You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Stepan Roh (JIRA)" <ji...@codehaus.org> on 2007/02/16 02:05:20 UTC

[jira] Created: (MNG-2827) java.lang.StringIndexOutOfBoundsException if embedded into Eclipse plugin and required plugin parameter is missing

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


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

        

[jira] Updated: (MNG-2827) java.lang.StringIndexOutOfBoundsException if embedded into Eclipse plugin and required plugin parameter is missing

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter updated MNG-2827:
------------------------------

    Affects Version/s:     (was: 3.0)
                       3.0-alpha-1
        Fix Version/s: 3.0-alpha-1

> 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: 3.0-alpha-1
>            Reporter: Stepan Roh
>            Assignee: Jason van Zyl
>             Fix For: 3.0-alpha-1
>
>
> 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

        

[jira] Closed: (MNG-2827) java.lang.StringIndexOutOfBoundsException if embedded into Eclipse plugin and required plugin parameter is missing

Posted by "Jason van Zyl (JIRA)" <ji...@codehaus.org>.
     [ 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

        

[jira] Commented: (MNG-2827) java.lang.StringIndexOutOfBoundsException if embedded into Eclipse plugin and required plugin parameter is missing

Posted by "Jason van Zyl (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_88827 ] 

Jason van Zyl commented on MNG-2827:
------------------------------------

I'm testing this now.

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