OPENFIREはEMOJI対応

2245 ワード

OpenfireでXMPPサーバを構築すると、クライアントがemojiの表情文字を送信するとオフラインになり、エラーログのクリップは次のようになります.
 2013.05.21 12:57:44 org.jivesoftware.openfire.nio.ConnectionHandler – Closing connection due to error while 
processing message: <message type=”chat” to=”[email protected]” dateline=”1369112264.017495″><body>   
emoji  </body></message> java.lang.NumberFormatException: For input string: “?” at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt
(Integer.java:481) at org.jivesoftware.openfire.net.MXParser.more(MXParser.java:384) at 
org.jivesoftware.openfire.net.MXParser.nextImpl(MXParser.java:85) at org.xmlpull.mxp1.MXParser.nextToken
(MXParser.java:1100) at org.dom4j.io.XMPPPacketReader.parseDocument(XMPPPacketReader.java:317) at
org.dom4j.io.XMPPPacketReader.read(XMPPPacketReader.java:154) at 
org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:159)

Javaコード
@Override  
    protected char more() throws IOException, XmlPullParserException {  
        final char codePoint = super.more(); // note – this does NOT return a  
                                                // codepoint now, but simply a  
                                                // (single byte) character!  
        if ((codePoint == 0x0)  
                || // 0×0 is not allowed, but flash clients insist on sending  
                    // this as the very first character of a stream. We should  
                    // stop allowing this codepoint after the first byte has  
                    // been parsed.  
                (codePoint == 0x9) || (codePoint == 0xA) || (codePoint == 0xD)  
                || ((codePoint >= 0x20) && (codePoint <= 0xFFFD))  
                || ((codePoint >= 0xE000) && (codePoint <= 0xFFFD))  
                || ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF))) {  
            return codePoint;  
        }  
        throw new XmlPullParserException("Illegal XML character: "  
                + Integer.parseInt(codePoint + "", 16));  
    }  

再コンパイルしてopenfireを得る.JAr、サーバ上のopenfireを置き換えます.jar、openfireサービスを再起動すればOKです