/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6985763
* @summary verify that proper exceptions are thrown
* @compile -XDignore.symbol.file Utils.java TestExceptions.java
* @run main TestExceptions
* @author ksrini
*/
public class TestExceptions {
static void init() {
try {
} catch (IOException ioe) {
} finally {
}
}
// a test that closes the input jarFile.
static void pack200Test1() {
// setup the scenario
try {
} catch (Exception e) {
throw new Error("Initialization error", e);
} finally {
}
// test the scenario
try {
} catch (Exception e) {
ti.checkException(e);
} finally {
}
}
}
// test the Pack200.pack(JarFile, OutputStream);
static void pack200Test2() {
try {
// setup the test scenarios
try {
} catch (Exception e) {
throw new Error("Initialization error", e);
}
// test the scenarios
try {
} catch (Exception e) {
ti.checkException(e);
}
}
} finally { // keep jprt happy
}
}
}
}
// test the Pack200.pack(JarInputStream, OutputStream);
static void pack200Test3() {
try {
// setup the test scenarios
try {
new ByteArrayOutputStream()));
} catch (Exception e) {
throw new Error("Initialization error", e);
}
try {
} catch (Exception e) {
ti.checkException(e);
}
}
} finally { // keep jprt happy
}
}
}
}
// test the Pack200.unpack(InputStream, OutputStream);
static void unpack200Test1() {
try {
// setup the test scenarios
try {
null));
new JarOutputStream(new ByteArrayOutputStream())));
} catch (Exception e) {
throw new Error("Initialization error", e);
}
// test the scenarios
try {
} catch (Exception e) {
ti.checkException(e);
}
}
} finally { // keep jprt happy
}
}
}
}
// test the Pack200.unpack(File, OutputStream);
static void unpack200Test2() {
try {
// setup the test scenarios
try {
new JarOutputStream(new ByteArrayOutputStream())));
} catch (Exception e) {
throw new Error("Initialization error", e);
}
// test the scenarios
try {
} catch (Exception e) {
ti.checkException(e);
}
}
} finally { // keep jprt happy
}
}
}
}
init();
pack200Test1();
pack200Test2();
pack200Test3();
}
// containers for test inputs and management
static abstract class TestInput {
final boolean shouldNPE;
}
}
void close() {
}
}
}
if (shouldNPE) {
if (t instanceof NullPointerException) {
return;
} else {
throw new RuntimeException("Expected NPE, but got ", t);
}
}
if (t instanceof IOException) {
return;
} else {
throw new RuntimeException("Expected IOException but got ", t);
}
}
}
}
}
return (OutputStream) super.out;
}
};
}
return (JarInputStream) super.in;
}
return (OutputStream) super.out;
}
};
}
return (InputStream) super.in;
}
return (JarOutputStream) super.out;
}
};
}
}
return (JarOutputStream) super.out;
}
};
}