mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 03:54:33 +02:00
Merge
This commit is contained in:
commit
0850f3ec01
7 changed files with 122 additions and 48 deletions
|
@ -475,7 +475,7 @@ public class Installer {
|
||||||
|
|
||||||
String filename = "/com/sun/servicetag/resources/javase_" +
|
String filename = "/com/sun/servicetag/resources/javase_" +
|
||||||
version + "_swordfish.properties";
|
version + "_swordfish.properties";
|
||||||
InputStream in = Installer.class.getClass().getResourceAsStream(filename);
|
InputStream in = Installer.class.getResourceAsStream(filename);
|
||||||
if (in == null) {
|
if (in == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +813,7 @@ public class Installer {
|
||||||
locale,
|
locale,
|
||||||
String.valueOf(version)).toString();
|
String.valueOf(version)).toString();
|
||||||
try {
|
try {
|
||||||
in = Installer.class.getClass().getResourceAsStream(resource + ".html");
|
in = Installer.class.getResourceAsStream(resource + ".html");
|
||||||
if (in == null) {
|
if (in == null) {
|
||||||
// if the resource file is missing
|
// if the resource file is missing
|
||||||
if (isVerbose()) {
|
if (isVerbose()) {
|
||||||
|
@ -825,34 +825,39 @@ public class Installer {
|
||||||
System.out.println("Generating " + f + " from " + resource + ".html");
|
System.out.println("Generating " + f + " from " + resource + ".html");
|
||||||
}
|
}
|
||||||
|
|
||||||
br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
|
try {
|
||||||
pw = new PrintWriter(f, "UTF-8");
|
br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
|
||||||
String line = null;
|
pw = new PrintWriter(f, "UTF-8");
|
||||||
while ((line = br.readLine()) != null) {
|
String line = null;
|
||||||
String output = line;
|
while ((line = br.readLine()) != null) {
|
||||||
if (line.contains(JDK_VERSION_KEY)) {
|
String output = line;
|
||||||
output = line.replace(JDK_VERSION_KEY, jdkVersion);
|
if (line.contains(JDK_VERSION_KEY)) {
|
||||||
} else if (line.contains(JDK_HEADER_PNG_KEY)) {
|
output = line.replace(JDK_VERSION_KEY, jdkVersion);
|
||||||
output = line.replace(JDK_HEADER_PNG_KEY, headerImageSrc);
|
} else if (line.contains(JDK_HEADER_PNG_KEY)) {
|
||||||
} else if (line.contains(REGISTRATION_URL_KEY)) {
|
output = line.replace(JDK_HEADER_PNG_KEY, headerImageSrc);
|
||||||
output = line.replace(REGISTRATION_URL_KEY, registerURL);
|
} else if (line.contains(REGISTRATION_URL_KEY)) {
|
||||||
} else if (line.contains(REGISTRATION_PAYLOAD_KEY)) {
|
output = line.replace(REGISTRATION_URL_KEY, registerURL);
|
||||||
output = line.replace(REGISTRATION_PAYLOAD_KEY, payload.toString());
|
} else if (line.contains(REGISTRATION_PAYLOAD_KEY)) {
|
||||||
|
output = line.replace(REGISTRATION_PAYLOAD_KEY, payload.toString());
|
||||||
|
}
|
||||||
|
pw.println(output);
|
||||||
|
}
|
||||||
|
f.setReadOnly();
|
||||||
|
pw.flush();
|
||||||
|
} finally {
|
||||||
|
// It's safe for this finally block to have two close statements
|
||||||
|
// consecutively as PrintWriter.close doesn't throw IOException.
|
||||||
|
if (pw != null) {
|
||||||
|
pw.close();
|
||||||
|
}
|
||||||
|
if (br!= null) {
|
||||||
|
br.close();
|
||||||
}
|
}
|
||||||
pw.println(output);
|
|
||||||
}
|
}
|
||||||
f.setReadOnly();
|
|
||||||
pw.flush();
|
|
||||||
} finally {
|
} finally {
|
||||||
if (pw != null) {
|
|
||||||
pw.close();
|
|
||||||
}
|
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
if (br!= null) {
|
|
||||||
br.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,8 @@ class SolarisSystemEnvironment extends SystemEnvironment {
|
||||||
return "Sun Microsystems, Inc";
|
return "Sun Microsystems, Inc";
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're here, then we'll try smbios (type 3)
|
// if we're here, then we'll try smbios (type 4)
|
||||||
return getSmbiosData("3", "Manufacturer: ");
|
return getSmbiosData("4", "Manufacturer: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -213,10 +213,16 @@ class SunConnection {
|
||||||
con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
|
con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
|
||||||
con.connect();
|
con.connect();
|
||||||
|
|
||||||
OutputStream out = con.getOutputStream();
|
OutputStream out = null;
|
||||||
registration.storeToXML(out);
|
try {
|
||||||
out.flush();
|
out = con.getOutputStream();
|
||||||
out.close();
|
registration.storeToXML(out);
|
||||||
|
out.flush();
|
||||||
|
} finally {
|
||||||
|
if (out != null) {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int returnCode = con.getResponseCode();
|
int returnCode = con.getResponseCode();
|
||||||
if (Util.isVerbose()) {
|
if (Util.isVerbose()) {
|
||||||
|
|
|
@ -140,11 +140,14 @@ class Util {
|
||||||
}
|
}
|
||||||
return e.getMessage();
|
return e.getMessage();
|
||||||
} finally {
|
} finally {
|
||||||
if (r != null) {
|
try {
|
||||||
r.close();
|
if (r != null) {
|
||||||
}
|
r.close();
|
||||||
if (err != null) {
|
}
|
||||||
err.close();
|
} finally {
|
||||||
|
if (err != null) {
|
||||||
|
err.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,11 +107,17 @@ class WindowsSystemEnvironment extends SystemEnvironment {
|
||||||
Process p = pb.start();
|
Process p = pb.start();
|
||||||
// need this for executing windows commands (at least
|
// need this for executing windows commands (at least
|
||||||
// needed for executing wmic command)
|
// needed for executing wmic command)
|
||||||
BufferedWriter bw = new BufferedWriter(
|
BufferedWriter bw = null;
|
||||||
new OutputStreamWriter(p.getOutputStream()));
|
try {
|
||||||
bw.write(13);
|
bw = new BufferedWriter(
|
||||||
bw.flush();
|
new OutputStreamWriter(p.getOutputStream()));
|
||||||
bw.close();
|
bw.write(13);
|
||||||
|
bw.flush();
|
||||||
|
} finally {
|
||||||
|
if (bw != null) {
|
||||||
|
bw.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p.waitFor();
|
p.waitFor();
|
||||||
if (p.exitValue() == 0) {
|
if (p.exitValue() == 0) {
|
||||||
|
|
|
@ -2377,7 +2377,7 @@ public class Cipher {
|
||||||
* For more information on default key size in JCE jurisdiction
|
* For more information on default key size in JCE jurisdiction
|
||||||
* policy files, please see Appendix E in the
|
* policy files, please see Appendix E in the
|
||||||
* <a href=
|
* <a href=
|
||||||
* "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppE">
|
* "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppC">
|
||||||
* Java Cryptography Architecture Reference Guide</a>.
|
* Java Cryptography Architecture Reference Guide</a>.
|
||||||
*
|
*
|
||||||
* @param transformation the cipher transformation.
|
* @param transformation the cipher transformation.
|
||||||
|
|
|
@ -57,15 +57,55 @@ package javax.management;
|
||||||
* what = "Unknown type " + n.getType();
|
* what = "Unknown type " + n.getType();
|
||||||
* System.out.println("Received MBean Server notification: " + what + ": " +
|
* System.out.println("Received MBean Server notification: " + what + ": " +
|
||||||
* mbsn.getMBeanName());
|
* mbsn.getMBeanName());
|
||||||
|
* }
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
* mbeanServer.addNotificationListener(
|
* mbeanServer.addNotificationListener(
|
||||||
* MBeanServerDelegate.DELEGATE_NAME, printListener, null, null);
|
* MBeanServerDelegate.DELEGATE_NAME, printListener, null, null);
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
* <p id="group">
|
||||||
* <p>The following code prints a message every time an MBean is registered
|
* An MBean which is not an {@link MBeanServerDelegate} may also emit
|
||||||
* or unregistered in the MBean Server {@code mbeanServer}:</p>
|
* MBeanServerNotifications. In particular, a custom subclass of the
|
||||||
|
* {@link javax.management.namespace.JMXDomain JMXDomain} MBean or a custom
|
||||||
|
* subclass of the {@link javax.management.namespace.JMXNamespace JMXNamespace}
|
||||||
|
* MBean may emit an MBeanServerNotification for a group of MBeans.<br>
|
||||||
|
* An MBeanServerNotification emitted to denote the registration or
|
||||||
|
* unregistration of a group of MBeans has the following characteristics:
|
||||||
|
* <ul><li>Its {@linkplain Notification#getType() notification type} is
|
||||||
|
* {@code "JMX.mbean.registered.group"} or
|
||||||
|
* {@code "JMX.mbean.unregistered.group"}, which can also be written {@link
|
||||||
|
* MBeanServerNotification#REGISTRATION_NOTIFICATION}{@code + ".group"} or
|
||||||
|
* {@link
|
||||||
|
* MBeanServerNotification#UNREGISTRATION_NOTIFICATION}{@code + ".group"}.
|
||||||
|
* </li>
|
||||||
|
* <li>Its {@linkplain #getMBeanName() MBean name} is an ObjectName pattern
|
||||||
|
* that selects the set (or a superset) of the MBeans being registered
|
||||||
|
* or unregistered</li>
|
||||||
|
* <li>Its {@linkplain Notification#getUserData() user data} can optionally
|
||||||
|
* be set to an array of ObjectNames containing the names of all MBeans
|
||||||
|
* being registered or unregistered.</li>
|
||||||
|
* </ul>
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* MBeans which emit these group registration/unregistration notifications will
|
||||||
|
* declare them in their {@link MBeanInfo#getNotifications()
|
||||||
|
* MBeanNotificationInfo}.
|
||||||
|
* </p>
|
||||||
|
* <P>
|
||||||
|
* To receive a group MBeanServerNotification, you need to register a listener
|
||||||
|
* with the MBean that emits it. For instance, assuming that the {@link
|
||||||
|
* javax.management.namespace.JMXNamespace JMXNamespace} MBean handling
|
||||||
|
* namespace {@code "foo"} has declared that it emits such a notification,
|
||||||
|
* you will need to register your notification listener with that MBean, which
|
||||||
|
* will be named {@link
|
||||||
|
* javax.management.namespace.JMXNamespaces#getNamespaceObjectName(java.lang.String)
|
||||||
|
* foo//:type=JMXNamespace}.
|
||||||
|
* </p>
|
||||||
|
* <p>The following code prints a message every time a group of MBean is
|
||||||
|
* registered or unregistered in the namespace {@code "foo"}, assumimg its
|
||||||
|
* {@link javax.management.namespace.JMXNamespace handler} supports
|
||||||
|
* group MBeanServerNotifications:</p>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* private static final NotificationListener printListener = new NotificationListener() {
|
* private static final NotificationListener printListener = new NotificationListener() {
|
||||||
|
@ -76,19 +116,33 @@ package javax.management;
|
||||||
* }
|
* }
|
||||||
* MBeanServerNotification mbsn = (MBeanServerNotification) n;
|
* MBeanServerNotification mbsn = (MBeanServerNotification) n;
|
||||||
* String what;
|
* String what;
|
||||||
* if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
|
* ObjectName[] names = null;
|
||||||
|
* if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
|
||||||
* what = "MBean registered";
|
* what = "MBean registered";
|
||||||
* else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION))
|
* } else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
|
||||||
* what = "MBean unregistered";
|
* what = "MBean unregistered";
|
||||||
* else
|
* } else if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION+".group")) {
|
||||||
|
* what = "Group of MBeans registered matching";
|
||||||
|
* if (mbsn.getUserData() instanceof ObjectName[])
|
||||||
|
* names = (ObjectName[]) mbsn.getUserData();
|
||||||
|
* } else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION+".group")) {
|
||||||
|
* what = "Group of MBeans unregistered matching";
|
||||||
|
* if (mbsn.getUserData() instanceof ObjectName[])
|
||||||
|
* names = (ObjectName[]) mbsn.getUserData();
|
||||||
|
* } else
|
||||||
* what = "Unknown type " + n.getType();
|
* what = "Unknown type " + n.getType();
|
||||||
* System.out.println("Received MBean Server notification: " + what + ": " +
|
* System.out.println("Received MBean Server notification: " + what + ": " +
|
||||||
* mbsn.getMBeanName());
|
* mbsn.getMBeanName());
|
||||||
|
* if (names != null) {
|
||||||
|
* for (ObjectName mb : names)
|
||||||
|
* System.out.println("\t"+mb);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
* mbeanServer.addNotificationListener(
|
* mbeanServer.addNotificationListener(
|
||||||
* MBeanServerDelegate.DELEGATE_NAME, printListener, null, null);
|
* JMXNamespaces.getNamespaceObjectName("foo"), printListener, null, null);
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue