提交 bd12513e 编写于 作者: L lana

Merge

...@@ -320,6 +320,7 @@ override LIBCXX = -lstdc++ ...@@ -320,6 +320,7 @@ override LIBCXX = -lstdc++
endif endif
override LIBPOSIX4 = override LIBPOSIX4 =
override LIBSOCKET = override LIBSOCKET =
override LIBNSL =
override LIBTHREAD = override LIBTHREAD =
override MOOT_PRIORITIES = true override MOOT_PRIORITIES = true
override NO_INTERRUPTIBLE_IO = true override NO_INTERRUPTIBLE_IO = true
......
...@@ -645,6 +645,9 @@ LIBM = /usr/lib$(ISA_DIR)/libm.so.2 ...@@ -645,6 +645,9 @@ LIBM = /usr/lib$(ISA_DIR)/libm.so.2
# Socket library # Socket library
LIBSOCKET = -lsocket LIBSOCKET = -lsocket
# Network Services library
LIBNSL = -lnsl
# GLOBAL_KPIC: If set means all libraries are PIC, position independent code # GLOBAL_KPIC: If set means all libraries are PIC, position independent code
# EXCEPT for select compiles # EXCEPT for select compiles
# If a .o file is compiled non-PIC then it should be forced # If a .o file is compiled non-PIC then it should be forced
......
...@@ -54,6 +54,13 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \ ...@@ -54,6 +54,13 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
# This is a stopgap until 6839872 is fixed. # This is a stopgap until 6839872 is fixed.
EXCLUDE_PROPWARN_PKGS += sun.dyn EXCLUDE_PROPWARN_PKGS += sun.dyn
#
# Include the exported private packages in ct.sym.
# This is an interim solution until the ct.sym is replaced
# with a new module system (being discussed for JDK 7).
#
EXPORTED_PRIVATE_PKGS = com.sun.servicetag
# 64-bit solaris has a few special cases. We define the variable # 64-bit solaris has a few special cases. We define the variable
# SOLARIS64 for use in this Makefile to easily test those cases # SOLARIS64 for use in this Makefile to easily test those cases
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
...@@ -982,7 +989,7 @@ initial-image-jdk:: initial-image-jdk-setup \ ...@@ -982,7 +989,7 @@ initial-image-jdk:: initial-image-jdk-setup \
-processor com.sun.tools.javac.sym.CreateSymbols \ -processor com.sun.tools.javac.sym.CreateSymbols \
-Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \ -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
-Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \ -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
$(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
$(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \ $(BOOT_JAR_CMD) c0f $(LIBDIR)/ct.sym \
-C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS) -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
@$(java-vm-cleanup) @$(java-vm-cleanup)
......
...@@ -35,9 +35,6 @@ ifndef JDK_MAKE_SHARED_DIR ...@@ -35,9 +35,6 @@ ifndef JDK_MAKE_SHARED_DIR
JDK_MAKE_SHARED_DIR = $(JDK_TOPDIR)/make/common/shared JDK_MAKE_SHARED_DIR = $(JDK_TOPDIR)/make/common/shared
endif endif
ifndef CONTROL_TOPDIR
CONTROL_TOPDIR=$(TOPDIR)
endif
ifndef HOTSPOT_TOPDIR ifndef HOTSPOT_TOPDIR
HOTSPOT_TOPDIR=$(TOPDIR)/hotspot HOTSPOT_TOPDIR=$(TOPDIR)/hotspot
endif endif
......
...@@ -234,6 +234,7 @@ CORE_PKGS = \ ...@@ -234,6 +234,7 @@ CORE_PKGS = \
javax.xml.ws.http \ javax.xml.ws.http \
javax.xml.ws.soap \ javax.xml.ws.soap \
javax.xml.ws.spi \ javax.xml.ws.spi \
javax.xml.ws.spi.http \
javax.xml.ws.wsaddressing \ javax.xml.ws.wsaddressing \
javax.xml.transform \ javax.xml.transform \
javax.xml.transform.sax \ javax.xml.transform.sax \
......
...@@ -86,5 +86,5 @@ endif ...@@ -86,5 +86,5 @@ endif
# Things that must be linked in. # Things that must be linked in.
# #
ifneq ($(PLATFORM), windows) ifneq ($(PLATFORM), windows)
OTHER_LDLIBS += $(LIBSOCKET) -lnsl $(LIBM) -ldl OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) $(LIBM) -ldl
endif endif
...@@ -204,7 +204,7 @@ ifeq ($(PLATFORM),windows) ...@@ -204,7 +204,7 @@ ifeq ($(PLATFORM),windows)
OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \ OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \
-libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib
else else
OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) -lnsl -ldl \ OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) -ldl \
-L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH) -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
endif endif
......
...@@ -84,7 +84,7 @@ OTHER_INCLUDES = -I$(SRCDIR) \ ...@@ -84,7 +84,7 @@ OTHER_INCLUDES = -I$(SRCDIR) \
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
OTHER_LDLIBS += wsock32.lib winmm.lib OTHER_LDLIBS += wsock32.lib winmm.lib
else else
OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl
endif endif
# #
......
...@@ -96,7 +96,7 @@ include $(BUILDDIR)/common/Library.gmk ...@@ -96,7 +96,7 @@ include $(BUILDDIR)/common/Library.gmk
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
OTHER_LDLIBS = ws2_32.lib $(JVMLIB) OTHER_LDLIBS = ws2_32.lib $(JVMLIB)
else else
OTHER_LDLIBS = $(LIBSOCKET) -lnsl -ldl $(JVMLIB) OTHER_LDLIBS = $(LIBSOCKET) $(LIBNSL) -ldl $(JVMLIB)
endif endif
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
OTHER_LDLIBS += -lpthread OTHER_LDLIBS += -lpthread
......
...@@ -38,11 +38,11 @@ FILES_m = mapfile-vers ...@@ -38,11 +38,11 @@ FILES_m = mapfile-vers
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
OTHER_LDLIBS += -lnsl $(LIBSOCKET) -lpthread OTHER_LDLIBS += $(LIBNSL) $(LIBSOCKET) -lpthread
endif endif
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
OTHER_LDLIBS += -lnsl $(LIBSOCKET) OTHER_LDLIBS += $(LIBNSL) $(LIBSOCKET)
endif endif
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
......
...@@ -39,10 +39,10 @@ ifeq ($(PLATFORM), windows) ...@@ -39,10 +39,10 @@ ifeq ($(PLATFORM), windows)
EXTRA_LIBS += wsock32.lib winmm.lib EXTRA_LIBS += wsock32.lib winmm.lib
endif endif
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl
endif endif
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl -lpthread OTHER_LDLIBS += $(LIBSOCKET) $(LIBNSL) -ldl -lpthread
endif endif
# #
......
...@@ -204,8 +204,8 @@ Provided NetBeans projects ...@@ -204,8 +204,8 @@ Provided NetBeans projects
note that pretty much regardless of your hardware, this *will* take note that pretty much regardless of your hardware, this *will* take
a long time, and use *lots* of disk space (more than 3GB). The a long time, and use *lots* of disk space (more than 3GB). The
results of the build are in results of the build are in
*install-dir*/control/build/*platform*-*arch* and *install-dir*/build/*platform*-*arch* and
*install-dir*/control/build/*platform*-*arch*-fastdebug. *install-dir*/build/*platform*-*arch*-fastdebug.
Consult the project's README file for details. Consult the project's README file for details.
......
...@@ -10,6 +10,6 @@ project code, you might prefer to build it from the command line using ant. ...@@ -10,6 +10,6 @@ project code, you might prefer to build it from the command line using ant.
Please note: the results of building this project are *not* put in the place Please note: the results of building this project are *not* put in the place
used by other projects. In this case, the results are place in used by other projects. In this case, the results are place in
<install-dir>/control/build/<platform>-<arch> <install-dir>/build/<platform>-<arch>
and and
<install-dir>/control/build/<platform>-<arch>-fastdebug <install-dir>/build/<platform>-<arch>-fastdebug
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
<import file="../common/shared.xml"/> <import file="../common/shared.xml"/>
<target name="-build-make" depends="-make.init" if="use.make"> <target name="-build-make" depends="-make.init" if="use.make">
<make-run target="dev" dir="${root}/../control/make" opts="SKIP_COMPARE_IMAGES=true"/> <make-run target="dev" dir="${root}/.." opts="SKIP_COMPARE_IMAGES=true"/>
</target> </target>
<target name="-clean-make" depends="-make.init" if="use.make"> <target name="-clean-make" depends="-make.init" if="use.make">
<make-run target="clean" dir="${root}/../control/make"/> <make-run target="clean" dir="${root}/.."/>
</target> </target>
</project> </project>
...@@ -37,7 +37,7 @@ PRODUCT = sun ...@@ -37,7 +37,7 @@ PRODUCT = sun
# This re-directs all the class files to a separate location # This re-directs all the class files to a separate location
CLASSDESTDIR = $(TEMPDIR)/classes CLASSDESTDIR = $(TEMPDIR)/classes
OTHER_JAVACFLAGS += -Xlint:serial -Werror OTHER_JAVACFLAGS += -Xlint:serial,-deprecation -Werror
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
# #
......
...@@ -52,5 +52,11 @@ build: copy-files ...@@ -52,5 +52,11 @@ build: copy-files
copy-files: $(FILES_copy) copy-files: $(FILES_copy)
$(SERVICEDIR)/%: $(SHARE_SRC)/classes/sun/java2d/pisces/META-INF/services/% ifneq ($(PLATFORM), windows)
SERVICE_SRC = $(PLATFORM_SRC)
else
SERVICE_SRC = $(SHARE_SRC)
endif
$(SERVICEDIR)/%: $(SERVICE_SRC)/classes/sun/java2d/pisces/META-INF/services/%
$(install-file) $(install-file)
...@@ -49,7 +49,8 @@ AUTO_FILES_JAVA_DIRS = \ ...@@ -49,7 +49,8 @@ AUTO_FILES_JAVA_DIRS = \
# Extra jstat files # Extra jstat files
FILES_copy += \ FILES_copy += \
$(CLASSDESTDIR)/sun/tools/jstat/resources/jstat_options $(CLASSDESTDIR)/sun/tools/jstat/resources/jstat_options \
$(CLASSDESTDIR)/sun/tools/jstat/resources/jstat_unsupported_options
# Extra jhat files # Extra jhat files
JHAT_RESOURCEDIR = $(CLASSDESTDIR)/com/sun/tools/hat/resources JHAT_RESOURCEDIR = $(CLASSDESTDIR)/com/sun/tools/hat/resources
......
...@@ -424,7 +424,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI { ...@@ -424,7 +424,7 @@ public class WindowsComboBoxUI extends BasicComboBoxUI {
State rv; State rv;
rv = super.getState(); rv = super.getState();
if (rv != State.DISABLED if (rv != State.DISABLED
&& ! comboBox.isEditable() && comboBox != null && ! comboBox.isEditable()
&& XPStyle.getXP().isSkinDefined(comboBox, && XPStyle.getXP().isSkinDefined(comboBox,
Part.CP_DROPDOWNBUTTONRIGHT)) { Part.CP_DROPDOWNBUTTONRIGHT)) {
/* /*
......
/* /*
* Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2010, Oracle and/or its affiliates. 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
...@@ -47,10 +47,13 @@ interface Constants { ...@@ -47,10 +47,13 @@ interface Constants {
public final static short JAVA5_MAX_CLASS_MAJOR_VERSION = 49; public final static short JAVA5_MAX_CLASS_MAJOR_VERSION = 49;
public final static short JAVA5_MAX_CLASS_MINOR_VERSION = 0; public final static short JAVA5_MAX_CLASS_MINOR_VERSION = 0;
// NOTE: ASSUMED for now
public final static short JAVA6_MAX_CLASS_MAJOR_VERSION = 50; public final static short JAVA6_MAX_CLASS_MAJOR_VERSION = 50;
public final static short JAVA6_MAX_CLASS_MINOR_VERSION = 0; public final static short JAVA6_MAX_CLASS_MINOR_VERSION = 0;
public final static short JAVA7_MAX_CLASS_MAJOR_VERSION = 51;
public final static short JAVA7_MAX_CLASS_MINOR_VERSION = 0;
public final static int JAVA_PACKAGE_MAGIC = 0xCAFED00D; public final static int JAVA_PACKAGE_MAGIC = 0xCAFED00D;
public final static int JAVA5_PACKAGE_MAJOR_VERSION = 150; public final static int JAVA5_PACKAGE_MAJOR_VERSION = 150;
public final static int JAVA5_PACKAGE_MINOR_VERSION = 7; public final static int JAVA5_PACKAGE_MINOR_VERSION = 7;
......
/* /*
* Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2010, Oracle and/or its affiliates. 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
...@@ -57,8 +57,8 @@ class Package implements Constants { ...@@ -57,8 +57,8 @@ class Package implements Constants {
// These fields can be adjusted by driver properties. // These fields can be adjusted by driver properties.
short min_class_majver = JAVA_MIN_CLASS_MAJOR_VERSION; short min_class_majver = JAVA_MIN_CLASS_MAJOR_VERSION;
short min_class_minver = JAVA_MIN_CLASS_MINOR_VERSION; short min_class_minver = JAVA_MIN_CLASS_MINOR_VERSION;
short max_class_majver = JAVA6_MAX_CLASS_MAJOR_VERSION; short max_class_majver = JAVA7_MAX_CLASS_MAJOR_VERSION;
short max_class_minver = JAVA6_MAX_CLASS_MINOR_VERSION; short max_class_minver = JAVA7_MAX_CLASS_MINOR_VERSION;
short observed_max_class_majver = min_class_majver; short observed_max_class_majver = min_class_majver;
short observed_max_class_minver = min_class_minver; short observed_max_class_minver = min_class_minver;
...@@ -122,13 +122,16 @@ class Package implements Constants { ...@@ -122,13 +122,16 @@ class Package implements Constants {
void choosePackageVersion() { void choosePackageVersion() {
assert(package_majver <= 0); // do not call this twice assert(package_majver <= 0); // do not call this twice
int classver = getHighestClassVersion(); int classver = getHighestClassVersion();
if (classver != 0 && if (classver == 0 || (classver >>> 16) < JAVA6_MAX_CLASS_MAJOR_VERSION) {
(classver >>> 16) < JAVA6_MAX_CLASS_MAJOR_VERSION) { // There are only old classfiles in this segment or resources
// There are only old classfiles in this segment.
package_majver = JAVA5_PACKAGE_MAJOR_VERSION; package_majver = JAVA5_PACKAGE_MAJOR_VERSION;
package_minver = JAVA5_PACKAGE_MINOR_VERSION; package_minver = JAVA5_PACKAGE_MINOR_VERSION;
} else if ((classver >>> 16) == JAVA6_MAX_CLASS_MAJOR_VERSION) {
package_majver = JAVA6_PACKAGE_MAJOR_VERSION;
package_minver = JAVA6_PACKAGE_MINOR_VERSION;
} else { } else {
// Normal case. Use the newest archive format. // Normal case. Use the newest archive format, when available
// TODO: replace the following with JAVA7* when the need arises
package_majver = JAVA6_PACKAGE_MAJOR_VERSION; package_majver = JAVA6_PACKAGE_MAJOR_VERSION;
package_minver = JAVA6_PACKAGE_MINOR_VERSION; package_minver = JAVA6_PACKAGE_MINOR_VERSION;
} }
......
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003,2010 Oracle and/or its affiliates. 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
...@@ -90,8 +90,8 @@ class PropMap extends TreeMap { ...@@ -90,8 +90,8 @@ class PropMap extends TreeMap {
props.put(Utils.PACK_DEFAULT_TIMEZONE, props.put(Utils.PACK_DEFAULT_TIMEZONE,
String.valueOf(Boolean.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))); String.valueOf(Boolean.getBoolean(Utils.PACK_DEFAULT_TIMEZONE)));
// Limit segment size to less than a megabyte. // The segment size is unlimited
props.put(Pack200.Packer.SEGMENT_LIMIT, ""+(1*1000*1000)); props.put(Pack200.Packer.SEGMENT_LIMIT, "");
// Preserve file ordering by default. // Preserve file ordering by default.
props.put(Pack200.Packer.KEEP_FILE_ORDER, Pack200.Packer.TRUE); props.put(Pack200.Packer.KEEP_FILE_ORDER, Pack200.Packer.TRUE);
......
...@@ -67,7 +67,6 @@ public class Registry { ...@@ -67,7 +67,6 @@ public class Registry {
// The stclient output has to be an exported interface // The stclient output has to be an exported interface
private static final String INSTANCE_URN_DESC = "Product instance URN="; private static final String INSTANCE_URN_DESC = "Product instance URN=";
private static boolean initialized = false; private static boolean initialized = false;
private static boolean supportsHelperClass = true; // default
private static File stclient = null; private static File stclient = null;
private static String stclientPath = null; private static String stclientPath = null;
private static Registry registry = new Registry(); private static Registry registry = new Registry();
...@@ -81,17 +80,6 @@ public class Registry { ...@@ -81,17 +80,6 @@ public class Registry {
private synchronized static String getSTclient() { private synchronized static String getSTclient() {
if (!initialized) { if (!initialized) {
// the system property always overrides the default setting
if (System.getProperty(SVCTAG_STHELPER_SUPPORTED) != null) {
supportsHelperClass = Boolean.getBoolean(SVCTAG_STHELPER_SUPPORTED);
}
// This is only used for testing
stclientPath = System.getProperty(SVCTAG_STCLIENT_CMD);
if (stclientPath != null) {
return stclientPath;
}
// Initialization to determine the platform's stclient pathname // Initialization to determine the platform's stclient pathname
String os = System.getProperty("os.name"); String os = System.getProperty("os.name");
if (os.equals("SunOS")) { if (os.equals("SunOS")) {
...@@ -108,10 +96,26 @@ public class Registry { ...@@ -108,10 +96,26 @@ public class Registry {
initialized = true; initialized = true;
} }
boolean supportsHelperClass = true; // default
if (System.getProperty(SVCTAG_STHELPER_SUPPORTED) != null) {
// the system property always overrides the default setting
supportsHelperClass = Boolean.getBoolean(SVCTAG_STHELPER_SUPPORTED);
}
if (!supportsHelperClass) {
// disable system registry
return null;
}
// This is only used for testing
String path = System.getProperty(SVCTAG_STCLIENT_CMD);
if (path != null) {
return path;
}
// com.sun.servicetag package has to be compiled with JDK 5 as well // com.sun.servicetag package has to be compiled with JDK 5 as well
// JDK 5 doesn't support the File.canExecute() method. // JDK 5 doesn't support the File.canExecute() method.
// Risk not checking isExecute() for the stclient command is very low. // Risk not checking isExecute() for the stclient command is very low.
if (stclientPath == null && stclient != null && stclient.exists()) { if (stclientPath == null && stclient != null && stclient.exists()) {
stclientPath = stclient.getAbsolutePath(); stclientPath = stclient.getAbsolutePath();
} }
...@@ -142,8 +146,8 @@ public class Registry { ...@@ -142,8 +146,8 @@ public class Registry {
* @return {@code true} if the {@code Registry} class is supported; * @return {@code true} if the {@code Registry} class is supported;
* otherwise, return {@code false}. * otherwise, return {@code false}.
*/ */
public static boolean isSupported() { public static synchronized boolean isSupported() {
return (getSTclient() != null && supportsHelperClass); return getSTclient() != null;
} }
private static List<String> getCommandList() { private static List<String> getCommandList() {
......
...@@ -53,13 +53,13 @@ a:visited,a:visited code{color:#917E9C} ...@@ -53,13 +53,13 @@ a:visited,a:visited code{color:#917E9C}
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td><p class="style1">Thank you for installing the <td><p class="style1">Thank you for installing the
<strong> Java Development Kit @@JDK_VERSION@@ </strong> <strong> Java Development Kit @@JDK_VERSION@@ </strong>
from Sun Microsystems. </p> from Oracle Corporation. </p>
<p class="style1">Registering your product will give you the following benefits:</p> <p class="style1">Registering your product will give you the following benefits:</p>
<ul class="style1"> <ul class="style1">
<li> Notification of new versions, patches, and updates</li> <li> Notification of new versions, patches, and updates</li>
<li> Special offers on Sun developer products, services and training </li> <li> Special offers on Oracle developer products, services and training </li>
<li> Access to early releases and documentation </li> <li> Access to early releases and documentation </li>
</ul> </ul>
<p class="style1">Product registration is FREE, quick and easy!</p> <p class="style1">Product registration is FREE, quick and easy!</p>
...@@ -68,11 +68,11 @@ a:visited,a:visited code{color:#917E9C} ...@@ -68,11 +68,11 @@ a:visited,a:visited code{color:#917E9C}
<table width="708" border="0" cellspacing="0" cellpadding="3"> <table width="708" border="0" cellspacing="0" cellpadding="3">
<tr valign="top"> <tr valign="top">
<td width="126" height="35"> <td width="126" height="35">
<form name="form1" method="post" action="@@REGISTRATION_URL@@"> <form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
<input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@"> <input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@">
<input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';" value="Register My JDK"> <input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';" value="Register My JDK">
</form></td> </form></td>
<td width="570"><span class="style3">You need to be connected to the Internet to register this Sun product. </span></td> <td width="570"><span class="style3">You need to be connected to the Internet to register this Oracle product. </span></td>
</tr> </tr>
</table> </table>
</blockquote> </blockquote>
...@@ -81,16 +81,16 @@ a:visited,a:visited code{color:#917E9C} ...@@ -81,16 +81,16 @@ a:visited,a:visited code{color:#917E9C}
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td bgcolor="#f1f7df"> <td bgcolor="#f1f7df">
<p class="style3">Sun Microsystems, Inc. respects your privacy. <p class="style3">Oracle Corporation respects your privacy.
We will use your personal information for communications We will use your personal information for communications
and management of your Sun Online Account, the services and management of your Sun Online Account, the services
and applications you access using your Sun Online Account, and applications you access using your Sun Online Account,
and the products and systems you register with your Sun Online Account.</p> and the products and systems you register with your Sun Online Account.</p>
<p class="style3">For more information on the data that will be collected as <p class="style3">For more information on the data that will be collected as
part of the registration process and how it will be managed <br> part of the registration process and how it will be managed <br>
see <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a>. <br> see <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a>. <br>
<br> <br>
For more information on Sun's Privacy Policy see <a href="http://www.sun.com/privacy/">http://www.sun.com/privacy/</a> or contact <a class="moz-txt-link-rfc2396E" href="mailto:privacy@sun.com">privacy@sun.com.</a></p></td> For more information on Oracle's Privacy Policy see <a href="http://www.oracle.com/html/privacy.html">http://www.oracle.com/html/privacy.html</a> or contact <a class="moz-txt-link-rfc2396E" href="mailto:privacy_ww@oracle.com">privacy_ww@oracle.com.</a></p></td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
......
...@@ -50,11 +50,11 @@ a:visited,a:visited code{color:#917E9C} ...@@ -50,11 +50,11 @@ a:visited,a:visited code{color:#917E9C}
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td><p class="style1">Sun Microsystems<strong> Java Development Kit @@JDK_VERSION@@ </strong>をインストールしていただき、ありがとうございます。 </p> <td><p class="style1">Oracle Corporation<strong> Java Development Kit @@JDK_VERSION@@ </strong>をインストールしていただき、ありがとうございます。 </p>
<p class="style1">製品登録をすると、次のような特典を受けることができます。</p> <p class="style1">製品登録をすると、次のような特典を受けることができます。</p>
<ul class="style1"> <ul class="style1">
<li> 最新のバージョン、パッチ、および更新についての通知</li> <li> 最新のバージョン、パッチ、および更新についての通知</li>
<li> Sun の開発者向け製品、サービス、およびトレーニングの特別販売 </li> <li> Oracle の開発者向け製品、サービス、およびトレーニングの特別販売 </li>
<li> アーリーリリースおよびドキュメントへのアクセス </li> <li> アーリーリリースおよびドキュメントへのアクセス </li>
</ul> </ul>
<p class="style1">製品登録は無料であり、迅速で簡単です。</p> <p class="style1">製品登録は無料であり、迅速で簡単です。</p>
...@@ -62,11 +62,11 @@ a:visited,a:visited code{color:#917E9C} ...@@ -62,11 +62,11 @@ a:visited,a:visited code{color:#917E9C}
<p class="style1">必要になるのは、Sun 開発者向けネットワークアカウントまたはその他の Sun オンラインアカウントだけです。 まだアカウントがない場合は、アカウントの作成が求められます。 </p> <p class="style1">必要になるのは、Sun 開発者向けネットワークアカウントまたはその他の Sun オンラインアカウントだけです。 まだアカウントがない場合は、アカウントの作成が求められます。 </p>
<table width="708" border="0" cellspacing="0" cellpadding="3"> <table width="708" border="0" cellspacing="0" cellpadding="3">
<tr valign="top"> <tr valign="top">
<td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@"> <td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
<input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@"> <input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@">
<input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';" value="JDK 製品登録"> <input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';" value="JDK 製品登録">
</form></td> </form></td>
<td width="570"><span class="style3">この Sun 製品を登録するには、インターネットに接続している必要があります。 </span></td> <td width="570"><span class="style3">この Oracle 製品を登録するには、インターネットに接続している必要があります。 </span></td>
</tr> </tr>
</table> </table>
</blockquote> </blockquote>
...@@ -75,8 +75,8 @@ a:visited,a:visited code{color:#917E9C} ...@@ -75,8 +75,8 @@ a:visited,a:visited code{color:#917E9C}
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td bgcolor="#f1f7df"> <td bgcolor="#f1f7df">
<p class="style3">Sun Microsystems, Inc. は、お客様のプライバシーを尊重します。 お客様の個人情報は、お客様の Sun オンラインアカウント、お客様が Sun オンラインアカウントを使用してアクセスするサービスとアプリケーション、およびお客様が Sun オンラインアカウントで登録する製品とシステムの通信と管理に使用します。</p> <p class="style3">Oracle Corporation は、お客様のプライバシーを尊重します。 お客様の個人情報は、お客様の Sun オンラインアカウント、お客様が Sun オンラインアカウントを使用してアクセスするサービスとアプリケーション、およびお客様が Sun オンラインアカウントで登録する製品とシステムの通信と管理に使用します。</p>
<p class="style3">登録の際に収集されるデータや、それらがどのように管理されるかについての詳細は、<br><a href="http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html</a> を参照してください。 <br> <br> Sun のプライバシーポリシーについての詳細は、<a href="http://jp.sun.com/privacy/">http://jp.sun.com/privacy/</a> を参照するか、<a class="moz-txt-link-rfc2396E" href="http://jp.sun.com/cgi-bin/contact/comment.cgi?url=http://jp.sun.com/privacy/">お問い合わせフォーム</a>からお問い合わせください。</p></td> <p class="style3">登録の際に収集されるデータや、それらがどのように管理されるかについての詳細は、<br><a href="http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/ja/registration/JDKRegistrationPrivacy.html</a> を参照してください。 <br> <br> Oracle のプライバシーポリシーについての詳細は、<a href="http://www.oracle.com/html/privacy.html">http://www.oracle.com/html/privacy.html</a> を参照するか、<a class="moz-txt-link-rfc2396E" href="mailto:privacy_ww@oracle.com">お問い合わせフォーム</a>からお問い合わせください。</p></td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
......
...@@ -51,11 +51,11 @@ a:visited,a:visited code{color:#917E9C} ...@@ -51,11 +51,11 @@ a:visited,a:visited code{color:#917E9C}
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td><p class="style1">感谢您安装 Sun Microsystems<strong>Java Development Kit @@JDK_VERSION@@</strong></p> <td><p class="style1">感谢您安装 Oracle Corporation<strong>Java Development Kit @@JDK_VERSION@@</strong></p>
<p class="style1">注册产品后您将获得如下增值服务:</p> <p class="style1">注册产品后您将获得如下增值服务:</p>
<ul class="style1"> <ul class="style1">
<li> 获得新版本、修补程序和更新的通知服务</li> <li> 获得新版本、修补程序和更新的通知服务</li>
<li> 获得有关 Sun 开发者产品、服务和培训的优惠 </li> <li> 获得有关 Oracle 开发者产品、服务和培训的优惠 </li>
<li> 获得对早期版本和文档的访问权限 </li> <li> 获得对早期版本和文档的访问权限 </li>
</ul> </ul>
<p class="style1">产品注册是免费的,即快速又轻松!</p> <p class="style1">产品注册是免费的,即快速又轻松!</p>
...@@ -63,11 +63,11 @@ a:visited,a:visited code{color:#917E9C} ...@@ -63,11 +63,11 @@ a:visited,a:visited code{color:#917E9C}
<p class="style1">您需要具有 Sun 开发者网络或其他 Sun 联机帐户。如果您没有,系统将提示您创建一个。 </p> <p class="style1">您需要具有 Sun 开发者网络或其他 Sun 联机帐户。如果您没有,系统将提示您创建一个。 </p>
<table width="708" border="0" cellspacing="0" cellpadding="3"> <table width="708" border="0" cellspacing="0" cellpadding="3">
<tr valign="top"> <tr valign="top">
<td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@"> <td width="126" height="35"><form name="form1" method="post" action="@@REGISTRATION_URL@@" enctype="text/xml">
<input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@"> <input type="hidden" name="servicetag_payload" value="@@REGISTRATION_PAYLOAD@@">
<input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';" value="注册我的 JDK"> <input type="submit" name="Submit"border="0" class="buttonblue" onmouseover="this.style.color='#fbe249';" onmouseout="this.style.color='#FFF';" value="注册我的 JDK">
</form></td> </form></td>
<td width="570"><span class="style3">您需要连接到 Internet 来注册此 Sun 产品。 </span></td> <td width="570"><span class="style3">您需要连接到 Internet 来注册此 Oracle 产品。 </span></td>
</tr> </tr>
</table> </table>
</blockquote> </blockquote>
...@@ -76,8 +76,8 @@ a:visited,a:visited code{color:#917E9C} ...@@ -76,8 +76,8 @@ a:visited,a:visited code{color:#917E9C}
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td bgcolor="#f1f7df"> <td bgcolor="#f1f7df">
<p class="style3">Sun Microsystems, Inc. 尊重您的隐私。我们会将您的个人信息用于通信和 Sun 联机帐户的管理、Sun 联机帐户访问的服务和应用程序以及用于使用 Sun 联机帐户注册的产品和系统。</p> <p class="style3">Oracle 尊重您的隐私。我们会将您的个人信息用于通信和 Sun 联机帐户的管理、Sun 联机帐户访问的服务和应用程序以及用于使用 Sun 联机帐户注册的产品和系统。</p>
<p class="style3">有关注册过程中收集的数据以及这些数据的管理方式的更多信息,<br>请访问 <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a><br> <br>有关 Sun 隐私政策的更多信息,请访问 <a href="http://www.sun.com/privacy/">http://www.sun.com/privacy/</a> 或与 <a class="moz-txt-link-rfc2396E" href="mailto:privacy@sun.com">privacy@sun.com</a> 联系。</p></td> <p class="style3">有关注册过程中收集的数据以及这些数据的管理方式的更多信息,<br>请访问 <a href="http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html">http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html</a><br> <br>有关 Oracle 隐私政策的更多信息,请访问 <a href="http://www.oracle.com/html/privacy.html">http://www.oracle.com/html/privacy.html</a> 或与 <a class="moz-txt-link-rfc2396E" href="mailto:privacy_ww@oracle.com">privacy_ww@oracle.com</a> 联系。</p></td>
</tr> </tr>
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
......
...@@ -66,7 +66,7 @@ public class AssertionError extends Error { ...@@ -66,7 +66,7 @@ public class AssertionError extends Error {
* defined in <i>The Java Language Specification, Second * defined in <i>The Java Language Specification, Second
* Edition</i>, Section 15.18.1.1. * Edition</i>, Section 15.18.1.1.
*<p> *<p>
* If the specified object is an instance of <tt>Throwable</tt>, it * If the specified object is an instance of {@code Throwable}, it
* becomes the <i>cause</i> of the newly constructed assertion error. * becomes the <i>cause</i> of the newly constructed assertion error.
* *
* @param detailMessage value to be used in constructing detail message * @param detailMessage value to be used in constructing detail message
...@@ -149,4 +149,21 @@ public class AssertionError extends Error { ...@@ -149,4 +149,21 @@ public class AssertionError extends Error {
public AssertionError(double detailMessage) { public AssertionError(double detailMessage) {
this("" + detailMessage); this("" + detailMessage);
} }
/**
* Constructs a new {@code AssertionError} with the specified
* detail message and cause.
*
* <p>Note that the detail message associated with
* {@code cause} is <i>not</i> automatically incorporated in
* this error's detail message.
*
* @param message the detail message, may be {@code null}
* @param cause the cause, may be {@code null}
*
* @since 1.7
*/
public AssertionError(String message, Throwable cause) {
super(message, cause);
}
} }
...@@ -681,9 +681,9 @@ public final class Math { ...@@ -681,9 +681,9 @@ public final class Math {
private static Random randomNumberGenerator; private static Random randomNumberGenerator;
private static synchronized void initRNG() { private static synchronized Random initRNG() {
if (randomNumberGenerator == null) Random rnd = randomNumberGenerator;
randomNumberGenerator = new Random(); return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
} }
/** /**
...@@ -694,9 +694,11 @@ public final class Math { ...@@ -694,9 +694,11 @@ public final class Math {
* *
* <p>When this method is first called, it creates a single new * <p>When this method is first called, it creates a single new
* pseudorandom-number generator, exactly as if by the expression * pseudorandom-number generator, exactly as if by the expression
* <blockquote>{@code new java.util.Random}</blockquote> This *
* new pseudorandom-number generator is used thereafter for all * <blockquote>{@code new java.util.Random()}</blockquote>
* calls to this method and is used nowhere else. *
* This new pseudorandom-number generator is used thereafter for
* all calls to this method and is used nowhere else.
* *
* <p>This method is properly synchronized to allow correct use by * <p>This method is properly synchronized to allow correct use by
* more than one thread. However, if many threads need to generate * more than one thread. However, if many threads need to generate
...@@ -705,11 +707,12 @@ public final class Math { ...@@ -705,11 +707,12 @@ public final class Math {
* *
* @return a pseudorandom {@code double} greater than or equal * @return a pseudorandom {@code double} greater than or equal
* to {@code 0.0} and less than {@code 1.0}. * to {@code 0.0} and less than {@code 1.0}.
* @see java.util.Random#nextDouble() * @see Random#nextDouble()
*/ */
public static double random() { public static double random() {
if (randomNumberGenerator == null) initRNG(); Random rnd = randomNumberGenerator;
return randomNumberGenerator.nextDouble(); if (rnd == null) rnd = initRNG();
return rnd.nextDouble();
} }
/** /**
......
...@@ -418,6 +418,8 @@ public final class ProcessBuilder ...@@ -418,6 +418,8 @@ public final class ProcessBuilder
* Implements a <a href="#redirect-output">null input stream</a>. * Implements a <a href="#redirect-output">null input stream</a>.
*/ */
static class NullInputStream extends InputStream { static class NullInputStream extends InputStream {
static final NullInputStream INSTANCE = new NullInputStream();
private NullInputStream() {}
public int read() { return -1; } public int read() { return -1; }
public int available() { return 0; } public int available() { return 0; }
} }
...@@ -426,6 +428,8 @@ public final class ProcessBuilder ...@@ -426,6 +428,8 @@ public final class ProcessBuilder
* Implements a <a href="#redirect-input">null output stream</a>. * Implements a <a href="#redirect-input">null output stream</a>.
*/ */
static class NullOutputStream extends OutputStream { static class NullOutputStream extends OutputStream {
static final NullOutputStream INSTANCE = new NullOutputStream();
private NullOutputStream() {}
public void write(int b) throws IOException { public void write(int b) throws IOException {
throw new IOException("Stream closed"); throw new IOException("Stream closed");
} }
......
...@@ -667,9 +667,9 @@ public final class StrictMath { ...@@ -667,9 +667,9 @@ public final class StrictMath {
private static Random randomNumberGenerator; private static Random randomNumberGenerator;
private static synchronized void initRNG() { private static synchronized Random initRNG() {
if (randomNumberGenerator == null) Random rnd = randomNumberGenerator;
randomNumberGenerator = new Random(); return (rnd == null) ? (randomNumberGenerator = new Random()) : rnd;
} }
/** /**
...@@ -680,9 +680,11 @@ public final class StrictMath { ...@@ -680,9 +680,11 @@ public final class StrictMath {
* *
* <p>When this method is first called, it creates a single new * <p>When this method is first called, it creates a single new
* pseudorandom-number generator, exactly as if by the expression * pseudorandom-number generator, exactly as if by the expression
* <blockquote>{@code new java.util.Random}</blockquote> This *
* new pseudorandom-number generator is used thereafter for all * <blockquote>{@code new java.util.Random()}</blockquote>
* calls to this method and is used nowhere else. *
* This new pseudorandom-number generator is used thereafter for
* all calls to this method and is used nowhere else.
* *
* <p>This method is properly synchronized to allow correct use by * <p>This method is properly synchronized to allow correct use by
* more than one thread. However, if many threads need to generate * more than one thread. However, if many threads need to generate
...@@ -691,11 +693,12 @@ public final class StrictMath { ...@@ -691,11 +693,12 @@ public final class StrictMath {
* *
* @return a pseudorandom {@code double} greater than or equal * @return a pseudorandom {@code double} greater than or equal
* to {@code 0.0} and less than {@code 1.0}. * to {@code 0.0} and less than {@code 1.0}.
* @see java.util.Random#nextDouble() * @see Random#nextDouble()
*/ */
public static double random() { public static double random() {
if (randomNumberGenerator == null) initRNG(); Random rnd = randomNumberGenerator;
return randomNumberGenerator.nextDouble(); if (rnd == null) rnd = initRNG();
return rnd.nextDouble();
} }
/** /**
......
...@@ -678,7 +678,7 @@ public final class Security { ...@@ -678,7 +678,7 @@ public final class Security {
spiMap.put(type, clazz); spiMap.put(type, clazz);
return clazz; return clazz;
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw (Error)new AssertionError("Spi class not found").initCause(e); throw new AssertionError("Spi class not found", e);
} }
} }
......
...@@ -463,10 +463,10 @@ public class Collections { ...@@ -463,10 +463,10 @@ public class Collections {
* its list-iterator does not support the <tt>set</tt> operation. * its list-iterator does not support the <tt>set</tt> operation.
*/ */
public static void shuffle(List<?> list) { public static void shuffle(List<?> list) {
if (r == null) { Random rnd = r;
r = new Random(); if (rnd == null)
} r = rnd = new Random();
shuffle(list, r); shuffle(list, rnd);
} }
private static Random r; private static Random r;
......
...@@ -73,10 +73,10 @@ public class ThreadLocalRandom extends Random { ...@@ -73,10 +73,10 @@ public class ThreadLocalRandom extends Random {
private long rnd; private long rnd;
/** /**
* Initialization flag to permit the first and only allowed call * Initialization flag to permit calls to setSeed to succeed only
* to setSeed (inside Random constructor) to succeed. We can't * while executing the Random constructor. We can't allow others
* allow others since it would cause setting seed in one part of a * since it would cause setting seed in one part of a program to
* program to unintentionally impact other usages by the thread. * unintentionally impact other usages by the thread.
*/ */
boolean initialized; boolean initialized;
...@@ -98,11 +98,10 @@ public class ThreadLocalRandom extends Random { ...@@ -98,11 +98,10 @@ public class ThreadLocalRandom extends Random {
/** /**
* Constructor called only by localRandom.initialValue. * Constructor called only by localRandom.initialValue.
* We rely on the fact that the superclass no-arg constructor
* invokes setSeed exactly once to initialize.
*/ */
ThreadLocalRandom() { ThreadLocalRandom() {
super(); super();
initialized = true;
} }
/** /**
...@@ -123,7 +122,6 @@ public class ThreadLocalRandom extends Random { ...@@ -123,7 +122,6 @@ public class ThreadLocalRandom extends Random {
public void setSeed(long seed) { public void setSeed(long seed) {
if (initialized) if (initialized)
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
initialized = true;
rnd = (seed ^ multiplier) & mask; rnd = (seed ^ multiplier) & mask;
} }
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003,2010, Oracle and/or its affiliates. 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
...@@ -212,10 +212,18 @@ public abstract class Pack200 { ...@@ -212,10 +212,18 @@ public abstract class Pack200 {
* to produce a specific bytewise image for any given transmission * to produce a specific bytewise image for any given transmission
* ordering of archive elements.) * ordering of archive elements.)
* <p> * <p>
* In order to maintain backward compatibility, if the input JAR-files are * In order to maintain backward compatibility, the pack file's version is
* solely comprised of 1.5 (or lesser) classfiles, a 1.5 compatible * set to accommodate the class files present in the input JAR file. In
* pack file is produced. Otherwise a 1.6 compatible pack200 file is * other words, the pack file version will be the latest, if the class files
* produced. * are the latest and conversely the pack file version will be the oldest
* if the class file versions are also the oldest. For intermediate class
* file versions the corresponding pack file version will be used.
* For example:
* If the input JAR-files are solely comprised of 1.5 (or lesser)
* class files, a 1.5 compatible pack file is produced. This will also be
* the case for archives that have no class files.
* If the input JAR-files contains a 1.6 class file, then the pack file
* version will be set to 1.6.
* <p> * <p>
* @since 1.5 * @since 1.5
*/ */
...@@ -236,9 +244,10 @@ public abstract class Pack200 { ...@@ -236,9 +244,10 @@ public abstract class Pack200 {
* input file to be transmitted in the segment, along with the size * input file to be transmitted in the segment, along with the size
* of its name and other transmitted properties. * of its name and other transmitted properties.
* <p> * <p>
* The default is 1000000 (a million bytes). This allows input JAR files * The default is -1, which means the packer will always create a single
* of moderate size to be transmitted in one segment. It also puts * segment output file. In cases where extremely large output files are
* a limit on memory requirements for packers and unpackers. * generated, users are strongly encouraged to use segmenting or break
* up the input file into smaller JARs.
* <p> * <p>
* A 10Mb JAR packed without this limit will * A 10Mb JAR packed without this limit will
* typically pack about 10% smaller, but the packer may require * typically pack about 10% smaller, but the packer may require
......
/* /*
* Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2010, Oracle and/or its affiliates. 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
...@@ -26,7 +26,6 @@ package javax.swing; ...@@ -26,7 +26,6 @@ package javax.swing;
import java.awt.Color; import java.awt.Color;
import java.awt.Font; import java.awt.Font;
import javax.swing.JComponent;
import javax.swing.border.*; import javax.swing.border.*;
/** /**
...@@ -74,10 +73,20 @@ public class BorderFactory ...@@ -74,10 +73,20 @@ public class BorderFactory
return new LineBorder(color, thickness); return new LineBorder(color, thickness);
} }
// public static Border createLineBorder(Color color, int thickness, /**
// boolean drawRounded) { * Creates a line border with the specified color, thickness, and corner shape.
// return new JLineBorder(color, thickness, drawRounded); *
// } * @param color the color of the border
* @param thickness the thickness of the border
* @param rounded whether or not border corners should be round
* @return the {@code Border} object
*
* @see LineBorder#LineBorder(Color, int, boolean)
* @since 1.7
*/
public static Border createLineBorder(Color color, int thickness, boolean rounded) {
return new LineBorder(color, thickness, rounded);
}
//// BevelBorder ///////////////////////////////////////////////////////////// //// BevelBorder /////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
...@@ -180,7 +189,115 @@ public class BorderFactory ...@@ -180,7 +189,115 @@ public class BorderFactory
} }
return null; return null;
} }
//// SoftBevelBorder ///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
private static Border sharedSoftRaisedBevel;
private static Border sharedSoftLoweredBevel;
/**
* Creates a beveled border with a raised edge and softened corners,
* using brighter shades of the component's current background color
* for highlighting, and darker shading for shadows.
* In a raised border, highlights are on top and shadows are underneath.
*
* @return the {@code Border} object
*
* @since 1.7
*/
public static Border createRaisedSoftBevelBorder() {
if (sharedSoftRaisedBevel == null) {
sharedSoftRaisedBevel = new SoftBevelBorder(BevelBorder.RAISED);
}
return sharedSoftRaisedBevel;
}
/**
* Creates a beveled border with a lowered edge and softened corners,
* using brighter shades of the component's current background color
* for highlighting, and darker shading for shadows.
* In a lowered border, shadows are on top and highlights are underneath.
*
* @return the {@code Border} object
*
* @since 1.7
*/
public static Border createLoweredSoftBevelBorder() {
if (sharedSoftLoweredBevel == null) {
sharedSoftLoweredBevel = new SoftBevelBorder(BevelBorder.LOWERED);
}
return sharedSoftLoweredBevel;
}
/**
* Creates a beveled border of the specified type with softened corners,
* using brighter shades of the component's current background color
* for highlighting, and darker shading for shadows.
* The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
*
* @param type a type of a bevel
* @return the {@code Border} object or {@code null}
* if the specified type is not valid
*
* @see BevelBorder#BevelBorder(int)
* @since 1.7
*/
public static Border createSoftBevelBorder(int type) {
if (type == BevelBorder.RAISED) {
return createRaisedSoftBevelBorder();
}
if (type == BevelBorder.LOWERED) {
return createLoweredSoftBevelBorder();
}
return null;
}
/**
* Creates a beveled border of the specified type with softened corners,
* using the specified highlighting and shadowing.
* The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
* The outer edge of the highlight area uses
* a brighter shade of the {@code highlight} color.
* The inner edge of the shadow area uses
* a brighter shade of the {@code shadow} color.
*
* @param type a type of a bevel
* @param highlight a basic color of the highlight area
* @param shadow a basic color of the shadow area
* @return the {@code Border} object
*
* @see BevelBorder#BevelBorder(int, Color, Color)
* @since 1.7
*/
public static Border createSoftBevelBorder(int type, Color highlight, Color shadow) {
return new BevelBorder(type, highlight, shadow);
}
/**
* Creates a beveled border of the specified type with softened corners,
* using the specified colors for the inner and outer edges
* of the highlight and the shadow areas.
* The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
* Note: The shadow inner and outer colors are switched
* for a lowered bevel border.
*
* @param type a type of a bevel
* @param highlightOuter a color of the outer edge of the highlight area
* @param highlightInner a color of the inner edge of the highlight area
* @param shadowOuter a color of the outer edge of the shadow area
* @param shadowInner a color of the inner edge of the shadow area
* @return the {@code Border} object
*
* @see BevelBorder#BevelBorder(int, Color, Color, Color, Color)
* @since 1.7
*/
public static Border createSoftBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) {
return new BevelBorder(type, highlightOuter, highlightInner, shadowOuter, shadowInner);
}
//// EtchedBorder /////////////////////////////////////////////////////////// //// EtchedBorder ///////////////////////////////////////////////////////////
static final Border sharedEtchedBorder = new EtchedBorder(); static final Border sharedEtchedBorder = new EtchedBorder();
private static Border sharedRaisedEtchedBorder; private static Border sharedRaisedEtchedBorder;
......
...@@ -658,8 +658,7 @@ class SynthParser extends DefaultHandler { ...@@ -658,8 +658,7 @@ class SynthParser extends DefaultHandler {
} }
try { try {
_colorTypes.add((ColorType)checkCast(typeClass. _colorTypes.add((ColorType)checkCast(typeClass.
getField(typeName.substring(classIndex, getField(typeName.substring(classIndex)).
typeName.length() - classIndex)).
get(typeClass), ColorType.class)); get(typeClass), ColorType.class));
} catch (NoSuchFieldException nsfe) { } catch (NoSuchFieldException nsfe) {
throw new SAXException("Unable to find color type: " + throw new SAXException("Unable to find color type: " +
......
...@@ -363,18 +363,24 @@ public class SynthToolBarUI extends BasicToolBarUI ...@@ -363,18 +363,24 @@ public class SynthToolBarUI extends BasicToolBarUI
SynthIcon.getIconWidth(handleIcon, context) : 0; SynthIcon.getIconWidth(handleIcon, context) : 0;
Dimension compDim; Dimension compDim;
for (int i = 0; i < tb.getComponentCount(); i++) { for (int i = 0; i < tb.getComponentCount(); i++) {
compDim = tb.getComponent(i).getMinimumSize(); Component component = tb.getComponent(i);
dim.width += compDim.width; if (component.isVisible()) {
dim.height = Math.max(dim.height, compDim.height); compDim = component.getMinimumSize();
dim.width += compDim.width;
dim.height = Math.max(dim.height, compDim.height);
}
} }
} else { } else {
dim.height = tb.isFloatable() ? dim.height = tb.isFloatable() ?
SynthIcon.getIconHeight(handleIcon, context) : 0; SynthIcon.getIconHeight(handleIcon, context) : 0;
Dimension compDim; Dimension compDim;
for (int i = 0; i < tb.getComponentCount(); i++) { for (int i = 0; i < tb.getComponentCount(); i++) {
compDim = tb.getComponent(i).getMinimumSize(); Component component = tb.getComponent(i);
dim.width = Math.max(dim.width, compDim.width); if (component.isVisible()) {
dim.height += compDim.height; compDim = component.getMinimumSize();
dim.width = Math.max(dim.width, compDim.width);
dim.height += compDim.height;
}
} }
} }
dim.width += insets.left + insets.right; dim.width += insets.left + insets.right;
...@@ -395,18 +401,24 @@ public class SynthToolBarUI extends BasicToolBarUI ...@@ -395,18 +401,24 @@ public class SynthToolBarUI extends BasicToolBarUI
SynthIcon.getIconWidth(handleIcon, context) : 0; SynthIcon.getIconWidth(handleIcon, context) : 0;
Dimension compDim; Dimension compDim;
for (int i = 0; i < tb.getComponentCount(); i++) { for (int i = 0; i < tb.getComponentCount(); i++) {
compDim = tb.getComponent(i).getPreferredSize(); Component component = tb.getComponent(i);
dim.width += compDim.width; if (component.isVisible()) {
dim.height = Math.max(dim.height, compDim.height); compDim = component.getPreferredSize();
dim.width += compDim.width;
dim.height = Math.max(dim.height, compDim.height);
}
} }
} else { } else {
dim.height = tb.isFloatable() ? dim.height = tb.isFloatable() ?
SynthIcon.getIconHeight(handleIcon, context) : 0; SynthIcon.getIconHeight(handleIcon, context) : 0;
Dimension compDim; Dimension compDim;
for (int i = 0; i < tb.getComponentCount(); i++) { for (int i = 0; i < tb.getComponentCount(); i++) {
compDim = tb.getComponent(i).getPreferredSize(); Component component = tb.getComponent(i);
dim.width = Math.max(dim.width, compDim.width); if (component.isVisible()) {
dim.height += compDim.height; compDim = component.getPreferredSize();
dim.width = Math.max(dim.width, compDim.width);
dim.height += compDim.height;
}
} }
} }
dim.width += insets.left + insets.right; dim.width += insets.left + insets.right;
...@@ -469,22 +481,24 @@ public class SynthToolBarUI extends BasicToolBarUI ...@@ -469,22 +481,24 @@ public class SynthToolBarUI extends BasicToolBarUI
for (int i = 0; i < tb.getComponentCount(); i++) { for (int i = 0; i < tb.getComponentCount(); i++) {
c = tb.getComponent(i); c = tb.getComponent(i);
d = c.getPreferredSize(); if (c.isVisible()) {
int y, h; d = c.getPreferredSize();
if (d.height >= baseH || c instanceof JSeparator) { int y, h;
// Fill available height if (d.height >= baseH || c instanceof JSeparator) {
y = baseY; // Fill available height
h = baseH; y = baseY;
} else { h = baseH;
// Center component vertically in the available space } else {
y = baseY + (baseH / 2) - (d.height / 2); // Center component vertically in the available space
h = d.height; y = baseY + (baseH / 2) - (d.height / 2);
h = d.height;
}
//if the component is a "glue" component then add to its
//width the extraSpacePerGlue it is due
if (isGlue(c)) d.width += extraSpacePerGlue;
c.setBounds(ltr ? x : x - d.width, y, d.width, h);
x = ltr ? x + d.width : x - d.width;
} }
//if the component is a "glue" component then add to its
//width the extraSpacePerGlue it is due
if (isGlue(c)) d.width += extraSpacePerGlue;
c.setBounds(ltr ? x : x - d.width, y, d.width, h);
x = ltr ? x + d.width : x - d.width;
} }
} else { } else {
int handleHeight = tb.isFloatable() ? int handleHeight = tb.isFloatable() ?
...@@ -512,29 +526,31 @@ public class SynthToolBarUI extends BasicToolBarUI ...@@ -512,29 +526,31 @@ public class SynthToolBarUI extends BasicToolBarUI
for (int i = 0; i < tb.getComponentCount(); i++) { for (int i = 0; i < tb.getComponentCount(); i++) {
c = tb.getComponent(i); c = tb.getComponent(i);
d = c.getPreferredSize(); if (c.isVisible()) {
int x, w; d = c.getPreferredSize();
if (d.width >= baseW || c instanceof JSeparator) { int x, w;
// Fill available width if (d.width >= baseW || c instanceof JSeparator) {
x = baseX; // Fill available width
w = baseW; x = baseX;
} else { w = baseW;
// Center component horizontally in the available space } else {
x = baseX + (baseW / 2) - (d.width / 2); // Center component horizontally in the available space
w = d.width; x = baseX + (baseW / 2) - (d.width / 2);
w = d.width;
}
//if the component is a "glue" component then add to its
//height the extraSpacePerGlue it is due
if (isGlue(c)) d.height += extraSpacePerGlue;
c.setBounds(x, y, w, d.height);
y += d.height;
} }
//if the component is a "glue" component then add to its
//height the extraSpacePerGlue it is due
if (isGlue(c)) d.height += extraSpacePerGlue;
c.setBounds(x, y, w, d.height);
y += d.height;
} }
} }
context.dispose(); context.dispose();
} }
private boolean isGlue(Component c) { private boolean isGlue(Component c) {
if (c instanceof Box.Filler) { if (c.isVisible() && c instanceof Box.Filler) {
Box.Filler f = (Box.Filler)c; Box.Filler f = (Box.Filler)c;
Dimension min = f.getMinimumSize(); Dimension min = f.getMinimumSize();
Dimension pref = f.getPreferredSize(); Dimension pref = f.getPreferredSize();
......
...@@ -25,15 +25,12 @@ ...@@ -25,15 +25,12 @@
package javax.swing.text; package javax.swing.text;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Font; import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.font.TextAttribute; import java.awt.font.TextAttribute;
import java.lang.ref.ReferenceQueue; import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Stack; import java.util.Stack;
...@@ -41,15 +38,14 @@ import java.util.Vector; ...@@ -41,15 +38,14 @@ import java.util.Vector;
import java.util.ArrayList; import java.util.ArrayList;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
import javax.swing.Icon;
import javax.swing.event.*; import javax.swing.event.*;
import javax.swing.undo.AbstractUndoableEdit; import javax.swing.undo.AbstractUndoableEdit;
import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException; import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit; import javax.swing.undo.UndoableEdit;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import static sun.swing.SwingUtilities2.IMPLIED_CR;
/** /**
* A document that can be marked up with character and paragraph * A document that can be marked up with character and paragraph
...@@ -782,9 +778,18 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc ...@@ -782,9 +778,18 @@ public class DefaultStyledDocument extends AbstractDocument implements StyledDoc
// Check for the composed text element. If it is, merge the character attributes // Check for the composed text element. If it is, merge the character attributes
// into this element as well. // into this element as well.
if (Utilities.isComposedTextAttributeDefined(attr)) { if (Utilities.isComposedTextAttributeDefined(attr)) {
((MutableAttributeSet)attr).addAttributes(cattr); MutableAttributeSet mattr = (MutableAttributeSet) attr;
((MutableAttributeSet)attr).addAttribute(AbstractDocument.ElementNameAttribute, mattr.addAttributes(cattr);
AbstractDocument.ContentElementName); mattr.addAttribute(AbstractDocument.ElementNameAttribute,
AbstractDocument.ContentElementName);
// Assure that the composed text element is named properly
// and doesn't have the CR attribute defined.
mattr.addAttribute(StyleConstants.NameAttribute,
AbstractDocument.ContentElementName);
if (mattr.isDefined(IMPLIED_CR)) {
mattr.removeAttribute(IMPLIED_CR);
}
} }
ElementSpec[] spec = new ElementSpec[parseBuffer.size()]; ElementSpec[] spec = new ElementSpec[parseBuffer.size()];
......
...@@ -32,6 +32,7 @@ import java.util.Locale; ...@@ -32,6 +32,7 @@ import java.util.Locale;
import javax.swing.UIManager; import javax.swing.UIManager;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
import static sun.swing.SwingUtilities2.IMPLIED_CR;
/** /**
* A GlyphView is a styled chunk of text that represents a view * A GlyphView is a styled chunk of text that represents a view
...@@ -1061,7 +1062,6 @@ public class GlyphView extends View implements TabableView, Cloneable { ...@@ -1061,7 +1062,6 @@ public class GlyphView extends View implements TabableView, Cloneable {
int length; int length;
// if it is an implied newline character // if it is an implied newline character
boolean impliedCR; boolean impliedCR;
private static final String IMPLIED_CR = "CR";
boolean skipWidth; boolean skipWidth;
/** /**
......
...@@ -403,6 +403,24 @@ public class Utilities { ...@@ -403,6 +403,24 @@ public class Utilities {
return txtCount; return txtCount;
} }
/**
* Adjust text offset so that the length of a resulting string as a whole
* fits into the specified width.
*/
static int adjustOffsetForFractionalMetrics(
Segment s, FontMetrics fm, int offset, int width) {
// Sometimes the offset returned by getTabbedTextOffset is beyond the
// available area, when fractional metrics are enabled. We should
// guard against this.
if (offset < s.count) {
while (offset > 0 &&
fm.charsWidth(s.array, s.offset, offset + 1) > width) {
offset--;
}
}
return offset;
}
/** /**
* Determine where to break the given text to fit * Determine where to break the given text to fit
* within the given span. This tries to find a word boundary. * within the given span. This tries to find a word boundary.
...@@ -425,7 +443,7 @@ public class Utilities { ...@@ -425,7 +443,7 @@ public class Utilities {
int txtCount = s.count; int txtCount = s.count;
int index = Utilities.getTabbedTextOffset(s, metrics, x0, x, int index = Utilities.getTabbedTextOffset(s, metrics, x0, x,
e, startOffset, false); e, startOffset, false);
index = adjustOffsetForFractionalMetrics(s, metrics, index, x - x0);
if (index >= txtCount - 1) { if (index >= txtCount - 1) {
return txtCount; return txtCount;
......
...@@ -108,7 +108,7 @@ public class WrappedPlainView extends BoxView implements TabExpander { ...@@ -108,7 +108,7 @@ public class WrappedPlainView extends BoxView implements TabExpander {
try { try {
if (line.isLeaf()) { if (line.isLeaf()) {
drawText(line, p0, p1, g, x, y); drawText(line, p0, p1, g, x, y);
} else { } else {
// this line contains the composed text. // this line contains the composed text.
int idx = line.getElementIndex(p0); int idx = line.getElementIndex(p0);
...@@ -239,9 +239,11 @@ public class WrappedPlainView extends BoxView implements TabExpander { ...@@ -239,9 +239,11 @@ public class WrappedPlainView extends BoxView implements TabExpander {
tabBase, tabBase + currentWidth, tabBase, tabBase + currentWidth,
this, p0); this, p0);
} else { } else {
p = p0 + Utilities.getTabbedTextOffset(segment, metrics, int offset = Utilities.getTabbedTextOffset(segment, metrics,
tabBase, tabBase + currentWidth, tabBase, tabBase + currentWidth, this, p0, false);
this, p0, false); offset = Utilities.adjustOffsetForFractionalMetrics(
segment, metrics, offset, currentWidth);
p = p0 + offset;
} }
SegmentCache.releaseSharedSegment(segment); SegmentCache.releaseSharedSegment(segment);
return p; return p;
......
...@@ -24,20 +24,17 @@ ...@@ -24,20 +24,17 @@
*/ */
package javax.swing.text.html; package javax.swing.text.html;
import java.awt.Color;
import java.awt.Component;
import java.awt.font.TextAttribute; import java.awt.font.TextAttribute;
import java.util.*; import java.util.*;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.io.*; import java.io.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.*; import javax.swing.event.*;
import javax.swing.text.*; import javax.swing.text.*;
import javax.swing.undo.*; import javax.swing.undo.*;
import java.text.Bidi;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
import static sun.swing.SwingUtilities2.IMPLIED_CR;
/** /**
* A document that models HTML. The purpose of this model is to * A document that models HTML. The purpose of this model is to
...@@ -1819,7 +1816,6 @@ public class HTMLDocument extends DefaultStyledDocument { ...@@ -1819,7 +1816,6 @@ public class HTMLDocument extends DefaultStyledDocument {
static String MAP_PROPERTY = "__MAP__"; static String MAP_PROPERTY = "__MAP__";
private static char[] NEWLINE; private static char[] NEWLINE;
private static final String IMPLIED_CR = "CR";
/** /**
* I18N property key. * I18N property key.
......
...@@ -124,15 +124,15 @@ public abstract class ByteToCharISO2022 extends ByteToCharConverter ...@@ -124,15 +124,15 @@ public abstract class ByteToCharISO2022 extends ByteToCharConverter
switch(shiftFlag) { switch(shiftFlag) {
case SOFlag: case SOFlag:
tmpIndex = curSODes; tmpIndex = curSODes;
tmpConverter = (ByteToCharConverter [])SOConverter; tmpConverter = SOConverter;
break; break;
case SS2Flag: case SS2Flag:
tmpIndex = curSS2Des; tmpIndex = curSS2Des;
tmpConverter = (ByteToCharConverter [])SS2Converter; tmpConverter = SS2Converter;
break; break;
case SS3Flag: case SS3Flag:
tmpIndex = curSS3Des; tmpIndex = curSS3Des;
tmpConverter = (ByteToCharConverter [])SS3Converter; tmpConverter = SS3Converter;
break; break;
} }
......
...@@ -141,7 +141,7 @@ public class ByteToCharISO2022JP extends ByteToCharJIS0208 { ...@@ -141,7 +141,7 @@ public class ByteToCharISO2022JP extends ByteToCharJIS0208 {
} else { } else {
savedSize = 2; savedSize = 2;
savedBytes[0] = (byte)byte1; savedBytes[0] = (byte)byte1;
savedBytes[1] = (byte)input[readOff + inputSize]; savedBytes[1] = input[readOff + inputSize];
inputSize++; inputSize++;
} }
break; break;
......
...@@ -34,14 +34,12 @@ public class ByteToCharJISAutoDetect extends ByteToCharConverter { ...@@ -34,14 +34,12 @@ public class ByteToCharJISAutoDetect extends ByteToCharConverter {
private final static int SJIS1B_MASK = 0x04; private final static int SJIS1B_MASK = 0x04;
private final static int EUCJP_KANA1_MASK = 0x08; private final static int EUCJP_KANA1_MASK = 0x08;
private final static int EUCJP_KANA2_MASK = 0x10; private final static int EUCJP_KANA2_MASK = 0x10;
private static byte[] maskTable1; private final static byte[] maskTable1 = JISAutoDetect.getByteMask1();
private static byte[] maskTable2; private final static byte[] maskTable2 = JISAutoDetect.getByteMask2();
private final static int SS2 = 0x8e; private final static int SS2 = 0x8e;
private final static int SS3 = 0x8f; private final static int SS3 = 0x8f;
private final static JISAutoDetect nioCoder = new JISAutoDetect();
// SJISName is set to either "SJIS" or "MS932" // SJISName is set to either "SJIS" or "MS932"
private String SJISName; private String SJISName;
private String EUCJPName; private String EUCJPName;
...@@ -57,8 +55,6 @@ public class ByteToCharJISAutoDetect extends ByteToCharConverter { ...@@ -57,8 +55,6 @@ public class ByteToCharJISAutoDetect extends ByteToCharConverter {
defaultConv = new ByteToCharISO8859_1(); defaultConv = new ByteToCharISO8859_1();
defaultConv.subChars = subChars; defaultConv.subChars = subChars;
defaultConv.subMode = subMode; defaultConv.subMode = subMode;
maskTable1 = nioCoder.getByteMask1();
maskTable2 = nioCoder.getByteMask2();
} }
public int flush(char [] output, int outStart, int outEnd) public int flush(char [] output, int outStart, int outEnd)
...@@ -133,7 +129,7 @@ public class ByteToCharJISAutoDetect extends ByteToCharConverter { ...@@ -133,7 +129,7 @@ public class ByteToCharJISAutoDetect extends ByteToCharConverter {
break; break;
} }
if ((mask == SJIS2B_MASK) || (mask == SJIS1B_MASK) if ((mask == SJIS2B_MASK) || (mask == SJIS1B_MASK)
|| (nioCoder.canBeSJIS1B(firstmask) && secondmask == 0)) { || (JISAutoDetect.canBeSJIS1B(firstmask) && secondmask == 0)) {
convName = SJISName; convName = SJISName;
break; break;
} }
...@@ -145,15 +141,15 @@ public class ByteToCharJISAutoDetect extends ByteToCharConverter { ...@@ -145,15 +141,15 @@ public class ByteToCharJISAutoDetect extends ByteToCharConverter {
// character boundary. If we tried both // character boundary. If we tried both
// possibilities here, it might be able to be // possibilities here, it might be able to be
// determined correctly. // determined correctly.
if ((byte1 == SS3) && nioCoder.canBeEUCJP(secondmask)) { if ((byte1 == SS3) && JISAutoDetect.canBeEUCJP(secondmask)) {
if (cnt+1 < inEnd) { if (cnt+1 < inEnd) {
int nextbyte = input[cnt+1] & 0xff; int nextbyte = input[cnt+1] & 0xff;
if (! nioCoder.canBeEUCJP(maskTable2[nextbyte])) if (! JISAutoDetect.canBeEUCJP(maskTable2[nextbyte]))
convName = SJISName; convName = SJISName;
} else } else
convName = SJISName; convName = SJISName;
} }
if (nioCoder.canBeEUCKana(firstmask, secondmask)) if (JISAutoDetect.canBeEUCKana(firstmask, secondmask))
euckana++; euckana++;
} else { } else {
if ((firstmask & SJIS1B_MASK) != 0) { if ((firstmask & SJIS1B_MASK) != 0) {
......
...@@ -66,7 +66,7 @@ public class CharToBytePCK extends CharToByteSJIS { ...@@ -66,7 +66,7 @@ public class CharToBytePCK extends CharToByteSJIS {
switch (ch) { switch (ch) {
case '\u2015': case '\u2015':
return (int)0x815C; return 0x815C;
case '\u2014': case '\u2014':
return 0; return 0;
default: default:
......
# Jules Rendering Engine module
sun.java2d.jules.JulesRenderingEngine
# Pisces Rendering Engine module # Pisces Rendering Engine module
sun.java2d.pisces.PiscesRenderingEngine sun.java2d.pisces.PiscesRenderingEngine
\ No newline at end of file
...@@ -171,10 +171,9 @@ public class DatagramSocketAdaptor ...@@ -171,10 +171,9 @@ public class DatagramSocketAdaptor
// Must hold dc.blockingLock() // Must hold dc.blockingLock()
// //
private void receive(ByteBuffer bb) throws IOException { private SocketAddress receive(ByteBuffer bb) throws IOException {
if (timeout == 0) { if (timeout == 0) {
dc.receive(bb); return dc.receive(bb);
return;
} }
// Implement timeout with a selector // Implement timeout with a selector
...@@ -183,8 +182,9 @@ public class DatagramSocketAdaptor ...@@ -183,8 +182,9 @@ public class DatagramSocketAdaptor
dc.configureBlocking(false); dc.configureBlocking(false);
try { try {
int n; int n;
if (dc.receive(bb) != null) SocketAddress sender;
return; if ((sender = dc.receive(bb)) != null)
return sender;
sel = Util.getTemporarySelector(dc); sel = Util.getTemporarySelector(dc);
sk = dc.register(sel, SelectionKey.OP_READ); sk = dc.register(sel, SelectionKey.OP_READ);
long to = timeout; long to = timeout;
...@@ -194,8 +194,8 @@ public class DatagramSocketAdaptor ...@@ -194,8 +194,8 @@ public class DatagramSocketAdaptor
long st = System.currentTimeMillis(); long st = System.currentTimeMillis();
int ns = sel.select(to); int ns = sel.select(to);
if (ns > 0 && sk.isReadable()) { if (ns > 0 && sk.isReadable()) {
if (dc.receive(bb) != null) if ((sender = dc.receive(bb)) != null)
return; return sender;
} }
sel.selectedKeys().remove(sk); sel.selectedKeys().remove(sk);
to -= System.currentTimeMillis() - st; to -= System.currentTimeMillis() - st;
...@@ -222,7 +222,8 @@ public class DatagramSocketAdaptor ...@@ -222,7 +222,8 @@ public class DatagramSocketAdaptor
ByteBuffer bb = ByteBuffer.wrap(p.getData(), ByteBuffer bb = ByteBuffer.wrap(p.getData(),
p.getOffset(), p.getOffset(),
p.getLength()); p.getLength());
receive(bb); SocketAddress sender = receive(bb);
p.setSocketAddress(sender);
p.setLength(bb.position() - p.getOffset()); p.setLength(bb.position() - p.getOffset());
} }
} catch (IOException x) { } catch (IOException x) {
......
...@@ -144,11 +144,7 @@ public class ServerSocketAdaptor // package-private ...@@ -144,11 +144,7 @@ public class ServerSocketAdaptor // package-private
} }
public void close() throws IOException { public void close() throws IOException {
try { ssc.close();
ssc.close();
} catch (Exception x) {
Net.translateException(x);
}
} }
public ServerSocketChannel getChannel() { public ServerSocketChannel getChannel() {
......
...@@ -404,11 +404,7 @@ public class SocketAdaptor ...@@ -404,11 +404,7 @@ public class SocketAdaptor
} }
public void close() throws IOException { public void close() throws IOException {
try { sc.close();
sc.close();
} catch (Exception x) {
Net.translateToSocketException(x);
}
} }
public void shutdownInput() throws IOException { public void shutdownInput() throws IOException {
......
...@@ -103,7 +103,7 @@ public class DoubleByte { ...@@ -103,7 +103,7 @@ public class DoubleByte {
public final static char[] B2C_UNMAPPABLE; public final static char[] B2C_UNMAPPABLE;
static { static {
B2C_UNMAPPABLE = new char[0x100]; B2C_UNMAPPABLE = new char[0x100];
Arrays.fill(B2C_UNMAPPABLE, (char)UNMAPPABLE_DECODING); Arrays.fill(B2C_UNMAPPABLE, UNMAPPABLE_DECODING);
} }
public static class Decoder extends CharsetDecoder public static class Decoder extends CharsetDecoder
...@@ -374,7 +374,7 @@ public class DoubleByte { ...@@ -374,7 +374,7 @@ public class DoubleByte {
static final char[] b2cSB; static final char[] b2cSB;
static { static {
b2cSB = new char[0x100]; b2cSB = new char[0x100];
Arrays.fill(b2cSB, (char)UNMAPPABLE_DECODING); Arrays.fill(b2cSB, UNMAPPABLE_DECODING);
} }
Decoder_EBCDIC_DBCSONLY(Charset cs, char[][] b2c, int b2Min, int b2Max) { Decoder_EBCDIC_DBCSONLY(Charset cs, char[][] b2c, int b2Min, int b2Max) {
super(cs, 0.5f, 1.0f, b2c, b2cSB, b2Min, b2Max); super(cs, 0.5f, 1.0f, b2c, b2cSB, b2Min, b2Max);
......
...@@ -79,8 +79,10 @@ public class EUC_JP ...@@ -79,8 +79,10 @@ public class EUC_JP
JIS_X_0201.Decoder decoderJ0201; JIS_X_0201.Decoder decoderJ0201;
JIS_X_0212_Decoder decoderJ0212; JIS_X_0212_Decoder decoderJ0212;
short[] j0208Index1; private static final short[] j0208Index1 =
String[] j0208Index2; JIS_X_0208_Decoder.getIndex1();
private static final String[] j0208Index2 =
JIS_X_0208_Decoder.getIndex2();
protected Decoder(Charset cs) { protected Decoder(Charset cs) {
super(cs); super(cs);
...@@ -88,8 +90,6 @@ public class EUC_JP ...@@ -88,8 +90,6 @@ public class EUC_JP
decoderJ0212 = new JIS_X_0212_Decoder(cs); decoderJ0212 = new JIS_X_0212_Decoder(cs);
start = 0xa1; start = 0xa1;
end = 0xfe; end = 0xfe;
j0208Index1 = super.getIndex1();
j0208Index2 = super.getIndex2();
} }
protected char decode0212(int byte1, int byte2) { protected char decode0212(int byte1, int byte2) {
return decoderJ0212.decodeDouble(byte1, byte2); return decoderJ0212.decodeDouble(byte1, byte2);
...@@ -238,8 +238,10 @@ public class EUC_JP ...@@ -238,8 +238,10 @@ public class EUC_JP
JIS_X_0201.Encoder encoderJ0201; JIS_X_0201.Encoder encoderJ0201;
JIS_X_0212_Encoder encoderJ0212; JIS_X_0212_Encoder encoderJ0212;
short[] j0208Index1; private static final short[] j0208Index1 =
String[] j0208Index2; JIS_X_0208_Encoder.getIndex1();
private static final String[] j0208Index2 =
JIS_X_0208_Encoder.getIndex2();
private final Surrogate.Parser sgp = new Surrogate.Parser(); private final Surrogate.Parser sgp = new Surrogate.Parser();
...@@ -247,8 +249,6 @@ public class EUC_JP ...@@ -247,8 +249,6 @@ public class EUC_JP
super(cs, 3.0f, 3.0f); super(cs, 3.0f, 3.0f);
encoderJ0201 = new JIS_X_0201.Encoder(cs); encoderJ0201 = new JIS_X_0201.Encoder(cs);
encoderJ0212 = new JIS_X_0212_Encoder(cs); encoderJ0212 = new JIS_X_0212_Encoder(cs);
j0208Index1 = super.getIndex1();
j0208Index2 = super.getIndex2();
} }
public boolean canEncode(char c) { public boolean canEncode(char c) {
......
...@@ -65,20 +65,18 @@ public class EUC_JP_LINUX ...@@ -65,20 +65,18 @@ public class EUC_JP_LINUX
private static class Decoder extends CharsetDecoder { private static class Decoder extends CharsetDecoder {
JIS_X_0201.Decoder decoderJ0201; JIS_X_0201.Decoder decoderJ0201;
JIS_X_0208_Decoder decodeMappingJ0208;
protected final char REPLACE_CHAR='\uFFFD'; protected final char REPLACE_CHAR='\uFFFD';
short[] jis0208Index1; private static final int start = 0xa1;
String[] jis0208Index2; private static final int end = 0xfe;
private static final short[] jis0208Index1 =
JIS_X_0208_Decoder.getIndex1();
private static final String[] jis0208Index2 =
JIS_X_0208_Decoder.getIndex2();
private Decoder(Charset cs) { private Decoder(Charset cs) {
super(cs, 1.0f, 1.0f); super(cs, 1.0f, 1.0f);
decoderJ0201 = new JIS_X_0201.Decoder(cs); decoderJ0201 = new JIS_X_0201.Decoder(cs);
decodeMappingJ0208 = new JIS_X_0208_Decoder(cs);
decodeMappingJ0208.start = 0xa1;
decodeMappingJ0208.end = 0xfe;
jis0208Index1 = decodeMappingJ0208.getIndex1();
jis0208Index2 = decodeMappingJ0208.getIndex2();
} }
protected char convSingleByte(int b) { protected char convSingleByte(int b) {
...@@ -93,11 +91,11 @@ public class EUC_JP_LINUX ...@@ -93,11 +91,11 @@ public class EUC_JP_LINUX
} }
if (((byte1 < 0) || (byte1 > jis0208Index1.length)) if (((byte1 < 0) || (byte1 > jis0208Index1.length))
|| ((byte2 < decodeMappingJ0208.start) || (byte2 > decodeMappingJ0208.end))) || ((byte2 < start) || (byte2 > end)))
return REPLACE_CHAR; return REPLACE_CHAR;
int n = (jis0208Index1[byte1 - 0x80] & 0xf) * (decodeMappingJ0208.end - decodeMappingJ0208.start + 1) int n = (jis0208Index1[byte1 - 0x80] & 0xf) * (end - start + 1)
+ (byte2 - decodeMappingJ0208.start); + (byte2 - start);
return jis0208Index2[jis0208Index1[byte1 - 0x80] >> 4].charAt(n); return jis0208Index2[jis0208Index1[byte1 - 0x80] >> 4].charAt(n);
} }
...@@ -213,18 +211,16 @@ public class EUC_JP_LINUX ...@@ -213,18 +211,16 @@ public class EUC_JP_LINUX
private static class Encoder extends CharsetEncoder { private static class Encoder extends CharsetEncoder {
JIS_X_0201.Encoder encoderJ0201; JIS_X_0201.Encoder encoderJ0201;
JIS_X_0208_Encoder encoderJ0208;
private final Surrogate.Parser sgp = new Surrogate.Parser(); private final Surrogate.Parser sgp = new Surrogate.Parser();
short[] jis0208Index1; private static final short[] jis0208Index1 =
String[] jis0208Index2; JIS_X_0208_Encoder.getIndex1();
private static final String[] jis0208Index2 =
JIS_X_0208_Encoder.getIndex2();
private Encoder(Charset cs) { private Encoder(Charset cs) {
super(cs, 2.0f, 2.0f); super(cs, 2.0f, 2.0f);
encoderJ0201 = new JIS_X_0201.Encoder(cs); encoderJ0201 = new JIS_X_0201.Encoder(cs);
encoderJ0208 = new JIS_X_0208_Encoder(cs);
jis0208Index1 = encoderJ0208.getIndex1();
jis0208Index2 = encoderJ0208.getIndex2();
} }
public boolean canEncode(char c) { public boolean canEncode(char c) {
......
...@@ -75,8 +75,12 @@ public class EUC_JP_Open ...@@ -75,8 +75,12 @@ public class EUC_JP_Open
JIS_X_0212_Solaris_Decoder decodeMappingJ0212; JIS_X_0212_Solaris_Decoder decodeMappingJ0212;
JIS_X_0208_Solaris_Decoder decodeMappingJ0208; JIS_X_0208_Solaris_Decoder decodeMappingJ0208;
short[] j0208Index1; private static final short[] j0208Index1 =
String[] j0208Index2; JIS_X_0208_Solaris_Decoder.getIndex1();
private static final String[] j0208Index2 =
JIS_X_0208_Solaris_Decoder.getIndex2();
private static final int start = 0xa1;
private static final int end = 0xfe;
protected final char REPLACE_CHAR='\uFFFD'; protected final char REPLACE_CHAR='\uFFFD';
...@@ -84,11 +88,6 @@ public class EUC_JP_Open ...@@ -84,11 +88,6 @@ public class EUC_JP_Open
super(cs); super(cs);
decoderJ0201 = new JIS_X_0201.Decoder(cs); decoderJ0201 = new JIS_X_0201.Decoder(cs);
decodeMappingJ0212 = new JIS_X_0212_Solaris_Decoder(cs); decodeMappingJ0212 = new JIS_X_0212_Solaris_Decoder(cs);
decodeMappingJ0208 = new JIS_X_0208_Solaris_Decoder(cs);
decodeMappingJ0208.start = 0xa1;
decodeMappingJ0208.end = 0xfe;
j0208Index1 = decodeMappingJ0208.getIndex1();
j0208Index2 = decodeMappingJ0208.getIndex2();
} }
...@@ -103,9 +102,9 @@ public class EUC_JP_Open ...@@ -103,9 +102,9 @@ public class EUC_JP_Open
} }
if (((byte1 < 0) if (((byte1 < 0)
|| (byte1 > decodeMappingJ0208.getIndex1().length)) || (byte1 > j0208Index1.length))
|| ((byte2 < decodeMappingJ0208.start) || ((byte2 < start)
|| (byte2 > decodeMappingJ0208.end))) || (byte2 > end)))
return REPLACE_CHAR; return REPLACE_CHAR;
char result = super.decodeDouble(byte1, byte2); char result = super.decodeDouble(byte1, byte2);
...@@ -113,8 +112,8 @@ public class EUC_JP_Open ...@@ -113,8 +112,8 @@ public class EUC_JP_Open
return result; return result;
} else { } else {
int n = (j0208Index1[byte1 - 0x80] & 0xf) * int n = (j0208Index1[byte1 - 0x80] & 0xf) *
(decodeMappingJ0208.end - decodeMappingJ0208.start + 1) (end - start + 1)
+ (byte2 - decodeMappingJ0208.start); + (byte2 - start);
return j0208Index2[j0208Index1[byte1 - 0x80] >> 4].charAt(n); return j0208Index2[j0208Index1[byte1 - 0x80] >> 4].charAt(n);
} }
} }
...@@ -125,10 +124,11 @@ public class EUC_JP_Open ...@@ -125,10 +124,11 @@ public class EUC_JP_Open
JIS_X_0201.Encoder encoderJ0201; JIS_X_0201.Encoder encoderJ0201;
JIS_X_0212_Solaris_Encoder encoderJ0212; JIS_X_0212_Solaris_Encoder encoderJ0212;
JIS_X_0208_Solaris_Encoder encoderJ0208;
short[] j0208Index1; private static final short[] j0208Index1 =
String[] j0208Index2; JIS_X_0208_Solaris_Encoder.getIndex1();
private static final String[] j0208Index2 =
JIS_X_0208_Solaris_Encoder.getIndex2();
private final Surrogate.Parser sgp = new Surrogate.Parser(); private final Surrogate.Parser sgp = new Surrogate.Parser();
...@@ -136,9 +136,6 @@ public class EUC_JP_Open ...@@ -136,9 +136,6 @@ public class EUC_JP_Open
super(cs); super(cs);
encoderJ0201 = new JIS_X_0201.Encoder(cs); encoderJ0201 = new JIS_X_0201.Encoder(cs);
encoderJ0212 = new JIS_X_0212_Solaris_Encoder(cs); encoderJ0212 = new JIS_X_0212_Solaris_Encoder(cs);
encoderJ0208 = new JIS_X_0208_Solaris_Encoder(cs);
j0208Index1 = encoderJ0208.getIndex1();
j0208Index2 = encoderJ0208.getIndex2();
} }
protected int encodeSingle(char inputChar, byte[] outputByte) { protected int encodeSingle(char inputChar, byte[] outputByte) {
......
...@@ -423,7 +423,7 @@ public class EUC_TW extends Charset implements HistoricallyNamedCharset ...@@ -423,7 +423,7 @@ public class EUC_TW extends Charset implements HistoricallyNamedCharset
if (dst.remaining() < outSize) if (dst.remaining() < outSize)
return CoderResult.OVERFLOW; return CoderResult.OVERFLOW;
for (int i = 0; i < outSize; i++) for (int i = 0; i < outSize; i++)
dst.put((byte)bb[i]); dst.put(bb[i]);
mark += inSize; mark += inSize;
} }
return CoderResult.UNDERFLOW; return CoderResult.UNDERFLOW;
......
...@@ -12339,7 +12339,7 @@ public class GB18030 ...@@ -12339,7 +12339,7 @@ public class GB18030
int start = 0x40, end = 0xFE; int start = 0x40, end = 0xFE;
if (((byte1 < 0) || (byte1 > index1.length)) if (((byte1 < 0) || (byte1 > index1.length))
|| ((byte2 < start) || (byte2 > end))) || ((byte2 < start) || (byte2 > end)))
return (char)'\uFFFD'; return '\uFFFD';
int n = (index1[byte1] & 0xf) * (end - start + 1) + (byte2 - start); int n = (index1[byte1] & 0xf) * (end - start + 1) + (byte2 - start);
return index2[index1[byte1] >> 4].charAt(n); return index2[index1[byte1] >> 4].charAt(n);
......
...@@ -43,7 +43,7 @@ public class HKSCS { ...@@ -43,7 +43,7 @@ public class HKSCS {
private char[][] b2cBmp; private char[][] b2cBmp;
private char[][] b2cSupp; private char[][] b2cSupp;
private static DoubleByte.Decoder big5Dec; private DoubleByte.Decoder big5Dec;
protected Decoder(Charset cs, protected Decoder(Charset cs,
DoubleByte.Decoder big5Dec, DoubleByte.Decoder big5Dec,
...@@ -355,7 +355,7 @@ public class HKSCS { ...@@ -355,7 +355,7 @@ public class HKSCS {
c2b[hi] = new char[0x100]; c2b[hi] = new char[0x100];
Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING); Arrays.fill(c2b[hi], (char)UNMAPPABLE_ENCODING);
} }
c2b[hi][c & 0xff] = (char)bb; c2b[hi][c & 0xff] = bb;
} }
c++; c++;
} }
......
...@@ -104,15 +104,15 @@ abstract class ISO2022 ...@@ -104,15 +104,15 @@ abstract class ISO2022
switch(shiftFlag) { switch(shiftFlag) {
case SOFlag: case SOFlag:
tmpIndex = curSODes; tmpIndex = curSODes;
tmpDecoder = (CharsetDecoder [])SODecoder; tmpDecoder = SODecoder;
break; break;
case SS2Flag: case SS2Flag:
tmpIndex = curSS2Des; tmpIndex = curSS2Des;
tmpDecoder = (CharsetDecoder [])SS2Decoder; tmpDecoder = SS2Decoder;
break; break;
case SS3Flag: case SS3Flag:
tmpIndex = curSS3Des; tmpIndex = curSS3Des;
tmpDecoder = (CharsetDecoder [])SS3Decoder; tmpDecoder = SS3Decoder;
break; break;
} }
......
...@@ -82,11 +82,11 @@ public class JISAutoDetect ...@@ -82,11 +82,11 @@ public class JISAutoDetect
* with the sun.io JISAutoDetect implementation * with the sun.io JISAutoDetect implementation
*/ */
public byte[] getByteMask1() { public static byte[] getByteMask1() {
return Decoder.maskTable1; return Decoder.maskTable1;
} }
public byte[] getByteMask2() { public static byte[] getByteMask2() {
return Decoder.maskTable2; return Decoder.maskTable2;
} }
......
...@@ -101,17 +101,15 @@ public class PCK ...@@ -101,17 +101,15 @@ public class PCK
private static class Encoder extends SJIS.Encoder { private static class Encoder extends SJIS.Encoder {
private JIS_X_0201.Encoder jis0201; private JIS_X_0201.Encoder jis0201;
private JIS_X_0208_Solaris_Encoder jis0208;
short[] j0208Index1; private static final short[] j0208Index1 =
String[] j0208Index2; JIS_X_0208_Solaris_Encoder.getIndex1();
private static final String[] j0208Index2 =
JIS_X_0208_Solaris_Encoder.getIndex2();
private Encoder(Charset cs) { private Encoder(Charset cs) {
super(cs); super(cs);
jis0201 = new JIS_X_0201.Encoder(cs); jis0201 = new JIS_X_0201.Encoder(cs);
jis0208 = new JIS_X_0208_Solaris_Encoder(cs);
j0208Index1 = jis0208.getIndex1();
j0208Index2 = jis0208.getIndex2();
} }
protected int encodeDouble(char ch) { protected int encodeDouble(char ch) {
...@@ -121,7 +119,7 @@ public class PCK ...@@ -121,7 +119,7 @@ public class PCK
switch (ch) { switch (ch) {
case '\u2015': case '\u2015':
return (int)0x815C; return 0x815C;
case '\u2014': case '\u2014':
return 0; return 0;
default: default:
......
...@@ -114,14 +114,14 @@ public class SJIS ...@@ -114,14 +114,14 @@ public class SJIS
private JIS_X_0201.Encoder jis0201; private JIS_X_0201.Encoder jis0201;
short[] j0208Index1; private static final short[] j0208Index1 =
String[] j0208Index2; JIS_X_0208_Encoder.getIndex1();
private static final String[] j0208Index2 =
JIS_X_0208_Encoder.getIndex2();
protected Encoder(Charset cs) { protected Encoder(Charset cs) {
super(cs); super(cs);
jis0201 = new JIS_X_0201.Encoder(cs); jis0201 = new JIS_X_0201.Encoder(cs);
j0208Index1 = super.getIndex1();
j0208Index2 = super.getIndex2();
} }
protected int encodeSingle(char inputChar) { protected int encodeSingle(char inputChar) {
......
...@@ -188,24 +188,13 @@ public class EncryptionKey ...@@ -188,24 +188,13 @@ public class EncryptionKey
etypes = EType.getBuiltInDefaults(); etypes = EType.getBuiltInDefaults();
} }
// set the preferred etype for preauth
if ((pa_exists) && (pa_etype != EncryptedData.ETYPE_NULL)) {
if (DEBUG) {
System.out.println("Pre-Authentication: " +
"Set preferred etype = " + pa_etype);
}
if (EType.isSupported(pa_etype)) {
// reset etypes to preferred value
etypes = new int[1];
etypes[0] = pa_etype;
}
}
EncryptionKey[] encKeys = new EncryptionKey[etypes.length]; EncryptionKey[] encKeys = new EncryptionKey[etypes.length];
for (int i = 0; i < etypes.length; i++) { for (int i = 0; i < etypes.length; i++) {
if (EType.isSupported(etypes[i])) { if (EType.isSupported(etypes[i])) {
byte[] s2kparams = (pa_exists && etypes[i] == pa_etype)
? pa_s2kparams : null;
encKeys[i] = new EncryptionKey( encKeys[i] = new EncryptionKey(
stringToKey(password, salt, pa_s2kparams, etypes[i]), stringToKey(password, salt, s2kparams, etypes[i]),
etypes[i], null); etypes[i], null);
} else { } else {
if (DEBUG) { if (DEBUG) {
......
...@@ -342,20 +342,20 @@ public class KrbAsReq extends KrbKdcReq { ...@@ -342,20 +342,20 @@ public class KrbAsReq extends KrbKdcReq {
} }
princName = cname; princName = cname;
int[] tktETypes = EType.getDefaults("default_tkt_enctypes", keys);
EncryptionKey key = null;
int[] tktETypes = EType.getDefaults("default_tkt_enctypes");
if (pa_exists && pa_etype != EncryptedData.ETYPE_NULL) {
if (DEBUG) {
System.out.println("Pre-Authenticaton: find key for etype = " + pa_etype);
}
key = EncryptionKey.findKey(pa_etype, keys);
} else {
key = EncryptionKey.findKey(tktETypes[0], keys);
}
PAData[] paData = null; PAData[] paData = null;
if (PA_ENC_TIMESTAMP_REQUIRED) { if (PA_ENC_TIMESTAMP_REQUIRED) {
EncryptionKey key = null;
if (pa_etype != EncryptedData.ETYPE_NULL) {
if (DEBUG) {
System.out.println("Pre-Authenticaton: find key for etype = " + pa_etype);
}
key = EncryptionKey.findKey(pa_etype, keys);
} else {
if (tktETypes.length > 0) {
key = EncryptionKey.findKey(tktETypes[0], keys);
}
}
if (DEBUG) { if (DEBUG) {
System.out.println("AS-REQ: Add PA_ENC_TIMESTAMP now"); System.out.println("AS-REQ: Add PA_ENC_TIMESTAMP now");
} }
......
...@@ -286,6 +286,19 @@ public class KRBError implements java.io.Serializable { ...@@ -286,6 +286,19 @@ public class KRBError implements java.io.Serializable {
salt = info.getSalt(); salt = info.getSalt();
if (DEBUG) { if (DEBUG) {
System.out.println("\t PA-ETYPE-INFO etype = " + etype); System.out.println("\t PA-ETYPE-INFO etype = " + etype);
System.out.println("\t PA-ETYPE-INFO salt = " + salt);
}
while (der.data.available() > 0) {
value = der.data.getDerValue();
info = new ETypeInfo(value);
if (DEBUG) {
etype = info.getEType();
System.out.println("\t salt for " + etype
+ " is " + info.getSalt());
}
if (salt == null || salt.isEmpty()) {
salt = info.getSalt();
}
} }
} }
break; break;
...@@ -299,6 +312,19 @@ public class KRBError implements java.io.Serializable { ...@@ -299,6 +312,19 @@ public class KRBError implements java.io.Serializable {
s2kparams = info2.getParams(); s2kparams = info2.getParams();
if (DEBUG) { if (DEBUG) {
System.out.println("\t PA-ETYPE-INFO2 etype = " + etype); System.out.println("\t PA-ETYPE-INFO2 etype = " + etype);
System.out.println("\t PA-ETYPE-INFO salt = " + salt);
}
while (der.data.available() > 0) {
value = der.data.getDerValue();
info2 = new ETypeInfo2(value);
if (DEBUG) {
etype = info2.getEType();
System.out.println("\t salt for " + etype
+ " is " + info2.getSalt());
}
if (salt == null || salt.isEmpty()) {
salt = info2.getSalt();
}
} }
} }
break; break;
......
...@@ -53,7 +53,7 @@ public final class PKIXValidator extends Validator { ...@@ -53,7 +53,7 @@ public final class PKIXValidator extends Validator {
private int certPathLength = -1; private int certPathLength = -1;
// needed only for the validator // needed only for the validator
private Map<X500Principal, X509Certificate> trustedSubjects; private Map<X500Principal, List<PublicKey>> trustedSubjects;
private CertificateFactory factory; private CertificateFactory factory;
private boolean plugin = false; private boolean plugin = false;
...@@ -95,9 +95,17 @@ public final class PKIXValidator extends Validator { ...@@ -95,9 +95,17 @@ public final class PKIXValidator extends Validator {
if (TRY_VALIDATOR == false) { if (TRY_VALIDATOR == false) {
return; return;
} }
trustedSubjects = new HashMap<X500Principal, X509Certificate>(); trustedSubjects = new HashMap<X500Principal, List<PublicKey>>();
for (X509Certificate cert : trustedCerts) { for (X509Certificate cert : trustedCerts) {
trustedSubjects.put(cert.getSubjectX500Principal(), cert); X500Principal dn = cert.getSubjectX500Principal();
List<PublicKey> keys;
if (trustedSubjects.containsKey(dn)) {
keys = trustedSubjects.get(dn);
} else {
keys = new ArrayList<PublicKey>();
trustedSubjects.put(dn, keys);
}
keys.add(cert.getPublicKey());
} }
try { try {
factory = CertificateFactory.getInstance("X.509"); factory = CertificateFactory.getInstance("X.509");
...@@ -161,13 +169,21 @@ public final class PKIXValidator extends Validator { ...@@ -161,13 +169,21 @@ public final class PKIXValidator extends Validator {
// chain is not ordered correctly, call builder instead // chain is not ordered correctly, call builder instead
return doBuild(chain, otherCerts); return doBuild(chain, otherCerts);
} }
if (trustedSubjects.containsKey(dn)
&& trustedSubjects.get(dn).getPublicKey() // Check if chain[i] is already trusted. It may be inside
.equals(cert.getPublicKey())) { // trustedCerts, or has the same dn and public key as a cert
// inside trustedCerts. The latter happens when a CA has
// updated its cert with a stronger signature algorithm in JRE
// but the weak one is still in circulation.
if (trustedCerts.contains(cert) || // trusted cert
(trustedSubjects.containsKey(dn) && // replacing ...
trustedSubjects.get(dn).contains( // ... weak cert
cert.getPublicKey()))) {
if (i == 0) { if (i == 0) {
return new X509Certificate[] {chain[0]}; return new X509Certificate[] {chain[0]};
} }
// Remove and call validator // Remove and call validator on partial chain [0 .. i-1]
X509Certificate[] newChain = new X509Certificate[i]; X509Certificate[] newChain = new X509Certificate[i];
System.arraycopy(chain, 0, newChain, 0, i); System.arraycopy(chain, 0, newChain, 0, i);
return doValidate(newChain); return doValidate(newChain);
...@@ -217,14 +233,17 @@ public final class PKIXValidator extends Validator { ...@@ -217,14 +233,17 @@ public final class PKIXValidator extends Validator {
return doBuild(chain, otherCerts); return doBuild(chain, otherCerts);
} }
private boolean isSignatureValid(X509Certificate iss, X509Certificate sub) { private boolean isSignatureValid(List<PublicKey> keys, X509Certificate sub) {
if (plugin) { if (plugin) {
try { for (PublicKey key: keys) {
sub.verify(iss.getPublicKey()); try {
} catch (Exception ex) { sub.verify(key);
return false; return true;
} catch (Exception ex) {
continue;
}
} }
return true; return false;
} }
return true; // only check if PLUGIN is set return true; // only check if PLUGIN is set
} }
......
...@@ -108,6 +108,12 @@ public class SwingUtilities2 { ...@@ -108,6 +108,12 @@ public class SwingUtilities2 {
public static final Object AA_TEXT_PROPERTY_KEY = public static final Object AA_TEXT_PROPERTY_KEY =
new StringBuffer("AATextInfoPropertyKey"); new StringBuffer("AATextInfoPropertyKey");
/**
* Attribute key for the content elements. If it is set on an element, the
* element is considered to be a line break.
*/
public static final String IMPLIED_CR = "CR";
/** /**
* Used to tell a text component, being used as an editor for table * Used to tell a text component, being used as an editor for table
* or tree, how many clicks it took to start editing. * or tree, how many clicks it took to start editing.
......
...@@ -127,7 +127,7 @@ public class DefaultTableCellHeaderRenderer extends DefaultTableCellRenderer ...@@ -127,7 +127,7 @@ public class DefaultTableCellHeaderRenderer extends DefaultTableCellRenderer
public static SortOrder getColumnSortOrder(JTable table, int column) { public static SortOrder getColumnSortOrder(JTable table, int column) {
SortOrder rv = null; SortOrder rv = null;
if (table.getRowSorter() == null) { if (table == null || table.getRowSorter() == null) {
return rv; return rv;
} }
java.util.List<? extends RowSorter.SortKey> sortKeys = java.util.List<? extends RowSorter.SortKey> sortKeys =
......
...@@ -47,6 +47,7 @@ public class Arguments { ...@@ -47,6 +47,7 @@ public class Arguments {
private static final String JVMSTAT_USERDIR = ".jvmstat"; private static final String JVMSTAT_USERDIR = ".jvmstat";
private static final String OPTIONS_FILENAME = "jstat_options"; private static final String OPTIONS_FILENAME = "jstat_options";
private static final String UNSUPPORTED_OPTIONS_FILENAME = "jstat_unsupported_options";
private static final String ALL_NAMES = "\\w*"; private static final String ALL_NAMES = "\\w*";
private Comparator<Monitor> comparator; private Comparator<Monitor> comparator;
...@@ -411,8 +412,8 @@ public class Arguments { ...@@ -411,8 +412,8 @@ public class Arguments {
return optionFormat; return optionFormat;
} }
public URL[] optionsSources() { public List<URL> optionsSources() {
URL[] sources = new URL[2]; List<URL> sources = new ArrayList<URL>();
int i = 0; int i = 0;
String filename = OPTIONS_FILENAME; String filename = OPTIONS_FILENAME;
...@@ -421,7 +422,7 @@ public class Arguments { ...@@ -421,7 +422,7 @@ public class Arguments {
String userHome = System.getProperty("user.home"); String userHome = System.getProperty("user.home");
String userDir = userHome + "/" + JVMSTAT_USERDIR; String userDir = userHome + "/" + JVMSTAT_USERDIR;
File home = new File(userDir + "/" + filename); File home = new File(userDir + "/" + filename);
sources[i++] = home.toURL(); sources.add(home.toURI().toURL());
} catch (Exception e) { } catch (Exception e) {
if (debug) { if (debug) {
System.err.println(e.getMessage()); System.err.println(e.getMessage());
...@@ -430,8 +431,15 @@ public class Arguments { ...@@ -430,8 +431,15 @@ public class Arguments {
throw new IllegalArgumentException("Internal Error: Bad URL: " throw new IllegalArgumentException("Internal Error: Bad URL: "
+ e.getMessage()); + e.getMessage());
} }
sources[i] = this.getClass().getResource("resources/" + filename); URL u = this.getClass().getResource("resources/" + filename);
assert sources[i] != null; assert u != null;
sources.add(u);
if (showUnsupported) {
u = this.getClass().getResource("resources/" + UNSUPPORTED_OPTIONS_FILENAME);
assert u != null;
sources.add(u);
}
return sources; return sources;
} }
} }
...@@ -39,9 +39,9 @@ public class OptionFinder { ...@@ -39,9 +39,9 @@ public class OptionFinder {
private static final boolean debug = false; private static final boolean debug = false;
URL[] optionsSources; List<URL> optionsSources;
public OptionFinder(URL[] optionsSources) { public OptionFinder(List<URL> optionsSources) {
this.optionsSources = optionsSources; this.optionsSources = optionsSources;
} }
...@@ -59,24 +59,25 @@ public class OptionFinder { ...@@ -59,24 +59,25 @@ public class OptionFinder {
return of; return of;
} }
protected OptionFormat getOptionFormat(String option, URL[] sources) { protected OptionFormat getOptionFormat(String option, List<URL> sources) {
OptionFormat of = null; OptionFormat of = null;
for (int i = 0; (i < sources.length) && (of == null); i++) { for (URL u : sources) {
try { try {
URL u = sources[i];
Reader r = new BufferedReader( Reader r = new BufferedReader(
new InputStreamReader(u.openStream())); new InputStreamReader(u.openStream()));
of = new Parser(r).parse(option); of = new Parser(r).parse(option);
if (of != null)
break;
} catch (IOException e) { } catch (IOException e) {
if (debug) { if (debug) {
System.err.println("Error processing " + sources[i] System.err.println("Error processing " + u
+ " : " + e.getMessage()); + " : " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
} catch (ParserException e) { } catch (ParserException e) {
// Exception in parsing the options file. // Exception in parsing the options file.
System.err.println(sources[i] + ": " + e.getMessage()); System.err.println(u + ": " + e.getMessage());
System.err.println("Parsing of " + sources[i] + " aborted"); System.err.println("Parsing of " + u + " aborted");
} }
} }
return of; return of;
......
...@@ -37,9 +37,9 @@ import java.io.*; ...@@ -37,9 +37,9 @@ import java.io.*;
*/ */
public class OptionLister { public class OptionLister {
private static final boolean debug = false; private static final boolean debug = false;
private URL[] sources; private List<URL> sources;
public OptionLister(URL[] sources) { public OptionLister(List<URL> sources) {
this.sources = sources; this.sources = sources;
} }
...@@ -54,9 +54,8 @@ public class OptionLister { ...@@ -54,9 +54,8 @@ public class OptionLister {
Set<OptionFormat> options = new TreeSet<OptionFormat>(c); Set<OptionFormat> options = new TreeSet<OptionFormat>(c);
for (int i = 0; i < sources.length; i++) { for (URL u : sources) {
try { try {
URL u = sources[i];
Reader r = new BufferedReader( Reader r = new BufferedReader(
new InputStreamReader(u.openStream())); new InputStreamReader(u.openStream()));
Set<OptionFormat> s = new Parser(r).parseOptions(); Set<OptionFormat> s = new Parser(r).parseOptions();
...@@ -68,8 +67,8 @@ public class OptionLister { ...@@ -68,8 +67,8 @@ public class OptionLister {
} }
} catch (ParserException e) { } catch (ParserException e) {
// Exception in parsing the options file. // Exception in parsing the options file.
System.err.println(sources[i] + ": " + e.getMessage()); System.err.println(u + ": " + e.getMessage());
System.err.println("Parsing of " + sources[i] + " aborted"); System.err.println("Parsing of " + u + " aborted");
} }
} }
......
...@@ -37,7 +37,7 @@ option timestamp { ...@@ -37,7 +37,7 @@ option timestamp {
option class { option class {
column { column {
header "^Loaded^" /* Number of classes loaded */ header "^Loaded^" /* Number of classes loaded */
data java.cls.loadedClasses data (java.cls.loadedClasses + java.cls.sharedLoadedClasses)
align right align right
scale raw scale raw
width 5 width 5
...@@ -45,7 +45,7 @@ option class { ...@@ -45,7 +45,7 @@ option class {
} }
column { column {
header "^Bytes^" /* Accumulated Size of classes loaded */ header "^Bytes^" /* Accumulated Size of classes loaded */
data sun.cls.loadedBytes data (sun.cls.loadedBytes + sun.cls.sharedLoadedBytes)
align right align right
scale K scale K
width 7 width 7
...@@ -53,7 +53,7 @@ option class { ...@@ -53,7 +53,7 @@ option class {
} }
column { column {
header "^Unloaded^" /* Number of classes unloaded */ header "^Unloaded^" /* Number of classes unloaded */
data java.cls.unloadedClasses data (java.cls.unloadedClasses + java.cls.sharedUnloadedClasses)
align right align right
width 5 width 5
scale raw scale raw
...@@ -61,7 +61,7 @@ option class { ...@@ -61,7 +61,7 @@ option class {
} }
column { column {
header "^Bytes^" /* Accumulated size of classes unloaded */ header "^Bytes^" /* Accumulated size of classes unloaded */
data sun.cls.unloadedBytes data (sun.cls.unloadedBytes + sun.cls.sharedUnloadedBytes)
align right align right
scale K scale K
width 7 width 7
......
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
option classload {
column {
header "^Loaded^" /* Number of classes loaded */
data (java.cls.loadedClasses + java.cls.sharedLoadedClasses)
align right
scale raw
width 5
format "0"
}
column {
header "Time^" /* Accumulated time for class loading */
data sun.cls.time/sun.os.hrt.frequency
scale sec
align right
width 10
format "0.000"
}
column {
header "^Inited^" /* Number of initialized classes */
data sun.cls.initializedClasses
align right
scale raw
width 5
format "0"
}
column {
header "Time^" /* Accumulated time for class initialization */
data sun.cls.classInitTime.self/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "Shared^" /* Number of system classes loaded from shared archive */
data java.cls.sharedLoadedClasses
align right
scale raw
width 5
format "0"
}
column {
header "Kbytes^" /* Accumulated Size of classes loaded */
data sun.cls.sharedLoadedBytes
align right
scale K
width 7
format "0.0"
}
column {
header "LoadTime^" /* Accumulated time for loading classes from shared archive */
data sun.cls.sharedClassLoadTime/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "^SysClass^" /* Number of system classes loaded */
data java.cls.loadedClasses
align right
scale raw
width 5
format "0"
}
column {
header "Kbytes^" /* Bytes read from system class files */
data sun.cls.sysClassBytes
align right
scale K
width 7
format "0.0"
}
column {
header "LoadTime^" /* Accumulated time for loading non-shared system classes */
data sun.cls.sysClassLoadTime/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "Lookup^" /* Time spent in looking up/reading of system classes */
data sun.cls.lookupSysClassTime/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "Parse^" /* Time spent in parsing system classes */
data sun.cls.parseClassTime.self/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "^Linked^" /* Number of linked classes */
data sun.cls.linkedClasses
align right
scale raw
width 5
format "0"
}
column {
header "Time^" /* Accumulated time for class linking */
data sun.cls.classInitTime.self/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "^Verified^" /* Number of verified classes */
data sun.cls.verifiedClasses
align right
scale raw
width 5
format "0"
}
column {
header "Time^" /* Accumulated time for class verification */
data sun.cls.classVerifyTime.self/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "AppClass^" /* Number of loaded application classes */
data sun.cls.appClassLoadCount
align right
scale raw
width 5
format "0"
}
column {
header "Kbytes^" /* Bytes read from app class files */
data sun.cls.appClassBytes
align right
scale K
width 7
format "0.0"
}
column {
header "AppCL^" /* Accumulated time for loading app classes */
data sun.cls.appClassLoadTime/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "^DefineClass^" /* Number of defineClass calls */
data sun.cls.defineAppClasses
align right
scale raw
width 5
format "0"
}
column {
header "Time^" /* Accumulated time for defineClass */
data sun.cls.defineAppClassTime.self/sun.os.hrt.frequency
scale raw
align right
width 10
format "0.000"
}
column {
header "^FindClass^" /* Number of findClass calls */
data sun.classloader.findClasses
align right
scale raw
width 5
format "0"
}
column {
header "Time^" /* Accumulated time for findClass */
data sun.classloader.findClassTime/1000000000
scale raw
align right
width 10
format "0.000"
}
column {
header "Delegation^" /* Parent class loader delegation time */
data sun.classloader.parentDelegationTime/1000000000
scale raw
align right
width 10
format "0.000"
}
column {
header "URLCL Read^" /* Accumulated time for URLClassLoader reading bytes */
data sun.urlClassLoader.readClassBytesTime/1000000000
scale raw
align right
width 10
format "0.000"
}
}
...@@ -132,7 +132,7 @@ ifeq ($(OSNAME), linux) ...@@ -132,7 +132,7 @@ ifeq ($(OSNAME), linux)
LIBRARY=lib$(LIBNAME).so LIBRARY=lib$(LIBNAME).so
LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
# Libraries we are dependent on # Libraries we are dependent on
LIBRARIES= -lnsl -ldl -lc LIBRARIES= -ldl -lc
# Building a shared library # Building a shared library
LINK_SHARED=$(LINK.c) -shared -o $@ LINK_SHARED=$(LINK.c) -shared -o $@
endif endif
......
...@@ -182,7 +182,7 @@ SplashDecodePngStream(Splash * splash, SplashStream * stream) ...@@ -182,7 +182,7 @@ SplashDecodePngStream(Splash * splash, SplashStream * stream)
int success = 0; int success = 0;
stream->read(stream, sig, SIG_BYTES); stream->read(stream, sig, SIG_BYTES);
if (!png_check_sig(sig, SIG_BYTES)) { if (png_sig_cmp(sig, 0, SIG_BYTES)) {
goto done; goto done;
} }
success = SplashDecodePng(splash, my_png_read_stream, stream); success = SplashDecodePng(splash, my_png_read_stream, stream);
......
...@@ -490,22 +490,23 @@ Java_sun_font_FreetypeFontScaler_getFontMetricsNative( ...@@ -490,22 +490,23 @@ Java_sun_font_FreetypeFontScaler_getFontMetricsNative(
/* ascent */ /* ascent */
ax = 0; ax = 0;
ay = -(jfloat) FT26Dot6ToFloat( ay = -(jfloat) FT26Dot6ToFloat(FT_MulFix(
scalerInfo->face->size->metrics.ascender + ((jlong) scalerInfo->face->ascender + bmodifier/2),
bmodifier/2); (jlong) scalerInfo->face->size->metrics.y_scale));
/* descent */ /* descent */
dx = 0; dx = 0;
dy = -(jfloat) FT26Dot6ToFloat( dy = -(jfloat) FT26Dot6ToFloat(FT_MulFix(
scalerInfo->face->size->metrics.descender + ((jlong) scalerInfo->face->descender + bmodifier/2),
bmodifier/2); (jlong) scalerInfo->face->size->metrics.y_scale));
/* baseline */ /* baseline */
bx = by = 0; bx = by = 0;
/* leading */ /* leading */
lx = 0; lx = 0;
ly = (jfloat) FT26Dot6ToFloat( ly = (jfloat) FT26Dot6ToFloat(FT_MulFix(
scalerInfo->face->size->metrics.height + (jlong) scalerInfo->face->height + bmodifier,
bmodifier) + ay - dy; (jlong) scalerInfo->face->size->metrics.y_scale))
+ ay - dy;
/* max advance */ /* max advance */
mx = (jfloat) FT26Dot6ToFloat( mx = (jfloat) FT26Dot6ToFloat(
scalerInfo->face->size->metrics.max_advance + scalerInfo->face->size->metrics.max_advance +
......
...@@ -25,25 +25,42 @@ ...@@ -25,25 +25,42 @@
package java.lang; package java.lang;
import java.io.*; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.concurrent.Executors;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadFactory;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
/* java.lang.Process subclass in the UNIX environment. /**
* java.lang.Process subclass in the UNIX environment.
* *
* @author Mario Wolczko and Ross Knippel. * @author Mario Wolczko and Ross Knippel.
* @author Konstantin Kladko (ported to Linux) * @author Konstantin Kladko (ported to Linux)
* @author Martin Buchholz
*/ */
final class UNIXProcess extends Process { final class UNIXProcess extends Process {
private static final sun.misc.JavaIOFileDescriptorAccess fdAccess private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
= sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess(); = sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
private int pid; private final int pid;
private int exitcode; private int exitcode;
private boolean hasExited; private boolean hasExited;
private OutputStream stdin_stream; private /* final */ OutputStream stdin;
private InputStream stdout_stream; private /* final */ InputStream stdout;
private InputStream stderr_stream; private /* final */ InputStream stderr;
/* this is for the reaping thread */ /* this is for the reaping thread */
private native int waitForProcessExit(int pid); private native int waitForProcessExit(int pid);
...@@ -51,155 +68,136 @@ final class UNIXProcess extends Process { ...@@ -51,155 +68,136 @@ final class UNIXProcess extends Process {
/** /**
* Create a process using fork(2) and exec(2). * Create a process using fork(2) and exec(2).
* *
* @param std_fds array of file descriptors. Indexes 0, 1, and * @param fds an array of three file descriptors.
* 2 correspond to standard input, standard output and * Indexes 0, 1, and 2 correspond to standard input,
* standard error, respectively. On input, a value of -1 * standard output and standard error, respectively. On
* means to create a pipe to connect child and parent * input, a value of -1 means to create a pipe to connect
* processes. On output, a value which is not -1 is the * child and parent processes. On output, a value which
* parent pipe fd corresponding to the pipe which has * is not -1 is the parent pipe fd corresponding to the
* been created. An element of this array is -1 on input * pipe which has been created. An element of this array
* if and only if it is <em>not</em> -1 on output. * is -1 on input if and only if it is <em>not</em> -1 on
* output.
* @return the pid of the subprocess * @return the pid of the subprocess
*/ */
private native int forkAndExec(byte[] prog, private native int forkAndExec(byte[] prog,
byte[] argBlock, int argc, byte[] argBlock, int argc,
byte[] envBlock, int envc, byte[] envBlock, int envc,
byte[] dir, byte[] dir,
int[] std_fds, int[] fds,
boolean redirectErrorStream) boolean redirectErrorStream)
throws IOException; throws IOException;
/* In the process constructor we wait on this gate until the process */ /**
/* has been created. Then we return from the constructor. */ * The thread factory used to create "process reaper" daemon threads.
/* fork() is called by the same thread which later waits for the process */ */
/* to terminate */ private static class ProcessReaperThreadFactory implements ThreadFactory {
private final static ThreadGroup group = getRootThreadGroup();
private static class Gate {
private boolean exited = false;
private IOException savedException;
synchronized void exit() { /* Opens the gate */
exited = true;
this.notify();
}
synchronized void waitForExit() { /* wait until the gate is open */
boolean interrupted = false;
while (!exited) {
try {
this.wait();
} catch (InterruptedException e) {
interrupted = true;
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
}
void setException (IOException e) { private static ThreadGroup getRootThreadGroup() {
savedException = e; return AccessController.doPrivileged
(new PrivilegedAction<ThreadGroup> () {
public ThreadGroup run() {
ThreadGroup root = Thread.currentThread().getThreadGroup();
while (root.getParent() != null)
root = root.getParent();
return root;
}});
} }
IOException getException() { public Thread newThread(Runnable grimReaper) {
return savedException; // Our thread stack requirement is quite modest.
Thread t = new Thread(group, grimReaper, "process reaper", 32768);
t.setDaemon(true);
// A small attempt (probably futile) to avoid priority inversion
t.setPriority(Thread.MAX_PRIORITY);
return t;
} }
} }
/**
* The thread pool of "process reaper" daemon threads.
*/
private static final Executor processReaperExecutor
= Executors.newCachedThreadPool(new ProcessReaperThreadFactory());
UNIXProcess(final byte[] prog, UNIXProcess(final byte[] prog,
final byte[] argBlock, final int argc, final byte[] argBlock, final int argc,
final byte[] envBlock, final int envc, final byte[] envBlock, final int envc,
final byte[] dir, final byte[] dir,
final int[] std_fds, final int[] fds,
final boolean redirectErrorStream) final boolean redirectErrorStream)
throws IOException { throws IOException {
final Gate gate = new Gate(); pid = forkAndExec(prog,
/* argBlock, argc,
* For each subprocess forked a corresponding reaper thread envBlock, envc,
* is started. That thread is the only thread which waits dir,
* for the subprocess to terminate and it doesn't hold any fds,
* locks while doing so. This design allows waitFor() and redirectErrorStream);
* exitStatus() to be safely executed in parallel (and they
* need no native code). try {
*/ AccessController.doPrivileged
(new PrivilegedExceptionAction<Void>() {
java.security.AccessController.doPrivileged( public Void run() throws IOException {
new java.security.PrivilegedAction<Void>() { initStreams(fds);
public Void run() { return null;
Thread t = new Thread("process reaper") { }});
public void run() { } catch (PrivilegedActionException ex) {
try { throw (IOException) ex.getException();
pid = forkAndExec(prog, }
argBlock, argc, }
envBlock, envc,
dir, static FileDescriptor newFileDescriptor(int fd) {
std_fds, FileDescriptor fileDescriptor = new FileDescriptor();
redirectErrorStream); fdAccess.set(fileDescriptor, fd);
} catch (IOException e) { return fileDescriptor;
gate.setException(e); /*remember to rethrow later*/ }
gate.exit();
return; void initStreams(int[] fds) throws IOException {
} stdin = (fds[0] == -1) ?
java.security.AccessController.doPrivileged( ProcessBuilder.NullOutputStream.INSTANCE :
new java.security.PrivilegedAction<Void>() { new ProcessPipeOutputStream(fds[0]);
public Void run() {
if (std_fds[0] == -1) stdout = (fds[1] == -1) ?
stdin_stream = new ProcessBuilder.NullOutputStream(); ProcessBuilder.NullInputStream.INSTANCE :
else { new ProcessPipeInputStream(fds[1]);
FileDescriptor stdin_fd = new FileDescriptor();
fdAccess.set(stdin_fd, std_fds[0]); stderr = (fds[2] == -1) ?
stdin_stream = new BufferedOutputStream( ProcessBuilder.NullInputStream.INSTANCE :
new FileOutputStream(stdin_fd)); new ProcessPipeInputStream(fds[2]);
}
processReaperExecutor.execute(new Runnable() {
if (std_fds[1] == -1) public void run() {
stdout_stream = new ProcessBuilder.NullInputStream(); int exitcode = waitForProcessExit(pid);
else { UNIXProcess.this.processExited(exitcode);
FileDescriptor stdout_fd = new FileDescriptor(); }});
fdAccess.set(stdout_fd, std_fds[1]); }
stdout_stream = new BufferedInputStream(
new FileInputStream(stdout_fd)); synchronized void processExited(int exitcode) {
} if (stdout instanceof ProcessPipeInputStream)
((ProcessPipeInputStream) stdout).processExited();
if (std_fds[2] == -1)
stderr_stream = new ProcessBuilder.NullInputStream(); if (stderr instanceof ProcessPipeInputStream)
else { ((ProcessPipeInputStream) stderr).processExited();
FileDescriptor stderr_fd = new FileDescriptor();
fdAccess.set(stderr_fd, std_fds[2]); if (stdin instanceof ProcessPipeOutputStream)
stderr_stream = new FileInputStream(stderr_fd); ((ProcessPipeOutputStream) stdin).processExited();
}
this.exitcode = exitcode;
return null; }}); hasExited = true;
gate.exit(); /* exit from constructor */ notifyAll();
int res = waitForProcessExit(pid);
synchronized (UNIXProcess.this) {
hasExited = true;
exitcode = res;
UNIXProcess.this.notifyAll();
}
}
};
t.setDaemon(true);
t.start();
return null; }});
gate.waitForExit();
IOException e = gate.getException();
if (e != null)
throw new IOException(e.toString());
} }
public OutputStream getOutputStream() { public OutputStream getOutputStream() {
return stdin_stream; return stdin;
} }
public InputStream getInputStream() { public InputStream getInputStream() {
return stdout_stream; return stdout;
} }
public InputStream getErrorStream() { public InputStream getErrorStream() {
return stderr_stream; return stderr;
} }
public synchronized int waitFor() throws InterruptedException { public synchronized int waitFor() throws InterruptedException {
...@@ -228,13 +226,9 @@ final class UNIXProcess extends Process { ...@@ -228,13 +226,9 @@ final class UNIXProcess extends Process {
if (!hasExited) if (!hasExited)
destroyProcess(pid); destroyProcess(pid);
} }
try { try { stdin.close(); } catch (IOException ignored) {}
stdin_stream.close(); try { stdout.close(); } catch (IOException ignored) {}
stdout_stream.close(); try { stderr.close(); } catch (IOException ignored) {}
stderr_stream.close();
} catch (IOException e) {
// ignore
}
} }
/* This routine initializes JNI field offsets for the class */ /* This routine initializes JNI field offsets for the class */
...@@ -243,4 +237,77 @@ final class UNIXProcess extends Process { ...@@ -243,4 +237,77 @@ final class UNIXProcess extends Process {
static { static {
initIDs(); initIDs();
} }
/**
* A buffered input stream for a subprocess pipe file descriptor
* that allows the underlying file descriptor to be reclaimed when
* the process exits, via the processExited hook.
*
* This is tricky because we do not want the user-level InputStream to be
* closed until the user invokes close(), and we need to continue to be
* able to read any buffered data lingering in the OS pipe buffer.
*/
static class ProcessPipeInputStream extends BufferedInputStream {
ProcessPipeInputStream(int fd) {
super(new FileInputStream(newFileDescriptor(fd)));
}
private static byte[] drainInputStream(InputStream in)
throws IOException {
if (in == null) return null;
int n = 0;
int j;
byte[] a = null;
while ((j = in.available()) > 0) {
a = (a == null) ? new byte[j] : Arrays.copyOf(a, n + j);
n += in.read(a, n, j);
}
return (a == null || n == a.length) ? a : Arrays.copyOf(a, n);
}
/** Called by the process reaper thread when the process exits. */
synchronized void processExited() {
// Most BufferedInputStream methods are synchronized, but close()
// is not, and so we have to handle concurrent racing close().
try {
InputStream in = this.in;
if (in != null) {
byte[] stragglers = drainInputStream(in);
in.close();
this.in = (stragglers == null) ?
ProcessBuilder.NullInputStream.INSTANCE :
new ByteArrayInputStream(stragglers);
if (buf == null) // asynchronous close()?
this.in = null;
}
} catch (IOException ignored) {
// probably an asynchronous close().
}
}
}
/**
* A buffered output stream for a subprocess pipe file descriptor
* that allows the underlying file descriptor to be reclaimed when
* the process exits, via the processExited hook.
*/
static class ProcessPipeOutputStream extends BufferedOutputStream {
ProcessPipeOutputStream(int fd) {
super(new FileOutputStream(newFileDescriptor(fd)));
}
/** Called by the process reaper thread when the process exits. */
synchronized void processExited() {
OutputStream out = this.out;
if (out != null) {
try {
out.close();
} catch (IOException ignored) {
// We know of no reason to get an IOException, but if
// we do, there's nothing else to do but carry on.
}
this.out = ProcessBuilder.NullOutputStream.INSTANCE;
}
}
}
} }
...@@ -86,7 +86,7 @@ final class UNIXProcess extends Process { ...@@ -86,7 +86,7 @@ final class UNIXProcess extends Process {
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() { public Void run() { new java.security.PrivilegedAction<Void>() { public Void run() {
if (std_fds[0] == -1) if (std_fds[0] == -1)
stdin_stream = new ProcessBuilder.NullOutputStream(); stdin_stream = ProcessBuilder.NullOutputStream.INSTANCE;
else { else {
FileDescriptor stdin_fd = new FileDescriptor(); FileDescriptor stdin_fd = new FileDescriptor();
fdAccess.set(stdin_fd, std_fds[0]); fdAccess.set(stdin_fd, std_fds[0]);
...@@ -95,7 +95,7 @@ final class UNIXProcess extends Process { ...@@ -95,7 +95,7 @@ final class UNIXProcess extends Process {
} }
if (std_fds[1] == -1) if (std_fds[1] == -1)
stdout_stream = new ProcessBuilder.NullInputStream(); stdout_stream = ProcessBuilder.NullInputStream.INSTANCE;
else { else {
FileDescriptor stdout_fd = new FileDescriptor(); FileDescriptor stdout_fd = new FileDescriptor();
fdAccess.set(stdout_fd, std_fds[1]); fdAccess.set(stdout_fd, std_fds[1]);
...@@ -104,7 +104,7 @@ final class UNIXProcess extends Process { ...@@ -104,7 +104,7 @@ final class UNIXProcess extends Process {
} }
if (std_fds[2] == -1) if (std_fds[2] == -1)
stderr_stream = new ProcessBuilder.NullInputStream(); stderr_stream = ProcessBuilder.NullInputStream.INSTANCE;
else { else {
FileDescriptor stderr_fd = new FileDescriptor(); FileDescriptor stderr_fd = new FileDescriptor();
fdAccess.set(stderr_fd, std_fds[2]); fdAccess.set(stderr_fd, std_fds[2]);
......
...@@ -275,7 +275,7 @@ public class XEmbeddedFramePeer extends XFramePeer { ...@@ -275,7 +275,7 @@ public class XEmbeddedFramePeer extends XFramePeer {
Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(), Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(),
XToolkit.getDefaultRootWindow(), XToolkit.getDefaultRootWindow(),
new Point(0, 0)); new Point(0, 0));
return absoluteLoc.x; return absoluteLoc != null ? absoluteLoc.x : 0;
} }
public int getAbsoluteY() public int getAbsoluteY()
...@@ -283,7 +283,7 @@ public class XEmbeddedFramePeer extends XFramePeer { ...@@ -283,7 +283,7 @@ public class XEmbeddedFramePeer extends XFramePeer {
Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(), Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(),
XToolkit.getDefaultRootWindow(), XToolkit.getDefaultRootWindow(),
new Point(0, 0)); new Point(0, 0));
return absoluteLoc.y; return absoluteLoc != null ? absoluteLoc.y : 0;
} }
public int getWidth() { public int getWidth() {
......
/* /*
* Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2010, Oracle and/or its affiliates. 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
...@@ -849,7 +849,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -849,7 +849,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
// if _NET_WM_STRUT_PARTIAL is present, we should use its values to detect // if _NET_WM_STRUT_PARTIAL is present, we should use its values to detect
// if the struts area intersects with screenBounds, however some window // if the struts area intersects with screenBounds, however some window
// managers don't set this hint correctly, so we just get intersection with windowBounds // managers don't set this hint correctly, so we just get intersection with windowBounds
if (windowBounds.intersects(screenBounds)) if (windowBounds != null && windowBounds.intersects(screenBounds))
{ {
insets.left = Math.max((int)Native.getLong(native_ptr, 0), insets.left); insets.left = Math.max((int)Native.getLong(native_ptr, 0), insets.left);
insets.right = Math.max((int)Native.getLong(native_ptr, 1), insets.right); insets.right = Math.max((int)Native.getLong(native_ptr, 1), insets.right);
...@@ -1961,7 +1961,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -1961,7 +1961,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
} }
static long reset_time_utc; static long reset_time_utc;
static final long WRAP_TIME_MILLIS = Integer.MAX_VALUE; static final long WRAP_TIME_MILLIS = 0x00000000FFFFFFFFL;
/* /*
* This function converts between the X server time (number of milliseconds * This function converts between the X server time (number of milliseconds
......
# Jules Rendering Engine module
sun.java2d.jules.JulesRenderingEngine
# Pisces Rendering Engine module
sun.java2d.pisces.PiscesRenderingEngine
...@@ -43,8 +43,8 @@ public class COMPOUND_TEXT_Encoder extends CharsetEncoder { ...@@ -43,8 +43,8 @@ public class COMPOUND_TEXT_Encoder extends CharsetEncoder {
* cannot be used for actual encoding because they are shared across all * cannot be used for actual encoding because they are shared across all
* COMPOUND_TEXT encoders and may be stateful. * COMPOUND_TEXT encoders and may be stateful.
*/ */
private static final Map encodingToEncoderMap = private static final Map<String,CharsetEncoder> encodingToEncoderMap =
Collections.synchronizedMap(new HashMap(21, 1.0f)); Collections.synchronizedMap(new HashMap<String,CharsetEncoder>(21, 1.0f));
private static final CharsetEncoder latin1Encoder; private static final CharsetEncoder latin1Encoder;
private static final CharsetEncoder defaultEncoder; private static final CharsetEncoder defaultEncoder;
private static final boolean defaultEncodingSupported; private static final boolean defaultEncodingSupported;
...@@ -221,7 +221,7 @@ public class COMPOUND_TEXT_Encoder extends CharsetEncoder { ...@@ -221,7 +221,7 @@ public class COMPOUND_TEXT_Encoder extends CharsetEncoder {
out.put((byte)0x1B); out.put((byte)0x1B);
out.put((byte)0x25); out.put((byte)0x25);
out.put((byte)0x2F); out.put((byte)0x2F);
out.put((byte)nonStandardBytes[3]); out.put(nonStandardBytes[3]);
int toWrite = Math.min(numBytes - nonStandardBytesOff, int toWrite = Math.min(numBytes - nonStandardBytesOff,
(1 << 14) - 1 - nonStandardEncodingLen); (1 << 14) - 1 - nonStandardEncodingLen);
...@@ -313,12 +313,9 @@ public class COMPOUND_TEXT_Encoder extends CharsetEncoder { ...@@ -313,12 +313,9 @@ public class COMPOUND_TEXT_Encoder extends CharsetEncoder {
} }
// 4. Brute force search of all supported encodings. // 4. Brute force search of all supported encodings.
for (Iterator iter = CompoundTextSupport.getEncodings().iterator(); for (String encoding : CompoundTextSupport.getEncodings())
iter.hasNext();)
{ {
String encoding = (String)iter.next(); CharsetEncoder enc = encodingToEncoderMap.get(encoding);
CharsetEncoder enc =
(CharsetEncoder)encodingToEncoderMap.get(encoding);
if (enc == null) { if (enc == null) {
enc = CompoundTextSupport.getEncoder(encoding); enc = CompoundTextSupport.getEncoder(encoding);
if (enc == null) { if (enc == null) {
......
...@@ -130,13 +130,13 @@ final class CompoundTextSupport { ...@@ -130,13 +130,13 @@ final class CompoundTextSupport {
/** /**
* Maps a GL or GR escape sequence to an encoding. * Maps a GL or GR escape sequence to an encoding.
*/ */
private static final Map sequenceToEncodingMap; private static final Map<ControlSequence, String> sequenceToEncodingMap;
/** /**
* Indicates whether a particular encoding wants the high bit turned on * Indicates whether a particular encoding wants the high bit turned on
* or off. * or off.
*/ */
private static final Map highBitsMap; private static final Map<ControlSequence, Boolean> highBitsMap;
/** /**
* Maps an encoding to an escape sequence. Rather than manage two * Maps an encoding to an escape sequence. Rather than manage two
...@@ -144,18 +144,21 @@ final class CompoundTextSupport { ...@@ -144,18 +144,21 @@ final class CompoundTextSupport {
* modify both GL and GR if necessary. This makes the output slightly less * modify both GL and GR if necessary. This makes the output slightly less
* efficient, but our code much simpler. * efficient, but our code much simpler.
*/ */
private static final Map encodingToSequenceMap; private static final Map<String, ControlSequence> encodingToSequenceMap;
/** /**
* The keys of 'encodingToSequenceMap', sorted in preferential order. * The keys of 'encodingToSequenceMap', sorted in preferential order.
*/ */
private static final List encodings; private static final List<String> encodings;
static { static {
HashMap tSequenceToEncodingMap = new HashMap(33, 1.0f); HashMap<ControlSequence, String> tSequenceToEncodingMap =
HashMap tHighBitsMap = new HashMap(31, 1.0f); new HashMap<>(33, 1.0f);
HashMap tEncodingToSequenceMap = new HashMap(21, 1.0f); HashMap<ControlSequence, Boolean> tHighBitsMap =
ArrayList tEncodings = new ArrayList(21); new HashMap<>(31, 1.0f);
HashMap<String, ControlSequence> tEncodingToSequenceMap =
new HashMap<>(21, 1.0f);
ArrayList<String> tEncodings = new ArrayList<>(21);
if (!(isEncodingSupported("US-ASCII") && if (!(isEncodingSupported("US-ASCII") &&
isEncodingSupported("ISO-8859-1"))) isEncodingSupported("ISO-8859-1")))
...@@ -457,13 +460,12 @@ final class CompoundTextSupport { ...@@ -457,13 +460,12 @@ final class CompoundTextSupport {
return getNonStandardDecoder(escSequence, null); return getNonStandardDecoder(escSequence, null);
} }
static boolean getHighBit(byte[] escSequence) { static boolean getHighBit(byte[] escSequence) {
Boolean bool = (Boolean)highBitsMap.get Boolean bool = highBitsMap.get(new ControlSequence(escSequence));
(new ControlSequence(escSequence));
return (bool == Boolean.TRUE); return (bool == Boolean.TRUE);
} }
static CharsetDecoder getNonStandardDecoder(byte[] escSequence, static CharsetDecoder getNonStandardDecoder(byte[] escSequence,
byte[] encoding) { byte[] encoding) {
return getDecoder((String)sequenceToEncodingMap.get return getDecoder(sequenceToEncodingMap.get
(new ControlSequence(escSequence, encoding))); (new ControlSequence(escSequence, encoding)));
} }
static CharsetDecoder getDecoder(String enc) { static CharsetDecoder getDecoder(String enc) {
...@@ -474,7 +476,7 @@ final class CompoundTextSupport { ...@@ -474,7 +476,7 @@ final class CompoundTextSupport {
try { try {
cs = Charset.forName(enc); cs = Charset.forName(enc);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Class cls; Class<?> cls;
try { try {
cls = Class.forName("sun.awt.motif." + enc); cls = Class.forName("sun.awt.motif." + enc);
} catch (ClassNotFoundException ee) { } catch (ClassNotFoundException ee) {
...@@ -497,22 +499,20 @@ final class CompoundTextSupport { ...@@ -497,22 +499,20 @@ final class CompoundTextSupport {
// For Encoder // For Encoder
static byte[] getEscapeSequence(String encoding) { static byte[] getEscapeSequence(String encoding) {
ControlSequence seq = (ControlSequence) ControlSequence seq = encodingToSequenceMap.get(encoding);
encodingToSequenceMap.get(encoding);
if (seq != null) { if (seq != null) {
return seq.escSequence; return seq.escSequence;
} }
return null; return null;
} }
static byte[] getEncoding(String encoding) { static byte[] getEncoding(String encoding) {
ControlSequence seq = (ControlSequence) ControlSequence seq = encodingToSequenceMap.get(encoding);
encodingToSequenceMap.get(encoding);
if (seq != null) { if (seq != null) {
return seq.encoding; return seq.encoding;
} }
return null; return null;
} }
static List getEncodings() { static List<String> getEncodings() {
return encodings; return encodings;
} }
static CharsetEncoder getEncoder(String enc) { static CharsetEncoder getEncoder(String enc) {
...@@ -523,7 +523,7 @@ final class CompoundTextSupport { ...@@ -523,7 +523,7 @@ final class CompoundTextSupport {
try { try {
cs = Charset.forName(enc); cs = Charset.forName(enc);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Class cls; Class<?> cls;
try { try {
cls = Class.forName("sun.awt.motif." + enc); cls = Class.forName("sun.awt.motif." + enc);
} catch (ClassNotFoundException ee) { } catch (ClassNotFoundException ee) {
......
...@@ -37,6 +37,8 @@ import java.util.Properties; ...@@ -37,6 +37,8 @@ import java.util.Properties;
* Linux implementation of HotSpotVirtualMachine * Linux implementation of HotSpotVirtualMachine
*/ */
public class LinuxVirtualMachine extends HotSpotVirtualMachine { public class LinuxVirtualMachine extends HotSpotVirtualMachine {
// temp directory for socket file
private static final String tmpdir = System.getProperty("java.io.tmpdir");
// Indicates if this machine uses the old LinuxThreads // Indicates if this machine uses the old LinuxThreads
static boolean isLinuxThreads; static boolean isLinuxThreads;
...@@ -260,7 +262,7 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine { ...@@ -260,7 +262,7 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine {
// Return the socket file for the given process. // Return the socket file for the given process.
// Checks working directory of process for .java_pid<pid>. If not // Checks working directory of process for .java_pid<pid>. If not
// found it looks in /tmp. // found it looks in temp directory.
private String findSocketFile(int pid) { private String findSocketFile(int pid) {
// First check for a .java_pid<pid> file in the working directory // First check for a .java_pid<pid> file in the working directory
// of the target process // of the target process
...@@ -268,20 +270,17 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine { ...@@ -268,20 +270,17 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine {
String path = "/proc/" + pid + "/cwd/" + fn; String path = "/proc/" + pid + "/cwd/" + fn;
File f = new File(path); File f = new File(path);
if (!f.exists()) { if (!f.exists()) {
// Not found, so try /tmp // Not found, so try temp directory
path = "/tmp/" + fn; f = new File(tmpdir, fn);
f = new File(path); path = f.exists() ? f.getPath() : null;
if (!f.exists()) {
return null; // not found
}
} }
return path; return path;
} }
// On Solaris/Linux a simple handshake is used to start the attach mechanism // On Solaris/Linux a simple handshake is used to start the attach mechanism
// if not already started. The client creates a .attach_pid<pid> file in the // if not already started. The client creates a .attach_pid<pid> file in the
// target VM's working directory (or /tmp), and the SIGQUIT handler checks // target VM's working directory (or temp directory), and the SIGQUIT handler
// for the file. // checks for the file.
private File createAttachFile(int pid) throws IOException { private File createAttachFile(int pid) throws IOException {
String fn = ".attach_pid" + pid; String fn = ".attach_pid" + pid;
String path = "/proc/" + pid + "/cwd/" + fn; String path = "/proc/" + pid + "/cwd/" + fn;
...@@ -289,8 +288,7 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine { ...@@ -289,8 +288,7 @@ public class LinuxVirtualMachine extends HotSpotVirtualMachine {
try { try {
f.createNewFile(); f.createNewFile();
} catch (IOException x) { } catch (IOException x) {
path = "/tmp/" + fn; f = new File(tmpdir, fn);
f = new File(path);
f.createNewFile(); f.createNewFile();
} }
return f; return f;
......
...@@ -38,6 +38,11 @@ import java.util.Properties; ...@@ -38,6 +38,11 @@ import java.util.Properties;
* Solaris implementation of HotSpotVirtualMachine. * Solaris implementation of HotSpotVirtualMachine.
*/ */
public class SolarisVirtualMachine extends HotSpotVirtualMachine { public class SolarisVirtualMachine extends HotSpotVirtualMachine {
// Use /tmp instead of /var/tmp on Solaris as /tmp is the default used by
// HotSpot when the property is not set on the command line.
private static final String tmpdir1 = System.getProperty("java.io.tmpdir");
private static final String tmpdir =
(tmpdir1.equals("/var/tmp") || tmpdir1.equals("/var/tmp/")) ? "/tmp" : tmpdir1;
// door descriptor; // door descriptor;
private int fd = -1; private int fd = -1;
...@@ -187,7 +192,7 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine { ...@@ -187,7 +192,7 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine {
} }
// The door is attached to .java_pid<pid> in the target VM's working // The door is attached to .java_pid<pid> in the target VM's working
// directory or /tmp. // directory or temporary directory.
private int openDoor(int pid) throws IOException { private int openDoor(int pid) throws IOException {
// First check for a .java_pid<pid> file in the working directory // First check for a .java_pid<pid> file in the working directory
// of the target process // of the target process
...@@ -196,7 +201,7 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine { ...@@ -196,7 +201,7 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine {
try { try {
fd = open(path); fd = open(path);
} catch (FileNotFoundException fnf) { } catch (FileNotFoundException fnf) {
path = "/tmp/" + fn; path = tmpdir + "/" + fn;
fd = open(path); fd = open(path);
} }
...@@ -213,8 +218,8 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine { ...@@ -213,8 +218,8 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine {
// On Solaris/Linux a simple handshake is used to start the attach mechanism // On Solaris/Linux a simple handshake is used to start the attach mechanism
// if not already started. The client creates a .attach_pid<pid> file in the // if not already started. The client creates a .attach_pid<pid> file in the
// target VM's working directory (or /tmp), and the SIGQUIT handler checks // target VM's working directory (or temporary directory), and the SIGQUIT
// for the file. // handler checks for the file.
private File createAttachFile(int pid) throws IOException { private File createAttachFile(int pid) throws IOException {
String fn = ".attach_pid" + pid; String fn = ".attach_pid" + pid;
String path = "/proc/" + pid + "/cwd/" + fn; String path = "/proc/" + pid + "/cwd/" + fn;
...@@ -222,8 +227,7 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine { ...@@ -222,8 +227,7 @@ public class SolarisVirtualMachine extends HotSpotVirtualMachine {
try { try {
f.createNewFile(); f.createNewFile();
} catch (IOException x) { } catch (IOException x) {
path = "/tmp/" + fn; f = new File(tmpdir, fn);
f = new File(path);
f.createNewFile(); f.createNewFile();
} }
return f; return f;
......
...@@ -52,11 +52,15 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit ...@@ -52,11 +52,15 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
{ {
if (dialog != NULL) if (dialog != NULL)
{ {
fp_gdk_threads_enter();
fp_gtk_widget_hide (dialog); fp_gtk_widget_hide (dialog);
fp_gtk_widget_destroy (dialog); fp_gtk_widget_destroy (dialog);
fp_gtk_main_quit (); fp_gtk_main_quit ();
dialog = NULL; dialog = NULL;
fp_gdk_threads_leave();
} }
} }
...@@ -162,7 +166,6 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer, ...@@ -162,7 +166,6 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
(*env)->GetJavaVM(env, &jvm); (*env)->GetJavaVM(env, &jvm);
} }
fp_gdk_threads_init();
fp_gdk_threads_enter(); fp_gdk_threads_enter();
const char *title = (*env)->GetStringUTFChars(env, jtitle, 0); const char *title = (*env)->GetStringUTFChars(env, jtitle, 0);
......
...@@ -159,7 +159,7 @@ final class ProcessImpl extends Process { ...@@ -159,7 +159,7 @@ final class ProcessImpl extends Process {
new java.security.PrivilegedAction<Void>() { new java.security.PrivilegedAction<Void>() {
public Void run() { public Void run() {
if (stdHandles[0] == -1L) if (stdHandles[0] == -1L)
stdin_stream = new ProcessBuilder.NullOutputStream(); stdin_stream = ProcessBuilder.NullOutputStream.INSTANCE;
else { else {
FileDescriptor stdin_fd = new FileDescriptor(); FileDescriptor stdin_fd = new FileDescriptor();
fdAccess.setHandle(stdin_fd, stdHandles[0]); fdAccess.setHandle(stdin_fd, stdHandles[0]);
...@@ -168,7 +168,7 @@ final class ProcessImpl extends Process { ...@@ -168,7 +168,7 @@ final class ProcessImpl extends Process {
} }
if (stdHandles[1] == -1L) if (stdHandles[1] == -1L)
stdout_stream = new ProcessBuilder.NullInputStream(); stdout_stream = ProcessBuilder.NullInputStream.INSTANCE;
else { else {
FileDescriptor stdout_fd = new FileDescriptor(); FileDescriptor stdout_fd = new FileDescriptor();
fdAccess.setHandle(stdout_fd, stdHandles[1]); fdAccess.setHandle(stdout_fd, stdHandles[1]);
...@@ -177,7 +177,7 @@ final class ProcessImpl extends Process { ...@@ -177,7 +177,7 @@ final class ProcessImpl extends Process {
} }
if (stdHandles[2] == -1L) if (stdHandles[2] == -1L)
stderr_stream = new ProcessBuilder.NullInputStream(); stderr_stream = ProcessBuilder.NullInputStream.INSTANCE;
else { else {
FileDescriptor stderr_fd = new FileDescriptor(); FileDescriptor stderr_fd = new FileDescriptor();
fdAccess.setHandle(stderr_fd, stdHandles[2]); fdAccess.setHandle(stderr_fd, stdHandles[2]);
......
...@@ -154,7 +154,7 @@ static int CALLBACK EnumFontFacesInFamilyProcA( ...@@ -154,7 +154,7 @@ static int CALLBACK EnumFontFacesInFamilyProcA(
fullname = JNU_NewStringPlatform(env, lpelfe->elfFullName); fullname = JNU_NewStringPlatform(env, lpelfe->elfFullName);
fullnameLC = (*env)->CallObjectMethod(env, fullname, fullnameLC = (*env)->CallObjectMethod(env, fullname,
fmi->toLowerCaseMID, fmi->locale); fmi->toLowerCaseMID, fmi->locale);
(*env)->CallObjectMethod(env, fmi->list, fmi->addMID, fullname); (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
(*env)->CallObjectMethod(env, fmi->fontToFamilyMap, (*env)->CallObjectMethod(env, fmi->fontToFamilyMap,
fmi->putMID, fullnameLC, fmi->family); fmi->putMID, fullnameLC, fmi->family);
return 1; return 1;
...@@ -238,7 +238,7 @@ static int CALLBACK EnumFontFacesInFamilyProcW( ...@@ -238,7 +238,7 @@ static int CALLBACK EnumFontFacesInFamilyProcW(
wcslen((LPWSTR)lpelfe->elfFullName)); wcslen((LPWSTR)lpelfe->elfFullName));
fullnameLC = (*env)->CallObjectMethod(env, fullname, fullnameLC = (*env)->CallObjectMethod(env, fullname,
fmi->toLowerCaseMID, fmi->locale); fmi->toLowerCaseMID, fmi->locale);
(*env)->CallObjectMethod(env, fmi->list, fmi->addMID, fullname); (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
(*env)->CallObjectMethod(env, fmi->fontToFamilyMap, (*env)->CallObjectMethod(env, fmi->fontToFamilyMap,
fmi->putMID, fullnameLC, fmi->family); fmi->putMID, fullnameLC, fmi->family);
return 1; return 1;
......
...@@ -120,6 +120,12 @@ Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jobject this, ...@@ -120,6 +120,12 @@ Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jobject this,
rv = connect((SOCKET)fd, (struct sockaddr *)&sa, sa_len); rv = connect((SOCKET)fd, (struct sockaddr *)&sa, sa_len);
if (rv == SOCKET_ERROR) { if (rv == SOCKET_ERROR) {
handleSocketError(env, WSAGetLastError()); handleSocketError(env, WSAGetLastError());
} else {
/* Disable WSAECONNRESET errors as socket is no longer connected */
BOOL enable = FALSE;
DWORD bytesReturned = 0;
WSAIoctl((SOCKET)fd, SIO_UDP_CONNRESET, &enable, sizeof(enable),
NULL, 0, &bytesReturned, NULL, NULL);
} }
} }
......
...@@ -67,6 +67,14 @@ typedef struct my_group_source_req { ...@@ -67,6 +67,14 @@ typedef struct my_group_source_req {
#define COPY_INET6_ADDRESS(env, source, target) \ #define COPY_INET6_ADDRESS(env, source, target) \
(*env)->GetByteArrayRegion(env, source, 0, 16, target) (*env)->GetByteArrayRegion(env, source, 0, 16, target)
/**
* Enable or disable receipt of WSAECONNRESET errors.
*/
static void setConnectionReset(SOCKET s, BOOL enable) {
DWORD bytesReturned = 0;
WSAIoctl(s, SIO_UDP_CONNRESET, &enable, sizeof(enable),
NULL, 0, &bytesReturned, NULL, NULL);
}
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
...@@ -109,6 +117,12 @@ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6, ...@@ -109,6 +117,12 @@ Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
(const char *)&opt, sizeof(opt)); (const char *)&opt, sizeof(opt));
} }
/* Disable WSAECONNRESET errors for initially unconnected UDP sockets */
if (!stream) {
setConnectionReset(s, FALSE);
}
} else { } else {
NET_ThrowNew(env, WSAGetLastError(), "socket"); NET_ThrowNew(env, WSAGetLastError(), "socket");
} }
...@@ -149,12 +163,13 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6, job ...@@ -149,12 +163,13 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6, job
SOCKETADDRESS sa; SOCKETADDRESS sa;
int rv; int rv;
int sa_len; int sa_len;
SOCKET s = (SOCKET)fdval(env, fdo);
if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *)&sa, &sa_len, preferIPv6) != 0) { if (NET_InetAddressToSockaddr(env, iao, port, (struct sockaddr *)&sa, &sa_len, preferIPv6) != 0) {
return IOS_THROWN; return IOS_THROWN;
} }
rv = connect(fdval(env, fdo), (struct sockaddr *)&sa, sa_len); rv = connect(s, (struct sockaddr *)&sa, sa_len);
if (rv != 0) { if (rv != 0) {
int err = WSAGetLastError(); int err = WSAGetLastError();
if (err == WSAEINPROGRESS || err == WSAEWOULDBLOCK) { if (err == WSAEINPROGRESS || err == WSAEWOULDBLOCK) {
...@@ -162,6 +177,13 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6, job ...@@ -162,6 +177,13 @@ Java_sun_nio_ch_Net_connect0(JNIEnv *env, jclass clazz, jboolean preferIPv6, job
} }
NET_ThrowNew(env, err, "connect"); NET_ThrowNew(env, err, "connect");
return IOS_THROWN; return IOS_THROWN;
} else {
/* Enable WSAECONNRESET errors when a UDP socket is connected */
int type = 0, optlen = sizeof(type);
rv = getsockopt(s, SOL_SOCKET, SO_TYPE, (char*)&type, &optlen);
if (rv == 0 && type == SOCK_DGRAM) {
setConnectionReset(s, TRUE);
}
} }
return 1; return 1;
} }
......
...@@ -50,6 +50,10 @@ Java_sun_nio_ch_SocketDispatcher_read0(JNIEnv *env, jclass clazz, jobject fdo, ...@@ -50,6 +50,10 @@ Java_sun_nio_ch_SocketDispatcher_read0(JNIEnv *env, jclass clazz, jobject fdo,
jint fd = fdval(env, fdo); jint fd = fdval(env, fdo);
WSABUF buf; WSABUF buf;
/* limit size */
if (len > MAX_BUFFER_SIZE)
len = MAX_BUFFER_SIZE;
/* destination buffer and size */ /* destination buffer and size */
buf.buf = (char *)address; buf.buf = (char *)address;
buf.len = (u_long)len; buf.len = (u_long)len;
...@@ -86,6 +90,7 @@ Java_sun_nio_ch_SocketDispatcher_readv0(JNIEnv *env, jclass clazz, jobject fdo, ...@@ -86,6 +90,7 @@ Java_sun_nio_ch_SocketDispatcher_readv0(JNIEnv *env, jclass clazz, jobject fdo,
jint fd = fdval(env, fdo); jint fd = fdval(env, fdo);
struct iovec *iovp = (struct iovec *)address; struct iovec *iovp = (struct iovec *)address;
WSABUF *bufs = malloc(len * sizeof(WSABUF)); WSABUF *bufs = malloc(len * sizeof(WSABUF));
jint rem = MAX_BUFFER_SIZE;
if (bufs == 0) { if (bufs == 0) {
JNU_ThrowOutOfMemoryError(env, 0); JNU_ThrowOutOfMemoryError(env, 0);
...@@ -98,8 +103,16 @@ Java_sun_nio_ch_SocketDispatcher_readv0(JNIEnv *env, jclass clazz, jobject fdo, ...@@ -98,8 +103,16 @@ Java_sun_nio_ch_SocketDispatcher_readv0(JNIEnv *env, jclass clazz, jobject fdo,
/* copy iovec into WSABUF */ /* copy iovec into WSABUF */
for(i=0; i<len; i++) { for(i=0; i<len; i++) {
jint iov_len = iovp[i].iov_len;
if (iov_len > rem)
iov_len = rem;
bufs[i].buf = (char *)iovp[i].iov_base; bufs[i].buf = (char *)iovp[i].iov_base;
bufs[i].len = (u_long)iovp[i].iov_len; bufs[i].len = (u_long)iov_len;
rem -= iov_len;
if (rem == 0) {
len = i+1;
break;
}
} }
/* read into the buffers */ /* read into the buffers */
...@@ -136,6 +149,10 @@ Java_sun_nio_ch_SocketDispatcher_write0(JNIEnv *env, jclass clazz, jobject fdo, ...@@ -136,6 +149,10 @@ Java_sun_nio_ch_SocketDispatcher_write0(JNIEnv *env, jclass clazz, jobject fdo,
jint fd = fdval(env, fdo); jint fd = fdval(env, fdo);
WSABUF buf; WSABUF buf;
/* limit size */
if (len > MAX_BUFFER_SIZE)
len = MAX_BUFFER_SIZE;
/* copy iovec into WSABUF */ /* copy iovec into WSABUF */
buf.buf = (char *)address; buf.buf = (char *)address;
buf.len = (u_long)len; buf.len = (u_long)len;
...@@ -171,6 +188,7 @@ Java_sun_nio_ch_SocketDispatcher_writev0(JNIEnv *env, jclass clazz, ...@@ -171,6 +188,7 @@ Java_sun_nio_ch_SocketDispatcher_writev0(JNIEnv *env, jclass clazz,
jint fd = fdval(env, fdo); jint fd = fdval(env, fdo);
struct iovec *iovp = (struct iovec *)address; struct iovec *iovp = (struct iovec *)address;
WSABUF *bufs = malloc(len * sizeof(WSABUF)); WSABUF *bufs = malloc(len * sizeof(WSABUF));
jint rem = MAX_BUFFER_SIZE;
if (bufs == 0) { if (bufs == 0) {
JNU_ThrowOutOfMemoryError(env, 0); JNU_ThrowOutOfMemoryError(env, 0);
...@@ -183,8 +201,16 @@ Java_sun_nio_ch_SocketDispatcher_writev0(JNIEnv *env, jclass clazz, ...@@ -183,8 +201,16 @@ Java_sun_nio_ch_SocketDispatcher_writev0(JNIEnv *env, jclass clazz,
/* copy iovec into WSABUF */ /* copy iovec into WSABUF */
for(i=0; i<len; i++) { for(i=0; i<len; i++) {
jint iov_len = iovp[i].iov_len;
if (iov_len > rem)
iov_len = rem;
bufs[i].buf = (char *)iovp[i].iov_base; bufs[i].buf = (char *)iovp[i].iov_base;
bufs[i].len = (u_long)iovp[i].iov_len; bufs[i].len = (u_long)iov_len;
rem -= iov_len;
if (rem == 0) {
len = i+1;
break;
}
} }
/* read into the buffers */ /* read into the buffers */
......
...@@ -25,6 +25,14 @@ ...@@ -25,6 +25,14 @@
#include "jni.h" #include "jni.h"
/**
* The maximum buffer size for WSASend/WSARecv. Microsoft recommendation for
* blocking operations is to use buffers no larger than 64k. We need the
* maximum to be less than 128k to support asynchronous close on Windows
* Server 2003 and newer editions of Windows.
*/
#define MAX_BUFFER_SIZE ((128*1024)-1)
jint fdval(JNIEnv *env, jobject fdo); jint fdval(JNIEnv *env, jobject fdo);
jlong handleval(JNIEnv *env, jobject fdo); jlong handleval(JNIEnv *env, jobject fdo);
jboolean isNT(); jboolean isNT();
......
...@@ -307,7 +307,7 @@ BUNDLE_UP_AND_EXIT = \ ...@@ -307,7 +307,7 @@ BUNDLE_UP_AND_EXIT = \
passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
$(ECHO) "TEST STATS: run=$${runc} pass=$${passc} fail=$${failc} excluded=$${exclc}" \ $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc} excluded=$${exclc}" \
>> $(STATS_TXT); \ >> $(STATS_TXT); \
else \ else \
$(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \ $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
...@@ -326,7 +326,7 @@ all: jtreg_tests ...@@ -326,7 +326,7 @@ all: jtreg_tests
# Prep for output # Prep for output
prep: clean prep: clean
@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
@$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` @$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
# Cleanup # Cleanup
clean: clean:
...@@ -376,7 +376,7 @@ else ...@@ -376,7 +376,7 @@ else
$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS) $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
@$(RM) $@ $@.temp1 $@.temp2 @$(RM) $@ $@.temp1 $@.temp2
@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\ @(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)' ) ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)' ) ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)' ) ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)' ) ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)' ) ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)' ) ;\
...@@ -562,7 +562,7 @@ jdk_tools1: com/sun/jdi ...@@ -562,7 +562,7 @@ jdk_tools1: com/sun/jdi
JDK_ALL_TARGETS += jdk_tools2 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 SharedLibraryPermissions,tools/launcher) $(call SharedLibraryPermissions,tools/launcher)
$(call RunOthervmBatch) $(call RunSamevmBatch)
# All tools tests # All tools tests
jdk_tools: jdk_tools1 jdk_tools2 jdk_tools: jdk_tools1 jdk_tools2
......
此差异已折叠。
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
/** /**
* @test * @test
* @bug 6517249 * @bug 6517249
* @ignore 6951287
* @summary JDWP: Cannot do an invokeMethod after a popFrames operation * @summary JDWP: Cannot do an invokeMethod after a popFrames operation
* *
* @author jjh * @author jjh
......
...@@ -56,8 +56,17 @@ public class FindServiceTags { ...@@ -56,8 +56,17 @@ public class FindServiceTags {
private static int expectedUrnCount = 3; private static int expectedUrnCount = 3;
public static void main(String[] argv) throws Exception { public static void main(String[] argv) throws Exception {
registry = Util.getSvcTagClientRegistry(); try {
registry = Util.getSvcTagClientRegistry();
runTest();
} finally {
// restore empty registry file
Util.emptyRegistryFile();
}
System.out.println("Test passed.");
}
public static void runTest() throws Exception {
for (String filename : files) { for (String filename : files) {
File f = new File(servicetagDir, filename); File f = new File(servicetagDir, filename);
ServiceTag svcTag = Util.newServiceTag(f); ServiceTag svcTag = Util.newServiceTag(f);
...@@ -95,7 +104,6 @@ public class FindServiceTags { ...@@ -95,7 +104,6 @@ public class FindServiceTags {
tags.size()); tags.size());
} }
System.out.println("Test passed.");
} }
private static void findServiceTags(String productUrn) throws Exception { private static void findServiceTags(String productUrn) throws Exception {
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* are both created correctly. * are both created correctly.
* @author Mandy Chung * @author Mandy Chung
* *
* @run build JavaServiceTagTest1 * @run build JavaServiceTagTest1 SvcTagClient Util
* @run main JavaServiceTagTest1 * @run main JavaServiceTagTest1
*/ */
...@@ -46,6 +46,16 @@ public class JavaServiceTagTest1 { ...@@ -46,6 +46,16 @@ public class JavaServiceTagTest1 {
private static File svcTagFile; private static File svcTagFile;
private static Registry registry; private static Registry registry;
public static void main(String[] argv) throws Exception { public static void main(String[] argv) throws Exception {
try {
registry = Util.getSvcTagClientRegistry();
runTest();
} finally {
// restore empty registry file
Util.emptyRegistryFile();
}
}
private static void runTest() throws Exception {
// cleanup the registration.xml and servicetag file in the test directory // cleanup the registration.xml and servicetag file in the test directory
System.setProperty("servicetag.dir.path", registrationDir); System.setProperty("servicetag.dir.path", registrationDir);
regFile = new File(registrationDir, "registration.xml"); regFile = new File(registrationDir, "registration.xml");
...@@ -54,8 +64,6 @@ public class JavaServiceTagTest1 { ...@@ -54,8 +64,6 @@ public class JavaServiceTagTest1 {
svcTagFile = new File(registrationDir, "servicetag"); svcTagFile = new File(registrationDir, "servicetag");
svcTagFile.delete(); svcTagFile.delete();
registry = Util.getSvcTagClientRegistry();
// verify that only one service tag is created // verify that only one service tag is created
ServiceTag st1 = testJavaServiceTag("Test1"); ServiceTag st1 = testJavaServiceTag("Test1");
......
...@@ -50,8 +50,16 @@ public class SystemRegistryTest { ...@@ -50,8 +50,16 @@ public class SystemRegistryTest {
private static Registry registry; private static Registry registry;
public static void main(String[] argv) throws Exception { public static void main(String[] argv) throws Exception {
registry = Util.getSvcTagClientRegistry(); try {
registry = Util.getSvcTagClientRegistry();
runTest();
} finally {
// restore empty registry file
Util.emptyRegistryFile();
}
}
private static void runTest() throws Exception {
for (String filename : files) { for (String filename : files) {
File f = new File(servicetagDir, filename); File f = new File(servicetagDir, filename);
ServiceTag svcTag = Util.newServiceTag(f); ServiceTag svcTag = Util.newServiceTag(f);
......
...@@ -219,25 +219,25 @@ public class Util { ...@@ -219,25 +219,25 @@ public class Util {
} }
private static Registry registry = null; private static Registry registry = null;
private static File registryFile = null;
/** /**
* Returns the Registry processed by SvcTagClient that simulates * Returns the Registry processed by SvcTagClient that simulates
* stclient. * stclient.
*/ */
static synchronized Registry getSvcTagClientRegistry() throws IOException { static synchronized Registry getSvcTagClientRegistry() throws IOException {
String regDir = System.getProperty("test.classes");
File f = new File(regDir, "registry.xml");
if (registry != null) { if (registry != null) {
if (!f.equals(registryFile) && f.length() != 0) {
throw new AssertionError("Has to be empty registry.xml to run in samevm");
}
return registry; return registry;
} }
// System.setProperty("servicetag.verbose", "true"); // System.setProperty("servicetag.verbose", "true");
// enable the helper class // enable the helper class
System.setProperty("servicetag.sthelper.supported", "true"); System.setProperty("servicetag.sthelper.supported", "true");
registryFile = f;
// clean up registry.xml
String regDir = System.getProperty("test.classes");
File registryFile = new File(regDir, "registry.xml");
if (registryFile.exists()) {
registryFile.delete();
}
String stclientCmd = Util.getSvcClientCommand(registryFile.getCanonicalPath()); String stclientCmd = Util.getSvcClientCommand(registryFile.getCanonicalPath());
System.out.println("stclient cmd: " + stclientCmd); System.out.println("stclient cmd: " + stclientCmd);
...@@ -247,4 +247,17 @@ public class Util { ...@@ -247,4 +247,17 @@ public class Util {
registry = Registry.getSystemRegistry(); registry = Registry.getSystemRegistry();
return registry; return registry;
} }
static void emptyRegistryFile() throws IOException {
if (registryFile.exists()) {
BufferedOutputStream out = new BufferedOutputStream(
new FileOutputStream(registryFile));
try {
RegistrationData data = new RegistrationData();
data.storeToXML(out);
} finally {
out.close();
}
}
}
} }
...@@ -37,6 +37,21 @@ then ...@@ -37,6 +37,21 @@ then
exit 1 exit 1
fi fi
# Windows 2000 is a problem here, so we skip it, see 6962615
osrev=`uname -a`
if [ "`echo ${osrev} | grep 'CYGWIN'`" != "" ] ; then
if [ "`echo ${osrev} | grep '5.0'`" != "" ] ; then
echo "Treating as a pass, not testing Windows 2000"
exit 0
fi
fi
if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then
if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then
echo "Treating as a pass, not testing Windows 2000"
exit 0
fi
fi
. ${TESTSRC}/CommonSetup.sh . ${TESTSRC}/CommonSetup.sh
. ${TESTSRC}/ApplicationSetup.sh . ${TESTSRC}/ApplicationSetup.sh
. ${TESTSRC}/AgentSetup.sh . ${TESTSRC}/AgentSetup.sh
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
/** /**
* @test * @test
* @bug 6537506 * @bug 6537506
* @ignore 6962535
* @summary Basic unit test for tracing framework * @summary Basic unit test for tracing framework
*/ */
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册