summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-05-23 18:07:46 -0700
committerElliott Hughes <enh@google.com>2011-05-23 18:07:46 -0700
commit8bc9296d071a77994b6418df2edb120d6a9f70ac (patch)
tree2b21f6474773ecae68a7fe807b049d9e41a72cb9 /luni
parent78b020b8412d212fa052b7ddf630ca6058c846be (diff)
downloadlibcore-8bc9296d071a77994b6418df2edb120d6a9f70ac.zip
libcore-8bc9296d071a77994b6418df2edb120d6a9f70ac.tar.gz
libcore-8bc9296d071a77994b6418df2edb120d6a9f70ac.tar.bz2
Fix the deprected overload of String.getBytes.
Previously, this would unconditionally throw ;-) Change-Id: Ia62eb6febcfca2a1a9f546935b092141e698d0b2
Diffstat (limited to 'luni')
-rw-r--r--luni/src/main/java/java/lang/String.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/luni/src/main/java/java/lang/String.java b/luni/src/main/java/java/lang/String.java
index a3d2cb4..5991f7a 100644
--- a/luni/src/main/java/java/lang/String.java
+++ b/luni/src/main/java/java/lang/String.java
@@ -805,6 +805,7 @@ outer:
*/
@Deprecated
public void getBytes(int start, int end, byte[] data, int index) {
+ // Note: last character not copied!
if (start >= 0 && start <= end && end <= count) {
end += offset;
try {
@@ -814,8 +815,9 @@ outer:
} catch (ArrayIndexOutOfBoundsException ignored) {
throw failedBoundsCheck(data.length, index, end - start);
}
+ } else {
+ throw startEndAndLength(start, end);
}
- throw startEndAndLength(start, end);
}
/**
@@ -892,7 +894,7 @@ outer:
* index}
*/
public void getChars(int start, int end, char[] buffer, int index) {
- // NOTE last character not copied!
+ // Note: last character not copied!
if (start >= 0 && start <= end && end <= count) {
System.arraycopy(value, start + offset, buffer, index, end - start);
} else {