2932N/A/*
2932N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2932N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2932N/A *
2932N/A * This code is free software; you can redistribute it and/or modify it
2932N/A * under the terms of the GNU General Public License version 2 only, as
2932N/A * published by the Free Software Foundation.
2932N/A *
2932N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2932N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2932N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2932N/A * version 2 for more details (a copy is included in the LICENSE file that
2932N/A * accompanied this code).
2932N/A *
2932N/A * You should have received a copy of the GNU General Public License version
2932N/A * 2 along with this work; if not, write to the Free Software Foundation,
2932N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2932N/A *
2932N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2932N/A * or visit www.oracle.com if you need additional information or have any
2932N/A * questions.
2932N/A */
2932N/A
2932N/A/**
2932N/A * @test %I% %E%
2932N/A * @bug 6954275
2932N/A * @summary Check that UnsyncByteArrayOutputStream does not
2932N/A * throw ArrayIndexOutOfBoundsException
2932N/A * @compile -XDignore.symbol.file BufferOverflowTest.java
2932N/A * @run main BufferOverflowTest
2932N/A */
2932N/A
2932N/Aimport com.sun.org.apache.xml.internal.security.utils.UnsyncByteArrayOutputStream;
2932N/A
2932N/Apublic class BufferOverflowTest {
2932N/A
2932N/A public static void main(String[] args) throws Exception {
2932N/A try {
2932N/A UnsyncByteArrayOutputStream out = new UnsyncByteArrayOutputStream();
2932N/A out.write(new byte[(8192) << 2 + 1]);
2932N/A System.out.println("PASSED");
2932N/A } catch (ArrayIndexOutOfBoundsException e) {
2932N/A System.err.println("FAILED, got ArrayIndexOutOfBoundsException");
2932N/A throw new Exception(e);
2932N/A }
2932N/A }
2932N/A}