*) better errorhandling for last commit

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2592 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent d0a5a53789
commit c5d3020941

@ -114,6 +114,8 @@ public class htmlFilterContentScraper extends htmlFilterAbstractScraper implemen
} }
public void setCharset(String charset) throws UnsupportedCharsetException { public void setCharset(String charset) throws UnsupportedCharsetException {
if (charset == null) return;
// testing if charset exists // testing if charset exists
Charset.forName(charset); Charset.forName(charset);

@ -53,6 +53,8 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI; import java.net.URI;
import java.nio.charset.UnsupportedCharsetException;
import de.anomic.net.URL; import de.anomic.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -550,7 +552,16 @@ public final class plasmaParser {
} else if (realtimeParsableMimeTypesContains(mimeType)) { } else if (realtimeParsableMimeTypesContains(mimeType)) {
// ...otherwise we make a scraper and transformer // ...otherwise we make a scraper and transformer
htmlFilterContentScraper scraper = new htmlFilterContentScraper(location); htmlFilterContentScraper scraper = new htmlFilterContentScraper(location);
scraper.setCharset(PARSER_MODE_URLREDIRECTOR);
// set the charset if known
if (charset != null) {
try {
scraper.setCharset(charset);
} catch (UnsupportedCharsetException e) {
serverLog.logWarning("PARSER", "parseSource2: unknown or unsupported charset '" + charset + "'");
return null;
}
}
OutputStream hfos = new htmlFilterOutputStream(null, scraper, null, false); OutputStream hfos = new htmlFilterOutputStream(null, scraper, null, false);
serverFileUtils.copy(sourceFile, hfos); serverFileUtils.copy(sourceFile, hfos);

Loading…
Cancel
Save