Fixed build (explicitly specified charset for new String(byte[]))

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1850366 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vladislav Galas 2019-01-04 14:25:11 +00:00
parent 1f9b858ae5
commit 6d87e36227
1 changed files with 3 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
@ -1166,7 +1167,7 @@ public abstract class BaseTestCell {
assertEquals(CellType.NUMERIC, cell.getCellType()); assertEquals(CellType.NUMERIC, cell.getCellType());
int badLength = cell.getSheet().getWorkbook().getSpreadsheetVersion().getMaxTextLength() + 1; int badLength = cell.getSheet().getWorkbook().getSpreadsheetVersion().getMaxTextLength() + 1;
String badStringValue = new String(new byte[badLength]); String badStringValue = new String(new byte[badLength], StandardCharsets.UTF_8);
try { try {
cell.setCellValue(badStringValue); cell.setCellValue(badStringValue);
@ -1188,7 +1189,7 @@ public abstract class BaseTestCell {
int badLength = cell.getSheet().getWorkbook().getSpreadsheetVersion().getMaxTextLength() + 1; int badLength = cell.getSheet().getWorkbook().getSpreadsheetVersion().getMaxTextLength() + 1;
RichTextString badStringValue = cell.getSheet().getWorkbook().getCreationHelper(). RichTextString badStringValue = cell.getSheet().getWorkbook().getCreationHelper().
createRichTextString(new String(new byte[badLength])); createRichTextString(new String(new byte[badLength], StandardCharsets.UTF_8));
try { try {
cell.setCellValue(badStringValue); cell.setCellValue(badStringValue);