mirror of https://github.com/apache/openjpa.git
Fixed error in substring range check.
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@487923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
264356a23f
commit
d98ca1d91d
|
@ -51,9 +51,9 @@ class Substring
|
|||
if (arg instanceof Object[]) {
|
||||
Object[] args = (Object[]) arg;
|
||||
int start = ((Number) args[0]).intValue();
|
||||
int end = Math.min(((Number) args[1]).intValue(),
|
||||
str.toString().length() - start + 1);
|
||||
return str.toString().substring(start, end);
|
||||
int end = ((Number) args[1]).intValue();
|
||||
String string = str == null ? "" : str.toString();
|
||||
return string.substring(start, Math.min(end, string.length()));
|
||||
}
|
||||
return str.toString().substring(((Number) arg).intValue());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue