# HG changeset patch # User clanger # Date 1568618934 -7200 # Node ID d003b3ef8b60ebf3d3657ef4d08c8e62658038c9 # Parent b35771556cd0e75d34ae376274bef06fea9fa223 8230854: Cleanup SuppressWarnings in test lib and remove noisy traces in StreamPumper Reviewed-by: stuefe, dholmes diff -r b35771556cd0 -r d003b3ef8b60 test/lib/jdk/test/lib/Platform.java --- a/test/lib/jdk/test/lib/Platform.java Mon Sep 16 09:21:42 2019 +0200 +++ b/test/lib/jdk/test/lib/Platform.java Mon Sep 16 09:28:54 2019 +0200 @@ -265,7 +265,6 @@ return false; } } catch (PrivilegedActionException e) { - @SuppressWarnings("unchecked") IOException t = (IOException) e.getException(); throw t; } @@ -289,7 +288,6 @@ return false; } } catch (PrivilegedActionException e) { - @SuppressWarnings("unchecked") IOException t = (IOException) e.getException(); throw t; } diff -r b35771556cd0 -r d003b3ef8b60 test/lib/jdk/test/lib/Utils.java --- a/test/lib/jdk/test/lib/Utils.java Mon Sep 16 09:21:42 2019 +0200 +++ b/test/lib/jdk/test/lib/Utils.java Mon Sep 16 09:28:54 2019 +0200 @@ -25,6 +25,7 @@ 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 @@ // 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 testClassAnnotation; try { - testClassAnnotation = Class.forName("org.testng.annotations.Test"); + testClassAnnotation = (Class)Class.forName("org.testng.annotations.Test"); } catch (ClassNotFoundException e) { testClassAnnotation = null; } @@ -776,7 +778,7 @@ // 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; diff -r b35771556cd0 -r d003b3ef8b60 test/lib/jdk/test/lib/process/ProcessTools.java --- a/test/lib/jdk/test/lib/process/ProcessTools.java Mon Sep 16 09:21:42 2019 +0200 +++ b/test/lib/jdk/test/lib/process/ProcessTools.java Mon Sep 16 09:28:54 2019 +0200 @@ -495,7 +495,6 @@ return AccessController.doPrivileged( (PrivilegedExceptionAction) () -> pb.start()); } catch (PrivilegedActionException e) { - @SuppressWarnings("unchecked") IOException t = (IOException) e.getException(); throw t; } diff -r b35771556cd0 -r d003b3ef8b60 test/lib/jdk/test/lib/process/StreamPumper.java --- a/test/lib/jdk/test/lib/process/StreamPumper.java Mon Sep 16 09:21:42 2019 +0200 +++ b/test/lib/jdk/test/lib/process/StreamPumper.java Mon Sep 16 09:28:54 2019 +0200 @@ -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 @@ } } catch (IOException e) { - e.printStackTrace(); + if (!e.getMessage().equalsIgnoreCase("stream closed")) { + e.printStackTrace(); + } } finally { for (OutputStream out : outStreams) { try {