Pārlūkot izejas kodu

Changed to use UTF8BenevolentDecoder class instead of generating a kind UTF-8 char decoder.

tags/Production_5_21_2012
ymlam pirms 13 gadiem
vecāks
revīzija
dc785485de
1 mainītis faili ar 6 papildinājumiem un 9 dzēšanām
  1. +6
    -9
      src/altk/comm/engine/XMLDOMBroadcast.java

+ 6
- 9
src/altk/comm/engine/XMLDOMBroadcast.java Parādīt failu

@@ -2,9 +2,6 @@ package altk.comm.engine;

import java.io.IOException;
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.Map;
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.PlatformError;
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
@@ -101,12 +100,10 @@ public abstract class XMLDOMBroadcast extends Broadcast
int contentLength = request.getContentLength();
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);
}
catch (SAXException e)


Notiek ielāde…
Atcelt
Saglabāt