Skip to content

Conversation

Unihedro
Copy link
Owner

I'm not sure if it actually works consistently though, and plus it could sure use a review. I've used HTTP requests instead of using the browser window of HTMLUnit, as the Stack Exchange login page generates a dynamic iframe, which is not possible to handle directly. Since the login method stands out of its own as it doesn't use the browser, I've isolated the code into its own method and called it when necessary.

Additionally, fixes string concatenation in a loop used as a parameter, which comes with undesired side effect.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make stackexchange the if-case and handle the problematic login in a separate method?

@Vogel612
Copy link
Collaborator

Vogel612 commented Apr 4, 2015

Currently trying to login with openid results in a SAXParseException, because the HTML of the login page is invalid:

        <script type="text/javascript">common.bustFrames();</script>            
        <link rel="openid.server" href="https://openid.stackexchange.com/openid/provider">
        <link rel="openid2.provider" href="https://openid.stackexchange.com/openid/provider">
</head>

With the following stacktrace:

[Fatal Error] :16:7: The element type "link" must be terminated by the matching 
end-tag "</link>".
Apr 04, 2015 3:04:02 PM com.gmail.inverseconduit.chat.StackExchangeChat openIdLo
gin
SEVERE: Parsing response text as DOM has caused a parse exception.
org.xml.sax.SAXParseException; lineNumber: 16; columnNumber: 7; The element type
 "link" must be terminated by the matching end-tag "</link>".
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
    at com.gmail.inverseconduit.chat.StackExchangeChat.openIdLogin(Unknown Source)
    at com.gmail.inverseconduit.chat.StackExchangeChat.login(Unknown Source)
    at com.gmail.inverseconduit.Main.main(Unknown Source)

@Vogel612
Copy link
Collaborator

Vogel612 commented Apr 7, 2015

This cannot be completed as of now, since the used DOM-Parser is not resilient enough to properly parse the served login pages for the required data.

Unbalanced Tags should be ignored or corrected on a best-effort basis when parsing malformed HTML as it is served on the relevant login pages.

@Vogel612
Copy link
Collaborator

Vogel612 commented May 3, 2015

Deferred until further notice, because completion of http://github.com/Unihedro/JChatExchange makes this moot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants