You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Stefan Ackermann (JIRA)" <ji...@codehaus.org> on 2008/07/25 10:57:27 UTC

[jira] Created: (SCM-391) urls without subfolders were not parsed correctly.

urls without subfolders were not parsed correctly.
--------------------------------------------------

                 Key: SCM-391
                 URL: http://jira.codehaus.org/browse/SCM-391
             Project: Maven SCM
          Issue Type: Bug
          Components: maven-scm-provider-mercurial (hg)
            Reporter: Stefan Ackermann


Following configuration within pom.xml failed to do checkins:
	<scm>
		<connection>scm:hg:file:///${basedir}</connection>
		<developerConnection>scm:hg:http://localhost:8000/</developerConnection>
	</scm>

The error is that it is trying to push to a wrong location.
[INFO] EXECUTING: hg push http://localhost8000/

I have traced it down to this function of this file:
http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/repository/HgScmProviderRepository.java?revision=528416&view=markup

Here is a proposal from me on how to fix that.

    private String parseHostAndPort( String url )
    {
        if ( protocol != FILE )
        {
            String[] split = url.split( ":" );
            if ( split.length == 2 )
            {
                setHost( split[0] );
                url = url.substring( split[0].length() + 1 );
                split = split[1].split( "/" );
                if ( split.length == 2 )
                {
                    url = url.substring( split[0].length() );
                    try
                    {
                        setPort( Integer.valueOf( split[0] ).intValue() );
                    }
                    catch ( NumberFormatException e )
                    {
                        //Ignore - error will manifest itself later.
                    }
                }
                else if (url.matches("\\d+/?"))
                {
                	url = url.replaceAll("/", "");
                	try {
						setPort(Integer.valueOf(url));
					} catch (NumberFormatException e) {
                        //Ignore - error will manifest itself later.
					}
                }
            }
            else
            {
                split = url.split( "/" );
                if ( split.length > 1 )
                {
                    url = url.substring( split[0].length() );
                    setHost( split[0] );
                }
                else if (url.matches("[^/]+/?"))
                {
                	url = url.replaceAll("/", "");
                	setHost(url);
                }
            }
        }
        return url;
    }

I have not run any unit tests, but I did run some tests against this function with some input strings. Seems to work.

A URL like this is default if you just use hg serve so it is kind of common.

-- 
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: (SCM-391) urls without subfolders were not parsed correctly.

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SCM-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=143257#action_143257 ] 

Dennis Lundberg commented on SCM-391:
-------------------------------------

What URL do you expect SCM to use?

> urls without subfolders were not parsed correctly.
> --------------------------------------------------
>
>                 Key: SCM-391
>                 URL: http://jira.codehaus.org/browse/SCM-391
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-mercurial (hg)
>            Reporter: Stefan Ackermann
>
> Following configuration within pom.xml failed to do checkins:
> {code:xml}
> <scm>
>   <connection>scm:hg:file:///${basedir}</connection>
>   <developerConnection>scm:hg:http://localhost:8000/</developerConnection>
> </scm>
> {code}
> The error is that it is trying to push to a wrong location.
> [INFO] EXECUTING: hg push http://localhost8000/
> I have traced it down to this function of this file:
> http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/repository/HgScmProviderRepository.java?revision=528416&view=markup
> Here is a proposal from me on how to fix that.
> {code}
>     private String parseHostAndPort( String url )
>     {
>         if ( protocol != FILE )
>         {
>             String[] split = url.split( ":" );
>             if ( split.length == 2 )
>             {
>                 setHost( split[0] );
>                 url = url.substring( split[0].length() + 1 );
>                 split = split[1].split( "/" );
>                 if ( split.length == 2 )
>                 {
>                     url = url.substring( split[0].length() );
>                     try
>                     {
>                         setPort( Integer.valueOf( split[0] ).intValue() );
>                     }
>                     catch ( NumberFormatException e )
>                     {
>                         //Ignore - error will manifest itself later.
>                     }
>                 }
>                 else if (url.matches("\\d+/?"))
>                 {
>                 	url = url.replaceAll("/", "");
>                 	try {
> 						setPort(Integer.valueOf(url));
> 					} catch (NumberFormatException e) {
>                         //Ignore - error will manifest itself later.
> 					}
>                 }
>             }
>             else
>             {
>                 split = url.split( "/" );
>                 if ( split.length > 1 )
>                 {
>                     url = url.substring( split[0].length() );
>                     setHost( split[0] );
>                 }
>                 else if (url.matches("[^/]+/?"))
>                 {
>                 	url = url.replaceAll("/", "");
>                 	setHost(url);
>                 }
>             }
>         }
>         return url;
>     }
> {code}
> I have not run any unit tests, but I did run some tests against this function with some input strings. Seems to work.
> A URL like this is default if you just use hg serve so it is kind of common.

