8230854: Cleanup SuppressWarnings in test lib and remove noisy traces in StreamPumper
Reviewed-by: stuefe, dholmes
This commit is contained in:
parent
2f5ce4c6cd
commit
75e8b6ed4b
@ -265,7 +265,6 @@ public class Platform {
|
||||
return false;
|
||||
}
|
||||
} catch (PrivilegedActionException e) {
|
||||
@SuppressWarnings("unchecked")
|
||||
IOException t = (IOException) e.getException();
|
||||
throw t;
|
||||
}
|
||||
@ -289,7 +288,6 @@ public class Platform {
|
||||
return false;
|
||||
}
|
||||
} catch (PrivilegedActionException e) {
|
||||
@SuppressWarnings("unchecked")
|
||||
IOException t = (IOException) e.getException();
|
||||
throw t;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ package jdk.test.lib;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.MalformedURLException;
|
||||
@ -749,13 +750,14 @@ public final class Utils {
|
||||
// until the method main() is found; the class containing that method is the
|
||||
// main test class and will be returned as the name of the test.
|
||||
// Special handling is used for testng tests.
|
||||
@SuppressWarnings("unchecked")
|
||||
public static String getTestName() {
|
||||
String result = null;
|
||||
// If we are using testng, then we should be able to load the "Test" annotation.
|
||||
Class testClassAnnotation;
|
||||
Class<? extends Annotation> testClassAnnotation;
|
||||
|
||||
try {
|
||||
testClassAnnotation = Class.forName("org.testng.annotations.Test");
|
||||
testClassAnnotation = (Class<? extends Annotation>)Class.forName("org.testng.annotations.Test");
|
||||
} catch (ClassNotFoundException e) {
|
||||
testClassAnnotation = null;
|
||||
}
|
||||
@ -776,7 +778,7 @@ public final class Utils {
|
||||
// annotation. If present, then use the name of this class.
|
||||
if (testClassAnnotation != null) {
|
||||
try {
|
||||
Class c = Class.forName(className);
|
||||
Class<?> c = Class.forName(className);
|
||||
if (c.isAnnotationPresent(testClassAnnotation)) {
|
||||
result = className;
|
||||
break;
|
||||
|
@ -495,7 +495,6 @@ public final class ProcessTools {
|
||||
return AccessController.doPrivileged(
|
||||
(PrivilegedExceptionAction<Process>) () -> pb.start());
|
||||
} catch (PrivilegedActionException e) {
|
||||
@SuppressWarnings("unchecked")
|
||||
IOException t = (IOException) e.getException();
|
||||
throw t;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2019, 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
|
||||
@ -144,7 +144,9 @@ public final class StreamPumper implements Runnable {
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (!e.getMessage().equalsIgnoreCase("stream closed")) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
for (OutputStream out : outStreams) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user