You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2007/09/02 22:03:22 UTC

DO NOT REPLY [Bug 42770] - IndexOutOfBounds exception in when the URI is invalid

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42770>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42770





------- Additional Comments From sjjohns@cox.net  2007-09-02 13:03 -------
Created an attachment (id=20754)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20754&action=view)
Patch to throw an appropriate exception when remoteToDir() gets an invalid URI.


Here's a patch that does what Steve mentions.  

I added a check in setRemoteTodir() to throw a BuildException with a
descriptive message when the URI does not contain an '@' symbol.

For good measure, I added some code in parseUri() at the point where the
StringIndexOutOfBoundsException was being thrown to skip the indexOf() call if
the index is negative.	And instead throw a BuildException explaining the
remote URI was invalid.

I also added a unit test to ScpTest.java to exercise the new code.  

While testing the unit test, I found an apparent bug in
ScpTest.testSingleFileUploadAndDownload().  I added a line to fix that. 

Let me know what you think.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org