inLocale
is null
*/
public String getDisplayVariant(Locale inLocale) {
- if (baseLocale.getVariant().length() == 0)
+ if (baseLocale.getVariant().isEmpty())
return "";
LocaleResources lr = LocaleProviderAdapter
@@ -1998,14 +1998,14 @@
// The display name consists of a main name, followed by qualifiers.
// Typically, the format is "MainName (Qualifier, Qualifier)" but this
// depends on what pattern is stored in the display locale.
- String mainName = null;
- String[] qualifierNames = null;
+ String mainName;
+ String[] qualifierNames;
// The main name is the language, or if there is no language, the script,
// then if no script, the country. If there is no language/script/country
// (an anomalous situation) then the display name is simply the variant's
// display name.
- if (languageName.length() == 0 && scriptName.length() == 0 && countryName.length() == 0) {
+ if (languageName.isEmpty() && scriptName.isEmpty() && countryName.isEmpty()) {
if (variantNames.length == 0) {
return "";
} else {
@@ -2013,13 +2013,13 @@
}
}
ArrayListFtpProtocolException
*/
public sun.net.ftp.FtpClient changeDirectory(String remoteDirectory) throws sun.net.ftp.FtpProtocolException, IOException {
- if (remoteDirectory == null || "".equals(remoteDirectory)) {
+ if (remoteDirectory == null || remoteDirectory.isEmpty()) {
throw new IllegalArgumentException("directory can't be null or empty");
}
@@ -1738,7 +1738,7 @@
* @throws IOException if an error occurs during the transmission.
*/
public long getSize(String path) throws sun.net.ftp.FtpProtocolException, IOException {
- if (path == null || path.length() == 0) {
+ if (path == null || path.isEmpty()) {
throw new IllegalArgumentException("path can't be null or empty");
}
issueCommandCheck("SIZE " + path);
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java
--- a/src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java Thu Dec 13 11:51:06 2018 -0800
@@ -238,7 +238,7 @@
if (phost != null && phost.length() != 0)
break;
}
- if (phost == null || phost.length() == 0) {
+ if (phost == null || phost.isEmpty()) {
/**
* No system property defined for that
* protocol. Let's check System Proxy
@@ -267,7 +267,7 @@
nprop.hostsSource = null;
nprop.pattern = null;
}
- } else if (nphosts.length() != 0) {
+ } else if (!nphosts.isEmpty()) {
// add the required default patterns
// but only if property no set. If it
// is empty, leave empty.
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/HeaderParser.java
--- a/src/java.base/share/classes/sun/net/www/HeaderParser.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/HeaderParser.java Thu Dec 13 11:51:06 2018 -0800
@@ -226,7 +226,7 @@
for (int i=0; k.hasNext(); i++) {
String key = k.next();
String val = findValue (i);
- if (val != null && "".equals (val)) {
+ if (val != null && val.isEmpty()) {
val = null;
}
sb.append(" {").append(key).append(val == null ? "" : "," + val)
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/MimeEntry.java
--- a/src/java.base/share/classes/sun/net/www/MimeEntry.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/MimeEntry.java Thu Dec 13 11:51:06 2018 -0800
@@ -201,9 +201,7 @@
}
private boolean isStarred(String typeName) {
- return (typeName != null)
- && (typeName.length() > 0)
- && (typeName.endsWith("/*"));
+ return typeName != null && typeName.endsWith("/*");
}
/**
@@ -300,7 +298,7 @@
}
String extensions = getExtensionsAsList();
- if (extensions.length() > 0) {
+ if (!extensions.isEmpty()) {
sj.add("file_extensions=" + extensions);
}
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/MimeLauncher.java
--- a/src/java.base/share/classes/sun/net/www/MimeLauncher.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/MimeLauncher.java Thu Dec 13 11:51:06 2018 -0800
@@ -162,7 +162,7 @@
location the application. If a valid path is not found, it
returns false else true. */
private boolean findExecutablePath(String str) {
- if (str == null || str.length() == 0) {
+ if (str == null || str.isEmpty()) {
return false;
}
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/ParseUtil.java
--- a/src/java.base/share/classes/sun/net/www/ParseUtil.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/ParseUtil.java Thu Dec 13 11:51:06 2018 -0800
@@ -536,8 +536,7 @@
throws URISyntaxException
{
if (scheme != null) {
- if ((path != null)
- && ((path.length() > 0) && (path.charAt(0) != '/')))
+ if (path != null && !path.isEmpty() && path.charAt(0) != '/')
throw new URISyntaxException(s,
"Relative path in absolute URI");
}
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/http/HttpClient.java
--- a/src/java.base/share/classes/sun/net/www/http/HttpClient.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/http/HttpClient.java Thu Dec 13 11:51:06 2018 -0800
@@ -603,7 +603,7 @@
StringBuilder result = new StringBuilder(128);
result.append(url.getProtocol());
result.append(":");
- if (url.getAuthority() != null && url.getAuthority().length() > 0) {
+ if (url.getAuthority() != null && !url.getAuthority().isEmpty()) {
result.append("//");
result.append(url.getAuthority());
}
@@ -619,7 +619,7 @@
} else {
fileName = url.getFile();
- if ((fileName == null) || (fileName.length() == 0)) {
+ if ((fileName == null) || (fileName.isEmpty())) {
fileName = "/";
} else if (fileName.charAt(0) == '?') {
/* HTTP/1.1 spec says in 5.1.2. about Request-URI:
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
--- a/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Thu Dec 13 11:51:06 2018 -0800
@@ -341,7 +341,7 @@
path.charAt(0) == '/') {
path = path.substring(1);
}
- if (path == null || path.length() == 0) {
+ if (path == null || path.isEmpty()) {
path = "./";
}
if (!path.endsWith("/")) {
@@ -555,7 +555,7 @@
}
decodePath(url.getPath());
- if (filename == null || filename.length() == 0) {
+ if (filename == null || filename.isEmpty()) {
throw new IOException("illegal filename for a PUT");
}
try {
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java
--- a/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Thu Dec 13 11:51:06 2018 -0800
@@ -248,7 +248,7 @@
this.realm = realm;
String urlPath = url.getPath();
- if (urlPath.length() == 0)
+ if (urlPath.isEmpty())
this.path = urlPath;
else {
this.path = reducePath (urlPath);
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java
--- a/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Thu Dec 13 11:51:06 2018 -0800
@@ -279,7 +279,7 @@
if (s == null || !s.equals("true"))
return false;
String newNonce = p.findValue ("nonce");
- if (newNonce == null || "".equals(newNonce)) {
+ if (newNonce == null || newNonce.isEmpty()) {
return false;
}
params.setNonce (newNonce);
@@ -323,7 +323,7 @@
+ authMethod.substring(1).toLowerCase();
}
String algorithm = p.findValue("algorithm");
- if (algorithm == null || "".equals(algorithm)) {
+ if (algorithm == null || algorithm.isEmpty()) {
algorithm = "MD5"; // The default, accoriding to rfc2069
}
params.setAlgorithm (algorithm);
@@ -451,7 +451,7 @@
}
/* Check if there is a nextnonce field */
String nextnonce = p.findValue ("nextnonce");
- if (nextnonce != null && ! "".equals(nextnonce)) {
+ if (nextnonce != null && !nextnonce.isEmpty()) {
params.setNonce (nextnonce);
}
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
--- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Thu Dec 13 11:51:06 2018 -0800
@@ -3026,7 +3026,7 @@
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
- if (cookieHandler == null || value.length() == 0)
+ if (cookieHandler == null || value.isEmpty())
return value;
JavaNetHttpCookieAccess access =
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java
--- a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java Thu Dec 13 11:51:06 2018 -0800
@@ -143,7 +143,7 @@
String cipherString =
GetPropertyAction.privilegedGetProperty("https.cipherSuites");
- if (cipherString == null || "".equals(cipherString)) {
+ if (cipherString == null || cipherString.isEmpty()) {
ciphers = null;
} else {
StringTokenizer tokenizer;
@@ -167,7 +167,7 @@
String protocolString =
GetPropertyAction.privilegedGetProperty("https.protocols");
- if (protocolString == null || "".equals(protocolString)) {
+ if (protocolString == null || protocolString.isEmpty()) {
protocols = null;
} else {
StringTokenizer tokenizer;
@@ -187,7 +187,7 @@
private String getUserAgent() {
String userAgent =
GetPropertyAction.privilegedGetProperty("https.agent");
- if (userAgent == null || userAgent.length() == 0) {
+ if (userAgent == null || userAgent.isEmpty()) {
userAgent = "JSSE";
}
return userAgent;
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java
--- a/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java Thu Dec 13 11:51:06 2018 -0800
@@ -66,7 +66,7 @@
JavaRuntimeURLConnection(URL url) throws IOException {
super(url);
String path = url.getPath();
- if (path.length() == 0 || path.charAt(0) != '/')
+ if (path.isEmpty() || path.charAt(0) != '/')
throw new MalformedURLException(url + " missing path or /");
if (path.length() == 1) {
this.module = null;
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/nio/ch/Net.java
--- a/src/java.base/share/classes/sun/nio/ch/Net.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/nio/ch/Net.java Thu Dec 13 11:51:06 2018 -0800
@@ -403,14 +403,8 @@
public static boolean isFastTcpLoopbackRequested() {
String loopbackProp = GetPropertyAction
- .privilegedGetProperty("jdk.net.useFastTcpLoopback");
- boolean enable;
- if ("".equals(loopbackProp)) {
- enable = true;
- } else {
- enable = Boolean.parseBoolean(loopbackProp);
- }
- return enable;
+ .privilegedGetProperty("jdk.net.useFastTcpLoopback", "false");
+ return loopbackProp.isEmpty() ? true : Boolean.parseBoolean(loopbackProp);
}
// -- Socket operations --
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java
--- a/src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/nio/fs/AbstractFileSystemProvider.java Thu Dec 13 11:51:06 2018 -0800
@@ -73,7 +73,7 @@
throws IOException
{
String[] s = split(attribute);
- if (s[0].length() == 0)
+ if (s[0].isEmpty())
throw new IllegalArgumentException(attribute);
DynamicFileAttributeView view = getFileAttributeView(file, s[0], options);
if (view == null)
@@ -86,7 +86,7 @@
throws IOException
{
String[] s = split(attributes);
- if (s[0].length() == 0)
+ if (s[0].isEmpty())
throw new IllegalArgumentException(attributes);
DynamicFileAttributeView view = getFileAttributeView(file, s[0], options);
if (view == null)
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/nio/fs/AbstractUserDefinedFileAttributeView.java
--- a/src/java.base/share/classes/sun/nio/fs/AbstractUserDefinedFileAttributeView.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/nio/fs/AbstractUserDefinedFileAttributeView.java Thu Dec 13 11:51:06 2018 -0800
@@ -83,7 +83,7 @@
names = list();
break;
} else {
- if (name.length() == 0)
+ if (name.isEmpty())
throw new IllegalArgumentException();
names.add(name);
}
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/jca/GetInstance.java
--- a/src/java.base/share/classes/sun/security/jca/GetInstance.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/jca/GetInstance.java Thu Dec 13 11:51:06 2018 -0800
@@ -75,7 +75,7 @@
public static Service getService(String type, String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
- if ((provider == null) || (provider.length() == 0)) {
+ if (provider == null || provider.isEmpty()) {
throw new IllegalArgumentException("missing provider");
}
Provider p = Providers.getProviderList().getProvider(provider);
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/jca/ProviderConfig.java
--- a/src/java.base/share/classes/sun/security/jca/ProviderConfig.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/jca/ProviderConfig.java Thu Dec 13 11:51:06 2018 -0800
@@ -114,7 +114,7 @@
}
private boolean hasArgument() {
- return argument.length() != 0;
+ return !argument.isEmpty();
}
// should we try to load this provider?
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/jca/ProviderList.java
--- a/src/java.base/share/classes/sun/security/jca/ProviderList.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/jca/ProviderList.java Thu Dec 13 11:51:06 2018 -0800
@@ -175,7 +175,7 @@
while ((entry = Security.getProperty("security.provider." + i)) != null) {
entry = entry.trim();
- if (entry.length() == 0) {
+ if (entry.isEmpty()) {
System.err.println("invalid entry for " +
"security.provider." + i);
break;
@@ -200,7 +200,7 @@
// Load config entries for use when getInstance is called
entry = Security.getProperty("jdk.security.provider.preferred");
- if (entry != null && (entry = entry.trim()).length() > 0) {
+ if (entry != null && !(entry = entry.trim()).isEmpty()) {
String[] entries = entry.split(",");
if (ProviderList.preferredPropList == null) {
ProviderList.preferredPropList = new PreferredList();
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/provider/ConfigFile.java
--- a/src/java.base/share/classes/sun/security/provider/ConfigFile.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/provider/ConfigFile.java Thu Dec 13 11:51:06 2018 -0800
@@ -626,7 +626,7 @@
return url.openStream();
} catch (Exception e) {
String file = url.getPath();
- if (url.getHost().length() > 0) { // For Windows UNC
+ if (!url.getHost().isEmpty()) { // For Windows UNC
file = "//" + url.getHost() + file;
}
if (debugConfig != null) {
@@ -651,7 +651,7 @@
return value;
}
String s = PropertyExpander.expand(value);
- if (s == null || s.length() == 0) {
+ if (s == null || s.isEmpty()) {
throw ioException(
"Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
linenum, value);
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/provider/PolicyParser.java
--- a/src/java.base/share/classes/sun/security/provider/PolicyParser.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/provider/PolicyParser.java Thu Dec 13 11:51:06 2018 -0800
@@ -391,9 +391,9 @@
out.print("keystore \"");
out.print(keyStoreUrlString);
out.print('"');
- if (keyStoreType != null && keyStoreType.length() > 0)
+ if (keyStoreType != null && !keyStoreType.isEmpty())
out.print(", \"" + keyStoreType + "\"");
- if (keyStoreProvider != null && keyStoreProvider.length() > 0)
+ if (keyStoreProvider != null && !keyStoreProvider.isEmpty())
out.print(", \"" + keyStoreProvider + "\"");
out.println(";");
out.println();
@@ -446,7 +446,7 @@
String alias = aliases.nextToken().trim();
if (alias.equals(","))
cctr++;
- else if (alias.length() > 0)
+ else if (!alias.isEmpty())
actr++;
}
if (actr <= cctr)
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/provider/SeedGenerator.java
--- a/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Thu Dec 13 11:51:06 2018 -0800
@@ -113,7 +113,7 @@
+ "generator: " + e.toString());
}
}
- } else if (egdSource.length() != 0) {
+ } else if (!egdSource.isEmpty()) {
try {
instance = new URLSeedGenerator(egdSource);
if (debug != null) {
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/ssl/CertificateMessage.java
--- a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java Thu Dec 13 11:51:06 2018 -0800
@@ -440,7 +440,7 @@
// It is not necessary to check the certificate update if
// endpoint identification is enabled.
String identityAlg = chc.sslConfig.identificationProtocol;
- if ((identityAlg == null || identityAlg.length() == 0) &&
+ if ((identityAlg == null || identityAlg.isEmpty()) &&
!isIdentityEquivalent(x509Certs[0],
chc.reservedServerCerts[0])) {
chc.conContext.fatal(Alert.BAD_CERTIFICATE,
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/ssl/ClientHello.java
--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java Thu Dec 13 11:51:06 2018 -0800
@@ -491,7 +491,7 @@
// It is fine to move on with abbreviate handshake if
// endpoint identification is enabled.
String identityAlg = chc.sslConfig.identificationProtocol;
- if ((identityAlg == null || identityAlg.length() == 0)) {
+ if (identityAlg == null || identityAlg.isEmpty()) {
if (isEmsAvailable) {
if (!session.useExtendedMasterSecret) {
// perform full handshake instead
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java
--- a/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java Thu Dec 13 11:51:06 2018 -0800
@@ -253,7 +253,7 @@
static {
String property = GetPropertyAction.privilegedGetProperty(
"jdk.tls.ephemeralDHKeySize");
- if (property == null || property.length() == 0) {
+ if (property == null || property.isEmpty()) {
useLegacyEphemeralDHKeys = false;
useSmartEphemeralDHKeys = false;
customizedDHKeySize = -1;
diff -r fd6de53a0d6e -r b94283cb226b src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java
--- a/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java Thu Dec 13 11:51:06 2018 -0800
@@ -237,7 +237,7 @@
public boolean permits(Set
*
- * public static void main(String[] args) {
- * if (args.length != 0) {
- * System.out.println("Must specify recording file.");
- * return;
+ * public static void main(String[] args) throws IOException {
+ * if (args.length != 1) {
+ * System.err.println("Must specify a recording file.");
+ * return;
* }
- * try (RecordingFile f = new RecordingFile(Paths.get(args[0]))) {
- * Map{@literal <}String, SimpleEntry{@literal <}String, Integer{@literal >}{@literal >} histogram = new HashMap{@literal <}{@literal >}();
- * int total = 0;
- * while (f.hasMoreEvents()) {
- * RecordedEvent event = f.readEvent();
- * if (event.getEventType().getName().equals("jdk.ExecutionSample")) {
- * RecordedStackTrace s = event.getStackTrace();
- * if (s != null) {
- * RecordedFrame topFrame= s.getFrames().get(0);
- * if (topFrame.isJavaFrame()) {
- * RecordedMethod method = topFrame.getMethod();
- * String methodName = method.getType().getName() + "#" + method.getName() + " " + method.getDescriptor();
- * Entry entry = histogram.computeIfAbsent(methodName, u -{@literal >} new SimpleEntry{@literal <}String, Integer{@literal >}(methodName, 0));
- * entry.setValue(entry.getValue() + 1);
- * total++;
- * }
- * }
- * }
- * }
- * List{@literal <}SimpleEntry{@literal <}String, Integer{@literal >}{@literal >} entries = new ArrayList{@literal <}{@literal >}(histogram.values());
- * entries.sort((u, v) -{@literal >} v.getValue().compareTo(u.getValue()));
- * for (SimpleEntry{@literal <}String, Integer{@literal >} c : entries) {
- * System.out.printf("%2.0f%% %s\n", 100 * (float) c.getValue() / total, c.getKey());
- * }
- * System.out.println("\nSample count: " + total);
- * } catch (IOException ioe) {
- * System.out.println("Error reading file " + args[0] + ". " + ioe.getMessage());
- * }
- * }
+ *
+ * RecordingFile.readAllEvents(Path.of(args[0])).stream()
+ * .filter(e -> e.getEventType().getName().equals("jdk.ExecutionSample"))
+ * .map(e -> e.getStackTrace())
+ * .filter(s -> s != null)
+ * .map(s -> s.getFrames().get(0))
+ * .filter(f -> f.isJavaFrame())
+ * .map(f -> f.getMethod())
+ * .collect(
+ * Collectors.groupingBy(m -> m.getType().getName() + "." + m.getName() + " " + m.getDescriptor(),
+ * Collectors.counting()))
+ * .entrySet()
+ * .stream()
+ * .sorted((a, b) -> b.getValue().compareTo(a.getValue()))
+ * .forEach(e -> System.out.printf("%8d %s\n", e.getValue(), e.getKey()));
+ * }
*
*
*
diff -r fd6de53a0d6e -r b94283cb226b src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java Thu Dec 13 11:51:06 2018 -0800
@@ -516,4 +516,11 @@
* @param emitAll emit all samples in old object queue
*/
public native void emitOldObjectSamples(long cutoff, boolean emitAll);
+
+ /**
+ * Test if a chunk rotation is warranted.
+ *
+ * @return if it is time to perform a chunk rotation
+ */
+ public native boolean shouldRotateDisk();
}
diff -r fd6de53a0d6e -r b94283cb226b src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataHandler.java
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataHandler.java Thu Dec 13 11:47:35 2018 -0800
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataHandler.java Thu Dec 13 11:51:06 2018 -0800
@@ -100,7 +100,7 @@
final Map