mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WEB-14926 org.xml.sax.SAXParseException: expected Element when open page in browser
This commit is contained in:
@@ -30,11 +30,13 @@ import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.http.FullHttpRequest;
|
||||
import io.netty.handler.codec.http.HttpMethod;
|
||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||
import io.netty.handler.codec.http.QueryStringDecoder;
|
||||
import org.apache.xmlrpc.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.io.Responses;
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -94,10 +96,15 @@ public class XmlRpcServerImpl implements XmlRpcServer {
|
||||
|
||||
if (request.method() == HttpMethod.POST) {
|
||||
ByteBuf result;
|
||||
ByteBufInputStream in = new ByteBufInputStream(request.content());
|
||||
ByteBuf content = request.content();
|
||||
if (content.readableBytes() == 0) {
|
||||
Responses.sendStatus(HttpResponseStatus.BAD_REQUEST, context.channel(), request);
|
||||
return true;
|
||||
}
|
||||
|
||||
ByteBufInputStream in = new ByteBufInputStream(content);
|
||||
try {
|
||||
XmlRpcServerRequest xmlRpcServerRequest = new XmlRpcRequestProcessor().decodeRequest(in);
|
||||
|
||||
if (StringUtil.isEmpty(xmlRpcServerRequest.getMethodName())) {
|
||||
LOG.warn("method name empty");
|
||||
return false;
|
||||
@@ -106,6 +113,11 @@ public class XmlRpcServerImpl implements XmlRpcServer {
|
||||
Object response = invokeHandler(getHandler(xmlRpcServerRequest.getMethodName(), handlers == null ? handlerMapping : handlers), xmlRpcServerRequest);
|
||||
result = Unpooled.wrappedBuffer(new XmlRpcResponseProcessor().encodeResponse(response, CharsetToolkit.UTF8));
|
||||
}
|
||||
catch (SAXParseException e) {
|
||||
LOG.warn(e);
|
||||
Responses.sendStatus(HttpResponseStatus.BAD_REQUEST, context.channel(), request);
|
||||
return true;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
context.channel().close();
|
||||
LOG.error(e);
|
||||
|
||||
Reference in New Issue
Block a user