Skip to content

Commit 4b82840

Browse files
asgerfsmowton
authored andcommitted
Revert "JS: Skip files with unsupported file encoding"
1 parent ab37ae6 commit 4b82840

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

javascript/extractor/src/com/semmle/js/extractor/FileExtractor.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.io.FileInputStream;
66
import java.io.FileReader;
77
import java.io.IOException;
8-
import java.nio.charset.CharacterCodingException;
8+
import java.nio.charset.Charset;
99
import java.nio.charset.StandardCharsets;
1010
import java.nio.file.Path;
1111
import java.util.LinkedHashSet;
@@ -17,7 +17,6 @@
1717
import com.semmle.js.extractor.trapcache.ITrapCache;
1818
import com.semmle.util.data.StringUtil;
1919
import com.semmle.util.exception.Exceptions;
20-
import com.semmle.util.exception.ResourceError;
2120
import com.semmle.util.extraction.ExtractorOutputConfig;
2221
import com.semmle.util.files.FileUtil;
2322
import com.semmle.util.io.WholeIO;
@@ -439,16 +438,7 @@ public Integer extract(File f, ExtractorState state) throws IOException {
439438
}
440439

441440
// populate source archive
442-
WholeIO wholeIO = new WholeIO(config.getDefaultEncoding(), true);
443-
String source = wholeIO.read(f);
444-
if (source == null) {
445-
if (wholeIO.getLastException() instanceof CharacterCodingException) {
446-
System.err.println("Skipped due to unsupported character encoding: " + f);
447-
return 0;
448-
} else {
449-
throw new ResourceError("Failed to read file " + f, wholeIO.getLastException());
450-
}
451-
}
441+
String source = new WholeIO(config.getDefaultEncoding()).strictread(f);
452442
outputConfig.getSourceArchive().add(f, source);
453443

454444
// extract language-independent bits

0 commit comments

Comments
 (0)