提交 c107a845 编写于 作者: L lana

Merge

...@@ -51,3 +51,4 @@ f708138c9aca4b389872838fe6773872fce3609e jdk7-b73 ...@@ -51,3 +51,4 @@ f708138c9aca4b389872838fe6773872fce3609e jdk7-b73
eacb36e30327e7ae33baa068e82ddccbd91eaae2 jdk7-b74 eacb36e30327e7ae33baa068e82ddccbd91eaae2 jdk7-b74
8885b22565077236a927e824ef450742e434a230 jdk7-b75 8885b22565077236a927e824ef450742e434a230 jdk7-b75
8fb602395be0f7d5af4e7e93b7df2d960faf9d17 jdk7-b76 8fb602395be0f7d5af4e7e93b7df2d960faf9d17 jdk7-b76
e6a5d095c356a547cf5b3c8885885aca5e91e09b jdk7-b77
...@@ -165,6 +165,9 @@ ifeq ($(SYSTEM_UNAME), Linux) ...@@ -165,6 +165,9 @@ ifeq ($(SYSTEM_UNAME), Linux)
sparc*) \ sparc*) \
echo sparc \ echo sparc \
;; \ ;; \
arm*) \
echo arm \
;; \
*) \ *) \
echo $(mach) \ echo $(mach) \
;; \ ;; \
......
...@@ -390,7 +390,7 @@ clean:: ...@@ -390,7 +390,7 @@ clean::
LOCALES_GEN_SH = localelist.sh LOCALES_GEN_SH = localelist.sh
$(GENSRCDIR)/sun/util/CoreResourceBundleControl.java: \ $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java: \
$(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java $(LOCALES_GEN_SH) $(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java.template $(LOCALES_GEN_SH)
@$(prep-target) @$(prep-target)
NAWK="$(NAWK)" SED="$(SED)" $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \ NAWK="$(NAWK)" SED="$(SED)" $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \
$< $@ $< $@
......
...@@ -68,7 +68,7 @@ NonEuro_Resources_properties := $(FILES_compiled_properties) ...@@ -68,7 +68,7 @@ NonEuro_Resources_properties := $(FILES_compiled_properties)
FILES_java := $(FILES_java_orig) FILES_java := $(FILES_java_orig)
FILES_compiled_properties := $(FILES_compiled_properties_orig) FILES_compiled_properties := $(FILES_compiled_properties_orig)
LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/LocaleDataMetaInfo-XLocales.java LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template
LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/LocaleDataMetaInfo.java LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/LocaleDataMetaInfo.java
LOCALEGEN_SH=localegen.sh LOCALEGEN_SH=localegen.sh
RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames CalendarData" RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames CalendarData"
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# #
# This script is to generate the supported locale list string and replace the # This script is to generate the supported locale list string and replace the
# LocaleDataMetaInfo-XLocales.java in <ws>/src/share/classes/sun/util # LocaleDataMetaInfo-XLocales.java.template in <ws>/src/share/classes/sun/util
# #
# SORT, NAWK & SED is passed in as environment variables. # SORT, NAWK & SED is passed in as environment variables.
# #
......
...@@ -96,6 +96,7 @@ OTHER_CPPFLAGS += $(LIBARCH_DEFINES) ...@@ -96,6 +96,7 @@ OTHER_CPPFLAGS += $(LIBARCH_DEFINES)
ifneq ($(PLATFORM), windows) # UNIX systems ifneq ($(PLATFORM), windows) # UNIX systems
LD_RUNPATH_EXTRAS += ..
LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli
# Note: its important to keep this order meaning -lc is the # Note: its important to keep this order meaning -lc is the
# last library otherwise it could cause compatibility issues # last library otherwise it could cause compatibility issues
......
...@@ -61,8 +61,5 @@ OTHER_CPPFLAGS += -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' ...@@ -61,8 +61,5 @@ OTHER_CPPFLAGS += -DLAUNCHER_NAME='"$(LAUNCHER_NAME)"'
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
LDFLAGS += -R$(OPENWIN_LIB) LDFLAGS += -R$(OPENWIN_LIB)
endif
ifeq ($(PLATFORM), solaris)
LDFLAGS += -M mapfile-$(ARCH) LDFLAGS += -M mapfile-$(ARCH)
endif endif
...@@ -834,7 +834,7 @@ $(SCH_GEN)/SocketOptionRegistry.java: $(GENSOR_EXE) ...@@ -834,7 +834,7 @@ $(SCH_GEN)/SocketOptionRegistry.java: $(GENSOR_EXE)
GENCSSRC = $(BUILDDIR)/tools/CharsetMapping GENCSSRC = $(BUILDDIR)/tools/CharsetMapping
CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar
$(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java $(GENCSSRC)/sbcs $(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java.template $(GENCSSRC)/sbcs
@$(prep-target) @$(prep-target)
$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSSRC) $(SCS_GEN) sbcs $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSSRC) $(SCS_GEN) sbcs
......
...@@ -194,10 +194,8 @@ endif ...@@ -194,10 +194,8 @@ endif
# For backwards compatability, make a link of the 32-bit client JVM to $(LIBDIR) # For backwards compatability, make a link of the 32-bit client JVM to $(LIBDIR)
IMPORT_LIST += $(LIB_LOCATION)/$(JVM_NAME) IMPORT_LIST += $(LIB_LOCATION)/$(JVM_NAME)
# create a link from lib/libjvm.so to client/libjvm.so
$(LIB_LOCATION)/$(JVM_NAME): $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME) $(LIB_LOCATION)/$(JVM_NAME): $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME)
@$(prep-target) @$(prep-target)
$(LN) -s $(CLIENT_LOCATION)/$(JVM_NAME) $@
# solaris ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ solaris # solaris ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ solaris
endif # 32bit solaris endif # 32bit solaris
......
...@@ -411,7 +411,7 @@ Creating your own NetBeans project ...@@ -411,7 +411,7 @@ Creating your own NetBeans project
java/util/regex/,\ java/util/regex/,\
java/util/spi/,\ java/util/spi/,\
java/util/zip/,\ java/util/zip/,\
**/*-XLocales.java **/*-XLocales.java.template
jtreg.tests=\ jtreg.tests=\
java/util/**/*Collection/ \ java/util/**/*Collection/ \
java/util/**/*Map/ \ java/util/**/*Map/ \
......
...@@ -82,7 +82,9 @@ $(FILES_DAT): $(FILES_MAP) ...@@ -82,7 +82,9 @@ $(FILES_DAT): $(FILES_MAP)
$(FILES_MAP) $(FILES_DAT) sjis0213 $(FILES_MAP) $(FILES_DAT) sjis0213
$(FILES_genout_extcs): $(GENCSDATASRC)/SingleByte-X.java $(GENCSDATASRC)/DoubleByte-X.java \ $(FILES_genout_extcs): \
$(GENCSDATASRC)/SingleByte-X.java.template \
$(GENCSDATASRC)/DoubleByte-X.java.template \
$(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs
@$(prep-target) @$(prep-target)
$(RM) -r $(GENCSEXT) $(RM) -r $(GENCSEXT)
......
...@@ -126,6 +126,8 @@ SUNWprivate_1.1 { ...@@ -126,6 +126,8 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XlibWrapper_ServerVendor; Java_sun_awt_X11_XlibWrapper_ServerVendor;
Java_sun_awt_X11_XlibWrapper_VendorRelease; Java_sun_awt_X11_XlibWrapper_VendorRelease;
Java_sun_awt_X11_XlibWrapper_IsXsunKPBehavior; Java_sun_awt_X11_XlibWrapper_IsXsunKPBehavior;
Java_sun_awt_X11_XlibWrapper_IsSunKeyboard;
Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard;
Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler; Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler;
Java_sun_awt_X11_XlibWrapper_XSetErrorHandler; Java_sun_awt_X11_XlibWrapper_XSetErrorHandler;
Java_sun_awt_X11_XlibWrapper_CallErrorHandler; Java_sun_awt_X11_XlibWrapper_CallErrorHandler;
...@@ -306,6 +308,7 @@ SUNWprivate_1.1 { ...@@ -306,6 +308,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode; Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode;
Java_sun_awt_X11_XlibWrapper_XGetModifierMapping; Java_sun_awt_X11_XlibWrapper_XGetModifierMapping;
Java_sun_awt_X11_XlibWrapper_XFreeModifiermap; Java_sun_awt_X11_XlibWrapper_XFreeModifiermap;
Java_sun_awt_X11_XlibWrapper_XRefreshKeyboardMapping;
Java_sun_awt_X11_XlibWrapper_XChangeActivePointerGrab; Java_sun_awt_X11_XlibWrapper_XChangeActivePointerGrab;
Java_sun_awt_X11_XlibWrapper_XNextSecondaryLoopEvent; Java_sun_awt_X11_XlibWrapper_XNextSecondaryLoopEvent;
Java_sun_awt_X11_XlibWrapper_ExitSecondaryLoop; Java_sun_awt_X11_XlibWrapper_ExitSecondaryLoop;
......
...@@ -63,7 +63,7 @@ public class GenerateDBCS { ...@@ -63,7 +63,7 @@ public class GenerateDBCS {
int b2Min = toInteger(fields[8]); int b2Min = toInteger(fields[8]);
int b2Max = toInteger(fields[9]); int b2Max = toInteger(fields[9]);
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName); System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
genClass(args[0], args[1], "DoubleByte-X.java", genClass(args[0], args[1], "DoubleByte-X.java.template",
clzName, csName, hisName, pkgName, clzName, csName, hisName, pkgName,
isASCII, type, isASCII, type,
b1Min, b1Max, b2Min, b2Max); b1Min, b1Max, b2Min, b2Max);
......
...@@ -55,7 +55,7 @@ public class GenerateSBCS { ...@@ -55,7 +55,7 @@ public class GenerateSBCS {
String pkgName = fields[4]; String pkgName = fields[4];
System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName); System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
genClass(args[0], args[1], "SingleByte-X.java", genClass(args[0], args[1], "SingleByte-X.java.template",
clzName, csName, hisName, pkgName, isASCII); clzName, csName, hisName, pkgName, isASCII);
} }
} }
......
/* /*
* Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -41,15 +41,13 @@ ...@@ -41,15 +41,13 @@
* options are turned into "-foo" options to the vm. This option * options are turned into "-foo" options to the vm. This option
* filtering is handled in a number of places in the launcher, some of * filtering is handled in a number of places in the launcher, some of
* it in machine-dependent code. In this file, the function * it in machine-dependent code. In this file, the function
* CheckJVMType removes vm style options and TranslateApplicationArgs * CheckJvmType removes vm style options and TranslateApplicationArgs
* removes "-J" prefixes. On unix platforms, the * removes "-J" prefixes. The CreateExecutionEnvironment function processes
* CreateExecutionEnvironment function from the unix java_md.c file * and removes -d<n> options. On unix, there is a possibility that the running
* processes and removes -d<n> options. However, in case * data model may not match to the desired data model, in this case an exec is
* CreateExecutionEnvironment does not need to exec because * required to start the desired model. If the data models match, then
* LD_LIBRARY_PATH is set acceptably and the data model does not need * ParseArguments will remove the -d<n> flags. If the data models do not match
* to be changed, ParseArguments will screen out the redundant -d<n> * the CreateExecutionEnviroment will remove the -d<n> flags.
* options and prevent them from being passed to the vm; this is done
* by RemovableOption.
*/ */
...@@ -1891,11 +1889,11 @@ DumpState() ...@@ -1891,11 +1889,11 @@ DumpState()
* Return JNI_TRUE for an option string that has no effect but should * Return JNI_TRUE for an option string that has no effect but should
* _not_ be passed on to the vm; return JNI_FALSE otherwise. On * _not_ be passed on to the vm; return JNI_FALSE otherwise. On
* Solaris SPARC, this screening needs to be done if: * Solaris SPARC, this screening needs to be done if:
* 1) LD_LIBRARY_PATH does _not_ need to be reset and * -d32 or -d64 is passed to a binary with an unmatched data model
* 2) -d32 or -d64 is passed to a binary with a matching data model * (the exec in CreateExecutionEnvironment removes -d<n> options and points the
* (the exec in SetLibraryPath removes -d<n> options and points the * exec to the proper binary). In the case of when the data model and the
* exec to the proper binary). When this exec is not done, these options * requested version is matched, an exec would not occur, and these options
* would end up getting passed onto the vm. * were erroneously passed to the vm.
*/ */
jboolean jboolean
RemovableOption(char * option) RemovableOption(char * option)
......
...@@ -36,7 +36,7 @@ import java.security.spec.*; ...@@ -36,7 +36,7 @@ import java.security.spec.*;
/** /**
* This class constitutes the core of HMAC-<MD> algorithms, where * This class constitutes the core of HMAC-<MD> algorithms, where
* <MD> can be SHA1 or MD5, etc. * <MD> can be SHA1 or MD5, etc. See RFC 2104 for spec.
* *
* It also contains the implementation classes for the SHA-256, * It also contains the implementation classes for the SHA-256,
* SHA-384, and SHA-512 HMACs. * SHA-384, and SHA-512 HMACs.
...@@ -116,7 +116,7 @@ final class HmacCore implements Cloneable { ...@@ -116,7 +116,7 @@ final class HmacCore implements Cloneable {
} }
byte[] secret = key.getEncoded(); byte[] secret = key.getEncoded();
if (secret == null || secret.length == 0) { if (secret == null) {
throw new InvalidKeyException("Missing key data"); throw new InvalidKeyException("Missing key data");
} }
......
/* /*
* Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,21 +25,19 @@ ...@@ -25,21 +25,19 @@
package com.sun.crypto.provider; package com.sun.crypto.provider;
import java.io.*; import java.io.ObjectStreamException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.Arrays; import java.util.Arrays;
import java.security.KeyRep; import java.security.KeyRep;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException; import java.security.NoSuchProviderException;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
import javax.crypto.Mac; import javax.crypto.Mac;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
/** /**
* This class represents a PBE key derived using PBKDF2 defined * This class represents a PBE key derived using PBKDF2 defined
...@@ -123,7 +121,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey { ...@@ -123,7 +121,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
this.key = deriveKey(prf, passwdBytes, salt, iterCount, keyLength); this.key = deriveKey(prf, passwdBytes, salt, iterCount, keyLength);
} }
private static byte[] deriveKey(Mac prf, byte[] password, byte[] salt, private static byte[] deriveKey(final Mac prf, final byte[] password, byte[] salt,
int iterCount, int keyLengthInBit) { int iterCount, int keyLengthInBit) {
int keyLength = keyLengthInBit/8; int keyLength = keyLengthInBit/8;
byte[] key = new byte[keyLength]; byte[] key = new byte[keyLength];
...@@ -133,7 +131,34 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey { ...@@ -133,7 +131,34 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
int intR = keyLength - (intL - 1)*hlen; // residue int intR = keyLength - (intL - 1)*hlen; // residue
byte[] ui = new byte[hlen]; byte[] ui = new byte[hlen];
byte[] ti = new byte[hlen]; byte[] ti = new byte[hlen];
SecretKey macKey = new SecretKeySpec(password, prf.getAlgorithm()); // SecretKeySpec cannot be used, since password can be empty here.
SecretKey macKey = new SecretKey() {
@Override
public String getAlgorithm() {
return prf.getAlgorithm();
}
@Override
public String getFormat() {
return "RAW";
}
@Override
public byte[] getEncoded() {
return password;
}
@Override
public int hashCode() {
return Arrays.hashCode(password) * 41 +
prf.getAlgorithm().toLowerCase().hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (this.getClass() != obj.getClass()) return false;
SecretKey sk = (SecretKey)obj;
return prf.getAlgorithm().equalsIgnoreCase(sk.getAlgorithm()) &&
Arrays.equals(password, sk.getEncoded());
}
};
prf.init(macKey); prf.init(macKey);
byte[] ibytes = new byte[4]; byte[] ibytes = new byte[4];
...@@ -230,7 +255,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey { ...@@ -230,7 +255,7 @@ final class PBKDF2KeyImpl implements javax.crypto.interfaces.PBEKey {
* @throws ObjectStreamException if a new object representing * @throws ObjectStreamException if a new object representing
* this PBE key could not be created * this PBE key could not be created
*/ */
private Object writeReplace() throws java.io.ObjectStreamException { private Object writeReplace() throws ObjectStreamException {
return new KeyRep(KeyRep.Type.SECRET, getAlgorithm(), return new KeyRep(KeyRep.Type.SECRET, getAlgorithm(),
getFormat(), getEncoded()); getFormat(), getEncoded());
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package com.sun.jmx.mbeanserver; package com.sun.jmx.mbeanserver;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.ref.SoftReference;
import java.lang.reflect.AnnotatedElement; import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -33,8 +34,13 @@ import java.lang.reflect.Modifier; ...@@ -33,8 +34,13 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.lang.reflect.UndeclaredThrowableException; import java.lang.reflect.UndeclaredThrowableException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap;
import javax.management.Descriptor; import javax.management.Descriptor;
import javax.management.DescriptorKey; import javax.management.DescriptorKey;
...@@ -506,11 +512,25 @@ public class Introspector { ...@@ -506,11 +512,25 @@ public class Introspector {
} else { } else {
// Java Beans introspection // Java Beans introspection
// //
BeanInfo bi = java.beans.Introspector.getBeanInfo(complex.getClass()); Class<?> clazz = complex.getClass();
PropertyDescriptor[] pds = bi.getPropertyDescriptors(); Method readMethod = null;
for (PropertyDescriptor pd : pds) if (BeansHelper.isAvailable()) {
if (pd.getName().equals(element)) Object bi = BeansHelper.getBeanInfo(clazz);
return pd.getReadMethod().invoke(complex); Object[] pds = BeansHelper.getPropertyDescriptors(bi);
for (Object pd: pds) {
if (BeansHelper.getPropertyName(pd).equals(element)) {
readMethod = BeansHelper.getReadMethod(pd);
break;
}
}
} else {
// Java Beans not available so use simple introspection
// to locate method
readMethod = SimpleIntrospector.getReadMethod(clazz, element);
}
if (readMethod != null)
return readMethod.invoke(complex);
throw new AttributeNotFoundException( throw new AttributeNotFoundException(
"Could not find the getter method for the property " + "Could not find the getter method for the property " +
element + " using the Java Beans introspector"); element + " using the Java Beans introspector");
...@@ -524,4 +544,235 @@ public class Introspector { ...@@ -524,4 +544,235 @@ public class Introspector {
new AttributeNotFoundException(e.getMessage()), e); new AttributeNotFoundException(e.getMessage()), e);
} }
} }
/**
* A simple introspector that uses reflection to analyze a class and
* identify its "getter" methods. This class is intended for use only when
* Java Beans is not present (which implies that there isn't explicit
* information about the bean available).
*/
private static class SimpleIntrospector {
private SimpleIntrospector() { }
private static final String GET_METHOD_PREFIX = "get";
private static final String IS_METHOD_PREFIX = "is";
// cache to avoid repeated lookups
private static final Map<Class<?>,SoftReference<List<Method>>> cache =
Collections.synchronizedMap(
new WeakHashMap<Class<?>,SoftReference<List<Method>>> ());
/**
* Returns the list of methods cached for the given class, or {@code null}
* if not cached.
*/
private static List<Method> getCachedMethods(Class<?> clazz) {
// return cached methods if possible
SoftReference<List<Method>> ref = cache.get(clazz);
if (ref != null) {
List<Method> cached = ref.get();
if (cached != null)
return cached;
}
return null;
}
/**
* Returns {@code true} if the given method is a "getter" method (where
* "getter" method is a public method of the form getXXX or "boolean
* isXXX")
*/
static boolean isReadMethod(Method method) {
// ignore static methods
int modifiers = method.getModifiers();
if (Modifier.isStatic(modifiers))
return false;
String name = method.getName();
Class<?>[] paramTypes = method.getParameterTypes();
int paramCount = paramTypes.length;
if (paramCount == 0 && name.length() > 2) {
// boolean isXXX()
if (name.startsWith(IS_METHOD_PREFIX))
return (method.getReturnType() == boolean.class);
// getXXX()
if (name.length() > 3 && name.startsWith(GET_METHOD_PREFIX))
return (method.getReturnType() != void.class);
}
return false;
}
/**
* Returns the list of "getter" methods for the given class. The list
* is ordered so that isXXX methods appear before getXXX methods - this
* is for compatability with the JavaBeans Introspector.
*/
static List<Method> getReadMethods(Class<?> clazz) {
// return cached result if available
List<Method> cachedResult = getCachedMethods(clazz);
if (cachedResult != null)
return cachedResult;
// get list of public methods, filtering out methods that have
// been overridden to return a more specific type.
List<Method> methods =
StandardMBeanIntrospector.getInstance().getMethods(clazz);
methods = MBeanAnalyzer.eliminateCovariantMethods(methods);
// filter out the non-getter methods
List<Method> result = new LinkedList<Method>();
for (Method m: methods) {
if (isReadMethod(m)) {
// favor isXXX over getXXX
if (m.getName().startsWith(IS_METHOD_PREFIX)) {
result.add(0, m);
} else {
result.add(m);
}
}
}
// add result to cache
cache.put(clazz, new SoftReference<List<Method>>(result));
return result;
}
/**
* Returns the "getter" to read the given property from the given class or
* {@code null} if no method is found.
*/
static Method getReadMethod(Class<?> clazz, String property) {
// first character in uppercase (compatability with JavaBeans)
property = property.substring(0, 1).toUpperCase(Locale.ENGLISH) +
property.substring(1);
String getMethod = GET_METHOD_PREFIX + property;
String isMethod = IS_METHOD_PREFIX + property;
for (Method m: getReadMethods(clazz)) {
String name = m.getName();
if (name.equals(isMethod) || name.equals(getMethod)) {
return m;
}
}
return null;
}
}
/**
* A class that provides access to the JavaBeans Introspector and
* PropertyDescriptors without creating a static dependency on java.beans.
*/
private static class BeansHelper {
private static final Class<?> introspectorClass =
getClass("java.beans.Introspector");
private static final Class<?> beanInfoClass =
(introspectorClass == null) ? null : getClass("java.beans.BeanInfo");
private static final Class<?> getPropertyDescriptorClass =
(beanInfoClass == null) ? null : getClass("java.beans.PropertyDescriptor");
private static final Method getBeanInfo =
getMethod(introspectorClass, "getBeanInfo", Class.class);
private static final Method getPropertyDescriptors =
getMethod(beanInfoClass, "getPropertyDescriptors");
private static final Method getPropertyName =
getMethod(getPropertyDescriptorClass, "getName");
private static final Method getReadMethod =
getMethod(getPropertyDescriptorClass, "getReadMethod");
private static Class<?> getClass(String name) {
try {
return Class.forName(name, true, null);
} catch (ClassNotFoundException e) {
return null;
}
}
private static Method getMethod(Class<?> clazz,
String name,
Class<?>... paramTypes)
{
if (clazz != null) {
try {
return clazz.getMethod(name, paramTypes);
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
}
} else {
return null;
}
}
private BeansHelper() { }
/**
* Returns {@code true} if java.beans is available.
*/
static boolean isAvailable() {
return introspectorClass != null;
}
/**
* Invokes java.beans.Introspector.getBeanInfo(Class)
*/
static Object getBeanInfo(Class<?> clazz) throws Exception {
try {
return getBeanInfo.invoke(null, clazz);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof Exception)
throw (Exception)cause;
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
}
/**
* Invokes java.beans.BeanInfo.getPropertyDescriptors()
*/
static Object[] getPropertyDescriptors(Object bi) {
try {
return (Object[])getPropertyDescriptors.invoke(bi);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
}
/**
* Invokes java.beans.PropertyDescriptor.getName()
*/
static String getPropertyName(Object pd) {
try {
return (String)getPropertyName.invoke(pd);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
}
/**
* Invokes java.beans.PropertyDescriptor.getReadMethod()
*/
static Method getReadMethod(Object pd) {
try {
return (Method)getReadMethod.invoke(pd);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
}
}
} }
...@@ -175,7 +175,7 @@ abstract class MBeanIntrospector<M> { ...@@ -175,7 +175,7 @@ abstract class MBeanIntrospector<M> {
/** /**
* Get the methods to be analyzed to build the MBean interface. * Get the methods to be analyzed to build the MBean interface.
*/ */
List<Method> getMethods(final Class<?> mbeanType) throws Exception { List<Method> getMethods(final Class<?> mbeanType) {
return Arrays.asList(mbeanType.getMethods()); return Arrays.asList(mbeanType.getMethods());
} }
......
...@@ -34,8 +34,6 @@ import java.util.*; ...@@ -34,8 +34,6 @@ import java.util.*;
import java.security.AccessController; import java.security.AccessController;
import java.security.CodeSource; import java.security.CodeSource;
import java.security.Identity;
import java.security.IdentityScope;
import java.security.KeyStore; import java.security.KeyStore;
import java.security.KeyStoreException; import java.security.KeyStoreException;
import java.security.Permission; import java.security.Permission;
...@@ -267,7 +265,7 @@ public class PolicyFile extends javax.security.auth.Policy { ...@@ -267,7 +265,7 @@ public class PolicyFile extends javax.security.auth.Policy {
private boolean initialized = false; private boolean initialized = false;
private boolean expandProperties = true; private boolean expandProperties = true;
private boolean ignoreIdentityScope = false; private boolean ignoreIdentityScope = true;
// for use with the reflection API // for use with the reflection API
...@@ -459,9 +457,6 @@ public class PolicyFile extends javax.security.auth.Policy { ...@@ -459,9 +457,6 @@ public class PolicyFile extends javax.security.auth.Policy {
} }
} }
/** the scope to check */
private static IdentityScope scope = null;
/** /**
* Checks public key. If it is marked as trusted in * Checks public key. If it is marked as trusted in
* the identity database, add it to the policy * the identity database, add it to the policy
......
...@@ -99,4 +99,58 @@ public interface ExtendedGSSContext extends GSSContext { ...@@ -99,4 +99,58 @@ public interface ExtendedGSSContext extends GSSContext {
*/ */
public Object inquireSecContext(InquireType type) public Object inquireSecContext(InquireType type)
throws GSSException; throws GSSException;
/**
* Requests that the delegation policy be respected. When a true value is
* requested, the underlying context would use the delegation policy
* defined by the environment as a hint to determine whether credentials
* delegation should be performed. This request can only be made on the
* context initiator's side and it has to be done prior to the first
* call to <code>initSecContext</code>.
* <p>
* When this flag is false, delegation will only be tried when the
* {@link GSSContext#requestCredDeleg(boolean) credentials delegation flag}
* is true.
* <p>
* When this flag is true but the
* {@link GSSContext#requestCredDeleg(boolean) credentials delegation flag}
* is false, delegation will be only tried if the delegation policy permits
* delegation.
* <p>
* When both this flag and the
* {@link GSSContext#requestCredDeleg(boolean) credentials delegation flag}
* are true, delegation will be always tried. However, if the delegation
* policy does not permit delegation, the value of
* {@link #getDelegPolicyState} will be false, even
* if delegation is performed successfully.
* <p>
* In any case, if the delegation is not successful, the value returned
* by {@link GSSContext#getCredDelegState()} is false, and the value
* returned by {@link #getDelegPolicyState()} is also false.
* <p>
* Not all mechanisms support delegation policy. Therefore, the
* application should check to see if the request was honored with the
* {@link #getDelegPolicyState() getDelegPolicyState} method. When
* delegation policy is not supported, <code>requestDelegPolicy</code>
* should return silently without throwing an exception.
* <p>
* Note: for the Kerberos 5 mechanism, the delegation policy is expressed
* through the OK-AS-DELEGATE flag in the service ticket. When it's true,
* the KDC permits delegation to the target server. In a cross-realm
* environment, in order for delegation be permitted, all cross-realm TGTs
* on the authentication path must also have the OK-AS-DELAGATE flags set.
* @param state true if the policy should be respected
* @throws GSSException containing the following
* major error codes:
* {@link GSSException#FAILURE GSSException.FAILURE}
*/
public void requestDelegPolicy(boolean state) throws GSSException;
/**
* Returns the delegation policy response. Called after a security context
* is established. This method can be only called on the initiator's side.
* See {@link ExtendedGSSContext#requestDelegPolicy}.
* @return the delegation policy response
*/
public boolean getDelegPolicyState();
} }
...@@ -57,7 +57,10 @@ public class JavaStatic { ...@@ -57,7 +57,10 @@ public class JavaStatic {
id = ((JavaObjectRef)value).getId(); id = ((JavaObjectRef)value).getId();
} }
value = value.dereference(snapshot, field); value = value.dereference(snapshot, field);
if (value.isHeapAllocated()) { if (value.isHeapAllocated() &&
clazz.getLoader() == snapshot.getNullThing()) {
// static fields are only roots if they are in classes
// loaded by the root classloader.
JavaHeapObject ho = (JavaHeapObject) value; JavaHeapObject ho = (JavaHeapObject) value;
String s = "Static reference from " + clazz.getName() String s = "Static reference from " + clazz.getName()
+ "." + field.getName(); + "." + field.getName();
......
...@@ -4,7 +4,10 @@ package com.sun.tracing; ...@@ -4,7 +4,10 @@ package com.sun.tracing;
import java.util.HashSet; import java.util.HashSet;
import java.io.PrintStream; import java.io.PrintStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.logging.Logger; import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import sun.security.action.GetPropertyAction;
import sun.tracing.NullProviderFactory; import sun.tracing.NullProviderFactory;
import sun.tracing.PrintStreamProviderFactory; import sun.tracing.PrintStreamProviderFactory;
...@@ -52,23 +55,17 @@ public abstract class ProviderFactory { ...@@ -52,23 +55,17 @@ public abstract class ProviderFactory {
HashSet<ProviderFactory> factories = new HashSet<ProviderFactory>(); HashSet<ProviderFactory> factories = new HashSet<ProviderFactory>();
// Try to instantiate a DTraceProviderFactory // Try to instantiate a DTraceProviderFactory
String prop = null; String prop = AccessController.doPrivileged(
try { prop = System.getProperty("com.sun.tracing.dtrace"); } new GetPropertyAction("com.sun.tracing.dtrace"));
catch (java.security.AccessControlException e) {
Logger.getAnonymousLogger().fine(
"Cannot access property com.sun.tracing.dtrace");
}
if ( (prop == null || !prop.equals("disable")) && if ( (prop == null || !prop.equals("disable")) &&
DTraceProviderFactory.isSupported() ) { DTraceProviderFactory.isSupported() ) {
factories.add(new DTraceProviderFactory()); factories.add(new DTraceProviderFactory());
} }
// Try to instantiate an output stream factory // Try to instantiate an output stream factory
try { prop = System.getProperty("sun.tracing.stream"); } prop = AccessController.doPrivileged(
catch (java.security.AccessControlException e) { new GetPropertyAction("sun.tracing.stream"));
Logger.getAnonymousLogger().fine(
"Cannot access property sun.tracing.stream");
}
if (prop != null) { if (prop != null) {
for (String spec : prop.split(",")) { for (String spec : prop.split(",")) {
PrintStream ps = getPrintStreamFromSpec(spec); PrintStream ps = getPrintStreamFromSpec(spec);
...@@ -89,22 +86,29 @@ public abstract class ProviderFactory { ...@@ -89,22 +86,29 @@ public abstract class ProviderFactory {
} }
} }
private static PrintStream getPrintStreamFromSpec(String spec) { private static PrintStream getPrintStreamFromSpec(final String spec) {
try { try {
// spec is in the form of <class>.<field>, where <class> is // spec is in the form of <class>.<field>, where <class> is
// a fully specified class name, and <field> is a static member // a fully specified class name, and <field> is a static member
// in that class. The <field> must be a 'PrintStream' or subtype // in that class. The <field> must be a 'PrintStream' or subtype
// in order to be used. // in order to be used.
int fieldpos = spec.lastIndexOf('.'); final int fieldpos = spec.lastIndexOf('.');
Class<?> cls = Class.forName(spec.substring(0, fieldpos)); final Class<?> cls = Class.forName(spec.substring(0, fieldpos));
Field f = cls.getField(spec.substring(fieldpos + 1));
Class<?> fieldType = f.getType(); Field f = AccessController.doPrivileged(new PrivilegedExceptionAction<Field>() {
public Field run() throws NoSuchFieldException {
return cls.getField(spec.substring(fieldpos + 1));
}
});
return (PrintStream)f.get(null); return (PrintStream)f.get(null);
} catch (Exception e) { } catch (ClassNotFoundException e) {
Logger.getAnonymousLogger().warning( throw new AssertionError(e);
"Could not parse sun.tracing.stream property: " + e); } catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (PrivilegedActionException e) {
throw new AssertionError(e);
} }
return null;
} }
} }
...@@ -871,7 +871,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -871,7 +871,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
return comp.canBeFocusOwner(); return comp.canBeFocusOwner();
} }
public boolean isVisible_NoClientCode(Component comp) { public boolean isVisible(Component comp) {
return comp.isVisible_NoClientCode(); return comp.isVisible_NoClientCode();
} }
public void setRequestFocusController public void setRequestFocusController
...@@ -885,6 +885,71 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -885,6 +885,71 @@ public abstract class Component implements ImageObserver, MenuContainer,
public void setAppContext(Component comp, AppContext appContext) { public void setAppContext(Component comp, AppContext appContext) {
comp.appContext = appContext; comp.appContext = appContext;
} }
public Container getParent(Component comp) {
return comp.getParent_NoClientCode();
}
public void setParent(Component comp, Container parent) {
comp.parent = parent;
}
public void setSize(Component comp, int width, int height) {
comp.width = width;
comp.height = height;
}
public Point getLocation(Component comp) {
return comp.location_NoClientCode();
}
public void setLocation(Component comp, int x, int y) {
comp.x = x;
comp.y = y;
}
public boolean isEnabled(Component comp) {
return comp.isEnabledImpl();
}
public boolean isDisplayable(Component comp) {
return comp.peer != null;
}
public Cursor getCursor(Component comp) {
return comp.getCursor_NoClientCode();
}
public ComponentPeer getPeer(Component comp) {
return comp.peer;
}
public void setPeer(Component comp, ComponentPeer peer) {
comp.peer = peer;
}
public boolean isLightweight(Component comp) {
return (comp.peer instanceof LightweightPeer);
}
public boolean getIgnoreRepaint(Component comp) {
return comp.ignoreRepaint;
}
public int getWidth(Component comp) {
return comp.width;
}
public int getHeight(Component comp) {
return comp.height;
}
public int getX(Component comp) {
return comp.x;
}
public int getY(Component comp) {
return comp.y;
}
public Color getForeground(Component comp) {
return comp.foreground;
}
public Color getBackground(Component comp) {
return comp.background;
}
public void setBackground(Component comp, Color background) {
comp.background = background;
}
public Font getFont(Component comp) {
return comp.getFont_NoClientCode();
}
public void processEvent(Component comp, AWTEvent e) {
comp.processEvent(e);
}
}); });
} }
...@@ -8021,7 +8086,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -8021,7 +8086,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
Container getNativeContainer() { Container getNativeContainer() {
Container p = parent; Container p = parent;
while (p != null && p.peer instanceof LightweightPeer) { while (p != null && p.peer instanceof LightweightPeer) {
p = p.getParent(); p = p.getParent_NoClientCode();
} }
return p; return p;
} }
......
...@@ -104,11 +104,8 @@ class EventDispatchThread extends Thread { ...@@ -104,11 +104,8 @@ class EventDispatchThread extends Thread {
} else { } else {
stopEvent.dispatch(); stopEvent.dispatch();
} }
synchronized (theQueue) {
if (theQueue.getDispatchThread() == this) { theQueue.detachDispatchThread(this, false);
theQueue.detachDispatchThread();
}
}
} }
public void stopDispatching() { public void stopDispatching() {
...@@ -142,35 +139,7 @@ class EventDispatchThread extends Thread { ...@@ -142,35 +139,7 @@ class EventDispatchThread extends Thread {
} }
}); });
} finally { } finally {
/* theQueue.detachDispatchThread(this, true);
* This synchronized block is to secure that the event dispatch
* thread won't die in the middle of posting a new event to the
* associated event queue. It is important because we notify
* that the event dispatch thread is busy after posting a new event
* to its queue, so the EventQueue.dispatchThread reference must
* be valid at that point.
*/
synchronized (theQueue) {
if (theQueue.getDispatchThread() == this) {
theQueue.detachDispatchThread();
}
/*
* Event dispatch thread dies in case of an uncaught exception.
* A new event dispatch thread for this queue will be started
* only if a new event is posted to it. In case if no more
* events are posted after this thread died all events that
* currently are in the queue will never be dispatched.
*/
/*
* Fix for 4648733. Check both the associated java event
* queue and the PostEventQueue.
*/
if (theQueue.peekEvent() != null ||
!SunToolkit.isPostEventQueueEmpty()) {
theQueue.initDispatchThread();
}
AWTAutoShutdown.getInstance().notifyThreadFree(this);
}
} }
} }
......
...@@ -53,8 +53,7 @@ import java.util.Set; ...@@ -53,8 +53,7 @@ import java.util.Set;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.logging.Level; import sun.util.logging.PlatformLogger;
import java.util.logging.Logger;
import sun.awt.AppContext; import sun.awt.AppContext;
import sun.awt.HeadlessToolkit; import sun.awt.HeadlessToolkit;
...@@ -111,7 +110,7 @@ public abstract class KeyboardFocusManager ...@@ -111,7 +110,7 @@ public abstract class KeyboardFocusManager
{ {
// Shared focus engine logger // Shared focus engine logger
private static final Logger focusLog = Logger.getLogger("java.awt.focus.KeyboardFocusManager"); private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.KeyboardFocusManager");
static { static {
/* ensure that the necessary native libraries are loaded */ /* ensure that the necessary native libraries are loaded */
...@@ -154,7 +153,7 @@ public abstract class KeyboardFocusManager ...@@ -154,7 +153,7 @@ public abstract class KeyboardFocusManager
*/ */
private static native void initIDs(); private static native void initIDs();
private static final Logger log = Logger.getLogger("java.awt.KeyboardFocusManager"); private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.KeyboardFocusManager");
/** /**
* The identifier for the Forward focus traversal keys. * The identifier for the Forward focus traversal keys.
...@@ -504,8 +503,8 @@ public abstract class KeyboardFocusManager ...@@ -504,8 +503,8 @@ public abstract class KeyboardFocusManager
if (this == getCurrentKeyboardFocusManager()) { if (this == getCurrentKeyboardFocusManager()) {
return focusOwner; return focusOwner;
} else { } else {
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
} }
throw new SecurityException(notPrivileged); throw new SecurityException(notPrivileged);
} }
...@@ -609,9 +608,9 @@ public abstract class KeyboardFocusManager ...@@ -609,9 +608,9 @@ public abstract class KeyboardFocusManager
} }
void setNativeFocusOwner(Component comp) { void setNativeFocusOwner(Component comp) {
if (focusLog.isLoggable(Level.FINEST)) { if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}", focusLog.finest("Calling peer {0} setCurrentFocusOwner for {1}",
new Object[] {String.valueOf(peer), String.valueOf(comp)}); String.valueOf(peer), String.valueOf(comp));
} }
peer.setCurrentFocusOwner(comp); peer.setCurrentFocusOwner(comp);
} }
...@@ -673,8 +672,8 @@ public abstract class KeyboardFocusManager ...@@ -673,8 +672,8 @@ public abstract class KeyboardFocusManager
if (this == getCurrentKeyboardFocusManager()) { if (this == getCurrentKeyboardFocusManager()) {
return permanentFocusOwner; return permanentFocusOwner;
} else { } else {
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
} }
throw new SecurityException(notPrivileged); throw new SecurityException(notPrivileged);
} }
...@@ -781,8 +780,8 @@ public abstract class KeyboardFocusManager ...@@ -781,8 +780,8 @@ public abstract class KeyboardFocusManager
if (this == getCurrentKeyboardFocusManager()) { if (this == getCurrentKeyboardFocusManager()) {
return focusedWindow; return focusedWindow;
} else { } else {
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
} }
throw new SecurityException(notPrivileged); throw new SecurityException(notPrivileged);
} }
...@@ -885,8 +884,8 @@ public abstract class KeyboardFocusManager ...@@ -885,8 +884,8 @@ public abstract class KeyboardFocusManager
if (this == getCurrentKeyboardFocusManager()) { if (this == getCurrentKeyboardFocusManager()) {
return activeWindow; return activeWindow;
} else { } else {
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
} }
throw new SecurityException(notPrivileged); throw new SecurityException(notPrivileged);
} }
...@@ -919,8 +918,8 @@ public abstract class KeyboardFocusManager ...@@ -919,8 +918,8 @@ public abstract class KeyboardFocusManager
Window oldActiveWindow; Window oldActiveWindow;
synchronized (KeyboardFocusManager.class) { synchronized (KeyboardFocusManager.class) {
oldActiveWindow = getActiveWindow(); oldActiveWindow = getActiveWindow();
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.log(Level.FINER, "Setting global active window to " + activeWindow + ", old active " + oldActiveWindow); focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow);
} }
try { try {
...@@ -1215,8 +1214,8 @@ public abstract class KeyboardFocusManager ...@@ -1215,8 +1214,8 @@ public abstract class KeyboardFocusManager
if (this == getCurrentKeyboardFocusManager()) { if (this == getCurrentKeyboardFocusManager()) {
return currentFocusCycleRoot; return currentFocusCycleRoot;
} else { } else {
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager()); focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
} }
throw new SecurityException(notPrivileged); throw new SecurityException(notPrivileged);
} }
...@@ -2149,9 +2148,9 @@ public abstract class KeyboardFocusManager ...@@ -2149,9 +2148,9 @@ public abstract class KeyboardFocusManager
HeavyweightFocusRequest(Component heavyweight, Component descendant, HeavyweightFocusRequest(Component heavyweight, Component descendant,
boolean temporary, CausedFocusEvent.Cause cause) { boolean temporary, CausedFocusEvent.Cause cause) {
if (log.isLoggable(Level.FINE)) { if (log.isLoggable(PlatformLogger.FINE)) {
if (heavyweight == null) { if (heavyweight == null) {
log.log(Level.FINE, "Assertion (heavyweight != null) failed"); log.fine("Assertion (heavyweight != null) failed");
} }
} }
...@@ -2161,12 +2160,12 @@ public abstract class KeyboardFocusManager ...@@ -2161,12 +2160,12 @@ public abstract class KeyboardFocusManager
} }
boolean addLightweightRequest(Component descendant, boolean addLightweightRequest(Component descendant,
boolean temporary, CausedFocusEvent.Cause cause) { boolean temporary, CausedFocusEvent.Cause cause) {
if (log.isLoggable(Level.FINE)) { if (log.isLoggable(PlatformLogger.FINE)) {
if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) { if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
log.log(Level.FINE, "Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed"); log.fine("Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed");
} }
if (descendant == null) { if (descendant == null) {
log.log(Level.FINE, "Assertion (descendant != null) failed"); log.fine("Assertion (descendant != null) failed");
} }
} }
...@@ -2339,12 +2338,12 @@ public abstract class KeyboardFocusManager ...@@ -2339,12 +2338,12 @@ public abstract class KeyboardFocusManager
(Component heavyweight, Component descendant, boolean temporary, (Component heavyweight, Component descendant, boolean temporary,
boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
{ {
if (log.isLoggable(Level.FINE)) { if (log.isLoggable(PlatformLogger.FINE)) {
if (heavyweight == null) { if (heavyweight == null) {
log.log(Level.FINE, "Assertion (heavyweight != null) failed"); log.fine("Assertion (heavyweight != null) failed");
} }
if (time == 0) { if (time == 0) {
log.log(Level.FINE, "Assertion (time != 0) failed"); log.fine("Assertion (time != 0) failed");
} }
} }
...@@ -2361,31 +2360,31 @@ public abstract class KeyboardFocusManager ...@@ -2361,31 +2360,31 @@ public abstract class KeyboardFocusManager
Component currentFocusOwner = thisManager.getGlobalFocusOwner(); Component currentFocusOwner = thisManager.getGlobalFocusOwner();
Component nativeFocusOwner = thisManager.getNativeFocusOwner(); Component nativeFocusOwner = thisManager.getNativeFocusOwner();
Window nativeFocusedWindow = thisManager.getNativeFocusedWindow(); Window nativeFocusedWindow = thisManager.getNativeFocusedWindow();
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.log(Level.FINER, "SNFH for {0} in {1}", focusLog.finer("SNFH for {0} in {1}",
new Object[] {String.valueOf(descendant), String.valueOf(heavyweight)}); String.valueOf(descendant), String.valueOf(heavyweight));
} }
if (focusLog.isLoggable(Level.FINEST)) { if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.log(Level.FINEST, "0. Current focus owner {0}", focusLog.finest("0. Current focus owner {0}",
String.valueOf(currentFocusOwner)); String.valueOf(currentFocusOwner));
focusLog.log(Level.FINEST, "0. Native focus owner {0}", focusLog.finest("0. Native focus owner {0}",
String.valueOf(nativeFocusOwner)); String.valueOf(nativeFocusOwner));
focusLog.log(Level.FINEST, "0. Native focused window {0}", focusLog.finest("0. Native focused window {0}",
String.valueOf(nativeFocusedWindow)); String.valueOf(nativeFocusedWindow));
} }
synchronized (heavyweightRequests) { synchronized (heavyweightRequests) {
HeavyweightFocusRequest hwFocusRequest = getLastHWRequest(); HeavyweightFocusRequest hwFocusRequest = getLastHWRequest();
if (focusLog.isLoggable(Level.FINEST)) { if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.log(Level.FINEST, "Request {0}", String.valueOf(hwFocusRequest)); focusLog.finest("Request {0}", String.valueOf(hwFocusRequest));
} }
if (hwFocusRequest == null && if (hwFocusRequest == null &&
heavyweight == nativeFocusOwner) heavyweight == nativeFocusOwner)
{ {
if (descendant == currentFocusOwner) { if (descendant == currentFocusOwner) {
// Redundant request. // Redundant request.
if (focusLog.isLoggable(Level.FINEST)) if (focusLog.isLoggable(PlatformLogger.FINEST))
focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}", focusLog.finest("1. SNFH_FAILURE for {0}",
String.valueOf(descendant)); String.valueOf(descendant));
return SNFH_FAILURE; return SNFH_FAILURE;
} }
...@@ -2417,8 +2416,8 @@ public abstract class KeyboardFocusManager ...@@ -2417,8 +2416,8 @@ public abstract class KeyboardFocusManager
// SunToolkit.postPriorityEvent(newFocusOwnerEvent); // SunToolkit.postPriorityEvent(newFocusOwnerEvent);
SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent); SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent);
if (focusLog.isLoggable(Level.FINEST)) if (focusLog.isLoggable(PlatformLogger.FINEST))
focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", String.valueOf(descendant)); focusLog.finest("2. SNFH_HANDLED for {0}", String.valueOf(descendant));
return SNFH_SUCCESS_HANDLED; return SNFH_SUCCESS_HANDLED;
} else if (hwFocusRequest != null && } else if (hwFocusRequest != null &&
hwFocusRequest.heavyweight == heavyweight) { hwFocusRequest.heavyweight == heavyweight) {
...@@ -2431,7 +2430,7 @@ public abstract class KeyboardFocusManager ...@@ -2431,7 +2430,7 @@ public abstract class KeyboardFocusManager
manager.enqueueKeyEvents(time, descendant); manager.enqueueKeyEvents(time, descendant);
} }
if (focusLog.isLoggable(Level.FINEST)) if (focusLog.isLoggable(PlatformLogger.FINEST))
focusLog.finest("3. SNFH_HANDLED for lightweight" + focusLog.finest("3. SNFH_HANDLED for lightweight" +
descendant + " in " + heavyweight); descendant + " in " + heavyweight);
return SNFH_SUCCESS_HANDLED; return SNFH_SUCCESS_HANDLED;
...@@ -2454,7 +2453,7 @@ public abstract class KeyboardFocusManager ...@@ -2454,7 +2453,7 @@ public abstract class KeyboardFocusManager
(hwFocusRequest != null) (hwFocusRequest != null)
? hwFocusRequest.heavyweight ? hwFocusRequest.heavyweight
: nativeFocusedWindow)) { : nativeFocusedWindow)) {
if (focusLog.isLoggable(Level.FINEST)) if (focusLog.isLoggable(PlatformLogger.FINEST))
focusLog.finest("4. SNFH_FAILURE for " + descendant); focusLog.finest("4. SNFH_FAILURE for " + descendant);
return SNFH_FAILURE; return SNFH_FAILURE;
} }
...@@ -2464,7 +2463,7 @@ public abstract class KeyboardFocusManager ...@@ -2464,7 +2463,7 @@ public abstract class KeyboardFocusManager
heavyweightRequests.add heavyweightRequests.add
(new HeavyweightFocusRequest(heavyweight, descendant, (new HeavyweightFocusRequest(heavyweight, descendant,
temporary, cause)); temporary, cause));
if (focusLog.isLoggable(Level.FINEST)) if (focusLog.isLoggable(PlatformLogger.FINEST))
focusLog.finest("5. SNFH_PROCEED for " + descendant); focusLog.finest("5. SNFH_PROCEED for " + descendant);
return SNFH_SUCCESS_PROCEED; return SNFH_SUCCESS_PROCEED;
} }
...@@ -2855,14 +2854,14 @@ public abstract class KeyboardFocusManager ...@@ -2855,14 +2854,14 @@ public abstract class KeyboardFocusManager
} }
KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); KeyboardFocusManager manager = getCurrentKeyboardFocusManager();
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
if (event instanceof FocusEvent || event instanceof WindowEvent) { if (event instanceof FocusEvent || event instanceof WindowEvent) {
focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)}); focusLog.finer(">>> {0}", String.valueOf(event));
} }
if (focusLog.isLoggable(Level.FINER) && event instanceof KeyEvent) { if (focusLog.isLoggable(PlatformLogger.FINER) && event instanceof KeyEvent) {
focusLog.log(Level.FINER, " focus owner is {0}", focusLog.finer(" focus owner is {0}",
new Object[] {String.valueOf(manager.getGlobalFocusOwner())}); String.valueOf(manager.getGlobalFocusOwner()));
focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)}); focusLog.finer(">>> {0}", String.valueOf(event));
} }
} }
...@@ -2946,9 +2945,9 @@ public abstract class KeyboardFocusManager ...@@ -2946,9 +2945,9 @@ public abstract class KeyboardFocusManager
} }
} }
static void removeLastFocusRequest(Component heavyweight) { static void removeLastFocusRequest(Component heavyweight) {
if (log.isLoggable(Level.FINE)) { if (log.isLoggable(PlatformLogger.FINE)) {
if (heavyweight == null) { if (heavyweight == null) {
log.log(Level.FINE, "Assertion (heavyweight != null) failed"); log.fine("Assertion (heavyweight != null) failed");
} }
} }
......
...@@ -147,6 +147,51 @@ import sun.util.logging.PlatformLogger; ...@@ -147,6 +147,51 @@ import sun.util.logging.PlatformLogger;
*/ */
public class Window extends Container implements Accessible { public class Window extends Container implements Accessible {
/**
* Enumeration of available <i>window types</i>.
*
* A window type defines the generic visual appearance and behavior of a
* top-level window. For example, the type may affect the kind of
* decorations of a decorated {@code Frame} or {@code Dialog} instance.
* <p>
* Some platforms may not fully support a certain window type. Depending on
* the level of support, some properties of the window type may be
* disobeyed.
*
* @see #getType
* @see #setType
* @since 1.7
*/
public static enum Type {
/**
* Represents a <i>normal</i> window.
*
* This is the default type for objects of the {@code Window} class or
* its descendants. Use this type for regular top-level windows.
*/
NORMAL,
/**
* Represents a <i>utility</i> window.
*
* A utility window is usually a small window such as a toolbar or a
* palette. The native system may render the window with smaller
* title-bar if the window is either a {@code Frame} or a {@code
* Dialog} object, and if it has its decorations enabled.
*/
UTILITY,
/**
* Represents a <i>popup</i> window.
*
* A popup window is a temporary window such as a drop-down menu or a
* tooltip. On some platforms, windows of that type may be forcibly
* made undecorated even if they are instances of the {@code Frame} or
* {@code Dialog} class, and have decorations enabled.
*/
POPUP
}
/** /**
* This represents the warning message that is * This represents the warning message that is
* to be displayed in a non secure window. ie : * to be displayed in a non secure window. ie :
...@@ -2717,6 +2762,52 @@ public class Window extends Container implements Accessible { ...@@ -2717,6 +2762,52 @@ public class Window extends Container implements Accessible {
removeFromWindowList(appContext, weakThis); removeFromWindowList(appContext, weakThis);
} }
/**
* Window type.
*
* Synchronization: ObjectLock
*/
private Type type = Type.NORMAL;
/**
* Sets the type of the window.
*
* This method can only be called while the window is not displayable.
*
* @throws IllegalComponentStateException if the window
* is displayable.
* @throws IllegalArgumentException if the type is {@code null}
* @see Component#isDisplayable
* @see #getType
* @since 1.7
*/
public void setType(Type type) {
if (type == null) {
throw new IllegalArgumentException("type should not be null.");
}
synchronized (getTreeLock()) {
if (isDisplayable()) {
throw new IllegalComponentStateException(
"The window is displayable.");
}
synchronized (getObjectLock()) {
this.type = type;
}
}
}
/**
* Returns the type of the window.
*
* @see #setType
* @since 1.7
*/
public Type getType() {
synchronized (getObjectLock()) {
return type;
}
}
/** /**
* The window serialized data version. * The window serialized data version.
* *
...@@ -3873,6 +3964,18 @@ public class Window extends Container implements Accessible { ...@@ -3873,6 +3964,18 @@ public class Window extends Container implements Accessible {
public void setLWRequestStatus(Window changed, boolean status) { public void setLWRequestStatus(Window changed, boolean status) {
changed.syncLWRequests = status; changed.syncLWRequests = status;
} }
public boolean isAutoRequestFocus(Window w) {
return w.autoRequestFocus;
}
public boolean isTrayIconWindow(Window w) {
return w.isTrayIconWindow;
}
public void setTrayIconWindow(Window w, boolean isTrayIconWindow) {
w.isTrayIconWindow = isTrayIconWindow;
}
}); // WindowAccessor }); // WindowAccessor
} // static } // static
......
...@@ -175,15 +175,8 @@ import sun.security.util.SecurityConstants; ...@@ -175,15 +175,8 @@ import sun.security.util.SecurityConstants;
public abstract class ClassLoader { public abstract class ClassLoader {
private static native void registerNatives(); private static native void registerNatives();
// Set of classes which are registered as parallel capable class loaders
private static final Set<Class<? extends ClassLoader>> parallelLoaders
= Collections.newSetFromMap(Collections.synchronizedMap
(new WeakHashMap<Class<? extends ClassLoader>, Boolean>()));
static { static {
registerNatives(); registerNatives();
parallelLoaders.add(ClassLoader.class);
} }
// The parent class loader for delegation // The parent class loader for delegation
...@@ -191,6 +184,52 @@ public abstract class ClassLoader { ...@@ -191,6 +184,52 @@ public abstract class ClassLoader {
// must be added *after* it. // must be added *after* it.
private final ClassLoader parent; private final ClassLoader parent;
/**
* Encapsulates the set of parallel capable loader types.
*/
private static class ParallelLoaders {
private ParallelLoaders() {}
// the set of parallel capable loader types
private static final Set<Class<? extends ClassLoader>> loaderTypes =
Collections.newSetFromMap(
new WeakHashMap<Class<? extends ClassLoader>, Boolean>());
static {
synchronized (loaderTypes) { loaderTypes.add(ClassLoader.class); }
}
/**
* Registers the given class loader type as parallel capabale.
* Returns {@code true} is successfully registered; {@code false} if
* loader's super class is not registered.
*/
static boolean register(Class<? extends ClassLoader> c) {
synchronized (loaderTypes) {
if (loaderTypes.contains(c.getSuperclass())) {
// register the class loader as parallel capable
// if and only if all of its super classes are.
// Note: given current classloading sequence, if
// the immediate super class is parallel capable,
// all the super classes higher up must be too.
loaderTypes.add(c);
return true;
} else {
return false;
}
}
}
/**
* Returns {@code true} if the given class loader type is
* registered as parallel capable.
*/
static boolean isRegistered(Class<? extends ClassLoader> c) {
synchronized (loaderTypes) {
return loaderTypes.contains(c);
}
}
}
// Maps class name to the corresponding lock object when the current // Maps class name to the corresponding lock object when the current
// class loader is parallel capable. // class loader is parallel capable.
// Note: VM also uses this field to decide if the current class loader // Note: VM also uses this field to decide if the current class loader
...@@ -237,7 +276,7 @@ public abstract class ClassLoader { ...@@ -237,7 +276,7 @@ public abstract class ClassLoader {
private ClassLoader(Void unused, ClassLoader parent) { private ClassLoader(Void unused, ClassLoader parent) {
this.parent = parent; this.parent = parent;
if (parallelLoaders.contains(this.getClass())) { if (ParallelLoaders.isRegistered(this.getClass())) {
parallelLockMap = new ConcurrentHashMap<String, Object>(); parallelLockMap = new ConcurrentHashMap<String, Object>();
package2certs = new ConcurrentHashMap<String, Certificate[]>(); package2certs = new ConcurrentHashMap<String, Certificate[]>();
domains = domains =
...@@ -1194,24 +1233,7 @@ public abstract class ClassLoader { ...@@ -1194,24 +1233,7 @@ public abstract class ClassLoader {
* @since 1.7 * @since 1.7
*/ */
protected static boolean registerAsParallelCapable() { protected static boolean registerAsParallelCapable() {
Class<? extends ClassLoader> caller = getCaller(1); return ParallelLoaders.register(getCaller(1));
Class superCls = caller.getSuperclass();
boolean result = false;
// Explicit synchronization needed for composite action
synchronized (parallelLoaders) {
if (!parallelLoaders.contains(caller)) {
if (parallelLoaders.contains(superCls)) {
// register the immediate caller as parallel capable
// if and only if all of its super classes are.
// Note: given current classloading sequence, if
// the immediate super class is parallel capable,
// all the super classes higher up must be too.
result = true;
parallelLoaders.add(caller);
}
} else result = true;
}
return result;
} }
/** /**
...@@ -2174,4 +2196,3 @@ class SystemClassLoaderAction ...@@ -2174,4 +2196,3 @@ class SystemClassLoaderAction
return sys; return sys;
} }
} }
...@@ -619,6 +619,20 @@ public final class System { ...@@ -619,6 +619,20 @@ public final class System {
return props; return props;
} }
/**
* Returns the system-dependent line separator string. It always
* returns the same value - the initial value of the {@linkplain
* #getProperty(String) system property} {@code line.separator}.
*
* <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
* Windows systems it returns {@code "\r\n"}.
*/
public static String lineSeparator() {
return lineSeparator;
}
private static String lineSeparator;
/** /**
* Sets the system properties to the <code>Properties</code> * Sets the system properties to the <code>Properties</code>
* argument. * argument.
...@@ -1104,6 +1118,7 @@ public final class System { ...@@ -1104,6 +1118,7 @@ public final class System {
private static void initializeSystemClass() { private static void initializeSystemClass() {
props = new Properties(); props = new Properties();
initProperties(props); initProperties(props);
lineSeparator = props.getProperty("line.separator");
sun.misc.Version.init(); sun.misc.Version.init();
// Workaround until DownloadManager initialization is revisited. // Workaround until DownloadManager initialization is revisited.
...@@ -1192,7 +1207,7 @@ public final class System { ...@@ -1192,7 +1207,7 @@ public final class System {
} }
/* returns the class of the caller. */ /* returns the class of the caller. */
static Class getCallerClass() { static Class<?> getCallerClass() {
// NOTE use of more generic Reflection.getCallerClass() // NOTE use of more generic Reflection.getCallerClass()
return Reflection.getCallerClass(3); return Reflection.getCallerClass(3);
} }
......
...@@ -30,6 +30,7 @@ import java.util.List; ...@@ -30,6 +30,7 @@ import java.util.List;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.io.IOException; import java.io.IOException;
import sun.util.logging.PlatformLogger;
/** /**
* CookieManager provides a concrete implementation of {@link CookieHandler}, * CookieManager provides a concrete implementation of {@link CookieHandler},
...@@ -263,6 +264,7 @@ public class CookieManager extends CookieHandler ...@@ -263,6 +264,7 @@ public class CookieManager extends CookieHandler
if (cookieJar == null) if (cookieJar == null)
return; return;
PlatformLogger logger = PlatformLogger.getLogger("java.net.CookieManager");
for (String headerKey : responseHeaders.keySet()) { for (String headerKey : responseHeaders.keySet()) {
// RFC 2965 3.2.2, key must be 'Set-Cookie2' // RFC 2965 3.2.2, key must be 'Set-Cookie2'
// we also accept 'Set-Cookie' here for backward compatibility // we also accept 'Set-Cookie' here for backward compatibility
...@@ -277,7 +279,16 @@ public class CookieManager extends CookieHandler ...@@ -277,7 +279,16 @@ public class CookieManager extends CookieHandler
for (String headerValue : responseHeaders.get(headerKey)) { for (String headerValue : responseHeaders.get(headerKey)) {
try { try {
List<HttpCookie> cookies = HttpCookie.parse(headerValue); List<HttpCookie> cookies;
try {
cookies = HttpCookie.parse(headerValue);
} catch (IllegalArgumentException e) {
// Bogus header, make an empty list and log the error
cookies = java.util.Collections.EMPTY_LIST;
if (logger.isLoggable(PlatformLogger.SEVERE)) {
logger.severe("Invalid cookie for " + uri + ": " + headerValue);
}
}
for (HttpCookie cookie : cookies) { for (HttpCookie cookie : cookies) {
if (cookie.getPath() == null) { if (cookie.getPath() == null) {
// If no path is specified, then by default // If no path is specified, then by default
......
...@@ -1036,7 +1036,7 @@ public final class HttpCookie implements Cloneable { ...@@ -1036,7 +1036,7 @@ public final class HttpCookie implements Cloneable {
int version = Integer.parseInt(attrValue); int version = Integer.parseInt(attrValue);
cookie.setVersion(version); cookie.setVersion(version);
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
throw new IllegalArgumentException("Illegal cookie version attribute"); // Just ignore bogus version, it will default to 0 or 1
} }
} }
}); });
...@@ -1147,12 +1147,15 @@ public final class HttpCookie implements Cloneable { ...@@ -1147,12 +1147,15 @@ public final class HttpCookie implements Cloneable {
} }
private static String stripOffSurroundingQuote(String str) { private static String stripOffSurroundingQuote(String str) {
if (str != null && str.length() > 0 && if (str != null && str.length() > 2 &&
str.charAt(0) == '"' && str.charAt(str.length() - 1) == '"') { str.charAt(0) == '"' && str.charAt(str.length() - 1) == '"') {
return str.substring(1, str.length() - 1); return str.substring(1, str.length() - 1);
} else {
return str;
} }
if (str != null && str.length() > 2 &&
str.charAt(0) == '\'' && str.charAt(str.length() - 1) == '\'') {
return str.substring(1, str.length() - 1);
}
return str;
} }
private static boolean equalsIgnoreCase(String s, String t) { private static boolean equalsIgnoreCase(String s, String t) {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package java.nio.channels; package java.nio.channels;
import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.nio.channels.spi.SelectorProvider; import java.nio.channels.spi.SelectorProvider;
import java.util.Set; import java.util.Set;
...@@ -202,7 +203,7 @@ import java.util.Set; ...@@ -202,7 +203,7 @@ import java.util.Set;
* @see SelectionKey * @see SelectionKey
*/ */
public abstract class Selector { public abstract class Selector implements Closeable {
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
......
...@@ -2552,9 +2552,6 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2552,9 +2552,6 @@ public final class Formatter implements Closeable, Flushable {
private boolean dt = false; private boolean dt = false;
private char c; private char c;
// cache the line separator
private String ls;
private int index(String s) { private int index(String s) {
if (s != null) { if (s != null) {
try { try {
...@@ -2702,9 +2699,7 @@ public final class Formatter implements Closeable, Flushable { ...@@ -2702,9 +2699,7 @@ public final class Formatter implements Closeable, Flushable {
printHashCode(arg); printHashCode(arg);
break; break;
case Conversion.LINE_SEPARATOR: case Conversion.LINE_SEPARATOR:
if (ls == null) a.append(System.lineSeparator());
ls = System.getProperty("line.separator");
a.append(ls);
break; break;
case Conversion.PERCENT_SIGN: case Conversion.PERCENT_SIGN:
a.append('%'); a.append('%');
......
...@@ -318,7 +318,7 @@ class Deflater { ...@@ -318,7 +318,7 @@ class Deflater {
/** /**
* Compresses the input data and fills specified buffer with compressed * Compresses the input data and fills specified buffer with compressed
* data. Returns actual number of bytes of compressed data. A return value * data. Returns actual number of bytes of compressed data. A return value
* of 0 indicates that {@link needsInput() needsInput} should be called * of 0 indicates that {@link #needsInput() needsInput} should be called
* in order to determine if more input data is required. * in order to determine if more input data is required.
* *
* <p>This method uses {@link #NO_FLUSH} as its compression flush mode. * <p>This method uses {@link #NO_FLUSH} as its compression flush mode.
...@@ -339,7 +339,7 @@ class Deflater { ...@@ -339,7 +339,7 @@ class Deflater {
/** /**
* Compresses the input data and fills specified buffer with compressed * Compresses the input data and fills specified buffer with compressed
* data. Returns actual number of bytes of compressed data. A return value * data. Returns actual number of bytes of compressed data. A return value
* of 0 indicates that {@link needsInput() needsInput} should be called * of 0 indicates that {@link #needsInput() needsInput} should be called
* in order to determine if more input data is required. * in order to determine if more input data is required.
* *
* <p>This method uses {@link #NO_FLUSH} as its compression flush mode. * <p>This method uses {@link #NO_FLUSH} as its compression flush mode.
......
...@@ -66,7 +66,7 @@ class DeflaterOutputStream extends FilterOutputStream { ...@@ -66,7 +66,7 @@ class DeflaterOutputStream extends FilterOutputStream {
* @param def the compressor ("deflater") * @param def the compressor ("deflater")
* @param size the output buffer size * @param size the output buffer size
* @param syncFlush * @param syncFlush
* if {@code true} the {@link flush()} method of this * if {@code true} the {@link #flush()} method of this
* instance flushes the compressor with flush mode * instance flushes the compressor with flush mode
* {@link Deflater#SYNC_FLUSH} before flushing the output * {@link Deflater#SYNC_FLUSH} before flushing the output
* stream, otherwise only flushes the output stream * stream, otherwise only flushes the output stream
...@@ -114,7 +114,7 @@ class DeflaterOutputStream extends FilterOutputStream { ...@@ -114,7 +114,7 @@ class DeflaterOutputStream extends FilterOutputStream {
* @param out the output stream * @param out the output stream
* @param def the compressor ("deflater") * @param def the compressor ("deflater")
* @param syncFlush * @param syncFlush
* if {@code true} the {@link flush()} method of this * if {@code true} the {@link #flush()} method of this
* instance flushes the compressor with flush mode * instance flushes the compressor with flush mode
* {@link Deflater#SYNC_FLUSH} before flushing the output * {@link Deflater#SYNC_FLUSH} before flushing the output
* stream, otherwise only flushes the output stream * stream, otherwise only flushes the output stream
...@@ -151,7 +151,7 @@ class DeflaterOutputStream extends FilterOutputStream { ...@@ -151,7 +151,7 @@ class DeflaterOutputStream extends FilterOutputStream {
* *
* @param out the output stream * @param out the output stream
* @param syncFlush * @param syncFlush
* if {@code true} the {@link flush()} method of this * if {@code true} the {@link #flush()} method of this
* instance flushes the compressor with flush mode * instance flushes the compressor with flush mode
* {@link Deflater#SYNC_FLUSH} before flushing the output * {@link Deflater#SYNC_FLUSH} before flushing the output
* stream, otherwise only flushes the output stream * stream, otherwise only flushes the output stream
...@@ -262,10 +262,10 @@ class DeflaterOutputStream extends FilterOutputStream { ...@@ -262,10 +262,10 @@ class DeflaterOutputStream extends FilterOutputStream {
/** /**
* Flushes the compressed output stream. * Flushes the compressed output stream.
* *
* If {@link DeflaterOutputStream(OutputStream, Deflater, int, boolean) * If {@link #DeflaterOutputStream(OutputStream, Deflater, int, boolean)
* syncFlush} is {@code true} when this compressed output stream is * syncFlush} is {@code true} when this compressed output stream is
* constructed this method flushes the underlying {@code compressor} * constructed, this method first flushes the underlying {@code compressor}
* first with the flush mode {@link Deflater#SYNC_FLUSH} to force * with the flush mode {@link Deflater#SYNC_FLUSH} to force
* all pending data to be flushed out to the output stream and then * all pending data to be flushed out to the output stream and then
* flushes the output stream. Otherwise this method only flushes the * flushes the output stream. Otherwise this method only flushes the
* output stream without flushing the {@code compressor}. * output stream without flushing the {@code compressor}.
......
/* /*
* Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -198,6 +198,8 @@ public class InitialContext implements Context { ...@@ -198,6 +198,8 @@ public class InitialContext implements Context {
* *
* <p> This constructor will not modify <tt>environment</tt> * <p> This constructor will not modify <tt>environment</tt>
* or save a reference to it, but may save a clone. * or save a reference to it, but may save a clone.
* Caller should not modify mutable keys and values in
* <tt>environment</tt> after it has been passed to the constructor.
* *
* @param environment * @param environment
* environment used to create the initial context. * environment used to create the initial context.
......
/* /*
* Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -86,6 +86,8 @@ public class InitialDirContext extends InitialContext implements DirContext { ...@@ -86,6 +86,8 @@ public class InitialDirContext extends InitialContext implements DirContext {
* *
* <p> This constructor will not modify <tt>environment</tt> * <p> This constructor will not modify <tt>environment</tt>
* or save a reference to it, but may save a clone. * or save a reference to it, but may save a clone.
* Caller should not modify mutable keys and values in
* <tt>environment</tt> after it has been passed to the constructor.
* *
* @param environment * @param environment
* environment used to create the initial DirContext. * environment used to create the initial DirContext.
......
/* /*
* Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -110,6 +110,8 @@ public class InitialLdapContext extends InitialDirContext implements LdapContext ...@@ -110,6 +110,8 @@ public class InitialLdapContext extends InitialDirContext implements LdapContext
* *
* <p> This constructor will not modify its parameters or * <p> This constructor will not modify its parameters or
* save references to them, but may save a clone or copy. * save references to them, but may save a clone or copy.
* Caller should not modify mutable keys and values in
* <tt>environment</tt> after it has been passed to the constructor.
* *
* <p> <tt>connCtls</tt> is used as the underlying context instance's * <p> <tt>connCtls</tt> is used as the underlying context instance's
* connection request controls. See the class description * connection request controls. See the class description
......
...@@ -40,7 +40,6 @@ import java.security.PrivilegedExceptionAction; ...@@ -40,7 +40,6 @@ import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import sun.security.util.ResourcesMgr; import sun.security.util.ResourcesMgr;
import sun.security.util.SecurityConstants;
/** /**
* <p> A <code>Subject</code> represents a grouping of related information * <p> A <code>Subject</code> represents a grouping of related information
...@@ -239,7 +238,7 @@ public final class Subject implements java.io.Serializable { ...@@ -239,7 +238,7 @@ public final class Subject implements java.io.Serializable {
public void setReadOnly() { public void setReadOnly() {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(new AuthPermission("setReadOnly")); sm.checkPermission(AuthPermissionHolder.SET_READ_ONLY_PERMISSION);
} }
this.readOnly = true; this.readOnly = true;
...@@ -285,7 +284,7 @@ public final class Subject implements java.io.Serializable { ...@@ -285,7 +284,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(new AuthPermission("getSubject")); sm.checkPermission(AuthPermissionHolder.GET_SUBJECT_PERMISSION);
} }
if (acc == null) { if (acc == null) {
...@@ -343,7 +342,7 @@ public final class Subject implements java.io.Serializable { ...@@ -343,7 +342,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(SecurityConstants.DO_AS_PERMISSION); sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
} }
if (action == null) if (action == null)
throw new NullPointerException throw new NullPointerException
...@@ -402,7 +401,7 @@ public final class Subject implements java.io.Serializable { ...@@ -402,7 +401,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(SecurityConstants.DO_AS_PERMISSION); sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
} }
if (action == null) if (action == null)
...@@ -456,7 +455,7 @@ public final class Subject implements java.io.Serializable { ...@@ -456,7 +455,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(SecurityConstants.DO_AS_PRIVILEGED_PERMISSION); sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
} }
if (action == null) if (action == null)
...@@ -520,7 +519,7 @@ public final class Subject implements java.io.Serializable { ...@@ -520,7 +519,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(SecurityConstants.DO_AS_PRIVILEGED_PERMISSION); sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
} }
if (action == null) if (action == null)
...@@ -1044,16 +1043,13 @@ public final class Subject implements java.io.Serializable { ...@@ -1044,16 +1043,13 @@ public final class Subject implements java.io.Serializable {
if (sm != null) { if (sm != null) {
switch (which) { switch (which) {
case Subject.PRINCIPAL_SET: case Subject.PRINCIPAL_SET:
sm.checkPermission(new AuthPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION);
("modifyPrincipals"));
break; break;
case Subject.PUB_CREDENTIAL_SET: case Subject.PUB_CREDENTIAL_SET:
sm.checkPermission(new AuthPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION);
("modifyPublicCredentials"));
break; break;
default: default:
sm.checkPermission(new AuthPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION);
("modifyPrivateCredentials"));
break; break;
} }
} }
...@@ -1073,16 +1069,13 @@ public final class Subject implements java.io.Serializable { ...@@ -1073,16 +1069,13 @@ public final class Subject implements java.io.Serializable {
if (sm != null) { if (sm != null) {
switch (which) { switch (which) {
case Subject.PRINCIPAL_SET: case Subject.PRINCIPAL_SET:
sm.checkPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION);
(new AuthPermission("modifyPrincipals"));
break; break;
case Subject.PUB_CREDENTIAL_SET: case Subject.PUB_CREDENTIAL_SET:
sm.checkPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION);
(new AuthPermission("modifyPublicCredentials"));
break; break;
default: default:
sm.checkPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION);
(new AuthPermission("modifyPrivateCredentials"));
break; break;
} }
} }
...@@ -1405,4 +1398,27 @@ public final class Subject implements java.io.Serializable { ...@@ -1405,4 +1398,27 @@ public final class Subject implements java.io.Serializable {
return set.add(o); return set.add(o);
} }
} }
static class AuthPermissionHolder {
static final AuthPermission DO_AS_PERMISSION =
new AuthPermission("doAs");
static final AuthPermission DO_AS_PRIVILEGED_PERMISSION =
new AuthPermission("doAsPrivileged");
static final AuthPermission SET_READ_ONLY_PERMISSION =
new AuthPermission("setReadOnly");
static final AuthPermission GET_SUBJECT_PERMISSION =
new AuthPermission("getSubject");
static final AuthPermission MODIFY_PRINCIPALS_PERMISSION =
new AuthPermission("modifyPrincipals");
static final AuthPermission MODIFY_PUBLIC_CREDENTIALS_PERMISSION =
new AuthPermission("modifyPublicCredentials");
static final AuthPermission MODIFY_PRIVATE_CREDENTIALS_PERMISSION =
new AuthPermission("modifyPrivateCredentials");
}
} }
...@@ -227,12 +227,8 @@ public class Popup { ...@@ -227,12 +227,8 @@ public class Popup {
HeavyWeightWindow(Window parent) { HeavyWeightWindow(Window parent) {
super(parent); super(parent);
setFocusableWindowState(false); setFocusableWindowState(false);
Toolkit tk = Toolkit.getDefaultToolkit(); setType(Window.Type.POPUP);
if (tk instanceof SunToolkit) {
// all the short-lived windows like Popups should be
// OverrideRedirect on X11 platforms
((SunToolkit)tk).setOverrideRedirect(this);
}
// Popups are typically transient and most likely won't benefit // Popups are typically transient and most likely won't benefit
// from true double buffering. Turn it off here. // from true double buffering. Turn it off here.
getRootPane().setUseTrueDoubleBuffering(false); getRootPane().setUseTrueDoubleBuffering(false);
......
/* /*
* Copyright 2000-2001 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -678,7 +678,7 @@ public interface GSSContext { ...@@ -678,7 +678,7 @@ public interface GSSContext {
* are not definitive then the method will attempt to treat all * are not definitive then the method will attempt to treat all
* available bytes as part of the token.<p> * available bytes as part of the token.<p>
* *
* Other than the possible blocking behaviour described above, this * Other than the possible blocking behavior described above, this
* method is equivalent to the byte array based {@link #unwrap(byte[], * method is equivalent to the byte array based {@link #unwrap(byte[],
* int, int, MessageProp) unwrap} method.<p> * int, int, MessageProp) unwrap} method.<p>
* *
...@@ -826,7 +826,7 @@ public interface GSSContext { ...@@ -826,7 +826,7 @@ public interface GSSContext {
* are not definitive then the method will attempt to treat all * are not definitive then the method will attempt to treat all
* available bytes as part of the token.<p> * available bytes as part of the token.<p>
* *
* Other than the possible blocking behaviour described above, this * Other than the possible blocking behavior described above, this
* method is equivalent to the byte array based {@link #verifyMIC(byte[], * method is equivalent to the byte array based {@link #verifyMIC(byte[],
* int, int, byte[], int, int, MessageProp) verifyMIC} method.<p> * int, int, byte[], int, int, MessageProp) verifyMIC} method.<p>
* *
...@@ -917,7 +917,7 @@ public interface GSSContext { ...@@ -917,7 +917,7 @@ public interface GSSContext {
* getMutualAuthState} method.<p> * getMutualAuthState} method.<p>
* *
* @param state a boolean value indicating whether mutual * @param state a boolean value indicating whether mutual
* authentication shouls be used or not. * authentication should be used or not.
* @see #getMutualAuthState() * @see #getMutualAuthState()
* *
* @throws GSSException containing the following * @throws GSSException containing the following
...@@ -928,7 +928,7 @@ public interface GSSContext { ...@@ -928,7 +928,7 @@ public interface GSSContext {
/** /**
* Requests that replay detection be enabled for the * Requests that replay detection be enabled for the
* per-message security services after context establishemnt. This * per-message security services after context establishment. This
* request can only be made on the context initiator's side and it has * request can only be made on the context initiator's side and it has
* to be done prior to the first call to * to be done prior to the first call to
* <code>initSecContext</code>. During context establishment replay * <code>initSecContext</code>. During context establishment replay
...@@ -958,7 +958,7 @@ public interface GSSContext { ...@@ -958,7 +958,7 @@ public interface GSSContext {
/** /**
* Requests that sequence checking be enabled for the * Requests that sequence checking be enabled for the
* per-message security services after context establishemnt. This * per-message security services after context establishment. This
* request can only be made on the context initiator's side and it has * request can only be made on the context initiator's side and it has
* to be done prior to the first call to * to be done prior to the first call to
* <code>initSecContext</code>. During context establishment sequence * <code>initSecContext</code>. During context establishment sequence
......
...@@ -98,7 +98,7 @@ public final class AWTAccessor { ...@@ -98,7 +98,7 @@ public final class AWTAccessor {
* Returns whether the component is visible without invoking * Returns whether the component is visible without invoking
* any client code. * any client code.
*/ */
boolean isVisible_NoClientCode(Component comp); boolean isVisible(Component comp);
/** /**
* Sets the RequestFocusController. * Sets the RequestFocusController.
...@@ -114,6 +114,112 @@ public final class AWTAccessor { ...@@ -114,6 +114,112 @@ public final class AWTAccessor {
* Sets the appContext of the component. * Sets the appContext of the component.
*/ */
void setAppContext(Component comp, AppContext appContext); void setAppContext(Component comp, AppContext appContext);
/**
* Returns the parent of the component.
*/
Container getParent(Component comp);
/**
* Sets the parent of the component to the specified parent.
*/
void setParent(Component comp, Container parent);
/**
* Resizes the component to the specified width and height.
*/
void setSize(Component comp, int width, int height);
/**
* Returns the location of the component.
*/
Point getLocation(Component comp);
/**
* Moves the component to the new location.
*/
void setLocation(Component comp, int x, int y);
/**
* Determines whether this component is enabled.
*/
boolean isEnabled(Component comp);
/**
* Determines whether this component is displayable.
*/
boolean isDisplayable(Component comp);
/**
* Gets the cursor set in the component.
*/
Cursor getCursor(Component comp);
/**
* Returns the peer of the component.
*/
ComponentPeer getPeer(Component comp);
/**
* Sets the peer of the component to the specified peer.
*/
void setPeer(Component comp, ComponentPeer peer);
/**
* Determines whether this component is lightweight.
*/
boolean isLightweight(Component comp);
/**
* Returns whether or not paint messages received from
* the operating system should be ignored.
*/
boolean getIgnoreRepaint(Component comp);
/**
* Returns the width of the component.
*/
int getWidth(Component comp);
/**
* Returns the height of the component.
*/
int getHeight(Component comp);
/**
* Returns the x coordinate of the component.
*/
int getX(Component comp);
/**
* Returns the y coordinate of the component.
*/
int getY(Component comp);
/**
* Gets the foreground color of this component.
*/
Color getForeground(Component comp);
/**
* Gets the background color of this component.
*/
Color getBackground(Component comp);
/**
* Sets the background of this component to the specified color.
*/
void setBackground(Component comp, Color background);
/**
* Gets the font of the component.
*/
Font getFont(Component comp);
/**
* Processes events occurring on this component.
*/
void processEvent(Component comp, AWTEvent e);
} }
/* /*
...@@ -169,6 +275,22 @@ public final class AWTAccessor { ...@@ -169,6 +275,22 @@ public final class AWTAccessor {
* components in the specified window to the specified value. * components in the specified window to the specified value.
*/ */
void setLWRequestStatus(Window changed, boolean status); void setLWRequestStatus(Window changed, boolean status);
/**
* Indicates whether this window should receive focus on subsequently
* being shown, or being moved to the front.
*/
boolean isAutoRequestFocus(Window w);
/**
* Indicates whether the specified window is an utility window for TrayIcon.
*/
boolean isTrayIconWindow(Window w);
/**
* Marks the specified window as an utility window for TrayIcon.
*/
void setTrayIconWindow(Window w, boolean isTrayIconWindow);
} }
/* /*
...@@ -248,14 +370,14 @@ public final class AWTAccessor { ...@@ -248,14 +370,14 @@ public final class AWTAccessor {
* An accessor for the EventQueue class * An accessor for the EventQueue class
*/ */
public interface EventQueueAccessor { public interface EventQueueAccessor {
/*
* Gets the next event queue.
*/
EventQueue getNextQueue(EventQueue eventQueue);
/* /*
* Gets the event dispatch thread. * Gets the event dispatch thread.
*/ */
Thread getDispatchThread(EventQueue eventQueue); Thread getDispatchThread(EventQueue eventQueue);
/*
* Checks if the current thread is EDT for the given EQ.
*/
public boolean isDispatchThreadImpl(EventQueue eventQueue);
} }
/* /*
......
...@@ -43,6 +43,9 @@ import java.util.HashSet; ...@@ -43,6 +43,9 @@ import java.util.HashSet;
import java.beans.PropertyChangeSupport; import java.beans.PropertyChangeSupport;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/** /**
* The AppContext is a table referenced by ThreadGroup which stores * The AppContext is a table referenced by ThreadGroup which stores
...@@ -132,10 +135,17 @@ public final class AppContext { ...@@ -132,10 +135,17 @@ public final class AppContext {
/* Since the contents of an AppContext are unique to each Java /* Since the contents of an AppContext are unique to each Java
* session, this class should never be serialized. */ * session, this class should never be serialized. */
/* The key to put()/get() the Java EventQueue into/from the AppContext. /*
* The key to put()/get() the Java EventQueue into/from the AppContext.
*/ */
public static final Object EVENT_QUEUE_KEY = new StringBuffer("EventQueue"); public static final Object EVENT_QUEUE_KEY = new StringBuffer("EventQueue");
/*
* The keys to store EventQueue push/pop lock and condition.
*/
public final static Object EVENT_QUEUE_LOCK_KEY = new StringBuilder("EventQueue.Lock");
public final static Object EVENT_QUEUE_COND_KEY = new StringBuilder("EventQueue.Condition");
/* A map of AppContexts, referenced by ThreadGroup. /* A map of AppContexts, referenced by ThreadGroup.
*/ */
private static final Map<ThreadGroup, AppContext> threadGroup2appContext = private static final Map<ThreadGroup, AppContext> threadGroup2appContext =
...@@ -244,6 +254,13 @@ public final class AppContext { ...@@ -244,6 +254,13 @@ public final class AppContext {
return Thread.currentThread().getContextClassLoader(); return Thread.currentThread().getContextClassLoader();
} }
}); });
// Initialize push/pop lock and its condition to be used by all the
// EventQueues within this AppContext
Lock eventQueuePushPopLock = new ReentrantLock();
put(EVENT_QUEUE_LOCK_KEY, eventQueuePushPopLock);
Condition eventQueuePushPopCond = eventQueuePushPopLock.newCondition();
put(EVENT_QUEUE_COND_KEY, eventQueuePushPopCond);
} }
private static final ThreadLocal<AppContext> threadAppContext = private static final ThreadLocal<AppContext> threadAppContext =
......
/*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.awt;
import java.awt.Component;
import java.awt.Container;
import java.awt.AWTEvent;
import java.awt.Font;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Point;
import java.awt.peer.ComponentPeer;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import sun.util.logging.PlatformLogger;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* A collection of methods for modifying package private fields in AWT components.
* This class is meant to be used by Peer code only. Previously peer code
* got around this problem by modifying fields from native code. However
* as we move away from native code to Pure-java peers we need this class.
*
* @author Bino George
*/
public class ComponentAccessor
{
private static Class componentClass;
private static Field fieldX;
private static Field fieldY;
private static Field fieldWidth;
private static Field fieldHeight;
private static Method methodGetParentNoClientCode;
private static Method methodGetFontNoClientCode;
private static Method methodProcessEvent;
private static Method methodEnableEvents;
private static Field fieldParent;
private static Field fieldBackground;
private static Field fieldForeground;
private static Field fieldFont;
private static Field fieldPacked;
private static Field fieldIgnoreRepaint;
private static Field fieldPeer;
private static Field fieldVisible;
private static Method methodIsEnabledImpl;
private static Method methodGetCursorNoClientCode;
private static Method methodLocationNoClientCode;
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.ComponentAccessor");
private ComponentAccessor() {
}
static {
AccessController.doPrivileged( new PrivilegedAction() {
public Object run() {
try {
componentClass = Class.forName("java.awt.Component");
fieldX = componentClass.getDeclaredField("x");
fieldX.setAccessible(true);
fieldY = componentClass.getDeclaredField("y");
fieldY.setAccessible(true);
fieldWidth = componentClass.getDeclaredField("width");
fieldWidth.setAccessible(true);
fieldHeight = componentClass.getDeclaredField("height");
fieldHeight.setAccessible(true);
fieldForeground = componentClass.getDeclaredField("foreground");
fieldForeground.setAccessible(true);
fieldBackground = componentClass.getDeclaredField("background");
fieldBackground.setAccessible(true);
fieldFont = componentClass.getDeclaredField("font");
fieldFont.setAccessible(true);
methodGetParentNoClientCode = componentClass.getDeclaredMethod("getParent_NoClientCode", (Class[]) null);
methodGetParentNoClientCode.setAccessible(true);
methodGetFontNoClientCode = componentClass.getDeclaredMethod("getFont_NoClientCode", (Class[]) null);
methodGetFontNoClientCode.setAccessible(true);
Class[] argTypes = { AWTEvent.class };
methodProcessEvent = componentClass.getDeclaredMethod("processEvent",argTypes);
methodProcessEvent.setAccessible(true);
Class[] argTypesForMethodEnableEvents = { Long.TYPE };
methodEnableEvents = componentClass.getDeclaredMethod("enableEvents",argTypesForMethodEnableEvents);
methodEnableEvents.setAccessible(true);
fieldParent = componentClass.getDeclaredField("parent");
fieldParent.setAccessible(true);
fieldPacked = componentClass.getDeclaredField("isPacked");
fieldPacked.setAccessible(true);
fieldIgnoreRepaint = componentClass.getDeclaredField("ignoreRepaint");
fieldIgnoreRepaint.setAccessible(true);
fieldPeer = componentClass.getDeclaredField("peer");
fieldPeer.setAccessible(true);
fieldVisible = componentClass.getDeclaredField("visible");
fieldVisible.setAccessible(true);
methodIsEnabledImpl = componentClass.getDeclaredMethod("isEnabledImpl", (Class[]) null);
methodIsEnabledImpl.setAccessible(true);
methodGetCursorNoClientCode = componentClass.getDeclaredMethod("getCursor_NoClientCode", (Class[]) null);
methodGetCursorNoClientCode.setAccessible(true);
methodLocationNoClientCode = componentClass.getDeclaredMethod("location_NoClientCode", (Class[]) null);
methodLocationNoClientCode.setAccessible(true);
}
catch (NoSuchFieldException e) {
log.fine("Unable to initialize ComponentAccessor", e);
}
catch (ClassNotFoundException e) {
log.fine("Unable to initialize ComponentAccessor", e);
}
catch (NoSuchMethodException e) {
log.fine("Unable to initialize ComponentAccessor", e);
}
// to please javac
return null;
}
});
}
public static void setX(Component c, int x)
{
try {
fieldX.setInt(c,x);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
}
public static void setY(Component c, int y)
{
try {
fieldY.setInt(c,y);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
}
public static void setWidth(Component c, int width)
{
try {
fieldWidth.setInt(c,width);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
}
public static void setHeight(Component c, int height)
{
try {
fieldHeight.setInt(c,height);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
}
public static void setBounds(Component c, int x, int y, int width, int height)
{
try {
fieldX.setInt(c,x);
fieldY.setInt(c,y);
fieldWidth.setInt(c,width);
fieldHeight.setInt(c,height);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
}
public static int getX(Component c) {
try {
return fieldX.getInt(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return 0;
}
public static int getY(Component c) {
try {
return fieldY.getInt(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return 0;
}
public static int getWidth(Component c) {
try {
return fieldWidth.getInt(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return 0;
}
public static int getHeight(Component c) {
try {
return fieldHeight.getInt(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return 0;
}
public static boolean getIsPacked(Component c) {
try {
return fieldPacked.getBoolean(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return false;
}
public static Container getParent_NoClientCode(Component c) {
Container parent=null;
try {
parent = (Container) methodGetParentNoClientCode.invoke(c, (Object[]) null);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
catch (InvocationTargetException e) {
log.fine("Unable to invoke on the Component object", e);
}
return parent;
}
public static Font getFont_NoClientCode(Component c) {
Font font=null;
try {
font = (Font) methodGetFontNoClientCode.invoke(c, (Object[]) null);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
catch (InvocationTargetException e) {
log.fine("Unable to invoke on the Component object", e);
}
return font;
}
public static void processEvent(Component c, AWTEvent event) {
Font font=null;
try {
Object[] args = new Object[1];
args[0] = event;
methodProcessEvent.invoke(c,args);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
catch (InvocationTargetException e) {
log.fine("Unable to invoke on the Component object", e);
}
}
public static void enableEvents(Component c, long event_mask) {
try {
Object[] args = new Object[1];
args[0] = Long.valueOf(event_mask);
methodEnableEvents.invoke(c,args);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
catch (InvocationTargetException e) {
log.fine("Unable to invoke on the Component object", e);
}
}
public static void setParent(Component c, Container parent)
{
try {
fieldParent.set(c,parent);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
}
public static Color getForeground(Component c)
{
Color color = null;
try {
color = (Color) fieldForeground.get(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return color;
}
public static Color getBackground(Component c)
{
Color color = null;
try {
color = (Color) fieldBackground.get(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return color;
}
public static void setBackground(Component c, Color color) {
try {
fieldBackground.set(c, color);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
}
public static Font getFont(Component c)
{
Font f = null;
try {
f = (Font) fieldFont.get(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return f;
}
public static ComponentPeer getPeer(Component c) {
ComponentPeer peer = null;
try {
peer = (ComponentPeer)fieldPeer.get(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return peer;
}
public static void setPeer(Component c, ComponentPeer peer) {
try {
fieldPeer.set(c, peer);
} catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
}
public static boolean getIgnoreRepaint(Component comp) {
try {
return fieldIgnoreRepaint.getBoolean(comp);
}
catch (IllegalAccessException e) {
log.fine("Unable to access the Component object", e);
}
return false;
}
public static boolean getVisible(Component c) {
try {
return fieldVisible.getBoolean(c);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
return false;
}
public static boolean isEnabledImpl(Component c) {
boolean enabled = true;
try {
enabled = (Boolean) methodIsEnabledImpl.invoke(c, (Object[]) null);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
catch (InvocationTargetException e) {
log.fine("Unable to invoke on the Component object", e);
}
return enabled;
}
public static Cursor getCursor_NoClientCode(Component c) {
Cursor cursor = null;
try {
cursor = (Cursor) methodGetCursorNoClientCode.invoke(c, (Object[]) null);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
catch (InvocationTargetException e) {
log.fine("Unable to invoke on the Component object", e);
}
return cursor;
}
public static Point getLocation_NoClientCode(Component c) {
Point loc = null;
try {
loc = (Point) methodLocationNoClientCode.invoke(c, (Object[]) null);
}
catch (IllegalAccessException e)
{
log.fine("Unable to access the Component object", e);
}
catch (InvocationTargetException e) {
log.fine("Unable to invoke on the Component object", e);
}
return loc;
}
}
...@@ -183,7 +183,7 @@ public abstract class GlobalCursorManager { ...@@ -183,7 +183,7 @@ public abstract class GlobalCursorManager {
} }
if (comp instanceof Window) { if (comp instanceof Window) {
p = ComponentAccessor.getLocation_NoClientCode(comp); p = AWTAccessor.getComponentAccessor().getLocation(comp);
} else if (comp instanceof Container) { } else if (comp instanceof Container) {
p = getLocationOnScreen(comp); p = getLocationOnScreen(comp);
} }
...@@ -202,7 +202,7 @@ public abstract class GlobalCursorManager { ...@@ -202,7 +202,7 @@ public abstract class GlobalCursorManager {
} }
} }
setCursor(comp, ComponentAccessor.getCursor_NoClientCode(comp), useCache); setCursor(comp, AWTAccessor.getComponentAccessor().getCursor(comp), useCache);
} catch (IllegalComponentStateException e) { } catch (IllegalComponentStateException e) {
// Shouldn't happen, but if it does, abort. // Shouldn't happen, but if it does, abort.
......
...@@ -722,13 +722,7 @@ public abstract class SunToolkit extends Toolkit ...@@ -722,13 +722,7 @@ public abstract class SunToolkit extends Toolkit
EventQueue eq = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY); EventQueue eq = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
AWTAccessor.EventQueueAccessor accessor = AWTAccessor.getEventQueueAccessor(); AWTAccessor.EventQueueAccessor accessor = AWTAccessor.getEventQueueAccessor();
EventQueue next = accessor.getNextQueue(eq); return accessor.isDispatchThreadImpl(eq);
while (next != null) {
eq = next;
next = accessor.getNextQueue(eq);
}
return (Thread.currentThread() == accessor.getDispatchThread(eq));
} }
public Dimension getScreenSize() { public Dimension getScreenSize() {
...@@ -806,17 +800,9 @@ public abstract class SunToolkit extends Toolkit ...@@ -806,17 +800,9 @@ public abstract class SunToolkit extends Toolkit
} }
/** static final SoftCache imgCache = new SoftCache();
* Makes the window OverrideRedirect, on X11 platforms. See
* ICCCM specification for more details about OverrideRedirect
* windows. Implemented in XToolkit, no-op in WToolkit.
*/
public void setOverrideRedirect(Window target) {
}
static SoftCache imgCache = new SoftCache();
static synchronized Image getImageFromHash(Toolkit tk, URL url) { static Image getImageFromHash(Toolkit tk, URL url) {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
try { try {
...@@ -844,32 +830,36 @@ public abstract class SunToolkit extends Toolkit ...@@ -844,32 +830,36 @@ public abstract class SunToolkit extends Toolkit
sm.checkConnect(url.getHost(), url.getPort()); sm.checkConnect(url.getHost(), url.getPort());
} }
} }
Image img = (Image)imgCache.get(url); synchronized (imgCache) {
if (img == null) { Image img = (Image)imgCache.get(url);
try { if (img == null) {
img = tk.createImage(new URLImageSource(url)); try {
imgCache.put(url, img); img = tk.createImage(new URLImageSource(url));
} catch (Exception e) { imgCache.put(url, img);
} catch (Exception e) {
}
} }
return img;
} }
return img;
} }
static synchronized Image getImageFromHash(Toolkit tk, static Image getImageFromHash(Toolkit tk,
String filename) { String filename) {
SecurityManager security = System.getSecurityManager(); SecurityManager security = System.getSecurityManager();
if (security != null) { if (security != null) {
security.checkRead(filename); security.checkRead(filename);
} }
Image img = (Image)imgCache.get(filename); synchronized (imgCache) {
if (img == null) { Image img = (Image)imgCache.get(filename);
try { if (img == null) {
img = tk.createImage(new FileImageSource(filename)); try {
imgCache.put(filename, img); img = tk.createImage(new FileImageSource(filename));
} catch (Exception e) { imgCache.put(filename, img);
} catch (Exception e) {
}
} }
return img;
} }
return img;
} }
public Image getImage(String filename) { public Image getImage(String filename) {
...@@ -1128,6 +1118,18 @@ public abstract class SunToolkit extends Toolkit ...@@ -1128,6 +1118,18 @@ public abstract class SunToolkit extends Toolkit
return Toolkit.getNativeContainer(c); return Toolkit.getNativeContainer(c);
} }
/**
* Gives native peers the ability to query the closest HW component.
* If the given component is heavyweight, then it returns this. Otherwise,
* it goes one level up in the hierarchy and tests next component.
*/
public static Component getHeavyweightComponent(Component c) {
while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) {
c = AWTAccessor.getComponentAccessor().getParent(c);
}
return c;
}
/** /**
* Returns a new input method window, with behavior as specified in * Returns a new input method window, with behavior as specified in
* {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}. * {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}.
......
/*
* Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package sun.awt;
import java.awt.Window;
import java.lang.reflect.Field;
import sun.util.logging.PlatformLogger;
import java.security.AccessController;
import java.security.PrivilegedAction;
public class WindowAccessor {
private static Class windowClass;
private static Field fieldIsAutoRequestFocus;
private static Field fieldIsTrayIconWindow;
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.WindowAccessor");
private WindowAccessor() {
}
static {
AccessController.doPrivileged( new PrivilegedAction() {
public Object run() {
try {
windowClass = Class.forName("java.awt.Window");
fieldIsAutoRequestFocus = windowClass.getDeclaredField("autoRequestFocus");
fieldIsAutoRequestFocus.setAccessible(true);
fieldIsTrayIconWindow = windowClass.getDeclaredField("isTrayIconWindow");
fieldIsTrayIconWindow.setAccessible(true);
} catch (NoSuchFieldException e) {
log.fine("Unable to initialize WindowAccessor: ", e);
} catch (ClassNotFoundException e) {
log.fine("Unable to initialize WindowAccessor: ", e);
}
return null;
}
});
}
public static boolean isAutoRequestFocus(Window w) {
try {
return fieldIsAutoRequestFocus.getBoolean(w);
} catch (IllegalAccessException e) {
log.fine("Unable to access the Window object", e);
}
return true;
}
public static boolean isTrayIconWindow(Window w) {
try {
return fieldIsTrayIconWindow.getBoolean(w);
} catch (IllegalAccessException e) {
log.fine("Unable to access the Window object", e);
}
return false;
}
public static void setTrayIconWindow(Window w, boolean isTrayIconWindow) {
try {
fieldIsTrayIconWindow.set(w, isTrayIconWindow);
} catch (IllegalAccessException e) {
log.fine("Unable to access the Window object", e);
}
}
}
...@@ -396,12 +396,19 @@ public class StandardGlyphVector extends GlyphVector { ...@@ -396,12 +396,19 @@ public class StandardGlyphVector extends GlyphVector {
// !!! not cached, assume TextLayout will cache if necessary // !!! not cached, assume TextLayout will cache if necessary
public Rectangle2D getVisualBounds() { public Rectangle2D getVisualBounds() {
if (glyphs.length == 0) { Rectangle2D result = null;
return new Rectangle2D.Float(0, 0, 0, 0); for (int i = 0; i < glyphs.length; ++i) {
Rectangle2D glyphVB = getGlyphVisualBounds(i).getBounds2D();
if (!glyphVB.isEmpty()) {
if (result == null) {
result = glyphVB;
} else {
Rectangle2D.union(result, glyphVB, result);
}
}
} }
Rectangle2D result = getGlyphVisualBounds(0).getBounds2D(); if (result == null) {
for (int i = 1; i < glyphs.length; ++i) { result = new Rectangle2D.Float(0, 0, 0, 0);
Rectangle2D.union(result, getGlyphVisualBounds(i).getBounds2D(), result);
} }
return result; return result;
} }
...@@ -1787,8 +1794,19 @@ public class StandardGlyphVector extends GlyphVector { ...@@ -1787,8 +1794,19 @@ public class StandardGlyphVector extends GlyphVector {
gp.transform(sgv.invdtx); gp.transform(sgv.invdtx);
result = gp.getBounds2D(); result = gp.getBounds2D();
} }
result.setRect(result.getMinX() + x + dx, result.getMinY() + y + dy, /* Since x is the logical advance of the glyph to this point.
result.getWidth(), result.getHeight()); * Because of the way that Rectangle.union is specified, this
* means that subsequent unioning of a rect including that
* will be affected, even if the glyph is empty. So skip such
* cases. This alone isn't a complete solution since x==0
* may also not be what is wanted. The code that does the
* unioning also needs to be aware to ignore empty glyphs.
*/
if (!result.isEmpty()) {
result.setRect(result.getMinX() + x + dx,
result.getMinY() + y + dy,
result.getWidth(), result.getHeight());
}
return result; return result;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package sun.net.www.protocol.http.spnego; package sun.net.www.protocol.http.spnego;
import com.sun.security.jgss.ExtendedGSSContext;
import java.io.IOException; import java.io.IOException;
import org.ietf.jgss.GSSContext; import org.ietf.jgss.GSSContext;
...@@ -100,15 +101,10 @@ public class NegotiatorImpl extends Negotiator { ...@@ -100,15 +101,10 @@ public class NegotiatorImpl extends Negotiator {
null, null,
GSSContext.DEFAULT_LIFETIME); GSSContext.DEFAULT_LIFETIME);
// In order to support credential delegation in HTTP/SPNEGO, // Always respect delegation policy in HTTP/SPNEGO.
// we always request it before initSecContext. The current if (context instanceof ExtendedGSSContext) {
// implementation will check the OK-AS-DELEGATE flag inside ((ExtendedGSSContext)context).requestDelegPolicy(true);
// the service ticket of the web server, and only enable }
// delegation when this flag is set. This check is only
// performed when the GSS caller is CALLER_HTTP_NEGOTIATE,
// so all other normal GSS-API calls are not affected.
context.requestCredDeleg(true);
oneToken = context.initSecContext(new byte[0], 0, 0); oneToken = context.initSecContext(new byte[0], 0, 0);
} }
......
...@@ -78,6 +78,7 @@ class Krb5Context implements GSSContextSpi { ...@@ -78,6 +78,7 @@ class Krb5Context implements GSSContextSpi {
private boolean sequenceDetState = true; private boolean sequenceDetState = true;
private boolean confState = true; private boolean confState = true;
private boolean integState = true; private boolean integState = true;
private boolean delegPolicyState = false;
private int mySeqNumber; private int mySeqNumber;
private int peerSeqNumber; private int peerSeqNumber;
...@@ -299,6 +300,21 @@ class Krb5Context implements GSSContextSpi { ...@@ -299,6 +300,21 @@ class Krb5Context implements GSSContextSpi {
return sequenceDetState || replayDetState; return sequenceDetState || replayDetState;
} }
/**
* Requests that the deleg policy be respected.
*/
public final void requestDelegPolicy(boolean value) {
if (state == STATE_NEW && isInitiator())
delegPolicyState = value;
}
/**
* Is deleg policy respected?
*/
public final boolean getDelegPolicyState() {
return delegPolicyState;
}
/* /*
* Anonymity is a little different in that after an application * Anonymity is a little different in that after an application
* requests anonymity it will want to know whether the mechanism * requests anonymity it will want to know whether the mechanism
...@@ -422,6 +438,10 @@ class Krb5Context implements GSSContextSpi { ...@@ -422,6 +438,10 @@ class Krb5Context implements GSSContextSpi {
integState = state; integState = state;
} }
final void setDelegPolicyState(boolean state) {
delegPolicyState = state;
}
/** /**
* Sets the channel bindings to be used during context * Sets the channel bindings to be used during context
* establishment. * establishment.
......
...@@ -124,6 +124,8 @@ public interface GSSContextSpi { ...@@ -124,6 +124,8 @@ public interface GSSContextSpi {
public void requestInteg(boolean state) throws GSSException; public void requestInteg(boolean state) throws GSSException;
public void requestDelegPolicy(boolean state) throws GSSException;
public void setChannelBinding(ChannelBinding cb) throws GSSException; public void setChannelBinding(ChannelBinding cb) throws GSSException;
public boolean getCredDelegState(); public boolean getCredDelegState();
...@@ -136,6 +138,8 @@ public interface GSSContextSpi { ...@@ -136,6 +138,8 @@ public interface GSSContextSpi {
public boolean getAnonymityState(); public boolean getAnonymityState();
public boolean getDelegPolicyState();
public boolean isTransferable() throws GSSException; public boolean isTransferable() throws GSSException;
public boolean isProtReady(); public boolean isProtReady();
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#ifdef __NEWVALID /* special setup for Sun test regime */ #ifdef __NEWVALID /* special setup for Sun test regime */
#if defined(i386) || defined(i486) || \ #if defined(i386) || defined(i486) || \
defined(intel) || defined(x86) || \ defined(intel) || defined(x86) || \
defined(i86pc) || defined(_M_IA64) defined(i86pc) || defined(_M_IA64) || defined(ia64)
#define _LITTLE_ENDIAN #define _LITTLE_ENDIAN
#endif #endif
#endif #endif
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册