| @@ -2,9 +2,6 @@ package altk.comm.engine; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.nio.charset.Charset; | |||||
| import java.nio.charset.CharsetDecoder; | |||||
| import java.nio.charset.CodingErrorAction; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.Vector; | import java.util.Vector; | ||||
| @@ -34,6 +31,8 @@ import altk.comm.engine.exception.InternalErrorException; | |||||
| import altk.comm.engine.exception.NonExistentException; | import altk.comm.engine.exception.NonExistentException; | ||||
| import altk.comm.engine.exception.PlatformError; | import altk.comm.engine.exception.PlatformError; | ||||
| import altk.comm.engine.exception.PlatformException; | import altk.comm.engine.exception.PlatformException; | ||||
| import altk.common.engine.util.LoggingInputStreamReader; | |||||
| import altk.common.engine.util.UTF8BenevolentDecoder; | |||||
| /** | /** | ||||
| * Abstract class extending Broadcast by providing an implementation of the decode | * Abstract class extending Broadcast by providing an implementation of the decode | ||||
| @@ -101,12 +100,10 @@ public abstract class XMLDOMBroadcast extends Broadcast | |||||
| int contentLength = request.getContentLength(); | int contentLength = request.getContentLength(); | ||||
| CommonLogger.activity.info("Receiving " + contentLength + " bytes of data"); | CommonLogger.activity.info("Receiving " + contentLength + " bytes of data"); | ||||
| // Clean content off bad UTF-8 characters. | |||||
| Charset utf8Charset = Charset.forName("UTF-8"); | |||||
| CharsetDecoder utf8Decoder = utf8Charset.newDecoder(); | |||||
| utf8Decoder.onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE); | |||||
| LoggingInputStreamReader ins = new LoggingInputStreamReader(inb, utf8Decoder); | |||||
| InputSource is = new InputSource(ins); | |||||
| // Convert InputStream inb into InputSource, using the UTF-8 decoder that | |||||
| // cleans content off bad UTF-8 characters. | |||||
| InputSource is = new InputSource(new LoggingInputStreamReader(inb, | |||||
| UTF8BenevolentDecoder.getDecoder(), CommonLogger.activity)); | |||||
| xmlDoc = builder.parse(is); | xmlDoc = builder.parse(is); | ||||
| } | } | ||||
| catch (SAXException e) | catch (SAXException e) | ||||