You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Nils Eckert (JIRA)" <ji...@codehaus.org> on 2008/03/27 15:03:58 UTC

[jira] Commented: (MNG-3242) It's not possible to get a property with unescaped & sign for urls

    [ http://jira.codehaus.org/browse/MNG-3242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=128878#action_128878 ] 

Nils Eckert commented on MNG-3242:
----------------------------------

I tried both.

Using a once escaped {{&}}-sign
{code:xml}
<jdbc.url>jdbc:mysql://localhost/mydb?user=myuser&amp;password=mypass&amp;useUnicode=true&amp;characterEncoding=utf-8</jdbc.url>
{code}
I get the following error:
{code}
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Cannot read project model from interpolating filter of serialized version.
	at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:378)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:290)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
	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:585)
	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.InvalidProjectModelException: Cannot read project model from interpolating filter of serialized version.
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:812)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:479)
	at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
	at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:537)
	at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:467)
	at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:364)
	... 11 more
Caused by: org.apache.maven.project.interpolation.ModelInterpolationException: Cannot read project model from interpolating filter of serialized version.
	at org.apache.maven.project.interpolation.RegexBasedModelInterpolator.interpolate(RegexBasedModelInterpolator.java:114)
	at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:946)
	at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:808)
	... 16 more
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: entity reference name can not contain character =' (position: START_TAG seen ...c:mysql://localhost/nefo?createDatabaseIfNotExist=true&useUnicode=... @133:85) 
	at org.codehaus.plexus.util.xml.pull.MXParser.parseEntityRef(MXParser.java:2219)
	at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1272)
	at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1090)
	at hidden.org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:187)
	at hidden.org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:94)
	at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parsePlugin(MavenXpp3Reader.java:2971)
	at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseBuild(MavenXpp3Reader.java:769)
	at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Reader.java:2240)
	at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:4438)
	at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:4449)
	at org.apache.maven.project.interpolation.RegexBasedModelInterpolator.interpolate(RegexBasedModelInterpolator.java:105)
	... 18 more
{code}

Using 
{code}<jdbc.url><![CDATA[jdbc:mysql://localhost/mydb?user=myuser&amp;password=mypass&amp;useUnicode=true&amp;characterEncoding=utf-8]]></jdbc.url>{code} is working. But the filtered properties file containts {{&amp;amp;}} instead of the expected {{&}}-sign.

If I'm using CDATA and do not escape the {{&}} sign, I'm getting an error similar to the first one.
{code}<jdbc.url><![CDATA[jdbc:mysql://localhost/mydb?user=myuser&password=mypass&useUnicode=true&characterEncoding=utf-8]]></jdbc.url>{code} 

For me it seems that there is no way to get an unescaped {{&}}-sign into a properties-file.





> It's not possible to get a property with unescaped & sign for urls
> ------------------------------------------------------------------
>
>                 Key: MNG-3242
>                 URL: http://jira.codehaus.org/browse/MNG-3242
>             Project: Maven 2
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.0.6
>            Reporter: Nils Eckert
>             Fix For: 2.0.x
>
>
> I found no way to create a property with a not escaped ampersand (&-sign). This is needed for a MySQL jdbc-connection String with some connection variabled and should be filtered in a properties file during compile phase.
> It tried to escape it with &amp; This leeds to following error: Project build error Cannot read project model from interpolating filter of serialized version.
> It is no option to use a double escaping with &amp;amp;. Here I get a &amp; in my connection url.
> I also tried to use a <[CDATA[ ... ]]> with the same problems. It's not possible to use & sign. And if I use &amp; this escaped tag appears in my properties file after filtering.

-- 
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