OPENFIRE支持EMOJI

用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=”18@chat.aiba.com” 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了

转载于:https://my.oschina.net/wzlee/blog/263516

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值