This interface extends {@link Watchable} interface so that a directory
* located by a path can be {@link #register registered} with a {@link
diff --git a/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java b/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java
index a9c68b83c00..c1f1de37130 100644
--- a/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java
+++ b/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,7 @@ import java.security.spec.AlgorithmParameterSpec;
*
* OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
* { OID id-sha1 PARAMETERS NULL }|
+ * { OID id-sha224 PARAMETERS NULL }|
* { OID id-sha256 PARAMETERS NULL }|
* { OID id-sha384 PARAMETERS NULL }|
* { OID id-sha512 PARAMETERS NULL },
@@ -62,6 +63,11 @@ public class MGF1ParameterSpec implements AlgorithmParameterSpec {
*/
public static final MGF1ParameterSpec SHA1 =
new MGF1ParameterSpec("SHA-1");
+ /**
+ * The MGF1ParameterSpec which uses "SHA-224" message digest.
+ */
+ public static final MGF1ParameterSpec SHA224 =
+ new MGF1ParameterSpec("SHA-224");
/**
* The MGF1ParameterSpec which uses "SHA-256" message digest.
*/
diff --git a/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java b/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
index e9f29b553a6..37a2eeb2625 100644
--- a/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
+++ b/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,7 @@ import java.security.spec.MGF1ParameterSpec;
*
* OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
* { OID id-sha1 PARAMETERS NULL }|
+ * { OID id-sha224 PARAMETERS NULL }|
* { OID id-sha256 PARAMETERS NULL }|
* { OID id-sha384 PARAMETERS NULL }|
* { OID id-sha512 PARAMETERS NULL },
diff --git a/jdk/src/share/classes/java/text/DateFormatSymbols.java b/jdk/src/share/classes/java/text/DateFormatSymbols.java
index e5b44c6e0e3..35126e4d0d9 100644
--- a/jdk/src/share/classes/java/text/DateFormatSymbols.java
+++ b/jdk/src/share/classes/java/text/DateFormatSymbols.java
@@ -647,6 +647,8 @@ public class DateFormatSymbols implements Serializable, Cloneable {
private static final ConcurrentMap> cachedInstances
= new ConcurrentHashMap>(3);
+ private transient int lastZoneIndex = 0;
+
private void initializeData(Locale desiredLocale) {
locale = desiredLocale;
@@ -692,12 +694,24 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* the given time zone ID can't be located in the DateFormatSymbols object.
* @see java.util.SimpleTimeZone
*/
- final int getZoneIndex(String ID)
- {
+ final int getZoneIndex(String ID) {
String[][] zoneStrings = getZoneStringsWrapper();
- for (int index=0; indexnextElement method of an
- * Enumeration
to indicate that there are no more
- * elements in the enumeration.
+ * Thrown by various accessor methods to indicate that the element being requested
+ * does not exist.
*
* @author unascribed
- * @see java.util.Enumeration
* @see java.util.Enumeration#nextElement()
+ * @see java.util.Iterator#next()
* @since JDK1.0
*/
public
diff --git a/jdk/src/share/classes/java/util/UUID.java b/jdk/src/share/classes/java/util/UUID.java
index 448429849b9..d3d8c242b4f 100644
--- a/jdk/src/share/classes/java/util/UUID.java
+++ b/jdk/src/share/classes/java/util/UUID.java
@@ -90,9 +90,11 @@ public final class UUID implements java.io.Serializable, Comparable {
/*
* The random number generator used by this class to create random
- * based UUIDs.
+ * based UUIDs. In a holder class to defer initialization until needed.
*/
- private static volatile SecureRandom numberGenerator = null;
+ private static class Holder {
+ static final SecureRandom numberGenerator = new SecureRandom();
+ }
// Constructors and Factories
@@ -137,10 +139,7 @@ public final class UUID implements java.io.Serializable, Comparable {
* @return A randomly generated {@code UUID}
*/
public static UUID randomUUID() {
- SecureRandom ng = numberGenerator;
- if (ng == null) {
- numberGenerator = ng = new SecureRandom();
- }
+ SecureRandom ng = Holder.numberGenerator;
byte[] randomBytes = new byte[16];
ng.nextBytes(randomBytes);
@@ -255,7 +254,8 @@ public final class UUID implements java.io.Serializable, Comparable {
* The variant number has the following meaning:
*
* 0 Reserved for NCS backward compatibility
- * 2 The Leach-Salz variant (used by this class)
+ * 2 IETF RFC 4122
+ * (Leach-Salz), used by this class
* 6 Reserved, Microsoft Corporation backward compatibility
* 7 Reserved for future definition
*
@@ -265,7 +265,7 @@ public final class UUID implements java.io.Serializable, Comparable {
public int variant() {
// This field is composed of a varying number of bits.
// 0 - - Reserved for NCS backward compatibility
- // 1 0 - The Leach-Salz variant (used by this class)
+ // 1 0 - The IETF aka Leach-Salz variant (used by this class)
// 1 1 0 Reserved, Microsoft backward compatibility
// 1 1 1 Reserved for future definition.
return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62)))
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
index 9f4fee4aa84..dc26f4c0ba7 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
@@ -35,7 +35,11 @@
package java.util.concurrent.atomic;
import sun.misc.Unsafe;
-import java.lang.reflect.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
/**
* A reflection-based utility that enables atomic updates to
@@ -67,7 +71,9 @@ public abstract class AtomicIntegerFieldUpdater {
* @throws IllegalArgumentException if the field is not a
* volatile integer type
* @throws RuntimeException with a nested reflection-based
- * exception if the class does not hold field or is the wrong type
+ * exception if the class does not hold field or is the wrong type,
+ * or the field is inaccessible to the caller according to Java language
+ * access control
*/
public static AtomicIntegerFieldUpdater newUpdater(Class tclass, String fieldName) {
return new AtomicIntegerFieldUpdaterImpl(tclass, fieldName);
@@ -267,17 +273,29 @@ public abstract class AtomicIntegerFieldUpdater {
private final Class tclass;
private final Class> cclass;
- AtomicIntegerFieldUpdaterImpl(Class tclass, String fieldName) {
+ AtomicIntegerFieldUpdaterImpl(final Class tclass, final String fieldName) {
Field field = null;
Class> caller = null;
int modifiers = 0;
try {
- field = tclass.getDeclaredField(fieldName);
+ field = AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Field run() throws NoSuchFieldException {
+ return tclass.getDeclaredField(fieldName);
+ }
+ });
caller = sun.reflect.Reflection.getCallerClass(3);
modifiers = field.getModifiers();
sun.reflect.misc.ReflectUtil.ensureMemberAccess(
caller, tclass, null, modifiers);
- sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
+ ClassLoader cl = tclass.getClassLoader();
+ ClassLoader ccl = caller.getClassLoader();
+ if ((ccl != null) && (ccl != cl) &&
+ ((cl == null) || !isAncestor(cl, ccl))) {
+ sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
+ }
+ } catch (PrivilegedActionException pae) {
+ throw new RuntimeException(pae.getException());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -295,6 +313,22 @@ public abstract class AtomicIntegerFieldUpdater {
offset = unsafe.objectFieldOffset(field);
}
+ /**
+ * Returns true if the second classloader can be found in the first
+ * classloader's delegation chain.
+ * Equivalent to the inaccessible: first.isAncestor(second).
+ */
+ private static boolean isAncestor(ClassLoader first, ClassLoader second) {
+ ClassLoader acl = first;
+ do {
+ acl = acl.getParent();
+ if (second == acl) {
+ return true;
+ }
+ } while (acl != null);
+ return false;
+ }
+
private void fullCheck(T obj) {
if (!tclass.isInstance(obj))
throw new ClassCastException();
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
index ccc5acbfe21..3311aecdbfb 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
@@ -35,7 +35,11 @@
package java.util.concurrent.atomic;
import sun.misc.Unsafe;
-import java.lang.reflect.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
/**
* A reflection-based utility that enables atomic updates to
@@ -67,7 +71,9 @@ public abstract class AtomicLongFieldUpdater {
* @throws IllegalArgumentException if the field is not a
* volatile long type.
* @throws RuntimeException with a nested reflection-based
- * exception if the class does not hold field or is the wrong type.
+ * exception if the class does not hold field or is the wrong type,
+ * or the field is inaccessible to the caller according to Java language
+ * access control
*/
public static AtomicLongFieldUpdater newUpdater(Class tclass, String fieldName) {
if (AtomicLong.VM_SUPPORTS_LONG_CAS)
@@ -267,17 +273,29 @@ public abstract class AtomicLongFieldUpdater {
private final Class tclass;
private final Class> cclass;
- CASUpdater(Class tclass, String fieldName) {
+ CASUpdater(final Class tclass, final String fieldName) {
Field field = null;
Class> caller = null;
int modifiers = 0;
try {
- field = tclass.getDeclaredField(fieldName);
+ field = AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Field run() throws NoSuchFieldException {
+ return tclass.getDeclaredField(fieldName);
+ }
+ });
caller = sun.reflect.Reflection.getCallerClass(3);
modifiers = field.getModifiers();
sun.reflect.misc.ReflectUtil.ensureMemberAccess(
caller, tclass, null, modifiers);
- sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
+ ClassLoader cl = tclass.getClassLoader();
+ ClassLoader ccl = caller.getClassLoader();
+ if ((ccl != null) && (ccl != cl) &&
+ ((cl == null) || !isAncestor(cl, ccl))) {
+ sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
+ }
+ } catch (PrivilegedActionException pae) {
+ throw new RuntimeException(pae.getException());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -350,17 +368,29 @@ public abstract class AtomicLongFieldUpdater {
private final Class tclass;
private final Class> cclass;
- LockedUpdater(Class tclass, String fieldName) {
+ LockedUpdater(final Class tclass, final String fieldName) {
Field field = null;
Class> caller = null;
int modifiers = 0;
try {
- field = tclass.getDeclaredField(fieldName);
+ field = AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Field run() throws NoSuchFieldException {
+ return tclass.getDeclaredField(fieldName);
+ }
+ });
caller = sun.reflect.Reflection.getCallerClass(3);
modifiers = field.getModifiers();
sun.reflect.misc.ReflectUtil.ensureMemberAccess(
caller, tclass, null, modifiers);
- sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
+ ClassLoader cl = tclass.getClassLoader();
+ ClassLoader ccl = caller.getClassLoader();
+ if ((ccl != null) && (ccl != cl) &&
+ ((cl == null) || !isAncestor(cl, ccl))) {
+ sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
+ }
+ } catch (PrivilegedActionException pae) {
+ throw new RuntimeException(pae.getException());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -433,4 +463,20 @@ public abstract class AtomicLongFieldUpdater {
);
}
}
+
+ /**
+ * Returns true if the second classloader can be found in the first
+ * classloader's delegation chain.
+ * Equivalent to the inaccessible: first.isAncestor(second).
+ */
+ private static boolean isAncestor(ClassLoader first, ClassLoader second) {
+ ClassLoader acl = first;
+ do {
+ acl = acl.getParent();
+ if (second == acl) {
+ return true;
+ }
+ } while (acl != null);
+ return false;
+ }
}
diff --git a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
index f2e0118aae7..bba703e67ec 100644
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
@@ -35,7 +35,11 @@
package java.util.concurrent.atomic;
import sun.misc.Unsafe;
-import java.lang.reflect.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
/**
* A reflection-based utility that enables atomic updates to
@@ -86,7 +90,9 @@ public abstract class AtomicReferenceFieldUpdater {
* @return the updater
* @throws IllegalArgumentException if the field is not a volatile reference type.
* @throws RuntimeException with a nested reflection-based
- * exception if the class does not hold field or is the wrong type.
+ * exception if the class does not hold field or is the wrong type,
+ * or the field is inaccessible to the caller according to Java language
+ * access control
*/
public static AtomicReferenceFieldUpdater newUpdater(Class tclass, Class vclass, String fieldName) {
return new AtomicReferenceFieldUpdaterImpl(tclass,
@@ -197,21 +203,33 @@ public abstract class AtomicReferenceFieldUpdater {
* screenings fail.
*/
- AtomicReferenceFieldUpdaterImpl(Class tclass,
+ AtomicReferenceFieldUpdaterImpl(final Class tclass,
Class vclass,
- String fieldName) {
+ final String fieldName) {
Field field = null;
Class> fieldClass = null;
Class> caller = null;
int modifiers = 0;
try {
- field = tclass.getDeclaredField(fieldName);
+ field = AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Field run() throws NoSuchFieldException {
+ return tclass.getDeclaredField(fieldName);
+ }
+ });
caller = sun.reflect.Reflection.getCallerClass(3);
modifiers = field.getModifiers();
sun.reflect.misc.ReflectUtil.ensureMemberAccess(
- caller, tclass, null, modifiers);
- sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
+ caller, tclass, null, modifiers);
+ ClassLoader cl = tclass.getClassLoader();
+ ClassLoader ccl = caller.getClassLoader();
+ if ((ccl != null) && (ccl != cl) &&
+ ((cl == null) || !isAncestor(cl, ccl))) {
+ sun.reflect.misc.ReflectUtil.checkPackageAccess(tclass);
+ }
fieldClass = field.getType();
+ } catch (PrivilegedActionException pae) {
+ throw new RuntimeException(pae.getException());
} catch (Exception ex) {
throw new RuntimeException(ex);
}
@@ -232,6 +250,22 @@ public abstract class AtomicReferenceFieldUpdater {
offset = unsafe.objectFieldOffset(field);
}
+ /**
+ * Returns true if the second classloader can be found in the first
+ * classloader's delegation chain.
+ * Equivalent to the inaccessible: first.isAncestor(second).
+ */
+ private static boolean isAncestor(ClassLoader first, ClassLoader second) {
+ ClassLoader acl = first;
+ do {
+ acl = acl.getParent();
+ if (second == acl) {
+ return true;
+ }
+ } while (acl != null);
+ return false;
+ }
+
void targetCheck(T obj) {
if (!tclass.isInstance(obj))
throw new ClassCastException();
@@ -281,7 +315,7 @@ public abstract class AtomicReferenceFieldUpdater {
}
@SuppressWarnings("unchecked")
- public V get(T obj) {
+ public V get(T obj) {
if (obj == null || obj.getClass() != tclass || cclass != null)
targetCheck(obj);
return (V)unsafe.getObjectVolatile(obj, offset);
@@ -292,14 +326,14 @@ public abstract class AtomicReferenceFieldUpdater {
return;
}
throw new RuntimeException(
- new IllegalAccessException("Class " +
- cclass.getName() +
- " can not access a protected member of class " +
- tclass.getName() +
- " using an instance of " +
- obj.getClass().getName()
- )
- );
+ new IllegalAccessException("Class " +
+ cclass.getName() +
+ " can not access a protected member of class " +
+ tclass.getName() +
+ " using an instance of " +
+ obj.getClass().getName()
+ )
+ );
}
}
}
diff --git a/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java b/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java
index f4a7e5e0a39..5ba264e5354 100644
--- a/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java
+++ b/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java
@@ -305,8 +305,10 @@ public abstract class AbstractPreferences extends Preferences {
* @param key key whose mapping is to be removed from the preference node.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
+ * @throws NullPointerException {@inheritDoc}.
*/
public void remove(String key) {
+ Objects.requireNonNull(key, "Specified key cannot be null");
synchronized(lock) {
if (removed)
throw new IllegalStateException("Node has been removed.");
diff --git a/jdk/src/share/classes/java/util/prefs/Preferences.java b/jdk/src/share/classes/java/util/prefs/Preferences.java
index 391439cbfa1..781b95ae446 100644
--- a/jdk/src/share/classes/java/util/prefs/Preferences.java
+++ b/jdk/src/share/classes/java/util/prefs/Preferences.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -293,7 +293,7 @@ public abstract class Preferences {
String platformFactory;
if (osName.startsWith("Windows")) {
platformFactory = "java.util.prefs.WindowsPreferencesFactory";
- } else if (osName.startsWith("Mac OS X")) {
+ } else if (osName.contains("OS X")) {
platformFactory = "java.util.prefs.MacOSXPreferencesFactory";
} else {
platformFactory = "java.util.prefs.FileSystemPreferencesFactory";
diff --git a/jdk/src/share/classes/java/util/regex/Pattern.java b/jdk/src/share/classes/java/util/regex/Pattern.java
index 626d5b08657..6c32f6a30bb 100644
--- a/jdk/src/share/classes/java/util/regex/Pattern.java
+++ b/jdk/src/share/classes/java/util/regex/Pattern.java
@@ -152,15 +152,24 @@ import java.util.Arrays;
* A digit: [0-9]
* \D
* A non-digit: [^0-9]
+ * \h
+ * A horizontal whitespace character:
+ * [ \t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]
+ * \H
+ * A non-horizontal whitespace character: [^\h]
* \s
* A whitespace character: [ \t\n\x0B\f\r]
* \S
* A non-whitespace character: [^\s]
+ * \v
+ * A vertical whitespace character: [\n\x0B\f\r\x85\u2028\u2029]
+ *
+ * \V
+ * A non-vertical whitespace character: [^\v]
* \w
* A word character: [a-zA-Z_0-9]
* \W
* A non-word character: [^\w]
- *
*
* POSIX character classes (US-ASCII only)
*
@@ -244,6 +253,13 @@ import java.util.Arrays;
* The end of the input
*
*
+ * Linebreak matcher
+ * \R
+ * Any Unicode linebreak sequence, is equivalent to
+ * \u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]
+ *
+ *
+ *
* Greedy quantifiers
*
* X ?
@@ -599,11 +615,9 @@ import java.util.Arrays;
* Noncharacter_Code_Point
* Assigned
*
-
-
*
- * Predefined Character classes and POSIX character classes are in
- * conformance with the recommendation of Annex C: Compatibility Properties
+ * The following Predefined Character classes and POSIX character classes
+ * are in conformance with the recommendation of Annex C: Compatibility Properties
* of Unicode Regular Expression
* , when {@link #UNICODE_CHARACTER_CLASS} flag is specified.
*
@@ -668,12 +682,6 @@ import java.util.Arrays;
*
*
* Predefined character classes (Unicode character)
- *
\h A horizontal whitespace
- *
\H A non horizontal whitespace
- *
\v A vertical whitespace
- *
\V A non vertical whitespace
- *
\R Any Unicode linebreak sequence
- * \u005cu000D\u005cu000A|[\u005cu000A\u005cu000B\u005cu000C\u005cu000D\u005cu0085\u005cu2028\u005cu2029]
*
\X Match Unicode
*
* extended grapheme cluster
@@ -2178,7 +2186,7 @@ loop: for(int x=0, offset=0; x= 0) {
append(ch, first);
first++;
@@ -2276,7 +2284,7 @@ loop: for(int x=0, offset=0; x= 0) {
if (peek() == '-') {
@@ -2606,9 +2636,15 @@ loop: for(int x=0, offset=0; x= 0x0A && cp <= 0x0D) ||
+ cp == 0x85 || cp == 0x2028 || cp == 0x2029;
+ }
+ }
+
+ /**
+ * Node class that matches a Perl horizontal whitespace
+ */
+ static final class HorizWS extends BmpCharProperty {
+ boolean isSatisfiedBy(int cp) {
+ return cp == 0x09 || cp == 0x20 || cp == 0xa0 ||
+ cp == 0x1680 || cp == 0x180e ||
+ cp >= 0x2000 && cp <= 0x200a ||
+ cp == 0x202f || cp == 0x205f || cp == 0x3000;
+ }
+ }
+
/**
* Base class for all Slice nodes
*/
diff --git a/jdk/src/share/classes/javax/net/ssl/SSLContext.java b/jdk/src/share/classes/javax/net/ssl/SSLContext.java
index 6852df2f98c..7aba5314e36 100644
--- a/jdk/src/share/classes/javax/net/ssl/SSLContext.java
+++ b/jdk/src/share/classes/javax/net/ssl/SSLContext.java
@@ -145,7 +145,7 @@ public class SSLContext {
* @return the new SSLContext
object.
*
* @exception NoSuchAlgorithmException if no Provider supports a
- * TrustManagerFactorySpi implementation for the
+ * SSLContextSpi implementation for the
* specified protocol.
* @exception NullPointerException if protocol is null.
*
@@ -222,11 +222,11 @@ public class SSLContext {
*
* @return the new SSLContext
object.
*
- * @throws NoSuchAlgorithmException if a KeyManagerFactorySpi
+ * @throws NoSuchAlgorithmException if a SSLContextSpi
* implementation for the specified protocol is not available
* from the specified Provider object.
*
- * @throws IllegalArgumentException if the provider name is null.
+ * @throws IllegalArgumentException if the provider is null.
* @throws NullPointerException if protocol is null.
*
* @see java.security.Provider
diff --git a/jdk/src/share/classes/javax/swing/JApplet.java b/jdk/src/share/classes/javax/swing/JApplet.java
index e36cd55e891..0da6c3e532a 100644
--- a/jdk/src/share/classes/javax/swing/JApplet.java
+++ b/jdk/src/share/classes/javax/swing/JApplet.java
@@ -149,7 +149,7 @@ public class JApplet extends Applet implements Accessible,
setRootPaneCheckingEnabled(true);
setFocusTraversalPolicyProvider(true);
- sun.awt.SunToolkit.checkAndSetPolicy(this, true);
+ sun.awt.SunToolkit.checkAndSetPolicy(this);
enableEvents(AWTEvent.KEY_EVENT_MASK);
}
diff --git a/jdk/src/share/classes/javax/swing/JComponent.java b/jdk/src/share/classes/javax/swing/JComponent.java
index 314a9315e48..dbf4b3c3343 100644
--- a/jdk/src/share/classes/javax/swing/JComponent.java
+++ b/jdk/src/share/classes/javax/swing/JComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2638,17 +2638,16 @@ public abstract class JComponent extends Container implements Serializable,
* attribute: visualUpdate true
*/
public void setVisible(boolean aFlag) {
- if(aFlag != isVisible()) {
+ if (aFlag != isVisible()) {
super.setVisible(aFlag);
- Container parent = getParent();
- if(parent != null) {
- Rectangle r = getBounds();
- parent.repaint(r.x,r.y,r.width,r.height);
+ if (aFlag) {
+ Container parent = getParent();
+ if (parent != null) {
+ Rectangle r = getBounds();
+ parent.repaint(r.x, r.y, r.width, r.height);
+ }
+ revalidate();
}
- // Some (all should) LayoutManagers do not consider components
- // that are not visible. As such we need to revalidate when the
- // visible bit changes.
- revalidate();
}
}
@@ -4149,6 +4148,9 @@ public abstract class JComponent extends Container implements Serializable,
* Refer to
* {@link java.awt.Component#setFocusTraversalKeys}
* for a complete description of this method.
+ *
+ * This method may throw a {@code ClassCastException} if any {@code Object}
+ * in {@code keystrokes} is not an {@code AWTKeyStroke}.
*
* @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
* KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
@@ -4161,8 +4163,7 @@ public abstract class JComponent extends Container implements Serializable,
* KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
* KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
* KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or if keystrokes
- * contains null, or if any Object in keystrokes is not an
- * AWTKeyStroke, or if any keystroke represents a KEY_TYPED event,
+ * contains null, or if any keystroke represents a KEY_TYPED event,
* or if any keystroke already maps to another focus traversal
* operation for this Component
* @since 1.5
@@ -5568,4 +5569,22 @@ public abstract class JComponent extends Container implements Serializable,
",preferredSize=" + preferredSizeString;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Deprecated
+ public void hide() {
+ boolean showing = isShowing();
+ super.hide();
+ if (showing) {
+ Container parent = getParent();
+ if (parent != null) {
+ Rectangle r = getBounds();
+ parent.repaint(r.x, r.y, r.width, r.height);
+ }
+ revalidate();
+ }
+ }
+
}
diff --git a/jdk/src/share/classes/javax/swing/JDesktopPane.java b/jdk/src/share/classes/javax/swing/JDesktopPane.java
index 579d65af3d0..85615d3d959 100644
--- a/jdk/src/share/classes/javax/swing/JDesktopPane.java
+++ b/jdk/src/share/classes/javax/swing/JDesktopPane.java
@@ -27,7 +27,8 @@ package javax.swing;
import java.util.List;
import java.util.ArrayList;
-import java.util.Vector;
+import java.util.Collection;
+import java.util.Iterator;
import javax.swing.plaf.*;
import javax.accessibility.*;
@@ -42,7 +43,6 @@ import java.io.IOException;
import java.beans.PropertyVetoException;
import java.util.Set;
import java.util.TreeSet;
-
/**
* A container used to create a multiple-document interface or a virtual desktop.
* You create JInternalFrame
objects and add them to the
@@ -261,25 +261,26 @@ public class JDesktopPane extends JLayeredPane implements Accessible
* @return an array of JInternalFrame
objects
*/
public JInternalFrame[] getAllFrames() {
- int i, count;
- JInternalFrame[] results;
- Vector vResults = new Vector(10);
+ return getAllFrames(this).toArray(new JInternalFrame[0]);
+ }
- count = getComponentCount();
- for(i = 0; i < count; i++) {
- Component next = getComponent(i);
- if(next instanceof JInternalFrame)
- vResults.addElement((JInternalFrame) next);
- else if(next instanceof JInternalFrame.JDesktopIcon) {
- JInternalFrame tmp = ((JInternalFrame.JDesktopIcon)next).getInternalFrame();
- if(tmp != null)
- vResults.addElement(tmp);
+ private static Collection getAllFrames(Container parent) {
+ int i, count;
+ Collection results = new ArrayList();
+ count = parent.getComponentCount();
+ for (i = 0; i < count; i++) {
+ Component next = parent.getComponent(i);
+ if (next instanceof JInternalFrame) {
+ results.add((JInternalFrame) next);
+ } else if (next instanceof JInternalFrame.JDesktopIcon) {
+ JInternalFrame tmp = ((JInternalFrame.JDesktopIcon) next).getInternalFrame();
+ if (tmp != null) {
+ results.add(tmp);
+ }
+ } else if (next instanceof Container) {
+ results.addAll(getAllFrames((Container) next));
}
}
-
- results = new JInternalFrame[vResults.size()];
- vResults.copyInto(results);
-
return results;
}
@@ -322,27 +323,14 @@ public class JDesktopPane extends JLayeredPane implements Accessible
* @see JLayeredPane
*/
public JInternalFrame[] getAllFramesInLayer(int layer) {
- int i, count;
- JInternalFrame[] results;
- Vector vResults = new Vector(10);
-
- count = getComponentCount();
- for(i = 0; i < count; i++) {
- Component next = getComponent(i);
- if(next instanceof JInternalFrame) {
- if(((JInternalFrame)next).getLayer() == layer)
- vResults.addElement((JInternalFrame) next);
- } else if(next instanceof JInternalFrame.JDesktopIcon) {
- JInternalFrame tmp = ((JInternalFrame.JDesktopIcon)next).getInternalFrame();
- if(tmp != null && tmp.getLayer() == layer)
- vResults.addElement(tmp);
+ Collection allFrames = getAllFrames(this);
+ Iterator iterator = allFrames.iterator();
+ while (iterator.hasNext()) {
+ if (iterator.next().getLayer() != layer) {
+ iterator.remove();
}
}
-
- results = new JInternalFrame[vResults.size()];
- vResults.copyInto(results);
-
- return results;
+ return allFrames.toArray(new JInternalFrame[0]);
}
private List getFrames() {
diff --git a/jdk/src/share/classes/javax/swing/JDialog.java b/jdk/src/share/classes/javax/swing/JDialog.java
index a4e35b66351..a53c4abe50c 100644
--- a/jdk/src/share/classes/javax/swing/JDialog.java
+++ b/jdk/src/share/classes/javax/swing/JDialog.java
@@ -654,7 +654,7 @@ public class JDialog extends Dialog implements WindowConstants,
getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
}
}
- sun.awt.SunToolkit.checkAndSetPolicy(this, true);
+ sun.awt.SunToolkit.checkAndSetPolicy(this);
}
/**
diff --git a/jdk/src/share/classes/javax/swing/JFrame.java b/jdk/src/share/classes/javax/swing/JFrame.java
index 3d5dea1f7cb..cccd6f98aa5 100644
--- a/jdk/src/share/classes/javax/swing/JFrame.java
+++ b/jdk/src/share/classes/javax/swing/JFrame.java
@@ -266,7 +266,7 @@ public class JFrame extends Frame implements WindowConstants,
getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
}
}
- sun.awt.SunToolkit.checkAndSetPolicy(this, true);
+ sun.awt.SunToolkit.checkAndSetPolicy(this);
}
/**
diff --git a/jdk/src/share/classes/javax/swing/JInternalFrame.java b/jdk/src/share/classes/javax/swing/JInternalFrame.java
index 516ac9afb08..a0ba3a18084 100644
--- a/jdk/src/share/classes/javax/swing/JInternalFrame.java
+++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java
@@ -349,7 +349,7 @@ public class JInternalFrame extends JComponent implements
setRootPaneCheckingEnabled(true);
desktopIcon = new JDesktopIcon(this);
updateUI();
- sun.awt.SunToolkit.checkAndSetPolicy(this, true);
+ sun.awt.SunToolkit.checkAndSetPolicy(this);
addPropertyChangeListenerIfNecessary();
}
diff --git a/jdk/src/share/classes/javax/swing/JPopupMenu.java b/jdk/src/share/classes/javax/swing/JPopupMenu.java
index 01763f666a9..7564b9f2075 100644
--- a/jdk/src/share/classes/javax/swing/JPopupMenu.java
+++ b/jdk/src/share/classes/javax/swing/JPopupMenu.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,8 @@ import javax.swing.plaf.PopupMenuUI;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicComboPopup;
import javax.swing.event.*;
+
+import sun.awt.SunToolkit;
import sun.security.util.SecurityConstants;
import java.applet.Applet;
@@ -347,6 +349,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
long popupBottomY = (long)popupLocation.y + (long)popupSize.height;
int scrWidth = scrBounds.width;
int scrHeight = scrBounds.height;
+
if (!canPopupOverlapTaskBar()) {
// Insets include the task bar. Take them into account.
Insets scrInsets = toolkit.getScreenInsets(gc);
@@ -407,25 +410,19 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
}
/**
- * Checks that there are enough security permissions
- * to make popup "always on top", which allows to show it above the task bar.
+ * Returns whether popup is allowed to be shown above the task bar.
*/
static boolean canPopupOverlapTaskBar() {
boolean result = true;
- try {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(
- SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
- }
- } catch (SecurityException se) {
- // There is no permission to show popups over the task bar
- result = false;
+
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ if (tk instanceof SunToolkit) {
+ result = ((SunToolkit)tk).canPopupOverlapTaskBar();
}
+
return result;
}
-
/**
* Factory method which creates the JMenuItem
for
* Actions
added to the JPopupMenu
.
diff --git a/jdk/src/share/classes/javax/swing/JTable.java b/jdk/src/share/classes/javax/swing/JTable.java
index 6314cb0a207..17b6b23d135 100644
--- a/jdk/src/share/classes/javax/swing/JTable.java
+++ b/jdk/src/share/classes/javax/swing/JTable.java
@@ -5470,7 +5470,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
if (constructor.getDeclaringClass() == String.class) {
value = s;
}
- super.stopCellEditing();
+ return super.stopCellEditing();
}
try {
diff --git a/jdk/src/share/classes/javax/swing/JWindow.java b/jdk/src/share/classes/javax/swing/JWindow.java
index 4a12d0205fb..f5d7b08a4bd 100644
--- a/jdk/src/share/classes/javax/swing/JWindow.java
+++ b/jdk/src/share/classes/javax/swing/JWindow.java
@@ -264,7 +264,7 @@ public class JWindow extends Window implements Accessible,
setLocale( JComponent.getDefaultLocale() );
setRootPane(createRootPane());
setRootPaneCheckingEnabled(true);
- sun.awt.SunToolkit.checkAndSetPolicy(this, true);
+ sun.awt.SunToolkit.checkAndSetPolicy(this);
}
/**
diff --git a/jdk/src/share/classes/javax/swing/UIManager.java b/jdk/src/share/classes/javax/swing/UIManager.java
index c3199d5f8d2..d135e34b5c9 100644
--- a/jdk/src/share/classes/javax/swing/UIManager.java
+++ b/jdk/src/share/classes/javax/swing/UIManager.java
@@ -191,6 +191,7 @@ public class UIManager implements Serializable
private UIDefaults[] tables = new UIDefaults[2];
boolean initialized = false;
+ boolean focusPolicyInitialized = false;
MultiUIDefaults multiUIDefaults = new MultiUIDefaults(tables);
LookAndFeel lookAndFeel;
LookAndFeel multiLookAndFeel = null;
@@ -1000,6 +1001,7 @@ public class UIManager implements Serializable
*/
public static ComponentUI getUI(JComponent target) {
maybeInitialize();
+ maybeInitializeFocusPolicy(target);
ComponentUI ui = null;
LookAndFeel multiLAF = getLAFState().multiLookAndFeel;
if (multiLAF != null) {
@@ -1422,6 +1424,27 @@ public class UIManager implements Serializable
}
}
+ /*
+ * Sets default swing focus traversal policy.
+ */
+ private static void maybeInitializeFocusPolicy(JComponent comp) {
+ // Check for JRootPane which indicates that a swing toplevel
+ // is coming, in which case a swing default focus policy
+ // should be instatiated. See 7125044.
+ if (comp instanceof JRootPane) {
+ synchronized (classLock) {
+ if (!getLAFState().focusPolicyInitialized) {
+ getLAFState().focusPolicyInitialized = true;
+
+ if (FocusManager.isFocusManagerEnabled()) {
+ KeyboardFocusManager.getCurrentKeyboardFocusManager().
+ setDefaultFocusTraversalPolicy(
+ new LayoutFocusTraversalPolicy());
+ }
+ }
+ }
+ }
+ }
/*
* Only called by maybeInitialize().
@@ -1433,17 +1456,6 @@ public class UIManager implements Serializable
initializeAuxiliaryLAFs(swingProps);
initializeInstalledLAFs(swingProps);
- // Enable the Swing default LayoutManager.
- String toolkitName = Toolkit.getDefaultToolkit().getClass().getName();
- // don't set default policy if this is XAWT.
- if (!"sun.awt.X11.XToolkit".equals(toolkitName)) {
- if (FocusManager.isFocusManagerEnabled()) {
- KeyboardFocusManager.getCurrentKeyboardFocusManager().
- setDefaultFocusTraversalPolicy(
- new LayoutFocusTraversalPolicy());
- }
- }
-
// Install Swing's PaintEventDispatcher
if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
sun.awt.PaintEventDispatcher.setPaintEventDispatcher(
diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java
index f8047790155..04a2799fe5f 100644
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java
@@ -34,6 +34,8 @@ import java.awt.geom.Point2D;
import java.awt.peer.ComponentPeer;
import java.security.AccessControlContext;
+import java.io.File;
+
/**
* The AWTAccessor utility class.
* The main purpose of this class is to enable accessing
@@ -455,7 +457,7 @@ public final class AWTAccessor {
/*
* Sets the files the user selects
*/
- void setFiles(FileDialog fileDialog, String directory, String files[]);
+ void setFiles(FileDialog fileDialog, File files[]);
/*
* Sets the file the user selects
diff --git a/jdk/src/share/classes/sun/awt/NativeLibLoader.java b/jdk/src/share/classes/sun/awt/NativeLibLoader.java
index ee9f695b6eb..32a31b9cb49 100644
--- a/jdk/src/share/classes/sun/awt/NativeLibLoader.java
+++ b/jdk/src/share/classes/sun/awt/NativeLibLoader.java
@@ -54,6 +54,11 @@ class NativeLibLoader {
*/
static void loadLibraries() {
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("awt"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("awt");
+ return null;
+ }
+ });
}
}
diff --git a/jdk/src/share/classes/sun/awt/OSInfo.java b/jdk/src/share/classes/sun/awt/OSInfo.java
index 58dd6cc1fd0..4a515a1734c 100644
--- a/jdk/src/share/classes/sun/awt/OSInfo.java
+++ b/jdk/src/share/classes/sun/awt/OSInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@ public class OSInfo {
return SOLARIS;
}
- if (osName.startsWith("Mac OS X")) {
+ if (osName.contains("OS X")) {
return MACOSX;
}
diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java
index 19cfdf41711..a1c0d184eb9 100644
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
+
+import sun.security.util.SecurityConstants;
import sun.util.logging.PlatformLogger;
import sun.misc.SoftCache;
import sun.font.FontDesignMetrics;
@@ -459,48 +461,11 @@ public abstract class SunToolkit extends Toolkit
AWTAccessor.getWindowAccessor().setLWRequestStatus(changed, status);
};
- public static void checkAndSetPolicy(Container cont, boolean isSwingCont)
- {
- FocusTraversalPolicy defaultPolicy = KeyboardFocusManager
- .getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy();
+ public static void checkAndSetPolicy(Container cont) {
+ FocusTraversalPolicy defaultPolicy = KeyboardFocusManager.
+ getCurrentKeyboardFocusManager().
+ getDefaultFocusTraversalPolicy();
- String toolkitName = Toolkit.getDefaultToolkit().getClass().getName();
- // if this is not XAWT then use default policy
- // because Swing change it
- if (!"sun.awt.X11.XToolkit".equals(toolkitName)) {
- cont.setFocusTraversalPolicy(defaultPolicy);
- return;
- }
-
- String policyName = defaultPolicy.getClass().getName();
-
- if (DefaultFocusTraversalPolicy.class != defaultPolicy.getClass()) {
- // Policy was changed
- // Check if it is awt policy or swing policy
- // If it is Swing policy we shouldn't use it in AWT frames
- // If it is AWT policy we shouldn't use it in Swing frames
- // Otherwise we should use this policy
- if (policyName.startsWith("java.awt.")) {
- // AWT
- if (isSwingCont) {
- // Can't use AWT policy in Swing windows - should use Swing's one.
- defaultPolicy = createLayoutPolicy();
- } else {
- // New awt policy.
- }
- } else if (policyName.startsWith("javax.swing.")) {
- if (isSwingCont) {
- // New Swing's policy
- } else {
- defaultPolicy = new DefaultFocusTraversalPolicy();
- }
- }
- } else {
- // Policy is default, use different default policy for swing
- if (isSwingCont) {
- defaultPolicy = createLayoutPolicy();
- }
- }
cont.setFocusTraversalPolicy(defaultPolicy);
}
@@ -1135,6 +1100,26 @@ public abstract class SunToolkit extends Toolkit
return ((mods & InputEvent.ALT_MASK) == (mods & InputEvent.CTRL_MASK));
}
+ /**
+ * Returns whether popup is allowed to be shown above the task bar.
+ * This is a default implementation of this method, which checks
+ * corresponding security permission.
+ */
+ public boolean canPopupOverlapTaskBar() {
+ boolean result = true;
+ try {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(
+ SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
+ }
+ } catch (SecurityException se) {
+ // There is no permission to show popups over the task bar
+ result = false;
+ }
+ return result;
+ }
+
/**
* Returns a new input method window, with behavior as specified in
* {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}.
diff --git a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
index 72ac1d06a70..c971b414ae1 100644
--- a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
+++ b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java
@@ -54,7 +54,12 @@ public class JPEGImageDecoder extends ImageDecoder {
static {
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("jpeg"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("jpeg");
+ return null;
+ }
+ });
initIDs(InputStreamClass);
RGBcolormodel = new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
ARGBcolormodel = ColorModel.getRGBdefault();
diff --git a/jdk/src/share/classes/sun/awt/image/NativeLibLoader.java b/jdk/src/share/classes/sun/awt/image/NativeLibLoader.java
index 5c6a765c414..d713d79b5c0 100644
--- a/jdk/src/share/classes/sun/awt/image/NativeLibLoader.java
+++ b/jdk/src/share/classes/sun/awt/image/NativeLibLoader.java
@@ -53,7 +53,12 @@ class NativeLibLoader {
* that the name of the library is "awt". -br.
*/
static void loadLibraries() {
- java.security.AccessController.doPrivileged
- (new sun.security.action.LoadLibraryAction("awt"));
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("awt");
+ return null;
+ }
+ });
}
}
diff --git a/jdk/src/share/classes/sun/font/FontUtilities.java b/jdk/src/share/classes/sun/font/FontUtilities.java
index fd1adcc9c98..2284c11714a 100644
--- a/jdk/src/share/classes/sun/font/FontUtilities.java
+++ b/jdk/src/share/classes/sun/font/FontUtilities.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@ public final class FontUtilities {
isLinux = osName.startsWith("Linux");
- isMacOSX = osName.startsWith("Mac OS X"); // TODO: MacOSX
+ isMacOSX = osName.contains("OS X"); // TODO: MacOSX
String t2kStr = System.getProperty("sun.java2d.font.scaler");
if (t2kStr != null) {
diff --git a/jdk/src/share/classes/sun/java2d/Disposer.java b/jdk/src/share/classes/sun/java2d/Disposer.java
index 83951023fbb..dcedfe3846e 100644
--- a/jdk/src/share/classes/sun/java2d/Disposer.java
+++ b/jdk/src/share/classes/sun/java2d/Disposer.java
@@ -57,7 +57,12 @@ public class Disposer implements Runnable {
static {
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("awt"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("awt");
+ return null;
+ }
+ });
initIDs();
String type = (String) java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("sun.java2d.reftype"));
diff --git a/jdk/src/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/share/classes/sun/launcher/LauncherHelper.java
index 233704c3b01..06c64f8ed50 100644
--- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java
+++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -381,7 +381,7 @@ public enum LauncherHelper {
PrintStream ostream = (printToStderr) ? System.err : System.out;
ostream.println(getLocalizedMessage("java.launcher.X.usage",
File.pathSeparator));
- if (System.getProperty("os.name").startsWith("Mac OS")) {
+ if (System.getProperty("os.name").contains("OS X")) {
ostream.println(getLocalizedMessage("java.launcher.X.macosx.usage",
File.pathSeparator));
}
diff --git a/jdk/src/share/classes/sun/management/Agent.java b/jdk/src/share/classes/sun/management/Agent.java
index 7f65e5ceb9f..19d2dedb5b4 100644
--- a/jdk/src/share/classes/sun/management/Agent.java
+++ b/jdk/src/share/classes/sun/management/Agent.java
@@ -168,7 +168,10 @@ public class Agent {
// management properties can be overridden by system properties
// which take precedence
- configProps.putAll(System.getProperties());
+ Properties sysProps = System.getProperties();
+ synchronized(sysProps){
+ configProps.putAll(sysProps);
+ }
// if user specifies config file into command line for either
// jcmd utilities or attach command it overrides properties set in
@@ -264,7 +267,10 @@ public class Agent {
// management properties can be overridden by system properties
// which take precedence
- props.putAll(System.getProperties());
+ Properties sysProps = System.getProperties();
+ synchronized(sysProps){
+ props.putAll(sysProps);
+ }
return props;
}
diff --git a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java
index 025b7a26d64..bd1cd2581e7 100644
--- a/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java
+++ b/jdk/src/share/classes/sun/management/ManagementFactoryHelper.java
@@ -37,7 +37,6 @@ import javax.management.RuntimeOperationsException;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import sun.security.action.LoadLibraryAction;
import sun.util.logging.LoggingSupport;
@@ -422,7 +421,13 @@ public class ManagementFactoryHelper {
}
static {
- AccessController.doPrivileged(new LoadLibraryAction("management"));
+ AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("management");
+ return null;
+ }
+ });
jvm = new VMManagementImpl();
}
diff --git a/jdk/src/share/classes/sun/net/sdp/SdpSupport.java b/jdk/src/share/classes/sun/net/sdp/SdpSupport.java
index 5baca6e4925..b70a729cc56 100644
--- a/jdk/src/share/classes/sun/net/sdp/SdpSupport.java
+++ b/jdk/src/share/classes/sun/net/sdp/SdpSupport.java
@@ -76,6 +76,11 @@ public final class SdpSupport {
static {
AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("net"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("net");
+ return null;
+ }
+ });
}
}
diff --git a/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java b/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java
index d7aa358d596..23c1338e8f1 100644
--- a/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java
+++ b/jdk/src/share/classes/sun/net/spi/DefaultProxySelector.java
@@ -95,7 +95,12 @@ public class DefaultProxySelector extends ProxySelector {
}});
if (b != null && b.booleanValue()) {
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("net"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("net");
+ return null;
+ }
+ });
hasSystemProxies = init();
}
}
diff --git a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
index 63868935059..4bf870856a4 100644
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -744,7 +744,8 @@ class DatagramChannelImpl
if (sm != null)
sm.checkConnect(isa.getAddress().getHostAddress(),
isa.getPort());
- disconnect0(fd);
+ boolean isIPv6 = (family == StandardProtocolFamily.INET6);
+ disconnect0(fd, isIPv6);
remoteAddress = null;
state = ST_UNCONNECTED;
@@ -1079,7 +1080,7 @@ class DatagramChannelImpl
private static native void initIDs();
- private static native void disconnect0(FileDescriptor fd)
+ private static native void disconnect0(FileDescriptor fd, boolean isIPv6)
throws IOException;
private native int receive0(FileDescriptor fd, long address, int len,
diff --git a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
index fe2c5fe33ac..f0f72551614 100644
--- a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java
@@ -629,17 +629,6 @@ class SocketChannelImpl
break;
}
- synchronized (stateLock) {
- if (isOpen() && (localAddress == null) ||
- ((InetSocketAddress)localAddress)
- .getAddress().isAnyLocalAddress())
- {
- // Socket was not bound before connecting or
- // Socket was bound with an "anyLocalAddress"
- localAddress = Net.localAddress(fd);
- }
- }
-
} finally {
readerCleanup();
end((n > 0) || (n == IOStatus.UNAVAILABLE));
@@ -659,6 +648,8 @@ class SocketChannelImpl
// Connection succeeded; disallow further
// invocation
state = ST_CONNECTED;
+ if (isOpen())
+ localAddress = Net.localAddress(fd);
return true;
}
// If nonblocking and no exception then connection
@@ -747,6 +738,8 @@ class SocketChannelImpl
if (n > 0) {
synchronized (stateLock) {
state = ST_CONNECTED;
+ if (isOpen())
+ localAddress = Net.localAddress(fd);
}
return true;
}
diff --git a/jdk/src/share/classes/sun/nio/ch/Util.java b/jdk/src/share/classes/sun/nio/ch/Util.java
index 56aa1f65e39..985f7ffefe5 100644
--- a/jdk/src/share/classes/sun/nio/ch/Util.java
+++ b/jdk/src/share/classes/sun/nio/ch/Util.java
@@ -472,10 +472,15 @@ public class Util {
if (loaded)
return;
loaded = true;
- java.security.AccessController
- .doPrivileged(new sun.security.action.LoadLibraryAction("net"));
- java.security.AccessController
- .doPrivileged(new sun.security.action.LoadLibraryAction("nio"));
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("net");
+ System.loadLibrary("nio");
+ return null;
+ }
+ });
+
// IOUtil must be initialized; Its native methods are called from
// other places in native nio code so they must be set up.
IOUtil.initIDs();
diff --git a/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java b/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
index ebf55b206ce..299db8fd7c4 100644
--- a/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
+++ b/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1280,7 +1280,7 @@ public class ExtendedCharsets
String osName = AccessController.doPrivileged(
new GetPropertyAction("os.name"));
if ("SunOS".equals(osName) || "Linux".equals(osName)
- || osName.startsWith("Mac OS")) {
+ || osName.contains("OS X")) {
charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
new String[] {
"COMPOUND_TEXT", // JDK historical
diff --git a/jdk/src/share/classes/sun/print/PSPrinterJob.java b/jdk/src/share/classes/sun/print/PSPrinterJob.java
index 49584f2f8a2..99f88f356c4 100644
--- a/jdk/src/share/classes/sun/print/PSPrinterJob.java
+++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1567,7 +1567,7 @@ public class PSPrinterJob extends RasterPrinterJob {
}
String osname = System.getProperty("os.name");
- if (osname.equals("Linux") || osname.startsWith("Mac OS X")) {
+ if (osname.equals("Linux") || osname.contains("OS X")) {
execCmd = new String[ncomps];
execCmd[n++] = "/usr/bin/lpr";
if ((pFlags & PRINTER) != 0) {
diff --git a/jdk/src/share/classes/sun/print/ServiceDialog.java b/jdk/src/share/classes/sun/print/ServiceDialog.java
index 9d2da0c7c91..136b40e487b 100644
--- a/jdk/src/share/classes/sun/print/ServiceDialog.java
+++ b/jdk/src/share/classes/sun/print/ServiceDialog.java
@@ -72,6 +72,7 @@ import javax.swing.text.NumberFormatter;
import sun.print.SunPageSelection;
import java.awt.event.KeyEvent;
import java.net.URISyntaxException;
+import java.lang.reflect.Field;
/**
@@ -479,20 +480,45 @@ public class ServiceDialog extends JDialog implements ActionListener {
*/
public static String getMsg(String key) {
try {
- return messageRB.getString(key);
+ return removeMnemonics(messageRB.getString(key));
} catch (java.util.MissingResourceException e) {
throw new Error("Fatal: Resource for ServiceUI is broken; " +
"there is no " + key + " key in resource");
}
}
+ private static String removeMnemonics(String s) {
+ int i = s.indexOf('&');
+ int len = s.length();
+ if (i < 0 || i == (len - 1)) {
+ return s;
+ }
+ int j = s.indexOf('&', i+1);
+ if (j == i+1) {
+ if (j+1 == len) {
+ return s.substring(0, i+1); // string ends with &&
+ } else {
+ return s.substring(0, i+1) + removeMnemonics(s.substring(j+1));
+ }
+ }
+ // ok first & not double &&
+ if (i == 0) {
+ return removeMnemonics(s.substring(1));
+ } else {
+ return (s.substring(0, i) + removeMnemonics(s.substring(i+1)));
+ }
+ }
+
+
/**
* Returns mnemonic character from resource
*/
private static char getMnemonic(String key) {
- String str = getMsg(key + ".mnemonic");
- if ((str != null) && (str.length() > 0)) {
- return str.charAt(0);
+ String str = messageRB.getString(key).replace("&&", "");
+ int index = str.indexOf('&');
+ if (0 <= index && index < str.length() - 1) {
+ char c = str.charAt(index + 1);
+ return Character.toUpperCase(c);
} else {
return (char)0;
}
@@ -501,12 +527,23 @@ public class ServiceDialog extends JDialog implements ActionListener {
/**
* Returns the mnemonic as a KeyEvent.VK constant from the resource.
*/
+ static Class _keyEventClazz = null;
private static int getVKMnemonic(String key) {
- String str = getMsg(key + ".vkMnemonic");
- if ((str != null) && (str.length() > 0)) {
- try {
- return Integer.parseInt(str);
- } catch (NumberFormatException nfe) {}
+ String s = String.valueOf(getMnemonic(key));
+ if ( s == null || s.length() != 1) {
+ return 0;
+ }
+ String vkString = "VK_" + s.toUpperCase();
+
+ try {
+ if (_keyEventClazz == null) {
+ _keyEventClazz= Class.forName("java.awt.event.KeyEvent",
+ true, (ServiceDialog.class).getClassLoader());
+ }
+ Field field = _keyEventClazz.getDeclaredField(vkString);
+ int value = field.getInt(null);
+ return value;
+ } catch (Exception e) {
}
return 0;
}
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui.properties b/jdk/src/share/classes/sun/print/resources/serviceui.properties
index ca244a870d7..6c97dce95b2 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui.properties
@@ -14,15 +14,11 @@ border.margins=Margins
button.cancel=Cancel
button.ok=OK
button.print=Print
-button.properties=Properties...
-button.properties.mnemonic=R
+button.properties=P&roperties...
#
-checkbox.collate=Collate
-checkbox.collate.mnemonic=C
-checkbox.jobsheets=Banner Page
-checkbox.jobsheets.mnemonic=B
-checkbox.printtofile=Print To File
-checkbox.printtofile.mnemonic=F
+checkbox.collate=&Collate
+checkbox.jobsheets=&Banner Page
+checkbox.printtofile=Print To &File
#
dialog.printtitle=Print
dialog.pstitle=Page Setup
@@ -33,70 +29,42 @@ dialog.noprintermsg=No print service found.
dialog.writeerror=Cannot write to file:
#
label.info=Info:
-label.jobname=Job Name:
-label.jobname.mnemonic=J
-label.numcopies=Number of copies:
-label.numcopies.mnemonic=O
-label.priority=Priority:
-label.priority.mnemonic=R
-label.psname=Name:
-label.psname.mnemonic=N
+label.jobname=&Job Name:
+label.numcopies=Number &of copies:
+label.priority=P&riority:
+label.psname=&Name:
label.pstype=Type:
label.rangeto=To
-label.size=Size:
-label.size.mnemonic=Z
-label.source=Source:
-label.source.mnemonic=C
+label.size=Si&ze:
+label.source=Sour&ce:
label.status=Status:
-label.username=User Name:
-label.username.mnemonic=U
+label.username=&User Name:
label.millimetres=(mm)
label.inches=(in)
-label.topmargin=top
-label.topmargin.mnemonic=T
-label.bottommargin=bottom
-label.bottommargin.mnemonic=B
-label.leftmargin=left
-label.leftmargin.mnemonic=F
-label.rightmargin=right
-label.rightmargin.mnemonic=R
+label.topmargin=&top
+label.bottommargin=&bottom
+label.leftmargin=le&ft
+label.rightmargin=&right
#
-radiobutton.color=Color
-radiobutton.color.mnemonic=C
-radiobutton.draftq=Draft
-radiobutton.draftq.mnemonic=F
-radiobutton.duplex=Duplex
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=High
-radiobutton.highq.mnemonic=H
-radiobutton.landscape=Landscape
-radiobutton.landscape.mnemonic=L
-radiobutton.monochrome=Monochrome
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=Normal
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=One Side
-radiobutton.oneside.mnemonic=O
-radiobutton.portrait=Portrait
-radiobutton.portrait.mnemonic=P
-radiobutton.rangeall=All
-radiobutton.rangeall.mnemonic=L
-radiobutton.rangepages=Pages
-radiobutton.rangepages.mnemonic=E
-radiobutton.revlandscape=Reverse Landscape
-radiobutton.revlandscape.mnemonic=N
-radiobutton.revportrait=Reverse Portrait
-radiobutton.revportrait.mnemonic=I
-radiobutton.tumble=Tumble
-radiobutton.tumble.mnemonic=T
+radiobutton.color=&Color
+radiobutton.draftq=Dra&ft
+radiobutton.duplex=&Duplex
+radiobutton.highq=&High
+radiobutton.landscape=&Landscape
+radiobutton.monochrome=&Monochrome
+radiobutton.normalq=&Normal
+radiobutton.oneside=&One Side
+radiobutton.portrait=&Portrait
+radiobutton.rangeall=A&ll
+radiobutton.rangepages=Pag&es
+radiobutton.revlandscape=Reverse La&ndscape
+radiobutton.revportrait=Reverse Portra&it
+radiobutton.tumble=&Tumble
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=Appearance
-tab.appearance.vkMnemonic=65
-tab.general=General
-tab.general.vkMnemonic=71
-tab.pagesetup=Page Setup
-tab.pagesetup.vkMnemonic=83
+tab.appearance=&Appearance
+tab.general=&General
+tab.pagesetup=Page &Setup
#
error.pagerange=Invalid page range; please re-enter values (e.g. 1-3,5,7-10)
error.destination=Invalid filename; please try again
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_de.properties b/jdk/src/share/classes/sun/print/resources/serviceui_de.properties
index b89af429b2e..67d06a3312f 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_de.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_de.properties
@@ -14,15 +14,11 @@ border.margins=R\u00E4nder
button.cancel=Abbrechen
button.ok=OK
button.print=Drucken
-button.properties=Eigenschaften...
-button.properties.mnemonic=I
+button.properties=E&igenschaften...
#
-checkbox.collate=Sortieren
-checkbox.collate.mnemonic=R
-checkbox.jobsheets=Bannerseite
-checkbox.jobsheets.mnemonic=B
-checkbox.printtofile=Ausgabe in Datei
-checkbox.printtofile.mnemonic=U
+checkbox.collate=So&rtieren
+checkbox.jobsheets=&Bannerseite
+checkbox.printtofile=A&usgabe in Datei
#
dialog.printtitle=Drucken
dialog.pstitle=Seite einrichten
@@ -33,70 +29,42 @@ dialog.noprintermsg=Kein Druckservice gefunden.
dialog.writeerror=Schreiben in Datei nicht m\u00F6glich:
#
label.info=Info:
-label.jobname=Job-Name:
-label.jobname.mnemonic=J
-label.numcopies=Anzahl Kopien:
-label.numcopies.mnemonic=K
-label.priority=Priorit\u00E4t:
-label.priority.mnemonic=R
-label.psname=Name:
-label.psname.mnemonic=N
+label.jobname=&Job-Name:
+label.numcopies=Anzahl &Kopien:
+label.priority=P&riorit\u00E4t:
+label.psname=&Name:
label.pstype=Typ:
label.rangeto=Bis
-label.size=Gr\u00F6\u00DFe:
-label.size.mnemonic=E
-label.source=Quelle:
-label.source.mnemonic=U
+label.size=Gr\u00F6\u00DF&e:
+label.source=Q&uelle:
label.status=Status:
-label.username=Benutzername:
-label.username.mnemonic=U
+label.username=Ben&utzername:
label.millimetres=(mm)
label.inches=(Zoll)
-label.topmargin=oben
-label.topmargin.mnemonic=O
-label.bottommargin=unten
-label.bottommargin.mnemonic=N
-label.leftmargin=links
-label.leftmargin.mnemonic=L
-label.rightmargin=rechts
-label.rightmargin.mnemonic=R
+label.topmargin=&oben
+label.bottommargin=u&nten
+label.leftmargin=&links
+label.rightmargin=&rechts
#
-radiobutton.color=Farbe
-radiobutton.color.mnemonic=F
-radiobutton.draftq=Entwurf
-radiobutton.draftq.mnemonic=W
-radiobutton.duplex=Duplex
-radiobutton.duplex.mnemonic=P
-radiobutton.highq=Hoch
-radiobutton.highq.mnemonic=H
-radiobutton.landscape=Querformat
-radiobutton.landscape.mnemonic=Q
-radiobutton.monochrome=Monochrom
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=Normal
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=Einseitig
-radiobutton.oneside.mnemonic=E
-radiobutton.portrait=Hochformat
-radiobutton.portrait.mnemonic=H
-radiobutton.rangeall=Alle
-radiobutton.rangeall.mnemonic=L
-radiobutton.rangepages=Seiten
-radiobutton.rangepages.mnemonic=E
-radiobutton.revlandscape=Umgekehrtes Querformat
-radiobutton.revlandscape.mnemonic=M
-radiobutton.revportrait=Umgekehrtes Hochformat
-radiobutton.revportrait.mnemonic=K
-radiobutton.tumble=Kalenderdruck
-radiobutton.tumble.mnemonic=K
+radiobutton.color=&Farbe
+radiobutton.draftq=Ent&wurf
+radiobutton.duplex=Du&plex
+radiobutton.highq=&Hoch
+radiobutton.landscape=&Querformat
+radiobutton.monochrome=&Monochrom
+radiobutton.normalq=&Normal
+radiobutton.oneside=&Einseitig
+radiobutton.portrait=&Hochformat
+radiobutton.rangeall=A&lle
+radiobutton.rangepages=S&eiten
+radiobutton.revlandscape=U&mgekehrtes Querformat
+radiobutton.revportrait=Umge&kehrtes Hochformat
+radiobutton.tumble=&Kalenderdruck
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=Darstellung
-tab.appearance.vkMnemonic=68
-tab.general=Allgemein
-tab.general.vkMnemonic=65
-tab.pagesetup=Seite einrichten
-tab.pagesetup.vkMnemonic=83
+tab.appearance=&Darstellung
+tab.general=&Allgemein
+tab.pagesetup=&Seite einrichten
#
error.pagerange=Ung\u00FCltiger Seitenbereich. Geben Sie die Werte erneut ein (Beispiel: 1-3,5,7-10)
error.destination=Ung\u00FCltiger Dateiname. Wiederholen Sie den Vorgang
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_es.properties b/jdk/src/share/classes/sun/print/resources/serviceui_es.properties
index ddca5ab9e01..f92f58e8e00 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_es.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_es.properties
@@ -14,15 +14,11 @@ border.margins=M\u00E1rgenes
button.cancel=Cancelar
button.ok=Aceptar
button.print=Imprimir
-button.properties=Propiedades...
-button.properties.mnemonic=R
+button.properties=P&ropiedades...
#
-checkbox.collate=Intercalar
-checkbox.collate.mnemonic=C
-checkbox.jobsheets=P\u00E1gina de R\u00F3tulo
-checkbox.jobsheets.mnemonic=E
-checkbox.printtofile=Imprimir en Archivo
-checkbox.printtofile.mnemonic=M
+checkbox.collate=Inter&calar
+checkbox.jobsheets=P\u00E1gina d&e R\u00F3tulo
+checkbox.printtofile=I&mprimir en Archivo
#
dialog.printtitle=Imprimir
dialog.pstitle=Preparar P\u00E1gina
@@ -33,70 +29,42 @@ dialog.noprintermsg=No se ha encontrado el servicio de impresi\u00F3n.
dialog.writeerror=No se puede escribir en el archivo:
#
label.info=Informaci\u00F3n:
-label.jobname=Nombre del Trabajo:
-label.jobname.mnemonic=T
-label.numcopies=N\u00FAmero de Copias:
-label.numcopies.mnemonic=O
-label.priority=Prioridad:
-label.priority.mnemonic=I
-label.psname=Nombre:
-label.psname.mnemonic=N
+label.jobname=Nombre del &Trabajo:
+label.numcopies=N\u00FAmer&o de Copias:
+label.priority=Pr&ioridad:
+label.psname=&Nombre:
label.pstype=Tipo:
label.rangeto=A
-label.size=Tama\u00F1o:
-label.size.mnemonic=T
+label.size=&Tama\u00F1o:
label.source=Origen:
-label.source.mnemonic=O
label.status=Estado:
-label.username=Usuario:
-label.username.mnemonic=S
+label.username=U&suario:
label.millimetres=(mm)
label.inches=(pulg.)
label.topmargin=superior
-label.topmargin.mnemonic=S
-label.bottommargin=inferior
-label.bottommargin.mnemonic=F
-label.leftmargin=izquierdo
-label.leftmargin.mnemonic=Q
-label.rightmargin=derecho
-label.rightmargin.mnemonic=E
+label.bottommargin=in&ferior
+label.leftmargin=iz&quierdo
+label.rightmargin=d&erecho
#
-radiobutton.color=Color
-radiobutton.color.mnemonic=C
-radiobutton.draftq=Borrador
-radiobutton.draftq.mnemonic=R
-radiobutton.duplex=D\u00FAplex
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=Alta
-radiobutton.highq.mnemonic=L
-radiobutton.landscape=Horizontal
-radiobutton.landscape.mnemonic=Z
-radiobutton.monochrome=Monocromo
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=Normal
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=Una Cara
-radiobutton.oneside.mnemonic=U
-radiobutton.portrait=Vertical
-radiobutton.portrait.mnemonic=V
-radiobutton.rangeall=Todo
-radiobutton.rangeall.mnemonic=T
-radiobutton.rangepages=P\u00E1ginas
-radiobutton.rangepages.mnemonic=G
-radiobutton.revlandscape=Horizontal Inverso
-radiobutton.revlandscape.mnemonic=H
-radiobutton.revportrait=Vertical Inverso
-radiobutton.revportrait.mnemonic=R
-radiobutton.tumble=Cambio de Cara
-radiobutton.tumble.mnemonic=B
+radiobutton.color=&Color
+radiobutton.draftq=Bo&rrador
+radiobutton.duplex=&D\u00FAplex
+radiobutton.highq=A<a
+radiobutton.landscape=Hori&zontal
+radiobutton.monochrome=&Monocromo
+radiobutton.normalq=&Normal
+radiobutton.oneside=&Una Cara
+radiobutton.portrait=&Vertical
+radiobutton.rangeall=&Todo
+radiobutton.rangepages=P\u00E1&ginas
+radiobutton.revlandscape=&Horizontal Inverso
+radiobutton.revportrait=Ve&rtical Inverso
+radiobutton.tumble=Cam&bio de Cara
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=Apariencia
-tab.appearance.vkMnemonic=65
-tab.general=General
-tab.general.vkMnemonic=71
-tab.pagesetup=Preparar P\u00E1gina
-tab.pagesetup.vkMnemonic=80
+tab.appearance=&Apariencia
+tab.general=&General
+tab.pagesetup=&Preparar P\u00E1gina
#
error.pagerange=Rango de p\u00E1ginas no v\u00E1lido; vuelva a introducir los valores (por ejemplo, 1-3, 5, 7-10)
error.destination=Nombre de archivo no v\u00E1lido; int\u00E9ntelo de nuevo
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties b/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties
index a74d5677454..2b7b160c75a 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_fr.properties
@@ -14,15 +14,11 @@ border.margins=Marges
button.cancel=Annuler
button.ok=OK
button.print=Imprimer
-button.properties=Propri\u00E9t\u00E9s...
-button.properties.mnemonic=R
+button.properties=P&ropri\u00E9t\u00E9s...
#
-checkbox.collate=Collationner
-checkbox.collate.mnemonic=C
-checkbox.jobsheets=Page de banni\u00E8re
-checkbox.jobsheets.mnemonic=B
-checkbox.printtofile=Imprimer dans un fichier
-checkbox.printtofile.mnemonic=F
+checkbox.collate=&Collationner
+checkbox.jobsheets=Page de &banni\u00E8re
+checkbox.printtofile=Imprimer dans un &fichier
#
dialog.printtitle=Imprimer
dialog.pstitle=Mise en page
@@ -33,70 +29,42 @@ dialog.noprintermsg=Service d'impression introuvable.
dialog.writeerror=Impossible d'\u00E9crire dans le fichier :
#
label.info=Infos :
-label.jobname=Nom du travail :
-label.jobname.mnemonic=T
-label.numcopies=Nombre de copies :
-label.numcopies.mnemonic=O
-label.priority=Priorit\u00E9 :
-label.priority.mnemonic=R
-label.psname=Nom :
-label.psname.mnemonic=N
+label.jobname=Nom du &travail :
+label.numcopies=N&ombre de copies :
+label.priority=P&riorit\u00E9 :
+label.psname=&Nom :
label.pstype=Type :
label.rangeto=A
-label.size=Taille :
-label.size.mnemonic=L
-label.source=Source :
-label.source.mnemonic=C
+label.size=Tai&lle :
+label.source=Sour&ce :
label.status=Statut :
-label.username=Nom utilisateur :
-label.username.mnemonic=O
+label.username=N&om utilisateur :
label.millimetres=(mm)
label.inches=(po)
-label.topmargin=haut
-label.topmargin.mnemonic=H
-label.bottommargin=bas
-label.bottommargin.mnemonic=B
-label.leftmargin=gauche
-label.leftmargin.mnemonic=G
-label.rightmargin=droite
-label.rightmargin.mnemonic=D
+label.topmargin=&haut
+label.bottommargin=&bas
+label.leftmargin=&gauche
+label.rightmargin=&droite
#
-radiobutton.color=Couleur
-radiobutton.color.mnemonic=C
-radiobutton.draftq=Brouillon
-radiobutton.draftq.mnemonic=L
-radiobutton.duplex=Duplex
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=Max.
-radiobutton.highq.mnemonic=X
-radiobutton.landscape=Paysage
-radiobutton.landscape.mnemonic=Y
-radiobutton.monochrome=Monochrome
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=Normal
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=Un c\u00F4t\u00E9
-radiobutton.oneside.mnemonic=U
-radiobutton.portrait=Portrait
-radiobutton.portrait.mnemonic=P
-radiobutton.rangeall=Tout
-radiobutton.rangeall.mnemonic=T
-radiobutton.rangepages=Pages
-radiobutton.rangepages.mnemonic=E
-radiobutton.revlandscape=Paysage invers\u00E9
-radiobutton.revlandscape.mnemonic=N
-radiobutton.revportrait=Portrait invers\u00E9
-radiobutton.revportrait.mnemonic=I
-radiobutton.tumble=T\u00EAte-b\u00EAche
-radiobutton.tumble.mnemonic=T
+radiobutton.color=&Couleur
+radiobutton.draftq=Broui&llon
+radiobutton.duplex=&Duplex
+radiobutton.highq=Ma&x.
+radiobutton.landscape=Pa&ysage
+radiobutton.monochrome=&Monochrome
+radiobutton.normalq=&Normal
+radiobutton.oneside=&Un c\u00F4t\u00E9
+radiobutton.portrait=&Portrait
+radiobutton.rangeall=&Tout
+radiobutton.rangepages=Pag&es
+radiobutton.revlandscape=Paysage i&nvers\u00E9
+radiobutton.revportrait=Portra&it invers\u00E9
+radiobutton.tumble=&T\u00EAte-b\u00EAche
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=Apparence
-tab.appearance.vkMnemonic=65
-tab.general=G\u00E9n\u00E9ral
-tab.general.vkMnemonic=71
-tab.pagesetup=Mise en page
-tab.pagesetup.vkMnemonic=83
+tab.appearance=&Apparence
+tab.general=&G\u00E9n\u00E9ral
+tab.pagesetup=Mi&se en page
#
error.pagerange=Plage de pages non valide. Sp\u00E9cifiez les valeurs de nouveau (ex. : 1-3,5,7-10)
error.destination=Nom de fichier non valide ; recommencez
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_it.properties b/jdk/src/share/classes/sun/print/resources/serviceui_it.properties
index e23da1c57ec..a824ef18223 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_it.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_it.properties
@@ -14,15 +14,11 @@ border.margins=Margini
button.cancel=Annulla
button.ok=OK
button.print=Stampa
-button.properties=Propriet\u00E0...
-button.properties.mnemonic=R
+button.properties=P&ropriet\u00E0...
#
-checkbox.collate=Fascicola
-checkbox.collate.mnemonic=L
-checkbox.jobsheets=Pagina banner
-checkbox.jobsheets.mnemonic=P
-checkbox.printtofile=Stampa su file
-checkbox.printtofile.mnemonic=F
+checkbox.collate=Fascico&la
+checkbox.jobsheets=&Pagina banner
+checkbox.printtofile=Stampa su &file
#
dialog.printtitle=Stampa
dialog.pstitle=Imposta pagina
@@ -33,70 +29,42 @@ dialog.noprintermsg=Nessun servizio di stampa trovato
dialog.writeerror=Impossibile scrivere nel file:
#
label.info=Informazioni:
-label.jobname=Nome job:
-label.jobname.mnemonic=J
-label.numcopies=Numero di copie:
-label.numcopies.mnemonic=O
-label.priority=Priorit\u00E0:
-label.priority.mnemonic=I
-label.psname=Nome:
-label.psname.mnemonic=N
+label.jobname=Nome &job:
+label.numcopies=Numer&o di copie:
+label.priority=Pr&iorit\u00E0:
+label.psname=&Nome:
label.pstype=Tipo:
label.rangeto=A
-label.size=Dimensioni:
-label.size.mnemonic=M
-label.source=Origine:
-label.source.mnemonic=R
+label.size=Di&mensioni:
+label.source=O&rigine:
label.status=Stato:
-label.username=Nome utente:
-label.username.mnemonic=U
+label.username=Nome &utente:
label.millimetres=(mm)
label.inches=(poll.)
-label.topmargin=superiore
-label.topmargin.mnemonic=P
-label.bottommargin=inferiore
-label.bottommargin.mnemonic=F
-label.leftmargin=sinistro
-label.leftmargin.mnemonic=T
-label.rightmargin=destro
-label.rightmargin.mnemonic=D
+label.topmargin=su&periore
+label.bottommargin=in&feriore
+label.leftmargin=sinis&tro
+label.rightmargin=&destro
#
-radiobutton.color=Colore
-radiobutton.color.mnemonic=C
-radiobutton.draftq=Bozza
-radiobutton.draftq.mnemonic=B
-radiobutton.duplex=Fronte retro
-radiobutton.duplex.mnemonic=R
-radiobutton.highq=Alta
-radiobutton.highq.mnemonic=L
-radiobutton.landscape=Orizzontale
-radiobutton.landscape.mnemonic=L
-radiobutton.monochrome=Monocromatico
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=Normale
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=Un lato
-radiobutton.oneside.mnemonic=O
-radiobutton.portrait=Verticale
-radiobutton.portrait.mnemonic=V
-radiobutton.rangeall=Tutto
-radiobutton.rangeall.mnemonic=U
-radiobutton.rangepages=Pagine
-radiobutton.rangepages.mnemonic=E
-radiobutton.revlandscape=Orizzontale capovolto
-radiobutton.revlandscape.mnemonic=N
-radiobutton.revportrait=Verticale capovolto
-radiobutton.revportrait.mnemonic=I
-radiobutton.tumble=Lato corto
-radiobutton.tumble.mnemonic=T
+radiobutton.color=&Colore
+radiobutton.draftq=&Bozza
+radiobutton.duplex=F&ronte retro
+radiobutton.highq=A<a
+radiobutton.landscape=Orizzonta&le
+radiobutton.monochrome=&Monocromatico
+radiobutton.normalq=&Normale
+radiobutton.oneside=Un lat&o
+radiobutton.portrait=&Verticale
+radiobutton.rangeall=T&utto
+radiobutton.rangepages=Pagin&e
+radiobutton.revlandscape=Orizzo&ntale capovolto
+radiobutton.revportrait=Vert&icale capovolto
+radiobutton.tumble=La&to corto
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=Aspetto
-tab.appearance.vkMnemonic=65
-tab.general=Generale
-tab.general.vkMnemonic=71
-tab.pagesetup=Imposta pagina
-tab.pagesetup.vkMnemonic=83
+tab.appearance=&Aspetto
+tab.general=&Generale
+tab.pagesetup=Impo&sta pagina
#
error.pagerange=Intervallo pagine non valido; immettere nuovamente i valori (ad es. 1-3,5,7-10)
error.destination=Nome file non valido; riprovare
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_ja.properties b/jdk/src/share/classes/sun/print/resources/serviceui_ja.properties
index d707013a300..a6dbd3802ce 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_ja.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_ja.properties
@@ -14,15 +14,11 @@ border.margins=\u30DE\u30FC\u30B8\u30F3
button.cancel=\u53D6\u6D88
button.ok=OK
button.print=\u5370\u5237
-button.properties=\u30D7\u30ED\u30D1\u30C6\u30A3(R)...
-button.properties.mnemonic=R
+button.properties=\u30D7\u30ED\u30D1\u30C6\u30A3(&R)...
#
-checkbox.collate=\u4E01\u5408\u3044(C)
-checkbox.collate.mnemonic=C
-checkbox.jobsheets=\u30D0\u30CA\u30FC\u30FB\u30DA\u30FC\u30B8(B)
-checkbox.jobsheets.mnemonic=B
-checkbox.printtofile=\u30D5\u30A1\u30A4\u30EB\u306B\u51FA\u529B(F)
-checkbox.printtofile.mnemonic=F
+checkbox.collate=\u4E01\u5408\u3044(&C)
+checkbox.jobsheets=\u30D0\u30CA\u30FC\u30FB\u30DA\u30FC\u30B8(&B)
+checkbox.printtofile=\u30D5\u30A1\u30A4\u30EB\u306B\u51FA\u529B(&F)
#
dialog.printtitle=\u5370\u5237
dialog.pstitle=\u30DA\u30FC\u30B8\u8A2D\u5B9A
@@ -33,70 +29,42 @@ dialog.noprintermsg=\u5370\u5237\u30B5\u30FC\u30D3\u30B9\u304C\u898B\u3064\u304B
dialog.writeerror=\u30D5\u30A1\u30A4\u30EB\u306B\u66F8\u304D\u8FBC\u3081\u307E\u305B\u3093:
#
label.info=\u60C5\u5831:
-label.jobname=\u30B8\u30E7\u30D6\u540D(J):
-label.jobname.mnemonic=J
-label.numcopies=\u5370\u5237\u90E8\u6570(O):
-label.numcopies.mnemonic=O
-label.priority=\u512A\u5148\u5EA6(R):
-label.priority.mnemonic=R
-label.psname=\u540D\u524D(N):
-label.psname.mnemonic=N
+label.jobname=\u30B8\u30E7\u30D6\u540D(&J):
+label.numcopies=\u5370\u5237\u90E8\u6570(&O):
+label.priority=\u512A\u5148\u5EA6(&R):
+label.psname=\u540D\u524D(&N):
label.pstype=\u30BF\u30A4\u30D7:
label.rangeto=\u5370\u5237\u7BC4\u56F2
-label.size=\u30B5\u30A4\u30BA(Z):
-label.size.mnemonic=Z
-label.source=\u30BD\u30FC\u30B9(C):
-label.source.mnemonic=C
+label.size=\u30B5\u30A4\u30BA(&Z):
+label.source=\u30BD\u30FC\u30B9(&C):
label.status=\u72B6\u614B:
-label.username=\u30E6\u30FC\u30B6\u30FC\u540D(U):
-label.username.mnemonic=U
+label.username=\u30E6\u30FC\u30B6\u30FC\u540D(&U):
label.millimetres=(mm)
label.inches=(in)
-label.topmargin=\u4E0A(T)
-label.topmargin.mnemonic=T
-label.bottommargin=\u4E0B(B)
-label.bottommargin.mnemonic=B
-label.leftmargin=\u5DE6(F)
-label.leftmargin.mnemonic=F
-label.rightmargin=\u53F3(R)
-label.rightmargin.mnemonic=R
+label.topmargin=\u4E0A(&T)
+label.bottommargin=\u4E0B(&B)
+label.leftmargin=\u5DE6(&F)
+label.rightmargin=\u53F3(&R)
#
-radiobutton.color=\u30AB\u30E9\u30FC(C)
-radiobutton.color.mnemonic=C
-radiobutton.draftq=\u30C9\u30E9\u30D5\u30C8(F)
-radiobutton.draftq.mnemonic=F
-radiobutton.duplex=\u4E21\u9762(D)
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=\u9AD8(H)
-radiobutton.highq.mnemonic=H
-radiobutton.landscape=\u6A2A(L)
-radiobutton.landscape.mnemonic=L
-radiobutton.monochrome=\u30E2\u30CE\u30AF\u30ED(M)
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=\u6A19\u6E96(N)
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=\u7247\u9762(O)
-radiobutton.oneside.mnemonic=O
-radiobutton.portrait=\u7E26(P)
-radiobutton.portrait.mnemonic=P
-radiobutton.rangeall=\u3059\u3079\u3066(L)
-radiobutton.rangeall.mnemonic=L
-radiobutton.rangepages=\u30DA\u30FC\u30B8(E)
-radiobutton.rangepages.mnemonic=E
-radiobutton.revlandscape=\u30E9\u30F3\u30C9\u30B9\u30B1\u30FC\u30D7(\u53CD\u8EE2)(N)
-radiobutton.revlandscape.mnemonic=N
-radiobutton.revportrait=\u30DD\u30FC\u30C8\u30EC\u30A4\u30C8(\u53CD\u8EE2)(I)
-radiobutton.revportrait.mnemonic=I
-radiobutton.tumble=\u53CD\u8EE2(T)
-radiobutton.tumble.mnemonic=T
+radiobutton.color=\u30AB\u30E9\u30FC(&C)
+radiobutton.draftq=\u30C9\u30E9\u30D5\u30C8(&F)
+radiobutton.duplex=\u4E21\u9762(&D)
+radiobutton.highq=\u9AD8(&H)
+radiobutton.landscape=\u6A2A(&L)
+radiobutton.monochrome=\u30E2\u30CE\u30AF\u30ED(&M)
+radiobutton.normalq=\u6A19\u6E96(&N)
+radiobutton.oneside=\u7247\u9762(&O)
+radiobutton.portrait=\u7E26(&P)
+radiobutton.rangeall=\u3059\u3079\u3066(&L)
+radiobutton.rangepages=\u30DA\u30FC\u30B8(&E)
+radiobutton.revlandscape=\u30E9\u30F3\u30C9\u30B9\u30B1\u30FC\u30D7(\u53CD\u8EE2)(&N)
+radiobutton.revportrait=\u30DD\u30FC\u30C8\u30EC\u30A4\u30C8(\u53CD\u8EE2)(&I)
+radiobutton.tumble=\u53CD\u8EE2(&T)
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=\u5916\u89B3(A)
-tab.appearance.vkMnemonic=65
-tab.general=\u4E00\u822C(G)
-tab.general.vkMnemonic=71
-tab.pagesetup=\u30DA\u30FC\u30B8\u8A2D\u5B9A(S)
-tab.pagesetup.vkMnemonic=83
+tab.appearance=\u5916\u89B3(&A)
+tab.general=\u4E00\u822C(&G)
+tab.pagesetup=\u30DA\u30FC\u30B8\u8A2D\u5B9A(&S)
#
error.pagerange=\u7121\u52B9\u306A\u30DA\u30FC\u30B8\u7BC4\u56F2\u3002\u5024\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044(\u4F8B\u30011-3,5,7-10)
error.destination=\u7121\u52B9\u306A\u30D5\u30A1\u30A4\u30EB\u540D\u3002\u30D5\u30A1\u30A4\u30EB\u540D\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_ko.properties b/jdk/src/share/classes/sun/print/resources/serviceui_ko.properties
index d4acf2fea3e..e0db7aa7098 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_ko.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_ko.properties
@@ -14,15 +14,11 @@ border.margins=\uC5EC\uBC31
button.cancel=\uCDE8\uC18C
button.ok=\uD655\uC778
button.print=\uC778\uC1C4
-button.properties=\uC18D\uC131(R)...
-button.properties.mnemonic=R
+button.properties=\uC18D\uC131(&R)...
#
-checkbox.collate=\uD55C \uBD80\uC529 \uC778\uC1C4(C)
-checkbox.collate.mnemonic=C
-checkbox.jobsheets=\uBC30\uB108 \uD398\uC774\uC9C0(B)
-checkbox.jobsheets.mnemonic=B
-checkbox.printtofile=\uD30C\uC77C\uB85C \uC778\uC1C4(F)
-checkbox.printtofile.mnemonic=F
+checkbox.collate=\uD55C \uBD80\uC529 \uC778\uC1C4(&C)
+checkbox.jobsheets=\uBC30\uB108 \uD398\uC774\uC9C0(&B)
+checkbox.printtofile=\uD30C\uC77C\uB85C \uC778\uC1C4(&F)
#
dialog.printtitle=\uC778\uC1C4
dialog.pstitle=\uD398\uC774\uC9C0 \uC124\uC815
@@ -33,70 +29,42 @@ dialog.noprintermsg=\uC778\uC1C4 \uC11C\uBE44\uC2A4\uB97C \uCC3E\uC744 \uC218 \u
dialog.writeerror=\uD30C\uC77C\uC5D0 \uC4F8 \uC218 \uC5C6\uC74C:
#
label.info=\uC815\uBCF4:
-label.jobname=\uC791\uC5C5 \uC774\uB984(J):
-label.jobname.mnemonic=J
-label.numcopies=\uB9E4\uC218(O):
-label.numcopies.mnemonic=O
-label.priority=\uC6B0\uC120\uC21C\uC704(R):
-label.priority.mnemonic=R
-label.psname=\uC774\uB984(N):
-label.psname.mnemonic=N
+label.jobname=\uC791\uC5C5 \uC774\uB984(&J):
+label.numcopies=\uB9E4\uC218(&O):
+label.priority=\uC6B0\uC120\uC21C\uC704(&R):
+label.psname=\uC774\uB984(&N):
label.pstype=\uC720\uD615:
label.rangeto=\uC885\uB8CC
-label.size=\uD06C\uAE30(Z):
-label.size.mnemonic=Z
-label.source=\uC18C\uC2A4(C):
-label.source.mnemonic=C
+label.size=\uD06C\uAE30(&Z):
+label.source=\uC18C\uC2A4(&C):
label.status=\uC0C1\uD0DC:
-label.username=\uC0AC\uC6A9\uC790 \uC774\uB984(U):
-label.username.mnemonic=U
+label.username=\uC0AC\uC6A9\uC790 \uC774\uB984(&U):
label.millimetres=(mm)
label.inches=(\uC778\uCE58)
-label.topmargin=\uC704\uCABD(T)
-label.topmargin.mnemonic=T
-label.bottommargin=\uC544\uB798\uCABD(B)
-label.bottommargin.mnemonic=B
-label.leftmargin=\uC67C\uCABD(F)
-label.leftmargin.mnemonic=F
-label.rightmargin=\uC624\uB978\uCABD(R)
-label.rightmargin.mnemonic=R
+label.topmargin=\uC704\uCABD(&T)
+label.bottommargin=\uC544\uB798\uCABD(&B)
+label.leftmargin=\uC67C\uCABD(&F)
+label.rightmargin=\uC624\uB978\uCABD(&R)
#
-radiobutton.color=\uC0C9\uC0C1(C)
-radiobutton.color.mnemonic=C
-radiobutton.draftq=\uCD08\uC548(F)
-radiobutton.draftq.mnemonic=F
-radiobutton.duplex=\uC591\uBA74(D)
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=\uB192\uC74C(H)
-radiobutton.highq.mnemonic=H
-radiobutton.landscape=\uAC00\uB85C(L)
-radiobutton.landscape.mnemonic=L
-radiobutton.monochrome=\uB2E8\uC0C9(M)
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=\uBCF4\uD1B5(N)
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=\uB2E8\uBA74(O)
-radiobutton.oneside.mnemonic=O
-radiobutton.portrait=\uC138\uB85C(P)
-radiobutton.portrait.mnemonic=P
-radiobutton.rangeall=\uC804\uCCB4(L)
-radiobutton.rangeall.mnemonic=L
-radiobutton.rangepages=\uD398\uC774\uC9C0(E)
-radiobutton.rangepages.mnemonic=E
-radiobutton.revlandscape=\uAC00\uB85C \uBC18\uC804(N)
-radiobutton.revlandscape.mnemonic=N
-radiobutton.revportrait=\uC138\uB85C \uBC18\uC804(I)
-radiobutton.revportrait.mnemonic=I
-radiobutton.tumble=\uD68C\uC804\uC2DD(T)
-radiobutton.tumble.mnemonic=T
+radiobutton.color=\uC0C9\uC0C1(&C)
+radiobutton.draftq=\uCD08\uC548(&F)
+radiobutton.duplex=\uC591\uBA74(&D)
+radiobutton.highq=\uB192\uC74C(&H)
+radiobutton.landscape=\uAC00\uB85C(&L)
+radiobutton.monochrome=\uB2E8\uC0C9(&M)
+radiobutton.normalq=\uBCF4\uD1B5(&N)
+radiobutton.oneside=\uB2E8\uBA74(&O)
+radiobutton.portrait=\uC138\uB85C(&P)
+radiobutton.rangeall=\uC804\uCCB4(&L)
+radiobutton.rangepages=\uD398\uC774\uC9C0(&E)
+radiobutton.revlandscape=\uAC00\uB85C \uBC18\uC804(&N)
+radiobutton.revportrait=\uC138\uB85C \uBC18\uC804(&I)
+radiobutton.tumble=\uD68C\uC804\uC2DD(&T)
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=\uBAA8\uC591(A)
-tab.appearance.vkMnemonic=65
-tab.general=\uC77C\uBC18 \uC0AC\uD56D(G)
-tab.general.vkMnemonic=71
-tab.pagesetup=\uD398\uC774\uC9C0 \uC124\uC815(S)
-tab.pagesetup.vkMnemonic=83
+tab.appearance=\uBAA8\uC591(&A)
+tab.general=\uC77C\uBC18 \uC0AC\uD56D(&G)
+tab.pagesetup=\uD398\uC774\uC9C0 \uC124\uC815(&S)
#
error.pagerange=\uBD80\uC801\uD569\uD55C \uD398\uC774\uC9C0 \uBC94\uC704: \uAC12\uC744 \uB2E4\uC2DC \uC785\uB825\uD558\uC2ED\uC2DC\uC624(\uC608: 1-3,5,7-10).
error.destination=\uBD80\uC801\uD569\uD55C \uD30C\uC77C \uC774\uB984: \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC2ED\uC2DC\uC624.
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties b/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties
index d82178f3a4e..fbd00aa9569 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_pt_BR.properties
@@ -14,15 +14,11 @@ border.margins=Margens
button.cancel=Cancelar
button.ok=OK
button.print=Imprimir
-button.properties=Propriedades...
-button.properties.mnemonic=D
+button.properties=Proprie&dades...
#
-checkbox.collate=Agrupar
-checkbox.collate.mnemonic=R
-checkbox.jobsheets=P\u00E1gina com Banner
-checkbox.jobsheets.mnemonic=B
-checkbox.printtofile=Imprimir em Arquivo
-checkbox.printtofile.mnemonic=I
+checkbox.collate=Ag&rupar
+checkbox.jobsheets=P\u00E1gina com &Banner
+checkbox.printtofile=&Imprimir em Arquivo
#
dialog.printtitle=Imprimir
dialog.pstitle=Configura\u00E7\u00E3o da P\u00E1gina
@@ -33,70 +29,42 @@ dialog.noprintermsg=Nenhum servi\u00E7o de impress\u00E3o encontrado.
dialog.writeerror=N\u00E3o \u00E9 poss\u00EDvel gravar no arquivo:
#
label.info=Informa\u00E7\u00F5es:
-label.jobname=Nome do Job:
-label.jobname.mnemonic=J
-label.numcopies=N\u00FAmero de c\u00F3pias:
-label.numcopies.mnemonic=O
-label.priority=Prioridade:
-label.priority.mnemonic=P
-label.psname=Nome:
-label.psname.mnemonic=N
+label.jobname=Nome do &Job:
+label.numcopies=N\u00FAmer&o de c\u00F3pias:
+label.priority=&Prioridade:
+label.psname=&Nome:
label.pstype=Tipo:
label.rangeto=At\u00E9
-label.size=Tamanho:
-label.size.mnemonic=M
-label.source=Origem:
-label.source.mnemonic=O
+label.size=Ta&manho:
+label.source=&Origem:
label.status=Status:
-label.username=Nome do Usu\u00E1rio:
-label.username.mnemonic=U
+label.username=Nome do &Usu\u00E1rio:
label.millimetres=(mm)
label.inches=(pol)
-label.topmargin=superior
-label.topmargin.mnemonic=S
-label.bottommargin=inferior
-label.bottommargin.mnemonic=I
-label.leftmargin=esquerda:
-label.leftmargin.mnemonic=Q
-label.rightmargin=direita
-label.rightmargin.mnemonic=D
+label.topmargin=&superior
+label.bottommargin=&inferior
+label.leftmargin=es&querda:
+label.rightmargin=&direita
#
-radiobutton.color=Cor
-radiobutton.color.mnemonic=O
-radiobutton.draftq=Rascunho
-radiobutton.draftq.mnemonic=R
-radiobutton.duplex=Duplex
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=Alta
-radiobutton.highq.mnemonic=T
-radiobutton.landscape=Paisagem
-radiobutton.landscape.mnemonic=P
-radiobutton.monochrome=Monocrom\u00E1tico
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=Normal
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=Um Lado
-radiobutton.oneside.mnemonic=L
-radiobutton.portrait=Retrato
-radiobutton.portrait.mnemonic=R
-radiobutton.rangeall=Tudo
-radiobutton.rangeall.mnemonic=U
-radiobutton.rangepages=P\u00E1ginas
-radiobutton.rangepages.mnemonic=P
-radiobutton.revlandscape=Paisagem Invertida
-radiobutton.revlandscape.mnemonic=N
-radiobutton.revportrait=Retrato Invertido
-radiobutton.revportrait.mnemonic=E
-radiobutton.tumble=Virar
-radiobutton.tumble.mnemonic=V
+radiobutton.color=C&or
+radiobutton.draftq=&Rascunho
+radiobutton.duplex=&Duplex
+radiobutton.highq=Al&ta
+radiobutton.landscape=&Paisagem
+radiobutton.monochrome=&Monocrom\u00E1tico
+radiobutton.normalq=&Normal
+radiobutton.oneside=Um &Lado
+radiobutton.portrait=&Retrato
+radiobutton.rangeall=T&udo
+radiobutton.rangepages=&P\u00E1ginas
+radiobutton.revlandscape=Paisagem I&nvertida
+radiobutton.revportrait=R&etrato Invertido
+radiobutton.tumble=&Virar
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=Apar\u00EAncia
-tab.appearance.vkMnemonic=65
-tab.general=Geral
-tab.general.vkMnemonic=71
-tab.pagesetup=Configura\u00E7\u00E3o de P\u00E1gina
-tab.pagesetup.vkMnemonic=67
+tab.appearance=&Apar\u00EAncia
+tab.general=&Geral
+tab.pagesetup=&Configura\u00E7\u00E3o de P\u00E1gina
#
error.pagerange=Faixa de p\u00E1ginas inv\u00E1lida; insira novamente os valores (por exemplo, 1-3,5,7-10)
error.destination=Nome de arquivo inv\u00E1lido; tente novamente
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties b/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties
index 859c0494610..35ae3741fdc 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_sv.properties
@@ -14,15 +14,11 @@ border.margins=Marginaler
button.cancel=Avbryt
button.ok=OK
button.print=Skriv ut
-button.properties=Egenskaper...
-button.properties.mnemonic=R
+button.properties=Egenskape&r...
#
-checkbox.collate=Sortera
-checkbox.collate.mnemonic=T
-checkbox.jobsheets=F\u00F6rs\u00E4ttsblad
-checkbox.jobsheets.mnemonic=R
-checkbox.printtofile=Skriv ut till fil
-checkbox.printtofile.mnemonic=K
+checkbox.collate=Sor&tera
+checkbox.jobsheets=F\u00F6&rs\u00E4ttsblad
+checkbox.printtofile=S&kriv ut till fil
#
dialog.printtitle=Skriv ut
dialog.pstitle=Utskriftsformat
@@ -33,70 +29,42 @@ dialog.noprintermsg=Hittade ingen utskriftstj\u00E4nst.
dialog.writeerror=Kan inte skriva till filen:
#
label.info=Information:
-label.jobname=Utskrift:
-label.jobname.mnemonic=U
-label.numcopies=Antal exemplar:
-label.numcopies.mnemonic=E
-label.priority=Prioritet:
-label.priority.mnemonic=R
-label.psname=Namn:
-label.psname.mnemonic=N
+label.jobname=&Utskrift:
+label.numcopies=Antal &exemplar:
+label.priority=P&rioritet:
+label.psname=&Namn:
label.pstype=Typ:
label.rangeto=Till
-label.size=Storlek:
-label.size.mnemonic=O
-label.source=K\u00E4lla:
-label.source.mnemonic=K
+label.size=St&orlek:
+label.source=&K\u00E4lla:
label.status=Status:
-label.username=Anv\u00E4ndarnamn:
-label.username.mnemonic=N
+label.username=A&nv\u00E4ndarnamn:
label.millimetres=(mm)
label.inches=(tum)
-label.topmargin=\u00F6verkant
-label.topmargin.mnemonic=R
-label.bottommargin=nederkant
-label.bottommargin.mnemonic=N
-label.leftmargin=v\u00E4nster
-label.leftmargin.mnemonic=V
-label.rightmargin=h\u00F6ger
-label.rightmargin.mnemonic=H
+label.topmargin=\u00F6ve&rkant
+label.bottommargin=&nederkant
+label.leftmargin=&v\u00E4nster
+label.rightmargin=&h\u00F6ger
#
-radiobutton.color=F\u00E4rg
-radiobutton.color.mnemonic=G
-radiobutton.draftq=Utkast
-radiobutton.draftq.mnemonic=K
-radiobutton.duplex=Dubbelsidig
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=H\u00F6g
-radiobutton.highq.mnemonic=H
-radiobutton.landscape=Liggande
-radiobutton.landscape.mnemonic=L
-radiobutton.monochrome=Monokrom
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=Normal
-radiobutton.normalq.mnemonic=O
-radiobutton.oneside=Ensidig
-radiobutton.oneside.mnemonic=E
-radiobutton.portrait=St\u00E5ende
-radiobutton.portrait.mnemonic=D
-radiobutton.rangeall=Alla
-radiobutton.rangeall.mnemonic=L
-radiobutton.rangepages=Sidor
-radiobutton.rangepages.mnemonic=D
-radiobutton.revlandscape=Omv\u00E4nt liggande
-radiobutton.revlandscape.mnemonic=G
-radiobutton.revportrait=Omv\u00E4nt st\u00E5ende
-radiobutton.revportrait.mnemonic=M
-radiobutton.tumble=V\u00E4nd
-radiobutton.tumble.mnemonic=V
+radiobutton.color=F\u00E4r&g
+radiobutton.draftq=Ut&kast
+radiobutton.duplex=&Dubbelsidig
+radiobutton.highq=&H\u00F6g
+radiobutton.landscape=&Liggande
+radiobutton.monochrome=&Monokrom
+radiobutton.normalq=N&ormal
+radiobutton.oneside=&Ensidig
+radiobutton.portrait=St\u00E5en&de
+radiobutton.rangeall=A&lla
+radiobutton.rangepages=Si&dor
+radiobutton.revlandscape=Omv\u00E4nt li&ggande
+radiobutton.revportrait=O&mv\u00E4nt st\u00E5ende
+radiobutton.tumble=&V\u00E4nd
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=Format
-tab.appearance.vkMnemonic=70
-tab.general=Allm\u00E4nt
-tab.general.vkMnemonic=65
-tab.pagesetup=Utskriftsformat
-tab.pagesetup.vkMnemonic=83
+tab.appearance=&Format
+tab.general=&Allm\u00E4nt
+tab.pagesetup=Ut&skriftsformat
#
error.pagerange=Ogiltigt sidintervall. Skriv in v\u00E4rdena igen (t ex 1-3,5,7-10)
error.destination=Ogiltigt filnamn. F\u00F6rs\u00F6k igen.
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_zh_CN.properties b/jdk/src/share/classes/sun/print/resources/serviceui_zh_CN.properties
index 98824cc9ae2..2d2f91b4219 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_zh_CN.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_zh_CN.properties
@@ -14,15 +14,11 @@ border.margins=\u8FB9\u8DDD
button.cancel=\u53D6\u6D88
button.ok=\u786E\u5B9A
button.print=\u6253\u5370
-button.properties=\u5C5E\u6027(R)...
-button.properties.mnemonic=R
+button.properties=\u5C5E\u6027(&R)...
#
-checkbox.collate=\u9010\u4EFD\u6253\u5370(C)
-checkbox.collate.mnemonic=C
-checkbox.jobsheets=\u6807\u5E1C\u9875(B)
-checkbox.jobsheets.mnemonic=B
-checkbox.printtofile=\u6253\u5370\u5230\u6587\u4EF6(F)
-checkbox.printtofile.mnemonic=F
+checkbox.collate=\u9010\u4EFD\u6253\u5370(&C)
+checkbox.jobsheets=\u6807\u5E1C\u9875(&B)
+checkbox.printtofile=\u6253\u5370\u5230\u6587\u4EF6(&F)
#
dialog.printtitle=\u6253\u5370
dialog.pstitle=\u9875\u9762\u8BBE\u7F6E
@@ -33,70 +29,42 @@ dialog.noprintermsg=\u627E\u4E0D\u5230\u6253\u5370\u670D\u52A1\u3002
dialog.writeerror=\u65E0\u6CD5\u5199\u5165\u6587\u4EF6:
#
label.info=\u4FE1\u606F:
-label.jobname=\u4F5C\u4E1A\u540D(J):
-label.jobname.mnemonic=J
-label.numcopies=\u6253\u5370\u4EFD\u6570(O):
-label.numcopies.mnemonic=O
-label.priority=\u4F18\u5148\u7EA7(R):
-label.priority.mnemonic=R
-label.psname=\u540D\u79F0(N):
-label.psname.mnemonic=N
+label.jobname=\u4F5C\u4E1A\u540D(&J):
+label.numcopies=\u6253\u5370\u4EFD\u6570(&O):
+label.priority=\u4F18\u5148\u7EA7(&R):
+label.psname=\u540D\u79F0(&N):
label.pstype=\u7C7B\u578B:
label.rangeto=\u81F3
-label.size=\u5927\u5C0F(Z):
-label.size.mnemonic=Z
-label.source=\u6765\u6E90(C):
-label.source.mnemonic=C
+label.size=\u5927\u5C0F(&Z):
+label.source=\u6765\u6E90(&C):
label.status=\u72B6\u6001:
-label.username=\u7528\u6237\u540D(U):
-label.username.mnemonic=U
+label.username=\u7528\u6237\u540D(&U):
label.millimetres=(\u6BEB\u7C73)
label.inches=(\u82F1\u5BF8)
-label.topmargin=\u4E0A\u8FB9\u8DDD(T)
-label.topmargin.mnemonic=T
-label.bottommargin=\u4E0B\u8FB9\u8DDD(B)
-label.bottommargin.mnemonic=B
-label.leftmargin=\u5DE6\u8FB9\u8DDD(F)
-label.leftmargin.mnemonic=F
-label.rightmargin=\u53F3\u8FB9\u8DDD(R)
-label.rightmargin.mnemonic=R
+label.topmargin=\u4E0A\u8FB9\u8DDD(&T)
+label.bottommargin=\u4E0B\u8FB9\u8DDD(&B)
+label.leftmargin=\u5DE6\u8FB9\u8DDD(&F)
+label.rightmargin=\u53F3\u8FB9\u8DDD(&R)
#
-radiobutton.color=\u989C\u8272(C)
-radiobutton.color.mnemonic=C
-radiobutton.draftq=\u8349\u56FE(F)
-radiobutton.draftq.mnemonic=F
-radiobutton.duplex=\u53CC\u9762\u6253\u5370(D)
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=\u9AD8(H)
-radiobutton.highq.mnemonic=H
-radiobutton.landscape=\u6A2A\u5411(L)
-radiobutton.landscape.mnemonic=L
-radiobutton.monochrome=\u5355\u8272(M)
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=\u6B63\u5E38(N)
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=\u5355\u9762(O)
-radiobutton.oneside.mnemonic=O
-radiobutton.portrait=\u7EB5\u5411(P)
-radiobutton.portrait.mnemonic=P
-radiobutton.rangeall=\u5168\u90E8(L)
-radiobutton.rangeall.mnemonic=L
-radiobutton.rangepages=\u9875\u7801\u8303\u56F4(E)
-radiobutton.rangepages.mnemonic=E
-radiobutton.revlandscape=\u6A2A\u5411\u53CD\u9762\u6253\u5370(N)
-radiobutton.revlandscape.mnemonic=N
-radiobutton.revportrait=\u7EB5\u5411\u53CD\u9762\u6253\u5370(I)
-radiobutton.revportrait.mnemonic=I
-radiobutton.tumble=\u7FFB\u8F6C(T)
-radiobutton.tumble.mnemonic=T
+radiobutton.color=\u989C\u8272(&C)
+radiobutton.draftq=\u8349\u56FE(&F)
+radiobutton.duplex=\u53CC\u9762\u6253\u5370(&D)
+radiobutton.highq=\u9AD8(&H)
+radiobutton.landscape=\u6A2A\u5411(&L)
+radiobutton.monochrome=\u5355\u8272(&M)
+radiobutton.normalq=\u6B63\u5E38(&N)
+radiobutton.oneside=\u5355\u9762(&O)
+radiobutton.portrait=\u7EB5\u5411(&P)
+radiobutton.rangeall=\u5168\u90E8(&L)
+radiobutton.rangepages=\u9875\u7801\u8303\u56F4(&E)
+radiobutton.revlandscape=\u6A2A\u5411\u53CD\u9762\u6253\u5370(&N)
+radiobutton.revportrait=\u7EB5\u5411\u53CD\u9762\u6253\u5370(&I)
+radiobutton.tumble=\u7FFB\u8F6C(&T)
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=\u5916\u89C2(A)
-tab.appearance.vkMnemonic=65
-tab.general=\u4E00\u822C\u4FE1\u606F(G)
-tab.general.vkMnemonic=71
-tab.pagesetup=\u9875\u9762\u8BBE\u7F6E(S)
-tab.pagesetup.vkMnemonic=83
+tab.appearance=\u5916\u89C2(&A)
+tab.general=\u4E00\u822C\u4FE1\u606F(&G)
+tab.pagesetup=\u9875\u9762\u8BBE\u7F6E(&S)
#
error.pagerange=\u65E0\u6548\u7684\u9875\u9762\u8303\u56F4; \u8BF7\u91CD\u65B0\u8F93\u5165\u6570\u503C (\u4F8B\u5982 1-3,5,7-10)
error.destination=\u65E0\u6548\u7684\u6587\u4EF6\u540D; \u8BF7\u91CD\u8BD5
diff --git a/jdk/src/share/classes/sun/print/resources/serviceui_zh_TW.properties b/jdk/src/share/classes/sun/print/resources/serviceui_zh_TW.properties
index d6a796325ea..41ce68ca516 100644
--- a/jdk/src/share/classes/sun/print/resources/serviceui_zh_TW.properties
+++ b/jdk/src/share/classes/sun/print/resources/serviceui_zh_TW.properties
@@ -14,15 +14,11 @@ border.margins=\u908A\u8DDD
button.cancel=\u53D6\u6D88
button.ok=\u78BA\u5B9A
button.print=\u5217\u5370
-button.properties=\u7279\u6027(R)...
-button.properties.mnemonic=R
+button.properties=\u7279\u6027(&R)...
#
-checkbox.collate=\u7406\u5E8F(C)
-checkbox.collate.mnemonic=C
-checkbox.jobsheets=\u6A19\u984C\u9801(B)
-checkbox.jobsheets.mnemonic=B
-checkbox.printtofile=\u5217\u5370\u81F3\u6A94\u6848(F)
-checkbox.printtofile.mnemonic=F
+checkbox.collate=\u7406\u5E8F(&C)
+checkbox.jobsheets=\u6A19\u984C\u9801(&B)
+checkbox.printtofile=\u5217\u5370\u81F3\u6A94\u6848(&F)
#
dialog.printtitle=\u5217\u5370
dialog.pstitle=\u9801\u9762\u8A2D\u5B9A
@@ -33,70 +29,42 @@ dialog.noprintermsg=\u627E\u4E0D\u5230\u5217\u5370\u670D\u52D9\u3002
dialog.writeerror=\u7121\u6CD5\u5BEB\u5165\u81F3\u6A94\u6848:
#
label.info=\u8CC7\u8A0A:
-label.jobname=\u5DE5\u4F5C\u540D\u7A31(J):
-label.jobname.mnemonic=J
-label.numcopies=\u5217\u5370\u4EFD\u6578(O):
-label.numcopies.mnemonic=O
-label.priority=\u512A\u5148\u6B0A(R):
-label.priority.mnemonic=R
-label.psname=\u540D\u7A31(N):
-label.psname.mnemonic=N
+label.jobname=\u5DE5\u4F5C\u540D\u7A31(&J):
+label.numcopies=\u5217\u5370\u4EFD\u6578(&O):
+label.priority=\u512A\u5148\u6B0A(&R):
+label.psname=\u540D\u7A31(&N):
label.pstype=\u985E\u578B:
label.rangeto=\u81F3
-label.size=\u5927\u5C0F(Z):
-label.size.mnemonic=Z
-label.source=\u4F86\u6E90(C):
-label.source.mnemonic=C
+label.size=\u5927\u5C0F(&Z):
+label.source=\u4F86\u6E90(&C):
label.status=\u72C0\u614B:
-label.username=\u4F7F\u7528\u8005\u540D\u7A31(U):
-label.username.mnemonic=U
+label.username=\u4F7F\u7528\u8005\u540D\u7A31(&U):
label.millimetres=(mm)
label.inches=(in)
-label.topmargin=\u9802\u7AEF\u908A\u8DDD(T)
-label.topmargin.mnemonic=T
-label.bottommargin=\u5E95\u90E8\u908A\u8DDD(B)
-label.bottommargin.mnemonic=B
-label.leftmargin=\u5DE6\u908A\u8DDD(F)
-label.leftmargin.mnemonic=F
-label.rightmargin=\u53F3\u908A\u8DDD(R)
-label.rightmargin.mnemonic=R
+label.topmargin=\u9802\u7AEF\u908A\u8DDD(&T)
+label.bottommargin=\u5E95\u90E8\u908A\u8DDD(&B)
+label.leftmargin=\u5DE6\u908A\u8DDD(&F)
+label.rightmargin=\u53F3\u908A\u8DDD(&R)
#
-radiobutton.color=\u984F\u8272(C)
-radiobutton.color.mnemonic=C
-radiobutton.draftq=\u8349\u7A3F(F)
-radiobutton.draftq.mnemonic=F
-radiobutton.duplex=\u96D9\u9762\u5217\u5370(D)
-radiobutton.duplex.mnemonic=D
-radiobutton.highq=\u9AD8(H)
-radiobutton.highq.mnemonic=H
-radiobutton.landscape=\u6A6B\u5411(L)
-radiobutton.landscape.mnemonic=L
-radiobutton.monochrome=\u55AE\u8272(M)
-radiobutton.monochrome.mnemonic=M
-radiobutton.normalq=\u6B63\u5E38(N)
-radiobutton.normalq.mnemonic=N
-radiobutton.oneside=\u55AE\u9762(O)
-radiobutton.oneside.mnemonic=O
-radiobutton.portrait=\u76F4\u5411(P)
-radiobutton.portrait.mnemonic=P
-radiobutton.rangeall=\u5168\u90E8(L)
-radiobutton.rangeall.mnemonic=L
-radiobutton.rangepages=\u9801\u9762(E)
-radiobutton.rangepages.mnemonic=E
-radiobutton.revlandscape=\u53CD\u5411\u6A6B\u5370(N)
-radiobutton.revlandscape.mnemonic=N
-radiobutton.revportrait=\u53CD\u5411\u76F4\u5370(I)
-radiobutton.revportrait.mnemonic=I
-radiobutton.tumble=\u7FFB\u8F49(T)
-radiobutton.tumble.mnemonic=T
+radiobutton.color=\u984F\u8272(&C)
+radiobutton.draftq=\u8349\u7A3F(&F)
+radiobutton.duplex=\u96D9\u9762\u5217\u5370(&D)
+radiobutton.highq=\u9AD8(&H)
+radiobutton.landscape=\u6A6B\u5411(&L)
+radiobutton.monochrome=\u55AE\u8272(&M)
+radiobutton.normalq=\u6B63\u5E38(&N)
+radiobutton.oneside=\u55AE\u9762(&O)
+radiobutton.portrait=\u76F4\u5411(&P)
+radiobutton.rangeall=\u5168\u90E8(&L)
+radiobutton.rangepages=\u9801\u9762(&E)
+radiobutton.revlandscape=\u53CD\u5411\u6A6B\u5370(&N)
+radiobutton.revportrait=\u53CD\u5411\u76F4\u5370(&I)
+radiobutton.tumble=\u7FFB\u8F49(&T)
# The vkMnemonics correspond with the constants defined in KeyEvent, eg
# 65 = KeyEvent.VK_A
-tab.appearance=\u5916\u89C0(A)
-tab.appearance.vkMnemonic=65
-tab.general=\u4E00\u822C(G)
-tab.general.vkMnemonic=71
-tab.pagesetup=\u9801\u9762\u8A2D\u5B9A(S)
-tab.pagesetup.vkMnemonic=83
+tab.appearance=\u5916\u89C0(&A)
+tab.general=\u4E00\u822C(&G)
+tab.pagesetup=\u9801\u9762\u8A2D\u5B9A(&S)
#
error.pagerange=\u7121\u6548\u7684\u9801\u9762\u7BC4\u570D; \u8ACB\u91CD\u65B0\u8F38\u5165\u6578\u503C (\u4F8B\u5982 1-3,5,7-10)
error.destination=\u7121\u6548\u7684\u6A94\u540D; \u8ACB\u518D\u8A66\u4E00\u6B21
diff --git a/jdk/src/share/classes/sun/security/action/LoadLibraryAction.java b/jdk/src/share/classes/sun/security/action/LoadLibraryAction.java
deleted file mode 100644
index c3510151438..00000000000
--- a/jdk/src/share/classes/sun/security/action/LoadLibraryAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.action;
-
-/**
- * A convenience class for loading a system library as a privileged action.
- *
- * An instance of this class can be used as the argument of
- * AccessController.doPrivileged
.
- *
- *
The following code attempts to load the system library named
- * "lib"
as a privileged action:
- *
- *
- * java.security.AccessController.doPrivileged(new LoadLibraryAction("lib"));
- *
- *
- * @author Roland Schemers
- * @see java.security.PrivilegedAction
- * @see java.security.AccessController
- * @since 1.2
- */
-
-public class LoadLibraryAction implements java.security.PrivilegedAction {
- private String theLib;
-
- /**
- * Constructor that takes the name of the system library that needs to be
- * loaded.
- *
- * The manner in which a library name is mapped to the
- * actual system library is system dependent.
- *
- * @param theLib the name of the library.
- */
- public LoadLibraryAction(String theLib) {
- this.theLib = theLib;
- }
-
- /**
- * Loads the system library whose name was specified in the constructor.
- */
- public Void run() {
- System.loadLibrary(theLib);
- return null;
- }
-}
diff --git a/jdk/src/share/classes/sun/security/ec/ECDSASignature.java b/jdk/src/share/classes/sun/security/ec/ECDSASignature.java
index 0d68225c9b0..64a36b1c894 100644
--- a/jdk/src/share/classes/sun/security/ec/ECDSASignature.java
+++ b/jdk/src/share/classes/sun/security/ec/ECDSASignature.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -41,6 +41,7 @@ import sun.security.util.*;
*
* . "NONEwithECDSA"
* . "SHA1withECDSA"
+ * . "SHA224withECDSA"
* . "SHA256withECDSA"
* . "SHA384withECDSA"
* . "SHA512withECDSA"
@@ -162,6 +163,13 @@ abstract class ECDSASignature extends SignatureSpi {
}
}
+ // Nested class for SHA224withECDSA signatures
+ public static final class SHA224 extends ECDSASignature {
+ public SHA224() {
+ super("SHA-224");
+ }
+ }
+
// Nested class for SHA256withECDSA signatures
public static final class SHA256 extends ECDSASignature {
public SHA256() {
diff --git a/jdk/src/share/classes/sun/security/ec/SunECEntries.java b/jdk/src/share/classes/sun/security/ec/SunECEntries.java
index 91c56697339..6d2cb65a77a 100644
--- a/jdk/src/share/classes/sun/security/ec/SunECEntries.java
+++ b/jdk/src/share/classes/sun/security/ec/SunECEntries.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -133,17 +133,31 @@ final class SunECEntries {
"sun.security.ec.ECDSASignature$Raw");
map.put("Signature.SHA1withECDSA",
"sun.security.ec.ECDSASignature$SHA1");
+ map.put("Signature.SHA224withECDSA",
+ "sun.security.ec.ECDSASignature$SHA224");
+ map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.1", "SHA224withECDSA");
+ map.put("Alg.Alias.Signature.1.2.840.10045.4.3.1", "SHA224withECDSA");
+
map.put("Signature.SHA256withECDSA",
"sun.security.ec.ECDSASignature$SHA256");
+ map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.2", "SHA256withECDSA");
+ map.put("Alg.Alias.Signature.1.2.840.10045.4.3.2", "SHA256withECDSA");
+
map.put("Signature.SHA384withECDSA",
"sun.security.ec.ECDSASignature$SHA384");
+ map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.3", "SHA384withECDSA");
+ map.put("Alg.Alias.Signature.1.2.840.10045.4.3.3", "SHA384withECDSA");
+
map.put("Signature.SHA512withECDSA",
"sun.security.ec.ECDSASignature$SHA512");
+ map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.4", "SHA512withECDSA");
+ map.put("Alg.Alias.Signature.1.2.840.10045.4.3.4", "SHA512withECDSA");
String ecKeyClasses = "java.security.interfaces.ECPublicKey" +
"|java.security.interfaces.ECPrivateKey";
map.put("Signature.NONEwithECDSA SupportedKeyClasses", ecKeyClasses);
map.put("Signature.SHA1withECDSA SupportedKeyClasses", ecKeyClasses);
+ map.put("Signature.SHA224withECDSA SupportedKeyClasses", ecKeyClasses);
map.put("Signature.SHA256withECDSA SupportedKeyClasses", ecKeyClasses);
map.put("Signature.SHA384withECDSA SupportedKeyClasses", ecKeyClasses);
map.put("Signature.SHA512withECDSA SupportedKeyClasses", ecKeyClasses);
@@ -152,6 +166,7 @@ final class SunECEntries {
map.put("Signature.NONEwithECDSA ImplementedIn", "Software");
map.put("Signature.SHA1withECDSA ImplementedIn", "Software");
+ map.put("Signature.SHA224withECDSA ImplementedIn", "Software");
map.put("Signature.SHA256withECDSA ImplementedIn", "Software");
map.put("Signature.SHA384withECDSA ImplementedIn", "Software");
map.put("Signature.SHA512withECDSA ImplementedIn", "Software");
diff --git a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
index a6280121420..1c869ade651 100644
--- a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
+++ b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -90,7 +90,7 @@ public final class SunNativeProvider extends Provider {
"libgssapi_krb5.so",
"libgssapi_krb5.so.2",
};
- } else if (osname.startsWith("Mac OS X")) {
+ } else if (osname.contains("OS X")) {
gssLibs = new String[]{
"/usr/lib/sasl2/libgssapiv2.2.so",
};
diff --git a/jdk/src/share/classes/sun/security/krb5/Config.java b/jdk/src/share/classes/sun/security/krb5/Config.java
index 8c0cc628029..61a3c7c129f 100644
--- a/jdk/src/share/classes/sun/security/krb5/Config.java
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -737,7 +737,7 @@ public class Config {
}
} else if (osname.startsWith("SunOS")) {
name = "/etc/krb5/krb5.conf";
- } else if (osname.startsWith("Mac")) {
+ } else if (osname.contains("OS X")) {
if (isMacosLionOrBetter()) return "";
name = findMacosConfigFile();
} else {
diff --git a/jdk/src/share/classes/sun/security/krb5/Credentials.java b/jdk/src/share/classes/sun/security/krb5/Credentials.java
index 3414e2f6e72..1451910c5cf 100644
--- a/jdk/src/share/classes/sun/security/krb5/Credentials.java
+++ b/jdk/src/share/classes/sun/security/krb5/Credentials.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -289,7 +289,7 @@ public class Credentials {
String os = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("os.name"));
if (os.toUpperCase(Locale.ENGLISH).startsWith("WINDOWS") ||
- os.toUpperCase(Locale.ENGLISH).startsWith("MAC")) {
+ os.toUpperCase(Locale.ENGLISH).contains("OS X")) {
Credentials creds = acquireDefaultCreds();
if (creds == null) {
if (DEBUG) {
@@ -478,7 +478,7 @@ public class Credentials {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction () {
public Void run() {
- if (System.getProperty("os.name").startsWith("Mac")) {
+ if (System.getProperty("os.name").contains("OS X")) {
System.loadLibrary("osxkrb5");
} else {
System.loadLibrary("w2k_lsa_auth");
diff --git a/jdk/src/share/classes/sun/security/krb5/SCDynamicStoreConfig.java b/jdk/src/share/classes/sun/security/krb5/SCDynamicStoreConfig.java
index d4b51f88ad9..c6e5e70a94b 100644
--- a/jdk/src/share/classes/sun/security/krb5/SCDynamicStoreConfig.java
+++ b/jdk/src/share/classes/sun/security/krb5/SCDynamicStoreConfig.java
@@ -36,7 +36,13 @@ public class SCDynamicStoreConfig {
private static native Hashtable getKerberosConfig();
static {
- java.security.AccessController.doPrivileged(new sun.security.action.LoadLibraryAction("osx"));
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("osx");
+ return null;
+ }
+ });
installNotificationCallback();
}
diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java b/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java
index 08f22fffc11..2dc66d2368b 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Digest.java
@@ -39,7 +39,7 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
/**
* MessageDigest implementation class. This class currently supports
- * MD2, MD5, SHA-1, SHA-256, SHA-384, and SHA-512.
+ * MD2, MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512.
*
* Note that many digest operations are on fairly small amounts of data
* (less than 100 bytes total). For example, the 2nd hashing in HMAC or
@@ -99,6 +99,9 @@ final class P11Digest extends MessageDigestSpi implements Cloneable {
case (int)CKM_SHA_1:
digestLength = 20;
break;
+ case (int)CKM_SHA224:
+ digestLength = 28;
+ break;
case (int)CKM_SHA256:
digestLength = 32;
break;
diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Mac.java b/jdk/src/share/classes/sun/security/pkcs11/P11Mac.java
index b32ee7affeb..2b0cbbcdf50 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Mac.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Mac.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,8 +40,8 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
/**
* MAC implementation class. This class currently supports HMAC using
- * MD5, SHA-1, SHA-256, SHA-384, and SHA-512 and the SSL3 MAC using MD5
- * and SHA-1.
+ * MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 and the SSL3 MAC
+ * using MD5 and SHA-1.
*
* Note that unlike other classes (e.g. Signature), this does not
* composite various operations if the token only supports part of the
@@ -107,6 +107,9 @@ final class P11Mac extends MacSpi {
case (int)CKM_SHA_1_HMAC:
macLength = 20;
break;
+ case (int)CKM_SHA224_HMAC:
+ macLength = 28;
+ break;
case (int)CKM_SHA256_HMAC:
macLength = 32;
break;
diff --git a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
index 70a79e46bdf..3c94ad6d3ab 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Signature.java
@@ -53,12 +53,14 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
* . MD2withRSA
* . MD5withRSA
* . SHA1withRSA
+ * . SHA224withRSA
* . SHA256withRSA
* . SHA384withRSA
* . SHA512withRSA
* . ECDSA
* . NONEwithECDSA
* . SHA1withECDSA
+ * . SHA224withECDSA
* . SHA256withECDSA
* . SHA384withECDSA
* . SHA512withECDSA
@@ -143,6 +145,7 @@ final class P11Signature extends SignatureSpi {
case (int)CKM_MD2_RSA_PKCS:
case (int)CKM_MD5_RSA_PKCS:
case (int)CKM_SHA1_RSA_PKCS:
+ case (int)CKM_SHA224_RSA_PKCS:
case (int)CKM_SHA256_RSA_PKCS:
case (int)CKM_SHA384_RSA_PKCS:
case (int)CKM_SHA512_RSA_PKCS:
@@ -181,6 +184,8 @@ final class P11Signature extends SignatureSpi {
String digestAlg;
if (algorithm.equals("SHA1withECDSA")) {
digestAlg = "SHA-1";
+ } else if (algorithm.equals("SHA224withECDSA")) {
+ digestAlg = "SHA-224";
} else if (algorithm.equals("SHA256withECDSA")) {
digestAlg = "SHA-256";
} else if (algorithm.equals("SHA384withECDSA")) {
@@ -207,6 +212,9 @@ final class P11Signature extends SignatureSpi {
} else if (algorithm.equals("MD2withRSA")) {
md = MessageDigest.getInstance("MD2");
digestOID = AlgorithmId.MD2_oid;
+ } else if (algorithm.equals("SHA224withRSA")) {
+ md = MessageDigest.getInstance("SHA-224");
+ digestOID = AlgorithmId.SHA224_oid;
} else if (algorithm.equals("SHA256withRSA")) {
md = MessageDigest.getInstance("SHA-256");
digestOID = AlgorithmId.SHA256_oid;
@@ -332,6 +340,8 @@ final class P11Signature extends SignatureSpi {
encodedLength = 34;
} else if (algorithm.equals("SHA1withRSA")) {
encodedLength = 35;
+ } else if (algorithm.equals("SHA224withRSA")) {
+ encodedLength = 47;
} else if (algorithm.equals("SHA256withRSA")) {
encodedLength = 51;
} else if (algorithm.equals("SHA384withRSA")) {
diff --git a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java
index 8c432571e3a..bac38137f16 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/SunPKCS11.java
@@ -342,6 +342,7 @@ public final class SunPKCS11 extends AuthProvider {
System.out.println("Library info:");
System.out.println(p11Info);
}
+
if ((slotID < 0) || showInfo) {
long[] slots = p11.C_GetSlotList(false);
if (showInfo) {
@@ -520,24 +521,37 @@ public final class SunPKCS11 extends AuthProvider {
m(CKM_MD2));
d(MD, "MD5", P11Digest,
m(CKM_MD5));
- d(MD, "SHA1", P11Digest, s("SHA", "SHA-1"),
+ d(MD, "SHA1", P11Digest, s("SHA", "SHA-1"),
m(CKM_SHA_1));
+
+ d(MD, "SHA-224", P11Digest,
+ s("2.16.840.1.101.3.4.2.4", "OID.2.16.840.1.101.3.4.2.4"),
+ m(CKM_SHA224));
d(MD, "SHA-256", P11Digest,
+ s("2.16.840.1.101.3.4.2.1", "OID.2.16.840.1.101.3.4.2.1"),
m(CKM_SHA256));
d(MD, "SHA-384", P11Digest,
+ s("2.16.840.1.101.3.4.2.2", "OID.2.16.840.1.101.3.4.2.2"),
m(CKM_SHA384));
d(MD, "SHA-512", P11Digest,
+ s("2.16.840.1.101.3.4.2.3", "OID.2.16.840.1.101.3.4.2.3"),
m(CKM_SHA512));
d(MAC, "HmacMD5", P11MAC,
m(CKM_MD5_HMAC));
d(MAC, "HmacSHA1", P11MAC,
m(CKM_SHA_1_HMAC));
+ d(MAC, "HmacSHA224", P11MAC,
+ s("1.2.840.113549.2.8", "OID.1.2.840.113549.2.8"),
+ m(CKM_SHA224_HMAC));
d(MAC, "HmacSHA256", P11MAC,
+ s("1.2.840.113549.2.9", "OID.1.2.840.113549.2.9"),
m(CKM_SHA256_HMAC));
d(MAC, "HmacSHA384", P11MAC,
+ s("1.2.840.113549.2.10", "OID.1.2.840.113549.2.10"),
m(CKM_SHA384_HMAC));
d(MAC, "HmacSHA512", P11MAC,
+ s("1.2.840.113549.2.11", "OID.1.2.840.113549.2.11"),
m(CKM_SHA512_HMAC));
d(MAC, "SslMacMD5", P11MAC,
m(CKM_SSL3_MD5_MAC));
@@ -648,11 +662,17 @@ public final class SunPKCS11 extends AuthProvider {
m(CKM_ECDSA));
d(SIG, "SHA1withECDSA", P11Signature, s("ECDSA"),
m(CKM_ECDSA_SHA1, CKM_ECDSA));
+ d(SIG, "SHA224withECDSA", P11Signature,
+ s("1.2.840.10045.4.3.1", "OID.1.2.840.10045.4.3.1"),
+ m(CKM_ECDSA));
d(SIG, "SHA256withECDSA", P11Signature,
+ s("1.2.840.10045.4.3.2", "OID.1.2.840.10045.4.3.2"),
m(CKM_ECDSA));
d(SIG, "SHA384withECDSA", P11Signature,
+ s("1.2.840.10045.4.3.3", "OID.1.2.840.10045.4.3.3"),
m(CKM_ECDSA));
d(SIG, "SHA512withECDSA", P11Signature,
+ s("1.2.840.10045.4.3.4", "OID.1.2.840.10045.4.3.4"),
m(CKM_ECDSA));
d(SIG, "MD2withRSA", P11Signature,
m(CKM_MD2_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
@@ -660,11 +680,17 @@ public final class SunPKCS11 extends AuthProvider {
m(CKM_MD5_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
d(SIG, "SHA1withRSA", P11Signature,
m(CKM_SHA1_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
+ d(SIG, "SHA224withRSA", P11Signature,
+ s("1.2.840.113549.1.1.14", "OID.1.2.840.113549.1.1.14"),
+ m(CKM_SHA224_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
d(SIG, "SHA256withRSA", P11Signature,
+ s("1.2.840.113549.1.1.11", "OID.1.2.840.113549.1.1.11"),
m(CKM_SHA256_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
d(SIG, "SHA384withRSA", P11Signature,
+ s("1.2.840.113549.1.1.12", "OID.1.2.840.113549.1.1.12"),
m(CKM_SHA384_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
d(SIG, "SHA512withRSA", P11Signature,
+ s("1.2.840.113549.1.1.13", "OID.1.2.840.113549.1.1.13"),
m(CKM_SHA512_RSA_PKCS, CKM_RSA_PKCS, CKM_RSA_X_509));
/*
diff --git a/jdk/src/share/classes/sun/security/pkcs11/wrapper/Functions.java b/jdk/src/share/classes/sun/security/pkcs11/wrapper/Functions.java
index fa7ad073598..58f778ebbe2 100644
--- a/jdk/src/share/classes/sun/security/pkcs11/wrapper/Functions.java
+++ b/jdk/src/share/classes/sun/security/pkcs11/wrapper/Functions.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -630,6 +630,7 @@ public class Functions {
addMech(CKM_X9_42_DH_DERIVE, "CKM_X9_42_DH_DERIVE");
addMech(CKM_X9_42_DH_HYBRID_DERIVE, "CKM_X9_42_DH_HYBRID_DERIVE");
addMech(CKM_X9_42_MQV_DERIVE, "CKM_X9_42_MQV_DERIVE");
+ addMech(CKM_SHA224_RSA_PKCS, "CKM_SHA224_RSA_PKCS");
addMech(CKM_SHA256_RSA_PKCS, "CKM_SHA256_RSA_PKCS");
addMech(CKM_SHA384_RSA_PKCS, "CKM_SHA384_RSA_PKCS");
addMech(CKM_SHA512_RSA_PKCS, "CKM_SHA512_RSA_PKCS");
@@ -675,6 +676,9 @@ public class Functions {
addMech(CKM_RIPEMD160, "CKM_RIPEMD160");
addMech(CKM_RIPEMD160_HMAC, "CKM_RIPEMD160_HMAC");
addMech(CKM_RIPEMD160_HMAC_GENERAL, "CKM_RIPEMD160_HMAC_GENERAL");
+ addMech(CKM_SHA224, "CKM_SHA224");
+ addMech(CKM_SHA224_HMAC, "CKM_SHA224_HMAC");
+ addMech(CKM_SHA224_HMAC_GENERAL, "CKM_SHA224_HMAC_GENERAL");
addMech(CKM_SHA256, "CKM_SHA256");
addMech(CKM_SHA256_HMAC, "CKM_SHA256_HMAC");
addMech(CKM_SHA256_HMAC_GENERAL, "CKM_SHA256_HMAC_GENERAL");
@@ -734,6 +738,7 @@ public class Functions {
addMech(CKM_MD5_KEY_DERIVATION, "CKM_MD5_KEY_DERIVATION");
addMech(CKM_MD2_KEY_DERIVATION, "CKM_MD2_KEY_DERIVATION");
addMech(CKM_SHA1_KEY_DERIVATION, "CKM_SHA1_KEY_DERIVATION");
+ addMech(CKM_SHA224_KEY_DERIVATION, "CKM_SHA224_KEY_DERIVATION");
addMech(CKM_SHA256_KEY_DERIVATION, "CKM_SHA256_KEY_DERIVATION");
addMech(CKM_SHA384_KEY_DERIVATION, "CKM_SHA384_KEY_DERIVATION");
addMech(CKM_SHA512_KEY_DERIVATION, "CKM_SHA512_KEY_DERIVATION");
diff --git a/jdk/src/share/classes/sun/security/provider/ByteArrayAccess.java b/jdk/src/share/classes/sun/security/provider/ByteArrayAccess.java
index 5b6f8bfaa93..1c7641372ab 100644
--- a/jdk/src/share/classes/sun/security/provider/ByteArrayAccess.java
+++ b/jdk/src/share/classes/sun/security/provider/ByteArrayAccess.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,8 @@ final class ByteArrayAccess {
private static boolean unaligned() {
String arch = java.security.AccessController.doPrivileged
(new sun.security.action.GetPropertyAction("os.arch", ""));
- return arch.equals("i386") || arch.equals("x86") || arch.equals("amd64");
+ return arch.equals("i386") || arch.equals("x86") || arch.equals("amd64")
+ || arch.equals("x86_64");
}
/**
diff --git a/jdk/src/share/classes/sun/security/provider/DigestBase.java b/jdk/src/share/classes/sun/security/provider/DigestBase.java
index 2c7b719b0bc..cbca1235fe6 100644
--- a/jdk/src/share/classes/sun/security/provider/DigestBase.java
+++ b/jdk/src/share/classes/sun/security/provider/DigestBase.java
@@ -39,7 +39,6 @@ import java.security.ProviderException;
* . abstract void implCompress(byte[] b, int ofs);
* . abstract void implDigest(byte[] out, int ofs);
* . abstract void implReset();
- * . public abstract Object clone();
*
* See the inline documentation for details.
*
@@ -61,7 +60,7 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
// buffer to store partial blocks, blockSize bytes large
// Subclasses should not access this array directly except possibly in their
// implDigest() method. See MD5.java as an example.
- final byte[] buffer;
+ byte[] buffer;
// offset into buffer
private int bufOfs;
@@ -83,18 +82,6 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
buffer = new byte[blockSize];
}
- /**
- * Constructor for cloning. Replicates common data.
- */
- DigestBase(DigestBase base) {
- this.algorithm = base.algorithm;
- this.digestLength = base.digestLength;
- this.blockSize = base.blockSize;
- this.buffer = base.buffer.clone();
- this.bufOfs = base.bufOfs;
- this.bytesProcessed = base.bytesProcessed;
- }
-
// return digest length. See JCA doc.
protected final int engineGetDigestLength() {
return digestLength;
@@ -206,12 +193,11 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
*/
abstract void implReset();
- /**
- * Clone this digest. Should be implemented as "return new MyDigest(this)".
- * That constructor should first call "super(baseDigest)" and then copy
- * subclass specific data.
- */
- public abstract Object clone();
+ public Object clone() throws CloneNotSupportedException {
+ DigestBase copy = (DigestBase) super.clone();
+ copy.buffer = copy.buffer.clone();
+ return copy;
+ }
// padding used for the MD5, and SHA-* message digests
static final byte[] padding;
@@ -223,5 +209,4 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
padding = new byte[136];
padding[0] = (byte)0x80;
}
-
}
diff --git a/jdk/src/share/classes/sun/security/provider/MD2.java b/jdk/src/share/classes/sun/security/provider/MD2.java
index c0c116ae84a..5d0a3e3e827 100644
--- a/jdk/src/share/classes/sun/security/provider/MD2.java
+++ b/jdk/src/share/classes/sun/security/provider/MD2.java
@@ -39,14 +39,14 @@ import java.util.Arrays;
public final class MD2 extends DigestBase {
// state, 48 ints
- private final int[] X;
+ private int[] X;
// checksum, 16 ints. they are really bytes, but byte arithmetic in
// the JVM is much slower that int arithmetic.
- private final int[] C;
+ private int[] C;
// temporary store for checksum C during final digest
- private final byte[] cBytes;
+ private byte[] cBytes;
/**
* Create a new MD2 digest. Called by the JCA framework
@@ -58,15 +58,12 @@ public final class MD2 extends DigestBase {
cBytes = new byte[16];
}
- private MD2(MD2 base) {
- super(base);
- this.X = base.X.clone();
- this.C = base.C.clone();
- cBytes = new byte[16];
- }
-
- public Object clone() {
- return new MD2(this);
+ public Object clone() throws CloneNotSupportedException {
+ MD2 copy = (MD2) super.clone();
+ copy.X = copy.X.clone();
+ copy.C = copy.C.clone();
+ copy.cBytes = new byte[16];
+ return copy;
}
// reset state and checksum
diff --git a/jdk/src/share/classes/sun/security/provider/MD4.java b/jdk/src/share/classes/sun/security/provider/MD4.java
index 56ff5a06ae3..e51b2485499 100644
--- a/jdk/src/share/classes/sun/security/provider/MD4.java
+++ b/jdk/src/share/classes/sun/security/provider/MD4.java
@@ -44,9 +44,9 @@ import static sun.security.provider.ByteArrayAccess.*;
public final class MD4 extends DigestBase {
// state of this object
- private final int[] state;
+ private int[] state;
// temporary buffer, used by implCompress()
- private final int[] x;
+ private int[] x;
// rotation constants
private static final int S11 = 3;
@@ -93,16 +93,12 @@ public final class MD4 extends DigestBase {
implReset();
}
- // Cloning constructor
- private MD4(MD4 base) {
- super(base);
- this.state = base.state.clone();
- this.x = new int[16];
- }
-
// clone this object
- public Object clone() {
- return new MD4(this);
+ public Object clone() throws CloneNotSupportedException {
+ MD4 copy = (MD4) super.clone();
+ copy.state = copy.state.clone();
+ copy.x = new int[16];
+ return copy;
}
/**
diff --git a/jdk/src/share/classes/sun/security/provider/MD5.java b/jdk/src/share/classes/sun/security/provider/MD5.java
index 85830e55010..32e42e5ecd7 100644
--- a/jdk/src/share/classes/sun/security/provider/MD5.java
+++ b/jdk/src/share/classes/sun/security/provider/MD5.java
@@ -39,9 +39,9 @@ import static sun.security.provider.ByteArrayAccess.*;
public final class MD5 extends DigestBase {
// state of this object
- private final int[] state;
+ private int[] state;
// temporary buffer, used by implCompress()
- private final int[] x;
+ private int[] x;
// rotation constants
private static final int S11 = 7;
@@ -69,16 +69,12 @@ public final class MD5 extends DigestBase {
implReset();
}
- // Cloning constructor
- private MD5(MD5 base) {
- super(base);
- this.state = base.state.clone();
- this.x = new int[16];
- }
-
// clone this object
- public Object clone() {
- return new MD5(this);
+ public Object clone() throws CloneNotSupportedException {
+ MD5 copy = (MD5) super.clone();
+ copy.state = copy.state.clone();
+ copy.x = new int[16];
+ return copy;
}
/**
diff --git a/jdk/src/share/classes/sun/security/provider/SHA.java b/jdk/src/share/classes/sun/security/provider/SHA.java
index 723c64a2b5b..0f13f41b25c 100644
--- a/jdk/src/share/classes/sun/security/provider/SHA.java
+++ b/jdk/src/share/classes/sun/security/provider/SHA.java
@@ -47,10 +47,10 @@ public final class SHA extends DigestBase {
// 64 bytes are included in each hash block so the low order
// bits of count are used to know how to pack the bytes into ints
// and to know when to compute the block and start the next one.
- private final int[] W;
+ private int[] W;
// state of this
- private final int[] state;
+ private int[] state;
/**
* Creates a new SHA object.
@@ -62,19 +62,14 @@ public final class SHA extends DigestBase {
implReset();
}
- /**
- * Creates a SHA object.with state (for cloning) */
- private SHA(SHA base) {
- super(base);
- this.state = base.state.clone();
- this.W = new int[80];
- }
-
/*
* Clones this object.
*/
- public Object clone() {
- return new SHA(this);
+ public Object clone() throws CloneNotSupportedException {
+ SHA copy = (SHA) super.clone();
+ copy.state = copy.state.clone();
+ copy.W = new int[80];
+ return copy;
}
/**
diff --git a/jdk/src/share/classes/sun/security/provider/SHA2.java b/jdk/src/share/classes/sun/security/provider/SHA2.java
index a04ada05a34..54f34545918 100644
--- a/jdk/src/share/classes/sun/security/provider/SHA2.java
+++ b/jdk/src/share/classes/sun/security/provider/SHA2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@ import static sun.security.provider.ByteArrayAccess.*;
* @author Valerie Peng
* @author Andreas Sterbenz
*/
-public final class SHA2 extends DigestBase {
+abstract class SHA2 extends DigestBase {
private static final int ITERATION = 64;
// Constants for each round
@@ -64,46 +64,30 @@ public final class SHA2 extends DigestBase {
};
// buffer used by implCompress()
- private final int[] W;
+ private int[] W;
// state of this object
- private final int[] state;
+ private int[] state;
+
+ // initial state value. different between SHA-224 and SHA-256
+ private final int[] initialHashes;
/**
* Creates a new SHA object.
*/
- public SHA2() {
- super("SHA-256", 32, 64);
+ SHA2(String name, int digestLength, int[] initialHashes) {
+ super(name, digestLength, 64);
+ this.initialHashes = initialHashes;
state = new int[8];
W = new int[64];
implReset();
}
- /**
- * Creates a SHA2 object.with state (for cloning)
- */
- private SHA2(SHA2 base) {
- super(base);
- this.state = base.state.clone();
- this.W = new int[64];
- }
-
- public Object clone() {
- return new SHA2(this);
- }
-
/**
* Resets the buffers and hash value to start a new hash.
*/
void implReset() {
- state[0] = 0x6a09e667;
- state[1] = 0xbb67ae85;
- state[2] = 0x3c6ef372;
- state[3] = 0xa54ff53a;
- state[4] = 0x510e527f;
- state[5] = 0x9b05688c;
- state[6] = 0x1f83d9ab;
- state[7] = 0x5be0cd19;
+ System.arraycopy(initialHashes, 0, state, 0, state.length);
}
void implDigest(byte[] out, int ofs) {
@@ -242,4 +226,38 @@ public final class SHA2 extends DigestBase {
state[7] += h;
}
+ public Object clone() throws CloneNotSupportedException {
+ SHA2 copy = (SHA2) super.clone();
+ copy.state = copy.state.clone();
+ copy.W = new int[64];
+ return copy;
+ }
+
+ /**
+ * SHA-224 implementation class.
+ */
+ public static final class SHA224 extends SHA2 {
+ private static final int[] INITIAL_HASHES = {
+ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
+ 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
+ };
+
+ public SHA224() {
+ super("SHA-224", 28, INITIAL_HASHES);
+ }
+ }
+
+ /**
+ * SHA-256 implementation class.
+ */
+ public static final class SHA256 extends SHA2 {
+ private static final int[] INITIAL_HASHES = {
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
+ 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
+ };
+
+ public SHA256() {
+ super("SHA-256", 32, INITIAL_HASHES);
+ }
+ }
}
diff --git a/jdk/src/share/classes/sun/security/provider/SHA5.java b/jdk/src/share/classes/sun/security/provider/SHA5.java
index 413770cc542..851c0706b1c 100644
--- a/jdk/src/share/classes/sun/security/provider/SHA5.java
+++ b/jdk/src/share/classes/sun/security/provider/SHA5.java
@@ -82,10 +82,10 @@ abstract class SHA5 extends DigestBase {
};
// buffer used by implCompress()
- private final long[] W;
+ private long[] W;
// state of this object
- private final long[] state;
+ private long[] state;
// initial state value. different between SHA-384 and SHA-512
private final long[] initialHashes;
@@ -101,16 +101,6 @@ abstract class SHA5 extends DigestBase {
implReset();
}
- /**
- * Creates a SHA object with state (for cloning)
- */
- SHA5(SHA5 base) {
- super(base);
- this.initialHashes = base.initialHashes;
- this.state = base.state.clone();
- this.W = new long[80];
- }
-
final void implReset() {
System.arraycopy(initialHashes, 0, state, 0, state.length);
}
@@ -255,6 +245,13 @@ abstract class SHA5 extends DigestBase {
state[7] += h;
}
+ public Object clone() throws CloneNotSupportedException {
+ SHA5 copy = (SHA5) super.clone();
+ copy.state = copy.state.clone();
+ copy.W = new long[80];
+ return copy;
+ }
+
/**
* SHA-512 implementation class.
*/
@@ -270,14 +267,6 @@ abstract class SHA5 extends DigestBase {
public SHA512() {
super("SHA-512", 64, INITIAL_HASHES);
}
-
- private SHA512(SHA512 base) {
- super(base);
- }
-
- public Object clone() {
- return new SHA512(this);
- }
}
/**
@@ -295,14 +284,5 @@ abstract class SHA5 extends DigestBase {
public SHA384() {
super("SHA-384", 48, INITIAL_HASHES);
}
-
- private SHA384(SHA384 base) {
- super(base);
- }
-
- public Object clone() {
- return new SHA384(this);
- }
}
-
}
diff --git a/jdk/src/share/classes/sun/security/provider/SecureRandom.java b/jdk/src/share/classes/sun/security/provider/SecureRandom.java
index aee8846ed14..e79e9d7f49a 100644
--- a/jdk/src/share/classes/sun/security/provider/SecureRandom.java
+++ b/jdk/src/share/classes/sun/security/provider/SecureRandom.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -102,7 +102,7 @@ implements java.io.Serializable {
try {
digest = MessageDigest.getInstance ("SHA");
} catch (NoSuchAlgorithmException e) {
- throw new InternalError("internal error: SHA-1 not available.");
+ throw new InternalError("internal error: SHA-1 not available.", e);
}
if (seed != null) {
diff --git a/jdk/src/share/classes/sun/security/provider/SunEntries.java b/jdk/src/share/classes/sun/security/provider/SunEntries.java
index 6421afd0fb3..3f0ef1084ce 100644
--- a/jdk/src/share/classes/sun/security/provider/SunEntries.java
+++ b/jdk/src/share/classes/sun/security/provider/SunEntries.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,10 @@ import java.security.*;
* identifier strings "OID.1.3.14.3.2.13", "OID.1.3.14.3.2.27" and
* "OID.1.2.840.10040.4.3".
*
+ * - SHA-2 is a set of message digest schemes described in FIPS 180-2.
+ * SHA-2 family of hash functions includes SHA-224, SHA-256, SHA-384,
+ * and SHA-512.
+ *
* - DSA is the key generation scheme as described in FIPS 186.
* Aliases for DSA include the OID strings "OID.1.3.14.3.2.12"
* and "OID.1.2.840.10040.4.1".
@@ -140,9 +144,19 @@ final class SunEntries {
map.put("Alg.Alias.MessageDigest.SHA-1", "SHA");
map.put("Alg.Alias.MessageDigest.SHA1", "SHA");
- map.put("MessageDigest.SHA-256", "sun.security.provider.SHA2");
+ map.put("MessageDigest.SHA-224", "sun.security.provider.SHA2$SHA224");
+ map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.4", "SHA-224");
+ map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.4", "SHA-224");
+
+ map.put("MessageDigest.SHA-256", "sun.security.provider.SHA2$SHA256");
+ map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.1", "SHA-256");
+ map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.1", "SHA-256");
map.put("MessageDigest.SHA-384", "sun.security.provider.SHA5$SHA384");
+ map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.2", "SHA-384");
+ map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.2", "SHA-384");
map.put("MessageDigest.SHA-512", "sun.security.provider.SHA5$SHA512");
+ map.put("Alg.Alias.MessageDigest.2.16.840.1.101.3.4.2.3", "SHA-512");
+ map.put("Alg.Alias.MessageDigest.OID.2.16.840.1.101.3.4.2.3", "SHA-512");
/*
* Algorithm Parameter Generator engines
diff --git a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
index c88c37b3bf7..b3daf348566 100644
--- a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
+++ b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java
@@ -318,7 +318,9 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi {
}
// break out of loop if search is successful
- break;
+ if (pathCompleted) {
+ break;
+ }
}
if (debug != null) {
diff --git a/jdk/src/share/classes/sun/security/rsa/RSASignature.java b/jdk/src/share/classes/sun/security/rsa/RSASignature.java
index a98ed881d1c..435e283ad23 100644
--- a/jdk/src/share/classes/sun/security/rsa/RSASignature.java
+++ b/jdk/src/share/classes/sun/security/rsa/RSASignature.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,8 @@ import sun.security.x509.AlgorithmId;
* PKCS#1 RSA signatures with the various message digest algorithms.
* This file contains an abstract base class with all the logic plus
* a nested static class for each of the message digest algorithms
- * (see end of the file). We support MD2, MD5, SHA-1, SHA-256, SHA-384,
- * and SHA-512.
+ * (see end of the file). We support MD2, MD5, SHA-1, SHA-224, SHA-256,
+ * SHA-384, and SHA-512.
*
* @since 1.5
* @author Andreas Sterbenz
@@ -276,6 +276,13 @@ public abstract class RSASignature extends SignatureSpi {
}
}
+ // Nested class for SHA224withRSA signatures
+ public static final class SHA224withRSA extends RSASignature {
+ public SHA224withRSA() {
+ super("SHA-224", AlgorithmId.SHA224_oid, 11);
+ }
+ }
+
// Nested class for SHA256withRSA signatures
public static final class SHA256withRSA extends RSASignature {
public SHA256withRSA() {
diff --git a/jdk/src/share/classes/sun/security/rsa/SunRsaSignEntries.java b/jdk/src/share/classes/sun/security/rsa/SunRsaSignEntries.java
index fc8f5576339..836fc5f201c 100644
--- a/jdk/src/share/classes/sun/security/rsa/SunRsaSignEntries.java
+++ b/jdk/src/share/classes/sun/security/rsa/SunRsaSignEntries.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,8 @@ public final class SunRsaSignEntries {
"sun.security.rsa.RSASignature$MD5withRSA");
map.put("Signature.SHA1withRSA",
"sun.security.rsa.RSASignature$SHA1withRSA");
+ map.put("Signature.SHA224withRSA",
+ "sun.security.rsa.RSASignature$SHA224withRSA");
map.put("Signature.SHA256withRSA",
"sun.security.rsa.RSASignature$SHA256withRSA");
map.put("Signature.SHA384withRSA",
@@ -66,6 +68,7 @@ public final class SunRsaSignEntries {
map.put("Signature.MD2withRSA SupportedKeyClasses", rsaKeyClasses);
map.put("Signature.MD5withRSA SupportedKeyClasses", rsaKeyClasses);
map.put("Signature.SHA1withRSA SupportedKeyClasses", rsaKeyClasses);
+ map.put("Signature.SHA224withRSA SupportedKeyClasses", rsaKeyClasses);
map.put("Signature.SHA256withRSA SupportedKeyClasses", rsaKeyClasses);
map.put("Signature.SHA384withRSA SupportedKeyClasses", rsaKeyClasses);
map.put("Signature.SHA512withRSA SupportedKeyClasses", rsaKeyClasses);
@@ -88,6 +91,9 @@ public final class SunRsaSignEntries {
map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.5", "SHA1withRSA");
map.put("Alg.Alias.Signature.1.3.14.3.2.29", "SHA1withRSA");
+ map.put("Alg.Alias.Signature.1.2.840.113549.1.1.14", "SHA224withRSA");
+ map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.14", "SHA224withRSA");
+
map.put("Alg.Alias.Signature.1.2.840.113549.1.1.11", "SHA256withRSA");
map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.11", "SHA256withRSA");
diff --git a/jdk/src/share/classes/sun/security/smartcardio/PCSC.java b/jdk/src/share/classes/sun/security/smartcardio/PCSC.java
index e9e98d9f659..c1ebe4c7b3e 100644
--- a/jdk/src/share/classes/sun/security/smartcardio/PCSC.java
+++ b/jdk/src/share/classes/sun/security/smartcardio/PCSC.java
@@ -27,8 +27,6 @@ package sun.security.smartcardio;
import java.security.AccessController;
-import sun.security.action.LoadLibraryAction;
-
/**
* Access to native PC/SC functions and definition of PC/SC constants.
* Initialization and platform specific PC/SC constants are handled in
diff --git a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java
index 9814f9f5010..1a5a8cf78ef 100644
--- a/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java
+++ b/jdk/src/share/classes/sun/security/ssl/SSLContextImpl.java
@@ -267,36 +267,42 @@ public abstract class SSLContextImpl extends SSLContextSpi {
// Get suported CipherSuiteList.
CipherSuiteList getSuportedCipherSuiteList() {
- // Clear cache of available ciphersuites.
- clearAvailableCache();
+ // The maintenance of cipher suites needs to be synchronized.
+ synchronized (this) {
+ // Clear cache of available ciphersuites.
+ clearAvailableCache();
- if (supportedCipherSuiteList == null) {
- supportedCipherSuiteList =
- getApplicableCipherSuiteList(getSuportedProtocolList(), false);
+ if (supportedCipherSuiteList == null) {
+ supportedCipherSuiteList = getApplicableCipherSuiteList(
+ getSuportedProtocolList(), false);
+ }
+
+ return supportedCipherSuiteList;
}
-
- return supportedCipherSuiteList;
}
// Get default CipherSuiteList.
CipherSuiteList getDefaultCipherSuiteList(boolean roleIsServer) {
- // Clear cache of available ciphersuites.
- clearAvailableCache();
+ // The maintenance of cipher suites needs to be synchronized.
+ synchronized (this) {
+ // Clear cache of available ciphersuites.
+ clearAvailableCache();
- if (roleIsServer) {
- if (defaultServerCipherSuiteList == null) {
- defaultServerCipherSuiteList = getApplicableCipherSuiteList(
+ if (roleIsServer) {
+ if (defaultServerCipherSuiteList == null) {
+ defaultServerCipherSuiteList = getApplicableCipherSuiteList(
getDefaultProtocolList(true), true);
- }
+ }
- return defaultServerCipherSuiteList;
- } else {
- if (defaultClientCipherSuiteList == null) {
- defaultClientCipherSuiteList = getApplicableCipherSuiteList(
+ return defaultServerCipherSuiteList;
+ } else {
+ if (defaultClientCipherSuiteList == null) {
+ defaultClientCipherSuiteList = getApplicableCipherSuiteList(
getDefaultProtocolList(false), true);
- }
+ }
- return defaultClientCipherSuiteList;
+ return defaultClientCipherSuiteList;
+ }
}
}
@@ -364,8 +370,11 @@ public abstract class SSLContextImpl extends SSLContextSpi {
* Clear cache of available ciphersuites. If we support all ciphers
* internally, there is no need to clear the cache and calling this
* method has no effect.
+ *
+ * Note that every call to clearAvailableCache() and the maintenance of
+ * cipher suites need to be synchronized with this instance.
*/
- synchronized void clearAvailableCache() {
+ private void clearAvailableCache() {
if (CipherSuite.DYNAMIC_AVAILABILITY) {
supportedCipherSuiteList = null;
defaultServerCipherSuiteList = null;
diff --git a/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java b/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
index 103c3d4b463..ca0393a323d 100644
--- a/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
+++ b/jdk/src/share/classes/sun/security/util/DisabledAlgorithmConstraints.java
@@ -59,10 +59,10 @@ public class DisabledAlgorithmConstraints implements AlgorithmConstraints {
public final static String PROPERTY_TLS_DISABLED_ALGS =
"jdk.tls.disabledAlgorithms";
- private static Map disabledAlgorithmsMap =
- Collections.synchronizedMap(new HashMap());
- private static Map keySizeConstraintsMap =
- Collections.synchronizedMap(new HashMap());
+ private final static Map disabledAlgorithmsMap =
+ new HashMap<>();
+ private final static Map keySizeConstraintsMap =
+ new HashMap<>();
private String[] disabledAlgorithms;
private KeySizeConstraints keySizeConstraints;
@@ -74,6 +74,8 @@ public class DisabledAlgorithmConstraints implements AlgorithmConstraints {
* algorithm constraints
*/
public DisabledAlgorithmConstraints(String propertyName) {
+ // Both disabledAlgorithmsMap and keySizeConstraintsMap are
+ // synchronized with the lock of disabledAlgorithmsMap.
synchronized (disabledAlgorithmsMap) {
if(!disabledAlgorithmsMap.containsKey(propertyName)) {
loadDisabledAlgorithmsMap(propertyName);
diff --git a/jdk/src/share/classes/sun/security/validator/SimpleValidator.java b/jdk/src/share/classes/sun/security/validator/SimpleValidator.java
index 94698427b92..a0f4f8b9e7e 100644
--- a/jdk/src/share/classes/sun/security/validator/SimpleValidator.java
+++ b/jdk/src/share/classes/sun/security/validator/SimpleValidator.java
@@ -311,7 +311,7 @@ public final class SimpleValidator extends Validator {
// if the certificate is self-issued, ignore the pathLenConstraint
// checking.
if (!X509CertImpl.isSelfIssued(cert)) {
- if (maxPathLen <= 1) { // reserved one for end-entity certificate
+ if (maxPathLen <= 0) {
throw new ValidatorException("Violated path length constraints",
ValidatorException.T_CA_EXTENSIONS, cert);
}
diff --git a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java
index 4602248c1f3..0504707fa8a 100644
--- a/jdk/src/share/classes/sun/security/x509/AlgorithmId.java
+++ b/jdk/src/share/classes/sun/security/x509/AlgorithmId.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -175,9 +175,9 @@ public class AlgorithmId implements Serializable, DerEncoder {
// it's NULL. They are ---
// rfc3370 2.1: Implementations SHOULD generate SHA-1
// AlgorithmIdentifiers with absent parameters.
- // rfc3447 C1: When id-sha1, id-sha256, id-sha384 and id-sha512
- // are used in an AlgorithmIdentifier the parameters (which are
- // optional) SHOULD be omitted.
+ // rfc3447 C1: When id-sha1, id-sha224, id-sha256, id-sha384 and
+ // id-sha512 are used in an AlgorithmIdentifier the parameters
+ // (which are optional) SHOULD be omitted.
// rfc3279 2.3.2: The id-dsa algorithm syntax includes optional
// domain parameters... When omitted, the parameters component
// MUST be omitted entirely
@@ -185,6 +185,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
// is used, the AlgorithmIdentifier parameters field MUST be absent.
/*if (
algid.equals((Object)SHA_oid) ||
+ algid.equals((Object)SHA224_oid) ||
algid.equals((Object)SHA256_oid) ||
algid.equals((Object)SHA384_oid) ||
algid.equals((Object)SHA512_oid) ||
@@ -488,7 +489,10 @@ public class AlgorithmId implements Serializable, DerEncoder {
name.equalsIgnoreCase("SHA512")) {
return AlgorithmId.SHA512_oid;
}
-
+ if (name.equalsIgnoreCase("SHA-224") ||
+ name.equalsIgnoreCase("SHA224")) {
+ return AlgorithmId.SHA224_oid;
+ }
// Various public key algorithms
if (name.equalsIgnoreCase("RSA")) {
@@ -625,6 +629,9 @@ public class AlgorithmId implements Serializable, DerEncoder {
public static final ObjectIdentifier SHA_oid =
ObjectIdentifier.newInternal(new int[] {1, 3, 14, 3, 2, 26});
+ public static final ObjectIdentifier SHA224_oid =
+ ObjectIdentifier.newInternal(new int[] {2, 16, 840, 1, 101, 3, 4, 2, 4});
+
public static final ObjectIdentifier SHA256_oid =
ObjectIdentifier.newInternal(new int[] {2, 16, 840, 1, 101, 3, 4, 2, 1});
@@ -664,6 +671,8 @@ public class AlgorithmId implements Serializable, DerEncoder {
{ 1, 2, 840, 113549, 1, 1, 5 };
private static final int sha1WithRSAEncryption_OIW_data[] =
{ 1, 3, 14, 3, 2, 29 };
+ private static final int sha224WithRSAEncryption_data[] =
+ { 1, 2, 840, 113549, 1, 1, 14 };
private static final int sha256WithRSAEncryption_data[] =
{ 1, 2, 840, 113549, 1, 1, 11 };
private static final int sha384WithRSAEncryption_data[] =
@@ -681,6 +690,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
public static final ObjectIdentifier md5WithRSAEncryption_oid;
public static final ObjectIdentifier sha1WithRSAEncryption_oid;
public static final ObjectIdentifier sha1WithRSAEncryption_OIW_oid;
+ public static final ObjectIdentifier sha224WithRSAEncryption_oid;
public static final ObjectIdentifier sha256WithRSAEncryption_oid;
public static final ObjectIdentifier sha384WithRSAEncryption_oid;
public static final ObjectIdentifier sha512WithRSAEncryption_oid;
@@ -809,6 +819,14 @@ public class AlgorithmId implements Serializable, DerEncoder {
sha1WithRSAEncryption_OIW_oid =
ObjectIdentifier.newInternal(sha1WithRSAEncryption_OIW_data);
+ /**
+ * Identifies a signing algorithm where a SHA224 digest is
+ * encrypted using an RSA private key; defined by PKCS #1.
+ * OID = 1.2.840.113549.1.1.14
+ */
+ sha224WithRSAEncryption_oid =
+ ObjectIdentifier.newInternal(sha224WithRSAEncryption_data);
+
/**
* Identifies a signing algorithm where a SHA256 digest is
* encrypted using an RSA private key; defined by PKCS #1.
@@ -859,6 +877,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
nameTable.put(MD5_oid, "MD5");
nameTable.put(MD2_oid, "MD2");
nameTable.put(SHA_oid, "SHA");
+ nameTable.put(SHA224_oid, "SHA224");
nameTable.put(SHA256_oid, "SHA256");
nameTable.put(SHA384_oid, "SHA384");
nameTable.put(SHA512_oid, "SHA512");
@@ -881,6 +900,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
nameTable.put(shaWithDSA_OIW_oid, "SHA1withDSA");
nameTable.put(sha1WithRSAEncryption_oid, "SHA1withRSA");
nameTable.put(sha1WithRSAEncryption_OIW_oid, "SHA1withRSA");
+ nameTable.put(sha224WithRSAEncryption_oid, "SHA224withRSA");
nameTable.put(sha256WithRSAEncryption_oid, "SHA256withRSA");
nameTable.put(sha384WithRSAEncryption_oid, "SHA384withRSA");
nameTable.put(sha512WithRSAEncryption_oid, "SHA512withRSA");
diff --git a/jdk/src/share/classes/sun/tools/jcmd/JCmd.java b/jdk/src/share/classes/sun/tools/jcmd/JCmd.java
index 3ec79968fed..4690a5bc4f6 100644
--- a/jdk/src/share/classes/sun/tools/jcmd/JCmd.java
+++ b/jdk/src/share/classes/sun/tools/jcmd/JCmd.java
@@ -142,8 +142,11 @@ public class JCmd {
// Cast to HotSpotVirtualMachine as this is an
// implementation specific method.
HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
- String lines[] = command .split("\\n");
+ String lines[] = command.split("\\n");
for (String line : lines) {
+ if (line.trim().equals("stop")) {
+ break;
+ }
try (InputStream in = hvm.executeJCmd(line);) {
// read to EOF and just print output
byte b[] = new byte[256];
diff --git a/jdk/src/share/classes/sun/tracing/dtrace/JVM.java b/jdk/src/share/classes/sun/tracing/dtrace/JVM.java
index 2bea9740c09..c59ce68cb3c 100644
--- a/jdk/src/share/classes/sun/tracing/dtrace/JVM.java
+++ b/jdk/src/share/classes/sun/tracing/dtrace/JVM.java
@@ -35,8 +35,13 @@ import java.lang.reflect.Method;
class JVM {
static {
- java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("jsdt"));
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("jsdt");
+ return null;
+ }
+ });
}
static long activate(String moduleName, DTraceProvider[] providers) {
diff --git a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java
index df88de5bdd4..30700a06b0b 100644
--- a/jdk/src/share/classes/sun/util/logging/PlatformLogger.java
+++ b/jdk/src/share/classes/sun/util/logging/PlatformLogger.java
@@ -516,6 +516,9 @@ public class PlatformLogger {
}
void doLog(int level, String msg, Object... params) {
+ if (!isLoggable(level)) {
+ return;
+ }
// only pass String objects to the j.u.l.Logger which may
// be created by untrusted code
int len = (params != null) ? params.length : 0;
diff --git a/jdk/src/share/demo/jfc/Notepad/Notepad.java b/jdk/src/share/demo/jfc/Notepad/Notepad.java
index c80966920fb..b6c7199e256 100644
--- a/jdk/src/share/demo/jfc/Notepad/Notepad.java
+++ b/jdk/src/share/demo/jfc/Notepad/Notepad.java
@@ -39,71 +39,18 @@
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.FileDialog;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JProgressBar;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JToolBar;
-import javax.swing.JViewport;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
+import java.awt.*;
+import java.awt.event.*;
+import java.beans.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.logging.*;
+import javax.swing.*;
+import javax.swing.undo.*;
+import javax.swing.text.*;
+import javax.swing.event.*;
import javax.swing.UIManager.LookAndFeelInfo;
-import javax.swing.event.UndoableEditEvent;
-import javax.swing.event.UndoableEditListener;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.Document;
-import javax.swing.text.JTextComponent;
-import javax.swing.text.PlainDocument;
-import javax.swing.text.Segment;
-import javax.swing.text.TextAction;
-import javax.swing.undo.CannotRedoException;
-import javax.swing.undo.CannotUndoException;
-import javax.swing.undo.UndoManager;
/**
@@ -115,16 +62,27 @@ import javax.swing.undo.UndoManager;
@SuppressWarnings("serial")
class Notepad extends JPanel {
+ protected static Properties properties;
private static ResourceBundle resources;
private final static String EXIT_AFTER_PAINT = "-exit";
private static boolean exitAfterFirstPaint;
+ private static final String[] MENUBAR_KEYS = {"file", "edit", "debug"};
+ private static final String[] TOOLBAR_KEYS = {"new", "open", "save", "-", "cut", "copy", "paste"};
+ private static final String[] FILE_KEYS = {"new", "open", "save", "-", "exit"};
+ private static final String[] EDIT_KEYS = {"cut", "copy", "paste", "-", "undo", "redo"};
+ private static final String[] DEBUG_KEYS = {"dump", "showElementTree"};
+
static {
try {
+ properties = new Properties();
+ properties.load(Notepad.class.getResourceAsStream(
+ "resources/NotepadSystem.properties"));
resources = ResourceBundle.getBundle("resources.Notepad",
Locale.getDefault());
- } catch (MissingResourceException mre) {
- System.err.println("resources/Notepad.properties not found");
+ } catch (MissingResourceException | IOException e) {
+ System.err.println("resources/Notepad.properties "
+ + "or resources/NotepadSystem.properties not found");
System.exit(1);
}
}
@@ -163,26 +121,22 @@ class Notepad extends JPanel {
// install the command table
commands = new HashMap();
Action[] actions = getActions();
- for (int i = 0; i < actions.length; i++) {
- Action a = actions[i];
- //commands.put(a.getText(Action.NAME), a);
+ for (Action a : actions) {
commands.put(a.getValue(Action.NAME), a);
}
JScrollPane scroller = new JScrollPane();
JViewport port = scroller.getViewport();
port.add(editor);
- try {
- String vpFlag = resources.getString("ViewportBackingStore");
+
+ String vpFlag = getProperty("ViewportBackingStore");
+ if (vpFlag != null) {
Boolean bs = Boolean.valueOf(vpFlag);
- port.setScrollMode(bs.booleanValue()
+ port.setScrollMode(bs
? JViewport.BACKINGSTORE_SCROLL_MODE
: JViewport.BLIT_SCROLL_MODE);
- } catch (MissingResourceException ignored) {
- // just use the viewport default
}
- menuItems = new HashMap();
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add("North", createToolbar());
@@ -191,31 +145,26 @@ class Notepad extends JPanel {
add("South", createStatusbar());
}
- public static void main(String[] args) {
- try {
- if (args.length > 0 && args[0].equals(EXIT_AFTER_PAINT)) {
- exitAfterFirstPaint = true;
- }
- SwingUtilities.invokeAndWait(new Runnable() {
-
- public void run() {
- JFrame frame = new JFrame();
- frame.setTitle(resources.getString("Title"));
- frame.setBackground(Color.lightGray);
- frame.getContentPane().setLayout(new BorderLayout());
- Notepad notepad = new Notepad();
- frame.getContentPane().add("Center", notepad);
- frame.setJMenuBar(notepad.createMenubar());
- frame.addWindowListener(new AppCloser());
- frame.pack();
- frame.setSize(500, 600);
- frame.setVisible(true);
- }
- });
- } catch (Throwable t) {
- Logger.getLogger(Notepad.class.getName()).log(Level.SEVERE,
- "uncaught exception", t);
+ public static void main(String[] args) throws Exception {
+ if (args.length > 0 && args[0].equals(EXIT_AFTER_PAINT)) {
+ exitAfterFirstPaint = true;
}
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ JFrame frame = new JFrame();
+ frame.setTitle(resources.getString("Title"));
+ frame.setBackground(Color.lightGray);
+ frame.getContentPane().setLayout(new BorderLayout());
+ Notepad notepad = new Notepad();
+ frame.getContentPane().add("Center", notepad);
+ frame.setJMenuBar(notepad.createMenubar());
+ frame.addWindowListener(new AppCloser());
+ frame.pack();
+ frame.setSize(500, 600);
+ frame.setVisible(true);
+ }
+ });
}
/**
@@ -274,9 +223,7 @@ class Notepad extends JPanel {
/**
* This is the hook through which all menu items are
- * created. It registers the result with the menuitem
- * hashtable so that it can be fetched with getMenuItem().
- * @see #getMenuItem
+ * created.
*/
protected JMenuItem createMenuItem(String cmd) {
JMenuItem mi = new JMenuItem(getResourceString(cmd + labelSuffix));
@@ -285,7 +232,7 @@ class Notepad extends JPanel {
mi.setHorizontalTextPosition(JButton.RIGHT);
mi.setIcon(new ImageIcon(url));
}
- String astr = getResourceString(cmd + actionSuffix);
+ String astr = getProperty(cmd + actionSuffix);
if (astr == null) {
astr = cmd;
}
@@ -298,25 +245,17 @@ class Notepad extends JPanel {
} else {
mi.setEnabled(false);
}
- menuItems.put(cmd, mi);
return mi;
}
- /**
- * Fetch the menu item that was created for the given
- * command.
- * @param cmd Name of the action.
- * @returns item created for the given command or null
- * if one wasn't created.
- */
- protected JMenuItem getMenuItem(String cmd) {
- return menuItems.get(cmd);
- }
-
protected Action getAction(String cmd) {
return commands.get(cmd);
}
+ protected String getProperty(String key) {
+ return properties.getProperty(key);
+ }
+
protected String getResourceString(String nm) {
String str;
try {
@@ -330,20 +269,11 @@ class Notepad extends JPanel {
protected URL getResource(String key) {
String name = getResourceString(key);
if (name != null) {
- URL url = this.getClass().getResource(name);
- return url;
+ return this.getClass().getResource(name);
}
return null;
}
- protected Container getToolbar() {
- return toolbar;
- }
-
- protected JMenuBar getMenubar() {
- return menubar;
- }
-
/**
* Create a status bar
*/
@@ -368,12 +298,11 @@ class Notepad extends JPanel {
*/
private Component createToolbar() {
toolbar = new JToolBar();
- String[] toolKeys = tokenize(getResourceString("toolbar"));
- for (int i = 0; i < toolKeys.length; i++) {
- if (toolKeys[i].equals("-")) {
+ for (String toolKey: getToolBarKeys()) {
+ if (toolKey.equals("-")) {
toolbar.add(Box.createHorizontalStrut(5));
} else {
- toolbar.add(createTool(toolKeys[i]));
+ toolbar.add(createTool(toolKey));
}
}
toolbar.add(Box.createHorizontalGlue());
@@ -408,7 +337,7 @@ class Notepad extends JPanel {
b.setRequestFocusEnabled(false);
b.setMargin(new Insets(1, 1, 1, 1));
- String astr = getResourceString(key + actionSuffix);
+ String astr = getProperty(key + actionSuffix);
if (astr == null) {
astr = key;
}
@@ -428,44 +357,18 @@ class Notepad extends JPanel {
return b;
}
- /**
- * Take the given string and chop it up into a series
- * of strings on whitespace boundaries. This is useful
- * for trying to get an array of strings out of the
- * resource file.
- */
- protected String[] tokenize(String input) {
- List v = new ArrayList();
- StringTokenizer t = new StringTokenizer(input);
- String cmd[];
-
- while (t.hasMoreTokens()) {
- v.add(t.nextToken());
- }
- cmd = new String[v.size()];
- for (int i = 0; i < cmd.length; i++) {
- cmd[i] = v.get(i);
- }
-
- return cmd;
- }
-
/**
* Create the menubar for the app. By default this pulls the
* definition of the menu from the associated resource file.
*/
protected JMenuBar createMenubar() {
- JMenuItem mi;
JMenuBar mb = new JMenuBar();
-
- String[] menuKeys = tokenize(getResourceString("menubar"));
- for (int i = 0; i < menuKeys.length; i++) {
- JMenu m = createMenu(menuKeys[i]);
+ for(String menuKey: getMenuBarKeys()){
+ JMenu m = createMenu(menuKey);
if (m != null) {
mb.add(m);
}
}
- this.menubar = mb;
return mb;
}
@@ -474,19 +377,42 @@ class Notepad extends JPanel {
* definition of the menu from the associated resource file.
*/
protected JMenu createMenu(String key) {
- String[] itemKeys = tokenize(getResourceString(key));
- JMenu menu = new JMenu(getResourceString(key + "Label"));
- for (int i = 0; i < itemKeys.length; i++) {
- if (itemKeys[i].equals("-")) {
+ JMenu menu = new JMenu(getResourceString(key + labelSuffix));
+ for (String itemKey: getItemKeys(key)) {
+ if (itemKey.equals("-")) {
menu.addSeparator();
} else {
- JMenuItem mi = createMenuItem(itemKeys[i]);
+ JMenuItem mi = createMenuItem(itemKey);
menu.add(mi);
}
}
return menu;
}
+ /**
+ * Get keys for menus
+ */
+ protected String[] getItemKeys(String key) {
+ switch (key) {
+ case "file":
+ return FILE_KEYS;
+ case "edit":
+ return EDIT_KEYS;
+ case "debug":
+ return DEBUG_KEYS;
+ default:
+ return null;
+ }
+ }
+
+ protected String[] getMenuBarKeys() {
+ return MENUBAR_KEYS;
+ }
+
+ protected String[] getToolBarKeys() {
+ return TOOLBAR_KEYS;
+ }
+
// Yarked from JMenu, ideally this would be public.
protected PropertyChangeListener createActionChangeListener(JMenuItem b) {
return new ActionChangedListener(b);
@@ -516,13 +442,11 @@ class Notepad extends JPanel {
}
private JTextComponent editor;
private Map commands;
- private Map menuItems;
- private JMenuBar menubar;
private JToolBar toolbar;
private JComponent status;
private JFrame elementTreeFrame;
protected ElementTreePanel elementTreePanel;
- protected FileDialog fileDialog;
+
/**
* Listener for the edits on the current document.
*/
@@ -773,10 +697,6 @@ class Notepad extends JPanel {
super(showElementTreeAction);
}
- ShowElementTreeAction(String nm) {
- super(nm);
- }
-
public void actionPerformed(ActionEvent e) {
if (elementTreeFrame == null) {
// Create a frame containing an instance of
diff --git a/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties b/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties
index ef61d6fd3c4..d43e350942c 100644
--- a/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties
+++ b/jdk/src/share/demo/jfc/Notepad/resources/Notepad.properties
@@ -3,16 +3,6 @@
Title=Notepad
ElementTreeFrameTitle=Elements
-# The following string should NOT be translated: ViewportBackingStore
-ViewportBackingStore=false
-
-# menubar definition
-#
-# Each of the strings that follow form a key to be
-# used to the actual menu definition.
-
-# The following string should NOT be translated: menubar
-menubar=file edit debug
# file Menu definition
#
@@ -24,8 +14,6 @@ menubar=file edit debug
# save -> Notepad.saveAction
# exit -> Notepad.exitAction
-# The following string should NOT be translated: file
-file=new open save - exit
fileLabel=File
openLabel=Open
openImage=resources/open.gif
@@ -42,38 +30,22 @@ exitLabel=Exit
# copy -> JTextComponent.copyAction
# paste -> JTextComponent.pasteAction
-# The following string should NOT be translated: edit
-edit=cut copy paste - undo redo
editLabel=Edit
cutLabel=Cut
-# The following string should NOT be translated: cutAction
-cutAction=cut-to-clipboard
cutImage=resources/cut.gif
copyLabel=Copy
-# The following string should NOT be translated: copyAction
-copyAction=copy-to-clipboard
copyImage=resources/copy.gif
pasteLabel=Paste
-# The following string should NOT be translated: pasteAction
-pasteAction=paste-from-clipboard
pasteImage=resources/paste.gif
undoLabel=Undo
-# The following string should NOT be translated: undoAction
-undoAction=Undo
redoLabel=Redo
-# The following string should NOT be translated: redoAction
-redoAction=Redo
#
# debug Menu definition
#
-# The following string should NOT be translated: debug
-debug=dump showElementTree
debugLabel=Debug
dumpLabel=Dump model to System.err
-# The following string should NOT be translated: dumpAction
-dumpAction=dump-model
showElementTreeLabel=Show Elements
# toolbar definition
@@ -83,8 +55,6 @@ showElementTreeLabel=Show Elements
# are of course sharable, and in this case are shared
# with the menu items.
-# The following string should NOT be translated: toolbar
-toolbar=new open save - cut copy paste
newTooltip=Create a new file
openTooltip=Open a file
saveTooltip=Save to a file
diff --git a/jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties b/jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties
new file mode 100644
index 00000000000..a6f8786d099
--- /dev/null
+++ b/jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties
@@ -0,0 +1,12 @@
+#
+# Non-translatable properties for Notepad example
+
+ViewportBackingStore=false
+
+cutAction=cut-to-clipboard
+copyAction=copy-to-clipboard
+pasteAction=paste-from-clipboard
+undoAction=Undo
+redoAction=Redo
+dumpAction=dump-model
+
diff --git a/jdk/src/share/demo/management/MemoryMonitor/README.txt b/jdk/src/share/demo/management/MemoryMonitor/README.txt
index 9b264c7f18c..2009e1339e2 100644
--- a/jdk/src/share/demo/management/MemoryMonitor/README.txt
+++ b/jdk/src/share/demo/management/MemoryMonitor/README.txt
@@ -38,7 +38,7 @@ and plots the memory usage history graph.
To run the MemoryMonitor demo
- java -jar /demo/management/MemoryMonitor.jar
+ java -jar /demo/management/MemoryMonitor/MemoryMonitor.jar
These instructions assume that this installation's version of the java
command is in your path. If it isn't, then you should either
diff --git a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
index d68388a97f3..44d3e809993 100644
--- a/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
+++ b/jdk/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java
@@ -651,7 +651,11 @@ public class ZipFileSystem extends FileSystem {
}
public int read(ByteBuffer dst) throws IOException {
- return rbc.read(dst);
+ int n = rbc.read(dst);
+ if (n > 0) {
+ read += n;
+ }
+ return n;
}
public SeekableByteChannel truncate(long size)
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp
index 88955faec34..08cdc8d3e76 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -188,9 +188,13 @@ void band::setIndexByTag(byte tag) {
entry* band::getRefCommon(cpindex* ix_, bool nullOKwithCaller) {
CHECK_0;
assert(ix_->ixTag == ixTag
- || (ixTag == CONSTANT_Literal
- && ix_->ixTag >= CONSTANT_Integer
- && ix_->ixTag <= CONSTANT_String));
+ || ((ixTag == CONSTANT_All ||
+ ixTag == CONSTANT_LoadableValue ||
+ ixTag == CONSTANT_AnyMember)
+ || (ixTag == CONSTANT_FieldSpecific &&
+ ix_->ixTag >= CONSTANT_Integer &&
+ ix_->ixTag <= CONSTANT_String))
+ );
int n = vs[0].getInt() - nullOK;
// Note: band-local nullOK means null encodes as 0.
// But nullOKwithCaller means caller is willing to tolerate a null.
@@ -270,22 +274,15 @@ int band::getIntCount(int tag) {
#define NO_INDEX 0
struct band_init {
-#ifndef PRODUCT
int bn;
const char* name;
-#endif
int defc;
int index;
};
-#ifdef PRODUCT
-#define BAND_INIT(name, cspec, ix) \
- { cspec, ix }
-#else
#define BAND_INIT(name, cspec, ix) \
{ e_##name, #name, /*debug only*/ \
cspec, ix }
-#endif
const band_init all_band_inits[] = {
//BAND_INIT(archive_magic, BYTE1_spec, 0),
@@ -314,6 +311,14 @@ const band_init all_band_inits[] = {
BAND_INIT(cp_Method_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
BAND_INIT(cp_Imethod_class, DELTA5_spec, INDEX(CONSTANT_Class)),
BAND_INIT(cp_Imethod_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
+ BAND_INIT(cp_MethodHandle_refkind, DELTA5_spec, 0),
+ BAND_INIT(cp_MethodHandle_member, UDELTA5_spec, INDEX(CONSTANT_AnyMember)),
+ BAND_INIT(cp_MethodType, UDELTA5_spec, INDEX(CONSTANT_Signature)),
+ BAND_INIT(cp_BootstrapMethod_ref, DELTA5_spec, INDEX(CONSTANT_MethodHandle)),
+ BAND_INIT(cp_BootstrapMethod_arg_count, UDELTA5_spec, 0),
+ BAND_INIT(cp_BootstrapMethod_arg, DELTA5_spec, INDEX(CONSTANT_LoadableValue)),
+ BAND_INIT(cp_InvokeDynamic_spec, DELTA5_spec, INDEX(CONSTANT_BootstrapMethod)),
+ BAND_INIT(cp_InvokeDynamic_desc, UDELTA5_spec, INDEX(CONSTANT_NameandType)),
BAND_INIT(attr_definition_headers, BYTE1_spec, 0),
BAND_INIT(attr_definition_name, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
BAND_INIT(attr_definition_layout, UNSIGNED5_spec, INDEX(CONSTANT_Utf8)),
@@ -333,7 +338,7 @@ const band_init all_band_inits[] = {
BAND_INIT(field_attr_count, UNSIGNED5_spec, 0),
BAND_INIT(field_attr_indexes, UNSIGNED5_spec, 0),
BAND_INIT(field_attr_calls, UNSIGNED5_spec, 0),
- BAND_INIT(field_ConstantValue_KQ, UNSIGNED5_spec, INDEX(CONSTANT_Literal)),
+ BAND_INIT(field_ConstantValue_KQ, UNSIGNED5_spec, INDEX(CONSTANT_FieldSpecific)),
BAND_INIT(field_Signature_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)),
BAND_INIT(field_metadata_bands, -1, -1),
BAND_INIT(field_attr_bands, -1, -1),
@@ -415,10 +420,12 @@ const band_init all_band_inits[] = {
BAND_INIT(bc_longref, DELTA5_spec, INDEX(CONSTANT_Long)),
BAND_INIT(bc_doubleref, DELTA5_spec, INDEX(CONSTANT_Double)),
BAND_INIT(bc_stringref, DELTA5_spec, INDEX(CONSTANT_String)),
+ BAND_INIT(bc_loadablevalueref, DELTA5_spec, INDEX(CONSTANT_LoadableValue)),
BAND_INIT(bc_classref, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Class)),
BAND_INIT(bc_fieldref, DELTA5_spec, INDEX(CONSTANT_Fieldref)),
BAND_INIT(bc_methodref, UNSIGNED5_spec, INDEX(CONSTANT_Methodref)),
BAND_INIT(bc_imethodref, DELTA5_spec, INDEX(CONSTANT_InterfaceMethodref)),
+ BAND_INIT(bc_indyref, DELTA5_spec, INDEX(CONSTANT_InvokeDynamic)),
BAND_INIT(bc_thisfield, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Fieldref)),
BAND_INIT(bc_superfield, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Fieldref)),
BAND_INIT(bc_thismethod, UNSIGNED5_spec, SUB_INDEX(CONSTANT_Methodref)),
@@ -471,7 +478,7 @@ void band::initIndexes(unpacker* u) {
for (int i = 0; i < BAND_LIMIT; i++) {
band* scan = &tmp_all_bands[i];
uint tag = scan->ixTag; // Cf. #define INDEX(tag) above
- if (tag != 0 && tag != CONSTANT_Literal && (tag & SUBINDEX_BIT) == 0) {
+ if (tag != 0 && tag != CONSTANT_FieldSpecific && (tag & SUBINDEX_BIT) == 0) {
scan->setIndex(u->cp.getIndex(tag));
}
}
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/bands.h b/jdk/src/share/native/com/sun/java/util/jar/pack/bands.h
index 8e15dcb0111..b8e322aa1db 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/bands.h
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/bands.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,9 +29,7 @@ struct cpindex;
struct unpacker;
struct band {
-#ifndef PRODUCT
const char* name;
-#endif
int bn; // band_number of this band
coding* defc; // default coding method
cpindex* ix; // CP entry mapping, if CPRefBand
@@ -162,6 +160,14 @@ enum band_number {
e_cp_Method_desc,
e_cp_Imethod_class,
e_cp_Imethod_desc,
+ e_cp_MethodHandle_refkind,
+ e_cp_MethodHandle_member,
+ e_cp_MethodType,
+ e_cp_BootstrapMethod_ref,
+ e_cp_BootstrapMethod_arg_count,
+ e_cp_BootstrapMethod_arg,
+ e_cp_InvokeDynamic_spec,
+ e_cp_InvokeDynamic_desc,
// bands which define transmission of attributes
e_attr_definition_headers,
@@ -284,11 +290,13 @@ enum band_number {
e_bc_longref,
e_bc_doubleref,
e_bc_stringref,
+ e_bc_loadablevalueref,
e_bc_classref,
e_bc_fieldref,
e_bc_methodref,
e_bc_imethodref,
+ e_bc_indyref,
// _self_linker_op family
e_bc_thisfield,
@@ -343,6 +351,14 @@ enum band_number {
#define cp_Method_desc all_bands[e_cp_Method_desc]
#define cp_Imethod_class all_bands[e_cp_Imethod_class]
#define cp_Imethod_desc all_bands[e_cp_Imethod_desc]
+#define cp_MethodHandle_refkind all_bands[e_cp_MethodHandle_refkind]
+#define cp_MethodHandle_member all_bands[e_cp_MethodHandle_member]
+#define cp_MethodType all_bands[e_cp_MethodType]
+#define cp_BootstrapMethod_ref all_bands[e_cp_BootstrapMethod_ref]
+#define cp_BootstrapMethod_arg_count all_bands[e_cp_BootstrapMethod_arg_count]
+#define cp_BootstrapMethod_arg all_bands[e_cp_BootstrapMethod_arg]
+#define cp_InvokeDynamic_spec all_bands[e_cp_InvokeDynamic_spec]
+#define cp_InvokeDynamic_desc all_bands[e_cp_InvokeDynamic_desc]
#define attr_definition_headers all_bands[e_attr_definition_headers]
#define attr_definition_name all_bands[e_attr_definition_name]
#define attr_definition_layout all_bands[e_attr_definition_layout]
@@ -437,10 +453,12 @@ enum band_number {
#define bc_longref all_bands[e_bc_longref]
#define bc_doubleref all_bands[e_bc_doubleref]
#define bc_stringref all_bands[e_bc_stringref]
+#define bc_loadablevalueref all_bands[e_bc_loadablevalueref]
#define bc_classref all_bands[e_bc_classref]
#define bc_fieldref all_bands[e_bc_fieldref]
#define bc_methodref all_bands[e_bc_methodref]
#define bc_imethodref all_bands[e_bc_imethodref]
+#define bc_indyref all_bands[e_bc_indyref]
#define bc_thisfield all_bands[e_bc_thisfield]
#define bc_superfield all_bands[e_bc_superfield]
#define bc_thismethod all_bands[e_bc_thismethod]
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h b/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h
index 22a6b6c3e58..a3a8c553368 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,61 +49,82 @@
#define JAVA6_PACKAGE_MAJOR_VERSION 160
#define JAVA6_PACKAGE_MINOR_VERSION 1
+#define JAVA7_PACKAGE_MAJOR_VERSION 170
+#define JAVA7_PACKAGE_MINOR_VERSION 1
// magic number for gzip streams (for processing pack200-gzip data)
#define GZIP_MAGIC 0x1F8B0800
#define GZIP_MAGIC_MASK 0xFFFFFF00 // last byte is variable "flg" field
enum {
- CONSTANT_None,
- CONSTANT_Utf8,
- CONSTANT_unused2, /* unused, was Unicode */
- CONSTANT_Integer,
- CONSTANT_Float,
- CONSTANT_Long,
- CONSTANT_Double,
- CONSTANT_Class,
- CONSTANT_String,
- CONSTANT_Fieldref,
- CONSTANT_Methodref,
- CONSTANT_InterfaceMethodref,
- CONSTANT_NameandType,
+ CONSTANT_None = 0,
+ CONSTANT_Utf8 = 1,
+ CONSTANT_unused = 2, /* unused, was Unicode */
+ CONSTANT_Integer = 3,
+ CONSTANT_Float = 4,
+ CONSTANT_Long = 5,
+ CONSTANT_Double = 6,
+ CONSTANT_Class = 7,
+ CONSTANT_String = 8,
+ CONSTANT_Fieldref = 9,
+ CONSTANT_Methodref = 10,
+ CONSTANT_InterfaceMethodref = 11,
+ CONSTANT_NameandType = 12,
+ CONSTANT_unused13 = 13,
+ CONSTANT_unused14 = 14,
+ CONSTANT_MethodHandle = 15,
+ CONSTANT_MethodType = 16,
+ CONSTANT_unused17 = 17,
+ CONSTANT_InvokeDynamic = 18,
+ CONSTANT_Limit = 19,
+ CONSTANT_Signature = CONSTANT_unused13,
+ CONSTANT_BootstrapMethod = CONSTANT_unused17, // used only for InvokeDynamic
+ CONSTANT_All = 50, // combined global map
+ CONSTANT_LoadableValue = 51, // used for 'KL' and qldc operands
+ CONSTANT_AnyMember = 52, // union of refs to field or (interface) method
+ CONSTANT_FieldSpecific = 53, // used only for 'KQ' ConstantValue attrs
+ CONSTANT_GroupFirst = CONSTANT_All, // start group marker
+ CONSTANT_GroupLimit = 54, // end group marker
- CONSTANT_Signature = 13,
- CONSTANT_All = 14,
- CONSTANT_Limit = 15,
- CONSTANT_NONE = 0,
-
- CONSTANT_Literal = 20, //pseudo-tag for debugging
- CONSTANT_Member = 21, //pseudo-tag for debugging
+ // CONSTANT_MethodHandle reference kinds
+ REF_getField = 1,
+ REF_getStatic = 2,
+ REF_putField = 3,
+ REF_putStatic = 4,
+ REF_invokeVirtual = 5,
+ REF_invokeStatic = 6,
+ REF_invokeSpecial = 7,
+ REF_newInvokeSpecial = 8,
+ REF_invokeInterface = 9,
SUBINDEX_BIT = 64, // combined with CONSTANT_xxx for ixTag
ACC_STATIC = 0x0008,
ACC_IC_LONG_FORM = (1<<16), //for ic_flags
- CLASS_ATTR_SourceFile = 17,
- CLASS_ATTR_EnclosingMethod = 18,
- CLASS_ATTR_InnerClasses = 23,
- CLASS_ATTR_ClassFile_version = 24,
- FIELD_ATTR_ConstantValue = 17,
- METHOD_ATTR_Code = 17,
- METHOD_ATTR_Exceptions = 18,
- METHOD_ATTR_RuntimeVisibleParameterAnnotations = 23,
+ CLASS_ATTR_SourceFile = 17,
+ CLASS_ATTR_EnclosingMethod = 18,
+ CLASS_ATTR_InnerClasses = 23,
+ CLASS_ATTR_ClassFile_version = 24,
+ CLASS_ATTR_BootstrapMethods = 25,
+ FIELD_ATTR_ConstantValue = 17,
+ METHOD_ATTR_Code = 17,
+ METHOD_ATTR_Exceptions = 18,
+ METHOD_ATTR_RuntimeVisibleParameterAnnotations = 23,
METHOD_ATTR_RuntimeInvisibleParameterAnnotations = 24,
- METHOD_ATTR_AnnotationDefault = 25,
- CODE_ATTR_StackMapTable = 0,
- CODE_ATTR_LineNumberTable = 1,
- CODE_ATTR_LocalVariableTable = 2,
+ METHOD_ATTR_AnnotationDefault = 25,
+ CODE_ATTR_StackMapTable = 0,
+ CODE_ATTR_LineNumberTable = 1,
+ CODE_ATTR_LocalVariableTable = 2,
CODE_ATTR_LocalVariableTypeTable = 3,
//X_ATTR_Synthetic = 12, // ACC_SYNTHETIC; not predefined
- X_ATTR_Signature = 19,
- X_ATTR_Deprecated = 20,
- X_ATTR_RuntimeVisibleAnnotations = 21,
+ X_ATTR_Signature = 19,
+ X_ATTR_Deprecated = 20,
+ X_ATTR_RuntimeVisibleAnnotations = 21,
X_ATTR_RuntimeInvisibleAnnotations = 22,
- X_ATTR_OVERFLOW = 16,
- X_ATTR_LIMIT_NO_FLAGS_HI = 32,
- X_ATTR_LIMIT_FLAGS_HI = 63,
+ X_ATTR_OVERFLOW = 16,
+ X_ATTR_LIMIT_NO_FLAGS_HI = 32,
+ X_ATTR_LIMIT_FLAGS_HI = 63,
#define O_ATTR_DO(F) \
F(X_ATTR_OVERFLOW,01) \
@@ -121,6 +142,7 @@ enum {
F(CLASS_ATTR_InnerClasses,InnerClasses) \
F(CLASS_ATTR_EnclosingMethod,EnclosingMethod) \
F(CLASS_ATTR_ClassFile_version,02) \
+ F(CLASS_ATTR_BootstrapMethods,BootstrapMethods) \
/*(end)*/
#define FIELD_ATTR_DO(F) \
F(FIELD_ATTR_ConstantValue,ConstantValue) \
@@ -175,7 +197,7 @@ enum {
AO_HAVE_SPECIAL_FORMATS = 1<<0,
AO_HAVE_CP_NUMBERS = 1<<1,
AO_HAVE_ALL_CODE_FLAGS = 1<<2,
- AO_3_UNUSED_MBZ = 1<<3,
+ AO_HAVE_CP_EXTRAS = 1<<3,
AO_HAVE_FILE_HEADERS = 1<<4,
AO_DEFLATE_HINT = 1<<5,
AO_HAVE_FILE_MODTIME = 1<<6,
@@ -185,11 +207,13 @@ enum {
AO_HAVE_FIELD_FLAGS_HI = 1<<10,
AO_HAVE_METHOD_FLAGS_HI = 1<<11,
AO_HAVE_CODE_FLAGS_HI = 1<<12,
+ AO_UNUSED_MBZ = (-1)<<13, // options bits reserved for future use.
+
#define ARCHIVE_BIT_DO(F) \
F(AO_HAVE_SPECIAL_FORMATS) \
F(AO_HAVE_CP_NUMBERS) \
F(AO_HAVE_ALL_CODE_FLAGS) \
- /*F(AO_3_UNUSED_MBZ)*/ \
+ F(AO_HAVE_CP_EXTRAS) \
F(AO_HAVE_FILE_HEADERS) \
F(AO_DEFLATE_HINT) \
F(AO_HAVE_FILE_MODTIME) \
@@ -215,14 +239,14 @@ enum {
NO_MODTIME = 0, // null modtime value
// meta-coding
- _meta_default = 0,
+ _meta_default = 0,
_meta_canon_min = 1,
_meta_canon_max = 115,
- _meta_arb = 116,
- _meta_run = 117,
- _meta_pop = 141,
- _meta_limit = 189,
- _meta_error = 255,
+ _meta_arb = 116,
+ _meta_run = 117,
+ _meta_pop = 141,
+ _meta_limit = 189,
+ _meta_error = 255,
_xxx_1_end
};
@@ -416,7 +440,7 @@ enum {
bc_invokespecial = 183, // 0xb7
bc_invokestatic = 184, // 0xb8
bc_invokeinterface = 185, // 0xb9
- bc_xxxunusedxxx = 186, // 0xba
+ bc_invokedynamic = 186, // 0xba
bc_new = 187, // 0xbb
bc_newarray = 188, // 0xbc
bc_anewarray = 189, // 0xbd
@@ -455,17 +479,19 @@ enum {
_invokeinit_limit = _invokeinit_op+3,
_xldc_op = _invokeinit_limit,
- bc_aldc = bc_ldc,
+ bc_sldc = bc_ldc, // previously named bc_aldc
bc_cldc = _xldc_op+0,
bc_ildc = _xldc_op+1,
bc_fldc = _xldc_op+2,
- bc_aldc_w = bc_ldc_w,
+ bc_sldc_w = bc_ldc_w, // previously named bc_aldc_w
bc_cldc_w = _xldc_op+3,
bc_ildc_w = _xldc_op+4,
bc_fldc_w = _xldc_op+5,
bc_lldc2_w = bc_ldc2_w,
bc_dldc2_w = _xldc_op+6,
- _xldc_limit = _xldc_op+7,
-
+ // anything other primitive, string, or class must be handled with qldc:
+ bc_qldc = _xldc_op+7,
+ bc_qldc_w = _xldc_op+8,
+ _xldc_limit = _xldc_op+9,
_xxx_3_end
};
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h b/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
index e49cade19b8..7fe36ffe576 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -109,7 +109,8 @@ typedef DWORDLONG julong;
#define dup2(a,b) _dup2(a,b)
#define strcasecmp(s1, s2) _stricmp(s1,s2)
#define tempname _tempname
-#define sleep Sleep
+#define sleep Sleep
+#define snprintf _snprintf
#else
typedef signed char byte;
#ifdef _LP64
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
index e77e99f33c5..bedecda5391 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,11 @@ static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
static unpacker* get_unpacker() {
//fprintf(stderr, "get_unpacker()\n");
JavaVM* vm = null;
- JNI_GetCreatedJavaVMs(&vm, 1, null);
+ jsize nVM = 0;
+ jint retval = JNI_GetCreatedJavaVMs(&vm, 1, &nVM);
+ // other VM implements may differ, thus for correctness, we need these checks
+ if (retval != JNI_OK || nVM != 1)
+ return null;
void* envRaw = null;
vm->GetEnv(&envRaw, JNI_VERSION_1_1);
JNIEnv* env = (JNIEnv*) envRaw;
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
index cee146d4db4..d7c51978ded 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,12 @@ static const byte TAGS_IN_ORDER[] = {
CONSTANT_NameandType,
CONSTANT_Fieldref,
CONSTANT_Methodref,
- CONSTANT_InterfaceMethodref
+ CONSTANT_InterfaceMethodref,
+ // constants defined as of JDK 7
+ CONSTANT_MethodHandle,
+ CONSTANT_MethodType,
+ CONSTANT_BootstrapMethod,
+ CONSTANT_InvokeDynamic
};
#define N_TAGS_IN_ORDER (sizeof TAGS_IN_ORDER)
@@ -101,6 +106,11 @@ static const char* TAG_NAME[] = {
"InterfaceMethodref",
"NameandType",
"*Signature",
+ "unused14",
+ "MethodHandle",
+ "MethodType",
+ "*BootstrapMethod",
+ "InvokeDynamic",
0
};
@@ -114,9 +124,13 @@ static const char* ATTR_CONTEXT_NAME[] = { // match ATTR_CONTEXT_NAME, etc.
#endif
-
-// REQUESTED must be -2 for u2 and REQUESTED_LDC must be -1 for u1
-enum { NOT_REQUESTED = 0, REQUESTED = -2, REQUESTED_LDC = -1 };
+// Note that REQUESTED_LDC comes first, then the normal REQUESTED,
+// in the regular constant pool.
+enum { REQUESTED_NONE = -1,
+ // The codes below REQUESTED_NONE are in constant pool output order,
+ // for the sake of outputEntry_cmp:
+ REQUESTED_LDC = -99, REQUESTED
+};
#define NO_INORD ((uint)-1)
@@ -146,7 +160,7 @@ struct entry {
void requestOutputIndex(cpool& cp, int req = REQUESTED);
int getOutputIndex() {
- assert(outputIndex > NOT_REQUESTED);
+ assert(outputIndex > REQUESTED_NONE);
return outputIndex;
}
@@ -167,12 +181,12 @@ struct entry {
}
entry* memberClass() {
- assert(tagMatches(CONSTANT_Member));
+ assert(tagMatches(CONSTANT_AnyMember));
return ref(0);
}
entry* memberDescr() {
- assert(tagMatches(CONSTANT_Member));
+ assert(tagMatches(CONSTANT_AnyMember));
return ref(1);
}
@@ -199,9 +213,9 @@ struct entry {
return (tag2 == tag)
|| (tag2 == CONSTANT_Utf8 && tag == CONSTANT_Signature)
#ifndef PRODUCT
- || (tag2 == CONSTANT_Literal
+ || (tag2 == CONSTANT_FieldSpecific
&& tag >= CONSTANT_Integer && tag <= CONSTANT_String && tag != CONSTANT_Class)
- || (tag2 == CONSTANT_Member
+ || (tag2 == CONSTANT_AnyMember
&& tag >= CONSTANT_Fieldref && tag <= CONSTANT_InterfaceMethodref)
#endif
;
@@ -309,6 +323,7 @@ void unpacker::free() {
code_fixup_offset.free();
code_fixup_source.free();
requested_ics.free();
+ cp.requested_bsms.free();
cur_classfile_head.free();
cur_classfile_tail.free();
for (i = 0; i < ATTR_CONTEXT_LIMIT; i++)
@@ -448,12 +463,12 @@ maybe_inline
int unpacker::putref_index(entry* e, int size) {
if (e == null)
return 0;
- else if (e->outputIndex > NOT_REQUESTED)
+ else if (e->outputIndex > REQUESTED_NONE)
return e->outputIndex;
else if (e->tag == CONSTANT_Signature)
return putref_index(e->ref(0), size);
else {
- e->requestOutputIndex(cp, -size);
+ e->requestOutputIndex(cp, (size == 1 ? REQUESTED_LDC : REQUESTED));
// Later on we'll fix the bits.
class_fixup_type.addByte(size);
class_fixup_offset.add((int)wpoffset());
@@ -515,28 +530,33 @@ void unpacker::saveTo(bytes& b, byte* ptr, size_t len) {
b.copyFrom(ptr, len);
}
+bool testBit(int archive_options, int bitMask) {
+ return (archive_options & bitMask) != 0;
+}
+
// Read up through band_headers.
// Do the archive_size dance to set the size of the input mega-buffer.
void unpacker::read_file_header() {
// Read file header to determine file type and total size.
enum {
MAGIC_BYTES = 4,
- AH_LENGTH_0 = 3, //minver, majver, options are outside of archive_size
+ AH_LENGTH_0 = 3, // archive_header_0 = {minver, majver, options}
+ AH_LENGTH_MIN = 15, // observed in spec {header_0[3], cp_counts[8], class_counts[4]}
AH_LENGTH_0_MAX = AH_LENGTH_0 + 1, // options might have 2 bytes
- AH_LENGTH = 26, //maximum archive header length (w/ all fields)
+ AH_LENGTH = 30, //maximum archive header length (w/ all fields)
// Length contributions from optional header fields:
- AH_FILE_HEADER_LEN = 5, // sizehi/lo/next/modtime/files
- AH_ARCHIVE_SIZE_LEN = 2, // sizehi/lo only; part of AH_FILE_HEADER_LEN
- AH_CP_NUMBER_LEN = 4, // int/float/long/double
- AH_SPECIAL_FORMAT_LEN = 2, // layouts/band-headers
- AH_LENGTH_MIN = AH_LENGTH
- -(AH_FILE_HEADER_LEN+AH_SPECIAL_FORMAT_LEN+AH_CP_NUMBER_LEN),
- ARCHIVE_SIZE_MIN = AH_LENGTH_MIN - (AH_LENGTH_0 + AH_ARCHIVE_SIZE_LEN),
+ AH_LENGTH_S = 2, // archive_header_S = optional {size_hi, size_lo}
+ AH_ARCHIVE_SIZE_HI = 0, // offset in archive_header_S
+ AH_ARCHIVE_SIZE_LO = 1, // offset in archive_header_S
+ AH_FILE_HEADER_LEN = 5, // file_counts = {{size_hi, size_lo), next, modtile, files}
+ AH_SPECIAL_FORMAT_LEN = 2, // special_count = {layouts, band_headers}
+ AH_CP_NUMBER_LEN = 4, // cp_number_counts = {int, float, long, double}
+ AH_CP_EXTRA_LEN = 4, // cp_attr_counts = {MH, MT, InDy, BSM}
+ ARCHIVE_SIZE_MIN = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S,
FIRST_READ = MAGIC_BYTES + AH_LENGTH_MIN
};
assert(AH_LENGTH_MIN == 15); // # of UNSIGNED5 fields required after archive_magic
- assert(ARCHIVE_SIZE_MIN == 10); // # of UNSIGNED5 fields required after archive_size
// An absolute minimum null archive is magic[4], {minver,majver,options}[3],
// archive_size[0], cp_counts[8], class_counts[4], for a total of 19 bytes.
// (Note that archive_size is optional; it may be 0..10 bytes in length.)
@@ -622,23 +642,32 @@ void unpacker::read_file_header() {
// Read the first 3 values from the header.
value_stream hdr;
int hdrVals = 0;
- int hdrValsSkipped = 0; // debug only
+ int hdrValsSkipped = 0; // for assert
hdr.init(rp, rplimit, UNSIGNED5_spec);
minver = hdr.getInt();
majver = hdr.getInt();
hdrVals += 2;
- if (magic != (int)JAVA_PACKAGE_MAGIC ||
- (majver != JAVA5_PACKAGE_MAJOR_VERSION &&
- majver != JAVA6_PACKAGE_MAJOR_VERSION) ||
- (minver != JAVA5_PACKAGE_MINOR_VERSION &&
- minver != JAVA6_PACKAGE_MINOR_VERSION)) {
+ int majmin[3][2] = {
+ {JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION},
+ {JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION},
+ {JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION}
+ };
+ int majminfound = false;
+ for (int i = 0 ; i < 3 ; i++) {
+ if (majver == majmin[i][0] && minver == majmin[i][1]) {
+ majminfound = true;
+ break;
+ }
+ }
+ if (majminfound == null) {
char message[200];
sprintf(message, "@" ERROR_FORMAT ": magic/ver = "
- "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d\n",
+ "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d\n",
magic, majver, minver,
JAVA_PACKAGE_MAGIC, JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION,
- JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION);
+ JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION,
+ JAVA_PACKAGE_MAGIC, JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION);
abort(message);
}
CHECK;
@@ -646,18 +675,26 @@ void unpacker::read_file_header() {
archive_options = hdr.getInt();
hdrVals += 1;
assert(hdrVals == AH_LENGTH_0); // first three fields only
+ bool haveSizeHi = testBit(archive_options, AO_HAVE_FILE_SIZE_HI);
+ bool haveModTime = testBit(archive_options, AO_HAVE_FILE_MODTIME);
+ bool haveFileOpt = testBit(archive_options, AO_HAVE_FILE_OPTIONS);
-#define ORBIT(bit) |(bit)
- int OPTION_LIMIT = (0 ARCHIVE_BIT_DO(ORBIT));
-#undef ORBIT
- if ((archive_options & ~OPTION_LIMIT) != 0) {
- fprintf(errstrm, "Warning: Illegal archive options 0x%x\n",
- archive_options);
- abort("illegal archive options");
+ bool haveSpecial = testBit(archive_options, AO_HAVE_SPECIAL_FORMATS);
+ bool haveFiles = testBit(archive_options, AO_HAVE_FILE_HEADERS);
+ bool haveNumbers = testBit(archive_options, AO_HAVE_CP_NUMBERS);
+ bool haveCPExtra = testBit(archive_options, AO_HAVE_CP_EXTRAS);
+
+ if (majver < JAVA7_PACKAGE_MAJOR_VERSION) {
+ if (haveCPExtra) {
+ abort("Format bits for Java 7 must be zero in previous releases");
+ return;
+ }
+ }
+ if (testBit(archive_options, AO_UNUSED_MBZ)) {
+ abort("High archive option bits are reserved and must be zero");
return;
}
-
- if ((archive_options & AO_HAVE_FILE_HEADERS) != 0) {
+ if (haveFiles) {
uint hi = hdr.getInt();
uint lo = hdr.getInt();
julong x = band::makeLong(hi, lo);
@@ -738,13 +775,23 @@ void unpacker::read_file_header() {
return;
}
- // read the rest of the header fields
- ensure_input((AH_LENGTH-AH_LENGTH_0) * B_MAX);
+ // read the rest of the header fields int assertSkipped = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S;
+ int remainingHeaders = AH_LENGTH_MIN - AH_LENGTH_0 - AH_LENGTH_S;
+ if (haveSpecial)
+ remainingHeaders += AH_SPECIAL_FORMAT_LEN;
+ if (haveFiles)
+ remainingHeaders += AH_FILE_HEADER_LEN;
+ if (haveNumbers)
+ remainingHeaders += AH_CP_NUMBER_LEN;
+ if (haveCPExtra)
+ remainingHeaders += AH_CP_EXTRA_LEN;
+
+ ensure_input(remainingHeaders * B_MAX);
CHECK;
hdr.rp = rp;
hdr.rplimit = rplimit;
- if ((archive_options & AO_HAVE_FILE_HEADERS) != 0) {
+ if (haveFiles) {
archive_next_count = hdr.getInt();
CHECK_COUNT(archive_next_count);
archive_modtime = hdr.getInt();
@@ -755,7 +802,7 @@ void unpacker::read_file_header() {
hdrValsSkipped += 3;
}
- if ((archive_options & AO_HAVE_SPECIAL_FORMATS) != 0) {
+ if (haveSpecial) {
band_headers_size = hdr.getInt();
CHECK_COUNT(band_headers_size);
attr_definition_count = hdr.getInt();
@@ -767,7 +814,7 @@ void unpacker::read_file_header() {
int cp_counts[N_TAGS_IN_ORDER];
for (int k = 0; k < (int)N_TAGS_IN_ORDER; k++) {
- if (!(archive_options & AO_HAVE_CP_NUMBERS)) {
+ if (!haveNumbers) {
switch (TAGS_IN_ORDER[k]) {
case CONSTANT_Integer:
case CONSTANT_Float:
@@ -778,6 +825,17 @@ void unpacker::read_file_header() {
continue;
}
}
+ if (!haveCPExtra) {
+ switch(TAGS_IN_ORDER[k]) {
+ case CONSTANT_MethodHandle:
+ case CONSTANT_MethodType:
+ case CONSTANT_InvokeDynamic:
+ case CONSTANT_BootstrapMethod:
+ cp_counts[k] = 0;
+ hdrValsSkipped += 1;
+ continue;
+ }
+ }
cp_counts[k] = hdr.getInt();
CHECK_COUNT(cp_counts[k]);
hdrVals += 1;
@@ -791,36 +849,26 @@ void unpacker::read_file_header() {
CHECK_COUNT(class_count);
hdrVals += 4;
- // done with archive_header
+ // done with archive_header, time to reconcile to ensure
+ // we have read everything correctly
hdrVals += hdrValsSkipped;
assert(hdrVals == AH_LENGTH);
-#ifndef PRODUCT
- int assertSkipped = AH_LENGTH - AH_LENGTH_MIN;
- if ((archive_options & AO_HAVE_FILE_HEADERS) != 0)
- assertSkipped -= AH_FILE_HEADER_LEN;
- if ((archive_options & AO_HAVE_SPECIAL_FORMATS) != 0)
- assertSkipped -= AH_SPECIAL_FORMAT_LEN;
- if ((archive_options & AO_HAVE_CP_NUMBERS) != 0)
- assertSkipped -= AH_CP_NUMBER_LEN;
- assert(hdrValsSkipped == assertSkipped);
-#endif //PRODUCT
-
rp = hdr.rp;
if (rp > rplimit)
abort("EOF reading archive header");
// Now size the CP.
#ifndef PRODUCT
- bool x = (N_TAGS_IN_ORDER == cpool::NUM_COUNTS);
- assert(x);
+ // bool x = (N_TAGS_IN_ORDER == CONSTANT_Limit);
+ // assert(x);
#endif //PRODUCT
cp.init(this, cp_counts);
CHECK;
default_file_modtime = archive_modtime;
- if (default_file_modtime == 0 && !(archive_options & AO_HAVE_FILE_MODTIME))
+ if (default_file_modtime == 0 && haveModTime)
default_file_modtime = DEFAULT_ARCHIVE_MODTIME; // taken from driver
- if ((archive_options & AO_DEFLATE_HINT) != 0)
+ if (testBit(archive_options, AO_DEFLATE_HINT))
default_file_options |= FO_DEFLATE_HINT;
// meta-bytes, if any, immediately follow archive header
@@ -876,7 +924,7 @@ void unpacker::finish() {
// Cf. PackageReader.readConstantPoolCounts
-void cpool::init(unpacker* u_, int counts[NUM_COUNTS]) {
+void cpool::init(unpacker* u_, int counts[CONSTANT_Limit]) {
this->u = u_;
// Fill-pointer for CP.
@@ -924,13 +972,16 @@ void cpool::init(unpacker* u_, int counts[NUM_COUNTS]) {
first_extra_entry = &entries[nentries];
// Initialize the standard indexes.
- tag_count[CONSTANT_All] = nentries;
- tag_base[ CONSTANT_All] = 0;
for (int tag = 0; tag < CONSTANT_Limit; tag++) {
entry* cpMap = &entries[tag_base[tag]];
tag_index[tag].init(tag_count[tag], cpMap, tag);
}
+ // Initialize *all* our entries once
+ for (int i = 0 ; i < maxentries ; i++)
+ entries[i].outputIndex = REQUESTED_NONE;
+
+ initGroupIndexes();
// Initialize hashTab to a generous power-of-two size.
uint pow2 = 1;
uint target = maxentries + maxentries/2; // 60% full
@@ -1281,6 +1332,70 @@ void unpacker::read_signature_values(entry* cpMap, int len) {
//cp_Signature_classes.done();
}
+maybe_inline
+void unpacker::checkLegacy(const char* name) {
+ if (u->majver < JAVA7_PACKAGE_MAJOR_VERSION) {
+ char message[100];
+ snprintf(message, 99, "unexpected band %s\n", name);
+ abort(message);
+ }
+}
+
+maybe_inline
+void unpacker::read_method_handle(entry* cpMap, int len) {
+ if (len > 0) {
+ checkLegacy(cp_MethodHandle_refkind.name);
+ }
+ cp_MethodHandle_refkind.readData(len);
+ cp_MethodHandle_member.setIndexByTag(CONSTANT_AnyMember);
+ cp_MethodHandle_member.readData(len);
+ for (int i = 0 ; i < len ; i++) {
+ entry& e = cpMap[i];
+ e.value.i = cp_MethodHandle_refkind.getInt();
+ e.refs = U_NEW(entry*, e.nrefs = 1);
+ e.refs[0] = cp_MethodHandle_member.getRef();
+ CHECK;
+ }
+}
+
+maybe_inline
+void unpacker::read_method_type(entry* cpMap, int len) {
+ if (len > 0) {
+ checkLegacy(cp_MethodType.name);
+ }
+ cp_MethodType.setIndexByTag(CONSTANT_Signature);
+ cp_MethodType.readData(len);
+ for (int i = 0 ; i < len ; i++) {
+ entry& e = cpMap[i];
+ e.refs = U_NEW(entry*, e.nrefs = 1);
+ e.refs[0] = cp_MethodType.getRef();
+ }
+}
+
+maybe_inline
+void unpacker::read_bootstrap_methods(entry* cpMap, int len) {
+ if (len > 0) {
+ checkLegacy(cp_BootstrapMethod_ref.name);
+ }
+ cp_BootstrapMethod_ref.setIndexByTag(CONSTANT_MethodHandle);
+ cp_BootstrapMethod_ref.readData(len);
+
+ cp_BootstrapMethod_arg_count.readData(len);
+ int totalArgCount = cp_BootstrapMethod_arg_count.getIntTotal();
+ cp_BootstrapMethod_arg.setIndexByTag(CONSTANT_LoadableValue);
+ cp_BootstrapMethod_arg.readData(totalArgCount);
+ for (int i = 0; i < len; i++) {
+ entry& e = cpMap[i];
+ int argc = cp_BootstrapMethod_arg_count.getInt();
+ e.value.i = argc;
+ e.refs = U_NEW(entry*, e.nrefs = argc + 1);
+ e.refs[0] = cp_BootstrapMethod_ref.getRef();
+ for (int j = 1 ; j < e.nrefs ; j++) {
+ e.refs[j] = cp_BootstrapMethod_arg.getRef();
+ CHECK;
+ }
+ }
+}
// Cf. PackageReader.readConstantPool
void unpacker::read_cp() {
byte* rp0 = rp;
@@ -1298,6 +1413,14 @@ void unpacker::read_cp() {
cpMap[i].tag = tag;
cpMap[i].inord = i;
}
+ // Initialize the tag's CP index right away, since it might be needed
+ // in the next pass to initialize the CP for another tag.
+#ifndef PRODUCT
+ cpindex* ix = &cp.tag_index[tag];
+ assert(ix->ixTag == tag);
+ assert((int)ix->len == len);
+ assert(ix->base1 == cpMap);
+#endif
switch (tag) {
case CONSTANT_Utf8:
@@ -1344,19 +1467,27 @@ void unpacker::read_cp() {
CONSTANT_Class, CONSTANT_NameandType,
cpMap, len);
break;
+ case CONSTANT_MethodHandle:
+ // consumes cp_MethodHandle_refkind and cp_MethodHandle_member
+ read_method_handle(cpMap, len);
+ break;
+ case CONSTANT_MethodType:
+ // consumes cp_MethodType
+ read_method_type(cpMap, len);
+ break;
+ case CONSTANT_InvokeDynamic:
+ read_double_refs(cp_InvokeDynamic_spec, CONSTANT_BootstrapMethod,
+ CONSTANT_NameandType,
+ cpMap, len);
+ break;
+ case CONSTANT_BootstrapMethod:
+ // consumes cp_BootstrapMethod_ref, cp_BootstrapMethod_arg_count and cp_BootstrapMethod_arg
+ read_bootstrap_methods(cpMap, len);
+ break;
default:
assert(false);
break;
}
-
- // Initialize the tag's CP index right away, since it might be needed
- // in the next pass to initialize the CP for another tag.
-#ifndef PRODUCT
- cpindex* ix = &cp.tag_index[tag];
- assert(ix->ixTag == tag);
- assert((int)ix->len == len);
- assert(ix->base1 == cpMap);
-#endif
CHECK;
}
@@ -1791,7 +1922,12 @@ unpacker::attr_definitions::parseLayout(const char* lp, band** &res,
case 'F': ixTag = CONSTANT_Float; break;
case 'D': ixTag = CONSTANT_Double; break;
case 'S': ixTag = CONSTANT_String; break;
- case 'Q': ixTag = CONSTANT_Literal; break;
+ case 'Q': ixTag = CONSTANT_FieldSpecific; break;
+
+ // new in 1.7
+ case 'M': ixTag = CONSTANT_MethodHandle; break;
+ case 'T': ixTag = CONSTANT_MethodType; break;
+ case 'L': ixTag = CONSTANT_LoadableValue; break;
}
} else {
switch (*lp++) {
@@ -1803,6 +1939,11 @@ unpacker::attr_definitions::parseLayout(const char* lp, band** &res,
case 'I': ixTag = CONSTANT_InterfaceMethodref; break;
case 'U': ixTag = CONSTANT_Utf8; break; //utf8_ref
case 'Q': ixTag = CONSTANT_All; break; //untyped_ref
+
+ // new in 1.7
+ case 'Y': ixTag = CONSTANT_InvokeDynamic; break;
+ case 'B': ixTag = CONSTANT_BootstrapMethod; break;
+ case 'N': ixTag = CONSTANT_AnyMember; break;
}
}
if (ixTag == CONSTANT_None) {
@@ -1873,13 +2014,13 @@ void unpacker::read_attr_defs() {
// Decide whether bands for the optional high flag words are present.
attr_defs[ATTR_CONTEXT_CLASS]
- .setHaveLongFlags((archive_options & AO_HAVE_CLASS_FLAGS_HI) != 0);
+ .setHaveLongFlags(testBit(archive_options, AO_HAVE_CLASS_FLAGS_HI));
attr_defs[ATTR_CONTEXT_FIELD]
- .setHaveLongFlags((archive_options & AO_HAVE_FIELD_FLAGS_HI) != 0);
+ .setHaveLongFlags(testBit(archive_options, AO_HAVE_FIELD_FLAGS_HI));
attr_defs[ATTR_CONTEXT_METHOD]
- .setHaveLongFlags((archive_options & AO_HAVE_METHOD_FLAGS_HI) != 0);
+ .setHaveLongFlags(testBit(archive_options, AO_HAVE_METHOD_FLAGS_HI));
attr_defs[ATTR_CONTEXT_CODE]
- .setHaveLongFlags((archive_options & AO_HAVE_CODE_FLAGS_HI) != 0);
+ .setHaveLongFlags(testBit(archive_options, AO_HAVE_CODE_FLAGS_HI));
// Set up built-in attrs.
// (The simple ones are hard-coded. The metadata layouts are not.)
@@ -2579,7 +2720,7 @@ void unpacker::putlayout(band** body) {
// It has data, so unparse an element.
if (b.ixTag != CONSTANT_None) {
assert(le_kind == EK_REF);
- if (b.ixTag == CONSTANT_Literal)
+ if (b.ixTag == CONSTANT_FieldSpecific)
e = b.getRefUsing(cp.getKQIndex());
else
e = b.getRefN();
@@ -2653,13 +2794,13 @@ void unpacker::putlayout(band** body) {
void unpacker::read_files() {
file_name.readData(file_count);
- if ((archive_options & AO_HAVE_FILE_SIZE_HI) != 0)
+ if (testBit(archive_options, AO_HAVE_FILE_SIZE_HI))
file_size_hi.readData(file_count);
file_size_lo.readData(file_count);
- if ((archive_options & AO_HAVE_FILE_MODTIME) != 0)
+ if (testBit(archive_options, AO_HAVE_FILE_MODTIME))
file_modtime.readData(file_count);
int allFiles = file_count + class_count;
- if ((archive_options & AO_HAVE_FILE_OPTIONS) != 0) {
+ if (testBit(archive_options, AO_HAVE_FILE_OPTIONS)) {
file_options.readData(file_count);
// FO_IS_CLASS_STUB might be set, causing overlap between classes and files
for (int i = 0; i < file_count; i++) {
@@ -2703,7 +2844,7 @@ void unpacker::get_code_header(int& max_stack,
max_stack = sc % mod;
max_na_locals = sc / mod; // caller must add static, siglen
handler_count = nh;
- if ((archive_options & AO_HAVE_ALL_CODE_FLAGS) != 0)
+ if (testBit(archive_options, AO_HAVE_ALL_CODE_FLAGS))
cflags = -1;
else
cflags = 0; // this one has no attributes
@@ -2777,12 +2918,14 @@ band* unpacker::ref_band_for_op(int bc) {
return &bc_longref;
case bc_dldc2_w:
return &bc_doubleref;
- case bc_aldc:
- case bc_aldc_w:
+ case bc_sldc:
+ case bc_sldc_w:
return &bc_stringref;
case bc_cldc:
case bc_cldc_w:
return &bc_classref;
+ case bc_qldc: case bc_qldc_w:
+ return &bc_loadablevalueref;
case bc_getstatic:
case bc_putstatic:
@@ -2796,6 +2939,8 @@ band* unpacker::ref_band_for_op(int bc) {
return &bc_methodref;
case bc_invokeinterface:
return &bc_imethodref;
+ case bc_invokedynamic:
+ return &bc_indyref;
case bc_new:
case bc_anewarray:
@@ -3131,6 +3276,71 @@ void cpool::expandSignatures() {
}
}
+bool isLoadableValue(int tag) {
+ switch(tag) {
+ case CONSTANT_Integer:
+ case CONSTANT_Float:
+ case CONSTANT_Long:
+ case CONSTANT_Double:
+ case CONSTANT_String:
+ case CONSTANT_Class:
+ case CONSTANT_MethodHandle:
+ case CONSTANT_MethodType:
+ return true;
+ default:
+ return false;
+ }
+}
+/*
+ * this method can be used to size an array using null as the parameter,
+ * thereafter can be reused to initialize the array using a valid pointer
+ * as a parameter.
+ */
+int cpool::initLoadableValues(entry** loadable_entries) {
+ int loadable_count = 0;
+ for (int i = 0; i < (int)N_TAGS_IN_ORDER; i++) {
+ int tag = TAGS_IN_ORDER[i];
+ if (!isLoadableValue(tag))
+ continue;
+ if (loadable_entries != NULL) {
+ for (int n = 0 ; n < tag_count[tag] ; n++) {
+ loadable_entries[loadable_count + n] = &entries[tag_base[tag] + n];
+ }
+ }
+ loadable_count += tag_count[tag];
+ }
+ return loadable_count;
+}
+
+// Initialize various views into the constant pool.
+void cpool::initGroupIndexes() {
+ // Initialize All
+ int all_count = 0;
+ for (int tag = CONSTANT_None ; tag < CONSTANT_Limit ; tag++) {
+ all_count += tag_count[tag];
+ }
+ entry* all_entries = &entries[tag_base[CONSTANT_None]];
+ tag_group_count[CONSTANT_All - CONSTANT_All] = all_count;
+ tag_group_index[CONSTANT_All - CONSTANT_All].init(all_count, all_entries, CONSTANT_All);
+
+ // Initialize LoadableValues
+ int loadable_count = initLoadableValues(NULL);
+ entry** loadable_entries = U_NEW(entry*, loadable_count);
+ initLoadableValues(loadable_entries);
+ tag_group_count[CONSTANT_LoadableValue - CONSTANT_All] = loadable_count;
+ tag_group_index[CONSTANT_LoadableValue - CONSTANT_All].init(loadable_count,
+ loadable_entries, CONSTANT_LoadableValue);
+
+// Initialize AnyMembers
+ int any_count = tag_count[CONSTANT_Fieldref] +
+ tag_count[CONSTANT_Methodref] +
+ tag_count[CONSTANT_InterfaceMethodref];
+ entry *any_entries = &entries[tag_base[CONSTANT_Fieldref]];
+ tag_group_count[CONSTANT_AnyMember - CONSTANT_All] = any_count;
+ tag_group_index[CONSTANT_AnyMember - CONSTANT_All].init(any_count,
+ any_entries, CONSTANT_AnyMember);
+}
+
void cpool::initMemberIndexes() {
// This function does NOT refer to any class schema.
// It is totally internal to the cpool.
@@ -3238,13 +3448,13 @@ void cpool::initMemberIndexes() {
}
void entry::requestOutputIndex(cpool& cp, int req) {
- assert(outputIndex <= NOT_REQUESTED); // must not have assigned indexes yet
+ assert(outputIndex <= REQUESTED_NONE); // must not have assigned indexes yet
if (tag == CONSTANT_Signature) {
ref(0)->requestOutputIndex(cp, req);
return;
}
assert(req == REQUESTED || req == REQUESTED_LDC);
- if (outputIndex != NOT_REQUESTED) {
+ if (outputIndex != REQUESTED_NONE) {
if (req == REQUESTED_LDC)
outputIndex = req; // this kind has precedence
return;
@@ -3252,31 +3462,52 @@ void entry::requestOutputIndex(cpool& cp, int req) {
outputIndex = req;
//assert(!cp.outputEntries.contains(this));
assert(tag != CONSTANT_Signature);
- cp.outputEntries.add(this);
+ // The BSMs are jetisoned to a side table, however all references
+ // that the BSMs refer to, need to be considered.
+ if (tag == CONSTANT_BootstrapMethod) {
+ // this is a a pseudo-op entry; an attribute will be generated later on
+ cp.requested_bsms.add(this);
+ } else {
+ // all other tag types go into real output file CP:
+ cp.outputEntries.add(this);
+ }
for (int j = 0; j < nrefs; j++) {
ref(j)->requestOutputIndex(cp);
}
}
void cpool::resetOutputIndexes() {
- int i;
- int noes = outputEntries.length();
+ /*
+ * reset those few entries that are being used in the current class
+ * (Caution since this method is called after every class written, a loop
+ * over every global constant pool entry would be a quadratic cost.)
+ */
+
+ int noes = outputEntries.length();
entry** oes = (entry**) outputEntries.base();
- for (i = 0; i < noes; i++) {
+ for (int i = 0 ; i < noes ; i++) {
entry& e = *oes[i];
- e.outputIndex = NOT_REQUESTED;
+ e.outputIndex = REQUESTED_NONE;
+ }
+
+ // do the same for bsms and reset them if required
+ int nbsms = requested_bsms.length();
+ entry** boes = (entry**) requested_bsms.base();
+ for (int i = 0 ; i < nbsms ; i++) {
+ entry& e = *boes[i];
+ e.outputIndex = REQUESTED_NONE;
}
outputIndexLimit = 0;
outputEntries.empty();
#ifndef PRODUCT
- // they must all be clear now
- for (i = 0; i < (int)nentries; i++)
- assert(entries[i].outputIndex == NOT_REQUESTED);
+ // ensure things are cleared out
+ for (int i = 0; i < (int)maxentries; i++)
+ assert(entries[i].outputIndex == REQUESTED_NONE);
#endif
}
static const byte TAG_ORDER[CONSTANT_Limit] = {
- 0, 1, 0, 2, 3, 4, 5, 7, 6, 10, 11, 12, 9, 8
+ 0, 1, 0, 2, 3, 4, 5, 7, 6, 10, 11, 12, 9, 8, 0, 13, 14, 15, 16
};
extern "C"
@@ -3323,10 +3554,18 @@ void cpool::computeOutputIndexes() {
if (nentries > 100) checkStep = nentries / 100;
for (i = (int)(checkStart++ % checkStep); i < (int)nentries; i += checkStep) {
entry& e = entries[i];
- if (e.outputIndex != NOT_REQUESTED) {
- assert(outputEntries.contains(&e));
+ if (e.tag == CONSTANT_BootstrapMethod) {
+ if (e.outputIndex != REQUESTED_NONE) {
+ assert(requested_bsms.contains(&e));
+ } else {
+ assert(!requested_bsms.contains(&e));
+ }
} else {
- assert(!outputEntries.contains(&e));
+ if (e.outputIndex != REQUESTED_NONE) {
+ assert(outputEntries.contains(&e));
+ } else {
+ assert(!outputEntries.contains(&e));
+ }
}
}
@@ -3348,7 +3587,7 @@ void cpool::computeOutputIndexes() {
int nextIndex = 1; // always skip index #0 in output cpool
for (i = 0; i < noes; i++) {
entry& e = *oes[i];
- assert(e.outputIndex == REQUESTED || e.outputIndex == REQUESTED_LDC);
+ assert(e.outputIndex >= REQUESTED_LDC);
e.outputIndex = nextIndex++;
if (e.isDoubleWord()) nextIndex++; // do not use the next index
}
@@ -3396,7 +3635,7 @@ char* entry::string() {
default:
if (nrefs == 0) {
buf = getbuf(20);
- sprintf((char*)buf.ptr, "", tag);
+ sprintf((char*)buf.ptr, TAG_NAME[tag]);
} else if (nrefs == 1) {
return refs[0]->string();
} else {
@@ -3674,6 +3913,7 @@ void unpacker::reset_cur_classfile() {
class_fixup_offset.empty();
class_fixup_ref.empty();
requested_ics.empty();
+ cp.requested_bsms.empty();
}
cpindex* cpool::getKQIndex() {
@@ -3931,13 +4171,15 @@ void unpacker::write_bc_ops() {
case bc_ildc:
case bc_cldc:
case bc_fldc:
- case bc_aldc:
+ case bc_sldc:
+ case bc_qldc:
origBC = bc_ldc;
break;
case bc_ildc_w:
case bc_cldc_w:
case bc_fldc_w:
- case bc_aldc_w:
+ case bc_sldc_w:
+ case bc_qldc_w:
origBC = bc_ldc_w;
break;
case bc_lldc2_w:
@@ -3962,6 +4204,10 @@ void unpacker::write_bc_ops() {
int argSize = ref->memberDescr()->descrType()->typeSize();
putu1_fast(1 + argSize);
putu1_fast(0);
+ } else if (origBC == bc_invokedynamic) {
+ // pad the next two byte
+ putu1_fast(0);
+ putu1_fast(0);
}
continue;
}
@@ -4353,49 +4599,12 @@ int raw_address_cmp(const void* p1p, const void* p2p) {
return (p1 > p2)? 1: (p1 < p2)? -1: 0;
}
-void unpacker::write_classfile_tail() {
- cur_classfile_tail.empty();
- set_output(&cur_classfile_tail);
-
- int i, num;
-
- attr_definitions& ad = attr_defs[ATTR_CONTEXT_CLASS];
-
- bool haveLongFlags = ad.haveLongFlags();
- julong kflags = class_flags_hi.getLong(class_flags_lo, haveLongFlags);
- julong indexMask = ad.flagIndexMask();
-
- cur_class = class_this.getRef();
- cur_super = class_super.getRef();
-
- CHECK;
-
- if (cur_super == cur_class) cur_super = null;
- // special representation for java/lang/Object
-
- putu2((ushort)(kflags & ~indexMask));
- putref(cur_class);
- putref(cur_super);
-
- putu2(num = class_interface_count.getInt());
- for (i = 0; i < num; i++) {
- putref(class_interface.getRef());
- }
-
- write_members(class_field_count.getInt(), ATTR_CONTEXT_FIELD);
- write_members(class_method_count.getInt(), ATTR_CONTEXT_METHOD);
- CHECK;
-
- cur_class_has_local_ics = false; // may be set true by write_attrs
-
-
- int naOffset = (int)wpoffset();
- int na = write_attrs(ATTR_CONTEXT_CLASS, (kflags & indexMask));
-
-
- // at the very last, choose which inner classes (if any) pertain to k:
+/*
+ * writes the InnerClass attributes and returns the updated attribute
+ */
+int unpacker::write_ics(int naOffset, int na) {
#ifdef ASSERT
- for (i = 0; i < ic_count; i++) {
+ for (int i = 0; i < ic_count; i++) {
assert(!ics[i].requested);
}
#endif
@@ -4416,7 +4625,7 @@ void unpacker::write_classfile_tail() {
// include it and all its outers.
int noes = cp.outputEntries.length();
entry** oes = (entry**) cp.outputEntries.base();
- for (i = 0; i < noes; i++) {
+ for (int i = 0; i < noes; i++) {
entry& e = *oes[i];
if (e.tag != CONSTANT_Class) continue; // wrong sort
for (inner_class* ic = cp.getIC(&e);
@@ -4442,10 +4651,10 @@ void unpacker::write_classfile_tail() {
// Note: extra_ics will be freed up by next call to get_next_file().
}
}
- for (i = 0; i < num_extra_ics; i++) {
+ for (int i = 0; i < num_extra_ics; i++) {
inner_class& extra_ic = extra_ics[i];
extra_ic.inner = class_InnerClasses_RC.getRef();
- CHECK;
+ CHECK_0;
// Find the corresponding equivalent global IC:
inner_class* global_ic = cp.getIC(extra_ic.inner);
int flags = class_InnerClasses_F.getInt();
@@ -4493,7 +4702,7 @@ void unpacker::write_classfile_tail() {
putu2(local_ics);
PTRLIST_QSORT(requested_ics, raw_address_cmp);
int num_global_ics = requested_ics.length();
- for (i = -num_global_ics; i < num_extra_ics; i++) {
+ for (int i = -num_global_ics; i < num_extra_ics; i++) {
inner_class* ic;
if (i < 0)
ic = (inner_class*) requested_ics.get(num_global_ics+i);
@@ -4512,17 +4721,99 @@ void unpacker::write_classfile_tail() {
}
// Tidy up global 'requested' bits:
- for (i = requested_ics.length(); --i >= 0; ) {
+ for (int i = requested_ics.length(); --i >= 0; ) {
inner_class* ic = (inner_class*) requested_ics.get(i);
ic->requested = false;
}
requested_ics.empty();
+ return na;
+}
+/*
+ * Writes the BootstrapMethods attribute and returns the updated attribute count
+ */
+int unpacker::write_bsms(int naOffset, int na) {
+ cur_class_local_bsm_count = cp.requested_bsms.length();
+ if (cur_class_local_bsm_count > 0) {
+ int noes = cp.outputEntries.length();
+ entry** oes = (entry**) cp.outputEntries.base();
+ PTRLIST_QSORT(cp.requested_bsms, outputEntry_cmp);
+ // append the BootstrapMethods attribute (after the InnerClasses attr):
+ putref(cp.sym[cpool::s_BootstrapMethods]);
+ int sizeOffset = (int)wpoffset();
+ byte* sizewp = wp;
+ putu4(-99); // attr size will be patched
+ putu2(cur_class_local_bsm_count);
+ int written_bsms = 0;
+ for (int i = 0 ; i < cur_class_local_bsm_count ; i++) {
+ entry* e = (entry*)cp.requested_bsms.get(i);
+ assert(e->outputIndex != REQUESTED_NONE);
+ // output index is the index within the array
+ e->outputIndex = i;
+ putref(e->refs[0]); // bsm
+ putu2(e->nrefs-1); // number of args after bsm
+ for (int j = 1; j < e->nrefs; j++) {
+ putref(e->refs[j]);
+ }
+ written_bsms += 1;
+ }
+ assert(written_bsms == cur_class_local_bsm_count); // else insane
+ putu4_at(sizewp, (int)(wp - (sizewp+4))); // size of code attr
+ putu2_at(wp_at(naOffset), ++na); // increment class attr count
+ }
+ return na;
+}
+
+void unpacker::write_classfile_tail() {
+
+ cur_classfile_tail.empty();
+ set_output(&cur_classfile_tail);
+
+ int i, num;
+
+ attr_definitions& ad = attr_defs[ATTR_CONTEXT_CLASS];
+
+ bool haveLongFlags = ad.haveLongFlags();
+ julong kflags = class_flags_hi.getLong(class_flags_lo, haveLongFlags);
+ julong indexMask = ad.flagIndexMask();
+
+ cur_class = class_this.getRef();
+ cur_super = class_super.getRef();
CHECK;
+
+ if (cur_super == cur_class) cur_super = null;
+ // special representation for java/lang/Object
+
+ putu2((ushort)(kflags & ~indexMask));
+ putref(cur_class);
+ putref(cur_super);
+
+ putu2(num = class_interface_count.getInt());
+ for (i = 0; i < num; i++) {
+ putref(class_interface.getRef());
+ }
+
+ write_members(class_field_count.getInt(), ATTR_CONTEXT_FIELD);
+ write_members(class_method_count.getInt(), ATTR_CONTEXT_METHOD);
+ CHECK;
+
+ cur_class_has_local_ics = false; // may be set true by write_attrs
+
+ int naOffset = (int)wpoffset(); // note the attr count location
+ int na = write_attrs(ATTR_CONTEXT_CLASS, (kflags & indexMask));
+ CHECK;
+
+ na = write_bsms(naOffset, na);
+ CHECK;
+
+ // choose which inner classes (if any) pertain to k:
+ na = write_ics(naOffset, na);
+ CHECK;
+
close_output();
+ cp.computeOutputIndexes();
// rewrite CP references in the tail
- cp.computeOutputIndexes();
int nextref = 0;
for (i = 0; i < (int)class_fixup_type.size(); i++) {
int type = class_fixup_type.getByte(i);
@@ -4579,9 +4870,18 @@ void unpacker::write_classfile_head() {
case CONSTANT_Methodref:
case CONSTANT_InterfaceMethodref:
case CONSTANT_NameandType:
+ case CONSTANT_InvokeDynamic:
putu2(e.refs[0]->getOutputIndex());
putu2(e.refs[1]->getOutputIndex());
break;
+ case CONSTANT_MethodHandle:
+ putu1(e.value.i);
+ putu2(e.refs[0]->getOutputIndex());
+ break;
+ case CONSTANT_MethodType:
+ putu2(e.refs[0]->getOutputIndex());
+ break;
+ case CONSTANT_BootstrapMethod: // should not happen
default:
abort(ERROR_INTERNAL);
}
@@ -4620,11 +4920,11 @@ unpacker::file* unpacker::get_next_file() {
entry* e = file_name.getRef();
CHECK_0;
cur_file.name = e->utf8String();
- bool haveLongSize = ((archive_options & AO_HAVE_FILE_SIZE_HI) != 0);
+ bool haveLongSize = (testBit(archive_options, AO_HAVE_FILE_SIZE_HI));
cur_file.size = file_size_hi.getLong(file_size_lo, haveLongSize);
- if ((archive_options & AO_HAVE_FILE_MODTIME) != 0)
+ if (testBit(archive_options, AO_HAVE_FILE_MODTIME))
cur_file.modtime += file_modtime.getInt(); //relative to archive modtime
- if ((archive_options & AO_HAVE_FILE_OPTIONS) != 0)
+ if (testBit(archive_options, AO_HAVE_FILE_OPTIONS))
cur_file.options |= file_options.getInt() & ~suppress_file_options;
} else if (classes_written < class_count) {
// there is a class for a missing file record
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h
index 0f66b7ef6f5..cec7a88b24e 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/unpack.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,9 +22,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
-
-
// Global Structures
struct jar;
struct gunzip;
@@ -70,6 +67,9 @@ struct cpool {
cpindex tag_index[CONSTANT_Limit];
ptrlist tag_extras[CONSTANT_Limit];
+ int tag_group_count[CONSTANT_GroupLimit - CONSTANT_GroupFirst];
+ cpindex tag_group_index[CONSTANT_GroupLimit - CONSTANT_GroupFirst];
+
cpindex* member_indexes; // indexed by 2*CONSTANT_Class.inord
cpindex* getFieldIndex(entry* classRef);
cpindex* getMethodIndex(entry* classRef);
@@ -82,6 +82,7 @@ struct cpool {
int outputIndexLimit; // index limit after renumbering
ptrlist outputEntries; // list of entry* needing output idx assigned
+ ptrlist requested_bsms; // which bsms need output?
entry** hashTab;
uint hashTabLength;
@@ -100,24 +101,36 @@ struct cpool {
entry* sym[s_LIMIT];
// read counts from hdr, allocate main arrays
- enum { NUM_COUNTS = 12 };
- void init(unpacker* u, int counts[NUM_COUNTS]);
+ void init(unpacker* u, int counts[CONSTANT_Limit]);
// pointer to outer unpacker, for error checks etc.
unpacker* u;
int getCount(byte tag) {
- assert((uint)tag < CONSTANT_Limit);
- return tag_count[tag];
+ if ((uint)tag >= CONSTANT_GroupFirst) {
+ assert((uint)tag < CONSTANT_GroupLimit);
+ return tag_group_count[(uint)tag - CONSTANT_GroupFirst];
+ } else {
+ assert((uint)tag < CONSTANT_Limit);
+ return tag_count[(uint)tag];
+ }
}
cpindex* getIndex(byte tag) {
- assert((uint)tag < CONSTANT_Limit);
- return &tag_index[tag];
+ if ((uint)tag >= CONSTANT_GroupFirst) {
+ assert((uint)tag < CONSTANT_GroupLimit);
+ return &tag_group_index[(uint)tag - CONSTANT_GroupFirst];
+ } else {
+ assert((uint)tag < CONSTANT_Limit);
+ return &tag_index[(uint)tag];
+ }
}
+
cpindex* getKQIndex(); // uses cur_descr
void expandSignatures();
+ void initGroupIndexes();
void initMemberIndexes();
+ int initLoadableValues(entry** loadable_entries);
void computeOutputOrder();
void computeOutputIndexes();
@@ -234,6 +247,7 @@ struct unpacker {
int cur_descr_flags; // flags corresponding to cur_descr
int cur_class_minver, cur_class_majver;
bool cur_class_has_local_ics;
+ int cur_class_local_bsm_count;
fillbytes cur_classfile_head;
fillbytes cur_classfile_tail;
int files_written; // also tells which file we're working on
@@ -412,7 +426,7 @@ struct unpacker {
void abort(const char* s = null);
bool aborting() { return abort_message != null; }
static unpacker* current(); // find current instance
-
+ void checkLegacy(const char* name);
// Output management
void set_output(fillbytes* which) {
assert(wp == null);
@@ -464,6 +478,8 @@ struct unpacker {
void write_bc_ops();
void write_members(int num, int attrc); // attrc=ATTR_CONTEXT_FIELD/METHOD
int write_attrs(int attrc, julong indexBits);
+ int write_ics(int naOffset, int na);
+ int write_bsms(int naOffset, int na);
// The readers
void read_bands();
@@ -484,6 +500,9 @@ struct unpacker {
void read_single_refs(band& cp_band, byte refTag, entry* cpMap, int len);
void read_double_refs(band& cp_band, byte ref1Tag, byte ref2Tag, entry* cpMap, int len);
void read_signature_values(entry* cpMap, int len);
+ void read_method_handle(entry* cpMap, int len);
+ void read_method_type(entry* cpMap, int len);
+ void read_bootstrap_methods(entry* cpMap, int len);
};
inline void cpool::abort(const char* msg) { u->abort(msg); }
diff --git a/jdk/src/share/native/java/net/net_util.h b/jdk/src/share/native/java/net/net_util.h
index d87ffdad280..923520bb2e1 100644
--- a/jdk/src/share/native/java/net/net_util.h
+++ b/jdk/src/share/native/java/net/net_util.h
@@ -139,6 +139,9 @@ NET_IPv4MappedToIPv4(jbyte* caddr);
int
NET_IsEqual(jbyte* caddr1, jbyte* caddr2);
+int
+NET_IsZeroAddr(jbyte* caddr);
+
/* Socket operations
*
* These work just like the JVM_* procedures, except that they may do some
diff --git a/jdk/src/share/native/java/util/zip/ZipFile.c b/jdk/src/share/native/java/util/zip/ZipFile.c
index 99d6d229f89..281dbc628fa 100644
--- a/jdk/src/share/native/java/util/zip/ZipFile.c
+++ b/jdk/src/share/native/java/util/zip/ZipFile.c
@@ -117,6 +117,7 @@ Java_java_util_zip_ZipFile_open(JNIEnv *env, jclass cls, jstring name,
result = ptr_to_jlong(zip);
} else if (msg != 0) {
ThrowZipException(env, msg);
+ free(msg);
} else if (errno == ENOMEM) {
JNU_ThrowOutOfMemoryError(env, 0);
} else {
diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c
index 991ed5c0123..9bffd3461e5 100644
--- a/jdk/src/share/native/java/util/zip/zip_util.c
+++ b/jdk/src/share/native/java/util/zip/zip_util.c
@@ -726,7 +726,7 @@ readCEN(jzfile *zip, jint knownTotal)
* Opens a zip file with the specified mode. Returns the jzfile object
* or NULL if an error occurred. If a zip error occurred then *pmsg will
* be set to the error message text if pmsg != 0. Otherwise, *pmsg will be
- * set to NULL.
+ * set to NULL. Caller is responsible to free the error message.
*/
jzfile *
ZIP_Open_Generic(const char *name, char **pmsg, int mode, jlong lastModified)
@@ -751,12 +751,12 @@ ZIP_Open_Generic(const char *name, char **pmsg, int mode, jlong lastModified)
* Returns the jzfile corresponding to the given file name from the cache of
* zip files, or NULL if the file is not in the cache. If the name is longer
* than PATH_MAX or a zip error occurred then *pmsg will be set to the error
- * message text if pmsg != 0. Otherwise, *pmsg will be set to NULL.
+ * message text if pmsg != 0. Otherwise, *pmsg will be set to NULL. Caller
+ * is responsible to free the error message.
*/
jzfile *
ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
{
- static char errbuf[256];
char buf[PATH_MAX];
jzfile *zip;
@@ -771,7 +771,7 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
if (strlen(name) >= PATH_MAX) {
if (pmsg) {
- *pmsg = "zip file name too long";
+ *pmsg = strdup("zip file name too long");
}
return NULL;
}
@@ -796,7 +796,8 @@ ZIP_Get_From_Cache(const char *name, char **pmsg, jlong lastModified)
* Reads data from the given file descriptor to create a jzfile, puts the
* jzfile in a cache, and returns that jzfile. Returns NULL in case of error.
* If a zip error occurs, then *pmsg will be set to the error message text if
- * pmsg != 0. Otherwise, *pmsg will be set to NULL.
+ * pmsg != 0. Otherwise, *pmsg will be set to NULL. Caller is responsible to
+ * free the error message.
*/
jzfile *
@@ -809,7 +810,7 @@ jzfile *
ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
jboolean usemmap)
{
- static char errbuf[256];
+ char errbuf[256];
jlong len;
jzfile *zip;
@@ -825,7 +826,7 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
if (zfd == -1) {
if (pmsg && JVM_GetLastErrorString(errbuf, sizeof(errbuf)) > 0)
- *pmsg = errbuf;
+ *pmsg = strdup(errbuf);
freeZip(zip);
return NULL;
}
@@ -834,11 +835,11 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
if (len <= 0) {
if (len == 0) { /* zip file is empty */
if (pmsg) {
- *pmsg = "zip file is empty";
+ *pmsg = strdup("zip file is empty");
}
} else { /* error */
if (pmsg && JVM_GetLastErrorString(errbuf, sizeof(errbuf)) > 0)
- *pmsg = errbuf;
+ *pmsg = strdup(errbuf);
}
ZFILE_Close(zfd);
freeZip(zip);
@@ -850,7 +851,8 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
/* An error occurred while trying to read the zip file */
if (pmsg != 0) {
/* Set the zip error message */
- *pmsg = zip->msg;
+ if (zip->msg != NULL)
+ *pmsg = strdup(zip->msg);
}
freeZip(zip);
return NULL;
@@ -867,12 +869,17 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
* Opens a zip file for reading. Returns the jzfile object or NULL
* if an error occurred. If a zip error occurred then *msg will be
* set to the error message text if msg != 0. Otherwise, *msg will be
- * set to NULL.
+ * set to NULL. Caller doesn't need to free the error message.
*/
jzfile * JNICALL
ZIP_Open(const char *name, char **pmsg)
{
- return ZIP_Open_Generic(name, pmsg, O_RDONLY, 0);
+ jzfile *file = ZIP_Open_Generic(name, pmsg, O_RDONLY, 0);
+ if (file == NULL && pmsg != NULL && *pmsg != NULL) {
+ free(*pmsg);
+ *pmsg = "Zip file open error";
+ }
+ return file;
}
/*
diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLContext.h b/jdk/src/share/native/sun/java2d/opengl/OGLContext.h
index 866d8f41280..5e236bb28c6 100644
--- a/jdk/src/share/native/sun/java2d/opengl/OGLContext.h
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLContext.h
@@ -84,6 +84,7 @@ typedef struct {
GLdouble *xformMatrix;
GLuint blitTextureID;
GLint textureFunction;
+ jboolean vertexCacheEnabled;
} OGLContext;
/**
diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c b/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
index 12e028452ba..7a24d5222d5 100644
--- a/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLTextRenderer.c
@@ -202,11 +202,6 @@ OGLTR_InitGlyphCache(jboolean lcdCache)
J2dTraceLn(J2D_TRACE_INFO, "OGLTR_InitGlyphCache");
- // init vertex cache (if it hasn't been already)
- if (!OGLVertexCache_InitVertexCache()) {
- return JNI_FALSE;
- }
-
// init glyph cache data structure
gcinfo = AccelGlyphCache_Init(OGLTR_CACHE_WIDTH,
OGLTR_CACHE_HEIGHT,
@@ -583,6 +578,10 @@ OGLTR_EnableGlyphVertexCache(OGLContext *oglc)
{
J2dTraceLn(J2D_TRACE_INFO, "OGLTR_EnableGlyphVertexCache");
+ if (!OGLVertexCache_InitVertexCache(oglc)) {
+ return;
+ }
+
if (glyphCache == NULL) {
if (!OGLTR_InitGlyphCache(JNI_FALSE)) {
return;
diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c
index 87556d61d5d..574e2786fb9 100644
--- a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.c
@@ -67,29 +67,31 @@ static jint maskCacheIndex = 0;
} while (0)
jboolean
-OGLVertexCache_InitVertexCache()
+OGLVertexCache_InitVertexCache(OGLContext *oglc)
{
J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_InitVertexCache");
- if (vertexCache != NULL) {
- return JNI_TRUE;
- }
-
- vertexCache = (J2DVertex *)malloc(OGLVC_MAX_INDEX * sizeof(J2DVertex));
if (vertexCache == NULL) {
- return JNI_FALSE;
+ vertexCache = (J2DVertex *)malloc(OGLVC_MAX_INDEX * sizeof(J2DVertex));
+ if (vertexCache == NULL) {
+ return JNI_FALSE;
+ }
}
- j2d_glTexCoordPointer(2, GL_FLOAT,
- sizeof(J2DVertex), vertexCache);
- j2d_glColorPointer(4, GL_UNSIGNED_BYTE,
- sizeof(J2DVertex), ((jfloat *)vertexCache) + 2);
- j2d_glVertexPointer(2, GL_FLOAT,
- sizeof(J2DVertex), ((jfloat *)vertexCache) + 3);
+ if (!oglc->vertexCacheEnabled) {
+ j2d_glTexCoordPointer(2, GL_FLOAT,
+ sizeof(J2DVertex), vertexCache);
+ j2d_glColorPointer(4, GL_UNSIGNED_BYTE,
+ sizeof(J2DVertex), ((jfloat *)vertexCache) + 2);
+ j2d_glVertexPointer(2, GL_FLOAT,
+ sizeof(J2DVertex), ((jfloat *)vertexCache) + 3);
- j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- j2d_glEnableClientState(GL_COLOR_ARRAY);
- j2d_glEnableClientState(GL_VERTEX_ARRAY);
+ j2d_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ j2d_glEnableClientState(GL_COLOR_ARRAY);
+ j2d_glEnableClientState(GL_VERTEX_ARRAY);
+
+ oglc->vertexCacheEnabled = JNI_TRUE;
+ }
return JNI_TRUE;
}
@@ -149,10 +151,6 @@ OGLVertexCache_InitMaskCache()
{
J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_InitMaskCache");
- if (!OGLVertexCache_InitVertexCache()) {
- return JNI_FALSE;
- }
-
maskCacheTexID =
OGLContext_CreateBlitTexture(GL_INTENSITY8, GL_LUMINANCE,
OGLVC_MASK_CACHE_WIDTH_IN_TEXELS,
@@ -179,6 +177,10 @@ OGLVertexCache_EnableMaskCache(OGLContext *oglc)
{
J2dTraceLn(J2D_TRACE_INFO, "OGLVertexCache_EnableMaskCache");
+ if (!OGLVertexCache_InitVertexCache(oglc)) {
+ return;
+ }
+
if (maskCacheTexID == 0) {
if (!OGLVertexCache_InitMaskCache()) {
return;
diff --git a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h
index bf22d1f950e..0392d8558ee 100644
--- a/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLVertexCache.h
@@ -65,7 +65,7 @@
/**
* Exported methods.
*/
-jboolean OGLVertexCache_InitVertexCache();
+jboolean OGLVertexCache_InitVertexCache(OGLContext *oglc);
void OGLVertexCache_FlushVertexCache();
void OGLVertexCache_RestoreColorState(OGLContext *oglc);
diff --git a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
index ebd434a96df..71cb7f3ddc5 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
@@ -73,7 +73,7 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
if (filenames == null) {
accessor.setDirectory(fd, null);
accessor.setFile(fd, null);
- accessor.setFiles(fd, null, null);
+ accessor.setFiles(fd, null);
} else {
// Fix 6987233: add the trailing slash if it's absent
String with_separator = directory;
@@ -83,7 +83,13 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
}
accessor.setDirectory(fd, with_separator);
accessor.setFile(fd, filenames[0]);
- accessor.setFiles(fd, directory, filenames);
+
+ int filesNumber = (filenames != null) ? filenames.length : 0;
+ File[] files = new File[filesNumber];
+ for (int i = 0; i < filesNumber; i++) {
+ files[i] = new File(directory, filenames[i]);
+ }
+ accessor.setFiles(fd, files);
}
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java
index 9fac04660ca..f15dbd209d1 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java
@@ -396,11 +396,18 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
savedFile = file.substring(index+1);
}
+ String[] fileNames = fileList.getSelectedItems();
+ int filesNumber = (fileNames != null) ? fileNames.length : 0;
+ File[] files = new File[filesNumber];
+ for (int i = 0; i < filesNumber; i++) {
+ files[i] = new File(savedDir, fileNames[i]);
+ }
+
AWTAccessor.FileDialogAccessor fileDialogAccessor = AWTAccessor.getFileDialogAccessor();
fileDialogAccessor.setDirectory(target, savedDir);
fileDialogAccessor.setFile(target, savedFile);
- fileDialogAccessor.setFiles(target, savedDir, fileList.getSelectedItems());
+ fileDialogAccessor.setFiles(target, files);
}
/**
@@ -419,7 +426,7 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
fileDialogAccessor.setDirectory(target, null);
fileDialogAccessor.setFile(target, null);
- fileDialogAccessor.setFiles(target, null, null);
+ fileDialogAccessor.setFiles(target, null);
handleQuitButton();
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
index 253fa4d1da0..5a08630acdc 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
@@ -657,10 +657,13 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
}
- // TODO : fix this duplicate code
- class XAWTCaret extends DefaultCaret {
+ static class XAWTCaret extends DefaultCaret {
public void focusGained(FocusEvent e) {
super.focusGained(e);
+ if (getComponent().isEnabled()){
+ // Make sure the cursor is visible in case of non-editable TextArea
+ super.setVisible(true);
+ }
getComponent().repaint();
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
index 6e3b78d1498..c67a2be1f5f 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java
@@ -578,31 +578,7 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
}
protected Caret createCaret() {
- return new XAWTCaret();
- }
- }
-
- class XAWTCaret extends DefaultCaret {
- public void focusGained(FocusEvent e) {
- super.focusGained(e);
- getComponent().repaint();
- }
-
- public void focusLost(FocusEvent e) {
- super.focusLost(e);
- getComponent().repaint();
- }
-
- // Fix for 5100950: textarea.getSelectedText() returns the de-selected text, on XToolkit
- // Restoring Motif behaviour
- // If the text is unhighlighted then we should sets the selection range to zero
- public void setSelectionVisible(boolean vis) {
- if (vis){
- super.setSelectionVisible(vis);
- }else{
- // In order to de-select the selection
- setDot(getDot());
- }
+ return new XTextAreaPeer.XAWTCaret();
}
}
diff --git a/jdk/src/solaris/classes/sun/management/FileSystemImpl.java b/jdk/src/solaris/classes/sun/management/FileSystemImpl.java
index 2961eca36af..67445c58d4e 100644
--- a/jdk/src/solaris/classes/sun/management/FileSystemImpl.java
+++ b/jdk/src/solaris/classes/sun/management/FileSystemImpl.java
@@ -48,7 +48,12 @@ public class FileSystemImpl extends FileSystem {
// Initialization
static {
- java.security.AccessController
- .doPrivileged(new sun.security.action.LoadLibraryAction("management"));
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("management");
+ return null;
+ }
+ });
}
}
diff --git a/jdk/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java b/jdk/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java
index 66430d40495..670a675d95c 100644
--- a/jdk/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java
+++ b/jdk/src/solaris/classes/sun/net/dns/ResolverConfigurationImpl.java
@@ -251,7 +251,12 @@ public class ResolverConfigurationImpl
static {
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("net"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("net");
+ return null;
+ }
+ });
}
}
diff --git a/jdk/src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java b/jdk/src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
index 9767c7ced9a..3efecaacac9 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/DefaultAsynchronousChannelProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ public class DefaultAsynchronousChannelProvider {
return new SolarisAsynchronousChannelProvider();
if (osname.equals("Linux"))
return new LinuxAsynchronousChannelProvider();
- if (osname.startsWith("Mac OS"))
+ if (osname.contains("OS X"))
return new BsdAsynchronousChannelProvider();
throw new InternalError("platform not recognized");
}
diff --git a/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
index 25afcff2695..92f17cb3e8b 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpChannelImpl.java
@@ -1100,7 +1100,12 @@ public class SctpChannelImpl extends SctpChannel
static {
Util.load(); /* loads nio & net native libraries */
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("sctp"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("sctp");
+ return null;
+ }
+ });
initIDs();
}
}
diff --git a/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
index e00247f3970..fa44072f4dc 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java
@@ -989,6 +989,11 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
static {
Util.load(); /* loads nio & net native libraries */
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("sctp"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("sctp");
+ return null;
+ }
+ });
}
}
diff --git a/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
index 15d281bd309..e5d5a892bd7 100644
--- a/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
+++ b/jdk/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
@@ -428,7 +428,12 @@ public class SctpServerChannelImpl extends SctpServerChannel
static {
Util.load(); // loads nio & net native libraries
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("sctp"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("sctp");
+ return null;
+ }
+ });
initIDs();
}
}
diff --git a/jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java b/jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
index 2605e1d6d44..9f8d479831e 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@ public class DefaultFileSystemProvider {
return createProvider("sun.nio.fs.SolarisFileSystemProvider");
if (osname.equals("Linux"))
return createProvider("sun.nio.fs.LinuxFileSystemProvider");
- if (osname.equals("Darwin") || osname.startsWith("Mac OS X"))
+ if (osname.equals("Darwin") || osname.contains("OS X"))
return createProvider("sun.nio.fs.BsdFileSystemProvider");
throw new AssertionError("Platform not recognized");
}
diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java
index 76187ec4df7..171dbfe0de2 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisWatchService.java
@@ -314,7 +314,7 @@ class SolarisWatchService
fileKey2WatchKey.put(fileKey, watchKey);
// register all entries in directory
- registerChildren(dir, watchKey, false);
+ registerChildren(dir, watchKey, false, false);
return watchKey;
}
@@ -486,7 +486,8 @@ class SolarisWatchService
void processDirectoryEvents(SolarisWatchKey key, int mask) {
if ((mask & (FILE_MODIFIED | FILE_ATTRIB)) != 0) {
registerChildren(key.getDirectory(), key,
- key.events().contains(StandardWatchEventKinds.ENTRY_CREATE));
+ key.events().contains(StandardWatchEventKinds.ENTRY_CREATE),
+ key.events().contains(StandardWatchEventKinds.ENTRY_DELETE));
}
}
@@ -535,14 +536,16 @@ class SolarisWatchService
/**
* Registers all entries in the given directory
*
- * The {@code sendEvents} parameter indicates if ENTRY_CREATE events
- * should be queued when new entries are found. When initially
- * registering a directory then will always be false. When re-scanning
- * a directory then it depends on if the event is enabled or not.
+ * The {@code sendCreateEvents} and {@code sendDeleteEvents} parameters
+ * indicates if ENTRY_CREATE and ENTRY_DELETE events should be queued
+ * when new entries are found. When initially registering a directory
+ * they will always be false. When re-scanning a directory then it
+ * depends on if the events are enabled or not.
*/
void registerChildren(UnixPath dir,
SolarisWatchKey parent,
- boolean sendEvents)
+ boolean sendCreateEvents,
+ boolean sendDeleteEvents)
{
// if the ENTRY_MODIFY event is not enabled then we don't need
// modification events for entries in the directory
@@ -550,14 +553,7 @@ class SolarisWatchService
if (parent.events().contains(StandardWatchEventKinds.ENTRY_MODIFY))
events |= (FILE_MODIFIED | FILE_ATTRIB);
- DirectoryStream stream = null;
- try {
- stream = Files.newDirectoryStream(dir);
- } catch (IOException x) {
- // nothing we can do
- return;
- }
- try {
+ try (DirectoryStream stream = Files.newDirectoryStream(dir)) {
for (Path entry: stream) {
Path name = entry.getFileName();
@@ -565,32 +561,34 @@ class SolarisWatchService
if (parent.getChild(name) != null)
continue;
- // send ENTRY_CREATE if enabled
- if (sendEvents) {
- parent.signalEvent(StandardWatchEventKinds.ENTRY_CREATE, name);
- }
-
- // register it
+ // attempt to register entry
long object = 0L;
+ int errno = 0;
try {
object = registerImpl((UnixPath)entry, events);
} catch (UnixException x) {
- // can't register so ignore for now.
- continue;
+ errno = x.errno();
}
- // create node
- EntryNode node = new EntryNode(object, entry.getFileName(), parent);
- // tell the parent about it
- parent.addChild(entry.getFileName(), node);
- object2Node.put(object, node);
+ boolean registered = (object != 0L);
+ boolean deleted = (errno == ENOENT);
+
+ if (registered) {
+ // create node
+ EntryNode node = new EntryNode(object, entry.getFileName(), parent);
+ // tell the parent about it
+ parent.addChild(entry.getFileName(), node);
+ object2Node.put(object, node);
+ }
+
+ if (sendCreateEvents && (registered || deleted))
+ parent.signalEvent(StandardWatchEventKinds.ENTRY_CREATE, name);
+ if (sendDeleteEvents && deleted)
+ parent.signalEvent(StandardWatchEventKinds.ENTRY_DELETE, name);
+
}
- } catch (ConcurrentModificationException x) {
- // error during iteration which we ignore for now
- } finally {
- try {
- stream.close();
- } catch (IOException x) { }
+ } catch (DirectoryIteratorException | IOException x) {
+ // nothing we can do
}
}
diff --git a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java
index 9648488b166..c64ea8b1122 100644
--- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java
+++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java
@@ -77,7 +77,12 @@ public class CUPSPrinter {
static {
// load awt library to access native code
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("awt"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("awt");
+ return null;
+ }
+ });
libFound = initIDs();
if (libFound) {
cupsServer = getCupsServer();
diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
index c1de9bc1849..7f402865d2b 100644
--- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
static boolean isBSD() {
return (osname.equals("Linux") ||
- osname.startsWith("Mac OS X"));
+ osname.contains("OS X"));
}
static final int UNINITIALIZED = -1;
diff --git a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
index 28e8448bdd1..a6f7ddc1a00 100644
--- a/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+++ b/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
@@ -671,12 +671,19 @@ ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
* We did receive something, but is it what we were expecting?
* I.E.: A ICMP_ECHOREPLY packet with the proper PID.
*/
- if (icmplen >= 8 && icmp->icmp_type == ICMP_ECHOREPLY &&
- (ntohs(icmp->icmp_id) == pid) &&
- (him->sin_addr.s_addr == sa_recv.sin_addr.s_addr)) {
- close(fd);
- return JNI_TRUE;
- }
+ if (icmplen >= 8 && icmp->icmp_type == ICMP_ECHOREPLY
+ && (ntohs(icmp->icmp_id) == pid)) {
+ if ((him->sin_addr.s_addr == sa_recv.sin_addr.s_addr)) {
+ close(fd);
+ return JNI_TRUE;
+ }
+
+ if (him->sin_addr.s_addr == 0) {
+ close(fd);
+ return JNI_TRUE;
+ }
+ }
+
}
} while (tmout2 > 0);
timeout -= 1000;
diff --git a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
index e612131b95c..63addd9fb70 100644
--- a/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
+++ b/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@ Java_java_net_Inet6AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
} else {
// ensure null-terminated
hostname[NI_MAXHOST] = '\0';
-#if defined(__linux__) && defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
/* On Linux/FreeBSD gethostname() says "host.domain.sun.com". On
* Solaris gethostname() says "host", so extra work is needed.
*/
@@ -532,10 +532,15 @@ ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
* from the host that we are trying to determine is reachable.
*/
if (n >= 8 && icmp6->icmp6_type == ICMP6_ECHO_REPLY &&
- (ntohs(icmp6->icmp6_id) == pid) &&
- NET_IsEqual(caddr, recv_caddr)) {
- close(fd);
- return JNI_TRUE;
+ (ntohs(icmp6->icmp6_id) == pid)) {
+ if (NET_IsEqual(caddr, recv_caddr)) {
+ close(fd);
+ return JNI_TRUE;
+ }
+ if (NET_IsZeroAddr(caddr)) {
+ close(fd);
+ return JNI_TRUE;
+ }
}
}
} while (tmout2 > 0);
diff --git a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
index cbdacdf6bcd..382ec4c83bc 100644
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
@@ -84,6 +84,7 @@ static jfieldID pdsi_ttlID;
#endif
extern void setDefaultScopeID(JNIEnv *env, struct sockaddr *him);
+extern int getDefaultScopeID(JNIEnv *env);
/*
* Returns a java.lang.Integer based on 'i'
@@ -2418,7 +2419,11 @@ static void mcast_join_leave(JNIEnv *env, jobject this,
}
}
#endif
-
+#ifdef MACOSX
+ if (family == AF_INET6 && index == 0) {
+ index = getDefaultScopeID(env);
+ }
+#endif
mname6.ipv6mr_interface = index;
} else {
jint idx = (*env)->GetIntField(env, niObj, ni_indexID);
diff --git a/jdk/src/solaris/native/java/net/net_util_md.c b/jdk/src/solaris/native/java/net/net_util_md.c
index f7e6d6a02ab..35330916214 100644
--- a/jdk/src/solaris/native/java/net/net_util_md.c
+++ b/jdk/src/solaris/native/java/net/net_util_md.c
@@ -109,6 +109,24 @@ void setDefaultScopeID(JNIEnv *env, struct sockaddr *him)
#endif
}
+int getDefaultScopeID(JNIEnv *env) {
+ static jclass ni_class = NULL;
+ static jfieldID ni_defaultIndexID;
+ if (ni_class == NULL) {
+ jclass c = (*env)->FindClass(env, "java/net/NetworkInterface");
+ CHECK_NULL(c);
+ c = (*env)->NewGlobalRef(env, c);
+ CHECK_NULL(c);
+ ni_defaultIndexID = (*env)->GetStaticFieldID(env, c,
+ "defaultIndex", "I");
+ ni_class = c;
+ }
+ int defaultIndex = 0;
+ defaultIndex = (*env)->GetStaticIntField(env, ni_class,
+ ni_defaultIndexID);
+ return defaultIndex;
+}
+
#ifdef __solaris__
static int init_tcp_max_buf, init_udp_max_buf;
static int tcp_max_buf;
@@ -943,6 +961,16 @@ NET_IsEqual(jbyte* caddr1, jbyte* caddr2) {
return 1;
}
+int NET_IsZeroAddr(jbyte* caddr) {
+ int i;
+ for (i = 0; i < 16; i++) {
+ if (caddr[i] != 0) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
/*
* Map the Java level socket option to the platform specific
* level and option name.
diff --git a/jdk/src/solaris/native/java/util/TimeZone_md.c b/jdk/src/solaris/native/java/util/TimeZone_md.c
index 3af5d72657f..ce2fa5aca8c 100644
--- a/jdk/src/solaris/native/java/util/TimeZone_md.c
+++ b/jdk/src/solaris/native/java/util/TimeZone_md.c
@@ -651,7 +651,7 @@ findJavaTZ_md(const char *java_home_dir, const char *country)
}
#ifdef __solaris__
- if (strcmp(tz, "localtime") == 0) {
+ if (tz != NULL && strcmp(tz, "localtime") == 0) {
tz = getSolarisDefaultZoneID();
freetz = tz;
}
diff --git a/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c b/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
index 7d42d1404c3..3bccd574871 100644
--- a/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
+++ b/jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
@@ -77,7 +77,7 @@ Java_sun_nio_ch_DatagramChannelImpl_initIDs(JNIEnv *env, jclass clazz)
JNIEXPORT void JNICALL
Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jobject this,
- jobject fdo)
+ jobject fdo, jboolean isIPv6)
{
jint fd = fdval(env, fdo);
int rv;
@@ -94,7 +94,7 @@ Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jobject this,
memset(&sa, 0, sizeof(sa));
#ifdef AF_INET6
- if (ipv6_available()) {
+ if (isIPv6) {
struct sockaddr_in6 *him6 = (struct sockaddr_in6 *)&sa;
#if defined(_ALLBSD_SOURCE)
him6->sin6_family = AF_INET6;
diff --git a/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c b/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
index 3d4f05100d1..7f7a3e82690 100644
--- a/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
+++ b/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
@@ -30,40 +30,10 @@
#include "sun_nio_ch_EPollArrayWrapper.h"
-#include
#include
#include
#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* epoll_wait(2) man page */
-
-typedef union epoll_data {
- void *ptr;
- int fd;
- __uint32_t u32;
- __uint64_t u64;
-} epoll_data_t;
-
-
-/* x86-64 has same alignment as 32-bit */
-#ifdef __x86_64__
-#define EPOLL_PACKED __attribute__((packed))
-#else
-#define EPOLL_PACKED
-#endif
-
-struct epoll_event {
- __uint32_t events; /* Epoll events */
- epoll_data_t data; /* User data variable */
-} EPOLL_PACKED;
-
-#ifdef __cplusplus
-}
-#endif
+#include
#define RESTARTABLE(_cmd, _result) do { \
do { \
@@ -71,18 +41,6 @@ struct epoll_event {
} while((_result == -1) && (errno == EINTR)); \
} while(0)
-/*
- * epoll event notification is new in 2.6 kernel. As the offical build
- * platform for the JDK is on a 2.4-based distribution then we must
- * obtain the addresses of the epoll functions dynamically.
- */
-typedef int (*epoll_create_t)(int size);
-typedef int (*epoll_ctl_t) (int epfd, int op, int fd, struct epoll_event *event);
-typedef int (*epoll_wait_t) (int epfd, struct epoll_event *events, int maxevents, int timeout);
-
-static epoll_create_t epoll_create_func;
-static epoll_ctl_t epoll_ctl_func;
-static epoll_wait_t epoll_wait_func;
static int
iepoll(int epfd, struct epoll_event *events, int numfds, jlong timeout)
@@ -96,7 +54,7 @@ iepoll(int epfd, struct epoll_event *events, int numfds, jlong timeout)
start = t.tv_sec * 1000 + t.tv_usec / 1000;
for (;;) {
- int res = (*epoll_wait_func)(epfd, events, numfds, timeout);
+ int res = epoll_wait(epfd, events, numfds, timeout);
if (res < 0 && errno == EINTR) {
if (remaining >= 0) {
gettimeofday(&t, NULL);
@@ -117,14 +75,6 @@ iepoll(int epfd, struct epoll_event *events, int numfds, jlong timeout)
JNIEXPORT void JNICALL
Java_sun_nio_ch_EPollArrayWrapper_init(JNIEnv *env, jclass this)
{
- epoll_create_func = (epoll_create_t) dlsym(RTLD_DEFAULT, "epoll_create");
- epoll_ctl_func = (epoll_ctl_t) dlsym(RTLD_DEFAULT, "epoll_ctl");
- epoll_wait_func = (epoll_wait_t) dlsym(RTLD_DEFAULT, "epoll_wait");
-
- if ((epoll_create_func == NULL) || (epoll_ctl_func == NULL) ||
- (epoll_wait_func == NULL)) {
- JNU_ThrowInternalError(env, "unable to get address of epoll functions, pre-2.6 kernel?");
- }
}
JNIEXPORT jint JNICALL
@@ -134,7 +84,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollCreate(JNIEnv *env, jobject this)
* epoll_create expects a size as a hint to the kernel about how to
* dimension internal structures. We can't predict the size in advance.
*/
- int epfd = (*epoll_create_func)(256);
+ int epfd = epoll_create(256);
if (epfd < 0) {
JNU_ThrowIOExceptionWithLastError(env, "epoll_create failed");
}
@@ -173,7 +123,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollCtl(JNIEnv *env, jobject this, jint epfd,
event.events = events;
event.data.fd = fd;
- RESTARTABLE((*epoll_ctl_func)(epfd, (int)opcode, (int)fd, &event), res);
+ RESTARTABLE(epoll_ctl(epfd, (int)opcode, (int)fd, &event), res);
/*
* A channel may be registered with several Selectors. When each Selector
@@ -199,7 +149,7 @@ Java_sun_nio_ch_EPollArrayWrapper_epollWait(JNIEnv *env, jobject this,
int res;
if (timeout <= 0) { /* Indefinite or no wait */
- RESTARTABLE((*epoll_wait_func)(epfd, events, numfds, timeout), res);
+ RESTARTABLE(epoll_wait(epfd, events, numfds, timeout), res);
} else { /* Bounded wait; bounded restarts */
res = iepoll(epfd, events, numfds, timeout);
}
diff --git a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
index 5d34d4fffe6..7e23874e0dd 100644
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
@@ -37,8 +37,6 @@ import java.util.*;
import java.util.List;
import java.util.concurrent.*;
-import sun.security.action.LoadLibraryAction;
-
import static sun.awt.shell.Win32ShellFolder2.*;
import sun.awt.OSInfo;
@@ -56,7 +54,13 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
static {
// Load library here
- AccessController.doPrivileged(new LoadLibraryAction("awt"));
+ AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("awt");
+ return null;
+ }
+ });
}
public ShellFolder createShellFolder(File file) throws FileNotFoundException {
diff --git a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
index 56568dcf3a1..11fe02f83d0 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
@@ -139,13 +139,16 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
String jDirectory = null;
String jFile = null;
- String jFiles[] = null;
+ File[] jFiles = null;
if (multiple) {
jDirectory = wFiles[0];
- jFiles = new String[wFiles.length - 1];
- System.arraycopy(wFiles, 1, jFiles, 0, jFiles.length);
- jFile = jFiles[1]; // choose any file
+ int filesNumber = wFiles.length - 1;
+ jFiles = new File[filesNumber];
+ for (int i = 0; i < filesNumber; i++) {
+ jFiles[i] = new File(jDirectory, wFiles[i + 1]);
+ }
+ jFile = wFiles[1]; // choose any file
} else {
int index = wFiles[0].lastIndexOf(java.io.File.separatorChar);
if (index == -1) {
@@ -155,7 +158,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
jDirectory = wFiles[0].substring(0, index + 1);
jFile = wFiles[0].substring(index + 1);
}
- jFiles = new String[] { jFile };
+ jFiles = new File[] { new File(jDirectory, jFile) };
}
final FileDialog fileDialog = (FileDialog)target;
@@ -163,7 +166,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
fileDialogAccessor.setDirectory(fileDialog, jDirectory);
fileDialogAccessor.setFile(fileDialog, jFile);
- fileDialogAccessor.setFiles(fileDialog, jDirectory, jFiles);
+ fileDialogAccessor.setFiles(fileDialog, jFiles);
WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
public void run() {
@@ -178,7 +181,7 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
final FileDialog fileDialog = (FileDialog)target;
AWTAccessor.getFileDialogAccessor().setFile(fileDialog, null);
- AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null, null);
+ AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null);
WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
public void run() {
diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
index 0c0cdd47aa7..515a8230bf3 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -94,7 +94,12 @@ public class WToolkit extends SunToolkit implements Runnable {
public static void loadLibraries() {
if (!loaded) {
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("awt"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("awt");
+ return null;
+ }
+ });
loaded = true;
}
}
diff --git a/jdk/src/windows/classes/sun/management/FileSystemImpl.java b/jdk/src/windows/classes/sun/management/FileSystemImpl.java
index 71fdaf2d297..789b7ee64ee 100644
--- a/jdk/src/windows/classes/sun/management/FileSystemImpl.java
+++ b/jdk/src/windows/classes/sun/management/FileSystemImpl.java
@@ -56,8 +56,13 @@ public class FileSystemImpl extends FileSystem {
// Initialization
static {
- java.security.AccessController
- .doPrivileged(new sun.security.action.LoadLibraryAction("management"));
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("management");
+ return null;
+ }
+ });
init0();
}
}
diff --git a/jdk/src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java b/jdk/src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java
index eb7405de9d3..b896fbf6344 100644
--- a/jdk/src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java
+++ b/jdk/src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java
@@ -161,7 +161,12 @@ public class ResolverConfigurationImpl
static {
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("net"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("net");
+ return null;
+ }
+ });
init0();
// start the address listener thread
diff --git a/jdk/src/windows/classes/sun/print/Win32PrintServiceLookup.java b/jdk/src/windows/classes/sun/print/Win32PrintServiceLookup.java
index 899ef23e461..dc9e9ee1b27 100644
--- a/jdk/src/windows/classes/sun/print/Win32PrintServiceLookup.java
+++ b/jdk/src/windows/classes/sun/print/Win32PrintServiceLookup.java
@@ -56,7 +56,12 @@ public class Win32PrintServiceLookup extends PrintServiceLookup {
static {
java.security.AccessController.doPrivileged(
- new sun.security.action.LoadLibraryAction("awt"));
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("awt");
+ return null;
+ }
+ });
}
/* The singleton win32 print lookup service.
diff --git a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java
index 488c2365b00..d8d8849e13c 100644
--- a/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java
+++ b/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java
@@ -57,8 +57,8 @@ import sun.security.rsa.RSAKeyFactory;
*
* NOTE: NONEwithRSA must be supplied with a pre-computed message digest.
* Only the following digest algorithms are supported: MD5, SHA-1,
- * SHA-256, SHA-384, SHA-512 and a special-purpose digest algorithm
- * which is a concatenation of SHA-1 and MD5 digests.
+ * SHA-256, SHA-384, SHA-512 and a special-purpose digest
+ * algorithm which is a concatenation of SHA-1 and MD5 digests.
*
* @since 1.6
* @author Stanley Man-Kit Ho
diff --git a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java
index f7df7ce4a8f..1af669415ee 100644
--- a/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java
+++ b/jdk/src/windows/classes/sun/security/mscapi/SunMSCAPI.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,18 +81,26 @@ public final class SunMSCAPI extends Provider {
*/
// NONEwithRSA must be supplied with a pre-computed message digest.
// Only the following digest algorithms are supported: MD5, SHA-1,
- // SHA-256, SHA-384, SHA-512 and a special-purpose digest algorithm
- // which is a concatenation of SHA-1 and MD5 digests.
+ // SHA-256, SHA-384, SHA-512 and a special-purpose digest
+ // algorithm which is a concatenation of SHA-1 and MD5 digests.
map.put("Signature.NONEwithRSA",
"sun.security.mscapi.RSASignature$Raw");
map.put("Signature.SHA1withRSA",
"sun.security.mscapi.RSASignature$SHA1");
map.put("Signature.SHA256withRSA",
"sun.security.mscapi.RSASignature$SHA256");
+ map.put("Alg.Alias.Signature.1.2.840.113549.1.1.11", "SHA256withRSA");
+ map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.11", "SHA256withRSA");
map.put("Signature.SHA384withRSA",
"sun.security.mscapi.RSASignature$SHA384");
+ map.put("Alg.Alias.Signature.1.2.840.113549.1.1.12", "SHA384withRSA");
+ map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.12", "SHA384withRSA");
+
map.put("Signature.SHA512withRSA",
"sun.security.mscapi.RSASignature$SHA512");
+ map.put("Alg.Alias.Signature.1.2.840.113549.1.1.13", "SHA512withRSA");
+ map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.13", "SHA512withRSA");
+
map.put("Signature.MD5withRSA",
"sun.security.mscapi.RSASignature$MD5");
map.put("Signature.MD2withRSA",
diff --git a/jdk/src/windows/classes/sun/security/smartcardio/PlatformPCSC.java b/jdk/src/windows/classes/sun/security/smartcardio/PlatformPCSC.java
index ea6e2fcd72b..0af23c0ddde 100644
--- a/jdk/src/windows/classes/sun/security/smartcardio/PlatformPCSC.java
+++ b/jdk/src/windows/classes/sun/security/smartcardio/PlatformPCSC.java
@@ -26,8 +26,7 @@
package sun.security.smartcardio;
import java.security.AccessController;
-
-import sun.security.action.LoadLibraryAction;
+import java.security.PrivilegedAction;
// Platform specific code and constants
class PlatformPCSC {
@@ -44,7 +43,12 @@ class PlatformPCSC {
private static Throwable loadLibrary() {
try {
- AccessController.doPrivileged(new LoadLibraryAction("j2pcsc"));
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("j2pcsc");
+ return null;
+ }
+ });
return null;
} catch (Throwable e) {
return e;
diff --git a/jdk/src/windows/native/java/net/NetworkInterface.c b/jdk/src/windows/native/java/net/NetworkInterface.c
index d6b04886975..8dbeb925029 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface.c
+++ b/jdk/src/windows/native/java/net/NetworkInterface.c
@@ -178,7 +178,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
int count;
netif *netifP;
DWORD i;
- int lo=0, eth=0, tr=0, fddi=0, ppp=0, sl=0, net=0;
+ int lo=0, eth=0, tr=0, fddi=0, ppp=0, sl=0, wlan=0, net=0;
/*
* Ask the IP Helper library to enumerate the adapters
@@ -218,15 +218,15 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
*/
switch (ifrowP->dwType) {
case MIB_IF_TYPE_ETHERNET:
- sprintf(dev_name, "eth%d", eth++);
+ _snprintf_s(dev_name, 8, _TRUNCATE, "eth%d", eth++);
break;
case MIB_IF_TYPE_TOKENRING:
- sprintf(dev_name, "tr%d", tr++);
+ _snprintf_s(dev_name, 8, _TRUNCATE, "tr%d", tr++);
break;
case MIB_IF_TYPE_FDDI:
- sprintf(dev_name, "fddi%d", fddi++);
+ _snprintf_s(dev_name, 8, _TRUNCATE, "fddi%d", fddi++);
break;
case MIB_IF_TYPE_LOOPBACK:
@@ -234,20 +234,24 @@ int enumInterfaces(JNIEnv *env, netif **netifPP)
if (lo > 0) {
continue;
}
- strcpy(dev_name, "lo");
+ strncpy_s(dev_name, 8, "lo", _TRUNCATE);
lo++;
break;
case MIB_IF_TYPE_PPP:
- sprintf(dev_name, "ppp%d", ppp++);
+ _snprintf_s(dev_name, 8, _TRUNCATE, "ppp%d", ppp++);
break;
case MIB_IF_TYPE_SLIP:
- sprintf(dev_name, "sl%d", sl++);
+ _snprintf_s(dev_name, 8, _TRUNCATE, "sl%d", sl++);
+ break;
+
+ case IF_TYPE_IEEE80211:
+ _snprintf_s(dev_name, 8, _TRUNCATE, "wlan%d", wlan++);
break;
default:
- sprintf(dev_name, "net%d", net++);
+ _snprintf_s(dev_name, 8, _TRUNCATE, "net%d", net++);
}
/*
@@ -382,6 +386,7 @@ int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP)
case MIB_IF_TYPE_TOKENRING:
case MIB_IF_TYPE_FDDI:
case MIB_IF_TYPE_LOOPBACK:
+ case IF_TYPE_IEEE80211:
/**
* Contrary to what it seems to indicate, dwBCastAddr doesn't
* contain the broadcast address but 0 or 1 depending on whether
@@ -928,6 +933,7 @@ JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0
case MIB_IF_TYPE_ETHERNET:
case MIB_IF_TYPE_TOKENRING:
case MIB_IF_TYPE_FDDI:
+ case IF_TYPE_IEEE80211:
len = ifRowP->dwPhysAddrLen;
ret = (*env)->NewByteArray(env, len);
if (!IS_NULL(ret)) {
diff --git a/jdk/src/windows/native/java/net/NetworkInterface.h b/jdk/src/windows/native/java/net/NetworkInterface.h
index 262e15a0db0..2f977fd624b 100644
--- a/jdk/src/windows/native/java/net/NetworkInterface.h
+++ b/jdk/src/windows/native/java/net/NetworkInterface.h
@@ -89,4 +89,9 @@ extern jfieldID ni_ibmaskID; /* InterfaceAddress.maskLength */
int enumInterfaces(JNIEnv *env, netif **netifPP);
+// Windows Visa (and later) only.....
+#ifndef IF_TYPE_IEEE80211
+#define IF_TYPE_IEEE80211 71
+#endif
+
#endif
diff --git a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
index 8df4b94a3ba..555ca9fbbfb 100644
--- a/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
+++ b/jdk/src/windows/native/sun/nio/ch/DatagramChannelImpl.c
@@ -108,7 +108,7 @@ jboolean purgeOutstandingICMP(JNIEnv *env, jclass clazz, jint fd)
JNIEXPORT void JNICALL
Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jobject this,
- jobject fdo)
+ jobject fdo, jboolean isIPv6)
{
jint fd = fdval(env, fdo);
int rv = 0;
diff --git a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
index a956730d8ca..2ee38039823 100644
--- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
+++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
@@ -466,7 +466,17 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_enqueue
}
CloseHandle(hThread);
} else {
- JNU_ThrowIOExceptionWithLastError(env, "CreateRemoteThread failed");
+ if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) {
+ //
+ // This error will occur when attaching to a process belonging to
+ // another terminal session. See "Remarks":
+ // http://msdn.microsoft.com/en-us/library/ms682437%28VS.85%29.aspx
+ //
+ JNU_ThrowIOException(env,
+ "Insufficient memory or insufficient privileges to attach");
+ } else {
+ JNU_ThrowIOExceptionWithLastError(env, "CreateRemoteThread failed");
+ }
}
VirtualFreeEx(hProcess, pCode, 0, MEM_RELEASE);
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 1980d033038..79c53f580db 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -286,13 +286,13 @@ com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java generic
# Failing on Solaris i586, 3/9/2010, not a -samevm issue (jdk_security3)
sun/security/pkcs11/Secmod/AddPrivateKey.java solaris-i586
-sun/security/pkcs11/ec/ReadCertificates.java solaris-i586
-sun/security/pkcs11/ec/ReadPKCS12.java solaris-i586
+sun/security/pkcs11/ec/ReadCertificates.java generic-all
+sun/security/pkcs11/ec/ReadPKCS12.java generic-all
sun/security/pkcs11/ec/TestCurves.java solaris-i586
sun/security/pkcs11/ec/TestECDSA.java solaris-i586
#sun/security/pkcs11/ec/TestECGenSpec.java solaris-i586
#sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586
-sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java solaris-i586
+sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java generic-all
# Fails on Fedora 9/Ubuntu 10.04 64bit, PKCS11Exception: CKR_DEVICE_ERROR
sun/security/pkcs11/KeyAgreement/TestDH.java generic-all
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java
index 2d7d8863b08..55b501ebf36 100644
--- a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEP.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,6 +58,7 @@ public class TestOAEP {
Cipher.getInstance("RSA/ECB/OAEPwithMD5andMGF1Padding");
Cipher.getInstance("RSA/ECB/OAEPwithSHA1andMGF1Padding");
Cipher.getInstance("RSA/ECB/OAEPwithSHA-1andMGF1Padding");
+ Cipher.getInstance("RSA/ECB/OAEPwithSHA-224andMGF1Padding");
Cipher.getInstance("RSA/ECB/OAEPwithSHA-256andMGF1Padding");
Cipher.getInstance("RSA/ECB/OAEPwithSHA-384andMGF1Padding");
Cipher.getInstance("RSA/ECB/OAEPwithSHA-512andMGF1Padding");
@@ -88,6 +89,18 @@ public class TestOAEP {
// tests alias works
testEncryptDecrypt("SHA-1", 16);
+ // basic test using SHA-224
+ testEncryptDecrypt("SHA-224", 0);
+ testEncryptDecrypt("SHA-224", 16);
+ testEncryptDecrypt("SHA-224", 38);
+ try {
+ testEncryptDecrypt("SHA-224", 39);
+ throw new Exception("Unexpectedly completed call");
+ } catch (IllegalBlockSizeException e) {
+ // ok
+ System.out.println(e);
+ }
+
// basic test using SHA-256
testEncryptDecrypt("SHA-256", 0);
testEncryptDecrypt("SHA-256", 16);
@@ -195,6 +208,7 @@ public class TestOAEP {
System.out.println("Done (" + (stop - start) + " ms).");
}
+ // NOTE: OAEP can process up to (modLen - 2*digestLen - 2) bytes of data
private static void testEncryptDecrypt(String hashAlg, int dataLength) throws Exception {
System.out.println("Testing OAEP with hash " + hashAlg + ", " + dataLength + " bytes");
Cipher c = Cipher.getInstance("RSA/ECB/OAEPwith" + hashAlg + "andMGF1Padding", cp);
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPParameterSpec.java b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPParameterSpec.java
index 366467b2bf6..1a152859f35 100644
--- a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPParameterSpec.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPParameterSpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -121,6 +121,7 @@ public class TestOAEPParameterSpec {
public static void main(String[] argv) throws Exception {
boolean status = true;
byte[] p = { (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04 };
+ status &= runTest("SHA-224", MGF1ParameterSpec.SHA224, p);
status &= runTest("SHA-256", MGF1ParameterSpec.SHA256, p);
status &= runTest("SHA-384", MGF1ParameterSpec.SHA384, p);
status &= runTest("SHA-512", MGF1ParameterSpec.SHA512, p);
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPWithParams.java b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPWithParams.java
index 97ee3a82ead..13bdfe1a31b 100644
--- a/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPWithParams.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/RSA/TestOAEPWithParams.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,10 +47,10 @@ public class TestOAEPWithParams {
private static Random random = new Random();
private static String MD[] = {
- "MD5", "SHA1", "SHA-256"
+ "MD5", "SHA1", "SHA-224", "SHA-256"
};
private static int DATA_LENGTH[] = {
- 62, 54, 30
+ 62, 54, 34, 30
};
public static void main(String[] args) throws Exception {
long start = System.currentTimeMillis();
diff --git a/jdk/test/com/sun/crypto/provider/KeyGenerator/Test4628062.java b/jdk/test/com/sun/crypto/provider/KeyGenerator/Test4628062.java
index d037c2290ef..3fc55b7f8c3 100644
--- a/jdk/test/com/sun/crypto/provider/KeyGenerator/Test4628062.java
+++ b/jdk/test/com/sun/crypto/provider/KeyGenerator/Test4628062.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4628062
+ * @bug 4628062 4963723
* @summary Verify that AES KeyGenerator supports default initialization
* when init is not called
* @author Valerie Peng
@@ -34,39 +34,45 @@ import java.util.*;
public class Test4628062 {
- private static final String ALGO = "AES";
- private static final int[] KEYSIZES =
- { 16, 24, 32 }; // in bytes
+ private static final int[] AES_SIZES = { 16, 24, 32 }; // in bytes
+ private static final int[] HMACSHA224_SIZES = { 28 };
+ private static final int[] HMACSHA256_SIZES = { 32 };
+ private static final int[] HMACSHA384_SIZES = { 48 };
+ private static final int[] HMACSHA512_SIZES = { 64 };
- public boolean execute() throws Exception {
- KeyGenerator kg = KeyGenerator.getInstance(ALGO, "SunJCE");
+ public boolean execute(String algo, int[] keySizes) throws Exception {
+ KeyGenerator kg = KeyGenerator.getInstance(algo, "SunJCE");
// TEST FIX 4628062
Key keyWithDefaultSize = kg.generateKey();
byte[] encoding = keyWithDefaultSize.getEncoded();
- if (encoding.length == 0) {
+ int defKeyLen = encoding.length ;
+ if (defKeyLen == 0) {
throw new Exception("default key length is 0!");
+ } else if (defKeyLen != keySizes[0]) {
+ throw new Exception("default key length mismatch!");
}
// BONUS TESTS
- // 1. call init(int keysize) with various valid key sizes
- // and see if the generated key is the right size.
- for (int i=0; i 1) {
+ // 1. call init(int keysize) with various valid key sizes
+ // and see if the generated key is the right size.
+ for (int i=0; i expectedPolicy) {
+ FocusTraversalPolicy ftp = win.getFocusTraversalPolicy();
+
+ System.out.println("==============" + "\n" +
+ "Tested window: " + win + "\n" +
+ "Expected policy: " + expectedPolicy + "\n" +
+ "Effective policy: " + ftp.getClass());
+
+ if (!expectedPolicy.equals(ftp.getClass())) {
+ throw new RuntimeException("Test failed: wrong effective focus policy");
+ }
+ }
+}
diff --git a/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java
new file mode 100644
index 00000000000..b22117a1dec
--- /dev/null
+++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_AWT.java
@@ -0,0 +1,50 @@
+/*
+ @bug 7125044
+ @summary Tests default focus traversal policy in AWT toplevel windows.
+ @author anton.tarasov@sun.com: area=awt.focus
+*/
+
+import java.awt.Button;
+import java.awt.DefaultFocusTraversalPolicy;
+import java.awt.FlowLayout;
+import java.awt.FocusTraversalPolicy;
+import java.awt.Frame;
+import java.awt.List;
+import java.awt.TextArea;
+import java.awt.Window;
+
+public class InitialFTP_AWT {
+ public static void main(String[] args) {
+ AWTFrame f0 = new AWTFrame("frame0");
+ f0.setVisible(true);
+
+ InitialFTP.test(f0, DefaultFocusTraversalPolicy.class);
+
+ AWTFrame f1 = new AWTFrame("frame1");
+ f1.setVisible(true);
+
+ InitialFTP.test(f1, DefaultFocusTraversalPolicy.class);
+
+ System.out.println("Test passed.");
+ }
+}
+
+class AWTFrame extends Frame {
+ Button button = new Button("button");
+ TextArea text = new TextArea("qwerty");
+ List list = new List();
+
+ public AWTFrame(String title) {
+ super(title);
+
+ list.add("one");
+ list.add("two");
+ list.add("three");
+
+ this.setLayout(new FlowLayout());
+ this.add(button);
+ this.add(text);
+ this.add(list);
+ this.pack();
+ }
+}
diff --git a/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java
new file mode 100644
index 00000000000..ab756220b6b
--- /dev/null
+++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/InitialFTP_Swing.java
@@ -0,0 +1,46 @@
+/*
+ @bug 7125044
+ @summary Tests default focus traversal policy in Swing toplevel windows.
+ @author anton.tarasov@sun.com: area=awt.focus
+*/
+
+import java.awt.FlowLayout;
+import java.awt.FocusTraversalPolicy;
+import java.awt.Window;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JTextArea;
+import javax.swing.LayoutFocusTraversalPolicy;
+
+public class InitialFTP_Swing {
+ public static void main(String[] args) {
+ SwingFrame f0 = new SwingFrame("frame0");
+ f0.setVisible(true);
+
+ InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
+
+ SwingFrame f1 = new SwingFrame("frame1");
+ f1.setVisible(true);
+
+ InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
+
+ System.out.println("Test passed.");
+ }
+}
+
+class SwingFrame extends JFrame {
+ JButton button = new JButton("button");
+ JTextArea text = new JTextArea("qwerty");
+ JList list = new JList(new String[] {"one", "two", "three"});
+
+ public SwingFrame(String title) {
+ super(title);
+
+ this.setLayout(new FlowLayout());
+ this.add(button);
+ this.add(text);
+ this.add(list);
+ this.pack();
+ }
+}
diff --git a/jdk/test/java/awt/Frame/FrameStateTest/FrameStateTest.html b/jdk/test/java/awt/Frame/FrameStateTest/FrameStateTest.html
new file mode 100644
index 00000000000..5c88ac2d1d8
--- /dev/null
+++ b/jdk/test/java/awt/Frame/FrameStateTest/FrameStateTest.html
@@ -0,0 +1,50 @@
+
+
+
+
+ FrameStateTest
+
+
+
+FrameStateTest Bug ID: 4157271
+This test checks that when setState(Frame.ICONIFIED) is called before
+ setVisible(true) the Frame is shown in the proper iconified state.
+ The problem was that it did not honor the initial iconic state, but
+ instead was shown in the NORMAL state.
+See the dialog box (usually in upper left corner) for instructions
+
+
+
+
diff --git a/jdk/test/java/awt/Frame/FrameStateTest/FrameStateTest.java b/jdk/test/java/awt/Frame/FrameStateTest/FrameStateTest.java
new file mode 100644
index 00000000000..33ea9b304ff
--- /dev/null
+++ b/jdk/test/java/awt/Frame/FrameStateTest/FrameStateTest.java
@@ -0,0 +1,459 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 4157271
+ @summary Checks that when a Frame is created it honors the state it
+ was set to. The bug was that if setState(Frame.ICONIFIED) was
+ called before setVisible(true) the Frame would be shown in NORMAL
+ state instead of ICONIFIED.
+ @author JTG East Team: area=awt.Frame
+ @run applet/manual=yesno FrameStateTest.html
+*/
+
+/**
+ * FrameStateTest.java
+ *
+ * summary: Checks that when setState(Frame.ICONIFIED) is called before
+ * setVisible(true) the Frame is shown in the proper iconified state.
+ * The problem was that it did not honor the initial iconic state, but
+ * instead was shown in the NORMAL state.
+ */
+
+import java.awt.event.*;
+import java.awt.*;
+import java.lang.*;
+import java.applet.Applet;
+
+
+public class FrameStateTest extends Applet implements ActionListener, ItemListener{
+
+ Button btnCreate = new Button("Create Frame");
+ Button btnDispose = new Button("Dispose Frame");
+ CheckboxGroup cbgState = new CheckboxGroup();
+ CheckboxGroup cbgResize = new CheckboxGroup();
+ Checkbox cbIconState = new Checkbox("Frame state ICONIFIED",cbgState,false);
+ Checkbox cbNormState = new Checkbox("Frame state NORMAL",cbgState,true);
+ Checkbox cbNonResize = new Checkbox("Frame Nonresizable",cbgResize,false);
+ Checkbox cbResize = new Checkbox("Frame Resizable",cbgResize,true);
+ int iState = 0;
+ boolean bResize = true;
+ CreateFrame icontst;
+
+ public void init() {
+ this.setLayout (new BorderLayout ());
+
+ String[] instructions =
+ {
+ "Steps to try to reproduce this problem:",
+ "When this test is run an Applet Viewer window will display. In the",
+ "Applet Viewer window select the different options for the Frame (i.e.",
+ "{Normal, Non-resizalbe}, {Normal, Resizable}, {Iconified, Resizable},",
+ "{Iconified, Non-resizalbe}). After chosing the Frame's state click the",
+ "Create Frame button. After the Frame (Frame State Test (Window2)) comes",
+ "up make sure the proper behavior occurred (Frame shown in proper state).",
+ "Click the Dispose button to close the Frame. Do the above steps for all",
+ "the different Frame state combinations available. If you observe the",
+ "proper behavior the test has passed, Press the Pass button. Otherwise",
+ "the test has failed, Press the Fail button.",
+ "Note: In Frame State Test (Window2) you can also chose the different",
+ "buttons to see different Frame behavior. An example of a problem that",
+ "has been seen, With the Frame nonresizable you can not iconify the Frame."
+ };
+ Sysout.createDialogWithInstructions( instructions );
+
+ btnDispose.setEnabled(false);
+ add(btnCreate, BorderLayout.NORTH);
+ add(btnDispose, BorderLayout.SOUTH);
+
+ Panel p = new Panel(new GridLayout(0,1));
+ p.add(cbIconState);
+ p.add(cbResize);
+ add(p, BorderLayout.WEST);
+
+ p = new Panel(new GridLayout(0,1));
+ p.add(cbNormState);
+ p.add(cbNonResize);
+ add(p, BorderLayout.EAST);
+
+ // Add Listeners
+ btnDispose.addActionListener(this);
+ btnCreate.addActionListener(this);
+ cbNormState.addItemListener(this);
+ cbResize.addItemListener(this);
+ cbIconState.addItemListener(this);
+ cbNonResize.addItemListener(this);
+
+ resize(600, 200);
+
+ }//End init()
+
+ public void actionPerformed(ActionEvent evt) {
+
+
+ if (evt.getSource() == btnCreate) {
+ btnCreate.setEnabled(false);
+ btnDispose.setEnabled(true);
+ icontst = new CreateFrame(iState, bResize);
+ icontst.show();
+ } else if (evt.getSource() == btnDispose) {
+ btnCreate.setEnabled(true);
+ btnDispose.setEnabled(false);
+ icontst.dispose();
+ }
+ }
+
+ public void itemStateChanged(ItemEvent evt) {
+
+ if (cbNormState.getState()) iState = 0;
+ if (cbIconState.getState()) iState = 1;
+ if (cbResize.getState()) bResize = true;
+ if (cbNonResize.getState()) bResize = false;
+
+ }
+
+}// class FrameStateTest
+
+
+class CreateFrame extends Frame implements ActionListener , WindowListener {
+
+ static int e=0;
+ static int u=0;
+ static int p=0;
+ static int i=0;
+ static int v=0;
+
+ Button b1, b2, b3, b4, b5, b6, b7;
+ boolean resizable = true;
+ boolean iconic = false;
+ String name = "Frame State Test";
+
+ CreateFrame (int iFrameState, boolean bFrameResizable) {
+
+ setTitle("Frame State Test (Window 2)");
+
+ if (iFrameState == 1) {
+ iconic = true;
+ }
+
+ if (!(bFrameResizable)) {
+ resizable = false;
+ }
+
+ System.out.println("CREATING FRAME - Initially "+
+ ((iconic) ? "ICONIFIED" : "NORMAL (NON-ICONIFIED)") + " and " +
+ ((resizable) ? "RESIZABLE" : "NON-RESIZABLE") );
+
+ Sysout.println("CREATING FRAME - Initially "+
+ ((iconic) ? "ICONIFIED" : "NORMAL (NON-ICONIFIED)") + " and " +
+ ((resizable) ? "RESIZABLE" : "NON-RESIZABLE") );
+
+ setLayout(new FlowLayout() );
+ b1 = new Button("resizable");
+ add(b1);
+ b2 = new Button("resize");
+ add(b2);
+ b3 = new Button("iconify");
+ add(b3);
+ b4 = new Button("iconify and restore");
+ add(b4);
+ b5 = new Button("hide and show");
+ add(b5);
+ b6 = new Button("hide, iconify and show");
+ add(b6);
+ b7 = new Button("hide, iconify, show, and restore");
+ add(b7);
+ b1.addActionListener(this);
+ b2.addActionListener(this);
+ b3.addActionListener(this);
+ b4.addActionListener(this);
+ b5.addActionListener(this);
+ b6.addActionListener(this);
+ b7.addActionListener(this);
+ addWindowListener(this);
+
+ setBounds(100,2,200, 200);
+ setState(iconic ? Frame.ICONIFIED: Frame.NORMAL);
+ setResizable(resizable);
+ pack();
+ setVisible(true);
+
+ }
+
+ public void actionPerformed ( ActionEvent e )
+ {
+ if ( e.getSource() == b2 ) {
+ Rectangle r = this.getBounds();
+ r.width += 10;
+ System.out.println(" - button pressed - setting bounds on Frame to: "+r);
+ setBounds(r);
+ validate();
+ } else if ( e.getSource() == b1 ) {
+ resizable = !resizable;
+ System.out.println(" - button pressed - setting Resizable to: "+resizable);
+ ((Frame)(b1.getParent())).setResizable(resizable);
+ } else if ( e.getSource() == b3 ) {
+ System.out.println(" - button pressed - setting Iconic: ");
+ dolog();
+ ((Frame)(b1.getParent())).setState(Frame.ICONIFIED);
+ dolog();
+ } else if ( e.getSource() == b4 ) {
+ System.out.println(" - button pressed - setting Iconic: ");
+ dolog();
+ ((Frame)(b1.getParent())).setState(Frame.ICONIFIED);
+ dolog();
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ex) {};
+ System.out.println(" - now restoring: ");
+ ((Frame)(b1.getParent())).setState(Frame.NORMAL);
+ dolog();
+ } else if ( e.getSource() == b5 ) {
+ System.out.println(" - button pressed - hiding : ");
+ dolog();
+ ((Frame)(b1.getParent())).setVisible(false);
+ dolog();
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ex) {};
+ System.out.println(" - now reshowing: ");
+ ((Frame)(b1.getParent())).setVisible(true);
+ dolog();
+ } else if ( e.getSource() == b6 ) {
+ System.out.println(" - button pressed - hiding : ");
+ dolog();
+ ((Frame)(b1.getParent())).setVisible(false);
+ dolog();
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ex) {};
+ System.out.println(" - setting Iconic: ");
+ dolog();
+ ((Frame)(b1.getParent())).setState(Frame.ICONIFIED);
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ex) {};
+ System.out.println(" - now reshowing: ");
+ ((Frame)(b1.getParent())).setVisible(true);
+ dolog();
+ } else if ( e.getSource() == b7 ) {
+ System.out.println(" - button pressed - hiding : ");
+ dolog();
+ ((Frame)(b1.getParent())).setVisible(false);
+ dolog();
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ex) {};
+ System.out.println(" - setting Iconic: ");
+ dolog();
+ ((Frame)(b1.getParent())).setState(Frame.ICONIFIED);
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ex) {};
+ System.out.println(" - now reshowing: ");
+ ((Frame)(b1.getParent())).setVisible(true);
+ dolog();
+ try {
+ Thread.sleep(1000);
+ } catch (Exception ex) {};
+ System.out.println(" - now restoring: ");
+ ((Frame)(b1.getParent())).setState(Frame.NORMAL);
+ dolog();
+ }
+ }
+
+ public void windowActivated(WindowEvent e) {
+ System.out.println(name + " Activated");
+ dolog();
+ }
+ public void windowClosed(WindowEvent e) {
+ System.out.println(name + " Closed");
+ dolog();
+ }
+ public void windowClosing(WindowEvent e) {
+ ((Window)(e.getSource())).dispose();
+ System.out.println(name + " Closing");
+ dolog();
+ }
+ public void windowDeactivated(WindowEvent e) {
+ System.out.println(name + " Deactivated");
+ dolog();
+ }
+ public void windowDeiconified(WindowEvent e) {
+ System.out.println(name + " Deiconified");
+ dolog();
+ }
+ public void windowIconified(WindowEvent e) {
+ System.out.println(name + " Iconified");
+ dolog();
+ }
+ public void windowOpened(WindowEvent e) {
+ System.out.println(name + " Opened");
+ dolog();
+ }
+
+ public void dolog() {
+ System.out.println(" getState returns: "+getState());
+ }
+}
+
+// }// class FrameStateTest
+
+/****************************************************
+ 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.show();
+ 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.show();
+ 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 );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ int scrollNone = TextArea.SCROLLBARS_NONE;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 10, maxStringLength, scrollBoth );
+ add("South", messageText);
+
+ pack();
+
+ show();
+ }// 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" );
+ }
+
+
+ }// TestDialog class
diff --git a/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java b/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java
index c124ff5f434..29c3aa9b575 100644
--- a/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java
+++ b/jdk/test/java/awt/GraphicsDevice/CloneConfigsTest.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6822057
+ * @bug 6822057 7124400
*
* @summary Test verifies that list of supported graphics configurations
* can not be changed via modification of elements of an array
diff --git a/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java
new file mode 100644
index 00000000000..57637710a16
--- /dev/null
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7154048
+ * @summary Window created under a mouse does not receive mouse enter event.
+ * Mouse Entered/Exited events should be generated during dragging the window
+ * out of the frame and to the frame.
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author alexandr.scherbatiy area=awt.event
+ * @run main DragWindowOutOfFrameTest
+ */
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+import java.util.concurrent.*;
+import sun.awt.SunToolkit;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class DragWindowOutOfFrameTest {
+
+ private static volatile int dragWindowMouseEnteredCount = 0;
+ private static volatile int dragWindowMouseExitedCount = 0;
+ private static volatile int dragWindowMouseReleasedCount = 0;
+ private static volatile int buttonMouseEnteredCount = 0;
+ private static volatile int buttonMouseExitedCount = 0;
+ private static volatile int labelMouseEnteredCount = 0;
+ private static volatile int labelMouseExitedCount = 0;
+ private static volatile int labelMouseReleasedCount = 0;
+ private static MyDragWindow dragWindow;
+ private static JLabel label;
+ private static JButton button;
+
+ public static void main(String[] args) throws Exception {
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ Point pointToClick = Util.invokeOnEDT(new Callable() {
+
+ @Override
+ public Point call() throws Exception {
+ return getCenterPoint(label);
+ }
+ });
+
+
+ robot.mouseMove(pointToClick.x, pointToClick.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ if (dragWindowMouseEnteredCount != 1 && dragWindowMouseExitedCount != 0) {
+ throw new RuntimeException(
+ "Wrong number mouse Entered/Exited events on Drag Window!");
+ }
+
+ Point pointToDrag = Util.invokeOnEDT(new Callable() {
+
+ @Override
+ public Point call() throws Exception {
+ label.addMouseListener(new LabelMouseListener());
+ button.addMouseListener(new ButtonMouseListener());
+ return getCenterPoint(button);
+ }
+ });
+
+ robot.mouseMove(450, pointToClick.y);
+ toolkit.realSync();
+
+ if (labelMouseEnteredCount != 0 && labelMouseExitedCount != 1) {
+ throw new RuntimeException(
+ "Wrong number Mouse Entered/Exited events on label!");
+ }
+
+ robot.mouseMove(450, pointToDrag.y);
+ toolkit.realSync();
+
+ if (labelMouseEnteredCount != 0 && labelMouseExitedCount != 1) {
+ throw new RuntimeException(
+ "Wrong number Mouse Entered/Exited events on label!");
+ }
+
+ if (buttonMouseEnteredCount != 0 && buttonMouseExitedCount != 0) {
+ throw new RuntimeException(
+ "Wrong number Mouse Entered/Exited events on button!");
+ }
+
+ robot.mouseMove(pointToDrag.y, pointToDrag.y);
+ toolkit.realSync();
+
+ if (buttonMouseEnteredCount != 1 && buttonMouseExitedCount != 0) {
+ throw new RuntimeException(
+ "Wrong number Mouse Entered/Exited events on button!");
+ }
+
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ if (labelMouseReleasedCount != 1) {
+ throw new RuntimeException("No MouseReleased event on label!");
+ }
+ }
+
+ private static Point getCenterPoint(Component comp) {
+ Point p = comp.getLocationOnScreen();
+ Rectangle rect = comp.getBounds();
+ return new Point(p.x + rect.width / 2, p.y + rect.height / 2);
+ }
+
+ private static void createAndShowGUI() {
+
+ JFrame frame = new JFrame("Main Frame");
+ frame.setLocation(100, 100);
+ frame.setSize(300, 200);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ label = new JLabel("Label");
+
+ DragWindowCreationMouseListener listener = new DragWindowCreationMouseListener(frame);
+ label.addMouseListener(listener);
+ label.addMouseMotionListener(listener);
+
+ button = new JButton("Button");
+ Panel panel = new Panel(new BorderLayout());
+
+ panel.add(label, BorderLayout.NORTH);
+ panel.add(button, BorderLayout.CENTER);
+
+ frame.getContentPane().add(panel);
+ frame.setVisible(true);
+
+ }
+
+ private static Point getAbsoluteLocation(MouseEvent e) {
+ return new Point(e.getXOnScreen(), e.getYOnScreen());
+ }
+
+ static class MyDragWindow extends Window {
+
+ public MyDragWindow(Window parent, Point location) {
+ super(parent);
+ setSize(500, 300);
+ setVisible(true);
+ JPanel panel = new JPanel();
+ add(panel);
+ setLocation(location.x - 250, location.y - 150);
+ addMouseListener(new DragWindowMouseListener());
+ }
+
+ void dragTo(Point point) {
+ setLocation(point.x - 250, point.y - 150);
+ }
+ }
+
+ static class DragWindowCreationMouseListener extends MouseAdapter {
+
+ Point origin;
+ Window parent;
+
+ public DragWindowCreationMouseListener(Window parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ if (dragWindow == null) {
+ dragWindow = new MyDragWindow(parent, getAbsoluteLocation(e));
+ } else {
+ dragWindow.setVisible(true);
+ dragWindow.dragTo(getAbsoluteLocation(e));
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ labelMouseReleasedCount++;
+ if (dragWindow != null) {
+ dragWindow.setVisible(false);
+ }
+ }
+
+ public void mouseDragged(MouseEvent e) {
+ if (dragWindow != null) {
+ dragWindow.dragTo(getAbsoluteLocation(e));
+ }
+ }
+ }
+
+ static class DragWindowMouseListener extends MouseAdapter {
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ dragWindowMouseEnteredCount++;
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ dragWindowMouseExitedCount++;
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ dragWindowMouseReleasedCount++;
+ }
+ }
+
+ static class LabelMouseListener extends MouseAdapter {
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ labelMouseEnteredCount++;
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ labelMouseExitedCount++;
+ }
+ }
+
+ static class ButtonMouseListener extends MouseAdapter {
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ buttonMouseEnteredCount++;
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ buttonMouseExitedCount++;
+ }
+ }
+}
diff --git a/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java
new file mode 100644
index 00000000000..ccba2bcb7b0
--- /dev/null
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/DragWindowTest.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7154048
+ * @summary Window created under a mouse does not receive mouse enter event.
+ * Mouse Entered/Exited events are wrongly generated during dragging the window
+ * from one component to another
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author alexandr.scherbatiy area=awt.event
+ * @run main DragWindowTest
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+import java.util.concurrent.*;
+import sun.awt.SunToolkit;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class DragWindowTest {
+
+ private static volatile int dragWindowMouseEnteredCount = 0;
+ private static volatile int dragWindowMouseReleasedCount = 0;
+ private static volatile int buttonMouseEnteredCount = 0;
+ private static volatile int labelMouseReleasedCount = 0;
+ private static MyDragWindow dragWindow;
+ private static JLabel label;
+ private static JButton button;
+
+ public static void main(String[] args) throws Exception {
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ Point pointToClick = Util.invokeOnEDT(new Callable() {
+
+ @Override
+ public Point call() throws Exception {
+ return getCenterPoint(label);
+ }
+ });
+
+
+ robot.mouseMove(pointToClick.x, pointToClick.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ if (dragWindowMouseEnteredCount != 1) {
+ throw new RuntimeException("No MouseEntered event on Drag Window!");
+ }
+
+ Point pointToDrag = Util.invokeOnEDT(new Callable() {
+
+ @Override
+ public Point call() throws Exception {
+ button.addMouseListener(new ButtonMouseListener());
+ return getCenterPoint(button);
+ }
+ });
+
+ robot.mouseMove(pointToDrag.x, pointToDrag.y);
+ toolkit.realSync();
+
+ if (buttonMouseEnteredCount != 0) {
+ throw new RuntimeException("Extra MouseEntered event on button!");
+ }
+
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ if (labelMouseReleasedCount != 1) {
+ throw new RuntimeException("No MouseReleased event on label!");
+ }
+
+ }
+
+ private static Point getCenterPoint(Component comp) {
+ Point p = comp.getLocationOnScreen();
+ Rectangle rect = comp.getBounds();
+ return new Point(p.x + rect.width / 2, p.y + rect.height / 2);
+ }
+
+ private static void createAndShowGUI() {
+
+ JFrame frame = new JFrame("Main Frame");
+ frame.setSize(300, 200);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ label = new JLabel("Label");
+
+ LabelMouseListener listener = new LabelMouseListener(frame);
+ label.addMouseListener(listener);
+ label.addMouseMotionListener(listener);
+
+ button = new JButton("Button");
+ Panel panel = new Panel(new BorderLayout());
+
+ panel.add(label, BorderLayout.NORTH);
+ panel.add(button, BorderLayout.CENTER);
+
+ frame.getContentPane().add(panel);
+ frame.setVisible(true);
+
+ }
+
+ private static Point getAbsoluteLocation(MouseEvent e) {
+ return new Point(e.getXOnScreen(), e.getYOnScreen());
+ }
+
+ static class MyDragWindow extends Window {
+
+ static int d = 30;
+
+ public MyDragWindow(Window parent, Point location) {
+ super(parent);
+ setSize(150, 150);
+ setVisible(true);
+ JPanel panel = new JPanel();
+ add(panel);
+ setLocation(location.x - d, location.y - d);
+ addMouseListener(new DragWindowMouseListener());
+ }
+
+ void dragTo(Point point) {
+ setLocation(point.x - d, point.y - d);
+ }
+ }
+
+ static class LabelMouseListener extends MouseAdapter {
+
+ Point origin;
+ Window parent;
+
+ public LabelMouseListener(Window parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ if (dragWindow == null) {
+ dragWindow = new MyDragWindow(parent, getAbsoluteLocation(e));
+ } else {
+ dragWindow.setVisible(true);
+ dragWindow.dragTo(getAbsoluteLocation(e));
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ labelMouseReleasedCount++;
+ if (dragWindow != null) {
+ dragWindow.setVisible(false);
+ }
+ }
+
+ public void mouseDragged(MouseEvent e) {
+ if (dragWindow != null) {
+ dragWindow.dragTo(getAbsoluteLocation(e));
+ }
+ }
+ }
+
+ static class DragWindowMouseListener extends MouseAdapter {
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ dragWindowMouseEnteredCount++;
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ dragWindowMouseReleasedCount++;
+ }
+ }
+
+ static class ButtonMouseListener extends MouseAdapter {
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ buttonMouseEnteredCount++;
+ }
+ }
+}
diff --git a/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java b/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java
new file mode 100644
index 00000000000..9a9042b1a70
--- /dev/null
+++ b/jdk/test/java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7154048
+ * @summary Programmatically resized window does not receive mouse entered/exited events
+ * @author alexandr.scherbatiy area=awt.event
+ * @run main ResizingFrameTest
+ */
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import sun.awt.SunToolkit;
+
+public class ResizingFrameTest {
+
+ private static volatile int mouseEnteredCount = 0;
+ private static volatile int mouseExitedCount = 0;
+ private static JFrame frame;
+
+ public static void main(String[] args) throws Exception {
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+ robot.mouseMove(100, 100);
+
+ // create a frame under the mouse cursor
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+
+ toolkit.realSync();
+
+ if (mouseEnteredCount != 1 || mouseExitedCount != 0) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+
+ // iconify frame
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ frame.setExtendedState(Frame.ICONIFIED);
+ }
+ });
+
+ toolkit.realSync();
+ robot.delay(200);
+
+ if (mouseEnteredCount != 1 || mouseExitedCount != 1) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+
+ // deiconify frame
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ frame.setExtendedState(Frame.NORMAL);
+ }
+ });
+
+ toolkit.realSync();
+ robot.delay(200);
+
+ if (mouseEnteredCount != 2 || mouseExitedCount != 1) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+
+ // move the mouse out of the frame
+ robot.mouseMove(500, 500);
+ toolkit.realSync();
+ robot.delay(200);
+
+ if (mouseEnteredCount != 2 || mouseExitedCount != 2) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+
+ // maximize the frame
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ frame.setExtendedState(Frame.MAXIMIZED_BOTH);
+ }
+ });
+
+ toolkit.realSync();
+ robot.delay(200);
+
+ if (mouseEnteredCount != 3 || mouseExitedCount != 2) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+
+
+ // demaximize the frame
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ frame.setExtendedState(Frame.NORMAL);
+ }
+ });
+
+ toolkit.realSync();
+ robot.delay(200);
+
+ if (mouseEnteredCount != 3 || mouseExitedCount != 3) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+
+ }
+
+ // move the frame under the mouse
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ frame.setLocation(400, 400);
+ }
+ });
+
+ toolkit.realSync();
+ robot.delay(200);
+
+ if (mouseEnteredCount != 4 || mouseExitedCount != 3) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+
+ // move the frame out of the mouse
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ frame.setLocation(100, 100);
+ }
+ });
+
+ toolkit.realSync();
+ robot.delay(400);
+
+ if (mouseEnteredCount != 4 || mouseExitedCount != 4) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+
+ // enlarge the frame bounds
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ frame.setBounds(100, 100, 800, 800);
+ }
+ });
+
+ toolkit.realSync();
+ robot.delay(200);
+
+ if (mouseEnteredCount != 5 || mouseExitedCount != 4) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+
+ // make the frame bounds smaller
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ frame.setBounds(100, 100, 200, 300);
+ }
+ });
+
+ toolkit.realSync();
+ robot.delay(400);
+
+
+ if (mouseEnteredCount != 5 || mouseExitedCount != 5) {
+ throw new RuntimeException("No Mouse Entered/Exited events!");
+ }
+ }
+
+ private static void createAndShowGUI() {
+
+ frame = new JFrame("Main Frame");
+ frame.setSize(300, 200);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ frame.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ mouseEnteredCount++;
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ mouseExitedCount++;
+ }
+ });
+
+ frame.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java
new file mode 100644
index 00000000000..188cd3fde86
--- /dev/null
+++ b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Portions Copyright (c) 2012 IBM Corporation
+ */
+
+
+/* @test
+ * @bug 7129742
+ * @summary Focus in non-editable TextArea is not shown on Linux.
+ * @author Sean Chou
+ */
+
+import java.awt.FlowLayout;
+import java.awt.TextArea;
+import java.awt.Toolkit;
+import java.lang.reflect.Field;
+
+import javax.swing.JFrame;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.text.DefaultCaret;
+
+import sun.awt.SunToolkit;
+
+public class bug7129742 {
+
+ public static DefaultCaret caret = null;
+ public static JFrame frame = null;
+ public static boolean fastreturn = false;
+
+ public static void main(String[] args) throws Exception {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ frame = new JFrame("Test");
+ TextArea textArea = new TextArea("Non-editable textArea");
+ textArea.setEditable(false);
+ frame.setLayout(new FlowLayout());
+ frame.add(textArea);
+ frame.pack();
+ frame.setVisible(true);
+
+ try {
+ Class XTextAreaPeerClzz = textArea.getPeer().getClass();
+ System.out.println(XTextAreaPeerClzz.getName());
+ if (!XTextAreaPeerClzz.getName().equals("sun.awt.X11.XTextAreaPeer")) {
+ fastreturn = true;
+ return;
+ }
+
+ Field jtextField = XTextAreaPeerClzz.getDeclaredField("jtext");
+ jtextField.setAccessible(true);
+ JTextArea jtext = (JTextArea)jtextField.get(textArea.getPeer());
+ caret = (DefaultCaret) jtext.getCaret();
+
+ textArea.requestFocusInWindow();
+ } catch (NoSuchFieldException | SecurityException
+ | IllegalArgumentException | IllegalAccessException e) {
+ /* These exceptions mean the implementation of XTextAreaPeer is
+ * changed, this testcase is not valid any more, fix it or remove.
+ */
+ frame.dispose();
+ throw new RuntimeException("This testcase is not valid any more!");
+ }
+ }
+ });
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ try{
+ if (fastreturn) {
+ return;
+ }
+ boolean passed = caret.isActive();
+ System.out.println("is caret visible : " + passed);
+
+ if (!passed) {
+ throw new RuntimeException("The test for bug 71297422 failed");
+ }
+ } finally {
+ frame.dispose();
+ }
+ }
+ });
+ }
+
+}
diff --git a/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java
new file mode 100644
index 00000000000..c10094eed67
--- /dev/null
+++ b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 7154072
+ @summary Tests that key events with modifiers are not swallowed.
+ @author anton.tarasov: area=awt.focus
+ @library ../../../regtesthelpers
+ @build Util
+ @run main SwallowKeyEvents
+*/
+
+import java.awt.AWTException;
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.TextField;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import test.java.awt.regtesthelpers.Util;
+
+public class SwallowKeyEvents {
+ static final int PRESS_COUNT = 10;
+
+ static int keyPressedCount = 0;
+
+ static Frame f = new Frame("Frame");
+ static TextField t = new TextField("text");
+ static Robot r;
+
+ public static void main(String[] args) {
+ f.add(t);
+ f.pack();
+ f.setVisible(true);
+
+ t.requestFocus();
+
+ try {
+ r = new Robot();
+ } catch (AWTException ex) {
+ throw new RuntimeException(ex);
+ }
+
+ Util.waitForIdle(r);
+
+ t.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent ke) {
+ System.out.println(ke);
+ if (ke.getKeyCode() == KeyEvent.VK_M) {
+ keyPressedCount++;
+ }
+ }
+ });
+
+ test();
+
+ System.out.println("key_pressed count: " + keyPressedCount);
+
+ if (keyPressedCount != PRESS_COUNT) {
+ throw new RuntimeException("Test failed!");
+ } else {
+ System.out.println("Test passed.");
+ }
+ }
+
+ public static void test() {
+ r.keyPress(KeyEvent.VK_SHIFT);
+ r.keyPress(KeyEvent.VK_META);
+
+ for (int i=0; itask on the EDT thread.
+ *
+ * @return result of the