jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x Changes Plugin
  • MCHANGES-50

Handle JIRA authentication failure

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0-beta-2
  • Fix Version/s: 2.0-beta-3
  • Component/s: jira
  • Labels:
    None

Description

Private instances of JIRA require authentication. If the changes report queries this server, the server returns a HTML 500 error page, rather than the expected XML content and the changes plugin throws an exception. This case should be handled and a warning printed to the screen (maybe with a hint as to the parameter(s) they need to set) so the site generation can continue.

See http://jira.webifysolutions.com for instance. You can use this URL for one-off testing of this fix.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. GZip Archive
    MCHANGES-50.tar.gz
    25/Jul/06 3:50 PM
    21 kB
    Jochen Wiedmann

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Dennis Lundberg added a comment - 25/Jul/06 3:08 PM

Mike, I'm a bit confused.

Are you concerned about the case where the issueManagement/url is configured to a private (one that needs username/password) JIRA instance and the developer has forgotten to configure jiraUser/jiraPassword in the plugin configuration? Then we just need a better handling of the response status code 500.

Trying this a bit revealed that the same exception is thrown if jiraUser/jiraPassword is configured but are not valid to login. We need to check the response status code there as well.

Show
Dennis Lundberg added a comment - 25/Jul/06 3:08 PM Mike, I'm a bit confused. Are you concerned about the case where the issueManagement/url is configured to a private (one that needs username/password) JIRA instance and the developer has forgotten to configure jiraUser/jiraPassword in the plugin configuration? Then we just need a better handling of the response status code 500. Trying this a bit revealed that the same exception is thrown if jiraUser/jiraPassword is configured but are not valid to login. We need to check the response status code there as well.
Hide
Permalink
Mike Perham added a comment - 25/Jul/06 3:17 PM

Exactly. We do not want to use the JIRA report but have not configured our reportSets to exclude the report. So we get an exception every time it runs. I would rather this just be a warning complaining about insufficient configuration.

It would be nice if you could document a best practice to configure the jiraPassword without hard coding it (e.g. through properties and profiles?) in the POM.

Show
Mike Perham added a comment - 25/Jul/06 3:17 PM Exactly. We do not want to use the JIRA report but have not configured our reportSets to exclude the report. So we get an exception every time it runs. I would rather this just be a warning complaining about insufficient configuration. It would be nice if you could document a best practice to configure the jiraPassword without hard coding it (e.g. through properties and profiles?) in the POM.
Hide
Permalink
Jochen Wiedmann added a comment - 25/Jul/06 3:50 PM

Mike, I have tried to reproduce your problem, using the attached test project, but could not. Could you please be more specific how to reproduce it?

Show
Jochen Wiedmann added a comment - 25/Jul/06 3:50 PM Mike, I have tried to reproduce your problem, using the attached test project, but could not. Could you please be more specific how to reproduce it?
Hide
Permalink
Dennis Lundberg added a comment - 25/Jul/06 6:44 PM

Making some progress on this, but got stuck. What is the best way to know whether we need to use authentication or not?

The only solution I can think of is to try to access the JIRA instance without username/password first. If we get a status 500 back then we probably need to authenticate, otherwise we don't.

Any thoughts on this?

Show
Dennis Lundberg added a comment - 25/Jul/06 6:44 PM Making some progress on this, but got stuck. What is the best way to know whether we need to use authentication or not? The only solution I can think of is to try to access the JIRA instance without username/password first. If we get a status 500 back then we probably need to authenticate, otherwise we don't. Any thoughts on this?
Hide
Permalink
Mike Perham added a comment - 25/Jul/06 8:41 PM

Dennis, that's the crux of my issue. There's no way you can know. You just need to check the recv'd content for a 500 error and key phrases like "Please log in". If you see that, don't throw an exception but just print a configuration warning to the console and generate an report summarizing the problem.

Show
Mike Perham added a comment - 25/Jul/06 8:41 PM Dennis, that's the crux of my issue. There's no way you can know. You just need to check the recv'd content for a 500 error and key phrases like "Please log in". If you see that, don't throw an exception but just print a configuration warning to the console and generate an report summarizing the problem.
Hide
Permalink
Jochen Wiedmann added a comment - 26/Jul/06 1:07 AM

Mike, are you sure about the 500 error? If so, then Jira behaves very unfortunate, as 500 is "Internal Server Error", which is more than unusual for authentication requests. Besides, please note that I could not find any problems with http://jira.webifysolutions.com/ as a Jira server. (See the attached test project.)

Show
Jochen Wiedmann added a comment - 26/Jul/06 1:07 AM Mike, are you sure about the 500 error? If so, then Jira behaves very unfortunate, as 500 is "Internal Server Error", which is more than unusual for authentication requests. Besides, please note that I could not find any problems with http://jira.webifysolutions.com/ as a Jira server. (See the attached test project.)
Hide
Permalink
Denis Cabasson added a comment - 26/Jul/06 1:11 AM

Same as Jochen....

Things are working (fine?) here, the requested URL returning a XML document without any JIRA entries.

When did you get a 500 reply?

Show
Denis Cabasson added a comment - 26/Jul/06 1:11 AM Same as Jochen.... Things are working (fine?) here, the requested URL returning a XML document without any JIRA entries. When did you get a 500 reply?
Hide
Permalink
Mike Perham added a comment - 26/Jul/06 9:51 AM

