Maven 1

Malformed project.xml caueses unexpected error

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.2
  • Fix Version/s: 1.1-beta-3
  • Component/s: None
  • Labels:
    None
  • Environment:
    Mac oS X 1.0.2, Java 1.4.2
  • Number of attachments :
    0

Description

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:

Total time: 1 seconds
Finished at: Thu Oct 06 06:41:25 EDT 2005

Issue Links

Activity

Hide
Lukas Theussl added a comment -

I think the error is clear enough:

Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.

What else do you want to know?

Show
Lukas Theussl added a comment - I think the error is clear enough: Parse Fatal Error at line 1 column 1: Content is not allowed in prolog. What else do you want to know?
Hide
Elliotte Rusty Harold added a comment -

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.

Show
Elliotte Rusty Harold added a comment - 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.
Hide
Arnaud Heritier added a comment -

We have to catch this error and to display a more user friendly message

Show
Arnaud Heritier added a comment - We have to catch this error and to display a more user friendly message

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: