You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jason van Zyl (JIRA)" <ji...@codehaus.org> on 2007/02/28 18:33:45 UTC
[jira] Closed: (MNG-2827) java.lang.StringIndexOutOfBoundsException
if embedded into Eclipse plugin and required plugin parameter is missing
[ http://jira.codehaus.org/browse/MNG-2827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jason van Zyl closed MNG-2827.
------------------------------
Resolution: Fixed
Patch applied and tested. Thanks.
> java.lang.StringIndexOutOfBoundsException if embedded into Eclipse plugin and required plugin parameter is missing
> ------------------------------------------------------------------------------------------------------------------
>
> Key: MNG-2827
> URL: http://jira.codehaus.org/browse/MNG-2827
> Project: Maven 2
> Issue Type: Bug
> Components: Embedding
> Affects Versions: 2.1.x
> Reporter: Stepan Roh
> Assigned To: Jason van Zyl
>
> Problem is in org.apache.maven.usability.plugin.ExpressionDocumenter.initializeDocLoader() which does some file-based magic tricks, but that does not work if Maven is embedded into Eclipse plugin (where resources have "bundle" scheme and not "file" and more importantly their path is different).
> Test case:
> - execute goal "jar:sign" on some basic pom.xml by using MavenEmbedder.execute()
> - proper behaviour is to throw MavenExecutionException where it says that required parameter "alias" is missing
> - but when executed from Eclipse (as part of some Eclipse plugin) it throws (line numbers may vary):
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> at java.lang.String.substring(String.java:1444)
> at org.apache.maven.usability.plugin.ExpressionDocumenter.initializeDocLoader(ExpressionDocumenter.java:148)
> at org.apache.maven.usability.plugin.ExpressionDocumenter.load(ExpressionDocumenter.java:53)
> at org.apache.maven.plugin.PluginConfigurationException.addParameterUsageInfo(PluginConfigurationException.java:107)
> at org.apache.maven.plugin.PluginConfigurationException.buildConfigurationDiagnosticMessage(PluginConfigurationException.java:274)
> at org.apache.maven.usability.PluginConfigurationDiagnoser.diagnose(PluginConfigurationDiagnoser.java:49)
> at org.apache.maven.usability.diagnostics.ErrorDiagnostics.diagnose(ErrorDiagnostics.java:81)
> at org.apache.maven.DefaultMaven.logDiagnostics(DefaultMaven.java:774)
> at org.apache.maven.DefaultMaven.logError(DefaultMaven.java:728)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:188)
> at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:746)
> The problematic line is:
> myClasspathEntry = myClasspathEntry.substring( 0, myClasspathEntry.length() - ( myResourcePath.length() + 2 ) );
> I replaced the initializeDocLoader()'s body with
> return ExpressionDocumenter.class.getClassLoader();
> ... which works both inside and outside of Eclipse, but I tested it only on embedder and do not know it's impact on CLI version.
--
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