I think the plugin is unable to determine the project ID automatically because it gets a "Please log in" response to its request for the project home page and so the IssueNavigator GET fails due to a null pid parameter. Make more sense?

[INFO] Generate "Jira Report" report.
log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient).
log4j:WARN Please initialize the log4j system properly.
[INFO] JIRA lives at: http://jira.webifysolutions.com
[INFO] JIRA URL http://jira.webifysolutions.com/browse/WR doesn't include a pid, trying to get it
[INFO] Successfully reached JIRA.
[ERROR] Unable to get JIRA pid using the url http://jira.webifysolutions.com/browse/WR
[INFO] Downloading http://jira.webifysolutions.com/secure/IssueNavigator.jspa?view=rss&pid=null&sort
er/field=created&sorter/order=DESC&sorter/field=priority&sorter/order=DESC&tempMax=100&reset=true&de
corator=none
[WARNING] Received: [500]
org.xml.sax.SAXParseException: Expected "</link>" to terminate element starting on line 9.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3370)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1697)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
at org.apache.maven.plugin.jira.JiraXML.<init>(JiraXML.java:56)
at org.apache.maven.plugin.jira.JiraReportGenerator.<init>(JiraReportGenerator.java:40)
at org.apache.maven.plugin.jira.JiraMojo.executeReport(JiraMojo.java:188)

Show
Mike Perham added a comment - 26/Jul/06 9:51 AM I think the plugin is unable to determine the project ID automatically because it gets a "Please log in" response to its request for the project home page and so the IssueNavigator GET fails due to a null pid parameter. Make more sense? [INFO] Generate "Jira Report" report. log4j:WARN No appenders could be found for logger (org.apache.commons.httpclient.HttpClient). log4j:WARN Please initialize the log4j system properly. [INFO] JIRA lives at: http://jira.webifysolutions.com [INFO] JIRA URL http://jira.webifysolutions.com/browse/WR doesn't include a pid, trying to get it [INFO] Successfully reached JIRA. [ERROR] Unable to get JIRA pid using the url http://jira.webifysolutions.com/browse/WR [INFO] Downloading http://jira.webifysolutions.com/secure/IssueNavigator.jspa?view=rss&pid=null&sort er/field=created&sorter/order=DESC&sorter/field=priority&sorter/order=DESC&tempMax=100&reset=true&de corator=none [WARNING] Received: [500] org.xml.sax.SAXParseException: Expected "</link>" to terminate element starting on line 9. at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376) at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3370) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1697) at org.apache.crimson.parser.Parser2.content(Parser2.java:1963) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691) at org.apache.crimson.parser.Parser2.content(Parser2.java:1963) at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691) at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667) at org.apache.crimson.parser.Parser2.parse(Parser2.java:337) at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at javax.xml.parsers.SAXParser.parse(SAXParser.java:281) at org.apache.maven.plugin.jira.JiraXML.<init>(JiraXML.java:56) at org.apache.maven.plugin.jira.JiraReportGenerator.<init>(JiraReportGenerator.java:40) at org.apache.maven.plugin.jira.JiraMojo.executeReport(JiraMojo.java:188)
Hide
Permalink
Dennis Lundberg added a comment - 26/Jul/06 6:36 PM

I've committed a couple of changes to the plugin that will help this issue. It's not finished yet, but were on the way. I'd appreciate if someone could give it a try and give me some feedback on the log messages that are output.

The thing that's left to do is to tell the plugin not to generate a report. But this is way past the time when canGenerateReport() is called. How can this be done? I'm getting an NPE in org.apache.maven.tools.plugin.generator.PluginXdocGenerator.execute because there is no report to generate.

Show
Dennis Lundberg added a comment - 26/Jul/06 6:36 PM I've committed a couple of changes to the plugin that will help this issue. It's not finished yet, but were on the way. I'd appreciate if someone could give it a try and give me some feedback on the log messages that are output. The thing that's left to do is to tell the plugin not to generate a report. But this is way past the time when canGenerateReport() is called. How can this be done? I'm getting an NPE in org.apache.maven.tools.plugin.generator.PluginXdocGenerator.execute because there is no report to generate.
Hide
Permalink
Mike Perham added a comment - 26/Jul/06 9:29 PM

Dennis, can you just generate a report that basically says "Authentication error generating report"? The alternative is to move the server communication into canGenerateReport and just cache the results until you actually generate the report. I have no problem with the former as I recognize my case is somewhat of an edge case.

Show
Mike Perham added a comment - 26/Jul/06 9:29 PM Dennis, can you just generate a report that basically says "Authentication error generating report"? The alternative is to move the server communication into canGenerateReport and just cache the results until you actually generate the report. I have no problem with the former as I recognize my case is somewhat of an edge case.
Hide
Permalink
Dennis Lundberg added a comment - 02/Aug/07 2:31 PM

It turns out that my test project was busted in other respects. After fixing that I now get a pretty "empty" report that says that an error occurred and directing to the console for more info.

Show
Dennis Lundberg added a comment - 02/Aug/07 2:31 PM It turns out that my test project was busted in other respects. After fixing that I now get a pretty "empty" report that says that an error occurred and directing to the console for more info.

People

  • Assignee:
    Dennis Lundberg
    Reporter:
    Mike Perham
Vote (1)
Watch (1)

Dates

  • Created:
    25/Jul/06 1:08 PM
    Updated:
    02/Aug/07 2:31 PM
    Resolved:
    02/Aug/07 2:31 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.