Skip to content

Commit

Permalink
Fix secondary failure on substring with maxFieldSize
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurvl committed Feb 9, 2018
1 parent ed114bb commit 1dbc32a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -276,7 +276,7 @@ public String getInternalString(ColumnInformation columnInfo, Calendar cal, Time
case STRING:
if (getMaxFieldSize() > 0) {
return new String(buf, pos, Math.min(getMaxFieldSize() * 3, length), StandardCharsets.UTF_8)
.substring(0, getMaxFieldSize());
.substring(0, Math.min(getMaxFieldSize(),length));
}
return new String(buf, pos, length, StandardCharsets.UTF_8);

Expand Down Expand Up @@ -326,7 +326,7 @@ public String getInternalString(ColumnInformation columnInfo, Calendar cal, Time
default:
if (getMaxFieldSize() > 0) {
return new String(buf, pos, Math.min(getMaxFieldSize() * 3, length), StandardCharsets.UTF_8)
.substring(0, getMaxFieldSize());
.substring(0, Math.min(getMaxFieldSize(),length));
}
return new String(buf, pos, length, StandardCharsets.UTF_8);
}
Expand Down
Expand Up @@ -221,7 +221,7 @@ public String getInternalString(ColumnInformation columnInfo, Calendar cal, Time

if (maxFieldSize > 0) {
return new String(buf, pos, Math.min(maxFieldSize * 3, length), StandardCharsets.UTF_8)
.substring(0, maxFieldSize);
.substring(0, Math.min(maxFieldSize, length));
}

return new String(buf, pos, length, StandardCharsets.UTF_8);
Expand Down
Expand Up @@ -58,4 +58,4 @@ public final class Version {
public static final int minorVersion = 2;
public static final int patchVersion = 1;
public static final String qualifier = "";
}
}

0 comments on commit 1dbc32a

Please sign in to comment.