-- 
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: (SCM-391) urls without subfolders were not parsed correctly.

Posted by "Stefan Ackermann (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SCM-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=143260#action_143260 ] 

Stefan Ackermann commented on SCM-391:
--------------------------------------

http://localhost:8000/ becomes http://localhost8000/
The colon is missing!

> urls without subfolders were not parsed correctly.
> --------------------------------------------------
>
>                 Key: SCM-391
>                 URL: http://jira.codehaus.org/browse/SCM-391
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-mercurial (hg)
>            Reporter: Stefan Ackermann
>
> Following configuration within pom.xml failed to do checkins:
> {code:xml}
> <scm>
>   <connection>scm:hg:file:///${basedir}</connection>
>   <developerConnection>scm:hg:http://localhost:8000/</developerConnection>
> </scm>
> {code}
> The error is that it is trying to push to a wrong location.
> [INFO] EXECUTING: hg push http://localhost8000/
> I have traced it down to this function of this file:
> http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/repository/HgScmProviderRepository.java?revision=528416&view=markup
> Here is a proposal from me on how to fix that.
> {code}
>     private String parseHostAndPort( String url )
>     {
>         if ( protocol != FILE )
>         {
>             String[] split = url.split( ":" );
>             if ( split.length == 2 )
>             {
>                 setHost( split[0] );
>                 url = url.substring( split[0].length() + 1 );
>                 split = split[1].split( "/" );
>                 if ( split.length == 2 )
>                 {
>                     url = url.substring( split[0].length() );
>                     try
>                     {
>                         setPort( Integer.valueOf( split[0] ).intValue() );
>                     }
>                     catch ( NumberFormatException e )
>                     {
>                         //Ignore - error will manifest itself later.
>                     }
>                 }
>                 else if (url.matches("\\d+/?"))
>                 {
>                 	url = url.replaceAll("/", "");
>                 	try {
> 						setPort(Integer.valueOf(url));
> 					} catch (NumberFormatException e) {
>                         //Ignore - error will manifest itself later.
> 					}
>                 }
>             }
>             else
>             {
>                 split = url.split( "/" );
>                 if ( split.length > 1 )
>                 {
>                     url = url.substring( split[0].length() );
>                     setHost( split[0] );
>                 }
>                 else if (url.matches("[^/]+/?"))
>                 {
>                 	url = url.replaceAll("/", "");
>                 	setHost(url);
>                 }
>             }
>         }
>         return url;
>     }
> {code}
> I have not run any unit tests, but I did run some tests against this function with some input strings. Seems to work.
> A URL like this is default if you just use hg serve so it is kind of common.

-- 
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: (SCM-391) urls without subfolders were not parsed correctly.

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SCM-391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg updated SCM-391:
--------------------------------

    Description: 
Following configuration within pom.xml failed to do checkins:
{code:xml}
<scm>
  <connection>scm:hg:file:///${basedir}</connection>
  <developerConnection>scm:hg:http://localhost:8000/</developerConnection>
</scm>
{code}

The error is that it is trying to push to a wrong location.
[INFO] EXECUTING: hg push http://localhost8000/

I have traced it down to this function of this file:
http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/repository/HgScmProviderRepository.java?revision=528416&view=markup

Here is a proposal from me on how to fix that.

