diff --git a/src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java b/src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java index f5799d3678..33aafed0df 100644 --- a/src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java +++ b/src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java @@ -327,7 +327,11 @@ private Annotation getDocument(Properties props, HttpExchange httpExchange) thro String text = IOUtils.slurpReader(IOUtils.encodedInputStreamReader(httpExchange.getRequestBody(), encoding)); if (contentType.equals(URL_ENCODED)) { - text = URLDecoder.decode(text, encoding); + try { + text = URLDecoder.decode(text, encoding); + } catch (IllegalArgumentException e) { + // ignore decoding errors so that libraries which don't specify a content type might not fail + } } // We use to trim. But now we don't. It seems like doing that is illegitimate. text = text.trim();