Files
.github
.jcheck
bin
doc
make
src
test
docs
failure_handler
hotspot
jaxp
jdk
build
com
demo
java
awt
beans
foreign
io
lang
Appendable
AssertionError
Boolean
Byte
CharSequence
Character
Class
ClassLoader
Double
Enum
Float
InheritableThreadLocal
Integer
Long
Math
ModuleLayer
ModuleTests
Object
Package
Process
ProcessBuilder
ProcessHandle
RuntimePermission
RuntimeTests
ScopedValue
SecurityManager
Short
StackTraceElement
StackWalker
StrictMath
String
StringBuffer
AppendCharSequence.java
AppendSB.java
AppendStringBuilder.java
BufferForwarding.java
Capacity.java
CompactStringBuffer.java
CompactStringBufferSerialization.java
Comparison.java
ECoreIndexOf.java
Exceptions.java
GetCharsOverLength.java
GetCharsSrcEndLarger.java
HugeCapacity.java
IndexOf.java
InsertMaxValue.java
InsertNullString.java
Replace.java
SBBasher.java
SetLength.java
Substring.java
Supplementary.java
TestSynchronization.java
ToStringCache.java
Trim.java
StringBuilder
StringCoding
System
Thread
ThreadGroup
ThreadLocal
Throwable
WeakPairMap
annotation
constant
instrument
invoke
management
module
ref
reflect
runtime
AbstractCompressExpandTest.java
Compare.java
CompressExpandSanityTest.java
CompressExpandTest.java
HashCode.java
IntegralPrimitiveToString.java
PrimitiveSumMinMaxTest.java
ToString.java
math
net
nio
rmi
security
sql
text
time
util
javax
jdk
jni
lib
native_sanity
performance
sanity
security
sun
tools
ProblemList-AotJdk.txt
ProblemList-Virtual.txt
ProblemList-Xcomp.txt
ProblemList-shenandoah.txt
ProblemList-zgc.txt
ProblemList.txt
TEST.ROOT
TEST.groups
req.flg
start-Xvfb.sh
jtreg-ext
jtreg_test_thread_factory
langtools
lib
lib-test
make
micro
.gitattributes
.gitignore
ADDITIONAL_LICENSE_INFO
ASSEMBLY_EXCEPTION
CONTRIBUTING.md
LICENSE
Makefile
README.md
SECURITY.md
configure
Erik Joelsson 3789983e89 8187443: Forest Consolidation: Move files to unified layout
Reviewed-by: darcy, ihse
2017-09-12 19:03:39 +02:00

57 lines
1.9 KiB
Java

/*
* Copyright (c) 1999, 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.
*
* 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 4230290
* @summary Test GetChars method parameter checking
*/
public class GetCharsOverLength {
public static void main (String argv[]) {
StringBuffer sb = new StringBuffer("sample string buffer");
char dst[] = new char[30];
boolean failed = false;
int a[][] = {
{0, 0, dst.length + 1},
{0, 0, dst.length + 2},
{0, 0, dst.length + 20},
{5, 5, dst.length + 1},
{5, 5, dst.length + 2},
{5, 5, dst.length + 20}
};
for (int i = 0; i < a.length; i++) {
try {
sb.getChars(a[i][0], a[i][1], dst, a[i][2]);
throw new RuntimeException("Bounds test failed");
} catch (IndexOutOfBoundsException iobe) {
// Test passed
}
}
}
}