From 8339b30ae2d56ed27c8d4f220230977d09fca2f1 Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik
Date: Tue, 3 Mar 2015 18:19:41 +0100
Subject: [PATCH 01/94] 8043937: Drop support for the IIOP transport from the
JMX RMIConnector
Reviewed-by: alanb, erikj
---
jdk/make/netbeans/jmx/build.xml | 42 +-
jdk/make/rmic/Rmic-java.management.gmk | 43 +-
.../sun/jmx/remote/internal/IIOPHelper.java | 190 --------
.../sun/jmx/remote/internal/IIOPProxy.java | 110 -----
.../remote/protocol/iiop/ClientProvider.java | 48 --
.../remote/protocol/iiop/IIOPProxyImpl.java | 157 -------
.../protocol/iiop/ProxyInputStream.java | 241 ----------
.../remote/protocol/iiop/ServerProvider.java | 51 ---
.../remote/JMXConnectorFactory.java | 6 +-
.../remote/JMXConnectorServerFactory.java | 6 +-
.../remote/rmi/NoCallStackClassLoader.java | 13 +-
.../remote/rmi/RMIConnectionImpl.java | 7 +-
.../management/remote/rmi/RMIConnector.java | 414 +-----------------
.../remote/rmi/RMIConnectorServer.java | 92 +---
.../remote/rmi/RMIIIOPServerImpl.java | 104 +----
.../management/remote/rmi/RMIServerImpl.java | 7 +-
.../javax/management/remote/rmi/package.html | 99 +----
.../mandatory/connection/CloseableTest.java | 2 -
.../remote/mandatory/connection/NoIIOP.java | 142 ------
19 files changed, 105 insertions(+), 1669 deletions(-)
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java
delete mode 100644 jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java
delete mode 100644 jdk/test/javax/management/remote/mandatory/connection/NoIIOP.java
diff --git a/jdk/make/netbeans/jmx/build.xml b/jdk/make/netbeans/jmx/build.xml
index 09c2cb25fb6..34e200f7190 100644
--- a/jdk/make/netbeans/jmx/build.xml
+++ b/jdk/make/netbeans/jmx/build.xml
@@ -63,8 +63,8 @@
-
@@ -90,44 +90,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jdk/make/rmic/Rmic-java.management.gmk b/jdk/make/rmic/Rmic-java.management.gmk
index 57b1d221ad8..9eca430ed63 100644
--- a/jdk/make/rmic/Rmic-java.management.gmk
+++ b/jdk/make/rmic/Rmic-java.management.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -32,38 +32,31 @@ include RmicCommon.gmk
# Generate RMI stubs
#
-# For RMI/IIOP call rmic a second time with -standardPackage option
-# so that *_tie classes are generated in package without the prefix
-# org.omg.stub (6375696)
JMX_RMI_CLASSES := javax.management.remote.rmi.RMIConnectionImpl \
javax.management.remote.rmi.RMIServerImpl
-GENRMIIIOPCLASSES :=
-ifneq ($(RMICONNECTOR_IIOP), false)
- GENRMIIIOPCLASSES := $(RMICONNECTOR_IIOP)
-endif
-$(eval $(call SetupRMICompilation,RMI_IIOP, \
- CLASSES := $(JMX_RMI_CLASSES), \
- CLASSES_DIR := $(CLASSES_DIR)/java.management, \
- STUB_CLASSES_DIR := $(STUB_CLASSES_DIR)/java.management, \
- RUN_V12 := true, \
- RUN_IIOP := $(GENRMIIIOPCLASSES), \
- RUN_IIOP_STDPKG := $(GENRMIIIOPCLASSES)))
-# Keep generated RMI/JRMP Stub source files and copy them to RMIC_GENSRC_DIR
-# so that javadoc can include them in the API (4997471)
-$(eval $(call SetupRMICompilation,RMI_SRC, \
+# Generate into gensrc dir where sources get picked up for javadoc, then move the classes
+# into the stub classes dir.
+$(eval $(call SetupRMICompilation,RMI_GEN, \
CLASSES := $(JMX_RMI_CLASSES), \
CLASSES_DIR := $(CLASSES_DIR)/java.management, \
- STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR)/java.management, \
+ STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR), \
RUN_V12 := true, \
- KEEP_GENERATED := true))
+ KEEP_GENERATED := true, \
+))
+
+# Find all classes generated and move them from the gensrc dir to the stub classes dir
+$(RMIC_GENSRC_DIR)/_classes.moved: $(RMI_GEN)
+ $(eval classfiles := $(shell $(FIND) $(RMIC_GENSRC_DIR) -name "*.class"))
+ $(foreach src, $(classfiles), \
+ $(eval target := $(patsubst $(RMIC_GENSRC_DIR)/%, \
+ $(STUB_CLASSES_DIR)/java.management/%, $(src))) \
+ $(MKDIR) -p $(dir $(target)) ; \
+ $(MV) $(src) $(target) $(NEWLINE))
+ $(TOUCH) $@
##########################################################################################
-$(RMIC_GENSRC_DIR)/_the.classes.removed: $(RMI_IIOP) $(RMI_SRC)
- $(FIND) $(RMIC_GENSRC_DIR) -name "*.class" $(FIND_DELETE)
- $(TOUCH) $@
-
-all: $(RMIC_GENSRC_DIR)/_the.classes.removed $(RMI_IIOP) $(RMI_SRC)
+all: $(RMIC_GENSRC_DIR)/_classes.moved $(RMI_GEN)
.PHONY: all
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java
deleted file mode 100644
index eabe73962c2..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.remote.internal;
-
-import java.util.Properties;
-import java.io.IOException;
-import java.rmi.Remote;
-import java.rmi.NoSuchObjectException;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * A helper class for RMI-IIOP and CORBA APIs.
- */
-
-public final class IIOPHelper {
- private IIOPHelper() { }
-
- // loads IIOPProxy implementation class if available
- private static final String IMPL_CLASS =
- "com.sun.jmx.remote.protocol.iiop.IIOPProxyImpl";
- private static final IIOPProxy proxy =
- AccessController.doPrivileged(new PrivilegedAction() {
- public IIOPProxy run() {
- try {
- Class> c = Class.forName(IMPL_CLASS, true,
- IIOPHelper.class.getClassLoader());
- return (IIOPProxy)c.newInstance();
- } catch (ClassNotFoundException cnf) {
- return null;
- } catch (InstantiationException e) {
- throw new AssertionError(e);
- } catch (IllegalAccessException e) {
- throw new AssertionError(e);
- }
- }});
-
- /**
- * Returns true if RMI-IIOP and CORBA is available.
- */
- public static boolean isAvailable() {
- return proxy != null;
- }
-
- private static void ensureAvailable() {
- if (proxy == null)
- throw new AssertionError("Should not here");
- }
-
- /**
- * Returns true if the given object is a Stub.
- */
- public static boolean isStub(Object obj) {
- return (proxy == null) ? false : proxy.isStub(obj);
- }
-
- /**
- * Returns the Delegate to which the given Stub delegates.
- */
- public static Object getDelegate(Object stub) {
- ensureAvailable();
- return proxy.getDelegate(stub);
- }
-
- /**
- * Sets the Delegate for a given Stub.
- */
- public static void setDelegate(Object stub, Object delegate) {
- ensureAvailable();
- proxy.setDelegate(stub, delegate);
- }
-
- /**
- * Returns the ORB associated with the given stub
- *
- * @throws UnsupportedOperationException
- * if the object does not support the operation that
- * was invoked
- */
- public static Object getOrb(Object stub) {
- ensureAvailable();
- return proxy.getOrb(stub);
- }
-
- /**
- * Connects the Stub to the given ORB.
- */
- public static void connect(Object stub, Object orb)
- throws IOException
- {
- if (proxy == null)
- throw new IOException("Connection to ORB failed, RMI/IIOP not available");
- proxy.connect(stub, orb);
- }
-
- /**
- * Returns true if the given object is an ORB.
- */
- public static boolean isOrb(Object obj) {
- return (proxy == null) ? false : proxy.isOrb(obj);
- }
-
- /**
- * Creates, and returns, a new ORB instance.
- */
- public static Object createOrb(String[] args, Properties props)
- throws IOException
- {
- if (proxy == null)
- throw new IOException("ORB initialization failed, RMI/IIOP not available");
- return proxy.createOrb(args, props);
- }
-
- /**
- * Converts a string, produced by the object_to_string method, back
- * to a CORBA object reference.
- */
- public static Object stringToObject(Object orb, String str) {
- ensureAvailable();
- return proxy.stringToObject(orb, str);
- }
-
- /**
- * Converts the given CORBA object reference to a string.
- */
- public static String objectToString(Object orb, Object obj) {
- ensureAvailable();
- return proxy.objectToString(orb, obj);
- }
-
- /**
- * Checks to ensure that an object of a remote or abstract interface
- * type can be cast to a desired type.
- */
- public static T narrow(Object narrowFrom, Class narrowTo) {
- ensureAvailable();
- return proxy.narrow(narrowFrom, narrowTo);
- }
-
- /**
- * Makes a server object ready to receive remote calls
- */
- public static void exportObject(Remote obj) throws IOException {
- if (proxy == null)
- throw new IOException("RMI object cannot be exported, RMI/IIOP not available");
- proxy.exportObject(obj);
- }
-
- /**
- * Deregisters a server object from the runtime.
- */
- public static void unexportObject(Remote obj) throws IOException {
- if (proxy == null)
- throw new NoSuchObjectException("Object not exported");
- proxy.unexportObject(obj);
- }
-
- /**
- * Returns a stub for the given server object.
- */
- public static Remote toStub(Remote obj) throws IOException {
- if (proxy == null)
- throw new NoSuchObjectException("Object not exported");
- return proxy.toStub(obj);
- }
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java
deleted file mode 100644
index b7e2ef6fe4c..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.remote.internal;
-
-import java.util.Properties;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.NoSuchObjectException;
-
-/**
- * An interface to a subset of the RMI-IIOP and CORBA APIs to avoid a
- * static dependencies on the types defined by these APIs.
- */
-
-public interface IIOPProxy {
-
- /**
- * Returns true if the given object is a Stub.
- */
- boolean isStub(Object obj);
-
- /**
- * Returns the Delegate to which the given Stub delegates.
- */
- Object getDelegate(Object stub);
-
- /**
- * Sets the Delegate for a given Stub.
- */
- void setDelegate(Object stub, Object delegate);
-
- /**
- * Returns the ORB associated with the given stub
- *
- * @throws UnsupportedOperationException
- * if the object does not support the operation that
- * was invoked
- */
- Object getOrb(Object stub);
-
- /**
- * Connects the Stub to the given ORB.
- */
- void connect(Object stub, Object orb) throws RemoteException;
-
- /**
- * Returns true if the given object is an ORB.
- */
- boolean isOrb(Object obj);
-
- /**
- * Creates, and returns, a new ORB instance.
- */
- Object createOrb(String[] args, Properties props);
-
- /**
- * Converts a string, produced by the object_to_string method, back
- * to a CORBA object reference.
- */
- Object stringToObject(Object orb, String str);
-
- /**
- * Converts the given CORBA object reference to a string.
- */
- String objectToString(Object orb, Object obj);
-
- /**
- * Checks to ensure that an object of a remote or abstract interface
- * type can be cast to a desired type.
- */
- T narrow(Object narrowFrom, Class narrowTo);
-
- /**
- * Makes a server object ready to receive remote calls
- */
- void exportObject(Remote obj) throws RemoteException;
-
- /**
- * Deregisters a server object from the runtime.
- */
- void unexportObject(Remote obj) throws NoSuchObjectException;
-
- /**
- * Returns a stub for the given server object.
- */
- Remote toStub(Remote obj) throws NoSuchObjectException;
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java
deleted file mode 100644
index eeeb6715982..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.remote.protocol.iiop;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import javax.management.remote.JMXConnectorProvider;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.rmi.RMIConnector;
-
-public class ClientProvider implements JMXConnectorProvider {
-
- public JMXConnector newJMXConnector(JMXServiceURL serviceURL,
- Map environment)
- throws IOException {
- if (!serviceURL.getProtocol().equals("iiop")) {
- throw new MalformedURLException("Protocol not iiop: " +
- serviceURL.getProtocol());
- }
- return new RMIConnector(serviceURL, environment);
- }
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java
deleted file mode 100644
index b0fe91bf728..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2009,2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.remote.protocol.iiop;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.portable.Delegate;
-import javax.rmi.PortableRemoteObject;
-import javax.rmi.CORBA.Stub;
-
-import java.util.Properties;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.NoSuchObjectException;
-
-import com.sun.jmx.remote.internal.IIOPProxy;
-import java.io.SerializablePermission;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.Permissions;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.security.ProtectionDomain;
-
-/**
- * An implementation of IIOPProxy that simply delegates to the appropriate
- * RMI-IIOP and CORBA APIs.
- */
-
-public class IIOPProxyImpl implements IIOPProxy {
- // special ACC used to initialize the IIOP stub
- // the only allowed privilege is SerializablePermission("enableSubclassImplementation")
- private static final AccessControlContext STUB_ACC;
-
- static {
- Permissions p = new Permissions();
- p.add(new SerializablePermission("enableSubclassImplementation"));
- STUB_ACC = new AccessControlContext(
- new ProtectionDomain[]{
- new ProtectionDomain(null, p)
- }
- );
- }
-
- public IIOPProxyImpl() { }
-
- @Override
- public boolean isStub(Object obj) {
- return (obj instanceof Stub);
- }
-
- @Override
- public Object getDelegate(Object stub) {
- return ((Stub)stub)._get_delegate();
- }
-
- @Override
- public void setDelegate(Object stub, Object delegate) {
- ((Stub)stub)._set_delegate((Delegate)delegate);
- }
-
- @Override
- public Object getOrb(Object stub) {
- try {
- return ((Stub)stub)._orb();
- } catch (org.omg.CORBA.BAD_OPERATION x) {
- throw new UnsupportedOperationException(x);
- }
- }
-
- @Override
- public void connect(Object stub, Object orb)
- throws RemoteException
- {
- ((Stub)stub).connect((ORB)orb);
- }
-
- @Override
- public boolean isOrb(Object obj) {
- return (obj instanceof ORB);
- }
-
- @Override
- public Object createOrb(String[] args, Properties props) {
- return ORB.init(args, props);
- }
-
- @Override
- public Object stringToObject(Object orb, String str) {
- return ((ORB)orb).string_to_object(str);
- }
-
- @Override
- public String objectToString(Object orb, Object obj) {
- return ((ORB)orb).object_to_string((org.omg.CORBA.Object)obj);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public T narrow(Object narrowFrom, Class narrowTo) {
- return (T)PortableRemoteObject.narrow(narrowFrom, narrowTo);
- }
-
- @Override
- public void exportObject(Remote obj) throws RemoteException {
- PortableRemoteObject.exportObject(obj);
- }
-
- @Override
- public void unexportObject(Remote obj) throws NoSuchObjectException {
- PortableRemoteObject.unexportObject(obj);
- }
-
- @Override
- public Remote toStub(final Remote obj) throws NoSuchObjectException {
- if (System.getSecurityManager() == null) {
- return PortableRemoteObject.toStub(obj);
- } else {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction() {
-
- @Override
- public Remote run() throws Exception {
- return PortableRemoteObject.toStub(obj);
- }
- }, STUB_ACC);
- } catch (PrivilegedActionException e) {
- if (e.getException() instanceof NoSuchObjectException) {
- throw (NoSuchObjectException)e.getException();
- }
- throw new RuntimeException("Unexpected exception type", e.getException());
- }
- }
- }
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java
deleted file mode 100644
index e7fda6098eb..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.remote.protocol.iiop;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import org.omg.CORBA.Any;
-import org.omg.CORBA.Context;
-import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.portable.BoxedValueHelper;
-
-@SuppressWarnings({"deprecation", "rawtypes"})
-public class ProxyInputStream extends org.omg.CORBA_2_3.portable.InputStream {
- public ProxyInputStream(org.omg.CORBA.portable.InputStream in) {
- this.in = in;
- }
-
- public boolean read_boolean() {
- return in.read_boolean();
- }
-
- public char read_char() {
- return in.read_char();
- }
-
- public char read_wchar() {
- return in.read_wchar();
- }
-
- public byte read_octet() {
- return in.read_octet();
- }
-
- public short read_short() {
- return in.read_short();
- }
-
- public short read_ushort() {
- return in.read_ushort();
- }
-
- public int read_long() {
- return in.read_long();
- }
-
- public int read_ulong() {
- return in.read_ulong();
- }
-
- public long read_longlong() {
- return in.read_longlong();
- }
-
- public long read_ulonglong() {
- return in.read_ulonglong();
- }
-
- public float read_float() {
- return in.read_float();
- }
-
- public double read_double() {
- return in.read_double();
- }
-
- public String read_string() {
- return in.read_string();
- }
-
- public String read_wstring() {
- return in.read_wstring();
- }
-
- public void read_boolean_array(boolean[] value, int offset, int length) {
- in.read_boolean_array(value, offset, length);
- }
-
- public void read_char_array(char[] value, int offset, int length) {
- in.read_char_array(value, offset, length);
- }
-
- public void read_wchar_array(char[] value, int offset, int length) {
- in.read_wchar_array(value, offset, length);
- }
-
- public void read_octet_array(byte[] value, int offset, int length) {
- in.read_octet_array(value, offset, length);
- }
-
- public void read_short_array(short[] value, int offset, int length) {
- in.read_short_array(value, offset, length);
- }
-
- public void read_ushort_array(short[] value, int offset, int length) {
- in.read_ushort_array(value, offset, length);
- }
-
- public void read_long_array(int[] value, int offset, int length) {
- in.read_long_array(value, offset, length);
- }
-
- public void read_ulong_array(int[] value, int offset, int length) {
- in.read_ulong_array(value, offset, length);
- }
-
- public void read_longlong_array(long[] value, int offset, int length) {
- in.read_longlong_array(value, offset, length);
- }
-
- public void read_ulonglong_array(long[] value, int offset, int length) {
- in.read_ulonglong_array(value, offset, length);
- }
-
- public void read_float_array(float[] value, int offset, int length) {
- in.read_float_array(value, offset, length);
- }
-
- public void read_double_array(double[] value, int offset, int length) {
- in.read_double_array(value, offset, length);
- }
-
- public org.omg.CORBA.Object read_Object() {
- return in.read_Object();
- }
-
- public TypeCode read_TypeCode() {
- return in.read_TypeCode();
- }
-
- public Any read_any() {
- return in.read_any();
- }
-
- /**
- * @deprecated
- */
- @Override
- @Deprecated
- public org.omg.CORBA.Principal read_Principal() {
- return in.read_Principal();
- }
-
- @Override
- public int read() throws IOException {
- return in.read();
- }
-
- @Override
- public BigDecimal read_fixed() {
- return in.read_fixed();
- }
-
- @Override
- public Context read_Context() {
- return in.read_Context();
- }
-
- @Override
- public org.omg.CORBA.Object read_Object(java.lang.Class clz) {
- return in.read_Object(clz);
- }
-
- @Override
- public ORB orb() {
- return in.orb();
- }
-
- @Override
- public Serializable read_value() {
- return narrow().read_value();
- }
-
- @Override
- public Serializable read_value(Class clz) {
- return narrow().read_value(clz);
- }
-
- @Override
- public Serializable read_value(BoxedValueHelper factory) {
- return narrow().read_value(factory);
- }
-
- @Override
- public Serializable read_value(String rep_id) {
- return narrow().read_value(rep_id);
- }
-
- @Override
- public Serializable read_value(Serializable value) {
- return narrow().read_value(value);
- }
-
- @Override
- public Object read_abstract_interface() {
- return narrow().read_abstract_interface();
- }
-
- @Override
- public Object read_abstract_interface(Class clz) {
- return narrow().read_abstract_interface(clz);
- }
-
- protected org.omg.CORBA_2_3.portable.InputStream narrow() {
- if (in instanceof org.omg.CORBA_2_3.portable.InputStream)
- return (org.omg.CORBA_2_3.portable.InputStream) in;
- throw new NO_IMPLEMENT();
- }
-
- public org.omg.CORBA.portable.InputStream getProxiedInputStream() {
- return in;
- }
-
- protected final org.omg.CORBA.portable.InputStream in;
-}
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java
deleted file mode 100644
index 2f248f52a0e..00000000000
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.remote.protocol.iiop;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import javax.management.MBeanServer;
-import javax.management.remote.JMXConnectorServer;
-import javax.management.remote.JMXConnectorServerProvider;
-import javax.management.remote.JMXServiceURL;
-import javax.management.remote.rmi.RMIConnectorServer;
-
-public class ServerProvider implements JMXConnectorServerProvider {
-
- public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
- Map environment,
- MBeanServer mbeanServer)
- throws IOException {
- if (!serviceURL.getProtocol().equals("iiop")) {
- throw new MalformedURLException("Protocol not iiop: " +
- serviceURL.getProtocol());
- }
- return new RMIConnectorServer(serviceURL, environment, mbeanServer);
- }
-
-}
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java
index 2eb99d2b870..1458aca4c3b 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java
@@ -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
@@ -140,9 +140,7 @@ import sun.reflect.misc.ReflectUtil;
*
*
Every implementation must support the RMI connector protocol with
* the default RMI transport, specified with string rmi.
- * An implementation may optionally support the RMI connector protocol
- * with the RMI/IIOP transport, specified with the string
- * iiop.
+ *
*
*
Once a provider is found, the result of the
* newJMXConnector method is the result of calling {@link
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java
index bdaa4e7f1fd..2bfae84c688 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java
@@ -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
@@ -131,9 +131,7 @@ import javax.management.MBeanServer;
*
*
Every implementation must support the RMI connector protocol with
* the default RMI transport, specified with string rmi.
- * An implementation may optionally support the RMI connector protocol
- * with the RMI/IIOP transport, specified with the string
- * iiop.
+ *
*
*
Once a provider is found, the result of the
* newJMXConnectorServer method is the result of calling
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
index e8addac66fe..8a0882f5369 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, 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
@@ -31,12 +31,11 @@ import java.security.ProtectionDomain;
A class loader that only knows how to define a limited number
of classes, and load a limited number of other classes through
delegation to another loader. It is used to get around a problem
- with Serialization, in particular as used by RMI (including
- RMI/IIOP). The JMX Remote API defines exactly what class loader
- must be used to deserialize arguments on the server, and return
- values on the client. We communicate this class loader to RMI by
- setting it as the context class loader. RMI uses the context
- class loader to load classes as it deserializes, which is what we
+ with Serialization, in particular as used by RMI. The JMX Remote API
+ defines exactly what class loader must be used to deserialize arguments on
+ the server, and return values on the client. We communicate this class
+ loader to RMI by setting it as the context class loader. RMI uses the
+ context class loader to load classes as it deserializes, which is what we
want. However, before consulting the context class loader, it
looks up the call stack for a class with a non-null class loader,
and uses that if it finds one. So, in the standalone version of
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
index 5fb3c9d0508..dd050e4ef9c 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, 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
@@ -76,11 +76,10 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
/**
* Constructs a new {@link RMIConnection}. This connection can be
- * used with either the JRMP or IIOP transport. This object does
+ * used with the JRMP transport. This object does
* not export itself: it is the responsibility of the caller to
* export it appropriately (see {@link
- * RMIJRMPServerImpl#makeClient(String,Subject)} and {@link
- * RMIIIOPServerImpl#makeClient(String,Subject)}.
+ * RMIJRMPServerImpl#makeClient(String,Subject)}).
*
* @param rmiServer The RMIServerImpl object for which this
* connection is created. The behavior is unspecified if this
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
index 9f256481711..4bd796e3e7a 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, 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
@@ -30,25 +30,21 @@ import com.sun.jmx.remote.internal.ClientCommunicatorAdmin;
import com.sun.jmx.remote.internal.ClientListenerInfo;
import com.sun.jmx.remote.internal.ClientNotifForwarder;
import com.sun.jmx.remote.internal.ProxyRef;
-import com.sun.jmx.remote.internal.IIOPHelper;
import com.sun.jmx.remote.util.ClassLogger;
import com.sun.jmx.remote.util.EnvHelp;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InvalidObjectException;
-import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.io.Serializable;
-import java.io.WriteAbortedException;
import java.lang.ref.WeakReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
-import java.rmi.MarshalException;
import java.rmi.MarshalledObject;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
@@ -61,13 +57,12 @@ import java.rmi.server.RemoteRef;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
-import java.security.PrivilegedActionException;
import java.security.ProtectionDomain;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Hashtable;
import java.util.Map;
-import java.util.Properties;
import java.util.Set;
import java.util.WeakHashMap;
import javax.management.Attribute;
@@ -146,22 +141,20 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* the RMI connector server with the given address.
*
*
The address can refer directly to the connector server,
- * using one of the following syntaxes:
An implementation may also recognize additional address
@@ -242,8 +235,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
/**
* @throws IOException if the connection could not be made because of a
- * communication problem, or in the case of the {@code iiop} protocol,
- * that RMI/IIOP is not supported
+ * communication problem
*/
public void connect() throws IOException {
connect(null);
@@ -251,8 +243,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
/**
* @throws IOException if the connection could not be made because of a
- * communication problem, or in the case of the {@code iiop} protocol,
- * that RMI/IIOP is not supported
+ * communication problem
*/
public synchronized void connect(Map environment)
throws IOException {
@@ -294,9 +285,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
if (checkStub) checkStub(stub, rmiServerImplStubClass);
- // Connect IIOP Stub if needed.
if (tracing) logger.trace("connect",idstr + " connecting stub...");
- stub = connectStub(stub,usemap);
idstr = (tracing?"["+this.toString()+"]":null);
// Calling newClient on the RMIServer stub.
@@ -307,18 +296,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
try {
connection = getConnection(stub, credentials, checkStub);
} catch (java.rmi.RemoteException re) {
- if (jmxServiceURL != null) {
- final String pro = jmxServiceURL.getProtocol();
- final String path = jmxServiceURL.getURLPath();
-
- if ("rmi".equals(pro) &&
- path.startsWith("/jndi/iiop:")) {
- MalformedURLException mfe = new MalformedURLException(
- "Protocol is rmi but JNDI scheme is iiop: " + jmxServiceURL);
- mfe.initCause(re);
- throw mfe;
- }
- }
throw re;
}
@@ -1413,13 +1390,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
if (ioe instanceof UnmarshalException) {
throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs
// fetch one by one with UnmarshalException
- } else if (ioe instanceof MarshalException) {
- // IIOP will throw MarshalException wrapping a NotSerializableException
- // when a server fails to serialize a response.
- MarshalException me = (MarshalException)ioe;
- if (me.detail instanceof NotSerializableException) {
- throw (NotSerializableException)me.detail;
- }
}
// Not serialization problem, return.
@@ -1654,9 +1624,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
throw new IOException("Failed to get a RMI stub: "+ne);
}
- // Connect IIOP Stub if needed.
- stub = connectStub(stub,env);
-
// Calling newClient on the RMIServer stub.
Object credentials = env.get(CREDENTIALS);
connection = stub.newClient(credentials);
@@ -1693,103 +1660,6 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
//--------------------------------------------------------------------
// Private stuff - Serialization
//--------------------------------------------------------------------
- /**
- *
In order to be usable, an IIOP stub must be connected to an ORB.
- * The stub is automatically connected to the ORB if:
- *
- *
It was returned by the COS naming
- *
Its server counterpart has been registered in COS naming
- * through JNDI.
- *
- * Otherwise, it is not connected. A stub which is deserialized
- * from Jini is not connected. A stub which is obtained from a
- * non registered RMIIIOPServerImpl is not a connected.
- * A stub which is not connected can't be serialized, and thus
- * can't be registered in Jini. A stub which is not connected can't
- * be used to invoke methods on the server.
- *
- * In order to palliate this, this method will connect the
- * given stub if it is not yet connected. If the given
- * RMIServer is not an instance of
- * {@link javax.rmi.CORBA.Stub javax.rmi.CORBA.Stub}, then the
- * method do nothing and simply returns that stub. Otherwise,
- * this method will attempt to connect the stub to an ORB as
- * follows:
- *
- *
This method looks in the provided environment for
- * the "java.naming.corba.orb" property. If it is found, the
- * referenced object (an {@link org.omg.CORBA.ORB ORB}) is used to
- * connect the stub. Otherwise, a new org.omg.CORBA.ORB is created
- * by calling {@link
- * org.omg.CORBA.ORB#init(String[], Properties)
- * org.omg.CORBA.ORB.init((String[])null,(Properties)null)}
- *
The new created ORB is kept in a static
- * {@link WeakReference} and can be reused for connecting other
- * stubs. However, no reference is ever kept on the ORB provided
- * in the environment map, if any.
- *
- * @param rmiServer A RMI Server Stub.
- * @param environment An environment map, possibly containing an ORB.
- * @return the given stub.
- * @exception IllegalArgumentException if the
- * {@code java.naming.corba.orb} property is specified and
- * does not point to an {@link org.omg.CORBA.ORB ORB}.
- * @exception IOException if the connection to the ORB failed.
- **/
- static RMIServer connectStub(RMIServer rmiServer,
- Map environment)
- throws IOException {
- if (IIOPHelper.isStub(rmiServer)) {
- try {
- IIOPHelper.getOrb(rmiServer);
- } catch (UnsupportedOperationException x) {
- // BAD_OPERATION
- IIOPHelper.connect(rmiServer, resolveOrb(environment));
- }
- }
- return rmiServer;
- }
-
- /**
- * Get the ORB specified by environment, or create a
- * new one.
- *
This method looks in the provided environment for
- * the "java.naming.corba.orb" property. If it is found, the
- * referenced object (an {@link org.omg.CORBA.ORB ORB}) is
- * returned. Otherwise, a new org.omg.CORBA.ORB is created
- * by calling {@link
- * org.omg.CORBA.ORB#init(String[], java.util.Properties)
- * org.omg.CORBA.ORB.init((String[])null,(Properties)null)}
- *
The new created ORB is kept in a static
- * {@link WeakReference} and can be reused for connecting other
- * stubs. However, no reference is ever kept on the ORB provided
- * in the environment map, if any.
- * @param environment An environment map, possibly containing an ORB.
- * @return An ORB.
- * @exception IllegalArgumentException if the
- * {@code java.naming.corba.orb} property is specified and
- * does not point to an {@link org.omg.CORBA.ORB ORB}.
- * @exception IOException if the ORB initialization failed.
- **/
- static Object resolveOrb(Map environment)
- throws IOException {
- if (environment != null) {
- final Object orb = environment.get(EnvHelp.DEFAULT_ORB);
- if (orb != null && !(IIOPHelper.isOrb(orb)))
- throw new IllegalArgumentException(EnvHelp.DEFAULT_ORB +
- " must be an instance of org.omg.CORBA.ORB.");
- if (orb != null) return orb;
- }
- final Object orb =
- (RMIConnector.orb==null)?null:RMIConnector.orb.get();
- if (orb != null) return orb;
-
- final Object newOrb =
- IIOPHelper.createOrb((String[])null, (Properties)null);
- RMIConnector.orb = new WeakReference
+ * rmi are described in the package documentation for
+ * {@link javax.management.remote.rmi}.
*
*
The behavior when the URL path is neither empty nor a JNDI
- * directory URL, or when the protocol is neither rmi
- * nor iiop, is implementation defined, and may
- * include throwing {@link MalformedURLException} when the
- * connector server is created or when it is started.
+ * directory URL, or when the protocol is not rmi,
+ * is implementation defined, and may include throwing
+ * {@link MalformedURLException} when the connector server is created
+ * or when it is started.
*
* @exception IllegalStateException if the connector server has
* not been attached to an MBean server.
* @exception IOException if the connector server cannot be
- * started, or in the case of the {@code iiop} protocol, that
- * RMI/IIOP is not supported.
+ * started.
*/
public synchronized void start() throws IOException {
final boolean tracing = logger.traceOn();
@@ -649,16 +641,13 @@ public class RMIConnectorServer extends JMXConnectorServer {
* Creates a new RMIServerImpl.
**/
RMIServerImpl newServer() throws IOException {
- final boolean iiop = isIiopURL(address,true);
final int port;
if (address == null)
port = 0;
else
port = address.getPort();
- if (iiop)
- return newIIOPServer(attributes);
- else
- return newJRMPServer(attributes, port);
+
+ return newJRMPServer(attributes, port);
}
/**
@@ -675,10 +664,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
final int port;
if (address == null) {
- if (IIOPHelper.isStub(rmiServer))
- protocol = "iiop";
- else
- protocol = "rmi";
+ protocol = "rmi";
host = null; // will default to local host name
port = 0;
} else {
@@ -692,31 +678,12 @@ public class RMIConnectorServer extends JMXConnectorServer {
address = new JMXServiceURL(protocol, host, port, urlPath);
}
- static boolean isIiopURL(JMXServiceURL directoryURL, boolean strict)
- throws MalformedURLException {
- String protocol = directoryURL.getProtocol();
- if (protocol.equals("rmi"))
- return false;
- else if (protocol.equals("iiop"))
- return true;
- else if (strict) {
-
- throw new MalformedURLException("URL must have protocol " +
- "\"rmi\" or \"iiop\": \"" +
- protocol + "\"");
- }
- return false;
- }
-
/**
* Returns the IOR of the given rmiServer.
**/
static String encodeStub(
RMIServer rmiServer, Map env) throws IOException {
- if (IIOPHelper.isStub(rmiServer))
- return "/ior/" + encodeIIOPStub(rmiServer, env);
- else
- return "/stub/" + encodeJRMPStub(rmiServer, env);
+ return "/stub/" + encodeJRMPStub(rmiServer, env);
}
static String encodeJRMPStub(
@@ -730,17 +697,6 @@ public class RMIConnectorServer extends JMXConnectorServer {
return byteArrayToBase64(bytes);
}
- static String encodeIIOPStub(
- RMIServer rmiServer, Map env)
- throws IOException {
- try {
- Object orb = IIOPHelper.getOrb(rmiServer);
- return IIOPHelper.objectToString(orb, rmiServer);
- } catch (RuntimeException x) {
- throw newIOException(x.getMessage(), x);
- }
- }
-
/**
* Object that we will bind to the registry.
* This object is a stub connected to our RMIServerImpl.
@@ -748,8 +704,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
private static RMIServer objectToBind(
RMIServerImpl rmiServer, Map env)
throws IOException {
- return RMIConnector.
- connectStub((RMIServer)rmiServer.toStub(),env);
+ return (RMIServer)rmiServer.toStub();
}
private static RMIServerImpl newJRMPServer(Map env, int port)
@@ -761,11 +716,6 @@ public class RMIConnectorServer extends JMXConnectorServer {
return new RMIJRMPServerImpl(port, csf, ssf, env);
}
- private static RMIServerImpl newIIOPServer(Map env)
- throws IOException {
- return new RMIIIOPServerImpl(env);
- }
-
private static String byteArrayToBase64(byte[] a) {
int aLen = a.length;
int numFullGroups = aLen/3;
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java
index 45be553e1f7..00b25b71d9e 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, 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
@@ -27,16 +27,9 @@ package javax.management.remote.rmi;
import java.io.IOException;
import java.rmi.Remote;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
import java.util.Map;
-import java.util.Collections;
import javax.security.auth.Subject;
-import com.sun.jmx.remote.internal.IIOPHelper;
-
/**
*
An {@link RMIServerImpl} that is exported through IIOP and that
* creates client connections as RMI objects exported through IIOP.
@@ -45,120 +38,59 @@ import com.sun.jmx.remote.internal.IIOPHelper;
* @see RMIServerImpl
*
* @since 1.5
+ * @deprecated This transport is no longer supported.
*/
+@Deprecated
public class RMIIIOPServerImpl extends RMIServerImpl {
/**
- *
Creates a new {@link RMIServerImpl}.
+ * Throws {@linkplain UnsupportedOperationException}
*
* @param env the environment containing attributes for the new
* RMIServerImpl. Can be null, which is equivalent
* to an empty Map.
*
- * @exception IOException if the RMI object cannot be created.
+ * @throws IOException if the RMI object cannot be created.
*/
public RMIIIOPServerImpl(Map env)
throws IOException {
super(env);
- this.env = (env == null) ? Collections.emptyMap() : env;
-
- callerACC = AccessController.getContext();
+ throw new UnsupportedOperationException();
}
+ @Override
protected void export() throws IOException {
- IIOPHelper.exportObject(this);
+ throw new UnsupportedOperationException("Method not supported. JMX RMI-IIOP is deprecated");
}
+ @Override
protected String getProtocol() {
return "iiop";
}
- /**
- *
Returns an IIOP stub.
- * The stub might not yet be connected to the ORB. The stub will
- * be serializable only if it is connected to the ORB.
- * @return an IIOP stub.
- * @exception IOException if the stub cannot be created - e.g the
- * RMIIIOPServerImpl has not been exported yet.
- **/
+ @Override
public Remote toStub() throws IOException {
- // javax.rmi.CORBA.Stub stub =
- // (javax.rmi.CORBA.Stub) PortableRemoteObject.toStub(this);
- final Remote stub = IIOPHelper.toStub(this);
- // java.lang.System.out.println("NON CONNECTED STUB " + stub);
- // org.omg.CORBA.ORB orb =
- // org.omg.CORBA.ORB.init((String[])null, (Properties)null);
- // stub.connect(orb);
- // java.lang.System.out.println("CONNECTED STUB " + stub);
- return stub;
+ throw new UnsupportedOperationException();
}
- /**
- *
Creates a new client connection as an RMI object exported
- * through IIOP.
- *
- * @param connectionId the ID of the new connection. Every
- * connection opened by this connector server will have a
- * different ID. The behavior is unspecified if this parameter is
- * null.
- *
- * @param subject the authenticated subject. Can be null.
- *
- * @return the newly-created RMIConnection.
- *
- * @exception IOException if the new client object cannot be
- * created or exported.
- */
+ @Override
protected RMIConnection makeClient(String connectionId, Subject subject)
throws IOException {
-
- if (connectionId == null)
- throw new NullPointerException("Null connectionId");
-
- RMIConnection client =
- new RMIConnectionImpl(this, connectionId, getDefaultClassLoader(),
- subject, env);
- IIOPHelper.exportObject(client);
- return client;
+ throw new UnsupportedOperationException();
}
+ @Override
protected void closeClient(RMIConnection client) throws IOException {
- IIOPHelper.unexportObject(client);
+ throw new UnsupportedOperationException();
}
- /**
- *
Called by {@link #close()} to close the connector server by
- * unexporting this object. After returning from this method, the
- * connector server must not accept any new connections.
- *
- * @exception IOException if the attempt to close the connector
- * server failed.
- */
+ @Override
protected void closeServer() throws IOException {
- IIOPHelper.unexportObject(this);
+ throw new UnsupportedOperationException();
}
@Override
RMIConnection doNewClient(final Object credentials) throws IOException {
- if (callerACC == null) {
- throw new SecurityException("AccessControlContext cannot be null");
- }
- try {
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public RMIConnection run() throws IOException {
- return superDoNewClient(credentials);
- }
- }, callerACC);
- } catch (PrivilegedActionException pae) {
- throw (IOException) pae.getCause();
- }
+ throw new UnsupportedOperationException();
}
-
- RMIConnection superDoNewClient(Object credentials) throws IOException {
- return super.doNewClient(credentials);
- }
-
- private final Map env;
- private final AccessControlContext callerACC;
}
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java
index 323f6bb2c2b..957a08e2535 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, 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
@@ -61,8 +61,7 @@ import javax.security.auth.Subject;
* or by instantiating {@link RMIConnector}.
*
*
This is an abstract class. Concrete subclasses define the
- * details of the client connection objects, such as whether they use
- * JRMP or IIOP.
+ * details of the client connection objects.
*
* @since 1.5
*/
@@ -307,7 +306,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
/**
*
Returns the protocol string for this object. The string is
- * rmi for RMI/JRMP and iiop for RMI/IIOP.
+ * rmi for RMI/JRMP.
*
* @return the protocol string for this object.
*/
diff --git a/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html b/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html
index 09b09a3021e..9669be24397 100644
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/package.html
@@ -2,7 +2,7 @@
See the dialog box (usually in upper left corner) for instructions
+
+
+
+
diff --git a/jdk/test/java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java b/jdk/test/java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java
new file mode 100644
index 00000000000..494369cd91a
--- /dev/null
+++ b/jdk/test/java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 6401700 6412803
+ @summary Tests that modal dialog is shown on the screen and
+iconified/restored correctly if some of its blocked windows are invisible
+ @author artem.ananiev: area=awt.modal
+ @run applet/manual=yesno InvisibleParentTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.TextArea;
+import java.awt.Window;
+
+public class InvisibleParentTest extends Applet
+{
+ public void init()
+ {
+ setLayout(new BorderLayout());
+
+ String[] instructions =
+ {
+ "If your system is Windows, press PASS button.",
+ "When the test starts two windows should appear: frame G1 and",
+ " dialog D1. Another one frame F1 should be minimized.",
+ " If the dialog is not shown (minimizied), press FAIL button.",
+ "Then minimize frame G1 and restore F1. If the dialog D1 is not",
+ " restored together with F1, press FAIL, else PASS"
+ };
+ Sysout.createDialogWithInstructions( instructions );
+ }
+
+ public void start ()
+ {
+ Button b;
+
+ setSize (200,200);
+ setVisible(true);
+ validate();
+
+ Component c = this;
+ while ((c != null) && !(c instanceof Window))
+ {
+ c = c.getParent();
+ }
+ if (c != null)
+ {
+ ((Window)c).setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+ }
+
+ Frame f1 = new Frame("F1");
+ f1.setBounds(100, 300, 100, 100);
+ f1.setVisible(true);
+ f1.setExtendedState(Frame.ICONIFIED);
+
+ Frame g1 = new Frame("G1");
+ g1.setBounds(150, 350, 100, 100);
+ g1.setVisible(true);
+
+ final Dialog d1 = new Dialog((Frame)null, "D1", Dialog.ModalityType.APPLICATION_MODAL);
+ d1.setBounds(200, 400, 100, 100);
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ d1.setVisible(true);
+ }
+ }).start();
+ }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
diff --git a/jdk/test/java/awt/PrintJob/Text/StringWidth.java b/jdk/test/java/awt/PrintJob/Text/StringWidth.java
index 6773b7f6f96..2990672613f 100644
--- a/jdk/test/java/awt/PrintJob/Text/StringWidth.java
+++ b/jdk/test/java/awt/PrintJob/Text/StringWidth.java
@@ -23,7 +23,6 @@
import java.awt.*;
import java.util.Properties;
-import sun.awt.*;
public class StringWidth extends Frame {
From 61cfd94c6c9502a3cdb04f4c6aae0e04a93246ab Mon Sep 17 00:00:00 2001
From: Shilpi Rastogi
Date: Tue, 8 Sep 2015 16:01:29 +0400
Subject: [PATCH 59/94] 8135176: Moving test from
javax/swing/plaf/basic/BasicHTML/4960629 to
test/javax/swing/plaf/basic/BasicHTML/4960629
Reviewed-by: azvegint, alexsch
---
.../javax/swing/plaf/basic/BasicHTML/4960629/bug4960629.java | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename jdk/{ => test}/javax/swing/plaf/basic/BasicHTML/4960629/bug4960629.java (100%)
diff --git a/jdk/javax/swing/plaf/basic/BasicHTML/4960629/bug4960629.java b/jdk/test/javax/swing/plaf/basic/BasicHTML/4960629/bug4960629.java
similarity index 100%
rename from jdk/javax/swing/plaf/basic/BasicHTML/4960629/bug4960629.java
rename to jdk/test/javax/swing/plaf/basic/BasicHTML/4960629/bug4960629.java
From 5ecb0a7e9edf1c54afb0badc4212def8bc2398e4 Mon Sep 17 00:00:00 2001
From: Shilpi Rastogi
Date: Wed, 9 Sep 2015 10:31:59 +0300
Subject: [PATCH 60/94] 8005914: [TEST_BUG] The last column header does not
contain "..."
Reviewed-by: alexsch, serb
---
.../JTableHeader/6442918/bug6442918a.java | 87 +++++++++++++++++++
jdk/test/javax/swing/regtesthelpers/Util.java | 39 +++++++++
2 files changed, 126 insertions(+)
create mode 100644 jdk/test/javax/swing/JTableHeader/6442918/bug6442918a.java
diff --git a/jdk/test/javax/swing/JTableHeader/6442918/bug6442918a.java b/jdk/test/javax/swing/JTableHeader/6442918/bug6442918a.java
new file mode 100644
index 00000000000..476ae0ec43e
--- /dev/null
+++ b/jdk/test/javax/swing/JTableHeader/6442918/bug6442918a.java
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 6442918 8005914
+ @summary Ensures that empty table headers do not show "..."
+ @author Shannon Hickey
+ @library ../../regtesthelpers
+ @build Util
+ @run main/manual bug6442918a
+ @requires os.family == "windows"
+*/
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.table.DefaultTableCellRenderer;
+
+
+public class bug6442918a {
+
+ public static void main(String[] args) throws Throwable, Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf"
+ + ".windows.WindowsLookAndFeel");
+ } catch (Exception e) {
+ // test is for Windows look and feel
+ throw new RuntimeException("Test is only for WLaF."
+ + e.getMessage());
+ }
+ runTest();
+ }
+ });
+ }
+
+ private static void runTest() {
+ JDialog dialog = Util
+ .createModalDialogWithPassFailButtons("Empty header showing \"...\"");
+ String[] columnNames = {"", "", "", "", "Testing"};
+ String[][] data = {{"1", "2", "3", "4", "5"}};
+ JTable table = new JTable(data, columnNames);
+ DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
+ int tableCellWidth = renderer.getFontMetrics(renderer.getFont())
+ .stringWidth("test");
+ table.setPreferredScrollableViewportSize(new Dimension(
+ 5 * tableCellWidth, 50));
+ JPanel p = new JPanel();
+ p.add(new JScrollPane(table));
+ dialog.add(p, BorderLayout.NORTH);
+ JTextArea area = new JTextArea();
+ String txt = "\nInstructions:\n\n";
+ txt += "Only the last column header should show \"...\".";
+ area.setText(txt);
+ dialog.add(new JScrollPane(area), BorderLayout.CENTER);
+ dialog.pack();
+ dialog.setVisible(true);
+ }
+}
diff --git a/jdk/test/javax/swing/regtesthelpers/Util.java b/jdk/test/javax/swing/regtesthelpers/Util.java
index 52fbf60a10d..534d99796ed 100644
--- a/jdk/test/javax/swing/regtesthelpers/Util.java
+++ b/jdk/test/javax/swing/regtesthelpers/Util.java
@@ -41,6 +41,7 @@ import java.util.concurrent.Callable;
*/
public class Util {
+
/**
* Convert a rectangle from coordinate system of Component c to
* screen coordinate system.
@@ -266,4 +267,42 @@ public class Util {
result.add(KeyEvent.VK_ALT);
return result;
}
+
+ /**
+ * Creates and returns a JDialog with two button, one that says pass,
+ * another that says fail. The fail button is wired to call
+ * uiTestFailed with failString and the pass
+ * button is wired to invoked uiTestPassed.
+ *
The content pane of the JDialog uses a BorderLayout with the
+ * buttons inside a horizontal box with filler between them and the
+ * pass button on the left.
+ *
The returned Dialog has not been packed, or made visible, it is
+ * up to the caller to do that (after putting in some useful components).
+ */
+ public static JDialog createModalDialogWithPassFailButtons(final String failString) {
+ JDialog retDialog = new JDialog();
+ Box buttonBox = Box.createHorizontalBox();
+ JButton passButton = new JButton("Pass");
+ JButton failButton = new JButton("Fail");
+
+ passButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ retDialog.dispose();
+ }
+ });
+ failButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ retDialog.dispose();
+ throw new RuntimeException("Test failed. " + failString);
+ }
+ });
+ retDialog.setTitle("Test");
+ retDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
+ buttonBox.add(passButton);
+ buttonBox.add(Box.createGlue());
+ buttonBox.add(failButton);
+ retDialog.getContentPane().add(buttonBox, BorderLayout.SOUTH);
+ retDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ return retDialog;
+ }
}
From cb34d07ae1c0cdccad13447abe8f9bcb09843aa5 Mon Sep 17 00:00:00 2001
From: Anton Nashatyrev
Date: Wed, 9 Sep 2015 19:10:38 +0300
Subject: [PATCH 61/94] 8081485: EDT auto shutdown is broken in case of new
event queue usage
Reviewed-by: serb, alexp
---
.../share/classes/java/awt/EventQueue.java | 12 +-
.../EventQueuePushAutoshutdown.java | 75 +++++++++
.../EventQueuePushAutoshutdown.sh | 159 ++++++++++++++++++
3 files changed, 241 insertions(+), 5 deletions(-)
create mode 100644 jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.java
create mode 100644 jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh
diff --git a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java
index 620c3c4ece8..ae728fe295f 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java
@@ -899,11 +899,13 @@ public class EventQueue {
}
}
- // Wake up EDT waiting in getNextEvent(), so it can
- // pick up a new EventQueue. Post the waking event before
- // topQueue.nextQueue is assigned, otherwise the event would
- // go newEventQueue
- topQueue.postEventPrivate(new InvocationEvent(topQueue, dummyRunnable));
+ if (topQueue.dispatchThread != null) {
+ // Wake up EDT waiting in getNextEvent(), so it can
+ // pick up a new EventQueue. Post the waking event before
+ // topQueue.nextQueue is assigned, otherwise the event would
+ // go newEventQueue
+ topQueue.postEventPrivate(new InvocationEvent(topQueue, dummyRunnable));
+ }
newEventQueue.previousQueue = topQueue;
topQueue.nextQueue = newEventQueue;
diff --git a/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.java b/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.java
new file mode 100644
index 00000000000..b1c0237c4bf
--- /dev/null
+++ b/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ test
+ @bug 8081485
+ @summary tests that a program terminates automatically after EventQueue.push()
+ @author Anton Nashatyrev : area=toolkit
+*/
+
+import java.awt.*;
+
+public class EventQueuePushAutoshutdown implements Runnable {
+ private volatile int status = 2;
+
+ public EventQueuePushAutoshutdown() throws Exception {
+ Runtime.getRuntime().addShutdownHook(new Thread(this));
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ status = 0;
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } finally {
+ status = 1;
+ System.exit(status);
+ }
+ }
+ };
+ thread.setDaemon(true);
+ thread.start();
+
+ System.setProperty("java.awt.headless", "true");
+ final EventQueue systemQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ systemQueue.push(new EventQueue());
+ EventQueue.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ System.out.println("Activated EDT");
+ }
+ });
+ System.out.println("After EDT activation");
+ }
+
+ public static void main(String[] args) throws Exception {
+ new EventQueuePushAutoshutdown();
+ }
+
+ @Override
+ public void run() {
+ Runtime.getRuntime().halt(status);
+ }
+}
diff --git a/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh b/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh
new file mode 100644
index 00000000000..b88becb681c
--- /dev/null
+++ b/jdk/test/java/awt/Toolkit/AutoShutdown/EventQueuePush/EventQueuePushAutoshutdown.sh
@@ -0,0 +1,159 @@
+#!/bin/ksh -p
+
+#
+# Copyright (c) 20015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# @test EventQueuePushAutoshutdown.sh
+# @bug 8081485
+# @summary tests that a program terminates automatically
+# after EventQueue.push()
+# @author Anton Nashatyrev : area=toolkit
+#
+# @compile EventQueuePushAutoshutdown.java
+# @run shell EventQueuePushAutoshutdown.sh
+
+
+# Beginning of subroutines:
+status=1
+
+#Call this from anywhere to fail the test with an error message
+# usage: fail "reason why the test failed"
+fail()
+ { echo "The test failed :-("
+ echo "$*" 1>&2
+ echo "exit status was $status"
+ exit $status
+ } #end of fail()
+
+#Call this from anywhere to pass the test with a message
+# usage: pass "reason why the test passed if applicable"
+pass()
+ { echo "The test passed!!!"
+ echo "$*" 1>&2
+ exit 0
+ } #end of pass()
+
+# end of subroutines
+
+
+# The beginning of the script proper
+OS=`uname -s`
+case "$OS" in
+ SunOS | Linux | Darwin | CYGWIN* )
+ FILESEP="/"
+ ;;
+
+ Windows_95 | Windows_98 | Windows_NT | Windows_ME )
+ FILESEP="\\"
+ ;;
+
+ # catch all other OSs
+ * )
+ echo "Unrecognized system! $OS"
+ fail "Unrecognized system! $OS"
+ ;;
+esac
+
+
+# Want this test to run standalone as well as in the harness, so do the
+# following to copy the test's directory into the harness's scratch directory
+# and set all appropriate variables:
+
+if [ -z "${TESTJAVA}" ] ; then
+ # TESTJAVA is not set, so the test is running stand-alone.
+ # TESTJAVA holds the path to the root directory of the build of the JDK
+ # to be tested. That is, any java files run explicitly in this shell
+ # should use TESTJAVA in the path to the java interpreter.
+ # So, we'll set this to the JDK spec'd on the command line. If none
+ # is given on the command line, tell the user that and use a cheesy
+ # default.
+ # THIS IS THE JDK BEING TESTED.
+ if [ -n "$1" ] ;
+ then TESTJAVA=$1
+ else fail "no JDK specified on command line!"
+ fi
+ TESTSRC=.
+ TESTCLASSES=.
+ STANDALONE=1;
+fi
+echo "JDK under test is: $TESTJAVA"
+
+#Deal with .class files:
+if [ -n "${STANDALONE}" ] ;
+ then
+ #if standalone, remind user to cd to dir. containing test before running it
+ echo "Just a reminder: cd to the dir containing this test when running it"
+ # then compile all .java files (if there are any) into .class files
+ if [ -a *.java ] ;
+ then echo "Reminder, this test should be in its own directory with all"
+ echo "supporting files it needs in the directory with it."
+ ${TESTJAVA}/bin/javac ./*.java ;
+ fi
+ # else in harness so copy all the class files from where jtreg put them
+ # over to the scratch directory this test is running in.
+ else cp ${TESTCLASSES}/*.class . ;
+fi
+
+#if in test harness, then copy the entire directory that the test is in over
+# to the scratch directory. This catches any support files needed by the test.
+if [ -z "${STANDALONE}" ] ;
+ then cp ${TESTSRC}/* .
+fi
+
+#Just before executing anything, make sure it has executable permission!
+chmod 777 ./*
+
+############### YOUR TEST CODE HERE!!!!!!! #############
+
+#All files required for the test should be in the same directory with
+# this file. If converting a standalone test to run with the harness,
+# as long as all files are in the same directory and it returns 0 for
+# pass, you should be able to cut and paste it into here and it will
+# run with the test harness.
+
+${TESTJAVA}/bin/java EventQueuePushAutoshutdown
+
+############### END YOUR TEST CODE !!!!! ############
+#Be sure the last command executed above this line returns 0 for success,
+# something non-zero for failure.
+status=$?
+
+# pass or fail the test based on status of the command
+case "$status" in
+ 0 )
+ pass ""
+ ;;
+
+ 1 )
+ fail "The program didn't automatically shut down"
+ ;;
+
+ * )
+ fail "The program terminated unexpectedly!"
+ ;;
+esac
+
+#For additional examples of how to write platform independent KSH scripts,
+# see the jtreg file itself. It is a KSH script for both Solaris and Win32
+
From 08da3be647ff911b81ec1359908b52e769bb06b5 Mon Sep 17 00:00:00 2001
From: Rajeev Chamyal
Date: Thu, 10 Sep 2015 17:02:30 +0400
Subject: [PATCH 62/94] 8032568: Test
javax/swing/JInternalFrame/8020708/bug8020708.java fails on Windows virtual
hosts
Reviewed-by: serb, alexsch
---
.../swing/JInternalFrame/8020708/bug8020708.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java b/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java
index 9aaa5afe2e0..3a3f82b0fe8 100644
--- a/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java
+++ b/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java
@@ -35,7 +35,7 @@ import javax.swing.UIManager;
/**
* @test
- * @bug 8020708
+ * @bug 8020708 8032568
* @author Alexander Scherbatiy
* @summary NLS: mnemonics missing in SwingSet2/JInternalFrame demo
* @library ../../regtesthelpers
@@ -111,8 +111,14 @@ public class bug8020708 {
Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_SPACE);
robot.waitForIdle();
-
- Util.hitKeys(robot, KeyEvent.VK_C);
+ int keyCode = KeyEvent.VK_C;
+ String mnemonic = UIManager
+ .getString("InternalFrameTitlePane.closeButton.mnemonic");
+ try {
+ keyCode = Integer.parseInt(mnemonic);
+ } catch (NumberFormatException e) {
+ }
+ Util.hitKeys(robot, keyCode);
robot.waitForIdle();
robot.delay(500);
From cedeb8472535f0dc76f334e26f48ae869dbd3959 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov
Date: Fri, 11 Sep 2015 15:03:53 +0300
Subject: [PATCH 63/94] 7131835: [TEST_BUG] Test does not consider that the
rounded edges of the window in Mac OS 10.7
Reviewed-by: azvegint, yan
---
jdk/test/sun/java2d/OpenGL/CopyAreaOOB.java | 146 ++++++++++++++++++++
1 file changed, 146 insertions(+)
create mode 100644 jdk/test/sun/java2d/OpenGL/CopyAreaOOB.java
diff --git a/jdk/test/sun/java2d/OpenGL/CopyAreaOOB.java b/jdk/test/sun/java2d/OpenGL/CopyAreaOOB.java
new file mode 100644
index 00000000000..9129bb1d05d
--- /dev/null
+++ b/jdk/test/sun/java2d/OpenGL/CopyAreaOOB.java
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6430601
+ * @summary Verifies that copyArea() works properly when the
+ * destination parameters are outside the destination bounds.
+ * @run main/othervm CopyAreaOOB
+ * @run main/othervm -Dsun.java2d.opengl=True CopyAreaOOB
+ * @author campbelc
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class CopyAreaOOB extends Canvas {
+
+ private static boolean done;
+
+ public void paint(Graphics g) {
+ synchronized (this) {
+ if (done) {
+ return;
+ }
+ }
+
+ int w = getWidth();
+ int h = getHeight();
+
+ Graphics2D g2d = (Graphics2D)g;
+ g2d.setColor(Color.black);
+ g2d.fillRect(0, 0, w, h);
+
+ g2d.setColor(Color.green);
+ g2d.fillRect(0, 0, w, 10);
+
+ g2d.setColor(Color.red);
+ g2d.fillRect(0, 10, 50, h-10);
+
+ // copy the region such that part of it goes below the bottom of the
+ // destination surface
+ g2d.copyArea(0, 10, 50, h-10, 60, 10);
+
+ Toolkit.getDefaultToolkit().sync();
+
+ synchronized (this) {
+ done = true;
+ notifyAll();
+ }
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(400, 400);
+ }
+
+ private static void testRegion(BufferedImage bi, String name,
+ int x1, int y1, int x2, int y2,
+ int expected)
+ {
+ for (int y = y1; y < y2; y++) {
+ for (int x = x1; x < x2; x++) {
+ int actual = bi.getRGB(x, y);
+ if (actual != expected) {
+ throw new RuntimeException("Test failed for " + name +
+ " region at x="+x+" y="+y+
+ " (expected="+
+ Integer.toHexString(expected) +
+ " actual="+
+ Integer.toHexString(actual) +
+ ")");
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ boolean show = (args.length == 1) && ("-show".equals(args[0]));
+
+ CopyAreaOOB test = new CopyAreaOOB();
+ Frame frame = new Frame();
+ frame.setUndecorated(true);
+ frame.add(test);
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+
+ // Wait until the component's been painted
+ synchronized (test) {
+ while (!done) {
+ try {
+ test.wait();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Failed: Interrupted");
+ }
+ }
+ }
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {}
+
+ // Grab the screen region
+ BufferedImage capture = null;
+ try {
+ Robot robot = new Robot();
+ Point pt1 = test.getLocationOnScreen();
+ Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400);
+ capture = robot.createScreenCapture(rect);
+ } catch (Exception e) {
+ throw new RuntimeException("Problems creating Robot");
+ } finally {
+ if (!show) {
+ frame.dispose();
+ }
+ }
+
+ // Test pixels
+ testRegion(capture, "green", 0, 0, 400, 10, 0xff00ff00);
+ testRegion(capture, "original red", 0, 10, 50, 400, 0xffff0000);
+ testRegion(capture, "background", 50, 10, 60, 400, 0xff000000);
+ testRegion(capture, "in-between", 60, 10, 110, 20, 0xff000000);
+ testRegion(capture, "copied red", 60, 20, 110, 400, 0xffff0000);
+ testRegion(capture, "background", 110, 10, 400, 400, 0xff000000);
+ }
+}
From 9c7443b15a03dff5857f478ade4d58887e5b1dc6 Mon Sep 17 00:00:00 2001
From: Rajeev Chamyal
Date: Fri, 11 Sep 2015 17:12:16 +0400
Subject: [PATCH 64/94] 8025082: The behaviour of the highlight will be lost
after clicking the set button
Reviewed-by: serb, alexsch
---
.../javax/swing/text/DefaultCaret.java | 13 +++
.../javax/swing/JTextPane/bug8025082.java | 108 ++++++++++++++++++
2 files changed, 121 insertions(+)
create mode 100644 jdk/test/javax/swing/JTextPane/bug8025082.java
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java
index 729c62a964c..f474ac79add 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java
@@ -860,6 +860,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
Highlighter.HighlightPainter p = getSelectionPainter();
try {
selectionTag = h.addHighlight(p0, p1, p);
+ updateOwnsSelection();
} catch (BadLocationException bl) {
selectionTag = null;
}
@@ -870,6 +871,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
Highlighter h = component.getHighlighter();
h.removeHighlight(selectionTag);
selectionTag = null;
+ updateOwnsSelection();
}
}
}
@@ -1110,6 +1112,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
if (selectionTag != null) {
h.removeHighlight(selectionTag);
selectionTag = null;
+ updateOwnsSelection();
}
// otherwise, change or add the highlight
} else {
@@ -1120,6 +1123,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
Highlighter.HighlightPainter p = getSelectionPainter();
selectionTag = h.addHighlight(p0, p1, p);
}
+ updateOwnsSelection();
} catch (BadLocationException e) {
throw new StateInvariantError("Bad caret position");
}
@@ -1170,6 +1174,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
if (this.dot != dot || this.dotBias != dotBias ||
selectionTag != null || forceCaretPositionChange) {
changeCaretPosition(dot, dotBias);
+ updateOwnsSelection();
}
this.markBias = this.dotBias;
this.markLTR = dotLTR;
@@ -1177,6 +1182,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
if ((h != null) && (selectionTag != null)) {
h.removeHighlight(selectionTag);
selectionTag = null;
+ updateOwnsSelection();
}
}
@@ -1925,6 +1931,13 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
}
}
+ /**
+ * Updates ownsSelection based on text selection in the caret.
+ */
+ private void updateOwnsSelection() {
+ ownsSelection = (selectionTag != null)
+ && SwingUtilities2.canAccessSystemClipboard();
+ }
private class DefaultFilterBypass extends NavigationFilter.FilterBypass {
public Caret getCaret() {
diff --git a/jdk/test/javax/swing/JTextPane/bug8025082.java b/jdk/test/javax/swing/JTextPane/bug8025082.java
new file mode 100644
index 00000000000..1c92f763837
--- /dev/null
+++ b/jdk/test/javax/swing/JTextPane/bug8025082.java
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025082
+ * @summary The behaviour of the highlight will be lost after clicking the set
+ * button.
+ * @run main bug8025082
+ */
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import javax.swing.*;
+
+public class bug8025082 {
+
+ private static JButton button;
+ private static JFrame frame;
+
+ public static void main(String[] args) throws Exception {
+ Robot robo = new Robot();
+ robo.delay(500);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ createUI();
+ }
+ });
+
+ robo.waitForIdle();
+ Point point = getButtonLocationOnScreen();
+ robo.mouseMove(point.x, point.y);
+ robo.mousePress(InputEvent.BUTTON1_MASK);
+ robo.mouseRelease(InputEvent.BUTTON1_MASK);
+ robo.waitForIdle();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ }
+ });
+ }
+
+ private static void createUI() {
+ frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setSize(500, 500);
+ JTextPane textpane = new JTextPane();
+ textpane.setText("Select Me");
+ textpane.selectAll();
+
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.add(textpane, BorderLayout.CENTER);
+ button = new JButton("Press Me");
+ panel.add(button, BorderLayout.SOUTH);
+
+ button.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (!textpane.getCaret().isSelectionVisible()) {
+ throw new RuntimeException("Highlight removed after "
+ + "button click");
+ }
+ }
+ });
+
+ frame.getContentPane().add(panel);
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ }
+
+ private static Point getButtonLocationOnScreen() throws Exception {
+ final Point[] result = new Point[1];
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ Point point = button.getLocationOnScreen();
+ point.x += button.getWidth() / 2;
+ point.y += button.getHeight() / 2;
+ result[0] = point;
+ }
+ });
+ return result[0];
+ }
+}
From da688f57c3822e0327ad717290bed88baa73bd17 Mon Sep 17 00:00:00 2001
From: Pooja Chopra
Date: Fri, 11 Sep 2015 17:58:31 +0300
Subject: [PATCH 65/94] 8136354: [TEST_BUG] Test
java/awt/image/RescaleOp/RescaleAlphaTest.java with Bad action for script
Reviewed-by: azvegint, serb
---
jdk/test/java/awt/image/RescaleOp/RescaleAlphaTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jdk/test/java/awt/image/RescaleOp/RescaleAlphaTest.java b/jdk/test/java/awt/image/RescaleOp/RescaleAlphaTest.java
index b6b16eea158..39c6b8eeb2f 100644
--- a/jdk/test/java/awt/image/RescaleOp/RescaleAlphaTest.java
+++ b/jdk/test/java/awt/image/RescaleOp/RescaleAlphaTest.java
@@ -22,8 +22,8 @@
*/
/**
* @test
- * @bug 8080287
- * @run RescaleAlphaTest
+ * @bug 8080287 8136354
+ * @run main RescaleAlphaTest
* @summary RescaleOp with scaleFactor/alpha should copy alpha to destination
* channel
*/
From 20b057fc29bf0dbe275be018f5c5a7fece7e1d9a Mon Sep 17 00:00:00 2001
From: Weijun Wang
Date: Sun, 13 Sep 2015 10:55:58 +0800
Subject: [PATCH 66/94] 8136425: KeystoreImpl.m using wrong type for cert
format
Reviewed-by: vinnie
---
jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m b/jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m
index 179151440da..cdc39aa7923 100644
--- a/jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m
+++ b/jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m
@@ -508,7 +508,7 @@ JNF_COCOA_ENTER(env);
SecKeychainRef defaultKeychain = NULL;
SecKeychainCopyDefault(&defaultKeychain);
- SecExternalItemType dataType = (isCertificate == JNI_TRUE ? kSecFormatX509Cert : kSecFormatWrappedPKCS8);
+ SecExternalFormat dataFormat = (isCertificate == JNI_TRUE ? kSecFormatX509Cert : kSecFormatWrappedPKCS8);
// Convert the password obj into a CFStringRef that the keychain importer can use for encryption.
SecKeyImportExportParameters paramBlock;
@@ -533,7 +533,7 @@ JNF_COCOA_ENTER(env);
paramBlock.keyUsage = CSSM_KEYUSE_ANY;
paramBlock.keyAttributes = CSSM_KEYATTR_RETURN_DEFAULT;
- err = SecKeychainItemImport(cfDataToImport, NULL, &dataType, NULL,
+ err = SecKeychainItemImport(cfDataToImport, NULL, &dataFormat, NULL,
0, ¶mBlock, defaultKeychain, &createdItems);
if (err == noErr) {
From b6f5a1c457ee81e0243000fd2b8adcdbaf568a21 Mon Sep 17 00:00:00 2001
From: Ambarish Rapte
Date: Mon, 14 Sep 2015 18:54:04 +0400
Subject: [PATCH 67/94] 8039467: [TEST_BUG] Test
java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java lefts keystrokes
in a keyboard buffer on Windows
Reviewed-by: serb, alexsch
---
.../UnfocusableToplevel.java | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
index 9c3a56af5c4..bdde570b252 100644
--- a/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
+++ b/jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
@test
- @bug 6566434
+ @bug 6566434 8039467
@library ../../regtesthelpers
@build Util Sysout AbstractTest
@summary Choice in unfocusable window responds to keyboard
@@ -63,6 +63,18 @@ public class UnfocusableToplevel {
w.setLayout(new FlowLayout());
w.setSize(200, 200);
+ // Note that Window w is non focusable. Key press events will not be
+ // consumed by w, but by any previously focused window & this can
+ // disturb the environment. So creating tempFrameToHoldFocus frame,
+ // to consume key press events.
+ Frame tempFrameToHoldFocus = new Frame();
+ tempFrameToHoldFocus.setVisible(true);
+ Util.waitForIdle(robot);
+
+ tempFrameToHoldFocus.requestFocus();
+ Util.clickOnComp(tempFrameToHoldFocus, robot);
+ Util.waitForIdle(robot);
+
ch.addKeyListener(new KeyAdapter(){
public void keyTyped(KeyEvent e){
traceEvent("keytyped", e);
@@ -94,6 +106,10 @@ public class UnfocusableToplevel {
testKeys();
Util.waitForIdle(robot);
+
+ tempFrameToHoldFocus.dispose();
+ w.dispose();
+ f.dispose();
}
private static void testKeys(){
From f1f48ab0d390c3660639efcc43f4e6237cd4271b Mon Sep 17 00:00:00 2001
From: Artem Smotrakov
Date: Mon, 14 Sep 2015 19:49:28 +0300
Subject: [PATCH 68/94] 8134232: KeyStore.load() throws an IOException with a
wrong cause in case of wrong password
Reviewed-by: vinnie
---
.../com/sun/crypto/provider/JceKeyStore.java | 6 +-
.../sun/security/pkcs12/PKCS12KeyStore.java | 4 +-
.../sun/security/pkcs11/P11KeyStore.java | 19 +-
.../security/KeyStore/TestKeyStoreBasic.java | 183 +++++++++++++-----
.../security/provider/KeyStore/DKSTest.java | 43 +++-
5 files changed, 203 insertions(+), 52 deletions(-)
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java
index 0e3f1ed0566..ccf49b7a802 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, 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
@@ -864,7 +864,9 @@ public final class JceKeyStore extends KeyStoreSpi {
if (computed[i] != actual[i]) {
throw new IOException(
"Keystore was tampered with, or "
- + "password was incorrect");
+ + "password was incorrect",
+ new UnrecoverableKeyException(
+ "Password verification failed"));
}
}
}
diff --git a/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java
index 162191ec850..a0fa9c781ed 100644
--- a/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java
@@ -51,6 +51,8 @@ import java.security.spec.PKCS8EncodedKeySpec;
import java.util.*;
import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
import javax.crypto.spec.PBEParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
@@ -2060,7 +2062,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
}
if (!MessageDigest.isEqual(macData.getDigest(), macResult)) {
- throw new SecurityException("Failed PKCS12" +
+ throw new UnrecoverableKeyException("Failed PKCS12" +
" integrity checking");
}
} catch (Exception e) {
diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java
index 1fba98270e9..c630598f199 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, 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
@@ -750,6 +750,21 @@ final class P11KeyStore extends KeyStoreSpi {
} else {
login(new PasswordCallbackHandler(password));
}
+ } catch(LoginException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof PKCS11Exception) {
+ PKCS11Exception pe = (PKCS11Exception) cause;
+ if (pe.getErrorCode() == CKR_PIN_INCORRECT) {
+ // if password is wrong, the cause of the IOException
+ // should be an UnrecoverableKeyException
+ throw new IOException("load failed",
+ new UnrecoverableKeyException().initCause(e));
+ }
+ }
+ throw new IOException("load failed", e);
+ }
+
+ try {
if (mapLabels() == true) {
// CKA_LABELs are shared by multiple certs
writeDisabled = true;
@@ -757,7 +772,7 @@ final class P11KeyStore extends KeyStoreSpi {
if (debug != null) {
dumpTokenMap();
}
- } catch (LoginException | KeyStoreException | PKCS11Exception e) {
+ } catch (KeyStoreException | PKCS11Exception e) {
throw new IOException("load failed", e);
}
}
diff --git a/jdk/test/java/security/KeyStore/TestKeyStoreBasic.java b/jdk/test/java/security/KeyStore/TestKeyStoreBasic.java
index 00b46baf6a5..fe18a8943a5 100644
--- a/jdk/test/java/security/KeyStore/TestKeyStoreBasic.java
+++ b/jdk/test/java/security/KeyStore/TestKeyStoreBasic.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -21,36 +21,97 @@
* questions.
*/
-import static java.lang.System.out;
-
+import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyFactory;
import java.security.KeyStore;
import java.security.KeyStoreException;
-import java.security.Provider;
-import java.security.Security;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
+import java.security.NoSuchProviderException;
+import java.security.PrivateKey;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.KeySpec;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.util.Base64;
/*
* @test
- * @bug 8048621
- * @summary Test the basic operations of KeyStore, provided by SunJCE (jceks),
- * and SunPKCS11-Solaris(PKCS11KeyStore)
+ * @bug 8048621 8133090
+ * @summary Test basic operations with keystores (jks, jceks, pkcs12)
* @author Yu-Ching Valerie PENG
*/
-
public class TestKeyStoreBasic {
+
+ private static final String PRIVATE_KEY_PKCS8_BASE64 = ""
+ + "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpyz97liuWPDYcLH9TX8BiT78o"
+ + "lCmAfmevvch6ncXUVuCzbdaKuKXwn4EVbDszsVJLoK5zdtP+X3iDhutj+IgKmLhuczF3M9VIcWr+"
+ + "JJUyTH4+3h/RT8cjCDZOmk9iXkb5ifruVsLqzb9g+Vp140Oz7leikne7KmclHvTfvFd0WDI7Gb9v"
+ + "o4f5rT717BXJ/n+M6pNk8DLpLiEu6eziYvXRv5x+t5Go3x0eCXdaxEQUf2j876Wfr2qHRJK7lDfF"
+ + "e1DDsMg/KpKGiILYZ+g2qtVMZSxtp5BZEtfB5qV/IE5kWO+mCIAGpXSZIdbERR6pZUq8GLEe1T9e"
+ + "+sO6H24w2F19AgMBAAECggEBAId/12187dO6wUPCjumuJA1QrrBnbKdKONyai36uoc1Od4s5QFj7"
+ + "+hEIeS7rbGNYQuBvnkgusAbzkW0FIpxpHce3EJez/emux6pEOKoP77BwMt9gy+txyu0+BHi91FQg"
+ + "AGvrnQDO5EYVY4Cz/WjOsJzKu8zVLg+DS0Toa2qRFwmUe9mVAXPNOCZ3Oae/Q6tCDsaINNw0fmjj"
+ + "jn6uohPbS+n6xENG3FkQXB36getXy310xTGED2J27cmAQH6gLR6Kl2iROzNPbbpBqbuemI9kbcld"
+ + "EwBS1jRfZWeaPstYA1niVrE9UgUBzemnoh4TDkG076sYthHMr5QFGjPswnwtJ4ECgYEA0sURQ5+v"
+ + "baH4tdaemI3qpnknXTlzSpuZZmAoyvY0Id0mlduwKwmZ3Y5989wHfnnhFfyNO4IkTKjI2Wp97qP5"
+ + "4eqUNpA7FtNU7KUzMcFDTtwtNZuRYMrKlqo2lLbA+gVrAYpYZFL4b7tcwtX4DnYorDsmude6W8sG"
+ + "4Mx2VdFJC9UCgYEAzjsdXCYH5doWUHb0dvn9ID7IikffEMRM720MRjrnnnVbpzx6ACntkPDNZg7p"
+ + "TRE/mx7iBz81ZaUWE+V0wd0JvCHEdpAz3mksyvDFhU4Bgs6xzf2pSul5muhsx3hHcvvPezz5Bnxs"
+ + "faJlzkxfwotyGmvWN15GA/pyfsZjsbbTpwkCgYAO6NnbysQCIV8SnegCKqfatt9N/O5m7LLhRxQb"
+ + "p2bwrlA4cZ34rWkw/w9x3LK7A6wkfgUPnJkswxPSLXJTG05l6M4rPfCwIKr1Qopojp9QSMr569NQ"
+ + "4YeLOOc7heIIzbFQHpU6I5Rncv2Q2sn9W+ZsqJKIuvX34FjQNiZ406EzMQKBgHSxOGS61D84DuZK"
+ + "2Ps1awhC3kB4eHzJRms3vflDPWoJJ+pSKwpKrzUTPHXiPBqyhtYkPGszVeiE6CAr9sv3YZnFVaBs"
+ + "6hyQUJsob+uE/w/gGvXe8VsFDx0bJOodYfhrCbTHBHWqE81nBcocpxayxsayfAzqWB3KKd0YLrMR"
+ + "K2PZAoGAcZa8915R2m0KZ6HVJUt/JDR85jCbN71kcVDFY2XSFkOJvOdFoHNfRckfLzjq9Y2MSSTV"
+ + "+QDWbDo2doUQCejJUTaN8nP79tfyir24X5uVPvQaeVoGTKYb+LfUqK0F60lStmjuddIGSZH55y3v"
+ + "+9XjmxbVERtd1lqgQg3VlmKlEXY=";
+
+ /*
+ * Certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 7 (0x7)
+ * Signature Algorithm: sha512WithRSAEncryption
+ * Issuer: CN=Root
+ * Validity
+ * Not Before: Sep 1 18:03:59 2015 GMT
+ * Not After : Jan 17 18:03:59 2043 GMT
+ * Subject: CN=EE
+ */
+ private static final String CERTIFICATE = ""
+ + "-----BEGIN CERTIFICATE-----\n"
+ + "MIIDHTCCAgWgAwIBAgIBBzANBgkqhkiG9w0BAQ0FADAPMQ0wCwYDVQQDDARSb290\n"
+ + "MB4XDTE1MDkwMTE4MDM1OVoXDTQzMDExNzE4MDM1OVowDTELMAkGA1UEAwwCRUUw\n"
+ + "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpyz97liuWPDYcLH9TX8Bi\n"
+ + "T78olCmAfmevvch6ncXUVuCzbdaKuKXwn4EVbDszsVJLoK5zdtP+X3iDhutj+IgK\n"
+ + "mLhuczF3M9VIcWr+JJUyTH4+3h/RT8cjCDZOmk9iXkb5ifruVsLqzb9g+Vp140Oz\n"
+ + "7leikne7KmclHvTfvFd0WDI7Gb9vo4f5rT717BXJ/n+M6pNk8DLpLiEu6eziYvXR\n"
+ + "v5x+t5Go3x0eCXdaxEQUf2j876Wfr2qHRJK7lDfFe1DDsMg/KpKGiILYZ+g2qtVM\n"
+ + "ZSxtp5BZEtfB5qV/IE5kWO+mCIAGpXSZIdbERR6pZUq8GLEe1T9e+sO6H24w2F19\n"
+ + "AgMBAAGjgYUwgYIwNAYDVR0fBC0wKzApoCegJYYjbGRhcDovL2xkYXAuaG9zdC5m\n"
+ + "b3IuY3JsZHAvbWFpbi5jcmwwSgYIKwYBBQUHAQEEPjA8MDoGCCsGAQUFBzAChi5s\n"
+ + "ZGFwOi8vbGRhcC5ob3N0LmZvci5haWEvZGM9Um9vdD9jQUNlcnRpZmljYXRlMA0G\n"
+ + "CSqGSIb3DQEBDQUAA4IBAQBWDfZHpuUx0yn5d3+BuztFqoks1MkGdk+USlH0TB1/\n"
+ + "gWWBd+4S4PCKlpSur0gj2rMW4fP5HQfNlHci8JV8/bG4KuKRAXW56dg1818Hl3pc\n"
+ + "iIrUSRn8uUjH3p9qb+Rb/u3mmVQRyJjN2t/zceNsO8/+Dd808OB9aEwGs8lMT0nn\n"
+ + "ZYaaAqYz1GIY/Ecyx1vfEZEQ1ljo6i/r70C3igbypBUShxSiGsleiVTLOGNA+MN1\n"
+ + "/a/Qh0bkaQyTGqK3bwvzzMeQVqWu2EWTBD/PmND5ExkpRICdv8LBVXfLnpoBr4lL\n"
+ + "hnxn9+e0Ah+t8dS5EKfn44w5bI5PCu2bqxs6RCTxNjcY\n"
+ + "-----END CERTIFICATE-----\n";
+
private static final char[] PASSWD2 = new char[] {
'b', 'o', 'r', 'e', 'd'
};
- private static final char[] PASSWDK = new String("cannot be null")
+ private static final char[] PASSWDK = "cannot be null"
.toCharArray();
private static final String[] KS_Type = {
"jks", "jceks", "pkcs12", "PKCS11KeyStore"
};
- private static final String[] PRO_TYPE = {
+ private static final String[] PROVIDERS = {
"SUN", "SunJCE", "SunJSSE", "SunPKCS11-Solaris"
};
private static final String ALIAS_HEAD = "test";
@@ -61,41 +122,58 @@ public class TestKeyStoreBasic {
}
public void run() throws Exception {
- Provider[] providers = Security.getProviders();
- for (Provider p: providers) {
- String prvName = p.getName();
- if (prvName.startsWith("SunJCE")
- || prvName.startsWith("SunPKCS11-Solaris")) {
- try {
- runTest(p);
- out.println("Test with provider " + p.getName() + ""
- + " passed");
- } catch (java.security.KeyStoreException e) {
- if (prvName.startsWith("SunPKCS11-Solaris")) {
- out.println("KeyStoreException is expected "
- + "PKCS11KeyStore is invalid keystore type.");
- e.printStackTrace();
- } else {
- throw e;
- }
+ for (String provider : PROVIDERS) {
+ try {
+ runTest(provider);
+ System.out.println("Test with provider " + provider + "passed");
+ } catch (java.security.KeyStoreException e) {
+ if (provider.equals("SunPKCS11-Solaris")) {
+ System.out.println("KeyStoreException is expected: "
+ + "PKCS11KeyStore is invalid keystore type: " + e);
+ } else {
+ throw e;
+ }
+ } catch (NoSuchProviderException e) {
+ String osName = System.getProperty("os.name");
+ if (provider.equals("SunPKCS11-Solaris")
+ && !osName.equals("SunOS")) {
+ System.out.println("Skip SunPKCS11-Solaris provider on "
+ + osName);
+ } else {
+ throw e;
}
}
}
}
- public void runTest(Provider p) throws Exception {
- SecretKey key = new SecretKeySpec(
- new String("No one knows").getBytes(), "PBE");
+ public void runTest(String provider) throws Exception {
+
+ // load private key
+ // all keystore types should support private keys
+ KeySpec spec = new PKCS8EncodedKeySpec(
+ Base64.getMimeDecoder().decode(PRIVATE_KEY_PKCS8_BASE64));
+ PrivateKey privateKey = KeyFactory.getInstance("RSA")
+ .generatePrivate(spec);
+
+ // load x509 certificate
+ Certificate cert;
+ try (InputStream is = new BufferedInputStream(
+ new ByteArrayInputStream(CERTIFICATE.getBytes()))) {
+ cert = CertificateFactory.getInstance("X.509")
+ .generateCertificate(is);
+ }
+
int numEntries = 5;
- String proName = p.getName();
String type = null;
- for (int i = 0; i < PRO_TYPE.length; i++) {
- if (proName.compareTo(PRO_TYPE[i]) == 0) {
+ for (int i = 0; i < PROVIDERS.length; i++) {
+ if (provider.compareTo(PROVIDERS[i]) == 0) {
type = KS_Type[i];
break;
}
}
- KeyStore ks = KeyStore.getInstance(type, p);
+
+ System.out.printf("Test %s provider and %s keystore%n", provider, type);
+ KeyStore ks = KeyStore.getInstance(type, provider);
KeyStore ks2 = KeyStore.getInstance(type, ks.getProvider().getName());
// create an empty key store
@@ -103,7 +181,8 @@ public class TestKeyStoreBasic {
// store the secret keys
for (int j = 0; j < numEntries; j++) {
- ks.setKeyEntry(ALIAS_HEAD + j, key, PASSWDK, null);
+ ks.setKeyEntry(ALIAS_HEAD + j, privateKey, PASSWDK,
+ new Certificate[] { cert });
}
// initialize the 2nd key store object with the 1st one
@@ -134,13 +213,18 @@ public class TestKeyStoreBasic {
throw new RuntimeException(
"ERROR: passed the loading with incorrect password");
} catch (IOException ex) {
+ System.out.println("Expected exception: " + ex);
+ if (!causedBy(ex, UnrecoverableKeyException.class)) {
+ ex.printStackTrace(System.out);
+ throw new RuntimeException("Unexpected cause");
+ }
+ System.out.println("Expected cause: "
+ + UnrecoverableKeyException.class.getName());
+
bais.reset();
ks.load(bais, PASSWD2);
bais.reset();
ks.load(bais, null);
- } finally {
- bais.close();
- baos.close();
}
// check key store type
@@ -158,7 +242,6 @@ public class TestKeyStoreBasic {
private void checkType(KeyStore obj, String type) {
if (!obj.getType().equals(type)) {
throw new RuntimeException("ERROR: wrong key store type");
-
}
}
@@ -168,7 +251,6 @@ public class TestKeyStoreBasic {
if (!obj.containsAlias(ALIAS_HEAD + k)) {
throw new RuntimeException("ERROR: alias (" + k
+ ") should exist");
-
}
}
}
@@ -176,16 +258,25 @@ public class TestKeyStoreBasic {
// compare the creation dates - true if all the same
private void compareCreationDate(KeyStore o1, KeyStore o2, int range)
throws KeyStoreException {
- boolean result = true;
- String alias = null;
+ String alias;
for (int k = 0; k < range; k++) {
alias = ALIAS_HEAD + k;
if (!o1.getCreationDate(alias).equals(o2.getCreationDate(alias))) {
throw new RuntimeException("ERROR: entry creation time (" + k
+ ") differs");
-
}
}
}
+ // checks if an exception was caused by specified exception class
+ private static boolean causedBy(Exception e, Class klass) {
+ Throwable cause = e;
+ while ((cause = cause.getCause()) != null) {
+ if (cause.getClass().equals(klass)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
diff --git a/jdk/test/sun/security/provider/KeyStore/DKSTest.java b/jdk/test/sun/security/provider/KeyStore/DKSTest.java
index a11210e7d47..dc63e82ecbd 100644
--- a/jdk/test/sun/security/provider/KeyStore/DKSTest.java
+++ b/jdk/test/sun/security/provider/KeyStore/DKSTest.java
@@ -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.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,37 @@ public class DKSTest {
new KeyStore.PasswordProtection("passphrase".toCharArray()));
}};
+ private static final Map
+ WRONG_PASSWORDS = new HashMap() {{
+ put("policy_keystore",
+ new KeyStore.PasswordProtection(
+ "wrong".toCharArray()));
+ put("pw_keystore",
+ new KeyStore.PasswordProtection("wrong".toCharArray()));
+ put("eckeystore1",
+ new KeyStore.PasswordProtection("wrong".toCharArray()));
+ put("eckeystore2",
+ new KeyStore.PasswordProtection("wrong".toCharArray()));
+ }};
+
public static void main(String[] args) throws Exception {
+ /*
+ * domain keystore: keystores with wrong passwords
+ */
+ try {
+ URI config = new URI(CONFIG + "#keystores");
+ KeyStore ks = KeyStore.getInstance("DKS");
+ ks.load(new DomainLoadStoreParameter(config, WRONG_PASSWORDS));
+ throw new RuntimeException("Expected exception not thrown");
+ } catch (IOException e) {
+ System.out.println("Expected exception: " + e);
+ if (!causedBy(e, UnrecoverableKeyException.class)) {
+ e.printStackTrace(System.out);
+ throw new RuntimeException("Unexpected cause");
+ }
+ System.out.println("Expected cause: " + e);
+ }
+
/*
* domain keystore: system
*/
@@ -182,4 +212,15 @@ public class DKSTest {
return factory.generateCertificate(certStream);
}
}
+
+ // checks if an exception was caused by specified exception class
+ private static boolean causedBy(Exception e, Class klass) {
+ Throwable cause = e;
+ while ((cause = cause.getCause()) != null) {
+ if (cause.getClass().equals(klass)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
From b8e4ae847655ded044c87c43022b8b3909fd9a60 Mon Sep 17 00:00:00 2001
From: Artem Smotrakov
Date: Mon, 14 Sep 2015 19:54:58 +0300
Subject: [PATCH 69/94] 8048622: Enhance tests for PKCS11 keystores with NSS
Reviewed-by: vinnie
---
jdk/test/sun/security/pkcs11/PKCS11Test.java | 10 ++
.../security/pkcs11/Secmod/AddPrivateKey.java | 102 +++++++++---------
.../pkcs11/Secmod/AddTrustedCert.java | 46 +++++---
.../sun/security/pkcs11/Secmod/Crypto.java | 9 +-
.../security/pkcs11/Secmod/GetPrivateKey.java | 18 ++--
.../security/pkcs11/Secmod/LoadKeystore.java | 94 ++++++++++++++++
6 files changed, 200 insertions(+), 79 deletions(-)
create mode 100644 jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java
diff --git a/jdk/test/sun/security/pkcs11/PKCS11Test.java b/jdk/test/sun/security/pkcs11/PKCS11Test.java
index 1b4c281048a..6ee011a294d 100644
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java
@@ -33,6 +33,8 @@ import java.security.spec.ECParameterSpec;
public abstract class PKCS11Test {
+ static final String PKCS11 = "PKCS11";
+
// directory of the test source
static final String BASE = System.getProperty("test.src", ".");
@@ -644,4 +646,12 @@ public abstract class PKCS11Test {
return "";
}
}
+
+ static byte[] generateData(int length) {
+ byte data[] = new byte[length];
+ for (int i=0; i entries = new ArrayList();
- for (String alias : Collections.list(jks.aliases())) {
- if (jks.entryInstanceOf(alias, PrivateKeyEntry.class)) {
- PrivateKeyEntry entry = (PrivateKeyEntry)jks.getEntry(alias, new PasswordProtection(jkspass));
- String algorithm = entry.getPrivateKey().getAlgorithm();
- System.out.println("-Entry " + alias + " (" + algorithm + ")");
- if ((supportsEC == false) && algorithm.equals("EC")) {
- System.out.println("EC not supported by provider, skipping");
- continue;
- }
- if ((supportsEC == false) && algorithm.equals("DSA")) {
- System.out.println("Provider does not appear to have CKA_NETSCAPE_DB fix, skipping");
- continue;
- }
- test(p, entry);
- } // else ignore
+ try (InputStream in = new FileInputStream(BASE + SEP + "keystore.jks")) {
+ char[] jkspass = "passphrase".toCharArray();
+ jks.load(in, jkspass);
+ for (String alias : Collections.list(jks.aliases())) {
+ if (jks.entryInstanceOf(alias, PrivateKeyEntry.class)) {
+ PrivateKeyEntry entry = (PrivateKeyEntry)jks.getEntry(alias,
+ new PasswordProtection(jkspass));
+ String algorithm = entry.getPrivateKey().getAlgorithm();
+ System.out.printf("-Entry %s (%s)%n", alias, algorithm);
+ if ((supportsEC == false) && algorithm.equals("EC")) {
+ System.out.println("EC not supported by provider, "
+ + "skipping");
+ continue;
+ }
+ if ((supportsEC == false) && algorithm.equals("DSA")) {
+ System.out.println("Provider does not appear to have "
+ + "CKA_NETSCAPE_DB fix, skipping");
+ continue;
+ }
+ test(p, entry);
+ } // else ignore
+ }
}
System.out.println("OK");
}
@@ -92,10 +101,6 @@ public class AddPrivateKey extends SecmodTest {
return Collections.list(ks.aliases());
}
- private final static String ALIAS1 = "entry1";
- private final static String ALIAS2 = "entry2";
- private final static String ALIAS3 = "entry3";
-
private static void test(Provider p, PrivateKeyEntry entry) throws Exception {
PrivateKey key = entry.getPrivateKey();
X509Certificate[] chain = (X509Certificate[])entry.getCertificateChain();
@@ -122,11 +127,8 @@ public class AddPrivateKey extends SecmodTest {
PrivateKey key2 = (PrivateKey)ks.getKey(ALIAS1, null);
System.out.println(toString(key2));
- X509Certificate[] chain2 = (X509Certificate[])ks.getCertificateChain(ALIAS1);
- // NSS makes token keys always sensitive, skip this check
-// if (key.equals(key2) == false) {
-// throw new Exception("key mismatch");
-// }
+ X509Certificate[] chain2 =
+ (X509Certificate[]) ks.getCertificateChain(ALIAS1);
if (Arrays.equals(chain, chain2) == false) {
throw new Exception("chain mismatch");
}
@@ -154,7 +156,8 @@ public class AddPrivateKey extends SecmodTest {
PrivateKey key4 = (PrivateKey)ks.getKey(ALIAS2, null);
System.out.println(toString(key4));
- X509Certificate[] chain4 = (X509Certificate[])ks.getCertificateChain(ALIAS2);
+ X509Certificate[] chain4 = (X509Certificate[])
+ ks.getCertificateChain(ALIAS2);
if (Arrays.equals(chain, chain4) == false) {
throw new Exception("chain mismatch");
}
@@ -172,7 +175,8 @@ public class AddPrivateKey extends SecmodTest {
PrivateKey key5 = (PrivateKey)ks.getKey(ALIAS3, null);
System.out.println(toString(key5));
- X509Certificate[] chain5 = (X509Certificate[])ks.getCertificateChain(ALIAS3);
+ X509Certificate[] chain5 = (X509Certificate[])
+ ks.getCertificateChain(ALIAS3);
if (Arrays.equals(chain, chain5) == false) {
throw new Exception("chain mismatch");
}
@@ -186,24 +190,22 @@ public class AddPrivateKey extends SecmodTest {
System.out.println("OK");
}
- private final static byte[] DATA = new byte[4096];
-
- static {
- Random random = new Random();
- random.nextBytes(DATA);
- }
-
- private static void sign(Provider p, PrivateKey privateKey, PublicKey publicKey) throws Exception {
+ private static void sign(Provider p, PrivateKey privateKey,
+ PublicKey publicKey) throws Exception {
String keyAlg = privateKey.getAlgorithm();
String alg;
- if (keyAlg.equals("RSA")) {
- alg = "SHA1withRSA";
- } else if (keyAlg.equals("DSA")) {
- alg = "SHA1withDSA";
- } else if (keyAlg.equals("EC")) {
- alg = "SHA1withECDSA";
- } else {
- throw new Exception("Unknown algorithm " + keyAlg);
+ switch (keyAlg) {
+ case "RSA":
+ alg = "SHA1withRSA";
+ break;
+ case "DSA":
+ alg = "SHA1withDSA";
+ break;
+ case "EC":
+ alg = "SHA1withECDSA";
+ break;
+ default:
+ throw new Exception("Unknown algorithm " + keyAlg);
}
Signature s = Signature.getInstance(alg, p);
s.initSign(privateKey);
@@ -217,8 +219,6 @@ public class AddPrivateKey extends SecmodTest {
}
}
- private final static int MAX_LINE = 85;
-
private static String toString(Object o) {
String s = String.valueOf(o).split("\n")[0];
return (s.length() <= MAX_LINE) ? s : s.substring(0, MAX_LINE);
diff --git a/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java b/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java
index 1b3ff8194e7..6b2b545611a 100644
--- a/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java
+++ b/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,29 +44,47 @@ public class AddTrustedCert extends SecmodTest {
return;
}
- InputStream in = new FileInputStream(BASE + SEP + "anchor.cer");
- CertificateFactory factory = CertificateFactory.getInstance("X.509");
- X509Certificate cert = (X509Certificate)factory.generateCertificate(in);
- in.close();
-// System.out.println(cert);
+ X509Certificate cert;
+ try (InputStream in = new FileInputStream(BASE + SEP + "anchor.cer")) {
+ CertificateFactory factory =
+ CertificateFactory.getInstance("X.509");
+ cert = (X509Certificate)factory.generateCertificate(in);
+ }
String configName = BASE + SEP + "nss.cfg";
Provider p = getSunPKCS11(configName);
System.out.println(p);
Security.addProvider(p);
- KeyStore ks = KeyStore.getInstance("PKCS11", p);
+ KeyStore ks = KeyStore.getInstance(PKCS11, p);
ks.load(null, password);
- Collection aliases = new TreeSet(Collections.list(ks.aliases()));
+ Collection aliases = new TreeSet<>(Collections.list(
+ ks.aliases()));
System.out.println("entries: " + aliases.size());
System.out.println(aliases);
int size1 = aliases.size();
String alias = "anchor";
- ks.setCertificateEntry(alias, cert);
- ks.setCertificateEntry(alias, cert);
+ if (ks.containsAlias(alias)) {
+ throw new Exception("Alias exists: " + alias);
+ }
- aliases = new TreeSet(Collections.list(ks.aliases()));
+ ks.setCertificateEntry(alias, cert);
+ KeyStore.Entry first = ks.getEntry(alias, null);
+ System.out.println("first entry = " + first);
+ if (!ks.entryInstanceOf(alias, TrustedCertificateEntry.class)) {
+ throw new Exception("Unexpected first entry type: " + first);
+ }
+
+ ks.setCertificateEntry(alias, cert);
+ KeyStore.Entry second = ks.getEntry(alias, null);
+ System.out.println("second entry = " + second);
+ if (!ks.entryInstanceOf(alias, TrustedCertificateEntry.class)) {
+ throw new Exception("Unexpected second entry type: "
+ + second);
+ }
+
+ aliases = new TreeSet<>(Collections.list(ks.aliases()));
System.out.println("entries: " + aliases.size());
System.out.println(aliases);
int size2 = aliases.size();
@@ -79,8 +97,12 @@ public class AddTrustedCert extends SecmodTest {
throw new Exception("KeyStore returned incorrect certificate");
}
- System.out.println("OK");
+ ks.deleteEntry(alias);
+ if (ks.containsAlias(alias)) {
+ throw new Exception("Alias still exists: " + alias);
+ }
+ System.out.println("OK");
}
}
diff --git a/jdk/test/sun/security/pkcs11/Secmod/Crypto.java b/jdk/test/sun/security/pkcs11/Secmod/Crypto.java
index 39465f794d1..735149f1c84 100644
--- a/jdk/test/sun/security/pkcs11/Secmod/Crypto.java
+++ b/jdk/test/sun/security/pkcs11/Secmod/Crypto.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,11 +28,8 @@
* @author Andreas Sterbenz
* @library ..
* @run main/othervm Crypto
- * @key randomness
*/
-import java.util.*;
-
import java.security.*;
public class Crypto extends SecmodTest {
@@ -51,9 +48,7 @@ public class Crypto extends SecmodTest {
System.out.println(kp.getPublic());
System.out.println(kp.getPrivate());
- SecureRandom random = new SecureRandom();
- byte[] data = new byte[2048];
- random.nextBytes(data);
+ byte[] data = generateData(2048);
Signature sig = Signature.getInstance("SHA1withRSA", p);
sig.initSign(kp.getPrivate());
diff --git a/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java b/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java
index 2dd1ce69056..a2547652348 100644
--- a/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java
+++ b/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,11 @@
/**
* @test
* @bug 6273877 6322208 6275523
- * @summary make sure we can access the NSS softtoken KeyStore and use a private key
+ * @summary make sure we can access the NSS softtoken KeyStore
+ * and use a private key
* @author Andreas Sterbenz
* @library ..
* @run main/othervm GetPrivateKey
- * @key randomness
*/
import java.util.*;
@@ -49,18 +49,17 @@ public class GetPrivateKey extends SecmodTest {
System.out.println(p);
Security.addProvider(p);
- KeyStore ks = KeyStore.getInstance("PKCS11", p);
+ KeyStore ks = KeyStore.getInstance(PKCS11, p);
ks.load(null, password);
- Collection aliases = new TreeSet(Collections.list(ks.aliases()));
+ Collection aliases = new TreeSet<>(
+ Collections.list(ks.aliases()));
System.out.println("entries: " + aliases.size());
System.out.println(aliases);
PrivateKey privateKey = (PrivateKey)ks.getKey(keyAlias, password);
System.out.println(privateKey);
- byte[] data = new byte[1024];
- Random random = new Random();
- random.nextBytes(data);
+ byte[] data = generateData(1024);
System.out.println("Signing...");
Signature signature = Signature.getInstance("MD5withRSA");
@@ -68,7 +67,8 @@ public class GetPrivateKey extends SecmodTest {
signature.update(data);
byte[] sig = signature.sign();
- X509Certificate[] chain = (X509Certificate[])ks.getCertificateChain(keyAlias);
+ X509Certificate[] chain =
+ (X509Certificate[]) ks.getCertificateChain(keyAlias);
signature.initVerify(chain[0].getPublicKey());
signature.update(data);
boolean ok = signature.verify(sig);
diff --git a/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java b/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java
new file mode 100644
index 00000000000..fd1aa694ddf
--- /dev/null
+++ b/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.UnrecoverableKeyException;
+import java.util.Collections;
+
+/*
+ * @test
+ * @bug 8048622 8134232
+ * @summary Checks that PKCS#11 keystore can't be loaded with wrong password
+ * @library ../
+ * @run main/othervm LoadKeystore
+ */
+public class LoadKeystore extends SecmodTest {
+
+ public static void main(String[] args) throws Exception {
+ if (!initSecmod()) {
+ return;
+ }
+
+ String configName = BASE + SEP + "nss.cfg";
+ Provider p = getSunPKCS11(configName);
+
+ System.out.println("Add provider " + p);
+ System.out.println();
+ Security.addProvider(p);
+
+ try {
+ System.out.println("Load keystore with wrong type");
+ KeyStore.getInstance("unknown", p);
+ throw new RuntimeException("Expected exception not thrown");
+ } catch(KeyStoreException e) {
+ System.out.println("Expected exception: " + e);
+ }
+
+ KeyStore ks = KeyStore.getInstance("PKCS11", p);
+ if (!"PKCS11".equals(ks.getType())) {
+ throw new RuntimeException("Unexpected keystore type: "
+ + ks.getType());
+ }
+ if (!p.equals(ks.getProvider())) {
+ throw new RuntimeException("Unexpected keystore provider: "
+ + ks.getProvider());
+ }
+
+ try {
+ System.out.println("Load keystore with wrong password");
+ ks.load(null, "wrong".toCharArray());
+ throw new RuntimeException("Expected exception not thrown");
+ } catch(IOException e) {
+ System.out.println("Expected exception: " + e);
+ Throwable cause = e.getCause();
+ if (!(cause instanceof UnrecoverableKeyException)) {
+ e.printStackTrace(System.out);
+ throw new RuntimeException("Unexpected cause: " + cause);
+ }
+ System.out.println("Expected cause: " + cause);
+ }
+
+ System.out.println("Load keystore with correct password");
+ ks.load(null, password);
+ for (String alias : Collections.list(ks.aliases())) {
+ System.out.println("Alias: " + alias);
+ }
+
+ System.out.println("Test passed");
+ }
+
+}
From 9baa352891d052a46412e68c84fc2966099b73ed Mon Sep 17 00:00:00 2001
From: Phil Race
Date: Mon, 14 Sep 2015 10:56:55 -0700
Subject: [PATCH 70/94] 8136397: Build should recognise .cc file extension
Reviewed-by: ihse
---
make/common/NativeCompilation.gmk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
index bc9802263ad..adba62283a1 100644
--- a/make/common/NativeCompilation.gmk
+++ b/make/common/NativeCompilation.gmk
@@ -102,7 +102,7 @@ $(eval $(call DefineNativeToolchain, TOOLCHAIN_BUILD, \
################################################################################
# Extensions of files handled by this macro.
-NATIVE_SOURCE_EXTENSIONS := %.s %.c %.cpp %.m %.mm
+NATIVE_SOURCE_EXTENSIONS := %.s %.c %.cpp %.cc %.m %.mm
# Replaces native source extensions with the object file extension in a string.
# Param 1: the string containing source file names with extensions
@@ -167,7 +167,7 @@ define add_native_source
$1_$2_FLAGS=$8 -DTHIS_FILE='"$$(
Date: Tue, 15 Sep 2015 12:43:12 +0300
Subject: [PATCH 71/94] 8074931: Additional tests for CertPath API
Reviewed-by: mullan
---
.../security/cert/CertPathEncodingTest.java | 253 ++++++++
.../security/cert/X509CertSelectorTest.java | 538 ++++++++++++++++++
2 files changed, 791 insertions(+)
create mode 100644 jdk/test/java/security/cert/CertPathEncodingTest.java
create mode 100644 jdk/test/java/security/cert/X509CertSelectorTest.java
diff --git a/jdk/test/java/security/cert/CertPathEncodingTest.java b/jdk/test/java/security/cert/CertPathEncodingTest.java
new file mode 100644
index 00000000000..2bcfcc76824
--- /dev/null
+++ b/jdk/test/java/security/cert/CertPathEncodingTest.java
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.ByteArrayInputStream;
+import java.security.cert.CertPath;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 8074931
+ * @summary CertPathEncodingTest tests the ability of the CertPath and
+ * CertificateFactory to encode and decode CertPaths.
+ */
+public final class CertPathEncodingTest {
+ /*
+ Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 935438132 (0x37c1a734)
+ Signature Algorithm: dsaWithSHA1
+ Issuer: C=us, O=sun, OU=east, OU=bcn, CN=yassir
+ Validity
+ Not Before: Aug 23 19:55:32 1999 GMT
+ Not After : Aug 22 19:55:32 2000 GMT
+ Subject: C=us, O=sun, OU=east, OU=bcn
+ Subject Public Key Info:
+ Public Key Algorithm: dsaEncryption
+ pub:
+ 63:47:4f:f6:29:e5:98:a2:21:fd:da:97:9e:3f:ca:
+ b0:17:49:8d:8a:a7:06:0d:a6:78:97:39:59:33:72:
+ a2:a5:74:d5:3a:ef:e6:7c:07:d7:8e:8e:d1:66:73:
+ 99:14:04:96:f5:31:d6:72:ee:d2:53:f8:90:b5:f3:
+ c3:f1:64:ba:1a:9e:c0:0a:da:92:48:c5:d3:84:7e:
+ 48:09:66:d9:51:ba:74:56:5a:77:8a:8c:9a:9c:f6:
+ 84:12:61:12:51:dc:c6:4f:84:94:ec:cb:78:51:83:
+ 8c:20:8a:53:7b:d2:b6:36:df:50:35:95:1f:cb:50:
+ 55:8b:3f:fb:e2:77:cb
+ P:
+ 00:fd:7f:53:81:1d:75:12:29:52:df:4a:9c:2e:ec:
+ e4:e7:f6:11:b7:52:3c:ef:44:00:c3:1e:3f:80:b6:
+ 51:26:69:45:5d:40:22:51:fb:59:3d:8d:58:fa:bf:
+ c5:f5:ba:30:f6:cb:9b:55:6c:d7:81:3b:80:1d:34:
+ 6f:f2:66:60:b7:6b:99:50:a5:a4:9f:9f:e8:04:7b:
+ 10:22:c2:4f:bb:a9:d7:fe:b7:c6:1b:f8:3b:57:e7:
+ c6:a8:a6:15:0f:04:fb:83:f6:d3:c5:1e:c3:02:35:
+ 54:13:5a:16:91:32:f6:75:f3:ae:2b:61:d7:2a:ef:
+ f2:22:03:19:9d:d1:48:01:c7
+ Q:
+ 00:97:60:50:8f:15:23:0b:cc:b2:92:b9:82:a2:eb:
+ 84:0b:f0:58:1c:f5
+ G:
+ 00:f7:e1:a0:85:d6:9b:3d:de:cb:bc:ab:5c:36:b8:
+ 57:b9:79:94:af:bb:fa:3a:ea:82:f9:57:4c:0b:3d:
+ 07:82:67:51:59:57:8e:ba:d4:59:4f:e6:71:07:10:
+ 81:80:b4:49:16:71:23:e8:4c:28:16:13:b7:cf:09:
+ 32:8c:c8:a6:e1:3c:16:7a:8b:54:7c:8d:28:e0:a3:
+ ae:1e:2b:b3:a6:75:91:6e:a3:7f:0b:fa:21:35:62:
+ f1:fb:62:7a:01:24:3b:cc:a4:f1:be:a8:51:90:89:
+ a8:83:df:e1:5a:e5:9f:06:92:8b:66:5e:80:7b:55:
+ 25:64:01:4c:3b:fe:cf:49:2a
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Digital Signature, Key Encipherment, Certificate Sign
+ Signature Algorithm: dsaWithSHA1
+ r:
+ 52:80:52:2b:2c:3d:02:66:58:b4:dc:ef:52:26:70:
+ 1b:53:ca:b3:7d
+ s:
+ 62:03:b2:ab:3e:18:2a:66:09:b6:ce:d4:05:a5:8e:
+ a5:7a:0d:55:67
+ */
+ private static final String cert1 =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICzTCCAougAwIBAgIEN8GnNDALBgcqhkjOOAQDBQAwSTELMAkGA1UEBhMCdXMx\n" +
+ "DDAKBgNVBAoTA3N1bjENMAsGA1UECxMEZWFzdDEMMAoGA1UECxMDYmNuMQ8wDQYD\n" +
+ "VQQDEwZ5YXNzaXIwHhcNOTkwODIzMTk1NTMyWhcNMDAwODIyMTk1NTMyWjA4MQsw\n" +
+ "CQYDVQQGEwJ1czEMMAoGA1UEChMDc3VuMQ0wCwYDVQQLEwRlYXN0MQwwCgYDVQQL\n" +
+ "EwNiY24wggG1MIIBLAYHKoZIzjgEATCCAR8CgYEA/X9TgR11EilS30qcLuzk5/YR\n" +
+ "t1I870QAwx4/gLZRJmlFXUAiUftZPY1Y+r/F9bow9subVWzXgTuAHTRv8mZgt2uZ\n" +
+ "UKWkn5/oBHsQIsJPu6nX/rfGG/g7V+fGqKYVDwT7g/bTxR7DAjVUE1oWkTL2dfOu\n" +
+ "K2HXKu/yIgMZndFIAccCFQCXYFCPFSMLzLKSuYKi64QL8Fgc9QKBgQD34aCF1ps9\n" +
+ "3su8q1w2uFe5eZSvu/o66oL5V0wLPQeCZ1FZV4661FlP5nEHEIGAtEkWcSPoTCgW\n" +
+ "E7fPCTKMyKbhPBZ6i1R8jSjgo64eK7OmdZFuo38L+iE1YvH7YnoBJDvMpPG+qFGQ\n" +
+ "iaiD3+Fa5Z8GkotmXoB7VSVkAUw7/s9JKgOBggACf2NHT/Yp5ZiiIf3al54/yrAX\n" +
+ "SY2KpwYNpniXOVkzcqKldNU67+Z8B9eOjtFmc5kUBJb1MdZy7tJT+JC188PxZLoa\n" +
+ "nsAK2pJIxdOEfkgJZtlRunRWWneKjJqc9oQSYRJR3MZPhJTsy3hRg4wgilN70rY2\n" +
+ "31A1lR/LUFWLP/vid8ujEzARMA8GA1UdDwEB/wQFAwMHpAAwCwYHKoZIzjgEAwUA\n" +
+ "Ay8AMCwCFFKAUissPQJmWLTc71ImcBtTyrN9AhRiA7KrPhgqZgm2ztQFpY6leg1V\n" +
+ "Zw==\n" +
+ "-----END CERTIFICATE-----\n" +
+ "";
+
+ /*
+ Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 935095671 (0x37bc6d77)
+ Signature Algorithm: dsaWithSHA1
+ Issuer: C=us, O=sun, OU=east, OU=bcn, CN=yassir
+ Validity
+ Not Before: Aug 19 20:47:51 1999 GMT
+ Not After : Aug 18 20:47:51 2000 GMT
+ Subject: C=us, O=sun, OU=east, OU=bcn, CN=yassir
+ Subject Public Key Info:
+ Public Key Algorithm: dsaEncryption
+ pub:
+ 0a:cc:a4:ec:d6:88:45:c2:24:6b:0d:78:f1:82:f3:
+ 5e:3e:31:5d:fb:64:d5:06:5e:39:16:f1:0a:85:d1:
+ ff:d1:a4:74:c5:e6:b0:ba:93:1c:ee:69:51:be:3b:
+ a6:66:44:50:b4:f0:5e:0e:dd:9f:08:71:fe:a1:91:
+ 2e:d4:9e:6b:b2:c0:82:3c:91:6c:18:b0:d9:bc:a3:
+ 48:91:3f:8b:59:01:61:00:02:ab:22:31:bc:7c:6c:
+ 0d:9f:ed:be:33:e6:5c:44:9e:62:30:95:f8:6d:22:
+ d7:e5:85:4c:b0:98:6e:ad:cc:ca:3b:ad:cb:fa:f7:
+ 9f:37:13:f7:ca:e2:22:ba
+ P:
+ 00:fd:7f:53:81:1d:75:12:29:52:df:4a:9c:2e:ec:
+ e4:e7:f6:11:b7:52:3c:ef:44:00:c3:1e:3f:80:b6:
+ 51:26:69:45:5d:40:22:51:fb:59:3d:8d:58:fa:bf:
+ c5:f5:ba:30:f6:cb:9b:55:6c:d7:81:3b:80:1d:34:
+ 6f:f2:66:60:b7:6b:99:50:a5:a4:9f:9f:e8:04:7b:
+ 10:22:c2:4f:bb:a9:d7:fe:b7:c6:1b:f8:3b:57:e7:
+ c6:a8:a6:15:0f:04:fb:83:f6:d3:c5:1e:c3:02:35:
+ 54:13:5a:16:91:32:f6:75:f3:ae:2b:61:d7:2a:ef:
+ f2:22:03:19:9d:d1:48:01:c7
+ Q:
+ 00:97:60:50:8f:15:23:0b:cc:b2:92:b9:82:a2:eb:
+ 84:0b:f0:58:1c:f5
+ G:
+ 00:f7:e1:a0:85:d6:9b:3d:de:cb:bc:ab:5c:36:b8:
+ 57:b9:79:94:af:bb:fa:3a:ea:82:f9:57:4c:0b:3d:
+ 07:82:67:51:59:57:8e:ba:d4:59:4f:e6:71:07:10:
+ 81:80:b4:49:16:71:23:e8:4c:28:16:13:b7:cf:09:
+ 32:8c:c8:a6:e1:3c:16:7a:8b:54:7c:8d:28:e0:a3:
+ ae:1e:2b:b3:a6:75:91:6e:a3:7f:0b:fa:21:35:62:
+ f1:fb:62:7a:01:24:3b:cc:a4:f1:be:a8:51:90:89:
+ a8:83:df:e1:5a:e5:9f:06:92:8b:66:5e:80:7b:55:
+ 25:64:01:4c:3b:fe:cf:49:2a
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Digital Signature, Key Encipherment, Certificate Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE, pathlen:5
+ Signature Algorithm: dsaWithSHA1
+ r:
+ 2f:88:46:37:94:92:b2:02:07:5b:8d:76:e5:81:23:
+ 85:7f:bc:8d:b9
+ s:
+ 00:8b:d7:41:fa:11:c7:ab:27:92:5d:0a:03:98:56:
+ 36:42:5f:f5:1f:9d
+ */
+ private static final String cert2 =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIIC9TCCArKgAwIBAgIEN7xtdzALBgcqhkjOOAQDBQAwSTELMAkGA1UEBhMCdXMx\n" +
+ "DDAKBgNVBAoTA3N1bjENMAsGA1UECxMEZWFzdDEMMAoGA1UECxMDYmNuMQ8wDQYD\n" +
+ "VQQDEwZ5YXNzaXIwHhcNOTkwODE5MjA0NzUxWhcNMDAwODE4MjA0NzUxWjBJMQsw\n" +
+ "CQYDVQQGEwJ1czEMMAoGA1UEChMDc3VuMQ0wCwYDVQQLEwRlYXN0MQwwCgYDVQQL\n" +
+ "EwNiY24xDzANBgNVBAMTBnlhc3NpcjCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQD9\n" +
+ "f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9jVj6v8X1ujD2\n" +
+ "y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD\n" +
+ "9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8VIwvMspK5gqLr\n" +
+ "hAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jrqgvlXTAs9B4JnUVlXjrrU\n" +
+ "WU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1kW6jfwv6\n" +
+ "ITVi8ftiegEkO8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GEAAKB\n" +
+ "gArMpOzWiEXCJGsNePGC814+MV37ZNUGXjkW8QqF0f/RpHTF5rC6kxzuaVG+O6Zm\n" +
+ "RFC08F4O3Z8Icf6hkS7UnmuywII8kWwYsNm8o0iRP4tZAWEAAqsiMbx8bA2f7b4z\n" +
+ "5lxEnmIwlfhtItflhUywmG6tzMo7rcv69583E/fK4iK6oycwJTAPBgNVHQ8BAf8E\n" +
+ "BQMDB6QAMBIGA1UdEwEB/wQIMAYBAf8CAQUwCwYHKoZIzjgEAwUAAzAAMC0CFC+I\n" +
+ "RjeUkrICB1uNduWBI4V/vI25AhUAi9dB+hHHqyeSXQoDmFY2Ql/1H50=\n" +
+ "-----END CERTIFICATE-----\n" +
+ "";
+
+ private static final String pkcs7path =
+ "MIIF9QYJKoZIhvcNAQcCoIIF5jCCBeICAQExADALBgkqhkiG9w0BBwGgggXKMIICzTCCAougAwIB\n" +
+ "AgIEN8GnNDALBgcqhkjOOAQDBQAwSTELMAkGA1UEBhMCdXMxDDAKBgNVBAoTA3N1bjENMAsGA1UE\n" +
+ "CxMEZWFzdDEMMAoGA1UECxMDYmNuMQ8wDQYDVQQDEwZ5YXNzaXIwHhcNOTkwODIzMTk1NTMyWhcN\n" +
+ "MDAwODIyMTk1NTMyWjA4MQswCQYDVQQGEwJ1czEMMAoGA1UEChMDc3VuMQ0wCwYDVQQLEwRlYXN0\n" +
+ "MQwwCgYDVQQLEwNiY24wggG1MIIBLAYHKoZIzjgEATCCAR8CgYEA/X9TgR11EilS30qcLuzk5/YR\n" +
+ "t1I870QAwx4/gLZRJmlFXUAiUftZPY1Y+r/F9bow9subVWzXgTuAHTRv8mZgt2uZUKWkn5/oBHsQ\n" +
+ "IsJPu6nX/rfGG/g7V+fGqKYVDwT7g/bTxR7DAjVUE1oWkTL2dfOuK2HXKu/yIgMZndFIAccCFQCX\n" +
+ "YFCPFSMLzLKSuYKi64QL8Fgc9QKBgQD34aCF1ps93su8q1w2uFe5eZSvu/o66oL5V0wLPQeCZ1FZ\n" +
+ "V4661FlP5nEHEIGAtEkWcSPoTCgWE7fPCTKMyKbhPBZ6i1R8jSjgo64eK7OmdZFuo38L+iE1YvH7\n" +
+ "YnoBJDvMpPG+qFGQiaiD3+Fa5Z8GkotmXoB7VSVkAUw7/s9JKgOBggACf2NHT/Yp5ZiiIf3al54/\n" +
+ "yrAXSY2KpwYNpniXOVkzcqKldNU67+Z8B9eOjtFmc5kUBJb1MdZy7tJT+JC188PxZLoansAK2pJI\n" +
+ "xdOEfkgJZtlRunRWWneKjJqc9oQSYRJR3MZPhJTsy3hRg4wgilN70rY231A1lR/LUFWLP/vid8uj\n" +
+ "EzARMA8GA1UdDwEB/wQFAwMHpAAwCwYHKoZIzjgEAwUAAy8AMCwCFFKAUissPQJmWLTc71ImcBtT\n" +
+ "yrN9AhRiA7KrPhgqZgm2ztQFpY6leg1VZzCCAvUwggKyoAMCAQICBDe8bXcwCwYHKoZIzjgEAwUA\n" +
+ "MEkxCzAJBgNVBAYTAnVzMQwwCgYDVQQKEwNzdW4xDTALBgNVBAsTBGVhc3QxDDAKBgNVBAsTA2Jj\n" +
+ "bjEPMA0GA1UEAxMGeWFzc2lyMB4XDTk5MDgxOTIwNDc1MVoXDTAwMDgxODIwNDc1MVowSTELMAkG\n" +
+ "A1UEBhMCdXMxDDAKBgNVBAoTA3N1bjENMAsGA1UECxMEZWFzdDEMMAoGA1UECxMDYmNuMQ8wDQYD\n" +
+ "VQQDEwZ5YXNzaXIwggG3MIIBLAYHKoZIzjgEATCCAR8CgYEA/X9TgR11EilS30qcLuzk5/YRt1I8\n" +
+ "70QAwx4/gLZRJmlFXUAiUftZPY1Y+r/F9bow9subVWzXgTuAHTRv8mZgt2uZUKWkn5/oBHsQIsJP\n" +
+ "u6nX/rfGG/g7V+fGqKYVDwT7g/bTxR7DAjVUE1oWkTL2dfOuK2HXKu/yIgMZndFIAccCFQCXYFCP\n" +
+ "FSMLzLKSuYKi64QL8Fgc9QKBgQD34aCF1ps93su8q1w2uFe5eZSvu/o66oL5V0wLPQeCZ1FZV466\n" +
+ "1FlP5nEHEIGAtEkWcSPoTCgWE7fPCTKMyKbhPBZ6i1R8jSjgo64eK7OmdZFuo38L+iE1YvH7YnoB\n" +
+ "JDvMpPG+qFGQiaiD3+Fa5Z8GkotmXoB7VSVkAUw7/s9JKgOBhAACgYAKzKTs1ohFwiRrDXjxgvNe\n" +
+ "PjFd+2TVBl45FvEKhdH/0aR0xeawupMc7mlRvjumZkRQtPBeDt2fCHH+oZEu1J5rssCCPJFsGLDZ\n" +
+ "vKNIkT+LWQFhAAKrIjG8fGwNn+2+M+ZcRJ5iMJX4bSLX5YVMsJhurczKO63L+vefNxP3yuIiuqMn\n" +
+ "MCUwDwYDVR0PAQH/BAUDAwekADASBgNVHRMBAf8ECDAGAQH/AgEFMAsGByqGSM44BAMFAAMwADAt\n" +
+ "AhQviEY3lJKyAgdbjXblgSOFf7yNuQIVAIvXQfoRx6snkl0KA5hWNkJf9R+dMQA=\n" +
+ "";
+
+ // Runs test of CertPath encoding and decoding.
+ public static void main(String[] args) throws Exception {
+ // Make the CertPath whose encoded form has already been stored
+ CertificateFactory certFac = CertificateFactory.getInstance("X509");
+
+ final List certs = new ArrayList<>();
+ certs.add(certFac.generateCertificate(new ByteArrayInputStream(cert1.getBytes())));
+ certs.add(certFac.generateCertificate(new ByteArrayInputStream(cert2.getBytes())));
+
+ CertPath cp = certFac.generateCertPath(certs);
+
+ // Get the encoded form of the CertPath we made
+ byte[] encoded = cp.getEncoded("PKCS7");
+
+ // check if it matches the encoded value
+ if (!Arrays.equals(encoded, Base64.getMimeDecoder().decode(pkcs7path.getBytes()))) {
+ throw new RuntimeException("PKCS#7 encoding doesn't match stored value");
+ }
+
+ // Generate a CertPath from the encoded value and check if it equals
+ // the CertPath generated from the certificates
+ CertPath decodedCP = certFac.generateCertPath(new ByteArrayInputStream(encoded), "PKCS7");
+ if (!decodedCP.equals(cp)) {
+ throw new RuntimeException("CertPath decoded from PKCS#7 isn't equal to original");
+ }
+ }
+}
diff --git a/jdk/test/java/security/cert/X509CertSelectorTest.java b/jdk/test/java/security/cert/X509CertSelectorTest.java
new file mode 100644
index 00000000000..3ff5b65350a
--- /dev/null
+++ b/jdk/test/java/security/cert/X509CertSelectorTest.java
@@ -0,0 +1,538 @@
+/*
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import static sun.security.x509.GeneralNameInterface.NAME_DIRECTORY;
+import static sun.security.x509.NameConstraintsExtension.EXCLUDED_SUBTREES;
+import static sun.security.x509.NameConstraintsExtension.PERMITTED_SUBTREES;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.security.GeneralSecurityException;
+import java.security.KeyFactory;
+import java.security.PublicKey;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509CertSelector;
+import java.security.cert.X509Certificate;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Base64;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import sun.security.util.DerInputStream;
+import sun.security.util.DerOutputStream;
+import sun.security.util.DerValue;
+import sun.security.util.ObjectIdentifier;
+import sun.security.x509.AlgorithmId;
+import sun.security.x509.AuthorityKeyIdentifierExtension;
+import sun.security.x509.CertificatePoliciesExtension;
+import sun.security.x509.DNSName;
+import sun.security.x509.GeneralName;
+import sun.security.x509.GeneralNameInterface;
+import sun.security.x509.GeneralNames;
+import sun.security.x509.GeneralSubtree;
+import sun.security.x509.GeneralSubtrees;
+import sun.security.x509.KeyIdentifier;
+import sun.security.x509.NameConstraintsExtension;
+import sun.security.x509.PolicyInformation;
+import sun.security.x509.PrivateKeyUsageExtension;
+import sun.security.x509.SubjectAlternativeNameExtension;
+import sun.security.x509.X500Name;
+
+/*
+ * @test
+ * @bug 8074931
+ * @summary This class tests the X509CertSelector. The tests check particular criteria
+ * by setting them to a value that should match our test certificate and
+ * ensuring that they do match, then setting them to a value that should not
+ * match our test certificate and ensuring that they do not match.
+ * @modules java.base/sun.security.x509
+ * java.base/sun.security.util
+ */
+public class X509CertSelectorTest {
+ /*
+ Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 954172088 (0x38df82b8)
+ Signature Algorithm: dsaWithSHA1
+ Issuer: C=us, O=sun, OU=testing
+ Validity
+ Not Before: Mar 27 15:48:08 2000 GMT
+ Not After : Jun 25 14:48:08 2000 GMT
+ Subject: C=us, O=sun, OU=testing, CN=mullan
+ Subject Public Key Info:
+ Public Key Algorithm: dsaEncryption
+ pub: 0
+ P: 0
+ Q: 0
+ G: 0
+ X509v3 extensions:
+ X509v3 Name Constraints: critical
+ 0D.B0@.>1.0...U....us1.0
+ ..U.
+ ..sun1.0...U....testing1.0
+ ..U....mullan
+ X509v3 Subject Key Identifier:
+ 56:E8:88:AE:9D:B5:3F:2B:CB:A0:4C:4B:E2:87:53:07:33:77:1B:DF
+ X509v3 Authority Key Identifier:
+ keyid:8E:DD:AF:6F:EE:02:12:F4:61:E9:2F:E3:64:1A:6F:71:32:25:20:C0
+
+ X509v3 Subject Alternative Name:
+ email:mullan@east.sun.com
+ X509v3 Private Key Usage Period:
+ Not Before: Jan 1 05:00:00 2000 GMT, Not After: Jan 1 05:00:00 2001 GMT
+ X509v3 Key Usage: critical
+ Digital Signature
+ X509v3 Certificate Policies:
+ 0$0\..*...0.0...+.......0..
+ Testing...
+ Signature Algorithm: dsaWithSHA1
+ r:
+ 44:c7:35:40:5d:6c:28:75:7f:73:b2:f8:0d:72:6c:
+ 09:65:b8:81:14
+ s:
+ 76:79:f5:c7:37:3b:0d:9b:db:70:2f:20:80:36:e3:
+ 80:e8:a6:c6:71
+ */
+ private static final String testCert =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICLjCCAeygAwIBAgIEON+CuDALBgcqhkjOOAQDBQAwLTELMAkGA1UEBhMCdXMx\n" +
+ "DDAKBgNVBAoTA3N1bjEQMA4GA1UECxMHdGVzdGluZzAeFw0wMDAzMjcxNTQ4MDha\n" +
+ "Fw0wMDA2MjUxNDQ4MDhaMD4xCzAJBgNVBAYTAnVzMQwwCgYDVQQKEwNzdW4xEDAO\n" +
+ "BgNVBAsTB3Rlc3RpbmcxDzANBgNVBAMTBm11bGxhbjAcMBQGByqGSM44BAEwCQIB\n" +
+ "AAIBAAIBAAMEAAIBAKOCASMwggEfMFAGA1UdHgEB/wRGMESgQjBApD4xCzAJBgNV\n" +
+ "BAYTAnVzMQwwCgYDVQQKEwNzdW4xEDAOBgNVBAsTB3Rlc3RpbmcxDzANBgNVBAMT\n" +
+ "Bm11bGxhbjAdBgNVHQ4EFgQUVuiIrp21PyvLoExL4odTBzN3G98wHwYDVR0jBBgw\n" +
+ "FoAUjt2vb+4CEvRh6S/jZBpvcTIlIMAwHgYDVR0RBBcwFYETbXVsbGFuQGVhc3Qu\n" +
+ "c3VuLmNvbTArBgNVHRAEJDAigA8yMDAwMDEwMTA1MDAwMFqBDzIwMDEwMTAxMDUw\n" +
+ "MDAwWjAPBgNVHQ8BAf8EBQMDB4AAMC0GA1UdIAQmMCQwIgYEKoSAADAaMBgGCCsG\n" +
+ "AQUFBwICMAwSClRlc3RpbmcuLi4wCwYHKoZIzjgEAwUAAy8AMCwCFETHNUBdbCh1\n" +
+ "f3Oy+A1ybAlluIEUAhR2efXHNzsNm9twLyCANuOA6KbGcQ==\n" +
+ "-----END CERTIFICATE-----\n" +
+ "";
+
+ private static final String testKey =
+ "MIIBtjCCASsGByqGSM44BAEwggEeAoGBAIVWPEkcxbxhQRCqVzg55tNqbP5j0K4kdu4bkmXvfqC5\n" +
+ "+qA75DvnfzsOJseb+9AuKXWk/DvCzFDmrY1YaU3scZC3OQEO9lEO3F4VDKOaudY6OT1SI22pAIwz\n" +
+ "j5pvq+i7zOp4xUqkQUeh/4iQSfxOT5UrFGjkcbnbpVkCXD/GxAz7AhUAjtnm3dVIddUUHl6wxpZ7\n" +
+ "GcA6gSsCgYAf/PXzQtemgIDjpFrNNSgTEKkLposBXKatAM+gUKlMUjf8SQvquqPxDtRrscGjXkoL\n" +
+ "oTkaR7/akULYFpBvUcFkeIFiCnJg8M9XhCWdLvn9MPt+jR2oxookvCb9xLtD6WvIM/wd/nZ1iK4u\n" +
+ "iY1+q85xvns/Awbtwl7oZDAwE2TUKAOBhAACgYBDc9UZ+3xsZubUZvRG5cpyJceYpJp2exOPVJXn\n" +
+ "jR4CcR+cT9bAJpFSxqE/8KtNHXxHdu4f3DU67IMOVDpugzihyzXJvNm3w2H9x+6xczHG2wjvAJeh\n" +
+ "X62EWbUatxPXFAoVKZWuUbaYaZzdWBDtNRrCuKKsLo0GFy8g2BZISuD3jw==\n" +
+ "";
+
+ // Certificate to run tests on
+ private final X509Certificate cert;
+
+ public static void main(String[] args) throws Exception {
+ X509CertSelectorTest test = new X509CertSelectorTest();
+ test.doTest();
+ }
+
+ public X509CertSelectorTest() throws CertificateException, IOException {
+ cert = (X509Certificate) CertificateFactory.getInstance("X.509")
+ .generateCertificate(new ByteArrayInputStream(testCert.getBytes()));
+ }
+
+ // Runs the test.
+ private void doTest() throws Exception {
+ System.out.println("START OF TESTS FOR " + "X509CertSelector");
+
+ testSerialNumber();
+ testIssuer();
+ testSubjectKeyIdentifier();
+ testAuthorityKeyIdentifier();
+ testCertificateValid();
+ testPrivateKeyValid();
+ testSubjectPublicKeyAlgID();
+ testKeyUsage();
+ testSubjectAltName();
+ testPolicy();
+ testPathToName();
+ testSubject();
+ testSubjectPublicKey();
+ testNameConstraints();
+ testBasicConstraints();
+ testCertificate();
+ }
+
+ // Tests matching on the serial number contained in the certificate.
+ private void testSerialNumber() {
+ System.out.println("X.509 Certificate Match on serialNumber");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ selector.setSerialNumber(new BigInteger("999999999"));
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setSerialNumber(cert.getSerialNumber());
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests matching on the issuer name contained in the certificate.
+ private void testIssuer() throws IOException {
+ System.out.println("X.509 Certificate Match on issuer");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ selector.setIssuer("ou=bogus,ou=east,o=sun,c=us");
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setIssuer((cert.getIssuerX500Principal()).getName("RFC2253"));
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the subject key identifier contained in the
+ * certificate.
+ */
+ private void testSubjectKeyIdentifier() throws IOException {
+ System.out.println("X.509 Certificate Match on subjectKeyIdentifier");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ byte[] b = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ selector.setSubjectKeyIdentifier(b);
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.14"));
+ byte[] encoded = in.getOctetString();
+ selector.setSubjectKeyIdentifier(encoded);
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the authority key identifier contained in the
+ * certificate.
+ */
+ private void testAuthorityKeyIdentifier() throws IOException {
+ System.out.println("X.509 Certificate Match on authorityKeyIdentifier");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ byte[] b = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ AuthorityKeyIdentifierExtension a = new AuthorityKeyIdentifierExtension(new KeyIdentifier(b), null, null);
+ selector.setAuthorityKeyIdentifier(a.getExtensionValue());
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.35"));
+ byte[] encoded = in.getOctetString();
+ selector.setAuthorityKeyIdentifier(encoded);
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the certificate validity component contained in the
+ * certificate.
+ */
+ private void testCertificateValid() {
+ System.out.println("X.509 Certificate Match on certificateValid");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ Calendar cal = Calendar.getInstance();
+ cal.set(1968, 12, 31);
+ selector.setCertificateValid(cal.getTime());
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setCertificateValid(cert.getNotBefore());
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the private key validity component contained in the
+ * certificate.
+ */
+ private void testPrivateKeyValid() throws IOException, CertificateException {
+ System.out.println("X.509 Certificate Match on privateKeyValid");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ Calendar cal = Calendar.getInstance();
+ cal.set(1968, 12, 31);
+ selector.setPrivateKeyValid(cal.getTime());
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.16"));
+ byte[] encoded = in.getOctetString();
+ PrivateKeyUsageExtension ext = new PrivateKeyUsageExtension(false, encoded);
+ Date validDate = (Date) ext.get(PrivateKeyUsageExtension.NOT_BEFORE);
+ selector.setPrivateKeyValid(validDate);
+ checkMatch(selector, cert, true);
+
+ }
+
+ private ObjectIdentifier getCertPubKeyAlgOID(X509Certificate xcert) throws IOException {
+ byte[] encodedKey = xcert.getPublicKey().getEncoded();
+ DerValue val = new DerValue(encodedKey);
+ if (val.tag != DerValue.tag_Sequence) {
+ throw new RuntimeException("invalid key format");
+ }
+
+ return AlgorithmId.parse(val.data.getDerValue()).getOID();
+ }
+
+ /*
+ * Tests matching on the subject public key algorithm ID component contained
+ * in the certificate.
+ */
+ private void testSubjectPublicKeyAlgID() throws IOException {
+ System.out.println("X.509 Certificate Match on subjectPublicKeyAlgID");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ selector.setSubjectPublicKeyAlgID("2.5.29.14");
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setSubjectPublicKeyAlgID(getCertPubKeyAlgOID(cert).toString());
+ checkMatch(selector, cert, true);
+
+ }
+
+ // Tests matching on the key usage extension contained in the certificate.
+ private void testKeyUsage() {
+ System.out.println("X.509 Certificate Match on keyUsage");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ boolean[] keyUsage = { true, false, true, false, true, false, true, false };
+ selector.setKeyUsage(keyUsage);
+ System.out.println("Selector = " + selector.toString());
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setKeyUsage(cert.getKeyUsage());
+ System.out.println("Selector = " + selector.toString());
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the subject alternative name extension contained in the
+ * certificate.
+ */
+ private void testSubjectAltName() throws IOException {
+ System.out.println("X.509 Certificate Match on subjectAltName");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ GeneralNameInterface dnsName = new DNSName("foo.com");
+ DerOutputStream tmp = new DerOutputStream();
+ dnsName.encode(tmp);
+ selector.addSubjectAlternativeName(2, tmp.toByteArray());
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17"));
+ byte[] encoded = in.getOctetString();
+ SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded);
+ GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
+ GeneralName name = (GeneralName) names.get(0);
+ selector.setSubjectAlternativeNames(null);
+ DerOutputStream tmp2 = new DerOutputStream();
+ name.getName().encode(tmp2);
+ selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray());
+ checkMatch(selector, cert, true);
+
+ // good match 2 (matches at least one)
+ selector.setMatchAllSubjectAltNames(false);
+ selector.addSubjectAlternativeName(2, "foo.com");
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the policy constraints extension contained in the
+ * certificate.
+ */
+ private void testPolicy() throws IOException {
+ System.out.println("X.509 Certificate Match on certificatePolicies");
+ // test encoding of CertificatePoliciesExtension because we wrote the
+ // code
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ Set s = new HashSet<>();
+ s.add(new String("1.2.5.7.68"));
+ selector.setPolicy(s);
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32"));
+ CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString());
+ List policies = ext.get(CertificatePoliciesExtension.POLICIES);
+ // match on the first policy id
+ PolicyInformation policyInfo = (PolicyInformation) policies.get(0);
+ s.clear();
+ s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString());
+ selector.setPolicy(s);
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the name constraints extension contained in the
+ * certificate.
+ */
+ private void testPathToName() throws IOException {
+ System.out.println("X.509 Certificate Match on pathToName");
+
+ X509CertSelector selector = null;
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.30"));
+ byte[] encoded = in.getOctetString();
+ NameConstraintsExtension ext = new NameConstraintsExtension(false, encoded);
+ GeneralSubtrees permitted = (GeneralSubtrees) ext.get(PERMITTED_SUBTREES);
+ GeneralSubtrees excluded = (GeneralSubtrees) ext.get(EXCLUDED_SUBTREES);
+
+ // bad matches on pathToName within excluded subtrees
+ if (excluded != null) {
+ Iterator e = excluded.iterator();
+ while (e.hasNext()) {
+ GeneralSubtree tree = e.next();
+ if (tree.getName().getType() == NAME_DIRECTORY) {
+ X500Name excludedDN1 = new X500Name(tree.getName().toString());
+ X500Name excludedDN2 = new X500Name("CN=Bogus, " + tree.getName().toString());
+ DerOutputStream derDN1 = new DerOutputStream();
+ DerOutputStream derDN2 = new DerOutputStream();
+ excludedDN1.encode(derDN1);
+ excludedDN2.encode(derDN2);
+ selector = new X509CertSelector();
+ selector.addPathToName(NAME_DIRECTORY, derDN1.toByteArray());
+ checkMatch(selector, cert, false);
+ selector.setPathToNames(null);
+ selector.addPathToName(NAME_DIRECTORY, derDN2.toByteArray());
+ checkMatch(selector, cert, false);
+ }
+ }
+ }
+
+ // good matches on pathToName within permitted subtrees
+ if (permitted != null) {
+ Iterator e = permitted.iterator();
+ while (e.hasNext()) {
+ GeneralSubtree tree = e.next();
+ if (tree.getName().getType() == NAME_DIRECTORY) {
+ X500Name permittedDN1 = new X500Name(tree.getName().toString());
+ X500Name permittedDN2 = new X500Name("CN=good, " + tree.getName().toString());
+ DerOutputStream derDN1 = new DerOutputStream();
+ DerOutputStream derDN2 = new DerOutputStream();
+ permittedDN1.encode(derDN1);
+ permittedDN2.encode(derDN2);
+ selector = new X509CertSelector();
+ selector.addPathToName(NAME_DIRECTORY, derDN1.toByteArray());
+ checkMatch(selector, cert, true);
+ selector.setPathToNames(null);
+ selector.addPathToName(NAME_DIRECTORY, derDN2.toByteArray());
+ checkMatch(selector, cert, true);
+ }
+ }
+ }
+ }
+
+ // Tests matching on the subject name contained in the certificate.
+ private void testSubject() throws IOException {
+ System.out.println("X.509 Certificate Match on subject");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ selector.setSubject("ou=bogus,ou=east,o=sun,c=us");
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setSubject(cert.getSubjectX500Principal().getName("RFC2253"));
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests matching on the subject public key contained in the certificate.
+ private void testSubjectPublicKey() throws IOException, GeneralSecurityException {
+ System.out.println("X.509 Certificate Match on subject public key");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ X509EncodedKeySpec keySpec = new X509EncodedKeySpec(
+ Base64.getMimeDecoder().decode(testKey.getBytes()));
+ KeyFactory keyFactory = KeyFactory.getInstance("DSA");
+ PublicKey pubKey = keyFactory.generatePublic(keySpec);
+ selector.setSubjectPublicKey(pubKey);
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setSubjectPublicKey(cert.getPublicKey());
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests matching on the name constraints contained in the certificate.
+ private void testNameConstraints() throws IOException {
+ System.out.println("X.509 Certificate Match on name constraints");
+ // bad match
+ GeneralSubtrees subjectTree = new GeneralSubtrees();
+ subjectTree.add(getGeneralSubtree((X500Name) cert.getSubjectDN()));
+ NameConstraintsExtension ext = new NameConstraintsExtension((GeneralSubtrees) null, subjectTree);
+ X509CertSelector selector = new X509CertSelector();
+ selector.setNameConstraints(ext.getExtensionValue());
+ checkMatch(selector, cert, false);
+
+ // good match
+ ext = new NameConstraintsExtension(subjectTree, null);
+ selector.setNameConstraints(ext.getExtensionValue());
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests matching on basic constraints.
+ private void testBasicConstraints() {
+ System.out.println("X.509 Certificate Match on basic constraints");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ int mpl = cert.getBasicConstraints();
+ selector.setBasicConstraints(0);
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setBasicConstraints(mpl);
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests certificateEquals criterion
+ private void testCertificate() {
+ System.out.println("X.509 Certificate Match on certificateEquals criterion");
+
+ X509CertSelector selector = new X509CertSelector();
+ // good match
+ selector.setCertificate(cert);
+ checkMatch(selector, cert, true);
+ }
+
+ private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) {
+ boolean result = selector.match(cert);
+ if (match != result)
+ throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match);
+ }
+
+ private static GeneralSubtree getGeneralSubtree(GeneralNameInterface gni) {
+ // Create a new GeneralSubtree with the specified name, 0 base, and
+ // unlimited length
+ GeneralName gn = new GeneralName(gni);
+ GeneralSubtree subTree = new GeneralSubtree(gn, 0, -1);
+ return subTree;
+ }
+}
From e643aeb178d7dc384201ab65ebae793684e2b340 Mon Sep 17 00:00:00 2001
From: Alexander Scherbatiy
Date: Tue, 15 Sep 2015 15:31:34 +0400
Subject: [PATCH 72/94] 8029339: Custom MultiResolution image support on HiDPI
displays
Reviewed-by: flar, serb
---
.../com/apple/laf/AquaImageFactory.java | 2 +-
.../classes/sun/lwawt/macosx/CImage.java | 2 +-
.../classes/java/awt/RenderingHints.java | 58 +++++
.../image/AbstractMultiResolutionImage.java | 69 ++----
.../awt/image/BaseMultiResolutionImage.java | 150 ++++++++++++
.../java/awt/image/MultiResolutionImage.java | 84 +++++++
.../share/classes/sun/awt/SunHints.java | 26 ++-
.../share/classes/sun/awt/SunToolkit.java | 2 +-
.../awt/image/MultiResolutionCachedImage.java | 22 +-
.../sun/awt/image/MultiResolutionImage.java | 83 -------
.../image/MultiResolutionToolkitImage.java | 18 +-
.../classes/sun/java2d/SunGraphics2D.java | 54 +++--
.../MultiResolutionCursorTest.java | 69 ++----
.../NSImageToMultiResolutionImageTest.java | 10 +-
.../image/MultiResolutionImageCommonTest.java | 12 +-
.../awt/image/MultiResolutionImageTest.java | 7 +-
.../BaseMultiResolutionImageTest.java | 204 ++++++++++++++++
.../MultiResolutionCachedImageTest.java | 2 +-
.../MultiResolutionRenderingHintsTest.java | 218 ++++++++++++++++++
19 files changed, 863 insertions(+), 229 deletions(-)
rename jdk/src/java.desktop/share/classes/{sun => java}/awt/image/AbstractMultiResolutionImage.java (60%)
create mode 100644 jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java
create mode 100644 jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java
delete mode 100644 jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionImage.java
create mode 100644 jdk/test/java/awt/image/multiresolution/BaseMultiResolutionImageTest.java
create mode 100644 jdk/test/java/awt/image/multiresolution/MultiResolutionRenderingHintsTest.java
diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java
index 041bec057ae..c26bcae3d06 100644
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java
@@ -46,7 +46,7 @@ import com.apple.laf.AquaIcon.JRSUIControlSpec;
import com.apple.laf.AquaIcon.SystemIcon;
import com.apple.laf.AquaUtils.RecyclableObject;
import com.apple.laf.AquaUtils.RecyclableSingleton;
-import sun.awt.image.MultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
import sun.awt.image.MultiResolutionCachedImage;
public class AquaImageFactory {
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java
index 3eaa3930dd9..a5504cbee25 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java
@@ -31,7 +31,7 @@ import java.awt.image.*;
import java.util.Arrays;
import java.util.List;
-import sun.awt.image.MultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
import sun.awt.image.MultiResolutionCachedImage;
import sun.awt.image.SunWritableRaster;
diff --git a/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java b/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java
index 6a1fa915b05..353a49c52cf 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/RenderingHints.java
@@ -954,6 +954,64 @@ public class RenderingHints
public static final Object VALUE_STROKE_PURE =
SunHints.VALUE_STROKE_PURE;
+ /**
+ * Image resolution variant hint key.
+ * The {@code RESOLUTION_VARIANT} hint controls which image resolution
+ * variant should be chosen for image drawing.
+ *
+ *
+ *
{@link #VALUE_RESOLUTION_VARIANT_DEFAULT}
+ *
{@link #VALUE_RESOLUTION_VARIANT_BASE}
+ *
{@link #VALUE_RESOLUTION_VARIANT_SIZE_FIT}
+ *
{@link #VALUE_RESOLUTION_VARIANT_DPI_FIT}
+ *
+ * @since 1.9
+ */
+ public static final Key KEY_RESOLUTION_VARIANT =
+ SunHints.KEY_RESOLUTION_VARIANT;
+
+ /**
+ * Image resolution variant hint value -- an image resolution variant is
+ * chosen based on a default heuristic which may depend on the policies
+ * of the platform
+ *
+ * @see #KEY_RESOLUTION_VARIANT
+ * @since 1.9
+ */
+ public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT =
+ SunHints.VALUE_RESOLUTION_VARIANT_DEFAULT;
+
+ /**
+ * Image resolution variant hint value -- the standard resolution of an image
+ * is always used.
+ *
+ * @see #KEY_RESOLUTION_VARIANT
+ * @since 1.9
+ */
+ public static final Object VALUE_RESOLUTION_VARIANT_BASE =
+ SunHints.VALUE_RESOLUTION_VARIANT_BASE;
+
+ /**
+ * Image resolution variant hint value -- an image resolution variant is
+ * chosen based on the DPI of the screen and the transform in the Graphics2D
+ * context.
+ *
+ * @see #KEY_RESOLUTION_VARIANT
+ * @since 1.9
+ */
+ public static final Object VALUE_RESOLUTION_VARIANT_SIZE_FIT =
+ SunHints.VALUE_RESOLUTION_VARIANT_SIZE_FIT;
+
+ /**
+ * Image resolution variant hint value -- an image resolution variant is
+ * chosen based only on the DPI of the screen.
+ *
+ * @see #KEY_RESOLUTION_VARIANT
+ * @since 1.9
+ */
+ public static final Object VALUE_RESOLUTION_VARIANT_DPI_FIT =
+ SunHints.VALUE_RESOLUTION_VARIANT_DPI_FIT;
+
/**
* Constructs a new object with keys and values initialized
* from the specified Map object which may be null.
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/AbstractMultiResolutionImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java
similarity index 60%
rename from jdk/src/java.desktop/share/classes/sun/awt/image/AbstractMultiResolutionImage.java
rename to jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java
index 5116f517ff0..606661b3e69 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/AbstractMultiResolutionImage.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -22,50 +22,39 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package sun.awt.image;
+package java.awt.image;
import java.awt.Graphics;
import java.awt.Image;
-import java.awt.image.*;
/**
- * This class provides default implementations for the
- * MultiResolutionImage interface. The developer needs only
- * to subclass this abstract class and define the getResolutionVariant,
- * getResolutionVariants, and getBaseImage methods.
- *
+ * This class provides default implementations of several {@code Image} methods
+ * for classes that want to implement the {@MultiResolutionImage} interface.
*
* For example,
- * {@code
+ *
{@code
* public class CustomMultiResolutionImage extends AbstractMultiResolutionImage {
*
- * int baseImageIndex;
- * Image[] resolutionVariants;
+ * final Image[] resolutionVariants;
*
- * public CustomMultiResolutionImage(int baseImageIndex,
- * Image... resolutionVariants) {
- * this.baseImageIndex = baseImageIndex;
+ * public CustomMultiResolutionImage(Image... resolutionVariants) {
* this.resolutionVariants = resolutionVariants;
* }
*
- * @Override
- * public Image getResolutionVariant(float logicalDPIX, float logicalDPIY,
- * float baseImageWidth, float baseImageHeight,
- * float destImageWidth, float destImageHeight) {
- * // return a resolution variant based on the given logical DPI,
- * // base image size, or destination image size
+ * public Image getResolutionVariant(
+ * double destImageWidth, double destImageHeight) {
+ * // return a resolution variant based on the given destination image size
* }
*
- * @Override
* public List getResolutionVariants() {
- * return Arrays.asList(resolutionVariants);
+ * return Collections.unmodifiableList(Arrays.asList(resolutionVariants));
* }
*
* protected Image getBaseImage() {
- * return resolutionVariants[baseImageIndex];
+ * return resolutionVariants[0];
* }
* }
- * }
+ * }
*
* @see java.awt.Image
* @see java.awt.image.MultiResolutionImage
@@ -75,49 +64,39 @@ import java.awt.image.*;
public abstract class AbstractMultiResolutionImage extends java.awt.Image
implements MultiResolutionImage {
- /**
- * @inheritDoc
- */
@Override
public int getWidth(ImageObserver observer) {
- return getBaseImage().getWidth(null);
+ return getBaseImage().getWidth(observer);
}
- /**
- * @inheritDoc
- */
@Override
public int getHeight(ImageObserver observer) {
- return getBaseImage().getHeight(null);
+ return getBaseImage().getHeight(observer);
}
- /**
- * @inheritDoc
- */
@Override
public ImageProducer getSource() {
return getBaseImage().getSource();
}
- /**
- * @inheritDoc
- */
@Override
public Graphics getGraphics() {
- return getBaseImage().getGraphics();
-
+ throw new UnsupportedOperationException("getGraphics() not supported"
+ + " on Multi-Resolution Images");
}
- /**
- * @inheritDoc
- */
@Override
public Object getProperty(String name, ImageObserver observer) {
return getBaseImage().getProperty(name, observer);
}
/**
- * @return base image
+ * Return the base image representing the best version of the image for
+ * rendering at the default width and height.
+ *
+ * @return the base image of the set of multi-resolution images
+ *
+ * @since 1.9
*/
protected abstract Image getBaseImage();
-}
+}
\ No newline at end of file
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java
new file mode 100644
index 00000000000..653057632a5
--- /dev/null
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/BaseMultiResolutionImage.java
@@ -0,0 +1,150 @@
+/*
+ * 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 java.awt.image;
+
+import java.awt.Image;
+import java.util.List;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Objects;
+
+/**
+ * This class is an array-based implementation of
+ * the {@code AbstractMultiResolutionImage} class.
+ *
+ * This class will implement the
+ * {@code getResolutionVariant(double destImageWidth, double destImageHeight)}
+ * method using a simple algorithm which will return the first image variant
+ * in the array that is large enough to satisfy the rendering request. The
+ * last image in the array will be returned if no suitable image is found
+ * that is as large as the rendering request.
+ *
+ * For best effect the array of images should be sorted with each image being
+ * both wider and taller than the previous image. The base image need not be
+ * the first image in the array. No exception will be thrown if the images
+ * are not sorted as suggested.
+ *
+ * @see java.awt.Image
+ * @see java.awt.image.MultiResolutionImage
+ * @see java.awt.image.AbstractMultiResolutionImage
+ *
+ * @since 1.9
+ */
+public class BaseMultiResolutionImage extends AbstractMultiResolutionImage {
+
+ private final int baseImageIndex;
+ private final Image[] resolutionVariants;
+
+ /**
+ * Creates a multi-resolution image with the given resolution variants.
+ * The first resolution variant is used as the base image.
+ *
+ * @param resolutionVariants array of resolution variants sorted by image size
+ * @throws IllegalArgumentException if null or zero-length array is passed
+ * @throws NullPointerException if the specified {@code resolutionVariants}
+ * contains one or more null elements
+ *
+ * @since 1.9
+ */
+ public BaseMultiResolutionImage(Image... resolutionVariants) {
+ this(0, resolutionVariants);
+ }
+
+ /**
+ * Creates a multi-resolution image with the given base image index and
+ * resolution variants.
+ *
+ * @param baseImageIndex the index of base image in the resolution variants
+ * array
+ * @param resolutionVariants array of resolution variants sorted by image size
+ * @throws IllegalArgumentException if null or zero-length array is passed
+ * @throws NullPointerException if the specified {@code resolutionVariants}
+ * contains one or more null elements
+ * @throws IndexOutOfBoundsException if {@code baseImageIndex} is
+ * negative or greater than or equal to {@code resolutionVariants}
+ * length.
+ *
+ * @since 1.9
+ */
+ public BaseMultiResolutionImage(int baseImageIndex,
+ Image... resolutionVariants) {
+
+ if (resolutionVariants == null || resolutionVariants.length == 0) {
+ throw new IllegalArgumentException(
+ "Null or zero-length array is passed");
+ }
+
+ if (baseImageIndex < 0 || baseImageIndex >= resolutionVariants.length) {
+ throw new IndexOutOfBoundsException("Invalid base image index: "
+ + baseImageIndex);
+ }
+
+ this.baseImageIndex = baseImageIndex;
+ this.resolutionVariants = Arrays.copyOf(resolutionVariants,
+ resolutionVariants.length);
+
+ for (Image resolutionVariant : this.resolutionVariants) {
+ Objects.requireNonNull(resolutionVariant,
+ "Resolution variant can't be null");
+ }
+ }
+
+ @Override
+ public Image getResolutionVariant(double destImageWidth,
+ double destImageHeight) {
+
+ checkSize(destImageWidth, destImageHeight);
+
+ for (Image rvImage : resolutionVariants) {
+ if (destImageWidth <= rvImage.getWidth(null)
+ && destImageHeight <= rvImage.getHeight(null)) {
+ return rvImage;
+ }
+ }
+ return resolutionVariants[resolutionVariants.length - 1];
+ }
+
+ private static void checkSize(double width, double height) {
+ if (width <= 0 || height <= 0) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) cannot be <= 0", width, height));
+ }
+
+ if (!Double.isFinite(width) || !Double.isFinite(height)) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) is not finite", width, height));
+ }
+ }
+
+ @Override
+ public List getResolutionVariants() {
+ return Collections.unmodifiableList(Arrays.asList(resolutionVariants));
+ }
+
+ @Override
+ protected Image getBaseImage() {
+ return resolutionVariants[baseImageIndex];
+ }
+}
\ No newline at end of file
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java b/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java
new file mode 100644
index 00000000000..26b4b534d81
--- /dev/null
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/MultiResolutionImage.java
@@ -0,0 +1,84 @@
+/*
+ * 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 java.awt.image;
+
+import java.awt.Image;
+import java.util.List;
+
+/**
+ * This interface is designed to be an optional additional API supported by
+ * some implementations of {@link java.awt.Image} to allow them to provide
+ * alternate images for various rendering resolutions. The various
+ * {@code Graphics.drawImage(...)} variant methods will consult the methods
+ * of this interface if it is implemented on the argument {@code Image} object
+ * in order to choose the best representation to use for each rendering operation.
+ *
+ * The {@code MultiResolutionImage} interface should be implemented by any
+ * subclass of {@code java.awt.Image} whose instances are intended to provide
+ * image resolution variants according to the given image width and height.
+ * For convenience, toolkit images obtained from
+ * {@code Toolkit.getImage(String name)} and {@code Toolkit.getImage(URL url)}
+ * will implement this interface on platforms that support naming conventions
+ * for resolution variants of stored image media and the
+ * {@code AbstractMultiResolutionImage} and {@code BaseMultiResolutionImage}
+ * classes are provided to facilitate easy construction of custom multi-resolution
+ * images from a list of related images.
+ *
+ * @see java.awt.Image
+ * @see java.awt.image.AbstractMultiResolutionImage
+ * @see java.awt.image.BaseMultiResolutionImage
+ * @see java.awt.Toolkit#getImage(java.lang.String filename)
+ * @see java.awt.Toolkit#getImage(java.net.URL url)
+ *
+ * @since 1.9
+ */
+public interface MultiResolutionImage {
+
+ /**
+ * Gets a specific image that is the best variant to represent
+ * this logical image at the indicated size.
+ *
+ * @param destImageWidth the width of the destination image, in pixels.
+ * @param destImageHeight the height of the destination image, in pixels.
+ * @return image resolution variant.
+ * @throws IllegalArgumentException if {@code destImageWidth} or
+ * {@code destImageHeight} is less than or equal to zero, infinity,
+ * or NaN.
+ *
+ * @since 1.9
+ */
+ Image getResolutionVariant(double destImageWidth, double destImageHeight);
+
+ /**
+ * Gets a readable list of all resolution variants.
+ * The list must be nonempty and contain at least one resolution variant.
+ *
+ * Note that many implementations might return an unmodifiable list.
+ *
+ * @return list of resolution variants.
+ * @since 1.9
+ */
+ public List getResolutionVariants();
+}
\ No newline at end of file
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/SunHints.java b/jdk/src/java.desktop/share/classes/sun/awt/SunHints.java
index 15c7e544901..b82e0564457 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/SunHints.java
+++ b/jdk/src/java.desktop/share/classes/sun/awt/SunHints.java
@@ -257,8 +257,10 @@ public class SunHints {
*/
@Native public static final int INTKEY_RESOLUTION_VARIANT = 9;
@Native public static final int INTVAL_RESOLUTION_VARIANT_DEFAULT = 0;
- @Native public static final int INTVAL_RESOLUTION_VARIANT_OFF = 1;
- @Native public static final int INTVAL_RESOLUTION_VARIANT_ON = 2;
+ @Native public static final int INTVAL_RESOLUTION_VARIANT_BASE = 1;
+ @Native public static final int INTVAL_RESOLUTION_VARIANT_SIZE_FIT = 2;
+ @Native public static final int INTVAL_RESOLUTION_VARIANT_DPI_FIT = 3;
+
/**
* LCD text contrast control hint key.
* Value is "100" to make discontiguous with the others which
@@ -466,15 +468,23 @@ public class SunHints {
public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT =
new SunHints.Value(KEY_RESOLUTION_VARIANT,
SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT,
- "Choose image resolutions based on a default heuristic");
- public static final Object VALUE_RESOLUTION_VARIANT_OFF =
+ "Choose image resolutions based on a default"
+ + "heuristic");
+ public static final Object VALUE_RESOLUTION_VARIANT_BASE =
new SunHints.Value(KEY_RESOLUTION_VARIANT,
- SunHints.INTVAL_RESOLUTION_VARIANT_OFF,
+ SunHints.INTVAL_RESOLUTION_VARIANT_BASE,
"Use only the standard resolution of an image");
- public static final Object VALUE_RESOLUTION_VARIANT_ON =
+ public static final Object VALUE_RESOLUTION_VARIANT_SIZE_FIT =
new SunHints.Value(KEY_RESOLUTION_VARIANT,
- SunHints.INTVAL_RESOLUTION_VARIANT_ON,
- "Always use resolution-specific variants of images");
+ SunHints.INTVAL_RESOLUTION_VARIANT_SIZE_FIT,
+ "Choose image resolutions based on the DPI"
+ + "of the screen and transform"
+ + "in the Graphics2D context");
+ public static final Object VALUE_RESOLUTION_VARIANT_DPI_FIT =
+ new SunHints.Value(KEY_RESOLUTION_VARIANT,
+ SunHints.INTVAL_RESOLUTION_VARIANT_DPI_FIT,
+ "Choose image resolutions based only on the DPI"
+ + " of the screen");
public static class LCDContrastKey extends Key {
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java
index c3b53acf7f0..61df2fa0909 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java
+++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java
@@ -60,7 +60,7 @@ import sun.awt.im.InputContext;
import sun.awt.image.ByteArrayImageSource;
import sun.awt.image.FileImageSource;
import sun.awt.image.ImageRepresentation;
-import sun.awt.image.MultiResolutionImage;
+import java.awt.image.MultiResolutionImage;
import sun.awt.image.MultiResolutionToolkitImage;
import sun.awt.image.ToolkitImage;
import sun.awt.image.URLImageSource;
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java
index acab1587c82..8d8acdcf0a3 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java
@@ -33,6 +33,7 @@ import java.util.List;
import java.util.function.Function;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
+import java.awt.image.AbstractMultiResolutionImage;
public class MultiResolutionCachedImage extends AbstractMultiResolutionImage {
@@ -58,7 +59,10 @@ public class MultiResolutionCachedImage extends AbstractMultiResolutionImage {
}
@Override
- public Image getResolutionVariant(int width, int height) {
+ public Image getResolutionVariant(double destWidth, double destHeight) {
+ checkSize(destWidth, destHeight);
+ int width = (int) Math.ceil(destWidth);
+ int height = (int) Math.ceil(destHeight);
ImageCache cache = ImageCache.getInstance();
ImageCacheKey key = new ImageCacheKey(this, width, height);
Image resolutionVariant = cache.getImage(key);
@@ -70,11 +74,23 @@ public class MultiResolutionCachedImage extends AbstractMultiResolutionImage {
return resolutionVariant;
}
+ private static void checkSize(double width, double height) {
+ if (width <= 0 || height <= 0) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) cannot be <= 0", width, height));
+ }
+
+ if (!Double.isFinite(width) || !Double.isFinite(height)) {
+ throw new IllegalArgumentException(String.format(
+ "Width (%s) or height (%s) is not finite", width, height));
+ }
+ }
+
@Override
public List getResolutionVariants() {
return Arrays.stream(sizes).map((Function) size
- -> getResolutionVariant((int) size.getWidth(),
- (int) size.getHeight())).collect(Collectors.toList());
+ -> getResolutionVariant(size.getWidth(), size.getHeight()))
+ .collect(Collectors.toList());
}
public MultiResolutionCachedImage map(Function mapper) {
diff --git a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionImage.java b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionImage.java
deleted file mode 100644
index 525267d1530..00000000000
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionImage.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.awt.image;
-
-import java.awt.Image;
-import java.util.List;
-
-/**
- * This interface is designed to provide a set of images at various resolutions.
- *
- * The MultiResolutionImage interface should be implemented by any
- * class whose instances are intended to provide image resolution variants
- * according to the given image width and height.
- *
- * For example,
- *
- * This protocol is described in the
* SSLContext section of the
* Java Cryptography Architecture Standard Algorithm Name Documentation.
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
index 36803cd5578..333f845dec8 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,19 @@ import sun.security.jca.GetInstance;
* This class acts as a factory for trust managers based on a
* source of trust material. Each trust manager manages a specific
* type of trust material for use by secure sockets. The trust
- * material is based on a KeyStore and/or provider specific sources.
+ * material is based on a KeyStore and/or provider-specific sources.
+ *
+ *
Every implementation of the Java platform is required to support the
+ * following standard {@code TrustManagerFactory} algorithm:
+ *
+ *
PKIX
+ *
+ * This algorithm is described in the
+ * TrustManagerFactory section of the
+ * Java Cryptography Architecture Standard Algorithm Name Documentation.
+ * Consult the release documentation for your implementation to see if any
+ * other algorithms are supported.
*
* @since 1.4
* @see TrustManager
From a2f0fe3c946b5704c7d550e55742e8714930b3df Mon Sep 17 00:00:00 2001
From: Martin Buchholz
Date: Tue, 15 Sep 2015 21:56:04 -0700
Subject: [PATCH 78/94] 8136583: Core libraries should use blessed modifier
order
Run blessed-modifier-order script (see bug)
Reviewed-by: psandoz, chegar, alanb, plevart
---
.../classes/java/net/DefaultInterface.java | 2 +-
.../HostLocaleProviderAdapterImpl.java | 2 +-
.../com/sun/crypto/provider/RC2Crypt.java | 2 +-
.../sun/crypto/provider/RC2Parameters.java | 2 +-
.../com/sun/crypto/provider/RSACipher.java | 16 +-
.../provider/TlsKeyMaterialGenerator.java | 2 +-
.../provider/TlsMasterSecretGenerator.java | 2 +-
.../sun/crypto/provider/TlsPrfGenerator.java | 20 +-
.../TlsRsaPremasterSecretGenerator.java | 2 +-
.../com/sun/java/util/jar/pack/Attribute.java | 20 +-
.../sun/java/util/jar/pack/BandStructure.java | 38 ++--
.../com/sun/java/util/jar/pack/Code.java | 2 +-
.../com/sun/java/util/jar/pack/Coding.java | 2 +-
.../sun/java/util/jar/pack/CodingChooser.java | 2 +-
.../sun/java/util/jar/pack/ConstantPool.java | 6 +-
.../com/sun/java/util/jar/pack/Constants.java | 190 +++++++++---------
.../com/sun/java/util/jar/pack/Driver.java | 6 +-
.../com/sun/java/util/jar/pack/Histogram.java | 2 +-
.../sun/java/util/jar/pack/Instruction.java | 16 +-
.../sun/java/util/jar/pack/NativeUnpack.java | 2 +-
.../com/sun/java/util/jar/pack/Package.java | 2 +-
.../sun/java/util/jar/pack/PackageReader.java | 2 +-
.../com/sun/java/util/jar/pack/Utils.java | 2 +-
.../com/sun/net/ssl/HttpsURLConnection.java | 2 +-
.../com/sun/net/ssl/KeyManagerFactory.java | 2 +-
.../com/sun/net/ssl/TrustManagerFactory.java | 2 +-
.../cert/internal/x509/X509V1CertImpl.java | 2 +-
.../classes/com/sun/security/ntlm/Client.java | 4 +-
.../com/sun/security/ntlm/NTLMException.java | 12 +-
.../classes/com/sun/security/ntlm/Server.java | 4 +-
.../share/classes/java/io/Console.java | 2 +-
.../classes/java/io/DataInputStream.java | 2 +-
.../java.base/share/classes/java/io/File.java | 2 +-
.../share/classes/java/io/FilePermission.java | 14 +-
.../classes/java/io/ObjectInputStream.java | 2 +-
.../classes/java/io/ObjectOutputStream.java | 2 +-
.../classes/java/io/ObjectStreamClass.java | 2 +-
.../java/io/ObjectStreamConstants.java | 58 +++---
.../share/classes/java/io/Reader.java | 4 +-
.../share/classes/java/io/Writer.java | 6 +-
.../share/classes/java/lang/Class.java | 20 +-
.../share/classes/java/lang/ClassLoader.java | 2 +-
.../java/lang/ConditionalSpecialCasing.java | 12 +-
.../share/classes/java/lang/Integer.java | 8 +-
.../share/classes/java/lang/Package.java | 2 +-
.../classes/java/lang/ProcessBuilder.java | 2 +-
.../share/classes/java/lang/StringCoding.java | 4 +-
.../share/classes/java/lang/System.java | 6 +-
.../share/classes/java/lang/Thread.java | 10 +-
.../java/lang/VirtualMachineError.java | 2 +-
.../lang/invoke/DelegatingMethodHandle.java | 2 +-
.../java/lang/invoke/DirectMethodHandle.java | 6 +-
.../lang/invoke/InvokerBytecodeGenerator.java | 6 +-
.../java/lang/invoke/MethodHandleNatives.java | 2 +-
.../java/lang/invoke/MethodHandles.java | 10 +-
.../java/lang/invoke/MethodTypeForm.java | 4 +-
.../classes/java/lang/ref/Reference.java | 4 +-
.../classes/java/lang/ref/ReferenceQueue.java | 2 +-
.../classes/java/lang/ref/SoftReference.java | 2 +-
.../java/lang/reflect/AccessibleObject.java | 2 +-
.../share/classes/java/math/BigDecimal.java | 20 +-
.../share/classes/java/math/BigInteger.java | 4 +-
.../net/AbstractPlainDatagramSocketImpl.java | 2 +-
.../java/net/AbstractPlainSocketImpl.java | 4 +-
.../share/classes/java/net/Authenticator.java | 2 +-
.../classes/java/net/ContentHandler.java | 4 +-
.../share/classes/java/net/CookieHandler.java | 4 +-
.../share/classes/java/net/CookieManager.java | 2 +-
.../classes/java/net/DatagramPacket.java | 2 +-
.../share/classes/java/net/HostPortrange.java | 6 +-
.../share/classes/java/net/HttpCookie.java | 8 +-
.../classes/java/net/HttpURLConnection.java | 2 +-
.../share/classes/java/net/Inet4Address.java | 2 +-
.../share/classes/java/net/Inet6Address.java | 4 +-
.../classes/java/net/NetworkInterface.java | 20 +-
.../share/classes/java/net/Proxy.java | 2 +-
.../share/classes/java/net/ResponseCache.java | 4 +-
.../classes/java/net/SocketInputStream.java | 2 +-
.../share/classes/java/net/SocketOptions.java | 28 +--
.../classes/java/net/SocketOutputStream.java | 2 +-
.../classes/java/net/SocketPermission.java | 12 +-
.../java.base/share/classes/java/net/URI.java | 24 +--
.../share/classes/java/net/URLConnection.java | 10 +-
.../classes/java/net/URLStreamHandler.java | 2 +-
.../share/classes/java/nio/Bits.java | 8 +-
.../share/classes/java/nio/channels/Pipe.java | 4 +-
.../classes/java/nio/charset/CoderResult.java | 2 +-
.../java/security/KeyPairGenerator.java | 6 +-
.../share/classes/java/security/KeyStore.java | 4 +-
.../share/classes/java/security/Provider.java | 6 +-
.../classes/java/security/SecureRandom.java | 6 +-
.../classes/java/security/Signature.java | 20 +-
.../java/security/cert/CertPathBuilder.java | 2 +-
.../security/cert/CertPathHelperImpl.java | 2 +-
.../java/security/cert/CertPathValidator.java | 2 +-
.../classes/java/security/cert/CertStore.java | 2 +-
.../java/security/cert/X509CertSelector.java | 2 +-
.../classes/java/text/AttributedString.java | 6 +-
.../java/text/CollationElementIterator.java | 20 +-
.../share/classes/java/text/CollationKey.java | 6 +-
.../share/classes/java/text/Collator.java | 22 +-
.../share/classes/java/text/DateFormat.java | 92 ++++-----
.../classes/java/text/MessageFormat.java | 2 +-
.../share/classes/java/text/NumberFormat.java | 10 +-
.../classes/java/text/RBCollationTables.java | 22 +-
.../classes/java/text/RBTableBuilder.java | 14 +-
.../classes/java/text/RuleBasedCollator.java | 10 +-
.../classes/java/text/SimpleDateFormat.java | 20 +-
.../share/classes/java/util/AbstractList.java | 2 +-
.../share/classes/java/util/BitSet.java | 6 +-
.../share/classes/java/util/Calendar.java | 134 ++++++------
.../share/classes/java/util/Comparators.java | 2 +-
.../share/classes/java/util/Currency.java | 4 +-
.../share/classes/java/util/Date.java | 6 +-
.../share/classes/java/util/Dictionary.java | 14 +-
.../classes/java/util/GregorianCalendar.java | 2 +-
.../java/util/JapaneseImperialCalendar.java | 2 +-
.../classes/java/util/ListResourceBundle.java | 2 +-
.../share/classes/java/util/Locale.java | 56 +++---
.../classes/java/util/PropertyPermission.java | 8 +-
.../share/classes/java/util/Random.java | 6 +-
.../classes/java/util/SimpleTimeZone.java | 6 +-
.../share/classes/java/util/Spliterators.java | 10 +-
.../share/classes/java/util/TimeZone.java | 6 +-
.../share/classes/java/util/Timer.java | 2 +-
.../share/classes/java/util/jar/Pack200.java | 4 +-
.../classes/java/util/regex/Pattern.java | 8 +-
.../classes/java/util/regex/UnicodeProp.java | 4 +-
.../classes/java/util/stream/FindOps.java | 2 +-
.../classes/java/util/stream/ForEachOps.java | 2 +-
.../classes/java/util/stream/MatchOps.java | 2 +-
.../share/classes/java/util/stream/Nodes.java | 12 +-
.../classes/java/util/stream/ReduceOps.java | 6 +-
.../share/classes/java/util/stream/Sink.java | 8 +-
.../classes/java/util/stream/SortedOps.java | 8 +-
.../java/util/stream/StreamSpliterators.java | 16 +-
.../classes/java/util/stream/Streams.java | 4 +-
.../classes/java/util/stream/WhileOps.java | 10 +-
.../share/classes/java/util/zip/Adler32.java | 6 +-
.../share/classes/java/util/zip/CRC32.java | 6 +-
.../share/classes/java/util/zip/Deflater.java | 10 +-
.../java/util/zip/GZIPInputStream.java | 12 +-
.../java/util/zip/GZIPOutputStream.java | 4 +-
.../share/classes/java/util/zip/Inflater.java | 12 +-
.../share/classes/javax/crypto/Cipher.java | 20 +-
.../classes/javax/crypto/JceSecurity.java | 6 +-
.../classes/javax/crypto/KeyAgreement.java | 4 +-
.../classes/javax/crypto/KeyGenerator.java | 8 +-
.../javax/net/ssl/HttpsURLConnection.java | 2 +-
.../javax/net/ssl/KeyManagerFactory.java | 2 +-
.../classes/javax/net/ssl/SNIHostName.java | 2 +-
.../javax/net/ssl/SSLEngineResult.java | 10 +-
.../javax/net/ssl/TrustManagerFactory.java | 2 +-
.../classes/javax/security/auth/Policy.java | 2 +-
.../jdk/internal/jimage/BasicImageWriter.java | 2 +-
.../internal/jimage/ImageLocationBase.java | 18 +-
.../jdk/internal/jimage/ImageModuleData.java | 26 +--
.../internal/jimage/ImageNativeSubstrate.java | 32 +--
.../jdk/internal/jimage/ImageReader.java | 2 +-
.../internal/jimage/PerfectHashBuilder.java | 2 +-
.../internal/org/objectweb/asm/TypePath.java | 8 +-
.../org/objectweb/asm/TypeReference.java | 44 ++--
.../asm/commons/InstructionAdapter.java | 2 +-
.../asm/signature/SignatureVisitor.java | 6 +-
.../util/xml/PropertiesDefaultHandler.java | 4 +-
.../internal/util/xml/XMLStreamWriter.java | 4 +-
.../jdk/internal/util/xml/impl/Parser.java | 52 ++---
.../jdk/internal/util/xml/impl/ParserSAX.java | 4 +-
.../share/classes/jdk/net/Sockets.java | 2 +-
.../sun/invoke/anon/AnonymousClassLoader.java | 2 +-
.../sun/invoke/anon/ConstantPoolPatch.java | 2 +-
.../sun/invoke/util/BytecodeDescriptor.java | 6 +-
.../sun/invoke/util/ValueConversions.java | 2 +-
.../classes/sun/invoke/util/Wrapper.java | 2 +-
.../classes/sun/launcher/LauncherHelper.java | 2 +-
.../share/classes/sun/misc/BASE64Decoder.java | 4 +-
.../share/classes/sun/misc/BASE64Encoder.java | 2 +-
.../classes/sun/misc/CharacterDecoder.java | 4 +-
.../classes/sun/misc/CharacterEncoder.java | 6 +-
.../share/classes/sun/misc/Cleaner.java | 2 +-
.../share/classes/sun/misc/FDBigInteger.java | 2 +-
.../classes/sun/misc/FloatingDecimal.java | 6 +-
.../share/classes/sun/misc/LRUCache.java | 4 +-
.../share/classes/sun/misc/PerfCounter.java | 8 +-
.../classes/sun/misc/ProxyGenerator.java | 8 +-
.../share/classes/sun/misc/Request.java | 4 +-
.../share/classes/sun/misc/SoftCache.java | 6 +-
.../share/classes/sun/misc/UCDecoder.java | 2 +-
.../share/classes/sun/misc/UCEncoder.java | 2 +-
.../java.base/share/classes/sun/misc/VM.java | 14 +-
.../share/classes/sun/net/NetProperties.java | 10 +-
.../share/classes/sun/net/NetworkServer.java | 4 +-
.../sun/net/dns/ResolverConfiguration.java | 2 +-
.../sun/net/spi/DefaultProxySelector.java | 4 +-
.../classes/sun/net/util/IPAddressUtil.java | 6 +-
.../share/classes/sun/net/www/ParseUtil.java | 2 +-
.../classes/sun/net/www/URLConnection.java | 6 +-
.../sun/net/www/http/ChunkedInputStream.java | 2 +-
.../classes/sun/net/www/http/HttpClient.java | 4 +-
.../net/www/protocol/http/AuthCacheValue.java | 2 +-
.../www/protocol/http/AuthenticationInfo.java | 8 +-
.../protocol/http/DigestAuthentication.java | 6 +-
.../net/www/protocol/http/HttpCallerInfo.java | 12 +-
.../www/protocol/http/HttpURLConnection.java | 10 +-
.../http/NegotiateAuthentication.java | 2 +-
.../https/DefaultHostnameVerifier.java | 2 +-
.../share/classes/sun/nio/ch/Net.java | 6 +-
.../classes/sun/nio/ch/SelectorImpl.java | 2 +-
.../share/classes/sun/nio/ch/ThreadPool.java | 2 +-
.../classes/sun/nio/cs/CharsetMapping.java | 18 +-
.../share/classes/sun/nio/cs/DoubleByte.java | 2 +-
.../share/classes/sun/nio/cs/SingleByte.java | 4 +-
.../classes/sun/nio/cs/ThreadLocalCoders.java | 2 +-
...nsafeQualifiedStaticFieldAccessorImpl.java | 2 +-
.../TlsRsaPremasterSecretParameterSpec.java | 4 +-
.../classes/sun/security/jca/JCAUtil.java | 2 +-
.../sun/security/jca/ProviderConfig.java | 4 +-
.../sun/security/jca/ProviderList.java | 6 +-
.../sun/security/pkcs/PKCS9Attribute.java | 2 +-
.../security/provider/ByteArrayAccess.java | 2 +-
.../sun/security/provider/ConfigFile.java | 2 +-
.../classes/sun/security/provider/MD2.java | 4 +-
.../classes/sun/security/provider/MD4.java | 2 +-
.../sun/security/provider/ParameterCache.java | 4 +-
.../classes/sun/security/provider/SHA.java | 8 +-
.../sun/security/provider/SecureRandom.java | 2 +-
.../sun/security/provider/SeedGenerator.java | 6 +-
.../sun/security/provider/SunEntries.java | 8 +-
.../provider/certpath/AlgorithmChecker.java | 6 +-
.../security/provider/certpath/Builder.java | 2 +-
.../provider/certpath/ForwardBuilder.java | 2 +-
.../provider/certpath/OCSPResponse.java | 2 +-
.../provider/certpath/URICertStore.java | 4 +-
.../provider/certpath/UntrustedChecker.java | 2 +-
.../certpath/ssl/SSLServerCertStore.java | 6 +-
.../classes/sun/security/rsa/RSACore.java | 10 +-
.../sun/security/rsa/RSAKeyFactory.java | 20 +-
.../classes/sun/security/rsa/RSAPadding.java | 8 +-
.../security/rsa/RSAPrivateCrtKeyImpl.java | 2 +-
.../sun/security/ssl/AppOutputStream.java | 4 +-
.../sun/security/ssl/Authenticator.java | 2 +-
.../sun/security/ssl/BaseSSLSocketImpl.java | 8 +-
.../classes/sun/security/ssl/CipherBox.java | 2 +-
.../classes/sun/security/ssl/CipherSuite.java | 20 +-
.../classes/sun/security/ssl/Ciphertext.java | 2 +-
.../sun/security/ssl/ClientHandshaker.java | 10 +-
.../sun/security/ssl/ClientKeyExchange.java | 12 +-
.../sun/security/ssl/DTLSInputRecord.java | 2 +-
.../sun/security/ssl/EphemeralKeyManager.java | 8 +-
.../sun/security/ssl/ExtensionType.java | 28 +--
.../sun/security/ssl/HandshakeMessage.java | 28 +--
.../security/ssl/HandshakeStateManager.java | 4 +-
.../classes/sun/security/ssl/Handshaker.java | 2 +-
.../classes/sun/security/ssl/InputRecord.java | 2 +-
.../classes/sun/security/ssl/JsseJce.java | 32 +--
.../share/classes/sun/security/ssl/MAC.java | 2 +-
.../sun/security/ssl/OutputRecord.java | 2 +-
.../classes/sun/security/ssl/Plaintext.java | 2 +-
.../sun/security/ssl/ProtocolVersion.java | 32 +--
.../security/ssl/SSLAlgorithmConstraints.java | 14 +-
.../sun/security/ssl/SSLContextImpl.java | 8 +-
.../sun/security/ssl/SSLEngineImpl.java | 48 ++---
.../security/ssl/SSLEngineOutputRecord.java | 2 +-
.../sun/security/ssl/SSLServerSocketImpl.java | 12 +-
.../sun/security/ssl/SSLSessionImpl.java | 2 +-
.../security/ssl/SSLSocketFactoryImpl.java | 2 +-
.../sun/security/ssl/SSLSocketImpl.java | 48 ++---
.../sun/security/ssl/ServerHandshaker.java | 2 +-
.../sun/security/ssl/ServerNameExtension.java | 2 +-
.../ssl/SignatureAndHashAlgorithm.java | 8 +-
.../sun/security/ssl/StatusRequestType.java | 4 +-
.../ssl/SupportedEllipticCurvesExtension.java | 8 +-
...upportedEllipticPointFormatsExtension.java | 6 +-
.../sun/security/ssl/X509KeyManagerImpl.java | 2 +-
.../sun/security/timestamp/TSResponse.java | 2 +-
.../classes/sun/security/util/Cache.java | 6 +-
.../classes/sun/security/util/CurveDB.java | 8 +-
.../classes/sun/security/util/Debug.java | 2 +-
.../classes/sun/security/util/DerValue.java | 40 ++--
.../util/DisabledAlgorithmConstraints.java | 14 +-
.../sun/security/util/HostnameChecker.java | 12 +-
.../util/LegacyAlgorithmConstraints.java | 10 +-
.../sun/security/util/ObjectIdentifier.java | 4 +-
.../security/validator/EndEntityChecker.java | 36 ++--
.../sun/security/validator/KeyStores.java | 6 +-
.../sun/security/validator/PKIXValidator.java | 2 +-
.../security/validator/SimpleValidator.java | 16 +-
.../sun/security/validator/Validator.java | 20 +-
.../validator/ValidatorException.java | 16 +-
.../share/classes/sun/security/x509/AVA.java | 6 +-
.../sun/security/x509/DistributionPoint.java | 16 +-
.../sun/security/x509/IPAddressName.java | 2 +-
.../classes/sun/security/x509/OIDMap.java | 4 +-
.../sun/security/x509/ReasonFlags.java | 2 +-
.../sun/security/x509/X509CRLEntryImpl.java | 2 +-
.../sun/security/x509/X509CRLImpl.java | 4 +-
.../classes/sun/text/CompactByteArray.java | 2 +-
.../sun/text/normalizer/Norm2AllModes.java | 2 +-
.../sun/text/normalizer/NormalizerBase.java | 2 +-
.../classes/sun/text/normalizer/Trie2.java | 4 +-
.../sun/text/normalizer/UBiDiProps.java | 2 +-
.../classes/sun/text/normalizer/Utility.java | 4 +-
.../sun/util/calendar/CalendarSystem.java | 4 +-
.../classes/sun/util/calendar/ZoneInfo.java | 2 +-
.../sun/util/calendar/ZoneInfoFile.java | 2 +-
.../locale/provider/CalendarDataUtility.java | 4 +-
.../util/locale/provider/CollationRules.java | 2 +-
.../sun/util/logging/PlatformLogger.java | 2 +-
.../resources/OpenListResourceBundle.java | 2 +-
.../classes/java/lang/ProcessEnvironment.java | 2 +-
.../java/net/PlainDatagramSocketImpl.java | 2 +-
.../unix/classes/sun/net/NetHooks.java | 2 +-
.../unix/classes/sun/net/PortConfig.java | 2 +-
...ixAsynchronousServerSocketChannelImpl.java | 2 +-
.../ch/UnixAsynchronousSocketChannelImpl.java | 2 +-
.../unix/classes/sun/nio/fs/UnixUriUtils.java | 2 +-
.../sun/security/provider/NativePRNG.java | 4 +-
.../net/DefaultDatagramSocketImplFactory.java | 6 +-
.../net/TwoStacksPlainDatagramSocketImpl.java | 2 +-
.../windows/classes/sun/net/PortConfig.java | 2 +-
.../protocol/http/ntlm/NTLMAuthSequence.java | 2 +-
.../sun/nio/ch/WindowsSelectorImpl.java | 6 +-
.../classes/sun/nio/fs/WindowsConstants.java | 10 +-
.../sun/nio/fs/WindowsWatchService.java | 4 +-
.../HostLocaleProviderAdapterImpl.java | 2 +-
jdk/test/java/io/File/MaxPathLength.java | 2 +-
jdk/test/java/io/File/SymLinks.java | 20 +-
jdk/test/java/io/FileDescriptor/Sharing.java | 4 +-
.../java/io/IOException/LastErrorString.java | 12 +-
jdk/test/java/io/InputStreamReader/One.java | 2 +-
.../io/PrintStream/OversynchronizedTest.java | 2 +-
.../io/PrintWriter/OversynchronizedTest.java | 2 +-
.../Serializable/defaulted/GetFieldRead.java | 2 +-
.../Serializable/defaulted/GetFieldWrite.java | 2 +-
.../extension/ExtendedObjectInputStream.java | 4 +-
.../oldTests/CheckingEquality.java | 2 +-
.../subclass/AbstractObjectInputStream.java | 52 ++---
.../subclass/AbstractObjectOutputStream.java | 44 ++--
.../java/io/Serializable/subclass/Test.java | 6 +-
.../subclass/XObjectInputStream.java | 8 +-
.../subclass/XObjectOutputStream.java | 6 +-
.../typeSafeEnum/TypeSafeEnum.java | 6 +-
.../java/io/StreamTokenizer/ReadAhead.java | 8 +-
.../ClassDeclaredFieldsTest.java | 2 +-
.../FieldSetAccessibleTest.java | 2 +-
jdk/test/java/lang/Enum/ValueOf.java | 2 +-
jdk/test/java/lang/ProcessBuilder/Basic.java | 2 +-
.../java/lang/Runtime/exec/ExitValue.java | 2 +-
.../SecurityManager/CheckPackageMatching.java | 2 +-
.../lang/String/StringContentEqualsBug.java | 2 +-
jdk/test/java/lang/String/StringJoinTest.java | 22 +-
.../lang/StringBuffer/BufferForwarding.java | 8 +-
.../lang/StringBuilder/BuilderForwarding.java | 8 +-
.../lang/System/finalization/FinThreads.java | 2 +-
.../java/lang/Thread/GenerifyStackTraces.java | 4 +-
.../java/lang/ThreadLocal/ImmutableLocal.java | 4 +-
.../GetAnnotatedInterfaces.java | 2 +-
.../GetAnnotatedSuperclass.java | 2 +-
.../lang/instrument/ATestCaseScaffold.java | 2 +-
.../java/lang/invoke/6998541/Test6998541.java | 162 +++++++--------
.../java/lang/invoke/7157574/Test7157574.java | 4 +-
.../lang/invoke/7196190/ClassForNameTest.java | 2 +-
.../lang/invoke/7196190/GetUnsafeTest.java | 2 +-
.../java/lang/invoke/AccessControlTest.java | 18 +-
.../Acquaintance_remote.java | 20 +-
jdk/test/java/lang/invoke/CallSiteTest.java | 8 +-
.../java/lang/invoke/JavaDocExamplesTest.java | 4 +-
.../invoke/LFCaching/LambdaFormTestCase.java | 6 +-
.../MethodHandles/TestCatchException.java | 8 +-
.../java/lang/invoke/MethodHandlesTest.java | 2 +-
jdk/test/java/lang/invoke/indify/Indify.java | 4 +-
.../management/MemoryMXBean/GetMBeanInfo.java | 2 +-
.../lang/management/MemoryMXBean/Pending.java | 6 +-
.../lang/management/RuntimeMXBean/UpTime.java | 6 +-
.../management/ThreadMXBean/AllThreadIds.java | 6 +-
.../ThreadMXBean/ThreadBlockedCount.java | 4 +-
.../management/ThreadMXBean/ThreadCounts.java | 10 +-
.../lang/ref/ReferenceEnqueuePending.java | 6 +-
.../java/lang/ref/SoftReference/Bash.java | 4 +-
jdk/test/java/lang/ref/SoftReference/Pin.java | 4 +-
.../lang/reflect/Field/GenericStringTest.java | 2 +-
.../DefaultMethodModeling.java | 2 +-
.../nonPublicProxy/NonPublicProxyClass.java | 2 +-
jdk/test/java/util/Arrays/ParallelPrefix.java | 10 +-
jdk/test/java/util/Calendar/Bug8007038.java | 6 +-
.../java/util/Collection/BiggernYours.java | 8 +-
.../java/util/Collection/HotPotatoes.java | 2 +-
jdk/test/java/util/Collections/AddAll.java | 2 +-
jdk/test/java/util/Collections/Disjoint.java | 2 +-
jdk/test/java/util/Collections/Frequency.java | 2 +-
.../util/Collections/RacingCollections.java | 10 +-
.../java/util/Collections/ReverseOrder2.java | 6 +-
jdk/test/java/util/Deque/ChorusLine.java | 2 +-
jdk/test/java/util/LinkedHashMap/Basic.java | 4 +-
.../util/Locale/tools/EquivMapsGenerator.java | 4 +-
jdk/test/java/util/Map/Collisions.java | 2 +-
jdk/test/java/util/Map/FunctionalCMEs.java | 2 +-
.../java/util/Map/InPlaceOpsCollisions.java | 2 +-
.../java/util/Map/MapBinToFromTreeTest.java | 2 +-
jdk/test/java/util/NavigableMap/LockStep.java | 4 +-
.../java/util/ResourceBundle/Bug6190861.java | 2 +-
.../java/util/ResourceBundle/Bug6204853.java | 2 +-
.../java/util/ResourceBundle/Bug6355009.java | 2 +-
.../java/util/ResourceBundle/Bug6356571.java | 2 +-
.../ResourceBundle/Control/StressTest.java | 2 +-
.../java/util/ResourceBundle/Test4300693.java | 4 +-
.../TestGetBaseBundleName.java | 4 +-
jdk/test/java/util/ServiceLoader/Basic.java | 2 +-
jdk/test/java/util/ServiceLoader/NPE.java | 2 +-
.../Spliterator/SpliteratorCollisions.java | 2 +-
.../java/util/StringJoiner/MergeTest.java | 4 +-
jdk/test/java/util/TreeMap/ContainsValue.java | 2 +-
.../BlockingQueue/OfferDrainToLoops.java | 2 +-
.../ConcurrentQueues/OfferRemoveLoops.java | 2 +-
.../FutureTask/DoneTimedGetLoops.java | 4 +-
.../java/util/concurrent/Phaser/Basic.java | 4 +-
.../concurrent/locks/StampedLock/Basic.java | 6 +-
.../jar/JarEntry/GetMethodsReturnClones.java | 2 +-
jdk/test/java/util/jar/TestExtra.java | 8 +-
.../AnonymousLogger/TestAnonymousLogger.java | 6 +-
.../util/logging/DrainFindDeadlockTest.java | 4 +-
.../util/logging/FileHandlerLongLimit.java | 2 +-
.../java/util/logging/FileHandlerPath.java | 10 +-
.../logging/FileHandlerPatternExceptions.java | 2 +-
.../SerializeLogRecord.java | 2 +-
.../XmlFormatterNanos.java | 2 +-
.../ParentLoggerWithHandlerGC.java | 2 +-
.../Configuration/TestConfigurationLock.java | 8 +-
.../logging/LogManagerAppContextDeadlock.java | 6 +-
.../entering/LoggerEnteringWithParams.java | 2 +-
.../Logger/getGlobal/TestGetGlobal.java | 2 +-
.../Logger/getGlobal/TestGetGlobalByName.java | 2 +-
.../getGlobal/TestGetGlobalConcurrent.java | 10 +-
.../getGlobal/testgetglobal/HandlerImpl.java | 2 +-
.../Logger/logrb/TestLogrbResourceBundle.java | 4 +-
.../TestSetResourceBundle.java | 4 +-
.../logging/LoggerResourceBundleRace.java | 20 +-
.../RootLogger/RootLevelInConfigFile.java | 2 +-
.../util/logging/TestAppletLoggerContext.java | 2 +-
.../logging/TestConfigurationListeners.java | 2 +-
.../logging/TestLogConfigurationDeadLock.java | 6 +-
.../TestLogConfigurationDeadLockWithConf.java | 6 +-
.../util/logging/TestLoggerBundleSync.java | 16 +-
.../bundlesearch/IndirectlyLoadABundle.java | 2 +-
.../util/logging/bundlesearch/LoadItUp2.java | 2 +-
.../ResourceBundleSearchTest.java | 8 +-
.../TwiceIndirectlyLoadABundle.java | 2 +-
jdk/test/java/util/regex/POSIX_Unicode.java | 2 +-
.../java/util/stream/CollectorsTest.java | 2 +-
jdk/test/java/util/zip/ChecksumBase.java | 2 +-
.../java/util/zip/FlaterCriticalArray.java | 6 +-
jdk/test/java/util/zip/FlaterTest.java | 2 +-
.../util/zip/ZipFile/FinalizeZipFile.java | 2 +-
453 files changed, 1775 insertions(+), 1775 deletions(-)
diff --git a/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java b/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java
index 93381a62e39..573de6986f8 100644
--- a/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java
+++ b/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java
@@ -42,7 +42,7 @@ import java.io.IOException;
class DefaultInterface {
- private final static NetworkInterface defaultInterface =
+ private static final NetworkInterface defaultInterface =
chooseDefaultInterface();
static NetworkInterface getDefault() {
diff --git a/jdk/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java b/jdk/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
index 713df8e5dc5..e4eb8da63cd 100644
--- a/jdk/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
+++ b/jdk/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
@@ -106,7 +106,7 @@ public class HostLocaleProviderAdapterImpl {
tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l));
supportedLocaleSet = Collections.unmodifiableSet(tmpSet);
}
- private final static Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]);
+ private static final Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]);
@SuppressWarnings("fallthrough")
private static Locale convertMacOSXLocaleToJavaLocale(String macosxloc) {
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java
index abaeae0251e..aa3100c1b7d 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java
@@ -45,7 +45,7 @@ import java.security.InvalidKeyException;
final class RC2Crypt extends SymmetricCipher {
// PITABLE from the RFC, used in key setup
- private final static int[] PI_TABLE = new int[] {
+ private static final int[] PI_TABLE = new int[] {
0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed,
0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,
0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e,
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java
index 617865855c4..d1a3c2edfaa 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java
@@ -59,7 +59,7 @@ public final class RC2Parameters extends AlgorithmParametersSpi {
// TABLE[EKB] from section 6 of RFC 2268, used to convert effective key
// size to/from encoded version number
- private final static int[] EKB_TABLE = new int[] {
+ private static final int[] EKB_TABLE = new int[] {
0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a,
0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0,
0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b,
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java
index c912a3f04f0..6faa5b218df 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java
@@ -66,23 +66,23 @@ import sun.security.util.KeyUtil;
public final class RSACipher extends CipherSpi {
// constant for an empty byte array
- private final static byte[] B0 = new byte[0];
+ private static final byte[] B0 = new byte[0];
// mode constant for public key encryption
- private final static int MODE_ENCRYPT = 1;
+ private static final int MODE_ENCRYPT = 1;
// mode constant for private key decryption
- private final static int MODE_DECRYPT = 2;
+ private static final int MODE_DECRYPT = 2;
// mode constant for private key encryption (signing)
- private final static int MODE_SIGN = 3;
+ private static final int MODE_SIGN = 3;
// mode constant for public key decryption (verifying)
- private final static int MODE_VERIFY = 4;
+ private static final int MODE_VERIFY = 4;
// constant for raw RSA
- private final static String PAD_NONE = "NoPadding";
+ private static final String PAD_NONE = "NoPadding";
// constant for PKCS#1 v1.5 RSA
- private final static String PAD_PKCS1 = "PKCS1Padding";
+ private static final String PAD_PKCS1 = "PKCS1Padding";
// constant for PKCS#2 v2.0 OAEP with MGF1
- private final static String PAD_OAEP_MGF1 = "OAEP";
+ private static final String PAD_OAEP_MGF1 = "OAEP";
// current mode, one of MODE_* above. Set when init() is called
private int mode;
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java
index bd08e710bee..46933860c71 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java
@@ -43,7 +43,7 @@ import static com.sun.crypto.provider.TlsPrfGenerator.*;
*/
public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi {
- private final static String MSG = "TlsKeyMaterialGenerator must be "
+ private static final String MSG = "TlsKeyMaterialGenerator must be "
+ "initialized using a TlsKeyMaterialParameterSpec";
@SuppressWarnings("deprecation")
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java
index b0527026757..c772396e990 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java
@@ -43,7 +43,7 @@ import static com.sun.crypto.provider.TlsPrfGenerator.*;
*/
public final class TlsMasterSecretGenerator extends KeyGeneratorSpi {
- private final static String MSG = "TlsMasterSecretGenerator must be "
+ private static final String MSG = "TlsMasterSecretGenerator must be "
+ "initialized using a TlsMasterSecretParameterSpec";
@SuppressWarnings("deprecation")
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java
index 0461523dec3..90cde7c6bfb 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java
@@ -50,23 +50,23 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi {
// magic constants and utility functions, also used by other files
// in this package
- private final static byte[] B0 = new byte[0];
+ private static final byte[] B0 = new byte[0];
- final static byte[] LABEL_MASTER_SECRET = // "master secret"
+ static final byte[] LABEL_MASTER_SECRET = // "master secret"
{ 109, 97, 115, 116, 101, 114, 32, 115, 101, 99, 114, 101, 116 };
- final static byte[] LABEL_KEY_EXPANSION = // "key expansion"
+ static final byte[] LABEL_KEY_EXPANSION = // "key expansion"
{ 107, 101, 121, 32, 101, 120, 112, 97, 110, 115, 105, 111, 110 };
- final static byte[] LABEL_CLIENT_WRITE_KEY = // "client write key"
+ static final byte[] LABEL_CLIENT_WRITE_KEY = // "client write key"
{ 99, 108, 105, 101, 110, 116, 32, 119, 114, 105, 116, 101, 32,
107, 101, 121 };
- final static byte[] LABEL_SERVER_WRITE_KEY = // "server write key"
+ static final byte[] LABEL_SERVER_WRITE_KEY = // "server write key"
{ 115, 101, 114, 118, 101, 114, 32, 119, 114, 105, 116, 101, 32,
107, 101, 121 };
- final static byte[] LABEL_IV_BLOCK = // "IV block"
+ static final byte[] LABEL_IV_BLOCK = // "IV block"
{ 73, 86, 32, 98, 108, 111, 99, 107 };
/*
@@ -79,7 +79,7 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi {
private static final byte[] HMAC_opad128 = genPad((byte)0x5c, 128);
// SSL3 magic mix constants ("A", "BB", "CCC", ...)
- final static byte[][] SSL3_CONST = genConst();
+ static final byte[][] SSL3_CONST = genConst();
static byte[] genPad(byte b, int count) {
byte[] padding = new byte[count];
@@ -109,7 +109,7 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi {
// PRF implementation
- private final static String MSG = "TlsPrfGenerator must be "
+ private static final String MSG = "TlsPrfGenerator must be "
+ "initialized using a TlsPrfParameterSpec";
@SuppressWarnings("deprecation")
@@ -368,7 +368,7 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi {
* appropriate supportsParamters() checks into KeyGenerators (not
* currently there).
*/
- static public class V12 extends TlsPrfGenerator {
+ public static class V12 extends TlsPrfGenerator {
protected SecretKey engineGenerateKey() {
return engineGenerateKey0(true);
}
@@ -377,7 +377,7 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi {
/**
* A KeyGenerator implementation that supports TLS 1.0/1.1.
*/
- static public class V10 extends TlsPrfGenerator {
+ public static class V10 extends TlsPrfGenerator {
protected SecretKey engineGenerateKey() {
return engineGenerateKey0(false);
}
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
index c4fc8364584..ef2d6351dde 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
@@ -41,7 +41,7 @@ import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
*/
public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
- private final static String MSG = "TlsRsaPremasterSecretGenerator must be "
+ private static final String MSG = "TlsRsaPremasterSecretGenerator must be "
+ "initialized using a TlsRsaPremasterSecretParameterSpec";
@SuppressWarnings("deprecation")
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java
index 2a4854a5649..e8ff8951716 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java
@@ -342,7 +342,7 @@ class Attribute implements Comparable {
* presence of attributes. That is, flags are a mix of modifier
* bits and attribute indicators.
*/
- public static abstract
+ public abstract static
class Holder {
// We need this abstract method to interpret embedded CP refs.
@@ -461,7 +461,7 @@ class Attribute implements Comparable {
// Lightweight interface to hide details of band structure.
// Also used for testing.
- public static abstract
+ public abstract static
class ValueStream {
public int getInt(int bandIndex) { throw undef(); }
public void putInt(int bandIndex, int value) { throw undef(); }
@@ -667,7 +667,7 @@ class Attribute implements Comparable {
public boolean hasCallables() {
return (elems.length > 0 && elems[0].kind == EK_CBLE);
}
- static private final Element[] noElems = {};
+ private static final Element[] noElems = {};
public Element[] getCallables() {
if (hasCallables()) {
Element[] nelems = Arrays.copyOf(elems, elems.length);
@@ -783,7 +783,7 @@ class Attribute implements Comparable {
* Replaces '\c' by the decimal code of the character c.
* Replaces '0xNNN' by the decimal code of the hex number NNN.
*/
- static public
+ public static
String normalizeLayoutString(String layout) {
StringBuilder buf = new StringBuilder();
for (int i = 0, len = layout.length(); i < len; ) {
@@ -1139,7 +1139,7 @@ class Attribute implements Comparable {
bodies.toArray(res);
return res;
}
- static private
+ private static
int skipBody(String layout, int i) {
assert(layout.charAt(i-1) == '[');
if (layout.charAt(i) == ']')
@@ -1156,7 +1156,7 @@ class Attribute implements Comparable {
assert(layout.charAt(i) == ']');
return i; // return closing bracket
}
- static private
+ private static
int tokenizeUInt(Layout.Element e, String layout, int i) {
switch (layout.charAt(i++)) {
case 'V': e.len = 0; break;
@@ -1167,7 +1167,7 @@ class Attribute implements Comparable {
}
return i;
}
- static private
+ private static
int tokenizeSInt(Layout.Element e, String layout, int i) {
if (layout.charAt(i) == 'S') {
e.flags |= EF_SIGN;
@@ -1176,7 +1176,7 @@ class Attribute implements Comparable {
return tokenizeUInt(e, layout, i);
}
- static private
+ private static
boolean isDigit(char c) {
return c >= '0' && c <= '9';
}
@@ -1383,7 +1383,7 @@ class Attribute implements Comparable {
return e.body[lastj];
}
- static private
+ private static
int parseInt(Layout.Element e, byte[] bytes, int pos, int[] buf) {
int value = 0;
int loBits = e.len * 8;
@@ -1483,7 +1483,7 @@ class Attribute implements Comparable {
}
}
- static private
+ private static
void unparseInt(Layout.Element e, int value, ByteArrayOutputStream out) {
int loBits = e.len * 8;
if (loBits == 0) {
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java
index a7db9784946..3816dd77bb3 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java
@@ -73,7 +73,7 @@ class BandStructure {
boolean optVaryCodings = !p200.getBoolean(Utils.COM_PREFIX+"no.vary.codings");
boolean optBigStrings = !p200.getBoolean(Utils.COM_PREFIX+"no.big.strings");
- abstract protected Index getCPIndex(byte tag);
+ protected abstract Index getCPIndex(byte tag);
// Local copy of highest class version.
private Package.Version highestClassVersion = null;
@@ -97,27 +97,27 @@ class BandStructure {
protected BandStructure() {}
- final static Coding BYTE1 = Coding.of(1,256);
+ static final Coding BYTE1 = Coding.of(1,256);
- final static Coding CHAR3 = Coding.of(3,128);
+ static final Coding CHAR3 = Coding.of(3,128);
// Note: Tried sharper (3,16) with no post-zip benefit.
// This is best used with BCI values:
- final static Coding BCI5 = Coding.of(5,4); // mostly 1-byte offsets
- final static Coding BRANCH5 = Coding.of(5,4,2); // mostly forward branches
+ static final Coding BCI5 = Coding.of(5,4); // mostly 1-byte offsets
+ static final Coding BRANCH5 = Coding.of(5,4,2); // mostly forward branches
- final static Coding UNSIGNED5 = Coding.of(5,64);
- final static Coding UDELTA5 = UNSIGNED5.getDeltaCoding();
+ static final Coding UNSIGNED5 = Coding.of(5,64);
+ static final Coding UDELTA5 = UNSIGNED5.getDeltaCoding();
// "sharp" (5,64) zips 0.4% better than "medium" (5,128)
// It zips 1.1% better than "flat" (5,192)
- final static Coding SIGNED5 = Coding.of(5,64,1); //sharp
- final static Coding DELTA5 = SIGNED5.getDeltaCoding();
+ static final Coding SIGNED5 = Coding.of(5,64,1); //sharp
+ static final Coding DELTA5 = SIGNED5.getDeltaCoding();
// Note: Tried (5,128,2) and (5,192,2) with no benefit.
- final static Coding MDELTA5 = Coding.of(5,64,2).getDeltaCoding();
+ static final Coding MDELTA5 = Coding.of(5,64,2).getDeltaCoding();
- final private static Coding[] basicCodings = {
+ private static final Coding[] basicCodings = {
// Table of "Canonical BHSD Codings" from Pack200 spec.
null, // _meta_default
@@ -250,7 +250,7 @@ class BandStructure {
null
};
- final private static Map basicCodingIndexes;
+ private static final Map basicCodingIndexes;
static {
assert(basicCodings[_meta_default] == null);
assert(basicCodings[_meta_canon_min] != null);
@@ -362,9 +362,9 @@ class BandStructure {
protected long outputSize = -1; // cache
- final public Coding regularCoding;
+ public final Coding regularCoding;
- final public int seqForDebug;
+ public final int seqForDebug;
public int elementCountForDebug;
@@ -430,7 +430,7 @@ class BandStructure {
protected abstract long computeOutputSize();
- abstract protected void writeDataTo(OutputStream out) throws IOException;
+ protected abstract void writeDataTo(OutputStream out) throws IOException;
/** Expect a certain number of values. */
void expectLength(int l) {
@@ -468,7 +468,7 @@ class BandStructure {
readDataFrom(in);
readyToDisburse();
}
- abstract protected void readDataFrom(InputStream in) throws IOException;
+ protected abstract void readDataFrom(InputStream in) throws IOException;
protected void readyToDisburse() {
if (verbose > 1) Utils.log.fine("readyToDisburse "+this);
setPhase(DISBURSE_PHASE);
@@ -1447,7 +1447,7 @@ class BandStructure {
return b;
}
- static private final boolean NULL_IS_OK = true;
+ private static final boolean NULL_IS_OK = true;
MultiBand all_bands = (MultiBand) new MultiBand("(package)", UNSIGNED5).init();
@@ -2539,7 +2539,7 @@ class BandStructure {
return false;
}
- static private boolean assertDoneDisbursing(Band b) {
+ private static boolean assertDoneDisbursing(Band b) {
if (b.phase != DISBURSE_PHASE) {
Utils.log.warning("assertDoneDisbursing: still in phase "+b.phase+": "+b);
if (verbose() <= 1) return false; // fail now
@@ -2562,7 +2562,7 @@ class BandStructure {
return true;
}
- static private void printCDecl(Band b) {
+ private static void printCDecl(Band b) {
if (b instanceof MultiBand) {
MultiBand mb = (MultiBand) b;
for (int i = 0; i < mb.bandCount; i++) {
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java
index 856a83ceeb1..c69578af775 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java
@@ -56,7 +56,7 @@ class Code extends Attribute.Holder {
return m.getCPMap();
}
- static private final ConstantPool.Entry[] noRefs = ConstantPool.noRefs;
+ private static final ConstantPool.Entry[] noRefs = ConstantPool.noRefs;
// The following fields are used directly by the ClassReader, etc.
int max_stack;
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java
index d334af4bd67..9dd884b7ff6 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java
@@ -662,7 +662,7 @@ class Coding implements Comparable, CodingMethod, Histogram.BitMetric {
return lg;
}
- static private final byte[] byteBitWidths = new byte[0x100];
+ private static final byte[] byteBitWidths = new byte[0x100];
static {
for (int b = 0; b < byteBitWidths.length; b++) {
byteBitWidths[b] = (byte) ceil_lg2(b + 1);
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java
index f173cf8059a..4cc1d0898ed 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java
@@ -1139,7 +1139,7 @@ class CodingChooser {
}
}
- static private
+ private static
String pct(double num, double den) {
return (Math.round((num / den)*10000)/100.0)+"%";
}
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
index e4c7d7d931d..c4875bf27e6 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
@@ -194,7 +194,7 @@ class ConstantPool {
/** Entries in the constant pool. */
- public static abstract
+ public abstract static
class Entry implements Comparable {
protected final byte tag; // a CONSTANT_foo code
protected int valueHash; // cached hashCode
@@ -338,7 +338,7 @@ class ConstantPool {
return (REF_getField <= refKind && refKind <= REF_invokeInterface);
}
- public static abstract
+ public abstract static
class LiteralEntry extends Entry {
protected LiteralEntry(byte tag) {
super(tag);
@@ -785,7 +785,7 @@ class ConstantPool {
return new String(sig);
}
- static private int skipTo(char semi, String sig, int i) {
+ private static int skipTo(char semi, String sig, int i) {
i = sig.indexOf(semi, i);
return (i >= 0) ? i : sig.length();
}
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java
index 15991700f25..fee0b800f2d 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java
@@ -36,7 +36,7 @@ class Constants {
private Constants(){}
- public final static int JAVA_MAGIC = 0xCAFEBABE;
+ public static final int JAVA_MAGIC = 0xCAFEBABE;
/*
Java Class Version numbers history
@@ -48,93 +48,93 @@ class Constants {
1.8 to 1.7.x 52,0
*/
- public final static Package.Version JAVA_MIN_CLASS_VERSION =
+ public static final Package.Version JAVA_MIN_CLASS_VERSION =
Package.Version.of(45, 03);
- public final static Package.Version JAVA5_MAX_CLASS_VERSION =
+ public static final Package.Version JAVA5_MAX_CLASS_VERSION =
Package.Version.of(49, 00);
- public final static Package.Version JAVA6_MAX_CLASS_VERSION =
+ public static final Package.Version JAVA6_MAX_CLASS_VERSION =
Package.Version.of(50, 00);
- public final static Package.Version JAVA7_MAX_CLASS_VERSION =
+ public static final Package.Version JAVA7_MAX_CLASS_VERSION =
Package.Version.of(51, 00);
- public final static Package.Version JAVA8_MAX_CLASS_VERSION =
+ public static final Package.Version JAVA8_MAX_CLASS_VERSION =
Package.Version.of(52, 00);
- public final static int JAVA_PACKAGE_MAGIC = 0xCAFED00D;
+ public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D;
- public final static Package.Version JAVA5_PACKAGE_VERSION =
+ public static final Package.Version JAVA5_PACKAGE_VERSION =
Package.Version.of(150, 7);
- public final static Package.Version JAVA6_PACKAGE_VERSION =
+ public static final Package.Version JAVA6_PACKAGE_VERSION =
Package.Version.of(160, 1);
- public final static Package.Version JAVA7_PACKAGE_VERSION =
+ public static final Package.Version JAVA7_PACKAGE_VERSION =
Package.Version.of(170, 1);
- public final static Package.Version JAVA8_PACKAGE_VERSION =
+ public static final Package.Version JAVA8_PACKAGE_VERSION =
Package.Version.of(171, 0);
// upper limit, should point to the latest class version
- public final static Package.Version JAVA_MAX_CLASS_VERSION =
+ public static final Package.Version JAVA_MAX_CLASS_VERSION =
JAVA8_MAX_CLASS_VERSION;
// upper limit should point to the latest package version, for version info!.
- public final static Package.Version MAX_PACKAGE_VERSION =
+ public static final Package.Version MAX_PACKAGE_VERSION =
JAVA7_PACKAGE_VERSION;
- public final static int CONSTANT_POOL_INDEX_LIMIT = 0x10000;
- public final static int CONSTANT_POOL_NARROW_LIMIT = 0x00100;
+ public static final int CONSTANT_POOL_INDEX_LIMIT = 0x10000;
+ public static final int CONSTANT_POOL_NARROW_LIMIT = 0x00100;
- public final static String JAVA_SIGNATURE_CHARS = "BSCIJFDZLV([";
+ public static final String JAVA_SIGNATURE_CHARS = "BSCIJFDZLV([";
- public final static byte CONSTANT_Utf8 = 1;
- public final static byte CONSTANT_unused2 = 2; // unused, was Unicode
- public final static byte CONSTANT_Integer = 3;
- public final static byte CONSTANT_Float = 4;
- public final static byte CONSTANT_Long = 5;
- public final static byte CONSTANT_Double = 6;
- public final static byte CONSTANT_Class = 7;
- public final static byte CONSTANT_String = 8;
- public final static byte CONSTANT_Fieldref = 9;
- public final static byte CONSTANT_Methodref = 10;
- public final static byte CONSTANT_InterfaceMethodref = 11;
- public final static byte CONSTANT_NameandType = 12;
- public final static byte CONSTANT_unused13 = 13;
- public final static byte CONSTANT_unused14 = 14;
- public final static byte CONSTANT_MethodHandle = 15;
- public final static byte CONSTANT_MethodType = 16;
- public final static byte CONSTANT_unused17 = 17; // unused
- public final static byte CONSTANT_InvokeDynamic = 18;
+ public static final byte CONSTANT_Utf8 = 1;
+ public static final byte CONSTANT_unused2 = 2; // unused, was Unicode
+ public static final byte CONSTANT_Integer = 3;
+ public static final byte CONSTANT_Float = 4;
+ public static final byte CONSTANT_Long = 5;
+ public static final byte CONSTANT_Double = 6;
+ public static final byte CONSTANT_Class = 7;
+ public static final byte CONSTANT_String = 8;
+ public static final byte CONSTANT_Fieldref = 9;
+ public static final byte CONSTANT_Methodref = 10;
+ public static final byte CONSTANT_InterfaceMethodref = 11;
+ public static final byte CONSTANT_NameandType = 12;
+ public static final byte CONSTANT_unused13 = 13;
+ public static final byte CONSTANT_unused14 = 14;
+ public static final byte CONSTANT_MethodHandle = 15;
+ public static final byte CONSTANT_MethodType = 16;
+ public static final byte CONSTANT_unused17 = 17; // unused
+ public static final byte CONSTANT_InvokeDynamic = 18;
// pseudo-constants:
- public final static byte CONSTANT_None = 0;
- public final static byte CONSTANT_Signature = CONSTANT_unused13;
- public final static byte CONSTANT_BootstrapMethod = CONSTANT_unused17; // used only in InvokeDynamic constants
- public final static byte CONSTANT_Limit = 19;
+ public static final byte CONSTANT_None = 0;
+ public static final byte CONSTANT_Signature = CONSTANT_unused13;
+ public static final byte CONSTANT_BootstrapMethod = CONSTANT_unused17; // used only in InvokeDynamic constants
+ public static final byte CONSTANT_Limit = 19;
- public final static byte CONSTANT_All = 50; // combined global map
- public final static byte CONSTANT_LoadableValue = 51; // used for 'KL' and qldc operands
- public final static byte CONSTANT_AnyMember = 52; // union of refs to field or (interface) method
- public final static byte CONSTANT_FieldSpecific = 53; // used only for 'KQ' ConstantValue attrs
- public final static byte CONSTANT_GroupFirst = CONSTANT_All;
- public final static byte CONSTANT_GroupLimit = CONSTANT_FieldSpecific+1;
+ public static final byte CONSTANT_All = 50; // combined global map
+ public static final byte CONSTANT_LoadableValue = 51; // used for 'KL' and qldc operands
+ public static final byte CONSTANT_AnyMember = 52; // union of refs to field or (interface) method
+ public static final byte CONSTANT_FieldSpecific = 53; // used only for 'KQ' ConstantValue attrs
+ public static final byte CONSTANT_GroupFirst = CONSTANT_All;
+ public static final byte CONSTANT_GroupLimit = CONSTANT_FieldSpecific+1;
// CONSTANT_MethodHandle reference kinds
- public final static byte REF_getField = 1;
- public final static byte REF_getStatic = 2;
- public final static byte REF_putField = 3;
- public final static byte REF_putStatic = 4;
- public final static byte REF_invokeVirtual = 5;
- public final static byte REF_invokeStatic = 6;
- public final static byte REF_invokeSpecial = 7;
- public final static byte REF_newInvokeSpecial = 8;
- public final static byte REF_invokeInterface = 9;
+ public static final byte REF_getField = 1;
+ public static final byte REF_getStatic = 2;
+ public static final byte REF_putField = 3;
+ public static final byte REF_putStatic = 4;
+ public static final byte REF_invokeVirtual = 5;
+ public static final byte REF_invokeStatic = 6;
+ public static final byte REF_invokeSpecial = 7;
+ public static final byte REF_newInvokeSpecial = 8;
+ public static final byte REF_invokeInterface = 9;
// pseudo-access bits
- public final static int ACC_IC_LONG_FORM = (1<<16); //for ic_flags
+ public static final int ACC_IC_LONG_FORM = (1<<16); //for ic_flags
// attribute "context types"
public static final int ATTR_CONTEXT_CLASS = 0;
@@ -199,14 +199,14 @@ class Constants {
public static final int NO_MODTIME = 0; // null modtime value
// some comstantly empty containers
- public final static int[] noInts = {};
- public final static byte[] noBytes = {};
- public final static Object[] noValues = {};
- public final static String[] noStrings = {};
- public final static List emptyList = Arrays.asList(noValues);
+ public static final int[] noInts = {};
+ public static final byte[] noBytes = {};
+ public static final Object[] noValues = {};
+ public static final String[] noStrings = {};
+ public static final List emptyList = Arrays.asList(noValues);
// meta-coding
- public final static int
+ public static final int
_meta_default = 0,
_meta_canon_min = 1,
_meta_canon_max = 115,
@@ -216,7 +216,7 @@ class Constants {
_meta_limit = 189;
// bytecodes
- public final static int
+ public static final int
_nop = 0, // 0x00
_aconst_null = 1, // 0x01
_iconst_m1 = 2, // 0x02
@@ -422,10 +422,10 @@ class Constants {
_bytecode_limit = 202; // 0xca
// End marker, used to terminate bytecode sequences:
- public final static int _end_marker = 255;
+ public static final int _end_marker = 255;
// Escapes:
- public final static int _byte_escape = 254;
- public final static int _ref_escape = 253;
+ public static final int _byte_escape = 254;
+ public static final int _ref_escape = 253;
// Self-relative pseudo-opcodes for better compression.
// A "linker op" is a bytecode which links to a class member.
@@ -440,26 +440,26 @@ class Constants {
// For simplicity, we define the full symmetric set of variants.
// However, some of them are relatively useless.
// Self linker ops are enabled by Pack.selfCallVariants (true).
- public final static int _first_linker_op = _getstatic;
- public final static int _last_linker_op = _invokestatic;
- public final static int _num_linker_ops = (_last_linker_op - _first_linker_op) + 1;
- public final static int _self_linker_op = _bytecode_limit;
- public final static int _self_linker_aload_flag = 1*_num_linker_ops;
- public final static int _self_linker_super_flag = 2*_num_linker_ops;
- public final static int _self_linker_limit = _self_linker_op + 4*_num_linker_ops;
+ public static final int _first_linker_op = _getstatic;
+ public static final int _last_linker_op = _invokestatic;
+ public static final int _num_linker_ops = (_last_linker_op - _first_linker_op) + 1;
+ public static final int _self_linker_op = _bytecode_limit;
+ public static final int _self_linker_aload_flag = 1*_num_linker_ops;
+ public static final int _self_linker_super_flag = 2*_num_linker_ops;
+ public static final int _self_linker_limit = _self_linker_op + 4*_num_linker_ops;
// An "invoke init" op is a variant of invokespecial which works
// only with the method name "". There are variants which
// link to the current class, the super class, or the class of the
// immediately previous "newinstance" op. There are 3 of these ops.
// They all take method signature references as operands.
// Invoke init ops are enabled by Pack.initCallVariants (true).
- public final static int _invokeinit_op = _self_linker_limit;
- public final static int _invokeinit_self_option = 0;
- public final static int _invokeinit_super_option = 1;
- public final static int _invokeinit_new_option = 2;
- public final static int _invokeinit_limit = _invokeinit_op+3;
+ public static final int _invokeinit_op = _self_linker_limit;
+ public static final int _invokeinit_self_option = 0;
+ public static final int _invokeinit_super_option = 1;
+ public static final int _invokeinit_new_option = 2;
+ public static final int _invokeinit_limit = _invokeinit_op+3;
- public final static int _pseudo_instruction_limit = _invokeinit_limit;
+ public static final int _pseudo_instruction_limit = _invokeinit_limit;
// linker variant limit == 202+(7*4)+3 == 233
// Ldc variants support strongly typed references to constants.
@@ -467,25 +467,25 @@ class Constants {
// which is a great simplification.
// Ldc variants gain us only 0.007% improvement in compression ratio,
// but they simplify the file format greatly.
- public final static int _xldc_op = _invokeinit_limit;
- public final static int _sldc = _ldc; // previously named _aldc
- public final static int _cldc = _xldc_op+0;
- public final static int _ildc = _xldc_op+1;
- public final static int _fldc = _xldc_op+2;
- public final static int _sldc_w = _ldc_w; // previously named _aldc_w
- public final static int _cldc_w = _xldc_op+3;
- public final static int _ildc_w = _xldc_op+4;
- public final static int _fldc_w = _xldc_op+5;
- public final static int _lldc2_w = _ldc2_w;
- public final static int _dldc2_w = _xldc_op+6;
+ public static final int _xldc_op = _invokeinit_limit;
+ public static final int _sldc = _ldc; // previously named _aldc
+ public static final int _cldc = _xldc_op+0;
+ public static final int _ildc = _xldc_op+1;
+ public static final int _fldc = _xldc_op+2;
+ public static final int _sldc_w = _ldc_w; // previously named _aldc_w
+ public static final int _cldc_w = _xldc_op+3;
+ public static final int _ildc_w = _xldc_op+4;
+ public static final int _fldc_w = _xldc_op+5;
+ public static final int _lldc2_w = _ldc2_w;
+ public static final int _dldc2_w = _xldc_op+6;
// anything other than primitive, string, or class must be handled with qldc:
- public final static int _qldc = _xldc_op+7;
- public final static int _qldc_w = _xldc_op+8;
- public final static int _xldc_limit = _xldc_op+9;
+ public static final int _qldc = _xldc_op+7;
+ public static final int _qldc_w = _xldc_op+8;
+ public static final int _xldc_limit = _xldc_op+9;
// handling of InterfaceMethodRef
- public final static int _invoke_int_op = _xldc_limit;
- public final static int _invokespecial_int = _invoke_int_op+0;
- public final static int _invokestatic_int = _invoke_int_op+1;
- public final static int _invoke_int_limit = _invoke_int_op+2;
+ public static final int _invoke_int_op = _xldc_limit;
+ public static final int _invokespecial_int = _invoke_int_op+0;
+ public static final int _invokestatic_int = _invoke_int_op+1;
+ public static final int _invoke_int_limit = _invoke_int_op+2;
}
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java
index c0393d3de4a..13ccac8b46d 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java
@@ -376,7 +376,7 @@ class Driver {
}
}
- static private
+ private static
File createTempFile(String basefile, String suffix) throws IOException {
File base = new File(basefile);
String prefix = base.getName();
@@ -393,7 +393,7 @@ class Driver {
return tmpfile.toFile();
}
- static private
+ private static
void printUsage(boolean doPack, boolean full, PrintStream out) {
String prog = doPack ? "pack200" : "unpack200";
String[] packUsage = (String[])RESOURCE.getObject(DriverResource.PACK_HELP);
@@ -408,7 +408,7 @@ class Driver {
}
}
- static private
+ private static
String getZipComment(String jarfile) throws IOException {
byte[] tail = new byte[1000];
long filelen = new File(jarfile).length();
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java
index 2616405893e..e6ea5b4c077 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java
@@ -218,7 +218,7 @@ final class Histogram {
return sum;
}
- static private
+ private static
double round(double x, double scale) {
return Math.round(x * scale) / scale;
}
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java
index 93175fe8ecf..cfbe8638b24 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java
@@ -471,14 +471,14 @@ class Instruction {
/// Format definitions.
- static private final byte[][] BC_LENGTH = new byte[2][0x100];
- static private final byte[][] BC_INDEX = new byte[2][0x100];
- static private final byte[][] BC_TAG = new byte[2][0x100];
- static private final byte[][] BC_BRANCH = new byte[2][0x100];
- static private final byte[][] BC_SLOT = new byte[2][0x100];
- static private final byte[][] BC_CON = new byte[2][0x100];
- static private final String[] BC_NAME = new String[0x100]; // debug only
- static private final String[][] BC_FORMAT = new String[2][_bytecode_limit]; // debug only
+ private static final byte[][] BC_LENGTH = new byte[2][0x100];
+ private static final byte[][] BC_INDEX = new byte[2][0x100];
+ private static final byte[][] BC_TAG = new byte[2][0x100];
+ private static final byte[][] BC_BRANCH = new byte[2][0x100];
+ private static final byte[][] BC_SLOT = new byte[2][0x100];
+ private static final byte[][] BC_CON = new byte[2][0x100];
+ private static final String[] BC_NAME = new String[0x100]; // debug only
+ private static final String[][] BC_FORMAT = new String[2][_bytecode_limit]; // debug only
static {
for (int i = 0; i < _bytecode_limit; i++) {
BC_LENGTH[0][i] = -1;
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
index d254cb8d5d2..2e6a4a4e11f 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java
@@ -104,7 +104,7 @@ class NativeUnpack {
}
// for JNI callbacks
- static private Object currentInstance() {
+ private static Object currentInstance() {
UnpackerImpl p200 = (UnpackerImpl) Utils.getTLGlobals();
return (p200 == null)? null: p200._nunp;
}
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java
index 002d88197cb..12baf44fe58 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java
@@ -990,7 +990,7 @@ class Package {
}
// Helper for building InnerClasses attributes.
- static private
+ private static
void visitInnerClassRefs(Collection innerClasses, int mode, Collection refs) {
if (innerClasses == null) {
return; // no attribute; nothing to do
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java
index 018c33f6fd0..1a60f9e1047 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java
@@ -218,7 +218,7 @@ class PackageReader extends BandStructure {
return res;
}
- final static int MAGIC_BYTES = 4;
+ static final int MAGIC_BYTES = 4;
void readArchiveMagic() throws IOException {
// Read a minimum of bytes in the first gulp.
diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java
index ebe0960dba0..0c9109542bd 100644
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java
@@ -265,7 +265,7 @@ class Utils {
}
}
// Wrapper to prevent closing of client-supplied stream.
- static private
+ private static
class NonCloser extends FilterOutputStream {
NonCloser(OutputStream out) { super(out); }
public void close() throws IOException { flush(); }
diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java
index 6ce3b16ff0b..0ddaa794efc 100644
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java
@@ -46,7 +46,7 @@ import javax.net.ssl.SSLPeerUnverifiedException;
* replaced by {@link javax.net.ssl.HttpsURLConnection}.
*/
@Deprecated
-abstract public
+public abstract
class HttpsURLConnection extends HttpURLConnection
{
/*
diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java
index 6ddf6bf6917..620de110be2 100644
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java
@@ -61,7 +61,7 @@ public class KeyManagerFactory {
*
* @see java.security.Security security properties
*/
- public final static String getDefaultAlgorithm() {
+ public static final String getDefaultAlgorithm() {
String type;
type = AccessController.doPrivileged(new PrivilegedAction<>() {
public String run() {
diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java
index 8b0701c0a29..14c54d29a8b 100644
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java
@@ -61,7 +61,7 @@ public class TrustManagerFactory {
*
* @see java.security.Security security properties
*/
- public final static String getDefaultAlgorithm() {
+ public static final String getDefaultAlgorithm() {
String type;
type = AccessController.doPrivileged(new PrivilegedAction<>() {
public String run() {
diff --git a/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java b/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
index b9ffb200a81..0fb1a6c1e88 100644
--- a/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
+++ b/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
@@ -56,7 +56,7 @@ public class X509V1CertImpl extends X509Certificate implements Serializable {
static final long serialVersionUID = -2048442350420423405L;
private java.security.cert.X509Certificate wrappedCert;
- synchronized private static java.security.cert.CertificateFactory
+ private static synchronized java.security.cert.CertificateFactory
getFactory()
throws java.security.cert.CertificateException
{
diff --git a/jdk/src/java.base/share/classes/com/sun/security/ntlm/Client.java b/jdk/src/java.base/share/classes/com/sun/security/ntlm/Client.java
index 9aacd433793..fe33ee89bde 100644
--- a/jdk/src/java.base/share/classes/com/sun/security/ntlm/Client.java
+++ b/jdk/src/java.base/share/classes/com/sun/security/ntlm/Client.java
@@ -43,8 +43,8 @@ import java.util.Locale;
*
*/
public final class Client extends NTLM {
- final private String hostname;
- final private String username;
+ private final String hostname;
+ private final String username;
private String domain;
private byte[] pw1, pw2;
diff --git a/jdk/src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java b/jdk/src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java
index 7275b4ae6d9..736db459cf3 100644
--- a/jdk/src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java
+++ b/jdk/src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java
@@ -36,13 +36,13 @@ public final class NTLMException extends GeneralSecurityException {
/**
* If the incoming packet is invalid.
*/
- public final static int PACKET_READ_ERROR = 1;
+ public static final int PACKET_READ_ERROR = 1;
/**
* If the client cannot get a domain value from the server and the
* caller has not provided one.
*/
- public final static int NO_DOMAIN_INFO = 2;
+ public static final int NO_DOMAIN_INFO = 2;
/**
* If the domain provided by the client does not match the one received
@@ -53,22 +53,22 @@ public final class NTLMException extends GeneralSecurityException {
/**
* If the client name is not found on server's user database.
*/
- public final static int USER_UNKNOWN = 3;
+ public static final int USER_UNKNOWN = 3;
/**
* If authentication fails.
*/
- public final static int AUTH_FAILED = 4;
+ public static final int AUTH_FAILED = 4;
/**
* If an illegal version string is provided.
*/
- public final static int BAD_VERSION = 5;
+ public static final int BAD_VERSION = 5;
/**
* Protocol errors.
*/
- public final static int PROTOCOL = 6;
+ public static final int PROTOCOL = 6;
private int errorCode;
diff --git a/jdk/src/java.base/share/classes/com/sun/security/ntlm/Server.java b/jdk/src/java.base/share/classes/com/sun/security/ntlm/Server.java
index adec1a3fa29..2e97579e669 100644
--- a/jdk/src/java.base/share/classes/com/sun/security/ntlm/Server.java
+++ b/jdk/src/java.base/share/classes/com/sun/security/ntlm/Server.java
@@ -49,8 +49,8 @@ import java.util.Locale;
*
*/
public abstract class Server extends NTLM {
- final private String domain;
- final private boolean allVersion;
+ private final String domain;
+ private final boolean allVersion;
/**
* Creates a Server instance.
* @param version the NTLM version to use, which can be:
diff --git a/jdk/src/java.base/share/classes/java/io/Console.java b/jdk/src/java.base/share/classes/java/io/Console.java
index df47870e14d..abf8559dd5c 100644
--- a/jdk/src/java.base/share/classes/java/io/Console.java
+++ b/jdk/src/java.base/share/classes/java/io/Console.java
@@ -554,7 +554,7 @@ public final class Console implements Flushable
});
}
private static Console cons;
- private native static boolean istty();
+ private static native boolean istty();
private Console() {
readLock = new Object();
writeLock = new Object();
diff --git a/jdk/src/java.base/share/classes/java/io/DataInputStream.java b/jdk/src/java.base/share/classes/java/io/DataInputStream.java
index 0ef3c356e2b..6ce6b233ee6 100644
--- a/jdk/src/java.base/share/classes/java/io/DataInputStream.java
+++ b/jdk/src/java.base/share/classes/java/io/DataInputStream.java
@@ -585,7 +585,7 @@ loop: while (true) {
* valid modified UTF-8 encoding of a Unicode string.
* @see java.io.DataInputStream#readUnsignedShort()
*/
- public final static String readUTF(DataInput in) throws IOException {
+ public static final String readUTF(DataInput in) throws IOException {
int utflen = in.readUnsignedShort();
byte[] bytearr = null;
char[] chararr = null;
diff --git a/jdk/src/java.base/share/classes/java/io/File.java b/jdk/src/java.base/share/classes/java/io/File.java
index e2ec80a92d1..63e6d571ed2 100644
--- a/jdk/src/java.base/share/classes/java/io/File.java
+++ b/jdk/src/java.base/share/classes/java/io/File.java
@@ -2204,7 +2204,7 @@ public class File
// -- Integration with java.nio.file --
- private volatile transient Path filePath;
+ private transient volatile Path filePath;
/**
* Returns a {@link Path java.nio.file.Path} object constructed from the
diff --git a/jdk/src/java.base/share/classes/java/io/FilePermission.java b/jdk/src/java.base/share/classes/java/io/FilePermission.java
index e3dc11f4eb5..3e948f58aae 100644
--- a/jdk/src/java.base/share/classes/java/io/FilePermission.java
+++ b/jdk/src/java.base/share/classes/java/io/FilePermission.java
@@ -101,32 +101,32 @@ public final class FilePermission extends Permission implements Serializable {
/**
* Execute action.
*/
- private final static int EXECUTE = 0x1;
+ private static final int EXECUTE = 0x1;
/**
* Write action.
*/
- private final static int WRITE = 0x2;
+ private static final int WRITE = 0x2;
/**
* Read action.
*/
- private final static int READ = 0x4;
+ private static final int READ = 0x4;
/**
* Delete action.
*/
- private final static int DELETE = 0x8;
+ private static final int DELETE = 0x8;
/**
* Read link action.
*/
- private final static int READLINK = 0x10;
+ private static final int READLINK = 0x10;
/**
* All actions (read,write,execute,delete,readlink)
*/
- private final static int ALL = READ|WRITE|EXECUTE|DELETE|READLINK;
+ private static final int ALL = READ|WRITE|EXECUTE|DELETE|READLINK;
/**
* No actions.
*/
- private final static int NONE = 0x0;
+ private static final int NONE = 0x0;
// the actions mask
private transient int mask;
diff --git a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java
index 389a70be1d3..133fc545def 100644
--- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java
@@ -1079,7 +1079,7 @@ public class ObjectInputStream
/**
* Provide access to the persistent fields read from the input stream.
*/
- public static abstract class GetField {
+ public abstract static class GetField {
/**
* Get the ObjectStreamClass that describes the fields in the stream.
diff --git a/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java b/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java
index 861b201aae8..2fc905e2dd3 100644
--- a/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java
+++ b/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java
@@ -875,7 +875,7 @@ public class ObjectOutputStream
*
* @since 1.2
*/
- public static abstract class PutField {
+ public abstract static class PutField {
/**
* Put the value of the named boolean field into the persistent field.
diff --git a/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java b/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java
index cd5cda45170..5c3c707768b 100644
--- a/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java
+++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java
@@ -1839,7 +1839,7 @@ public class ObjectStreamClass implements Serializable {
* Returns true if the given class defines a static initializer method,
* false otherwise.
*/
- private native static boolean hasStaticInitializer(Class> cl);
+ private static native boolean hasStaticInitializer(Class> cl);
/**
* Class for computing and caching field/constructor/method signatures
diff --git a/jdk/src/java.base/share/classes/java/io/ObjectStreamConstants.java b/jdk/src/java.base/share/classes/java/io/ObjectStreamConstants.java
index fd7e7666e74..7c6f4d84c96 100644
--- a/jdk/src/java.base/share/classes/java/io/ObjectStreamConstants.java
+++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamConstants.java
@@ -36,12 +36,12 @@ public interface ObjectStreamConstants {
/**
* Magic number that is written to the stream header.
*/
- final static short STREAM_MAGIC = (short)0xaced;
+ static final short STREAM_MAGIC = (short)0xaced;
/**
* Version number that is written to the stream header.
*/
- final static short STREAM_VERSION = 5;
+ static final short STREAM_VERSION = 5;
/* Each item in the stream is preceded by a tag
*/
@@ -49,95 +49,95 @@ public interface ObjectStreamConstants {
/**
* First tag value.
*/
- final static byte TC_BASE = 0x70;
+ static final byte TC_BASE = 0x70;
/**
* Null object reference.
*/
- final static byte TC_NULL = (byte)0x70;
+ static final byte TC_NULL = (byte)0x70;
/**
* Reference to an object already written into the stream.
*/
- final static byte TC_REFERENCE = (byte)0x71;
+ static final byte TC_REFERENCE = (byte)0x71;
/**
* new Class Descriptor.
*/
- final static byte TC_CLASSDESC = (byte)0x72;
+ static final byte TC_CLASSDESC = (byte)0x72;
/**
* new Object.
*/
- final static byte TC_OBJECT = (byte)0x73;
+ static final byte TC_OBJECT = (byte)0x73;
/**
* new String.
*/
- final static byte TC_STRING = (byte)0x74;
+ static final byte TC_STRING = (byte)0x74;
/**
* new Array.
*/
- final static byte TC_ARRAY = (byte)0x75;
+ static final byte TC_ARRAY = (byte)0x75;
/**
* Reference to Class.
*/
- final static byte TC_CLASS = (byte)0x76;
+ static final byte TC_CLASS = (byte)0x76;
/**
* Block of optional data. Byte following tag indicates number
* of bytes in this block data.
*/
- final static byte TC_BLOCKDATA = (byte)0x77;
+ static final byte TC_BLOCKDATA = (byte)0x77;
/**
* End of optional block data blocks for an object.
*/
- final static byte TC_ENDBLOCKDATA = (byte)0x78;
+ static final byte TC_ENDBLOCKDATA = (byte)0x78;
/**
* Reset stream context. All handles written into stream are reset.
*/
- final static byte TC_RESET = (byte)0x79;
+ static final byte TC_RESET = (byte)0x79;
/**
* long Block data. The long following the tag indicates the
* number of bytes in this block data.
*/
- final static byte TC_BLOCKDATALONG= (byte)0x7A;
+ static final byte TC_BLOCKDATALONG= (byte)0x7A;
/**
* Exception during write.
*/
- final static byte TC_EXCEPTION = (byte)0x7B;
+ static final byte TC_EXCEPTION = (byte)0x7B;
/**
* Long string.
*/
- final static byte TC_LONGSTRING = (byte)0x7C;
+ static final byte TC_LONGSTRING = (byte)0x7C;
/**
* new Proxy Class Descriptor.
*/
- final static byte TC_PROXYCLASSDESC = (byte)0x7D;
+ static final byte TC_PROXYCLASSDESC = (byte)0x7D;
/**
* new Enum constant.
* @since 1.5
*/
- final static byte TC_ENUM = (byte)0x7E;
+ static final byte TC_ENUM = (byte)0x7E;
/**
* Last tag value.
*/
- final static byte TC_MAX = (byte)0x7E;
+ static final byte TC_MAX = (byte)0x7E;
/**
* First wire handle to be assigned.
*/
- final static int baseWireHandle = 0x7e0000;
+ static final int baseWireHandle = 0x7e0000;
/******************************************************/
@@ -147,7 +147,7 @@ public interface ObjectStreamConstants {
* Bit mask for ObjectStreamClass flag. Indicates a Serializable class
* defines its own writeObject method.
*/
- final static byte SC_WRITE_METHOD = 0x01;
+ static final byte SC_WRITE_METHOD = 0x01;
/**
* Bit mask for ObjectStreamClass flag. Indicates Externalizable data
@@ -157,23 +157,23 @@ public interface ObjectStreamConstants {
* @see #PROTOCOL_VERSION_2
* @since 1.2
*/
- final static byte SC_BLOCK_DATA = 0x08;
+ static final byte SC_BLOCK_DATA = 0x08;
/**
* Bit mask for ObjectStreamClass flag. Indicates class is Serializable.
*/
- final static byte SC_SERIALIZABLE = 0x02;
+ static final byte SC_SERIALIZABLE = 0x02;
/**
* Bit mask for ObjectStreamClass flag. Indicates class is Externalizable.
*/
- final static byte SC_EXTERNALIZABLE = 0x04;
+ static final byte SC_EXTERNALIZABLE = 0x04;
/**
* Bit mask for ObjectStreamClass flag. Indicates class is an enum type.
* @since 1.5
*/
- final static byte SC_ENUM = 0x10;
+ static final byte SC_ENUM = 0x10;
/* *******************************************************************/
@@ -187,7 +187,7 @@ public interface ObjectStreamConstants {
* @see java.io.ObjectInputStream#enableResolveObject(boolean)
* @since 1.2
*/
- final static SerializablePermission SUBSTITUTION_PERMISSION =
+ static final SerializablePermission SUBSTITUTION_PERMISSION =
new SerializablePermission("enableSubstitution");
/**
@@ -197,7 +197,7 @@ public interface ObjectStreamConstants {
* @see java.io.ObjectInputStream#readObjectOverride()
* @since 1.2
*/
- final static SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION =
+ static final SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION =
new SerializablePermission("enableSubclassImplementation");
/**
* A Stream Protocol Version.
@@ -210,7 +210,7 @@ public interface ObjectStreamConstants {
* @see java.io.ObjectOutputStream#useProtocolVersion(int)
* @since 1.2
*/
- public final static int PROTOCOL_VERSION_1 = 1;
+ public static final int PROTOCOL_VERSION_1 = 1;
/**
@@ -231,5 +231,5 @@ public interface ObjectStreamConstants {
* @see #SC_BLOCK_DATA
* @since 1.2
*/
- public final static int PROTOCOL_VERSION_2 = 2;
+ public static final int PROTOCOL_VERSION_2 = 2;
}
diff --git a/jdk/src/java.base/share/classes/java/io/Reader.java b/jdk/src/java.base/share/classes/java/io/Reader.java
index 0045f00b6fd..13e90d76ea6 100644
--- a/jdk/src/java.base/share/classes/java/io/Reader.java
+++ b/jdk/src/java.base/share/classes/java/io/Reader.java
@@ -157,7 +157,7 @@ public abstract class Reader implements Readable, Closeable {
* If {@code off} is negative, or {@code len} is negative,
* or {@code len} is greater than {@code cbuf.length - off}
*/
- abstract public int read(char cbuf[], int off, int len) throws IOException;
+ public abstract int read(char cbuf[], int off, int len) throws IOException;
/** Maximum skip-buffer size */
private static final int maxSkipBufferSize = 8192;
@@ -260,6 +260,6 @@ public abstract class Reader implements Readable, Closeable {
*
* @exception IOException If an I/O error occurs
*/
- abstract public void close() throws IOException;
+ public abstract void close() throws IOException;
}
diff --git a/jdk/src/java.base/share/classes/java/io/Writer.java b/jdk/src/java.base/share/classes/java/io/Writer.java
index 85d9290c2e1..5ad5e554fb3 100644
--- a/jdk/src/java.base/share/classes/java/io/Writer.java
+++ b/jdk/src/java.base/share/classes/java/io/Writer.java
@@ -142,7 +142,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
* @throws IOException
* If an I/O error occurs
*/
- abstract public void write(char cbuf[], int off, int len) throws IOException;
+ public abstract void write(char cbuf[], int off, int len) throws IOException;
/**
* Writes a string.
@@ -312,7 +312,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
* @throws IOException
* If an I/O error occurs
*/
- abstract public void flush() throws IOException;
+ public abstract void flush() throws IOException;
/**
* Closes the stream, flushing it first. Once the stream has been closed,
@@ -322,6 +322,6 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
* @throws IOException
* If an I/O error occurs
*/
- abstract public void close() throws IOException;
+ public abstract void close() throws IOException;
}
diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java
index 2e8a469e9ba..fc1e6b9f0f3 100644
--- a/jdk/src/java.base/share/classes/java/lang/Class.java
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java
@@ -469,8 +469,8 @@ public final class Class implements java.io.Serializable,
return null;
}
}
- private volatile transient Constructor cachedConstructor;
- private volatile transient Class> newInstanceCallerCache;
+ private transient volatile Constructor cachedConstructor;
+ private transient volatile Class> newInstanceCallerCache;
/**
@@ -1123,7 +1123,7 @@ public final class Class implements java.io.Serializable,
}
}
- private final static class EnclosingMethodInfo {
+ private static final class EnclosingMethodInfo {
private Class> enclosingClass;
private String name;
private String descriptor;
@@ -2514,11 +2514,11 @@ public final class Class implements java.io.Serializable,
}
}
- private volatile transient SoftReference> reflectionData;
+ private transient volatile SoftReference> reflectionData;
// Incremented by the VM on each call to JVM TI RedefineClasses()
// that redefines this class or a superclass.
- private volatile transient int classRedefinedCount = 0;
+ private transient volatile int classRedefinedCount = 0;
// Lazily create and cache ReflectionData
private ReflectionData reflectionData() {
@@ -2561,7 +2561,7 @@ public final class Class implements java.io.Serializable,
private native String getGenericSignature0();
// Generic info repository; lazily initialized
- private volatile transient ClassRepository genericInfo;
+ private transient volatile ClassRepository genericInfo;
// accessor for factory
private GenericsFactory getFactory() {
@@ -3353,7 +3353,7 @@ public final class Class implements java.io.Serializable,
}
return enumConstants;
}
- private volatile transient T[] enumConstants = null;
+ private transient volatile T[] enumConstants = null;
/**
* Returns a map from simple name to enum constant. This package-private
@@ -3375,7 +3375,7 @@ public final class Class implements java.io.Serializable,
}
return enumConstantDirectory;
}
- private volatile transient Map enumConstantDirectory = null;
+ private transient volatile Map enumConstantDirectory = null;
/**
* Casts an object to the class or interface represented
@@ -3523,7 +3523,7 @@ public final class Class implements java.io.Serializable,
// Annotations cache
@SuppressWarnings("UnusedDeclaration")
- private volatile transient AnnotationData annotationData;
+ private transient volatile AnnotationData annotationData;
private AnnotationData annotationData() {
while (true) { // retry loop
@@ -3578,7 +3578,7 @@ public final class Class implements java.io.Serializable,
// Annotation types cache their internal (AnnotationType) form
@SuppressWarnings("UnusedDeclaration")
- private volatile transient AnnotationType annotationType;
+ private transient volatile AnnotationType annotationType;
boolean casAnnotationType(AnnotationType oldType, AnnotationType newType) {
return Atomic.casAnnotationType(this, oldType, newType);
diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
index 2ba6f5d4f0d..a3009062c2d 100644
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -1030,7 +1030,7 @@ public abstract class ClassLoader {
return findLoadedClass0(name);
}
- private native final Class> findLoadedClass0(String name);
+ private final native Class> findLoadedClass0(String name);
/**
* Sets the signers of a class. This should be invoked after defining a
diff --git a/jdk/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java b/jdk/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java
index 10986ea82bc..6266733b5a3 100644
--- a/jdk/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java
+++ b/jdk/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java
@@ -47,14 +47,14 @@ import sun.text.Normalizer;
final class ConditionalSpecialCasing {
// context conditions.
- final static int FINAL_CASED = 1;
- final static int AFTER_SOFT_DOTTED = 2;
- final static int MORE_ABOVE = 3;
- final static int AFTER_I = 4;
- final static int NOT_BEFORE_DOT = 5;
+ static final int FINAL_CASED = 1;
+ static final int AFTER_SOFT_DOTTED = 2;
+ static final int MORE_ABOVE = 3;
+ static final int AFTER_I = 4;
+ static final int NOT_BEFORE_DOT = 5;
// combining class definitions
- final static int COMBINING_CLASS_ABOVE = 230;
+ static final int COMBINING_CLASS_ABOVE = 230;
// Special case mapping entries
static Entry[] entry = {
diff --git a/jdk/src/java.base/share/classes/java/lang/Integer.java b/jdk/src/java.base/share/classes/java/lang/Integer.java
index b3cfe9315ba..ed401dba13f 100644
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java
@@ -76,7 +76,7 @@ public final class Integer extends Number implements Comparable {
/**
* All possible chars for representing a number as a String
*/
- final static char[] digits = {
+ static final char[] digits = {
'0' , '1' , '2' , '3' , '4' , '5' ,
'6' , '7' , '8' , '9' , 'a' , 'b' ,
'c' , 'd' , 'e' , 'f' , 'g' , 'h' ,
@@ -344,7 +344,7 @@ public final class Integer extends Number implements Comparable {
} while (charPos > offset);
}
- final static char [] DigitTens = {
+ static final char [] DigitTens = {
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
@@ -357,7 +357,7 @@ public final class Integer extends Number implements Comparable {
'9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
} ;
- final static char [] DigitOnes = {
+ static final char [] DigitOnes = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
@@ -467,7 +467,7 @@ public final class Integer extends Number implements Comparable {
}
}
- final static int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
+ static final int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
99999999, 999999999, Integer.MAX_VALUE };
// Requires positive x
diff --git a/jdk/src/java.base/share/classes/java/lang/Package.java b/jdk/src/java.base/share/classes/java/lang/Package.java
index 9cd63274b65..2ab9fe3c4bf 100644
--- a/jdk/src/java.base/share/classes/java/lang/Package.java
+++ b/jdk/src/java.base/share/classes/java/lang/Package.java
@@ -656,6 +656,6 @@ public class Package implements java.lang.reflect.AnnotatedElement {
private final String implVersion;
private final String implVendor;
private final URL sealBase;
- private transient final ClassLoader loader;
+ private final transient ClassLoader loader;
private transient Class> packageInfo;
}
diff --git a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
index f49b6a9cb9b..eac4aa2be65 100644
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
@@ -458,7 +458,7 @@ public final class ProcessBuilder
*
* @since 1.7
*/
- public static abstract class Redirect {
+ public abstract static class Redirect {
/**
* The type of a {@link Redirect}.
*/
diff --git a/jdk/src/java.base/share/classes/java/lang/StringCoding.java b/jdk/src/java.base/share/classes/java/lang/StringCoding.java
index a4c71b4cf21..d770156da2c 100644
--- a/jdk/src/java.base/share/classes/java/lang/StringCoding.java
+++ b/jdk/src/java.base/share/classes/java/lang/StringCoding.java
@@ -52,9 +52,9 @@ class StringCoding {
private StringCoding() { }
/** The cached coders for each thread */
- private final static ThreadLocal> decoder =
+ private static final ThreadLocal> decoder =
new ThreadLocal<>();
- private final static ThreadLocal> encoder =
+ private static final ThreadLocal> encoder =
new ThreadLocal<>();
private static boolean warnUnsupportedCharset = true;
diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java
index 87b6816940f..0f7e18df1ee 100644
--- a/jdk/src/java.base/share/classes/java/lang/System.java
+++ b/jdk/src/java.base/share/classes/java/lang/System.java
@@ -81,7 +81,7 @@ public final class System {
* corresponds to keyboard input or another input source specified by
* the host environment or user.
*/
- public final static InputStream in = null;
+ public static final InputStream in = null;
/**
* The "standard" output stream. This stream is already
@@ -108,7 +108,7 @@ public final class System {
* @see java.io.PrintStream#println(java.lang.Object)
* @see java.io.PrintStream#println(java.lang.String)
*/
- public final static PrintStream out = null;
+ public static final PrintStream out = null;
/**
* The "standard" error output stream. This stream is already
@@ -122,7 +122,7 @@ public final class System {
* variable out, has been redirected to a file or other
* destination that is typically not continuously monitored.
*/
- public final static PrintStream err = null;
+ public static final PrintStream err = null;
/* The security manager for the system.
*/
diff --git a/jdk/src/java.base/share/classes/java/lang/Thread.java b/jdk/src/java.base/share/classes/java/lang/Thread.java
index 3fca1bd8091..a3ca2fd52fc 100644
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java
@@ -244,17 +244,17 @@ class Thread implements Runnable {
/**
* The minimum priority that a thread can have.
*/
- public final static int MIN_PRIORITY = 1;
+ public static final int MIN_PRIORITY = 1;
/**
* The default priority that is assigned to a thread.
*/
- public final static int NORM_PRIORITY = 5;
+ public static final int NORM_PRIORITY = 5;
/**
* The maximum priority that a thread can have.
*/
- public final static int MAX_PRIORITY = 10;
+ public static final int MAX_PRIORITY = 10;
/**
* Returns a reference to the currently executing thread object.
@@ -1688,8 +1688,8 @@ class Thread implements Runnable {
return result.booleanValue();
}
- private native static StackTraceElement[][] dumpThreads(Thread[] threads);
- private native static Thread[] getThreads();
+ private static native StackTraceElement[][] dumpThreads(Thread[] threads);
+ private static native Thread[] getThreads();
/**
* Returns the identifier of this Thread. The thread ID is a positive
diff --git a/jdk/src/java.base/share/classes/java/lang/VirtualMachineError.java b/jdk/src/java.base/share/classes/java/lang/VirtualMachineError.java
index a8b5807c3c7..04e21fa1dc0 100644
--- a/jdk/src/java.base/share/classes/java/lang/VirtualMachineError.java
+++ b/jdk/src/java.base/share/classes/java/lang/VirtualMachineError.java
@@ -33,7 +33,7 @@ package java.lang;
* @author Frank Yellin
* @since 1.0
*/
-abstract public class VirtualMachineError extends Error {
+public abstract class VirtualMachineError extends Error {
private static final long serialVersionUID = 4161983926571568670L;
/**
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java
index 5c874f49741..2e4baec0857 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java
@@ -49,7 +49,7 @@ abstract class DelegatingMethodHandle extends MethodHandle {
}
/** Define this to extract the delegated target which supplies the invocation behavior. */
- abstract protected MethodHandle getTarget();
+ protected abstract MethodHandle getTarget();
@Override
abstract MethodHandle asTypeUncached(MethodType newType);
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
index f02ed74aae5..c70b9db3097 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
@@ -445,9 +445,9 @@ class DirectMethodHandle extends MethodHandle {
/** This subclass handles static field references. */
static class StaticAccessor extends DirectMethodHandle {
- final private Class> fieldType;
- final private Object staticBase;
- final private long staticOffset;
+ private final Class> fieldType;
+ private final Object staticBase;
+ private final long staticOffset;
private StaticAccessor(MethodType mtype, LambdaForm form, MemberName member,
Object staticBase, long staticOffset) {
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
index 2c94e081568..bcfa877fbf1 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@@ -140,9 +140,9 @@ class InvokerBytecodeGenerator {
/** instance counters for dumped classes */
- private final static HashMap DUMP_CLASS_FILES_COUNTERS;
+ private static final HashMap DUMP_CLASS_FILES_COUNTERS;
/** debugging flag for saving generated class files */
- private final static File DUMP_CLASS_FILES_DIR;
+ private static final File DUMP_CLASS_FILES_DIR;
static {
if (DUMP_CLASS_FILES) {
@@ -771,7 +771,7 @@ class InvokerBytecodeGenerator {
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.basicType().toMethodDescriptorString(), false);
}
- static private Class>[] STATICALLY_INVOCABLE_PACKAGES = {
+ private static Class>[] STATICALLY_INVOCABLE_PACKAGES = {
// Sample classes from each package we are willing to bind to statically:
java.lang.Object.class,
java.util.Arrays.class,
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
index b53b44b99b1..4b98a2cf1a1 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java
@@ -440,7 +440,7 @@ class MethodHandleNatives {
* Use best possible cause for err.initCause(), substituting the
* cause for err itself if the cause has the same (or better) type.
*/
- static private Error initCauseFrom(Error err, Exception ex) {
+ private static Error initCauseFrom(Error err, Exception ex) {
Throwable th = ex.getCause();
if (err.getClass().isInstance(th))
return (Error) th;
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 41a0054db7a..13520e45f1c 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -147,7 +147,7 @@ public class MethodHandles {
return lookup.revealDirect(target).reflectAs(expected, lookup);
}
// Copied from AccessibleObject, as used by Method.setAccessible, etc.:
- static final private java.security.Permission ACCESS_PERMISSION =
+ private static final java.security.Permission ACCESS_PERMISSION =
new ReflectPermission("suppressAccessChecks");
/**
@@ -1884,7 +1884,7 @@ return invoker;
* or if the resulting method handle's type would have
* too many parameters
*/
- static public
+ public static
MethodHandle spreadInvoker(MethodType type, int leadingArgCount) {
if (leadingArgCount < 0 || leadingArgCount > type.parameterCount())
throw newIllegalArgumentException("bad argument count", leadingArgCount);
@@ -1927,7 +1927,7 @@ return invoker;
* @throws IllegalArgumentException if the resulting method handle's type would have
* too many parameters
*/
- static public
+ public static
MethodHandle exactInvoker(MethodType type) {
return type.invokers().exactInvoker();
}
@@ -1966,7 +1966,7 @@ return invoker;
* @throws IllegalArgumentException if the resulting method handle's type would have
* too many parameters
*/
- static public
+ public static
MethodHandle invoker(MethodType type) {
return type.invokers().genericInvoker();
}
@@ -2322,7 +2322,7 @@ assert((int)twice.invokeExact(21) == 42);
return MethodHandleImpl.makeIntrinsic(mtype, lform, Intrinsic.ZERO);
}
- synchronized private static MethodHandle setCachedMethodHandle(MethodHandle[] cache, int pos, MethodHandle value) {
+ private static synchronized MethodHandle setCachedMethodHandle(MethodHandle[] cache, int pos, MethodHandle value) {
// Simulate a CAS, to avoid racy duplication of results.
MethodHandle prev = cache[pos];
if (prev != null) return prev;
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
index bcf16dba9db..0c4cf9bd4e1 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
@@ -111,7 +111,7 @@ final class MethodTypeForm {
return (entry != null) ? entry.get() : null;
}
- synchronized public MethodHandle setCachedMethodHandle(int which, MethodHandle mh) {
+ public synchronized MethodHandle setCachedMethodHandle(int which, MethodHandle mh) {
// Simulate a CAS, to avoid racy duplication of results.
SoftReference entry = methodHandles[which];
if (entry != null) {
@@ -130,7 +130,7 @@ final class MethodTypeForm {
return (entry != null) ? entry.get() : null;
}
- synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
+ public synchronized LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
// Simulate a CAS, to avoid racy duplication of results.
SoftReference entry = lambdaForms[which];
if (entry != null) {
diff --git a/jdk/src/java.base/share/classes/java/lang/ref/Reference.java b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java
index 854cdd6cb9d..c2dd47c78e5 100644
--- a/jdk/src/java.base/share/classes/java/lang/ref/Reference.java
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java
@@ -107,7 +107,7 @@ public abstract class Reference {
* pending: next element in the pending list (or null if last)
* otherwise: NULL
*/
- transient private Reference discovered; /* used by VM */
+ private transient Reference discovered; /* used by VM */
/* Object used to synchronize with the garbage collector. The collector
@@ -115,7 +115,7 @@ public abstract class Reference {
* therefore critical that any code holding this lock complete as quickly
* as possible, allocate no new objects, and avoid calling user code.
*/
- static private class Lock { }
+ private static class Lock { }
private static Lock lock = new Lock();
diff --git a/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java b/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java
index bf68b61b36f..d23491906c1 100644
--- a/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java
+++ b/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java
@@ -51,7 +51,7 @@ public class ReferenceQueue {
static ReferenceQueue NULL = new Null<>();
static ReferenceQueue ENQUEUED = new Null<>();
- static private class Lock { };
+ private static class Lock { };
private Lock lock = new Lock();
private volatile Reference extends T> head = null;
private long queueLength = 0;
diff --git a/jdk/src/java.base/share/classes/java/lang/ref/SoftReference.java b/jdk/src/java.base/share/classes/java/lang/ref/SoftReference.java
index 5da95e789e8..8ce74a67d0a 100644
--- a/jdk/src/java.base/share/classes/java/lang/ref/SoftReference.java
+++ b/jdk/src/java.base/share/classes/java/lang/ref/SoftReference.java
@@ -66,7 +66,7 @@ public class SoftReference extends Reference {
/**
* Timestamp clock, updated by the garbage collector
*/
- static private long clock;
+ private static long clock;
/**
* Timestamp updated by each invocation of the get method. The VM may use
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
index 65755f09826..506e27d760e 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
@@ -61,7 +61,7 @@ public class AccessibleObject implements AnnotatedElement {
* has sufficient privilege to defeat Java language access
* control checks.
*/
- static final private java.security.Permission ACCESS_PERMISSION =
+ private static final java.security.Permission ACCESS_PERMISSION =
new ReflectPermission("suppressAccessChecks");
/**
diff --git a/jdk/src/java.base/share/classes/java/math/BigDecimal.java b/jdk/src/java.base/share/classes/java/math/BigDecimal.java
index bb04b589dcb..7214950c489 100644
--- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java
+++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java
@@ -2268,14 +2268,14 @@ public class BigDecimal extends Number implements Comparable {
* digit prior to a nonzero discarded fraction. Note that this rounding
* mode never decreases the magnitude of the calculated value.
*/
- public final static int ROUND_UP = 0;
+ public static final int ROUND_UP = 0;
/**
* Rounding mode to round towards zero. Never increments the digit
* prior to a discarded fraction (i.e., truncates). Note that this
* rounding mode never increases the magnitude of the calculated value.
*/
- public final static int ROUND_DOWN = 1;
+ public static final int ROUND_DOWN = 1;
/**
* Rounding mode to round towards positive infinity. If the
@@ -2284,7 +2284,7 @@ public class BigDecimal extends Number implements Comparable {
* {@code ROUND_DOWN}. Note that this rounding mode never
* decreases the calculated value.
*/
- public final static int ROUND_CEILING = 2;
+ public static final int ROUND_CEILING = 2;
/**
* Rounding mode to round towards negative infinity. If the
@@ -2293,7 +2293,7 @@ public class BigDecimal extends Number implements Comparable {
* {@code ROUND_UP}. Note that this rounding mode never
* increases the calculated value.
*/
- public final static int ROUND_FLOOR = 3;
+ public static final int ROUND_FLOOR = 3;
/**
* Rounding mode to round towards {@literal "nearest neighbor"}
@@ -2303,7 +2303,7 @@ public class BigDecimal extends Number implements Comparable {
* that this is the rounding mode that most of us were taught in
* grade school.
*/
- public final static int ROUND_HALF_UP = 4;
+ public static final int ROUND_HALF_UP = 4;
/**
* Rounding mode to round towards {@literal "nearest neighbor"}
@@ -2312,7 +2312,7 @@ public class BigDecimal extends Number implements Comparable {
* fraction is {@literal >} 0.5; otherwise, behaves as for
* {@code ROUND_DOWN}.
*/
- public final static int ROUND_HALF_DOWN = 5;
+ public static final int ROUND_HALF_DOWN = 5;
/**
* Rounding mode to round towards the {@literal "nearest neighbor"}
@@ -2324,7 +2324,7 @@ public class BigDecimal extends Number implements Comparable {
* rounding mode that minimizes cumulative error when applied
* repeatedly over a sequence of calculations.
*/
- public final static int ROUND_HALF_EVEN = 6;
+ public static final int ROUND_HALF_EVEN = 6;
/**
* Rounding mode to assert that the requested operation has an exact
@@ -2332,7 +2332,7 @@ public class BigDecimal extends Number implements Comparable {
* specified on an operation that yields an inexact result, an
* {@code ArithmeticException} is thrown.
*/
- public final static int ROUND_UNNECESSARY = 7;
+ public static final int ROUND_UNNECESSARY = 7;
// Scaling/Rounding Operations
@@ -3398,7 +3398,7 @@ public class BigDecimal extends Number implements Comparable {
return charPos;
}
- final static char[] DIGIT_TENS = {
+ static final char[] DIGIT_TENS = {
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
@@ -3411,7 +3411,7 @@ public class BigDecimal extends Number implements Comparable {
'9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
};
- final static char[] DIGIT_ONES = {
+ static final char[] DIGIT_ONES = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
diff --git a/jdk/src/java.base/share/classes/java/math/BigInteger.java b/jdk/src/java.base/share/classes/java/math/BigInteger.java
index 7232724d84c..80330c8c4e4 100644
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java
@@ -184,7 +184,7 @@ public class BigInteger extends Number implements Comparable {
/**
* This mask is used to obtain the value of an int as if it were unsigned.
*/
- final static long LONG_MASK = 0xffffffffL;
+ static final long LONG_MASK = 0xffffffffL;
/**
* This constant limits {@code mag.length} of BigIntegers to the supported
@@ -1212,7 +1212,7 @@ public class BigInteger extends Number implements Comparable {
/**
* Initialize static constant array when class is loaded.
*/
- private final static int MAX_CONSTANT = 16;
+ private static final int MAX_CONSTANT = 16;
private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];
private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1];
diff --git a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
index 25677980d66..1f9eba1300e 100644
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
@@ -55,7 +55,7 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
/**
* flag set if the native connect() call not to be used
*/
- private final static boolean connectDisabled = os.contains("OS X");
+ private static final boolean connectDisabled = os.contains("OS X");
/**
* Load net library into runtime.
diff --git a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java
index 59b4042562f..8841e4fe724 100644
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java
@@ -721,6 +721,6 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
abstract void socketSendUrgentData(int data)
throws IOException;
- public final static int SHUT_RD = 0;
- public final static int SHUT_WR = 1;
+ public static final int SHUT_RD = 0;
+ public static final int SHUT_WR = 1;
}
diff --git a/jdk/src/java.base/share/classes/java/net/Authenticator.java b/jdk/src/java.base/share/classes/java/net/Authenticator.java
index a83f40791d2..e62e169099c 100644
--- a/jdk/src/java.base/share/classes/java/net/Authenticator.java
+++ b/jdk/src/java.base/share/classes/java/net/Authenticator.java
@@ -119,7 +119,7 @@ class Authenticator {
* @see SecurityManager#checkPermission
* @see java.net.NetPermission
*/
- public synchronized static void setDefault(Authenticator a) {
+ public static synchronized void setDefault(Authenticator a) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
NetPermission setDefaultPermission
diff --git a/jdk/src/java.base/share/classes/java/net/ContentHandler.java b/jdk/src/java.base/share/classes/java/net/ContentHandler.java
index 690cbd9b2bd..bea0391b1ea 100644
--- a/jdk/src/java.base/share/classes/java/net/ContentHandler.java
+++ b/jdk/src/java.base/share/classes/java/net/ContentHandler.java
@@ -81,7 +81,7 @@ import java.io.IOException;
* @see java.net.URLConnection#setContentHandlerFactory(java.net.ContentHandlerFactory)
* @since 1.0
*/
-abstract public class ContentHandler {
+public abstract class ContentHandler {
/**
* Given a URL connect stream positioned at the beginning of the
@@ -92,7 +92,7 @@ abstract public class ContentHandler {
* @return the object read by the {@code ContentHandler}.
* @exception IOException if an I/O error occurs while reading the object.
*/
- abstract public Object getContent(URLConnection urlc) throws IOException;
+ public abstract Object getContent(URLConnection urlc) throws IOException;
/**
* Given a URL connect stream positioned at the beginning of the
diff --git a/jdk/src/java.base/share/classes/java/net/CookieHandler.java b/jdk/src/java.base/share/classes/java/net/CookieHandler.java
index ef91d009feb..af4c813926b 100644
--- a/jdk/src/java.base/share/classes/java/net/CookieHandler.java
+++ b/jdk/src/java.base/share/classes/java/net/CookieHandler.java
@@ -69,7 +69,7 @@ public abstract class CookieHandler {
* {@link NetPermission}{@code ("getCookieHandler")}
* @see #setDefault(CookieHandler)
*/
- public synchronized static CookieHandler getDefault() {
+ public static synchronized CookieHandler getDefault() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(SecurityConstants.GET_COOKIEHANDLER_PERMISSION);
@@ -89,7 +89,7 @@ public abstract class CookieHandler {
* {@link NetPermission}{@code ("setCookieHandler")}
* @see #getDefault()
*/
- public synchronized static void setDefault(CookieHandler cHandler) {
+ public static synchronized void setDefault(CookieHandler cHandler) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(SecurityConstants.SET_COOKIEHANDLER_PERMISSION);
diff --git a/jdk/src/java.base/share/classes/java/net/CookieManager.java b/jdk/src/java.base/share/classes/java/net/CookieManager.java
index 74216eb4de0..fb3fa356e99 100644
--- a/jdk/src/java.base/share/classes/java/net/CookieManager.java
+++ b/jdk/src/java.base/share/classes/java/net/CookieManager.java
@@ -362,7 +362,7 @@ public class CookieManager extends CookieHandler
}
- static private boolean isInPortList(String lst, int port) {
+ private static boolean isInPortList(String lst, int port) {
int i = lst.indexOf(',');
int val = -1;
while (i > 0) {
diff --git a/jdk/src/java.base/share/classes/java/net/DatagramPacket.java b/jdk/src/java.base/share/classes/java/net/DatagramPacket.java
index 2fb419db282..13fac5d46c2 100644
--- a/jdk/src/java.base/share/classes/java/net/DatagramPacket.java
+++ b/jdk/src/java.base/share/classes/java/net/DatagramPacket.java
@@ -384,5 +384,5 @@ class DatagramPacket {
/**
* Perform class load-time initializations.
*/
- private native static void init();
+ private static native void init();
}
diff --git a/jdk/src/java.base/share/classes/java/net/HostPortrange.java b/jdk/src/java.base/share/classes/java/net/HostPortrange.java
index 3c924d8bfc0..09f20d43cbe 100644
--- a/jdk/src/java.base/share/classes/java/net/HostPortrange.java
+++ b/jdk/src/java.base/share/classes/java/net/HostPortrange.java
@@ -225,9 +225,9 @@ class HostPortrange {
}
// these shouldn't leak outside the implementation
- final static int[] HTTP_PORT = {80, 80};
- final static int[] HTTPS_PORT = {443, 443};
- final static int[] NO_PORT = {-1, -1};
+ static final int[] HTTP_PORT = {80, 80};
+ static final int[] HTTPS_PORT = {443, 443};
+ static final int[] NO_PORT = {-1, -1};
int[] defaultPort() {
if (scheme.equals("http")) {
diff --git a/jdk/src/java.base/share/classes/java/net/HttpCookie.java b/jdk/src/java.base/share/classes/java/net/HttpCookie.java
index 92dcd68c0b5..4b1ba5200d0 100644
--- a/jdk/src/java.base/share/classes/java/net/HttpCookie.java
+++ b/jdk/src/java.base/share/classes/java/net/HttpCookie.java
@@ -84,11 +84,11 @@ public final class HttpCookie implements Cloneable {
// Since the positive and zero max-age have their meanings,
// this value serves as a hint as 'not specify max-age'
- private final static long MAX_AGE_UNSPECIFIED = -1;
+ private static final long MAX_AGE_UNSPECIFIED = -1;
// date formats used by Netscape's cookie draft
// as well as formats seen on various sites
- private final static String[] COOKIE_DATE_FORMATS = {
+ private static final String[] COOKIE_DATE_FORMATS = {
"EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'",
"EEE',' dd MMM yyyy HH:mm:ss 'GMT'",
"EEE MMM dd yyyy HH:mm:ss 'GMT'Z",
@@ -98,8 +98,8 @@ public final class HttpCookie implements Cloneable {
};
// constant strings represent set-cookie header token
- private final static String SET_COOKIE = "set-cookie:";
- private final static String SET_COOKIE2 = "set-cookie2:";
+ private static final String SET_COOKIE = "set-cookie:";
+ private static final String SET_COOKIE2 = "set-cookie2:";
// ---------------- Ctors --------------
diff --git a/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java b/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java
index de9ac337f06..94b537d2658 100644
--- a/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java
+++ b/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java
@@ -66,7 +66,7 @@ import java.util.Date;
* @see java.net.HttpURLConnection#disconnect()
* @since 1.1
*/
-abstract public class HttpURLConnection extends URLConnection {
+public abstract class HttpURLConnection extends URLConnection {
/* instance variables */
/**
diff --git a/jdk/src/java.base/share/classes/java/net/Inet4Address.java b/jdk/src/java.base/share/classes/java/net/Inet4Address.java
index 08559f35829..6b0f765cd0e 100644
--- a/jdk/src/java.base/share/classes/java/net/Inet4Address.java
+++ b/jdk/src/java.base/share/classes/java/net/Inet4Address.java
@@ -84,7 +84,7 @@ import java.io.ObjectStreamException;
public final
class Inet4Address extends InetAddress {
- final static int INADDRSZ = 4;
+ static final int INADDRSZ = 4;
/** use serialVersionUID from InetAddress, but Inet4Address instance
* is always replaced by an InetAddress instance before being
diff --git a/jdk/src/java.base/share/classes/java/net/Inet6Address.java b/jdk/src/java.base/share/classes/java/net/Inet6Address.java
index bbe2263e1c0..e51064fbd31 100644
--- a/jdk/src/java.base/share/classes/java/net/Inet6Address.java
+++ b/jdk/src/java.base/share/classes/java/net/Inet6Address.java
@@ -173,7 +173,7 @@ import java.util.Arrays;
public final
class Inet6Address extends InetAddress {
- final static int INADDRSZ = 16;
+ static final int INADDRSZ = 16;
/*
* cached scope_id - for link-local address use only.
@@ -922,7 +922,7 @@ class Inet6Address extends InetAddress {
}
// Utilities
- private final static int INT16SZ = 2;
+ private static final int INT16SZ = 2;
/*
* Convert IPv6 binary address into presentation (printable) format.
diff --git a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java
index 81da1c0cf8f..8e5ec293646 100644
--- a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java
+++ b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java
@@ -400,16 +400,16 @@ public final class NetworkInterface {
false);
}
- private native static NetworkInterface[] getAll()
+ private static native NetworkInterface[] getAll()
throws SocketException;
- private native static NetworkInterface getByName0(String name)
+ private static native NetworkInterface getByName0(String name)
throws SocketException;
- private native static NetworkInterface getByIndex0(int index)
+ private static native NetworkInterface getByIndex0(int index)
throws SocketException;
- private native static NetworkInterface getByInetAddress0(InetAddress addr)
+ private static native NetworkInterface getByInetAddress0(InetAddress addr)
throws SocketException;
/**
@@ -525,12 +525,12 @@ public final class NetworkInterface {
return virtual;
}
- private native static boolean isUp0(String name, int ind) throws SocketException;
- private native static boolean isLoopback0(String name, int ind) throws SocketException;
- private native static boolean supportsMulticast0(String name, int ind) throws SocketException;
- private native static boolean isP2P0(String name, int ind) throws SocketException;
- private native static byte[] getMacAddr0(byte[] inAddr, String name, int ind) throws SocketException;
- private native static int getMTU0(String name, int ind) throws SocketException;
+ private static native boolean isUp0(String name, int ind) throws SocketException;
+ private static native boolean isLoopback0(String name, int ind) throws SocketException;
+ private static native boolean supportsMulticast0(String name, int ind) throws SocketException;
+ private static native boolean isP2P0(String name, int ind) throws SocketException;
+ private static native byte[] getMacAddr0(byte[] inAddr, String name, int ind) throws SocketException;
+ private static native int getMTU0(String name, int ind) throws SocketException;
/**
* Compares this object against the specified object.
diff --git a/jdk/src/java.base/share/classes/java/net/Proxy.java b/jdk/src/java.base/share/classes/java/net/Proxy.java
index 8ba020ef484..672235b527f 100644
--- a/jdk/src/java.base/share/classes/java/net/Proxy.java
+++ b/jdk/src/java.base/share/classes/java/net/Proxy.java
@@ -69,7 +69,7 @@ public class Proxy {
* {@code Socket s = new Socket(Proxy.NO_PROXY);}
*
*/
- public final static Proxy NO_PROXY = new Proxy();
+ public static final Proxy NO_PROXY = new Proxy();
// Creates the proxy that represents a {@code DIRECT} connection.
private Proxy() {
diff --git a/jdk/src/java.base/share/classes/java/net/ResponseCache.java b/jdk/src/java.base/share/classes/java/net/ResponseCache.java
index 2dfaf4aa9f9..e023735ddc0 100644
--- a/jdk/src/java.base/share/classes/java/net/ResponseCache.java
+++ b/jdk/src/java.base/share/classes/java/net/ResponseCache.java
@@ -80,7 +80,7 @@ public abstract class ResponseCache {
* @return the system-wide {@code ResponseCache}
* @since 1.5
*/
- public synchronized static ResponseCache getDefault() {
+ public static synchronized ResponseCache getDefault() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(SecurityConstants.GET_RESPONSECACHE_PERMISSION);
@@ -103,7 +103,7 @@ public abstract class ResponseCache {
* @see #getDefault()
* @since 1.5
*/
- public synchronized static void setDefault(ResponseCache responseCache) {
+ public static synchronized void setDefault(ResponseCache responseCache) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(SecurityConstants.SET_RESPONSECACHE_PERMISSION);
diff --git a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java
index 41b18bdc7e0..2fb035ef7d8 100644
--- a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java
+++ b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java
@@ -287,5 +287,5 @@ class SocketInputStream extends FileInputStream
/**
* Perform class load-time initializations.
*/
- private native static void init();
+ private static native void init();
}
diff --git a/jdk/src/java.base/share/classes/java/net/SocketOptions.java b/jdk/src/java.base/share/classes/java/net/SocketOptions.java
index cd1539c3530..82e98e99064 100644
--- a/jdk/src/java.base/share/classes/java/net/SocketOptions.java
+++ b/jdk/src/java.base/share/classes/java/net/SocketOptions.java
@@ -139,7 +139,7 @@ public interface SocketOptions {
* @see Socket#getTcpNoDelay
*/
- @Native public final static int TCP_NODELAY = 0x0001;
+ @Native public static final int TCP_NODELAY = 0x0001;
/**
* Fetch the local address binding of a socket (this option cannot
@@ -160,7 +160,7 @@ public interface SocketOptions {
* @see DatagramSocket#getLocalAddress
*/
- @Native public final static int SO_BINDADDR = 0x000F;
+ @Native public static final int SO_BINDADDR = 0x000F;
/** Sets SO_REUSEADDR for a socket. This is used only for MulticastSockets
* in java, and it is set by default for MulticastSockets.
@@ -168,7 +168,7 @@ public interface SocketOptions {
* Valid for: DatagramSocketImpl
*/
- @Native public final static int SO_REUSEADDR = 0x04;
+ @Native public static final int SO_REUSEADDR = 0x04;
/**
* Sets SO_BROADCAST for a socket. This option enables and disables
@@ -179,7 +179,7 @@ public interface SocketOptions {
* @since 1.4
*/
- @Native public final static int SO_BROADCAST = 0x0020;
+ @Native public static final int SO_BROADCAST = 0x0020;
/** Set which outgoing interface on which to send multicast packets.
* Useful on hosts with multiple network interfaces, where applications
@@ -191,7 +191,7 @@ public interface SocketOptions {
* @see MulticastSocket#getInterface()
*/
- @Native public final static int IP_MULTICAST_IF = 0x10;
+ @Native public static final int IP_MULTICAST_IF = 0x10;
/** Same as above. This option is introduced so that the behaviour
* with IP_MULTICAST_IF will be kept the same as before, while
@@ -203,7 +203,7 @@ public interface SocketOptions {
* @see MulticastSocket#getNetworkInterface()
* @since 1.4
*/
- @Native public final static int IP_MULTICAST_IF2 = 0x1f;
+ @Native public static final int IP_MULTICAST_IF2 = 0x1f;
/**
* This option enables or disables local loopback of multicast datagrams.
@@ -211,7 +211,7 @@ public interface SocketOptions {
* @since 1.4
*/
- @Native public final static int IP_MULTICAST_LOOP = 0x12;
+ @Native public static final int IP_MULTICAST_LOOP = 0x12;
/**
* This option sets the type-of-service or traffic class field
@@ -219,7 +219,7 @@ public interface SocketOptions {
* @since 1.4
*/
- @Native public final static int IP_TOS = 0x3;
+ @Native public static final int IP_TOS = 0x3;
/**
* Specify a linger-on-close timeout. This option disables/enables
@@ -237,7 +237,7 @@ public interface SocketOptions {
* @see Socket#setSoLinger
* @see Socket#getSoLinger
*/
- @Native public final static int SO_LINGER = 0x0080;
+ @Native public static final int SO_LINGER = 0x0080;
/** Set a timeout on blocking Socket operations:
*