Mercurial > hg > openjdk > lambda > jdk
changeset 10506:efbbcd5848cf
Merge
author | jlaskey |
---|---|
date | Mon, 01 Apr 2013 10:09:27 -0300 |
parents | e433ed08b733 (diff) 8c223a4f906a (current diff) |
children | 39ce82dad57d |
files | |
diffstat | 16 files changed, 738 insertions(+), 266 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/java/lang/AbstractStringBuilder.java Tue Mar 26 09:12:41 2013 -0300 +++ b/src/share/classes/java/lang/AbstractStringBuilder.java Mon Apr 01 10:09:27 2013 -0300 @@ -236,7 +236,7 @@ if ((index < 0) || (index >= count)) { throw new StringIndexOutOfBoundsException(index); } - return Character.codePointAt(value, index); + return Character.codePointAtImpl(value, index, count); } /** @@ -265,7 +265,7 @@ if ((i < 0) || (i >= count)) { throw new StringIndexOutOfBoundsException(index); } - return Character.codePointBefore(value, index); + return Character.codePointBeforeImpl(value, index, 0); } /** @@ -1370,32 +1370,37 @@ * @return a reference to this object. */ public AbstractStringBuilder reverse() { - boolean hasSurrogate = false; + boolean hasSurrogates = false; int n = count - 1; - for (int j = (n-1) >> 1; j >= 0; --j) { - char temp = value[j]; - char temp2 = value[n - j]; - if (!hasSurrogate) { - hasSurrogate = (temp >= Character.MIN_SURROGATE && temp <= Character.MAX_SURROGATE) - || (temp2 >= Character.MIN_SURROGATE && temp2 <= Character.MAX_SURROGATE); + for (int j = (n-1) >> 1; j >= 0; j--) { + int k = n - j; + char cj = value[j]; + char ck = value[k]; + value[j] = ck; + value[k] = cj; + if (Character.isSurrogate(cj) || + Character.isSurrogate(ck)) { + hasSurrogates = true; } - value[j] = temp2; - value[n - j] = temp; + } + if (hasSurrogates) { + reverseAllValidSurrogatePairs(); } - if (hasSurrogate) { - // Reverse back all valid surrogate pairs - for (int i = 0; i < count - 1; i++) { - char c2 = value[i]; - if (Character.isLowSurrogate(c2)) { - char c1 = value[i + 1]; - if (Character.isHighSurrogate(c1)) { - value[i++] = c1; - value[i] = c2; - } + return this; + } + + /** Outlined helper method for reverse() */ + private void reverseAllValidSurrogatePairs() { + for (int i = 0; i < count - 1; i++) { + char c2 = value[i]; + if (Character.isLowSurrogate(c2)) { + char c1 = value[i + 1]; + if (Character.isHighSurrogate(c1)) { + value[i++] = c1; + value[i] = c2; } } } - return this; } /**
--- a/src/share/classes/java/lang/Character.java Tue Mar 26 09:12:41 2013 -0300 +++ b/src/share/classes/java/lang/Character.java Mon Apr 01 10:09:27 2013 -0300 @@ -4862,13 +4862,11 @@ * @since 1.5 */ public static int codePointAt(CharSequence seq, int index) { - char c1 = seq.charAt(index++); - if (isHighSurrogate(c1)) { - if (index < seq.length()) { - char c2 = seq.charAt(index); - if (isLowSurrogate(c2)) { - return toCodePoint(c1, c2); - } + char c1 = seq.charAt(index); + if (isHighSurrogate(c1) && ++index < seq.length()) { + char c2 = seq.charAt(index); + if (isLowSurrogate(c2)) { + return toCodePoint(c1, c2); } } return c1; @@ -4931,15 +4929,13 @@ return codePointAtImpl(a, index, limit); } - // throws ArrayIndexOutofBoundsException if index out of bounds + // throws ArrayIndexOutOfBoundsException if index out of bounds static int codePointAtImpl(char[] a, int index, int limit) { - char c1 = a[index++]; - if (isHighSurrogate(c1)) { - if (index < limit) { - char c2 = a[index]; - if (isLowSurrogate(c2)) { - return toCodePoint(c1, c2); - } + char c1 = a[index]; + if (isHighSurrogate(c1) && ++index < limit) { + char c2 = a[index]; + if (isLowSurrogate(c2)) { + return toCodePoint(c1, c2); } } return c1; @@ -4968,12 +4964,10 @@ */ public static int codePointBefore(CharSequence seq, int index) { char c2 = seq.charAt(--index); - if (isLowSurrogate(c2)) { - if (index > 0) { - char c1 = seq.charAt(--index); - if (isHighSurrogate(c1)) { - return toCodePoint(c1, c2); - } + if (isLowSurrogate(c2) && index > 0) { + char c1 = seq.charAt(--index); + if (isHighSurrogate(c1)) { + return toCodePoint(c1, c2); } } return c2; @@ -5038,15 +5032,13 @@ return codePointBeforeImpl(a, index, start); } - // throws ArrayIndexOutofBoundsException if index-1 out of bounds + // throws ArrayIndexOutOfBoundsException if index-1 out of bounds static int codePointBeforeImpl(char[] a, int index, int start) { char c2 = a[--index]; - if (isLowSurrogate(c2)) { - if (index > start) { - char c1 = a[--index]; - if (isHighSurrogate(c1)) { - return toCodePoint(c1, c2); - } + if (isLowSurrogate(c2) && index > start) { + char c1 = a[--index]; + if (isHighSurrogate(c1)) { + return toCodePoint(c1, c2); } } return c2;
--- a/src/share/classes/java/util/zip/ZipOutputStream.java Tue Mar 26 09:12:41 2013 -0300 +++ b/src/share/classes/java/util/zip/ZipOutputStream.java Mon Apr 01 10:09:27 2013 -0300 @@ -43,6 +43,20 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstants { + /** + * Whether to use ZIP64 for zip files with more than 64k entries. + * Until ZIP64 support in zip implementations is ubiquitous, this + * system property allows the creation of zip files which can be + * read by legacy zip implementations which tolerate "incorrect" + * total entry count fields, such as the ones in jdk6, and even + * some in jdk7. + */ + private static final boolean inhibitZip64 = + Boolean.parseBoolean( + java.security.AccessController.doPrivileged( + new sun.security.action.GetPropertyAction( + "jdk.util.zip.inhibitZip64", "false"))); + private static class XEntry { public final ZipEntry entry; public final long offset; @@ -534,8 +548,10 @@ } int count = xentries.size(); if (count >= ZIP64_MAGICCOUNT) { - count = ZIP64_MAGICCOUNT; - hasZip64 = true; + hasZip64 |= !inhibitZip64; + if (hasZip64) { + count = ZIP64_MAGICCOUNT; + } } if (hasZip64) { long off64 = written;
--- a/src/share/classes/sun/reflect/annotation/AnnotationType.java Tue Mar 26 09:12:41 2013 -0300 +++ b/src/share/classes/sun/reflect/annotation/AnnotationType.java Mon Apr 01 10:09:27 2013 -0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,19 +45,18 @@ * types. This matches the return value that must be used for a * dynamic proxy, allowing for a simple isInstance test. */ - private final Map<String, Class<?>> memberTypes = new HashMap<String,Class<?>>(); + private final Map<String, Class<?>> memberTypes; /** * Member name -> default value mapping. */ - private final Map<String, Object> memberDefaults = - new HashMap<String, Object>(); + private final Map<String, Object> memberDefaults; /** * Member name -> Method object mapping. This (and its assoicated * accessor) are used only to generate AnnotationTypeMismatchExceptions. */ - private final Map<String, Method> members = new HashMap<String, Method>(); + private final Map<String, Method> members; /** * The retention policy for this annotation type. @@ -105,6 +104,9 @@ } }); + memberTypes = new HashMap<String,Class<?>>(methods.length+1, 1.0f); + memberDefaults = new HashMap<String, Object>(0); + members = new HashMap<String, Method>(methods.length+1, 1.0f); for (Method method : methods) { if (method.getParameterTypes().length != 0) @@ -117,8 +119,6 @@ Object defaultValue = method.getDefaultValue(); if (defaultValue != null) memberDefaults.put(name, defaultValue); - - members.put(name, method); } sun.misc.SharedSecrets.getJavaLangAccess().
--- a/src/share/classes/sun/security/tools/keytool/Main.java Tue Mar 26 09:12:41 2013 -0300 +++ b/src/share/classes/sun/security/tools/keytool/Main.java Mon Apr 01 10:09:27 2013 -0300 @@ -1832,9 +1832,9 @@ if (alias != null) { doImportKeyStoreSingle(loadSourceKeyStore(), alias); } else { - if (dest != null || srckeyPass != null || destKeyPass != null) { + if (dest != null || srckeyPass != null) { throw new Exception(rb.getString( - "if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified")); + "if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified")); } doImportKeyStoreAll(loadSourceKeyStore()); } @@ -1888,14 +1888,25 @@ // using destkeypass. If destkeypass is not provided, the destination // entry will be protected with the source entry password." // so always try to protect with destKeyPass. + char[] newPass = null; if (destKeyPass != null) { + newPass = destKeyPass; pp = new PasswordProtection(destKeyPass); } else if (objs.snd != null) { + newPass = objs.snd; pp = new PasswordProtection(objs.snd); } try { keyStore.setEntry(newAlias, entry, pp); + // Place the check so that only successful imports are blocked. + // For example, we don't block a failed SecretEntry import. + if (P12KEYSTORE.equalsIgnoreCase(storetype)) { + if (newPass != null && !Arrays.equals(newPass, storePass)) { + throw new Exception(rb.getString( + "The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.")); + } + } return 1; } catch (KeyStoreException kse) { Object[] source2 = {alias, kse.toString()};
--- a/src/share/classes/sun/security/tools/keytool/Resources.java Tue Mar 26 09:12:41 2013 -0300 +++ b/src/share/classes/sun/security/tools/keytool/Resources.java Mon Apr 01 10:09:27 2013 -0300 @@ -242,8 +242,10 @@ {"Certification.request.stored.in.file.filename.", "Certification request stored in file <{0}>"}, {"Submit.this.to.your.CA", "Submit this to your CA"}, - {"if.alias.not.specified.destalias.srckeypass.and.destkeypass.must.not.be.specified", - "if alias not specified, destalias, srckeypass, and destkeypass must not be specified"}, + {"if.alias.not.specified.destalias.and.srckeypass.must.not.be.specified", + "if alias not specified, destalias and srckeypass must not be specified"}, + {"The.destination.pkcs12.keystore.has.different.storepass.and.keypass.Please.retry.with.destkeypass.specified.", + "The destination pkcs12 keystore has different storepass and keypass. Please retry with -destkeypass specified."}, {"Certificate.stored.in.file.filename.", "Certificate stored in file <{0}>"}, {"Certificate.reply.was.installed.in.keystore",
--- a/src/share/classes/sun/util/logging/PlatformLogger.java Tue Mar 26 09:12:41 2013 -0300 +++ b/src/share/classes/sun/util/logging/PlatformLogger.java Mon Apr 01 10:09:27 2013 -0300 @@ -27,14 +27,11 @@ package sun.util.logging; import java.lang.ref.WeakReference; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; import java.security.AccessController; import java.security.PrivilegedAction; -import java.text.MessageFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -87,18 +84,51 @@ * @since 1.7 */ public class PlatformLogger { - // Same values as java.util.logging.Level for easy mapping - public static final int OFF = Integer.MAX_VALUE; - public static final int SEVERE = 1000; - public static final int WARNING = 900; - public static final int INFO = 800; - public static final int CONFIG = 700; - public static final int FINE = 500; - public static final int FINER = 400; - public static final int FINEST = 300; - public static final int ALL = Integer.MIN_VALUE; + // shortcut to PlatformLogger.Level enums + public static final Level OFF = Level.OFF; + public static final Level SEVERE = Level.SEVERE; + public static final Level WARNING = Level.WARNING; + public static final Level INFO = Level.INFO; + public static final Level CONFIG = Level.CONFIG; + public static final Level FINE = Level.FINE; + public static final Level FINER = Level.FINER; + public static final Level FINEST = Level.FINEST; + public static final Level ALL = Level.ALL; - private static final int defaultLevel = INFO; + /** + * PlatformLogger logging levels. + */ + public static enum Level { + // The name and value must match that of {@code java.util.logging.Level} objects. + ALL(Integer.MIN_VALUE), + FINEST(300), + FINER(400), + FINE(500), + CONFIG(700), + INFO(800), + WARNING(900), + SEVERE(1000), + OFF(Integer.MAX_VALUE); + + /** + * Associated java.util.logging.Level lazily initialized in + * JavaLoggerProxy's static initializer only once + * when java.util.logging is available and enabled. + * Only accessed by JavaLoggerProxy. + */ + /* java.util.logging.Level */ Object javaLevel; + + private final int value; + public int intValue() { + return value; + } + + Level(int value) { + this.value = value; + } + } + + private static final Level DEFAULT_LEVEL = INFO; private static boolean loggingEnabled; static { loggingEnabled = AccessController.doPrivileged( @@ -109,6 +139,20 @@ return (cname != null || fname != null); } }); + + // force loading of all JavaLoggerProxy (sub)classes to make JIT de-optimizations + // less probable. Don't initialize JavaLoggerProxy class since + // java.util.logging may not be enabled. + try { + Class.forName("sun.util.logging.PlatformLogger$DefaultLoggerProxy", + false, + PlatformLogger.class.getClassLoader()); + Class.forName("sun.util.logging.PlatformLogger$JavaLoggerProxy", + false, // do not invoke class initializer + PlatformLogger.class.getClassLoader()); + } catch (ClassNotFoundException ex) { + throw new InternalError(ex); + } } // Table of known loggers. Maps names to PlatformLoggers. @@ -143,27 +187,32 @@ WeakReference<PlatformLogger> ref = entry.getValue(); PlatformLogger plog = ref.get(); if (plog != null) { - plog.newJavaLogger(); + plog.redirectToJavaLoggerProxy(); } } } /** - * Creates a new JavaLogger that the platform logger uses + * Creates a new JavaLoggerProxy and redirects the platform logger to it */ - private void newJavaLogger() { - logger = new JavaLogger(logger.name, logger.effectiveLevel); + private void redirectToJavaLoggerProxy() { + DefaultLoggerProxy lp = DefaultLoggerProxy.class.cast(this.loggerProxy); + JavaLoggerProxy jlp = new JavaLoggerProxy(lp.name, lp.level); + // the order of assignments is important + this.javaLoggerProxy = jlp; // isLoggable checks javaLoggerProxy if set + this.loggerProxy = jlp; } - // logger may be replaced with a JavaLogger object - // when the logging facility is enabled - private volatile LoggerProxy logger; - + // DefaultLoggerProxy may be replaced with a JavaLoggerProxy object + // when the java.util.logging facility is enabled + private volatile LoggerProxy loggerProxy; + // javaLoggerProxy is only set when the java.util.logging facility is enabled + private volatile JavaLoggerProxy javaLoggerProxy; private PlatformLogger(String name) { if (loggingEnabled) { - this.logger = new JavaLogger(name); + this.loggerProxy = this.javaLoggerProxy = new JavaLoggerProxy(name); } else { - this.logger = new LoggerProxy(name); + this.loggerProxy = new DefaultLoggerProxy(name); } } @@ -172,204 +221,248 @@ * (i.e. its level is OFF). */ public boolean isEnabled() { - return logger.isEnabled(); + return loggerProxy.isEnabled(); } /** * Gets the name for this platform logger. */ public String getName() { - return logger.name; + return loggerProxy.name; } /** * Returns true if a message of the given level would actually * be logged by this logger. */ - public boolean isLoggable(int level) { - return logger.isLoggable(level); + public boolean isLoggable(Level level) { + // performance-sensitive method: use two monomorphic call-sites + JavaLoggerProxy jlp = javaLoggerProxy; + return jlp != null ? jlp.isLoggable(level) : loggerProxy.isLoggable(level); } /** - * Gets the current log level. Returns 0 if the current effective level - * is not set (equivalent to Logger.getLevel() returns null). + * Get the log level that has been specified for this PlatformLogger. + * The result may be null, which means that this logger's + * effective level will be inherited from its parent. + * + * This method is primarily for testing purpose and not recommended + * to be used at runtime since it does not support custom j.u.l.Level. + * + * @return this PlatformLogger's level + * + * @throw IllegalArgumentException if j.u.l.Logger is set to + * a custom j.u.l.Level when java.util.logging facility is enabled */ - public int getLevel() { - return logger.getLevel(); + public Level getLevel() { + return loggerProxy.getLevel(); } /** - * Sets the log level. + * Set the log level specifying which message levels will be + * logged by this logger. Message levels lower than this + * value will be discarded. The level value {@link #OFF} + * can be used to turn off logging. + * <p> + * If the new level is null, it means that this node should + * inherit its level from its nearest ancestor with a specific + * (non-null) level value. + * + * @param newLevel the new value for the log level (may be null) */ - public void setLevel(int newLevel) { - logger.setLevel(newLevel); + public void setLevel(Level newLevel) { + loggerProxy.setLevel(newLevel); } /** * Logs a SEVERE message. */ public void severe(String msg) { - logger.doLog(SEVERE, msg); + loggerProxy.doLog(SEVERE, msg); } public void severe(String msg, Throwable t) { - logger.doLog(SEVERE, msg, t); + loggerProxy.doLog(SEVERE, msg, t); } public void severe(String msg, Object... params) { - logger.doLog(SEVERE, msg, params); + loggerProxy.doLog(SEVERE, msg, params); } /** * Logs a WARNING message. */ public void warning(String msg) { - logger.doLog(WARNING, msg); + loggerProxy.doLog(WARNING, msg); } public void warning(String msg, Throwable t) { - logger.doLog(WARNING, msg, t); + loggerProxy.doLog(WARNING, msg, t); } public void warning(String msg, Object... params) { - logger.doLog(WARNING, msg, params); + loggerProxy.doLog(WARNING, msg, params); } /** * Logs an INFO message. */ public void info(String msg) { - logger.doLog(INFO, msg); + loggerProxy.doLog(INFO, msg); } public void info(String msg, Throwable t) { - logger.doLog(INFO, msg, t); + loggerProxy.doLog(INFO, msg, t); } public void info(String msg, Object... params) { - logger.doLog(INFO, msg, params); + loggerProxy.doLog(INFO, msg, params); } /** * Logs a CONFIG message. */ public void config(String msg) { - logger.doLog(CONFIG, msg); + loggerProxy.doLog(CONFIG, msg); } public void config(String msg, Throwable t) { - logger.doLog(CONFIG, msg, t); + loggerProxy.doLog(CONFIG, msg, t); } public void config(String msg, Object... params) { - logger.doLog(CONFIG, msg, params); + loggerProxy.doLog(CONFIG, msg, params); } /** * Logs a FINE message. */ public void fine(String msg) { - logger.doLog(FINE, msg); + loggerProxy.doLog(FINE, msg); } public void fine(String msg, Throwable t) { - logger.doLog(FINE, msg, t); + loggerProxy.doLog(FINE, msg, t); } public void fine(String msg, Object... params) { - logger.doLog(FINE, msg, params); + loggerProxy.doLog(FINE, msg, params); } /** * Logs a FINER message. */ public void finer(String msg) { - logger.doLog(FINER, msg); + loggerProxy.doLog(FINER, msg); } public void finer(String msg, Throwable t) { - logger.doLog(FINER, msg, t); + loggerProxy.doLog(FINER, msg, t); } public void finer(String msg, Object... params) { - logger.doLog(FINER, msg, params); + loggerProxy.doLog(FINER, msg, params); } /** * Logs a FINEST message. */ public void finest(String msg) { - logger.doLog(FINEST, msg); + loggerProxy.doLog(FINEST, msg); } public void finest(String msg, Throwable t) { - logger.doLog(FINEST, msg, t); + loggerProxy.doLog(FINEST, msg, t); } public void finest(String msg, Object... params) { - logger.doLog(FINEST, msg, params); + loggerProxy.doLog(FINEST, msg, params); } /** - * Default platform logging support - output messages to - * System.err - equivalent to ConsoleHandler with SimpleFormatter. + * Abstract base class for logging support, defining the API and common field. */ - static class LoggerProxy { - private static final PrintStream defaultStream = System.err; + private static abstract class LoggerProxy { + final String name; - final String name; - volatile int levelValue; - volatile int effectiveLevel = 0; // current effective level value - - LoggerProxy(String name) { - this(name, defaultLevel); + protected LoggerProxy(String name) { + this.name = name; } - LoggerProxy(String name, int level) { - this.name = name; - this.levelValue = level == 0 ? defaultLevel : level; + abstract boolean isEnabled(); + + abstract Level getLevel(); + abstract void setLevel(Level newLevel); + + abstract void doLog(Level level, String msg); + abstract void doLog(Level level, String msg, Throwable thrown); + abstract void doLog(Level level, String msg, Object... params); + + abstract boolean isLoggable(Level level); + } + + + private static final class DefaultLoggerProxy extends LoggerProxy { + /** + * Default platform logging support - output messages to System.err - + * equivalent to ConsoleHandler with SimpleFormatter. + */ + private static PrintStream outputStream() { + return System.err; + } + + volatile Level effectiveLevel; // effective level (never null) + volatile Level level; // current level set for this node (may be null) + + DefaultLoggerProxy(String name) { + super(name); + this.effectiveLevel = deriveEffectiveLevel(null); + this.level = null; } boolean isEnabled() { - return levelValue != OFF; + return effectiveLevel != OFF; } - int getLevel() { - return effectiveLevel; + Level getLevel() { + return level; } - void setLevel(int newLevel) { - levelValue = newLevel; - effectiveLevel = newLevel; + void setLevel(Level newLevel) { + Level oldLevel = level; + if (oldLevel != newLevel) { + level = newLevel; + effectiveLevel = deriveEffectiveLevel(newLevel); + } } - void doLog(int level, String msg) { - if (level < levelValue || levelValue == OFF) { - return; + void doLog(Level level, String msg) { + if (isLoggable(level)) { + outputStream().print(format(level, msg, null)); } - defaultStream.print(format(level, msg, null)); } - void doLog(int level, String msg, Throwable thrown) { - if (level < levelValue || levelValue == OFF) { - return; + void doLog(Level level, String msg, Throwable thrown) { + if (isLoggable(level)) { + outputStream().print(format(level, msg, thrown)); } - defaultStream.print(format(level, msg, thrown)); } - void doLog(int level, String msg, Object... params) { - if (level < levelValue || levelValue == OFF) { - return; + void doLog(Level level, String msg, Object... params) { + if (isLoggable(level)) { + String newMsg = formatMessage(msg, params); + outputStream().print(format(level, newMsg, null)); } - String newMsg = formatMessage(msg, params); - defaultStream.print(format(level, newMsg, null)); } - public boolean isLoggable(int level) { - if (level < levelValue || levelValue == OFF) { - return false; - } - return true; + boolean isLoggable(Level level) { + Level effectiveLevel = this.effectiveLevel; + return level.intValue() >= effectiveLevel.intValue() && effectiveLevel != OFF; + } + + // derive effective level (could do inheritance search like j.u.l.Logger) + private Level deriveEffectiveLevel(Level level) { + return level == null ? DEFAULT_LEVEL : level; } // Copied from java.util.logging.Formatter.formatMessage @@ -401,7 +494,7 @@ // minimize memory allocation private Date date = new Date(); - private synchronized String format(int level, String msg, Throwable thrown) { + private synchronized String format(Level level, String msg, Throwable thrown) { date.setTime(System.currentTimeMillis()); String throwable = ""; if (thrown != null) { @@ -417,7 +510,7 @@ date, getCallerInfo(), name, - PlatformLogger.getLevelName(level), + level.name(), msg, throwable); } @@ -464,58 +557,41 @@ } /** - * JavaLogger forwards all the calls to its corresponding + * JavaLoggerProxy forwards all the calls to its corresponding * java.util.logging.Logger object. */ - static class JavaLogger extends LoggerProxy { - private static final Map<Integer, Object> levelObjects = - new HashMap<>(); - + private static final class JavaLoggerProxy extends LoggerProxy { + // initialize javaLevel fields for mapping from Level enum -> j.u.l.Level object static { - if (LoggingSupport.isAvailable()) { - // initialize the map to Level objects - getLevelObjects(); - } - } - - private static void getLevelObjects() { - // get all java.util.logging.Level objects - int[] levelArray = new int[] {OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL}; - for (int l : levelArray) { - Object level = LoggingSupport.parseLevel(getLevelName(l)); - levelObjects.put(l, level); + for (Level level : Level.values()) { + level.javaLevel = LoggingSupport.parseLevel(level.name()); } } - private final Object javaLogger; - JavaLogger(String name) { - this(name, 0); + private final /* java.util.logging.Logger */ Object javaLogger; + + JavaLoggerProxy(String name) { + this(name, null); } - JavaLogger(String name, int level) { - super(name, level); + JavaLoggerProxy(String name, Level level) { + super(name); this.javaLogger = LoggingSupport.getLogger(name); - if (level != 0) { + if (level != null) { // level has been updated and so set the Logger's level - LoggingSupport.setLevel(javaLogger, levelObjects.get(level)); + LoggingSupport.setLevel(javaLogger, level.javaLevel); } } - /** - * Let Logger.log() do the filtering since if the level of a - * platform logger is altered directly from - * java.util.logging.Logger.setLevel(), the levelValue will - * not be updated. - */ - void doLog(int level, String msg) { - LoggingSupport.log(javaLogger, levelObjects.get(level), msg); + void doLog(Level level, String msg) { + LoggingSupport.log(javaLogger, level.javaLevel, msg); } - void doLog(int level, String msg, Throwable t) { - LoggingSupport.log(javaLogger, levelObjects.get(level), msg, t); + void doLog(Level level, String msg, Throwable t) { + LoggingSupport.log(javaLogger, level.javaLevel, msg, t); } - void doLog(int level, String msg, Object... params) { + void doLog(Level level, String msg, Object... params) { if (!isLoggable(level)) { return; } @@ -526,49 +602,32 @@ for (int i = 0; i < len; i++) { sparams [i] = String.valueOf(params[i]); } - LoggingSupport.log(javaLogger, levelObjects.get(level), msg, sparams); + LoggingSupport.log(javaLogger, level.javaLevel, msg, sparams); } boolean isEnabled() { - Object level = LoggingSupport.getLevel(javaLogger); - return level == null || level.equals(levelObjects.get(OFF)) == false; - } - - int getLevel() { - Object level = LoggingSupport.getLevel(javaLogger); - if (level != null) { - for (Map.Entry<Integer, Object> l : levelObjects.entrySet()) { - if (level == l.getValue()) { - return l.getKey(); - } - } - } - return 0; - } - - void setLevel(int newLevel) { - levelValue = newLevel; - LoggingSupport.setLevel(javaLogger, levelObjects.get(newLevel)); + return LoggingSupport.isLoggable(javaLogger, Level.OFF.javaLevel); } - public boolean isLoggable(int level) { - return LoggingSupport.isLoggable(javaLogger, levelObjects.get(level)); + /** + * Returns the PlatformLogger.Level mapped from j.u.l.Level + * set in the logger. + * @throw IllegalArgumentException if j.u.l.Logger is set to + * a custom j.u.l.Level + */ + Level getLevel() { + Object javaLevel = LoggingSupport.getLevel(javaLogger); + return javaLevel == null + ? null + : Level.valueOf(LoggingSupport.getLevelName(javaLevel)); + } + + void setLevel(Level level) { + LoggingSupport.setLevel(javaLogger, level == null ? null : level.javaLevel); + } + + boolean isLoggable(Level level) { + return LoggingSupport.isLoggable(javaLogger, level.javaLevel); } } - - private static String getLevelName(int level) { - switch (level) { - case OFF : return "OFF"; - case SEVERE : return "SEVERE"; - case WARNING : return "WARNING"; - case INFO : return "INFO"; - case CONFIG : return "CONFIG"; - case FINE : return "FINE"; - case FINER : return "FINER"; - case FINEST : return "FINEST"; - case ALL : return "ALL"; - default : return "UNKNOWN"; - } - } - }
--- a/src/solaris/native/java/io/io_util_md.c Tue Mar 26 09:12:41 2013 -0300 +++ b/src/solaris/native/java/io/io_util_md.c Mon Apr 01 10:09:27 2013 -0300 @@ -200,12 +200,8 @@ return 0; } - if (size >= current) { - *pbytes = size - current; - return 1; - } else { - return 0; - } + *pbytes = size - current; + return 1; } jint
--- a/test/ProblemList.txt Tue Mar 26 09:12:41 2013 -0300 +++ b/test/ProblemList.txt Mon Apr 01 10:09:27 2013 -0300 @@ -339,23 +339,6 @@ # 8007410 tools/launcher/FXLauncherTest.java linux-all -# 8004172 -sun/tools/jstat/jstatGcCapacityOutput1.sh generic-all -sun/tools/jstat/jstatGcCauseOutput1.sh generic-all -sun/tools/jstat/jstatGcOldOutput1.sh generic-all -sun/tools/jstat/jstatGcOutput1.sh generic-all -sun/tools/jstat/jstatGcPermCapacityOutput1.sh generic-all -sun/tools/jstat/jstatLineCounts1.sh generic-all -sun/tools/jstat/jstatLineCounts2.sh generic-all -sun/tools/jstat/jstatLineCounts3.sh generic-all -sun/tools/jstat/jstatLineCounts4.sh generic-all -sun/tools/jstat/jstatOptions1.sh generic-all -sun/tools/jstat/jstatTimeStamp1.sh generic-all -sun/tools/jstatd/jstatdExternalRegistry.sh generic-all -sun/tools/jstatd/jstatdDefaults.sh generic-all -sun/tools/jstatd/jstatdPort.sh generic-all -sun/tools/jstatd/jstatdServerName.sh generic-all - ############################################################################ # jdk_jdi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/io/FileInputStream/NegativeAvailable.java Mon Apr 01 10:09:27 2013 -0300 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8010837 + * @summary Test if available returns correct value when skipping beyond + * the end of a file. + * @author Dan Xu + */ + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; + +public class NegativeAvailable { + + public static void main(String[] args) throws IOException { + final int SIZE = 10; + final int SKIP = 5; + + // Create a temporary file with size of 10 bytes. + Path tmp = Files.createTempFile(null, null); + try (BufferedWriter writer = + Files.newBufferedWriter(tmp, Charset.defaultCharset())) { + for (int i = 0; i < SIZE; i++) { + writer.write('1'); + } + } + + File tempFile = tmp.toFile(); + try (FileInputStream fis = new FileInputStream(tempFile)) { + if (tempFile.length() != SIZE) { + throw new RuntimeException("unexpected file size = " + + tempFile.length()); + } + long space = skipBytes(fis, SKIP, SIZE); + space = skipBytes(fis, SKIP, space); + space = skipBytes(fis, SKIP, space); + space = skipBytes(fis, SKIP, space); + } + Files.deleteIfExists(tmp); + } + + /** + * Skip toSkip number of bytes and return the remaining bytes of the file. + */ + private static long skipBytes(FileInputStream fis, int toSkip, long space) + throws IOException { + long skip = fis.skip(toSkip); + if (skip != toSkip) { + throw new RuntimeException("skip() returns " + skip + + " but expected " + toSkip); + } + long remaining = space - toSkip; + int avail = fis.available(); + if (avail != remaining) { + throw new RuntimeException("available() returns " + avail + + " but expected " + remaining); + } + + System.out.println("Skipped " + skip + " bytes " + + " available() returns " + avail); + return remaining; + } +}
--- a/test/java/lang/StringBuilder/Supplementary.java Tue Mar 26 09:12:41 2013 -0300 +++ b/test/java/lang/StringBuilder/Supplementary.java Mon Apr 01 10:09:27 2013 -0300 @@ -37,6 +37,7 @@ test4(); // Test for appendCodePoint(int codePoint) test5(); // Test for codePointCount(int beginIndex, int endIndex) test6(); // Test for offsetByCodePoints(int index, int offset) + testDontReadOutOfBoundsTrailingSurrogate(); } /* Text strings which are used as input data. @@ -305,6 +306,19 @@ } } + static void testDontReadOutOfBoundsTrailingSurrogate() { + StringBuilder sb = new StringBuilder(); + int suppl = Character.MIN_SUPPLEMENTARY_CODE_POINT; + sb.appendCodePoint(suppl); + check(sb.codePointAt(0) != (int) suppl, + "codePointAt(0)", sb.codePointAt(0), suppl); + check(sb.length() != 2, "sb.length()"); + sb.setLength(1); + check(sb.length() != 1, "sb.length()"); + check(sb.codePointAt(0) != Character.highSurrogate(suppl), + "codePointAt(0)", + sb.codePointAt(0), Character.highSurrogate(suppl)); + } static final boolean At = true, Before = false;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/java/util/zip/EntryCount64k.java Mon Apr 01 10:09:27 2013 -0300 @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2013 Google 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @summary Test java.util.zip behavior with ~64k entries + * @run main/othervm EntryCount64k + * @run main/othervm -Djdk.util.zip.inhibitZip64=true EntryCount64k + * @run main/othervm -Djdk.util.zip.inhibitZip64=false EntryCount64k + */ + +import java.io.*; +import java.util.*; +import java.util.zip.*; + +public class EntryCount64k { + + public static void main(String[] args) throws Exception { + for (int i = (1 << 16) - 2; i < (1 << 16) + 2; i++) + test(i); + } + + static void test(int entryCount) throws Exception { + File zipFile = new File("EntryCount64k-tmp.zip"); + zipFile.delete(); + + try (ZipOutputStream zos = + new ZipOutputStream( + new BufferedOutputStream( + new FileOutputStream(zipFile)))) { + for (int i = 0; i < entryCount; i++) { + ZipEntry e = new ZipEntry(Integer.toString(i)); + zos.putNextEntry(e); + zos.closeEntry(); + } + } + + String p = System.getProperty("jdk.util.zip.inhibitZip64"); + boolean tooManyEntries = entryCount >= (1 << 16) - 1; + boolean shouldUseZip64 = tooManyEntries & !("true".equals(p)); + boolean usesZip64 = usesZip64(zipFile); + String details = String.format + ("entryCount=%d shouldUseZip64=%s usesZip64=%s zipSize=%d%n", + entryCount, shouldUseZip64, usesZip64, zipFile.length()); + System.err.println(details); + checkCanRead(zipFile, entryCount); + if (shouldUseZip64 != usesZip64) + throw new Error(details); + zipFile.delete(); + } + + static boolean usesZip64(File zipFile) throws Exception { + RandomAccessFile raf = new RandomAccessFile(zipFile, "r"); + byte[] buf = new byte[4096]; + raf.seek(raf.length() - buf.length); + raf.read(buf); + for (int i = 0; i < buf.length - 4; i++) { + // Look for ZIP64 End Header Signature + // Phil Katz: yes, we will always remember you + if (buf[i+0] == 'P' && + buf[i+1] == 'K' && + buf[i+2] == 6 && + buf[i+3] == 6) + return true; + } + return false; + } + + static void checkCanRead(File zipFile, int entryCount) throws Exception { + // Check ZipInputStream API + try (ZipInputStream zis = + new ZipInputStream( + new BufferedInputStream( + new FileInputStream(zipFile)))) { + for (int i = 0; i < entryCount; i++) { + ZipEntry e = zis.getNextEntry(); + if (Integer.parseInt(e.getName()) != i) + throw new AssertionError(); + } + if (zis.getNextEntry() != null) + throw new AssertionError(); + } + + // Check ZipFile API + try (ZipFile zf = new ZipFile(zipFile)) { + Enumeration<? extends ZipEntry> en = zf.entries(); + for (int i = 0; i < entryCount; i++) { + ZipEntry e = en.nextElement(); + if (Integer.parseInt(e.getName()) != i) + throw new AssertionError(); + } + if (en.hasMoreElements() + || (zf.size() != entryCount) + || (zf.getEntry(Integer.toString(entryCount - 1)) == null) + || (zf.getEntry(Integer.toString(entryCount)) != null)) + throw new AssertionError(); + } + } +}
--- a/test/javax/script/GetInterfaceTest.java Tue Mar 26 09:12:41 2013 -0300 +++ b/test/javax/script/GetInterfaceTest.java Mon Apr 01 10:09:27 2013 -0300 @@ -22,7 +22,6 @@ */ /* - * @run ignore * @test * @bug 6960211 * @summary JavaScript engine allows creation of interface although methods not available. @@ -49,30 +48,30 @@ } // now define "run" - engine.eval("function run() { println('this is run function'); }"); + engine.eval("function run() { print('this is run function'); }"); runnable = ((Invocable)engine).getInterface(Runnable.class); // should not return null now! runnable.run(); // define only one method of "Foo2" - engine.eval("function bar() { println('bar function'); }"); + engine.eval("function bar() { print('bar function'); }"); Foo2 foo2 = ((Invocable)engine).getInterface(Foo2.class); if (foo2 != null) { throw new RuntimeException("foo2 is not null!"); } // now define other method of "Foo2" - engine.eval("function bar2() { println('bar2 function'); }"); + engine.eval("function bar2() { print('bar2 function'); }"); foo2 = ((Invocable)engine).getInterface(Foo2.class); foo2.bar(); foo2.bar2(); } - interface Foo { + public interface Foo { public void bar(); } - interface Foo2 extends Foo { + public interface Foo2 extends Foo { public void bar2(); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/sun/security/tools/keytool/p12importks.sh Mon Apr 01 10:09:27 2013 -0300 @@ -0,0 +1,118 @@ +# +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# @test +# @bug 8010125 +# @summary keytool -importkeystore could create a pkcs12 keystore with +# different storepass and keypass +# + +if [ "${TESTJAVA}" = "" ] ; then + JAVAC_CMD=`which javac` + TESTJAVA=`dirname $JAVAC_CMD`/.. +fi + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + Windows_* ) + FS="\\" + ;; + * ) + FS="/" + ;; +esac + +LANG=C +KT=$TESTJAVA${FS}bin${FS}keytool + +# Part 1: JKS keystore with same storepass and keypass + +rm jks 2> /dev/null +$KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \ + -storepass pass1111 -keypass pass1111 || exit 11 + +# Cannot only change storepass +rm p12 2> /dev/null +$KT -importkeystore -noprompt \ + -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \ + -srcstorepass pass1111 \ + -deststorepass pass2222 \ + && exit 12 + +# You can keep storepass unchanged +rm p12 2> /dev/null +$KT -importkeystore -noprompt \ + -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \ + -srcstorepass pass1111 \ + -deststorepass pass1111 \ + || exit 13 +$KT -certreq -storetype pkcs12 -keystore p12 -alias me \ + -storepass pass1111 -keypass pass1111 || exit 14 + +# Or change storepass and keypass both +rm p12 2> /dev/null +$KT -importkeystore -noprompt \ + -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \ + -srcstorepass pass1111 \ + -deststorepass pass2222 -destkeypass pass2222 \ + || exit 15 +$KT -certreq -storetype pkcs12 -keystore p12 -alias me \ + -storepass pass2222 -keypass pass2222 || exit 16 + +# Part 2: JKS keystore with different storepass and keypass +# Must import by alias (-srckeypass is not available when importing all) + +rm jks 2> /dev/null +$KT -genkeypair -keystore jks -storetype jks -alias me -dname CN=Me \ + -storepass pass1111 -keypass pass2222 || exit 21 + +# Can use old keypass as new storepass so new storepass and keypass are same +rm p12 2> /dev/null +$KT -importkeystore -noprompt -srcalias me \ + -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \ + -srcstorepass pass1111 -srckeypass pass2222 \ + -deststorepass pass2222 \ + || exit 22 +$KT -certreq -storetype pkcs12 -keystore p12 -alias me \ + -storepass pass2222 -keypass pass2222 || exit 23 + +# Or specify both storepass and keypass to brand new ones +rm p12 2> /dev/null +$KT -importkeystore -noprompt -srcalias me \ + -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \ + -srcstorepass pass1111 -srckeypass pass2222 \ + -deststorepass pass3333 -destkeypass pass3333 \ + || exit 24 +$KT -certreq -storetype pkcs12 -keystore p12 -alias me \ + -storepass pass3333 -keypass pass3333 || exit 25 + +# Anyway you cannot make new storepass and keypass different +rm p12 2> /dev/null +$KT -importkeystore -noprompt -srcalias me \ + -srcstoretype jks -srckeystore jks -destkeystore p12 -deststoretype pkcs12 \ + -srcstorepass pass1111 -srckeypass pass2222 \ + -deststorepass pass1111 \ + && exit 26 + +exit 0
--- a/test/sun/util/logging/PlatformLoggerTest.java Tue Mar 26 09:12:41 2013 -0300 +++ b/test/sun/util/logging/PlatformLoggerTest.java Mon Apr 01 10:09:27 2013 -0300 @@ -23,7 +23,7 @@ /* * @test - * @bug 6882376 6985460 + * @bug 6882376 6985460 8010309 * @summary Test if java.util.logging.Logger is created before and after * logging is enabled. Also validate some basic PlatformLogger * operations. othervm mode to make sure java.util.logging @@ -33,11 +33,11 @@ * @run main/othervm PlatformLoggerTest */ +import java.lang.reflect.Field; import java.util.logging.*; import sun.util.logging.PlatformLogger; public class PlatformLoggerTest { - private static final int defaultEffectiveLevel = 0; public static void main(String[] args) throws Exception { final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo"; final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar"; @@ -72,6 +72,7 @@ foo.setLevel(PlatformLogger.SEVERE); checkLogger(FOO_PLATFORM_LOGGER, Level.SEVERE); + checkPlatformLoggerLevels(foo, bar); } private static void checkPlatformLogger(PlatformLogger logger, String name) { @@ -80,9 +81,9 @@ logger.getName() + " but expected " + name); } - if (logger.getLevel() != defaultEffectiveLevel) { + if (logger.getLevel() != null) { throw new RuntimeException("Invalid default level for logger " + - logger.getName()); + logger.getName() + ": " + logger.getLevel()); } if (logger.isLoggable(PlatformLogger.FINE) != false) { @@ -91,7 +92,7 @@ } logger.setLevel(PlatformLogger.FINER); - if (logger.getLevel() != Level.FINER.intValue()) { + if (logger.getLevel() != PlatformLogger.FINER) { throw new RuntimeException("Invalid level for logger " + logger.getName() + " " + logger.getLevel()); } @@ -125,6 +126,73 @@ logger.info("Test info(String)"); } + private static void checkPlatformLoggerLevels(PlatformLogger... loggers) { + final Level[] levels = new Level[] { + Level.ALL, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, + Level.INFO, Level.OFF, Level.SEVERE, Level.WARNING + }; + + int count = PlatformLogger.Level.values().length; + if (levels.length != count) { + throw new RuntimeException("There are " + count + + " PlatformLogger.Level members, but " + levels.length + + " standard java.util.logging levels - the numbers should be equal."); + } + // check mappings + for (Level level : levels) { + checkPlatformLoggerLevelMapping(level); + } + + for (Level level : levels) { + PlatformLogger.Level platformLevel = PlatformLogger.Level.valueOf(level.getName()); + for (PlatformLogger logger : loggers) { + // verify PlatformLogger.setLevel to a given level + logger.setLevel(platformLevel); + PlatformLogger.Level retrievedPlatformLevel = logger.getLevel(); + if (platformLevel != retrievedPlatformLevel) { + throw new RuntimeException("Retrieved PlatformLogger level " + + retrievedPlatformLevel + + " is not the same as set level " + platformLevel); + } + + // check the level set in java.util.logging.Logger + Logger javaLogger = LogManager.getLogManager().getLogger(logger.getName()); + Level javaLevel = javaLogger.getLevel(); + if (javaLogger.getLevel() != level) { + throw new RuntimeException("Retrieved backing java.util.logging.Logger level " + + javaLevel + " is not the expected " + level); + } + } + } + } + + private static void checkPlatformLoggerLevelMapping(Level level) { + // map the given level to PlatformLogger.Level of the same name and value + PlatformLogger.Level platformLevel = PlatformLogger.Level.valueOf(level.getName()); + if (platformLevel.intValue() != level.intValue()) { + throw new RuntimeException("Mismatched level: " + level + + " PlatformLogger.Level" + platformLevel); + } + + PlatformLogger.Level plevel; + try { + // validate if there is a public static final field in PlatformLogger + // matching the level name + Field platformLevelField = PlatformLogger.class.getField(level.getName()); + plevel = (PlatformLogger.Level) platformLevelField.get(null); + } catch (Exception e) { + throw new RuntimeException("No public static PlatformLogger." + level.getName() + + " field", e); + } + if (!plevel.name().equals(level.getName())) + throw new RuntimeException("The value of PlatformLogger." + level.getName() + ".name() is " + + platformLevel.name() + " but expected " + level.getName()); + + if (plevel.intValue() != level.intValue()) + throw new RuntimeException("The value of PlatformLogger." + level.intValue() + ".intValue() is " + + platformLevel.intValue() + " but expected " + level.intValue()); + } + static Point[] getPoints() { Point[] res = new Point[3]; res[0] = new Point(0,0);
--- a/test/vm/verifier/TestStaticIF.java Tue Mar 26 09:12:41 2013 -0300 +++ b/test/vm/verifier/TestStaticIF.java Mon Apr 01 10:09:27 2013 -0300 @@ -26,7 +26,7 @@ * @test * @bug 8007736 * @summary Test static interface method. - * @run main/othervm -Xverify:all -XX:-UseSplitVerifier TestStaticIF + * @run main/othervm -Xverify:all TestStaticIF */ public class TestStaticIF implements StaticMethodInInterface {