Skip to content

Commit 36b59f3

Browse files
turbanoffRoger Riggs
authored andcommitted
8274333: Redundant null comparison after Pattern.split
Reviewed-by: mullan, weijun, rriggs, iris
1 parent 6677554 commit 36b59f3

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/java.base/share/classes/sun/launcher/LauncherHelper.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@
3434
*
3535
*/
3636

37-
/**
38-
* A utility package for the java(1), javaw(1) launchers.
39-
* The following are helper methods that the native launcher uses
40-
* to perform checks etc. using JNI, see src/share/bin/java.c
41-
*/
4237
import java.io.File;
4338
import java.io.IOException;
4439
import java.io.PrintStream;
@@ -88,7 +83,11 @@
8883
import jdk.internal.platform.Container;
8984
import jdk.internal.platform.Metrics;
9085

91-
86+
/**
87+
* A utility package for the java(1), javaw(1) launchers.
88+
* The following are helper methods that the native launcher uses
89+
* to perform checks etc. using JNI, see src/share/bin/java.c
90+
*/
9291
public final class LauncherHelper {
9392

9493
// No instantiation
@@ -154,8 +153,8 @@ static void showSettings(boolean printToStderr, String optionFlag,
154153
long initialHeapSize, long maxHeapSize, long stackSize) {
155154

156155
initOutput(printToStderr);
157-
String opts[] = optionFlag.split(":");
158-
String optStr = (opts.length > 1 && opts[1] != null)
156+
String[] opts = optionFlag.split(":");
157+
String optStr = opts.length > 1
159158
? opts[1].trim()
160159
: "all";
161160
switch (optStr) {

src/java.base/share/classes/sun/security/util/AlgorithmDecomposer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private static Set<String> decomposeImpl(String algorithm) {
5757
String[] transTokens = algorithm.split("/");
5858

5959
for (String transToken : transTokens) {
60-
if (transToken == null || transToken.isEmpty()) {
60+
if (transToken.isEmpty()) {
6161
continue;
6262
}
6363

@@ -70,7 +70,7 @@ private static Set<String> decomposeImpl(String algorithm) {
7070
String[] tokens = PATTERN.split(transToken);
7171

7272
for (String token : tokens) {
73-
if (token == null || token.isEmpty()) {
73+
if (token.isEmpty()) {
7474
continue;
7575
}
7676

0 commit comments

Comments
 (0)