Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix for http://forum.yacy-websuche.de/viewtopic.php?f=5&t=1111#p11166

danielrcd8082b4e33c
diff --git a/source/de/anomic/http/httpResponseHeader.java b/source/de/anomic/http/httpResponseHeader.java
index 5049c949d..242450818 100755
--- a/source/de/anomic/http/httpResponseHeader.java
+++ b/source/de/anomic/http/httpResponseHeader.java
@@ -24,6 +24,7 @@
package de.anomic.http;
import java.nio.charset.Charset;
+import java.nio.charset.IllegalCharsetNameException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -129,10 +130,14 @@ public class httpResponseHeader extends httpHeader {
charSetName = DEFAULT_CHARSET;
}
// maybe the charset is valid but not installed on this computer
- if(!Charset.isSupported(charSetName)) {
- serverLog.logWarning("httpHeader", "charset '"+ charSetName +"' is not supported on this machine, using default ("+ Charset.defaultCharset().name() +")");
- // use system default
- return Charset.defaultCharset();
+ try {
+ if(!Charset.isSupported(charSetName)) {
+ serverLog.logWarning("httpHeader", "charset '"+ charSetName +"' is not supported on this machine, using default ("+ Charset.defaultCharset().name() +")");
+ // use system default
+ return Charset.defaultCharset();
+ }
+ } catch(IllegalCharsetNameException e) {
+ serverLog.logSevere("httpHeader", "Charset in header is illegal: '"+ charSetName +"'\n "+ toString());
}
return Charset.forName(charSetName);
}