/*
* 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 4472841 4703640 4705681 4705683 4833095 5005831
* @summary Verify that constructor exceptions are thrown as expected.
*/
public class Exceptions {
private static final byte [] b = { 0x48, 0x69, 0x2c, 0x20,
0x44, 0x75, 0x6b, 0x65, 0x21 };
private static final char [] c
= "Attack of the Killer Tomatoes!".toCharArray();
private static boolean ok = true;
ok = false;
+ " - FAILED");
}
}
try {
} catch (Throwable x) {
t = x;
else
x.printStackTrace();
}
else
pass(s);
}
// -- Constructors --
private static void noArgs() {
public void run() {
new String();
}});
}
private static void string() {
public void run() {
new String("foo");
}});
public void run() {
}});
}
private static void charArray() {
public void run() {
}});
public void run() {
}});
}
private static void charArrayOffCount() {
public void run() {
}});
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
}
private static void byteArrayHiOffCount() {
+ "int count)");
public void run() {
}});
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
}
private static void byteArrayHi() {
public void run() {
new String(b, 0);
}});
public void run() {
}});
}
byte [] b, int off,
{
try {
else // (cs instanceof Charset)
} catch (Throwable x) {
t = x;
else
x.printStackTrace();
}
else
pass(s);
}
private static void byteArrayOffLengthCharsetName() {
+ "String charsetName)");
NullPointerException.class,
IndexOutOfBoundsException.class,
IndexOutOfBoundsException.class,
IndexOutOfBoundsException.class,
IndexOutOfBoundsException.class,
byteArrayOffLengthCharset0(" b, -1, 0, null",
NullPointerException.class,
byteArrayOffLengthCharset0(" b, 0, b.length, foo",
UnsupportedEncodingException.class,
}
private static void byteArrayOffLengthCharset() {
+ "Charset charset)");
NullPointerException.class,
IndexOutOfBoundsException.class,
IndexOutOfBoundsException.class,
IndexOutOfBoundsException.class,
IndexOutOfBoundsException.class,
byteArrayOffLengthCharset0(" b, -1, 0, null",
NullPointerException.class,
}
{
try {
else // (cs instanceof Charset)
} catch (Throwable x) {
t = x;
else
x.printStackTrace();
}
else
pass(s);
}
private static void byteArrayCharsetName() {
b, "bar");
}
private static void byteArrayCharset() {
}
private static void byteArrayOffLength() {
public void run() {
}});
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
new Runnable() {
public void run() {
}});
}
private static void byteArray() {
public void run() {
new String(b);
}});
public void run() {
}});
}
private static void stringBuffer() {
public void run() {
}});
public void run() {
}});
}
// -- Methods --
private static void getChars() {
+ " int dstBegin");
public void run() {
}});
}
private static void getBytes() {
+ " int dstBegin");
public void run() {
}});
+ " throws UnsupportedEncodingException");
public void run() {
try {
} catch (UnsupportedEncodingException x) {
throw new RuntimeException(x);
}
}});
public void run() {
}});
}
private static void contentEquals() {
public void run() {
}});
}
private static void compareTo() {
public void run() {
}});
/* 4830291 (javac generics bug) causes this test to fail
System.out.println("compareTo(Object o)");
tryCatch(" (Object) null", NullPointerException.class, new Runnable() {
public void run() {
"foo".compareTo((Object) null);
}});
*/
}
private static void compareToIgnoreCase() {
public void run() {
}});
}
private static void regionMatches() {
+ " int ooffset, int len)");
public void run() {
}});
+ " String other, int ooffset, int len)");
new Runnable() {
public void run() {
}});
}
private static void startsWith() {
public void run() {
}});
public void run() {
}});
}
private static void endsWith() {
public void run() {
}});
}
private static void indexOf() {
public void run() {
}});
public void run() {
}});
}
private static void lastIndexOf() {
public void run() {
}});
public void run() {
}});
}
private static void concat() {
public void run() {
}});
}
private static void matches() {
public void run() {
}});
}
private static void replaceFirst() {
public void run() {
}});
public void run() {
}});
}
private static void replaceAll() {
public void run() {
}});
public void run() {
}});
}
private static void split() {
public void run() {
}});
public void run() {
}});
}
private static void toLowerCase() {
public void run() {
}});
}
private static void toUpperCase() {
public void run() {
}});
}
private static void valueOf() {
public void run() {
}});
public void run() {
}});
public void run() {
}});
}
private static void copyValueOf() {
public void run() {
}});
public void run() {
}});
}
// -- Constructors --
noArgs(); // String()
string(); // String(String original)
charArray(); // String(char value[])
charArrayOffCount(); // String(char value[], int offset, int count)
// String(byte ascii[], int hibyte, int offset, int count)
byteArrayHi(); // String(byte ascii[], int hibyte)
// String(byte bytes[], int offset, int length, String charsetName)
// throws UnsupportedEncodingException
// String(byte bytes[], int offset, int length, Charset charset)
// String(byte bytes[], String charsetName)
// throws UnsupportedEncodingException
// String(byte bytes[], Charset charset)
byteArrayOffLength(); // String(byte bytes[], int offset, int length)
byteArray(); // String(byte bytes[])
stringBuffer(); // String(StringBuffer buffer)
// -- Methods --
getChars(); // getChars(int, int. char [], int)
getBytes(); // getBytes(int, int, byte [], int),
// getBytes(Locale)
// getBytes(String)
// getBytes(Charset)
contentEquals(); // contentEquals(StringBuffer)
compareTo(); // compareTo(String), compareTo(Object)
compareToIgnoreCase();// compareToIgnoreCase(String)
regionMatches(); // regionMatches(int, String, int, int)
// regionMatches(boolean, int, String, int, int)
startsWith(); // startsWith(String, int), startsWith(String)
endsWith(); // endsWith(String)
indexOf(); // indexOf(String), indexOf(String, int),
lastIndexOf(); // lastIndexOf(String), lastIndexOf(String, int)
concat(); // concat(String)
matches(); // matches(String)
replaceFirst(); // replaceFirst(String, String)
replaceAll(); // replaceAll(String, String)
split(); // split(String, int), split(String)
toLowerCase(); // toLowerCase(Locale)
toUpperCase(); // toUpperCase(Locale)
valueOf(); // valueOf(Object), valueOf(char []),
// valueOf(char [], int, int)
copyValueOf(); // copyValueOf(char [], int, int),
// copyValueOf(char [])
if (!ok)
throw new RuntimeException("Some tests FAILED");
else
}
}