{code}
    private String parseHostAndPort( String url )
    {
        if ( protocol != FILE )
        {
            String[] split = url.split( ":" );
            if ( split.length == 2 )
            {
                setHost( split[0] );
                url = url.substring( split[0].length() + 1 );
                split = split[1].split( "/" );
                if ( split.length == 2 )
                {
                    url = url.substring( split[0].length() );
                    try
                    {
                        setPort( Integer.valueOf( split[0] ).intValue() );
                    }
                    catch ( NumberFormatException e )
                    {
                        //Ignore - error will manifest itself later.
                    }
                }
                else if (url.matches("\\d+/?"))
                {
                	url = url.replaceAll("/", "");
                	try {
						setPort(Integer.valueOf(url));
					} catch (NumberFormatException e) {
                        //Ignore - error will manifest itself later.
					}
                }
            }
            else
            {
                split = url.split( "/" );
                if ( split.length > 1 )
                {
                    url = url.substring( split[0].length() );
                    setHost( split[0] );
                }
                else if (url.matches("[^/]+/?"))
                {
                	url = url.replaceAll("/", "");
                	setHost(url);
                }
            }
        }
        return url;
    }
{code}

I have not run any unit tests, but I did run some tests against this function with some input strings. Seems to work.

A URL like this is default if you just use hg serve so it is kind of common.

  was:
Following configuration within pom.xml failed to do checkins:
	<scm>
		<connection>scm:hg:file:///${basedir}</connection>
		<developerConnection>scm:hg:http://localhost:8000/</developerConnection>
	</scm>

The error is that it is trying to push to a wrong location.
[INFO] EXECUTING: hg push http://localhost8000/

I have traced it down to this function of this file:
http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/repository/HgScmProviderRepository.java?revision=528416&view=markup

Here is a proposal from me on how to fix that.

    private String parseHostAndPort( String url )
    {
        if ( protocol != FILE )
        {
            String[] split = url.split( ":" );
            if ( split.length == 2 )
            {
                setHost( split[0] );
                url = url.substring( split[0].length() + 1 );
                split = split[1].split( "/" );
                if ( split.length == 2 )
                {
                    url = url.substring( split[0].length() );
                    try
                    {
                        setPort( Integer.valueOf( split[0] ).intValue() );
                    }
                    catch ( NumberFormatException e )
                    {
                        //Ignore - error will manifest itself later.
                    }
                }
                else if (url.matches("\\d+/?"))
                {
                	url = url.replaceAll("/", "");
                	try {
						setPort(Integer.valueOf(url));
					} catch (NumberFormatException e) {
                        //Ignore - error will manifest itself later.
					}
                }
            }
            else
            {
                split = url.split( "/" );
                if ( split.length > 1 )
                {
                    url = url.substring( split[0].length() );
                    setHost( split[0] );
                }
                else if (url.matches("[^/]+/?"))
                {
                	url = url.replaceAll("/", "");
                	setHost(url);
                }
            }
        }
        return url;
    }

I have not run any unit tests, but I did run some tests against this function with some input strings. Seems to work.

A URL like this is default if you just use hg serve so it is kind of common.


Add formating

