|
5 | 5 | import java.io.FileInputStream; |
6 | 6 | import java.io.FileReader; |
7 | 7 | import java.io.IOException; |
8 | | -import java.nio.charset.CharacterCodingException; |
| 8 | +import java.nio.charset.Charset; |
9 | 9 | import java.nio.charset.StandardCharsets; |
10 | 10 | import java.nio.file.Path; |
11 | 11 | import java.util.LinkedHashSet; |
|
17 | 17 | import com.semmle.js.extractor.trapcache.ITrapCache; |
18 | 18 | import com.semmle.util.data.StringUtil; |
19 | 19 | import com.semmle.util.exception.Exceptions; |
20 | | -import com.semmle.util.exception.ResourceError; |
21 | 20 | import com.semmle.util.extraction.ExtractorOutputConfig; |
22 | 21 | import com.semmle.util.files.FileUtil; |
23 | 22 | import com.semmle.util.io.WholeIO; |
@@ -439,16 +438,7 @@ public Integer extract(File f, ExtractorState state) throws IOException { |
439 | 438 | } |
440 | 439 |
|
441 | 440 | // 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); |
452 | 442 | outputConfig.getSourceArchive().add(f, source); |
453 | 443 |
|
454 | 444 | // extract language-independent bits |
|
0 commit comments