[ http://jira.codehaus.org/browse/MAVEN-1707?page=comments#action_47971 ] 

Elliotte Rusty Harold commented on MAVEN-1707:
----------------------------------------------

The bug is obvious to me, but I'm an XML wonk. A lot of people using Maven 
aren't. Dumping a stack trace and then asking the programmer to report the 
apparent bug in maven is not an appropriate response here. Maven should catch 
this exception and indicate it to the user with an appropriate error message. 
For instance, "Your project.xml file is malformed." and then pass along the 
error message and line and column numbers reported by the SAX parser. The stack 
trace should not be printed, and it should not say "You have encountered an 
unknown error running Maven. Please help us to correct this problem by 
following these simple steps: ..."

Everything about the current output indicates that this is a bug in Maven. 
However it's not. It's a common user mistake, and it should be reported as 
such. 

> Malformed project.xml caueses unexpected error
> ----------------------------------------------
>
>          Key: MAVEN-1707
>          URL: http://jira.codehaus.org/browse/MAVEN-1707
>      Project: Maven
>         Type: Bug
>     Versions: 1.0.2
>  Environment: Mac oS X 1.0.2, Java 1.4.2
>     Reporter: Elliotte Rusty Harold

>
>
> My project.xml is malformed. There is a ' character before the XMl 
> declaration that shouldn't be there. that is, it begins 
> `<?xml version="1.0" encoding="UTF-8"?>
> and it should begin
> <?xml version="1.0" encoding="UTF-8"?>
> Easy enough to fix (and for me to diagnose) but Maven gets really way more 
> confused by this than it should. 
> Even maven --info fails here. Maven should recognize this error for what it 
> is (malformed project.xml) and provide an appropriate error message to the 
> end user. Stack trace:
> ~/projects/jaxen$ maven cobertura
>  __  __
> |  \/  |__ _Apache__ ___
> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
> Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.
> org.xml.sax.SAXParseException: Content is not allowed in prolog.
>         at 
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 
> Source)
>         at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown 
> Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
>         at 
> org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown
>  Source)
>         at 
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
> Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>         at org.apache.commons.digester.Digester.parse(Digester.java:1527)
>         at org.apache.maven.MavenUtils.getNonJellyProject(MavenUtils.java:203)
>         at org.apache.maven.MavenUtils.getProject(MavenUtils.java:143)
>         at org.apache.maven.MavenUtils.getProject(MavenUtils.java:122)
>         at 
> org.apache.maven.MavenSession.initializeRootProject(MavenSession.java:232)
>         at org.apache.maven.MavenSession.initialize(MavenSession.java:172)
>         at org.apache.maven.cli.App.doMain(App.java:475)
>         at org.apache.maven.cli.App.main(App.java:1239)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at com.werken.forehead.Forehead.run(Forehead.java:551)
>         at com.werken.forehead.Forehead.main(Forehead.java:581)
> org.apache.maven.MavenException: Error parsing project.xml 
> '/Users/elharo/Projects/Jaxen/project.xml'
>         at org.apache.maven.MavenUtils.getNonJellyProject(MavenUtils.java:207)
>         at org.apache.maven.MavenUtils.getProject(MavenUtils.java:143)
>         at org.apache.maven.MavenUtils.getProject(MavenUtils.java:122)
>         at 
> org.apache.maven.MavenSession.initializeRootProject(MavenSession.java:232)
>         at org.apache.maven.MavenSession.initialize(MavenSession.java:172)
>         at org.apache.maven.cli.App.doMain(App.java:475)
>         at org.apache.maven.cli.App.main(App.java:1239)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at com.werken.forehead.Forehead.run(Forehead.java:551)
>         at com.werken.forehead.Forehead.main(Forehead.java:581)
> --- Nested Exception ---
> org.xml.sax.SAXParseException: Content is not allowed in prolog.
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>         at org.apache.commons.digester.Digester.parse(Digester.java:1527)
>         at org.apache.maven.MavenUtils.getNonJellyProject(MavenUtils.java:203)
>         at org.apache.maven.MavenUtils.getProject(MavenUtils.java:143)
>         at org.apache.maven.MavenUtils.getProject(MavenUtils.java:122)
>         at 
> org.apache.maven.MavenSession.initializeRootProject(MavenSession.java:232)
>         at org.apache.maven.MavenSession.initialize(MavenSession.java:172)
>         at org.apache.maven.cli.App.doMain(App.java:475)
>         at org.apache.maven.cli.App.main(App.java:1239)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at com.werken.forehead.Forehead.run(Forehead.java:551)
>         at com.werken.forehead.Forehead.main(Forehead.java:581)
> You have encountered an unknown error running Maven. Please help us to 
> correct 
> this problem by following these simple steps:
> - read the Maven FAQ at http://maven.apache.org/faq.html
> - run the same command again with the '-e' parameter, eg maven -e jar
> - search the maven-user archives for the error at
> http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]
> - post the output of maven -e to JIRA at
> http://jira.codehaus.org/BrowseProject.jspa?id=10030 (you must sign up first)
> - run 'maven --info' and post the output as the environment to the bug above
> Total time: 1 seconds
> Finished at: Thu Oct 06 06:41:25 EDT 2005

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to