test/jdk/java/io/NegativeInitSize.java
changeset 55729 68deaa66130c
parent 47216 71c04702a3d5
child 55741 880266b6e5b3
equal deleted inserted replaced
55728:978350939943 55729:68deaa66130c
     1 /*
     1 /*
     2  * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    47             System.out.println(e.getClass().getName());
    47             System.out.println(e.getClass().getName());
    48             throw new Exception
    48             throw new Exception
    49                 ("PushbackReader failed to detect negative init size");
    49                 ("PushbackReader failed to detect negative init size");
    50         }
    50         }
    51 
    51 
       
    52         byte[] ba = { 123 };
       
    53         ByteArrayInputStream goodbis = new ByteArrayInputStream(ba);
    52         try {
    54         try {
    53             PushbackInputStream pbis = new PushbackInputStream(null, -1);
    55             PushbackInputStream pbis = new PushbackInputStream(goodbis, -1);
    54         } catch (IllegalArgumentException e) {
    56         } catch (IllegalArgumentException e) {
    55         } catch (Exception e) {
    57         } catch (Exception e) {
    56             throw new Exception
    58             throw new Exception
    57                 ("PushbackInputStream failed to detect negative init size");
    59                 ("PushbackInputStream failed to detect negative init size");
    58         }
    60         }
    64         } catch (Exception e) {
    66         } catch (Exception e) {
    65             throw new Exception
    67             throw new Exception
    66                 ("BufferedOutputStream failed to detect negative init size");
    68                 ("BufferedOutputStream failed to detect negative init size");
    67         }
    69         }
    68 
    70 
    69         byte[] ba = { 123 };
       
    70         ByteArrayInputStream goodbis = new ByteArrayInputStream(ba);
       
    71         try {
    71         try {
    72             BufferedInputStream bis = new BufferedInputStream(goodbis, -1);
    72             BufferedInputStream bis = new BufferedInputStream(goodbis, -1);
    73         } catch (IllegalArgumentException e) {
    73         } catch (IllegalArgumentException e) {
    74         } catch (Exception e) {
    74         } catch (Exception e) {
    75             throw new Exception
    75             throw new Exception