Merge
This commit is contained in:
commit
0b4fe8b0f0
@ -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;
|
|||||||
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 {
|
|||||||
} 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 {
|
|||||||
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> {
|
|||||||
/**
|
/**
|
||||||
* 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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
|||||||
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 {
|
|||||||
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 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
|||||||
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
|
|||||||
|
|
||||||
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 {
|
|||||||
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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -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 {
|
|||||||
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 {
|
|||||||
|
|
||||||
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 {
|
|||||||
|
|
||||||
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 {
|
|||||||
|
|
||||||
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 {
|
|||||||
|
|
||||||
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 {
|
|||||||
|
|
||||||
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 {
|
|||||||
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 {
|
|||||||
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 {
|
|||||||
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,10 +335,13 @@ class OCSPChecker extends PKIXCertPathChecker {
|
|||||||
response = OCSP.check(Collections.singletonList(certId), uri,
|
response = OCSP.check(Collections.singletonList(certId), uri,
|
||||||
responderCert, pkixParams.getDate());
|
responderCert, pkixParams.getDate());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Wrap all exceptions in CertPathValidatorException so that
|
if (e instanceof CertPathValidatorException) {
|
||||||
// we can fallback to CRLs, if enabled.
|
throw (CertPathValidatorException) e;
|
||||||
throw new CertPathValidatorException
|
} else {
|
||||||
("Unable to send OCSP request", e);
|
// Wrap exceptions in CertPathValidatorException so that
|
||||||
|
// we can fallback to CRLs, if enabled.
|
||||||
|
throw new CertPathValidatorException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RevocationStatus rs = (RevocationStatus) response.getSingleResponse(certId);
|
RevocationStatus rs = (RevocationStatus) response.getSingleResponse(certId);
|
||||||
|
@ -33,7 +33,6 @@ import java.security.Permission;
|
|||||||
import java.security.BasicPermission;
|
import java.security.BasicPermission;
|
||||||
import java.security.SecurityPermission;
|
import java.security.SecurityPermission;
|
||||||
import java.security.AllPermission;
|
import java.security.AllPermission;
|
||||||
import javax.security.auth.AuthPermission;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission constants and string constants used to create permissions
|
* Permission constants and string constants used to create permissions
|
||||||
@ -259,12 +258,4 @@ public final class SecurityConstants {
|
|||||||
// java.lang.SecurityManager
|
// java.lang.SecurityManager
|
||||||
public static final SocketPermission LOCAL_LISTEN_PERMISSION =
|
public static final SocketPermission LOCAL_LISTEN_PERMISSION =
|
||||||
new SocketPermission("localhost:1024-", SOCKET_LISTEN_ACTION);
|
new SocketPermission("localhost:1024-", SOCKET_LISTEN_ACTION);
|
||||||
|
|
||||||
// javax.security.auth.Subject
|
|
||||||
public static final AuthPermission DO_AS_PERMISSION =
|
|
||||||
new AuthPermission("doAs");
|
|
||||||
|
|
||||||
// javax.security.auth.Subject
|
|
||||||
public static final AuthPermission DO_AS_PRIVILEGED_PERMISSION =
|
|
||||||
new AuthPermission("doAsPrivileged");
|
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,17 @@ public final class PKIXValidator extends Validator {
|
|||||||
("null or zero-length certificate chain");
|
("null or zero-length certificate chain");
|
||||||
}
|
}
|
||||||
if (TRY_VALIDATOR) {
|
if (TRY_VALIDATOR) {
|
||||||
// check if chain contains trust anchor
|
// check that chain is in correct order and check if chain contains
|
||||||
|
// trust anchor
|
||||||
|
X500Principal prevIssuer = null;
|
||||||
for (int i = 0; i < chain.length; i++) {
|
for (int i = 0; i < chain.length; i++) {
|
||||||
if (trustedCerts.contains(chain[i])) {
|
X509Certificate cert = chain[i];
|
||||||
|
if (i != 0 &&
|
||||||
|
!cert.getSubjectX500Principal().equals(prevIssuer)) {
|
||||||
|
// chain is not ordered correctly, call builder instead
|
||||||
|
return doBuild(chain, otherCerts);
|
||||||
|
}
|
||||||
|
if (trustedCerts.contains(cert)) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return new X509Certificate[] {chain[0]};
|
return new X509Certificate[] {chain[0]};
|
||||||
}
|
}
|
||||||
@ -161,6 +169,7 @@ public final class PKIXValidator extends Validator {
|
|||||||
System.arraycopy(chain, 0, newChain, 0, i);
|
System.arraycopy(chain, 0, newChain, 0, i);
|
||||||
return doValidate(newChain);
|
return doValidate(newChain);
|
||||||
}
|
}
|
||||||
|
prevIssuer = cert.getIssuerX500Principal();
|
||||||
}
|
}
|
||||||
|
|
||||||
// apparently issued by trust anchor?
|
// apparently issued by trust anchor?
|
||||||
@ -303,5 +312,4 @@ public final class PKIXValidator extends Validator {
|
|||||||
("PKIX path building failed: " + e.toString(), e);
|
("PKIX path building failed: " + e.toString(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import com.sun.tracing.ProviderFactory;
|
import com.sun.tracing.ProviderFactory;
|
||||||
import com.sun.tracing.Provider;
|
import com.sun.tracing.Provider;
|
||||||
@ -65,13 +64,7 @@ public class MultiplexProviderFactory extends ProviderFactory {
|
|||||||
providers.add(factory.createProvider(cls));
|
providers.add(factory.createProvider(cls));
|
||||||
}
|
}
|
||||||
MultiplexProvider provider = new MultiplexProvider(cls, providers);
|
MultiplexProvider provider = new MultiplexProvider(cls, providers);
|
||||||
try {
|
provider.init();
|
||||||
provider.init();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Probably a permission problem (can't get declared members)
|
|
||||||
Logger.getAnonymousLogger().warning(
|
|
||||||
"Could not initialize tracing provider: " + e.getMessage());
|
|
||||||
}
|
|
||||||
return provider.newProxyInstance();
|
return provider.newProxyInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
package sun.tracing;
|
package sun.tracing;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import com.sun.tracing.ProviderFactory;
|
import com.sun.tracing.ProviderFactory;
|
||||||
import com.sun.tracing.Provider;
|
import com.sun.tracing.Provider;
|
||||||
@ -53,13 +52,7 @@ public class NullProviderFactory extends ProviderFactory {
|
|||||||
*/
|
*/
|
||||||
public <T extends Provider> T createProvider(Class<T> cls) {
|
public <T extends Provider> T createProvider(Class<T> cls) {
|
||||||
NullProvider provider = new NullProvider(cls);
|
NullProvider provider = new NullProvider(cls);
|
||||||
try {
|
provider.init();
|
||||||
provider.init();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Probably a permission problem (can't get declared members)
|
|
||||||
Logger.getAnonymousLogger().warning(
|
|
||||||
"Could not initialize tracing provider: " + e.getMessage());
|
|
||||||
}
|
|
||||||
return provider.newProxyInstance();
|
return provider.newProxyInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ package sun.tracing;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import com.sun.tracing.ProviderFactory;
|
import com.sun.tracing.ProviderFactory;
|
||||||
import com.sun.tracing.Provider;
|
import com.sun.tracing.Provider;
|
||||||
@ -54,13 +53,7 @@ public class PrintStreamProviderFactory extends ProviderFactory {
|
|||||||
|
|
||||||
public <T extends Provider> T createProvider(Class<T> cls) {
|
public <T extends Provider> T createProvider(Class<T> cls) {
|
||||||
PrintStreamProvider provider = new PrintStreamProvider(cls, stream);
|
PrintStreamProvider provider = new PrintStreamProvider(cls, stream);
|
||||||
try {
|
provider.init();
|
||||||
provider.init();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Probably a permission problem (can't get declared members)
|
|
||||||
Logger.getAnonymousLogger().warning(
|
|
||||||
"Could not initialize tracing provider: " + e.getMessage());
|
|
||||||
}
|
|
||||||
return provider.newProxyInstance();
|
return provider.newProxyInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.AnnotatedElement;
|
import java.lang.reflect.AnnotatedElement;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
|
|
||||||
import com.sun.tracing.Provider;
|
import com.sun.tracing.Provider;
|
||||||
import com.sun.tracing.Probe;
|
import com.sun.tracing.Probe;
|
||||||
@ -99,7 +101,13 @@ public abstract class ProviderSkeleton implements InvocationHandler, Provider {
|
|||||||
* It is up to the factory implementations to call this after construction.
|
* It is up to the factory implementations to call this after construction.
|
||||||
*/
|
*/
|
||||||
public void init() {
|
public void init() {
|
||||||
for (Method m : providerType.getDeclaredMethods()) {
|
Method[] methods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
|
||||||
|
public Method[] run() {
|
||||||
|
return providerType.getDeclaredMethods();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (Method m : methods) {
|
||||||
if ( m.getReturnType() != Void.TYPE ) {
|
if ( m.getReturnType() != Void.TYPE ) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Return value of method is not void");
|
"Return value of method is not void");
|
||||||
|
@ -29,7 +29,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.security.Permission;
|
import java.security.Permission;
|
||||||
|
|
||||||
import com.sun.tracing.ProviderFactory;
|
import com.sun.tracing.ProviderFactory;
|
||||||
@ -80,15 +79,8 @@ public final class DTraceProviderFactory extends ProviderFactory {
|
|||||||
DTraceProvider jsdt = new DTraceProvider(cls);
|
DTraceProvider jsdt = new DTraceProvider(cls);
|
||||||
T proxy = jsdt.newProxyInstance();
|
T proxy = jsdt.newProxyInstance();
|
||||||
jsdt.setProxy(proxy);
|
jsdt.setProxy(proxy);
|
||||||
try {
|
jsdt.init();
|
||||||
jsdt.init();
|
new Activation(jsdt.getModuleName(), new DTraceProvider[] { jsdt });
|
||||||
new Activation(jsdt.getModuleName(), new DTraceProvider[] { jsdt });
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Probably a permission problem (can't get declared members)
|
|
||||||
Logger.getAnonymousLogger().warning(
|
|
||||||
"Could not initialize tracing provider: " + e.getMessage());
|
|
||||||
jsdt.dispose();
|
|
||||||
}
|
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,9 +337,11 @@ clean:
|
|||||||
# jtreg tests
|
# jtreg tests
|
||||||
|
|
||||||
# Expect JT_HOME to be set for jtreg tests. (home for jtreg)
|
# Expect JT_HOME to be set for jtreg tests. (home for jtreg)
|
||||||
JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
|
ifndef JT_HOME
|
||||||
ifdef JPRT_JTREG_HOME
|
JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
|
||||||
JT_HOME = $(JPRT_JTREG_HOME)
|
ifdef JPRT_JTREG_HOME
|
||||||
|
JT_HOME = $(JPRT_JTREG_HOME)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Expect JPRT to set TESTDIRS to the jtreg test dirs
|
# Expect JPRT to set TESTDIRS to the jtreg test dirs
|
||||||
@ -361,21 +363,22 @@ endif
|
|||||||
|
|
||||||
# Some tests annoy me and fail frequently
|
# Some tests annoy me and fail frequently
|
||||||
PROBLEM_LIST=ProblemList.txt
|
PROBLEM_LIST=ProblemList.txt
|
||||||
|
PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST))
|
||||||
EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt
|
EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt
|
||||||
|
|
||||||
# Create exclude list for this platform and arch
|
# Create exclude list for this platform and arch
|
||||||
ifdef NO_EXCLUDES
|
ifdef NO_EXCLUDES
|
||||||
$(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS)
|
$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
|
||||||
@$(ECHO) "NOTHING_EXCLUDED" > $@
|
@$(ECHO) "NOTHING_EXCLUDED" > $@
|
||||||
else
|
else
|
||||||
$(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS)
|
$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
|
||||||
@$(RM) $@ $@.temp1 $@.temp2
|
@$(RM) $@ $@.temp1 $@.temp2
|
||||||
@( ( $(EGREP) -- '$(OS_NAME)-all' $< ) ;\
|
@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\
|
||||||
( $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)' $< ) ;\
|
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)' ) ;\
|
||||||
( $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)' $< ) ;\
|
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
|
||||||
( $(EGREP) -- 'generic-$(OS_ARCH)' $< ) ;\
|
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)' ) ;\
|
||||||
( $(EGREP) -- 'generic-all' $< ) ;\
|
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all' ) ;\
|
||||||
( $(ECHO) "#") ;\
|
($(ECHO) "#") ;\
|
||||||
) | $(SED) -e 's@^[\ ]*@@' \
|
) | $(SED) -e 's@^[\ ]*@@' \
|
||||||
| $(EGREP) -v '^#' > $@.temp1
|
| $(EGREP) -v '^#' > $@.temp1
|
||||||
@for tdir in $(TESTDIRS) ; do \
|
@for tdir in $(TESTDIRS) ; do \
|
||||||
@ -386,14 +389,18 @@ $(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS)
|
|||||||
@$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items"
|
@$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Select list of directories that exist
|
||||||
|
define TestDirs
|
||||||
|
$(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
|
||||||
|
endef
|
||||||
# Running batches of tests with or without samevm
|
# Running batches of tests with or without samevm
|
||||||
define RunSamevmBatch
|
define RunSamevmBatch
|
||||||
$(ECHO) "Running tests in samevm mode: $?"
|
$(ECHO) "Running tests in samevm mode: $(call TestDirs, $?)"
|
||||||
$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests
|
$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests
|
||||||
endef
|
endef
|
||||||
define RunOthervmBatch
|
define RunOthervmBatch
|
||||||
$(ECHO) "Running tests in othervm mode: $?"
|
$(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)"
|
||||||
$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
|
$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
|
||||||
endef
|
endef
|
||||||
define SummaryInfo
|
define SummaryInfo
|
||||||
$(ECHO) "Summary for: $?"
|
$(ECHO) "Summary for: $?"
|
||||||
@ -428,6 +435,9 @@ JDK_ALL_TARGETS += jdk_beans3
|
|||||||
jdk_beans3: java/beans/XMLEncoder
|
jdk_beans3: java/beans/XMLEncoder
|
||||||
$(call RunOthervmBatch)
|
$(call RunOthervmBatch)
|
||||||
|
|
||||||
|
jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
|
||||||
|
@$(SummaryInfo)
|
||||||
|
|
||||||
# Stable samevm testruns (minus items from PROBLEM_LIST)
|
# Stable samevm testruns (minus items from PROBLEM_LIST)
|
||||||
JDK_ALL_TARGETS += jdk_io
|
JDK_ALL_TARGETS += jdk_io
|
||||||
jdk_io: java/io
|
jdk_io: java/io
|
||||||
@ -450,6 +460,9 @@ JDK_ALL_TARGETS += jdk_management2
|
|||||||
jdk_management2: com/sun/jmx com/sun/management sun/management
|
jdk_management2: com/sun/jmx com/sun/management sun/management
|
||||||
$(call RunOthervmBatch)
|
$(call RunOthervmBatch)
|
||||||
|
|
||||||
|
jdk_management: jdk_management1 jdk_management2
|
||||||
|
@$(SummaryInfo)
|
||||||
|
|
||||||
# Stable samevm testruns (minus items from PROBLEM_LIST)
|
# Stable samevm testruns (minus items from PROBLEM_LIST)
|
||||||
JDK_ALL_TARGETS += jdk_math
|
JDK_ALL_TARGETS += jdk_math
|
||||||
jdk_math: java/math
|
jdk_math: java/math
|
||||||
@ -482,6 +495,9 @@ JDK_ALL_TARGETS += jdk_nio3
|
|||||||
jdk_nio3: com/sun/nio sun/nio
|
jdk_nio3: com/sun/nio sun/nio
|
||||||
$(call RunOthervmBatch)
|
$(call RunOthervmBatch)
|
||||||
|
|
||||||
|
jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3
|
||||||
|
@$(SummaryInfo)
|
||||||
|
|
||||||
# Stable othervm testruns (minus items from PROBLEM_LIST)
|
# Stable othervm testruns (minus items from PROBLEM_LIST)
|
||||||
# Using samevm has serious problems with these tests
|
# Using samevm has serious problems with these tests
|
||||||
JDK_ALL_TARGETS += jdk_rmi
|
JDK_ALL_TARGETS += jdk_rmi
|
||||||
@ -502,6 +518,9 @@ JDK_ALL_TARGETS += jdk_security3
|
|||||||
jdk_security3: com/sun/security lib/security javax/security sun/security
|
jdk_security3: com/sun/security lib/security javax/security sun/security
|
||||||
$(call RunOthervmBatch)
|
$(call RunOthervmBatch)
|
||||||
|
|
||||||
|
jdk_security: jdk_security1 jdk_security2 jdk_security3
|
||||||
|
@$(SummaryInfo)
|
||||||
|
|
||||||
# Stable othervm testruns (minus items from PROBLEM_LIST)
|
# Stable othervm testruns (minus items from PROBLEM_LIST)
|
||||||
# Using samevm has problems, and doesn't help performance as much as others.
|
# Using samevm has problems, and doesn't help performance as much as others.
|
||||||
JDK_ALL_TARGETS += jdk_swing
|
JDK_ALL_TARGETS += jdk_swing
|
||||||
@ -522,6 +541,9 @@ JDK_ALL_TARGETS += jdk_tools2
|
|||||||
jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
|
jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
|
||||||
$(call RunOthervmBatch)
|
$(call RunOthervmBatch)
|
||||||
|
|
||||||
|
jdk_tools: jdk_tools1 jdk_tools2
|
||||||
|
@$(SummaryInfo)
|
||||||
|
|
||||||
# Stable samevm testruns (minus items from PROBLEM_LIST)
|
# Stable samevm testruns (minus items from PROBLEM_LIST)
|
||||||
JDK_ALL_TARGETS += jdk_util
|
JDK_ALL_TARGETS += jdk_util
|
||||||
jdk_util: java/util sun/util
|
jdk_util: java/util sun/util
|
||||||
|
@ -344,6 +344,9 @@ java/io/StreamTokenizer/Comment.java generic-all
|
|||||||
# Some of these tests (like java/lang/management) may just need to be marked
|
# Some of these tests (like java/lang/management) may just need to be marked
|
||||||
# othervm, but that is partially speculation.
|
# othervm, but that is partially speculation.
|
||||||
|
|
||||||
|
# Samevm failure on OpenSolaris, security manager?
|
||||||
|
java/lang/ClassLoader/UninitializedParent.java generic-all
|
||||||
|
|
||||||
# Times out on solaris 10 sparc
|
# Times out on solaris 10 sparc
|
||||||
java/lang/ClassLoader/Assert.java generic-all
|
java/lang/ClassLoader/Assert.java generic-all
|
||||||
|
|
||||||
@ -538,6 +541,18 @@ javax/imageio/plugins/jpeg/ReadAsGrayTest.java generic-all
|
|||||||
# Missing close on file wbmp*, windows samevm
|
# Missing close on file wbmp*, windows samevm
|
||||||
javax/imageio/plugins/wbmp/CanDecodeTest.java generic-all
|
javax/imageio/plugins/wbmp/CanDecodeTest.java generic-all
|
||||||
|
|
||||||
|
# Failures on OpenSolaris, cannot read input files? samevm issues?
|
||||||
|
javax/imageio/metadata/BooleanAttributes.java generic-all
|
||||||
|
javax/imageio/plugins/bmp/BMPSubsamplingTest.java generic-all
|
||||||
|
javax/imageio/plugins/bmp/TopDownTest.java generic-all
|
||||||
|
javax/imageio/plugins/gif/EncodeSubImageTest.java generic-all
|
||||||
|
javax/imageio/plugins/gif/GifTransparencyTest.java generic-all
|
||||||
|
javax/imageio/plugins/png/GrayPngTest.java generic-all
|
||||||
|
javax/imageio/plugins/png/ItxtUtf8Test.java generic-all
|
||||||
|
javax/imageio/plugins/png/MergeStdCommentTest.java generic-all
|
||||||
|
javax/imageio/plugins/png/ShortHistogramTest.java generic-all
|
||||||
|
javax/imageio/plugins/shared/BitDepth.java generic-all
|
||||||
|
|
||||||
# Exclude all javax/print tests, even if they passed, they may need samevm work
|
# Exclude all javax/print tests, even if they passed, they may need samevm work
|
||||||
|
|
||||||
# Times out on solaris-sparc, sparcv9, x64 -server, some on i586 -client
|
# Times out on solaris-sparc, sparcv9, x64 -server, some on i586 -client
|
||||||
@ -1117,9 +1132,6 @@ sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
|
|||||||
# Unexpected Monitor Exception, solaris sparc -client
|
# Unexpected Monitor Exception, solaris sparc -client
|
||||||
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh generic-all
|
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh generic-all
|
||||||
|
|
||||||
# Probably should be samevm, but seem to cause errors even in othervm at times
|
|
||||||
sun/tools/jhat/HatHeapDump1Test.java generic-all
|
|
||||||
|
|
||||||
# Problems on windows, jmap.exe hangs? (these run jmap)
|
# Problems on windows, jmap.exe hangs? (these run jmap)
|
||||||
sun/tools/jmap/Basic.sh windows-all
|
sun/tools/jmap/Basic.sh windows-all
|
||||||
|
|
||||||
@ -1129,9 +1141,6 @@ sun/tools/jstatd/jstatdDefaults.sh solaris-all
|
|||||||
# Solaris sparcv9, jps output does not match, x64 different
|
# Solaris sparcv9, jps output does not match, x64 different
|
||||||
sun/tools/jstatd/jstatdExternalRegistry.sh solaris-all
|
sun/tools/jstatd/jstatdExternalRegistry.sh solaris-all
|
||||||
|
|
||||||
# Probably should be samevm, but seem to cause errors even in othervm at times
|
|
||||||
sun/tools/native2ascii/NativeErrors.java generic-all
|
|
||||||
|
|
||||||
# Solaris 10 sparc 32bit -client, java.lang.AssertionError: Some tests failed
|
# Solaris 10 sparc 32bit -client, java.lang.AssertionError: Some tests failed
|
||||||
tools/jar/JarEntryTime.java generic-all
|
tools/jar/JarEntryTime.java generic-all
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved.
|
# Copyright 2002-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
|
||||||
@ -194,7 +194,7 @@ findPid()
|
|||||||
# Return 0 if $1 is the pid of a running process.
|
# Return 0 if $1 is the pid of a running process.
|
||||||
if [ -z "$isWin98" ] ; then
|
if [ -z "$isWin98" ] ; then
|
||||||
if [ "$osname" = SunOS ] ; then
|
if [ "$osname" = SunOS ] ; then
|
||||||
#Solaris and OpenSolaris use pgrep and not ps in psCmd
|
# Solaris and OpenSolaris use pgrep and not ps in psCmd
|
||||||
findPidCmd="$psCmd"
|
findPidCmd="$psCmd"
|
||||||
else
|
else
|
||||||
# Never use plain 'ps', which requires a "controlling terminal"
|
# Never use plain 'ps', which requires a "controlling terminal"
|
||||||
@ -298,15 +298,15 @@ EOF
|
|||||||
# On linux, core files take a long time, and can leave
|
# On linux, core files take a long time, and can leave
|
||||||
# zombie processes
|
# zombie processes
|
||||||
if [ "$osname" = SunOS ] ; then
|
if [ "$osname" = SunOS ] ; then
|
||||||
#Experiments show Solaris '/usr/ucb/ps -axwww' and
|
# Experiments show Solaris '/usr/ucb/ps -axwww' and
|
||||||
#'/usr/bin/pgrep -f -l' provide the same small amount of the
|
# '/usr/bin/pgrep -f -l' provide the same small amount of the
|
||||||
#argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
|
# argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
|
||||||
# 1) This seems to have been working OK in ShellScaffold.
|
# 1) This seems to have been working OK in ShellScaffold.
|
||||||
# 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
|
# 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
|
||||||
# instead
|
# instead
|
||||||
#The alternative would be to use /usr/bin/pargs [pid] to get
|
# The alternative would be to use /usr/bin/pargs [pid] to get
|
||||||
#all the args for a process, splice them back into one
|
# all the args for a process, splice them back into one
|
||||||
#long string, then grep.
|
# long string, then grep.
|
||||||
UU=`/usr/xpg4/bin/id -u -n`
|
UU=`/usr/xpg4/bin/id -u -n`
|
||||||
psCmd="pgrep -f -l -U $UU"
|
psCmd="pgrep -f -l -U $UU"
|
||||||
else
|
else
|
||||||
@ -519,7 +519,7 @@ cmd()
|
|||||||
# if jdb got a cont cmd that caused the debuggee
|
# if jdb got a cont cmd that caused the debuggee
|
||||||
# to run to completion, jdb can be gone before
|
# to run to completion, jdb can be gone before
|
||||||
# we get here.
|
# we get here.
|
||||||
echo quit >& 2
|
echo "--Sending cmd: quit" >& 2
|
||||||
echo quit
|
echo quit
|
||||||
# See 6562090. Maybe there is a way that the exit
|
# See 6562090. Maybe there is a way that the exit
|
||||||
# can cause jdb to not get the quit.
|
# can cause jdb to not get the quit.
|
||||||
@ -531,7 +531,7 @@ cmd()
|
|||||||
# because after starting jdb, we waited
|
# because after starting jdb, we waited
|
||||||
# for the prompt.
|
# for the prompt.
|
||||||
fileSize=`wc -c $jdbOutFile | awk '{ print $1 }'`
|
fileSize=`wc -c $jdbOutFile | awk '{ print $1 }'`
|
||||||
echo $* >&2
|
echo "--Sending cmd: " $* >&2
|
||||||
|
|
||||||
# jjh: We have a few intermittent failures here.
|
# jjh: We have a few intermittent failures here.
|
||||||
# It is as if every so often, jdb doesn't
|
# It is as if every so often, jdb doesn't
|
||||||
@ -558,12 +558,85 @@ cmd()
|
|||||||
# seen the ].
|
# seen the ].
|
||||||
echo $*
|
echo $*
|
||||||
|
|
||||||
# wait for jdb output to appear
|
# Now we have to wait for the next jdb prompt. We wait for a pattern
|
||||||
|
# to appear in the last line of jdb output. Normally, the prompt is
|
||||||
|
#
|
||||||
|
# 1) ^main[89] @
|
||||||
|
#
|
||||||
|
# where ^ means start of line, and @ means end of file with no end of line
|
||||||
|
# and 89 is the current command counter. But we have complications e.g.,
|
||||||
|
# the following jdb output can appear:
|
||||||
|
#
|
||||||
|
# 2) a[89] = 10
|
||||||
|
#
|
||||||
|
# The above form is an array assignment and not a prompt.
|
||||||
|
#
|
||||||
|
# 3) ^main[89] main[89] ...
|
||||||
|
#
|
||||||
|
# This occurs if the next cmd is one that causes no jdb output, e.g.,
|
||||||
|
# 'trace methods'.
|
||||||
|
#
|
||||||
|
# 4) ^main[89] [main[89]] .... > @
|
||||||
|
#
|
||||||
|
# jdb prints a > as a prompt after something like a cont.
|
||||||
|
# Thus, even though the above is the last 'line' in the file, it
|
||||||
|
# isn't the next prompt we are waiting for after the cont completes.
|
||||||
|
# HOWEVER, sometimes we see this for a cont command:
|
||||||
|
#
|
||||||
|
# ^main[89] $
|
||||||
|
# <lines output for hitting a bkpt>
|
||||||
|
#
|
||||||
|
# 5) ^main[89] > @
|
||||||
|
#
|
||||||
|
# i.e., the > prompt comes out AFTER the prompt we we need to wait for.
|
||||||
|
#
|
||||||
|
# So, how do we know when the next prompt has appeared??
|
||||||
|
# 1. Search for
|
||||||
|
# main[89] $
|
||||||
|
# This will handle cases 1, 2, 3
|
||||||
|
# 2. This leaves cases 4 and 5.
|
||||||
|
#
|
||||||
|
# What if we wait for 4 more chars to appear and then search for
|
||||||
|
#
|
||||||
|
# main[89] [>]$
|
||||||
|
#
|
||||||
|
# on the last line?
|
||||||
|
#
|
||||||
|
# a. if we are currently at
|
||||||
|
#
|
||||||
|
# ^main[89] main[89] @
|
||||||
|
#
|
||||||
|
# and a 'trace methods comes in, we will wait until at least
|
||||||
|
#
|
||||||
|
# ^main[89] main[89] main@
|
||||||
|
#
|
||||||
|
# and then the search will find the new prompt when it completes.
|
||||||
|
#
|
||||||
|
# b. if we are currently at
|
||||||
|
#
|
||||||
|
# ^main[89] main[89] @
|
||||||
|
#
|
||||||
|
# and the first form of cont comes in, then we will see
|
||||||
|
#
|
||||||
|
# ^main[89] main[89] > $
|
||||||
|
# ^x@
|
||||||
|
#
|
||||||
|
# where x is the first char of the msg output when the bkpt is hit
|
||||||
|
# and we will start our search, which will find the prompt
|
||||||
|
# when it comes out after the bkpt output, with or without the
|
||||||
|
# trailing >
|
||||||
|
#
|
||||||
|
|
||||||
|
# wait for 4 new chars to appear in the jdb output
|
||||||
count=0
|
count=0
|
||||||
|
desiredFileSize=`expr $fileSize + 4`
|
||||||
msg1=`echo At start: cmd/size/waiting : $* / $fileSize / \`date\``
|
msg1=`echo At start: cmd/size/waiting : $* / $fileSize / \`date\``
|
||||||
while [ 1 = 1 ] ; do
|
while [ 1 = 1 ] ; do
|
||||||
newFileSize=`wc -c $jdbOutFile | awk '{ print $1 } '`
|
newFileSize=`wc -c $jdbOutFile | awk '{ print $1 } '`
|
||||||
if [ "$fileSize" != "$newFileSize" ] ; then
|
#echo jj: desired = $desiredFileSize, new = $newFileSize >& 2
|
||||||
|
|
||||||
|
done=`expr $newFileSize \>= $desiredFileSize`
|
||||||
|
if [ $done = 1 ] ; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
sleep ${sleep_seconds}
|
sleep ${sleep_seconds}
|
||||||
@ -573,14 +646,19 @@ cmd()
|
|||||||
echo "--DEBUG: jdb $$ didn't responded to command in $count secs: $*" >& 2
|
echo "--DEBUG: jdb $$ didn't responded to command in $count secs: $*" >& 2
|
||||||
echo "--DEBUG:" $msg1 >& 2
|
echo "--DEBUG:" $msg1 >& 2
|
||||||
echo "--DEBUG: "done size/waiting : / $newFileSize / `date` >& 2
|
echo "--DEBUG: "done size/waiting : / $newFileSize / `date` >& 2
|
||||||
$psCmd | sed -e '/com.sun.javatest/d' -e '/nsk/d' >& 2
|
echo "-- $jdbOutFile follows-------------------------------" >& 2
|
||||||
|
cat $jdbOutFile >& 2
|
||||||
|
echo "------------------------------------------" >& 2
|
||||||
|
dojstack
|
||||||
|
#$psCmd | sed -e '/com.sun.javatest/d' -e '/nsk/d' >& 2
|
||||||
if [ $count = 60 ] ; then
|
if [ $count = 60 ] ; then
|
||||||
dofail "jdb never responded to command: $*"
|
dofail "jdb never responded to command: $*"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# Note that this assumes just these chars in thread names.
|
||||||
waitForJdbMsg '^.*\[[0-9]*\] $' 1 allowExit
|
waitForJdbMsg '[a-zA-Z0-9_-][a-zA-Z0-9_-]*\[[1-9][0-9]*\] [ >]*$' \
|
||||||
|
1 allowExit
|
||||||
}
|
}
|
||||||
|
|
||||||
setBkpts()
|
setBkpts()
|
||||||
@ -596,15 +674,19 @@ setBkpts()
|
|||||||
runToBkpt()
|
runToBkpt()
|
||||||
{
|
{
|
||||||
cmd run
|
cmd run
|
||||||
|
# Don't need to do this - the above waits for the next prompt which comes out
|
||||||
|
# AFTER the Breakpoint hit message.
|
||||||
# Wait for jdb to hit the bkpt
|
# Wait for jdb to hit the bkpt
|
||||||
waitForJdbMsg "Breakpoint hit" 5
|
#waitForJdbMsg "Breakpoint hit" 5
|
||||||
}
|
}
|
||||||
|
|
||||||
contToBkpt()
|
contToBkpt()
|
||||||
{
|
{
|
||||||
cmd cont
|
cmd cont
|
||||||
|
# Don't need to do this - the above waits for the next prompt which comes out
|
||||||
|
# AFTER the Breakpoint hit message.
|
||||||
# Wait for jdb to hit the bkpt
|
# Wait for jdb to hit the bkpt
|
||||||
waitForJdbMsg "Breakpoint hit" 5
|
#waitForJdbMsg "Breakpoint hit" 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -618,7 +700,7 @@ waitForJdbMsg()
|
|||||||
nlines=$2
|
nlines=$2
|
||||||
allowExit="$3"
|
allowExit="$3"
|
||||||
myCount=0
|
myCount=0
|
||||||
timeLimit=40 # wait a max of 40 secs for a response from a jdb command
|
timeLimit=40 # wait a max of this many secs for a response from a jdb command
|
||||||
while [ 1 = 1 ] ; do
|
while [ 1 = 1 ] ; do
|
||||||
if [ -r $jdbOutFile ] ; then
|
if [ -r $jdbOutFile ] ; then
|
||||||
# Something here causes jdb to complain about Unrecognized cmd on x86.
|
# Something here causes jdb to complain about Unrecognized cmd on x86.
|
||||||
@ -654,8 +736,11 @@ waitForJdbMsg()
|
|||||||
|
|
||||||
myCount=`expr $myCount + ${sleep_seconds}`
|
myCount=`expr $myCount + ${sleep_seconds}`
|
||||||
if [ $myCount -gt $timeLimit ] ; then
|
if [ $myCount -gt $timeLimit ] ; then
|
||||||
|
echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds, looking for /$1/, in $nlines lines; exitting" >> $failFile
|
||||||
|
echo "vv jdbOutFile vvvvvvvvvvvvvvvvvvvvvvvvvvvv" >& 2
|
||||||
|
cat $jdbOutFile >& 2
|
||||||
|
echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >& 2
|
||||||
dojstack
|
dojstack
|
||||||
echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds; exitting" >> $failFile
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -865,35 +950,29 @@ grepForString()
|
|||||||
# get inserted into the string we are searching for
|
# get inserted into the string we are searching for
|
||||||
# so ignore those chars.
|
# so ignore those chars.
|
||||||
if [ -z "$3" ] ; then
|
if [ -z "$3" ] ; then
|
||||||
case "$2" in
|
theCmd=cat
|
||||||
*\>*)
|
|
||||||
# Target string contains a > so we better
|
|
||||||
# not ignore it
|
|
||||||
$grep -s "$2" $1 > $devnull 2>&1
|
|
||||||
stat=$?
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Target string does not contain a >.
|
|
||||||
# Ignore > and '> ' in the file.
|
|
||||||
cat $1 | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
|
|
||||||
stat=$?
|
|
||||||
esac
|
|
||||||
else
|
else
|
||||||
case "$2" in
|
theCmd="tail -$3"
|
||||||
*\>*)
|
|
||||||
# Target string contains a > so we better
|
|
||||||
# not ignore it
|
|
||||||
tail -$3 $1 | $grep -s "$2" > $devnull 2>&1
|
|
||||||
stat=$?
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Target string does not contain a >.
|
|
||||||
# Ignore > and '> ' in the file.
|
|
||||||
tail -$3 $1 | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
|
|
||||||
stat=$?
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
case "$2" in
|
||||||
|
*\>*)
|
||||||
|
# Target string contains a > so we better
|
||||||
|
# not ignore it
|
||||||
|
$theCmd $1 | $grep -s "$2" > $devnull 2>&1
|
||||||
|
return $?
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Target string does not contain a >.
|
||||||
|
# Ignore > and '> ' in the file.
|
||||||
|
# NOTE: if $1 does not end with a new line, piping it to sed doesn't include the
|
||||||
|
# chars on the last line. Detect this case, and add a new line.
|
||||||
|
cp $1 $1.tmp
|
||||||
|
if [ `tail -1 $1.tmp | wc -l | sed -e 's@ @@g'` = 0 ] ; then
|
||||||
|
echo >> $1.tmp
|
||||||
|
fi
|
||||||
|
$theCmd $1.tmp | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
|
||||||
|
stat=$?
|
||||||
|
rm -f $1.tmp
|
||||||
return $stat
|
return $stat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
149
jdk/test/com/sun/tracing/BasicWithSecurityMgr.java
Normal file
149
jdk/test/com/sun/tracing/BasicWithSecurityMgr.java
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 6899605
|
||||||
|
* @summary Basic unit test for tracing framework with security manager
|
||||||
|
* enabled
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.sun.tracing.*;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
@ProviderName("NamedProvider")
|
||||||
|
interface BasicProvider extends Provider {
|
||||||
|
void plainProbe();
|
||||||
|
void probeWithArgs(int a, float f, String s, Long l);
|
||||||
|
@ProbeName("namedProbe") void probeWithName();
|
||||||
|
void overloadedProbe();
|
||||||
|
void overloadedProbe(int i);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InvalidProvider extends Provider {
|
||||||
|
int nonVoidProbe();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BasicWithSecurityMgr {
|
||||||
|
|
||||||
|
public static ProviderFactory factory;
|
||||||
|
public static BasicProvider bp;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
// enable security manager
|
||||||
|
System.setSecurityManager(new SecurityManager());
|
||||||
|
|
||||||
|
factory = ProviderFactory.getDefaultFactory();
|
||||||
|
if (factory != null) {
|
||||||
|
bp = factory.createProvider(BasicProvider.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
testProviderFactory();
|
||||||
|
testProbe();
|
||||||
|
testProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void fail(String s) throws Exception {
|
||||||
|
throw new Exception(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testProviderFactory() throws Exception {
|
||||||
|
if (factory == null) {
|
||||||
|
fail("ProviderFactory.getDefaultFactory: Did not create factory");
|
||||||
|
}
|
||||||
|
if (bp == null) {
|
||||||
|
fail("ProviderFactory.createProvider: Did not create provider");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
factory.createProvider(null);
|
||||||
|
fail("ProviderFactory.createProvider: Did not throw NPE for null");
|
||||||
|
} catch (NullPointerException e) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
factory.createProvider(InvalidProvider.class);
|
||||||
|
fail("Factory.createProvider: Should error with non-void probes");
|
||||||
|
} catch (IllegalArgumentException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testProvider() throws Exception {
|
||||||
|
|
||||||
|
// These just shouldn't throw any exeptions:
|
||||||
|
bp.plainProbe();
|
||||||
|
bp.probeWithArgs(42, (float)3.14, "spam", new Long(2L));
|
||||||
|
bp.probeWithArgs(42, (float)3.14, null, null);
|
||||||
|
bp.probeWithName();
|
||||||
|
bp.overloadedProbe();
|
||||||
|
bp.overloadedProbe(42);
|
||||||
|
|
||||||
|
Method m = BasicProvider.class.getMethod("plainProbe");
|
||||||
|
Probe p = bp.getProbe(m);
|
||||||
|
if (p == null) {
|
||||||
|
fail("Provider.getProbe: Did not return probe");
|
||||||
|
}
|
||||||
|
|
||||||
|
Method m2 = BasicWithSecurityMgr.class.getMethod("testProvider");
|
||||||
|
p = bp.getProbe(m2);
|
||||||
|
if (p != null) {
|
||||||
|
fail("Provider.getProbe: Got probe with invalid spec");
|
||||||
|
}
|
||||||
|
|
||||||
|
bp.dispose();
|
||||||
|
// These just shouldn't throw any exeptions:
|
||||||
|
bp.plainProbe();
|
||||||
|
bp.probeWithArgs(42, (float)3.14, "spam", new Long(2L));
|
||||||
|
bp.probeWithArgs(42, (float)3.14, null, null);
|
||||||
|
bp.probeWithName();
|
||||||
|
bp.overloadedProbe();
|
||||||
|
bp.overloadedProbe(42);
|
||||||
|
|
||||||
|
if (bp.getProbe(m) != null) {
|
||||||
|
fail("Provider.getProbe: Should return null after dispose()");
|
||||||
|
}
|
||||||
|
|
||||||
|
bp.dispose(); // just to make sure nothing bad happens
|
||||||
|
}
|
||||||
|
|
||||||
|
static void testProbe() throws Exception {
|
||||||
|
Method m = BasicProvider.class.getMethod("plainProbe");
|
||||||
|
Probe p = bp.getProbe(m);
|
||||||
|
p.isEnabled(); // just make sure it doesn't do anything bad
|
||||||
|
p.trigger();
|
||||||
|
|
||||||
|
try {
|
||||||
|
p.trigger(0);
|
||||||
|
fail("Probe.trigger: too many arguments not caught");
|
||||||
|
} catch (IllegalArgumentException e) {}
|
||||||
|
|
||||||
|
p = bp.getProbe(BasicProvider.class.getMethod(
|
||||||
|
"probeWithArgs", int.class, float.class, String.class, Long.class));
|
||||||
|
try {
|
||||||
|
p.trigger();
|
||||||
|
fail("Probe.trigger: too few arguments not caught");
|
||||||
|
} catch (IllegalArgumentException e) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
p.trigger((float)3.14, (float)3.14, "", new Long(0L));
|
||||||
|
fail("Probe.trigger: wrong type primitive arguments not caught");
|
||||||
|
} catch (IllegalArgumentException e) {}
|
||||||
|
}
|
||||||
|
}
|
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @summary Unit test for java.net.HttpCookie
|
* @summary Unit test for java.net.HttpCookie
|
||||||
* @bug 6244040 6277796 6277801 6277808 6294071 6692802 6790677
|
* @bug 6244040 6277796 6277801 6277808 6294071 6692802 6790677 6901170
|
||||||
* @author Edward Wang
|
* @author Edward Wang
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -335,6 +335,9 @@ public class TestHttpCookie {
|
|||||||
// bug 6277801
|
// bug 6277801
|
||||||
test("set-cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT; path=\"/acme\"")
|
test("set-cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT; path=\"/acme\"")
|
||||||
.n("CUSTOMER").v("WILE_E_COYOTE").p("/").ver(0);
|
.n("CUSTOMER").v("WILE_E_COYOTE").p("/").ver(0);
|
||||||
|
|
||||||
|
// bug 6901170
|
||||||
|
test("set-cookie: CUSTOMER=WILE_E_COYOTE; version='1'").ver(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void misc() {
|
static void misc() {
|
||||||
|
@ -186,11 +186,13 @@ public class HatRun {
|
|||||||
*/
|
*/
|
||||||
int nvm_options = 0;
|
int nvm_options = 0;
|
||||||
if ( vm_options != null ) nvm_options = vm_options.length;
|
if ( vm_options != null ) nvm_options = vm_options.length;
|
||||||
String cmd[] = new String[1 + (d64?1:0) + 5 + nvm_options];
|
String cmd[] = new String[1 + (d64?1:0) + 7 + nvm_options];
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
cmd[i++] = java;
|
cmd[i++] = java;
|
||||||
|
cmd[i++] = "-cp";
|
||||||
|
cmd[i++] = cdir;
|
||||||
cmd[i++] = "-Dtest.classes=" + cdir;
|
cmd[i++] = "-Dtest.classes=" + cdir;
|
||||||
if ( d64 ) {
|
if ( d64 ) {
|
||||||
cmd[i++] = "-d64";
|
cmd[i++] = "-d64";
|
||||||
|
@ -59,15 +59,28 @@ public class NativeErrors {
|
|||||||
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||||
checkResult(in, "err.bad.arg");
|
checkResult(in, "err.bad.arg");
|
||||||
|
|
||||||
command = getComString("test123");
|
File f0 = new File(System.getProperty("test.src", "."), "test123");
|
||||||
|
String path0 = f0.getPath();
|
||||||
|
if ( f0.exists() ) {
|
||||||
|
throw new Error("Input file should not exist: " + path0);
|
||||||
|
}
|
||||||
|
|
||||||
|
command = getComString(path0);
|
||||||
p = Runtime.getRuntime().exec(command);
|
p = Runtime.getRuntime().exec(command);
|
||||||
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
in = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||||
checkResult(in, "err.cannot.read");
|
checkResult(in, "err.cannot.read");
|
||||||
|
|
||||||
File f1 = new File(System.getProperty("test.src", "."), "test1");
|
File f1 = new File(System.getProperty("test.src", "."), "test1");
|
||||||
File f2 = new File(System.getProperty("test.src", "."), "test2");
|
File f2 = File.createTempFile("test2", ".tmp");
|
||||||
String path1 = f1.getPath();
|
String path1 = f1.getPath();
|
||||||
String path2 = f2.getPath();
|
String path2 = f2.getPath();
|
||||||
|
if ( !f1.exists() ) {
|
||||||
|
throw new Error("Missing input file: " + path1);
|
||||||
|
}
|
||||||
|
if ( !f2.setWritable(false) ) {
|
||||||
|
throw new Error("Output file cannot be made read only: " + path2);
|
||||||
|
}
|
||||||
|
f2.deleteOnExit();
|
||||||
|
|
||||||
command = getComString(path1, path2);
|
command = getComString(path1, path2);
|
||||||
p = Runtime.getRuntime().exec(command);
|
p = Runtime.getRuntime().exec(command);
|
||||||
@ -80,7 +93,9 @@ public class NativeErrors {
|
|||||||
throws Exception {
|
throws Exception {
|
||||||
String errorReceived;
|
String errorReceived;
|
||||||
errorReceived = in.readLine();
|
errorReceived = in.readLine();
|
||||||
|
assert errorReceived != null : "First readline cannot be null";
|
||||||
errorExpected = rsrc.getString(errorExpected);
|
errorExpected = rsrc.getString(errorExpected);
|
||||||
|
assert errorExpected != null : "Expected message cannot be null";
|
||||||
StringBuffer error = new StringBuffer(errorExpected);
|
StringBuffer error = new StringBuffer(errorExpected);
|
||||||
int start = errorExpected.indexOf("{0}");
|
int start = errorExpected.indexOf("{0}");
|
||||||
if (start >= 0) {
|
if (start >= 0) {
|
||||||
@ -128,6 +143,7 @@ public class NativeErrors {
|
|||||||
f = new File(path);
|
f = new File(path);
|
||||||
if (!f.exists())
|
if (!f.exists())
|
||||||
throw new RuntimeException("Cannot find native2ascii at "+path);
|
throw new RuntimeException("Cannot find native2ascii at "+path);
|
||||||
|
System.out.println("Using native2ascii at "+path);
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
This file exists as a non-writable placeholder for NativeErrors.java
|
|
Loading…
x
Reference in New Issue
Block a user