test/java/util/logging/SimpleFormatterFormat.java

Print this page
rev 6099 : 8003380: Compiler warnings in logging test code
Summary: Use generics, suppress warnings where appropriate, remove unused imports, etc.
Reviewed-by: lancea, chegar

*** 1,7 **** /* ! * Copyright (c) 2011, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2011, 2012 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 90,101 **** private static void checkLogRecords(File log) throws Exception { System.out.println("Checking log records in file: " + log); Pattern p = Pattern.compile("([\\.a-zA-Z:]+) (.*) \\[.*\\] source: (.*)"); ! try (FileInputStream in = new FileInputStream(log)) { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; int i = 0; while (i < messages.length && (line = reader.readLine()) != null) { String expectedLogger = loggers[i]; --- 90,102 ---- private static void checkLogRecords(File log) throws Exception { System.out.println("Checking log records in file: " + log); Pattern p = Pattern.compile("([\\.a-zA-Z:]+) (.*) \\[.*\\] source: (.*)"); ! try (FileInputStream in = new FileInputStream(log); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + ) { String line; int i = 0; while (i < messages.length && (line = reader.readLine()) != null) { String expectedLogger = loggers[i];