Merge branch 'master' into pmd/7.0.x
This commit is contained in:
@ -26,8 +26,6 @@ import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
public final class StringUtils {
|
||||
private StringUtils() {
|
||||
// to prevent instantiation
|
||||
@ -35,15 +33,11 @@ public final class StringUtils {
|
||||
|
||||
public static List<String> convertStringToListOfLines(String string) throws IOException {
|
||||
final List<String> lines = new ArrayList<>();
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new StringReader(string));
|
||||
try (BufferedReader reader = new BufferedReader(new StringReader(string))) {
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
lines.add(line);
|
||||
}
|
||||
} finally {
|
||||
IOUtils.closeQuietly(reader);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ package net.sourceforge.pmd.cpd;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@ -18,7 +20,7 @@ import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
|
||||
|
||||
public class ScalaTokenizerTest extends AbstractTokenizerTest {
|
||||
|
||||
private static final String ENCODING = "UTF-8";
|
||||
private static final Charset ENCODING = StandardCharsets.UTF_8;
|
||||
|
||||
private static final String FILENAME = "sample-LiftActor.scala";
|
||||
|
||||
|
Reference in New Issue
Block a user