Replacing deprecated IO methods with ones that specify a charset
Standardizing with StandardCharsets.UTF_8, given that it was used in several places of code already, and it provides compile-time checking (as opposed to "UTF-8")
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
package net.sourceforge.pmd.cpd;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Before;
|
||||
@ -25,7 +26,7 @@ public class ObjectiveCTokenizerTest extends AbstractTokenizerTest {
|
||||
|
||||
@Override
|
||||
public String getSampleCode() throws IOException {
|
||||
return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME));
|
||||
return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -5,6 +5,7 @@
|
||||
package net.sourceforge.pmd.cpd;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Before;
|
||||
@ -26,7 +27,7 @@ public class UTF8EscapesInStringLiteralObjCTokenizerTest extends AbstractTokeniz
|
||||
|
||||
@Override
|
||||
public String getSampleCode() throws IOException {
|
||||
return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME), "UTF-8");
|
||||
return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -7,6 +7,7 @@ package net.sourceforge.pmd.cpd;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Before;
|
||||
@ -29,7 +30,7 @@ public class UnicodeObjectiveCTokenizerTest extends AbstractTokenizerTest {
|
||||
|
||||
@Override
|
||||
public String getSampleCode() throws IOException {
|
||||
return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME), "UTF-8");
|
||||
return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user