> urls without subfolders were not parsed correctly.
> --------------------------------------------------
>
>                 Key: SCM-391
>                 URL: http://jira.codehaus.org/browse/SCM-391
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-mercurial (hg)
>            Reporter: Stefan Ackermann
>
> Following configuration within pom.xml failed to do checkins:
> {code:xml}
> <scm>
>   <connection>scm:hg:file:///${basedir}</connection>
>   <developerConnection>scm:hg:http://localhost:8000/</developerConnection>
> </scm>
> {code}
> The error is that it is trying to push to a wrong location.
> [INFO] EXECUTING: hg push http://localhost8000/
> I have traced it down to this function of this file:
> http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/repository/HgScmProviderRepository.java?revision=528416&view=markup
> Here is a proposal from me on how to fix that.
> {code}
>     private String parseHostAndPort( String url )
>     {
>         if ( protocol != FILE )
>         {
>             String[] split = url.split( ":" );
>             if ( split.length == 2 )
>             {
>                 setHost( split[0] );
>                 url = url.substring( split[0].length() + 1 );
>                 split = split[1].split( "/" );
>                 if ( split.length == 2 )
>                 {
>                     url = url.substring( split[0].length() );
>                     try
>                     {
>                         setPort( Integer.valueOf( split[0] ).intValue() );
>                     }
>                     catch ( NumberFormatException e )
>                     {
>                         //Ignore - error will manifest itself later.
>                     }
>                 }
>                 else if (url.matches("\\d+/?"))
>                 {
>                 	url = url.replaceAll("/", "");
>                 	try {
> 						setPort(Integer.valueOf(url));
> 					} catch (NumberFormatException e) {
>                         //Ignore - error will manifest itself later.
> 					}
>                 }
>             }
>             else
>             {
>                 split = url.split( "/" );
>                 if ( split.length > 1 )
>                 {
>                     url = url.substring( split[0].length() );
>                     setHost( split[0] );
>                 }
>                 else if (url.matches("[^/]+/?"))
>                 {
>                 	url = url.replaceAll("/", "");
>                 	setHost(url);
>                 }
>             }
>         }
>         return url;
>     }
> {code}
> I have not run any unit tests, but I did run some tests against this function with some input strings. Seems to work.
> A URL like this is default if you just use hg serve so it is kind of common.

-- 
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: (SCM-391) urls without subfolders were not parsed correctly.

Posted by "Vincent Siveton (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SCM-391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vincent Siveton closed SCM-391.
-------------------------------

         Assignee: Vincent Siveton
       Resolution: Fixed
    Fix Version/s: 1.1

Fixed in [r6867356|http://svn.apache.org/viewvc?rev=686735&view=rev]
Added a test case.

> urls without subfolders were not parsed correctly.
> --------------------------------------------------
>
>                 Key: SCM-391
>                 URL: http://jira.codehaus.org/browse/SCM-391
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-mercurial (hg)
>            Reporter: Stefan Ackermann
>            Assignee: Vincent Siveton
>             Fix For: 1.1
>
>
> Following configuration within pom.xml failed to do checkins:
> {code:xml}
> <scm>
>   <connection>scm:hg:file:///${basedir}</connection>
>   <developerConnection>scm:hg:http://localhost:8000/</developerConnection>
> </scm>
> {code}
> The error is that it is trying to push to a wrong location.
> [INFO] EXECUTING: hg push http://localhost8000/
> I have traced it down to this function of this file:
> http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/repository/HgScmProviderRepository.java?revision=528416&view=markup
> Here is a proposal from me on how to fix that.
> {code}
>     private String parseHostAndPort( String url )
>     {
>         if ( protocol != FILE )
>         {
>             String[] split = url.split( ":" );
>             if ( split.length == 2 )
>             {
>                 setHost( split[0] );
>                 url = url.substring( split[0].length() + 1 );
>                 split = split[1].split( "/" );
>                 if ( split.length == 2 )
>                 {
>                     url = url.substring( split[0].length() );
>                     try
>                     {
>                         setPort( Integer.valueOf( split[0] ).intValue() );
>                     }
>                     catch ( NumberFormatException e )
>                     {
>                         //Ignore - error will manifest itself later.
>                     }
>                 }
>                 else if (url.matches("\\d+/?"))
>                 {
>                 	url = url.replaceAll("/", "");
>                 	try {
> 						setPort(Integer.valueOf(url));
> 					} catch (NumberFormatException e) {
>                         //Ignore - error will manifest itself later.
> 					}
>                 }
>             }
>             else
>             {
>                 split = url.split( "/" );
>                 if ( split.length > 1 )
>                 {
>                     url = url.substring( split[0].length() );
>                     setHost( split[0] );
>                 }
>                 else if (url.matches("[^/]+/?"))
>                 {
>                 	url = url.replaceAll("/", "");
>                 	setHost(url);
>                 }
>             }
>         }
>         return url;
>     }
> {code}
> I have not run any unit tests, but I did run some tests against this function with some input strings. Seems to work.
> A URL like this is default if you just use hg serve so it is kind of common.

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