JavaChat / OakBot

A Java-based chat bot for Stackoverflow Chat
46 stars 32 forks source link

Exception thrown when "define" command is invoked #52

Closed mangstadt closed 3 years ago

mangstadt commented 3 years ago
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 50; White spaces are required between publicId and systemId.
        at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
        at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1471)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.scanExternalID(XMLScanner.java:1071)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.scanDoctypeDecl(XMLDocumentScannerImpl.java:645)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:908)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:541)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246)
        at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
        at java.xml/javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:122)
        at oakbot.util.Leaf.parse(Leaf.java:95)
        at oakbot.command.define.DefineCommand.onMessage(DefineCommand.java:80)
        at oakbot.listener.CommandListener.onMessage(CommandListener.java:91)
        at oakbot.bot.Bot.handleListeners(Bot.java:538)
        at oakbot.bot.Bot.handleMessage(Bot.java:311)
        at oakbot.bot.Bot.lambda$connect$0(Bot.java:184)
        at java.base/java.lang.Thread.run(Thread.java:832)
mangstadt commented 3 years ago

API was returning an HTML document saying to use https:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://www.dictionaryapi.com/api/v1/references/collegiate/xml/sparta?key=adecbd14-6fff-416f-a8d2-9b1ee13d61cb">here</a>.</p>
</body></html>

Changing the API address to use https solved the issue.

Fixed in 43c2a8757422b0c85934f6114f833e6e05479b9e