From cd8082b4e33c51b5ad7cc3cb6acb131e1ab19f02 Mon Sep 17 00:00:00 2001 From: danielr Date: Thu, 20 Nov 2008 11:18:19 +0000 Subject: [PATCH] fix for http://forum.yacy-websuche.de/viewtopic.php?f=5&t=1111#p11166 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5350 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/http/httpResponseHeader.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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); }