[
http://jira.codehaus.org/browse/SCM-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=252825#action_252825
]
Aleksandr Zhuikov commented on SCM-598:
---------------------------------------
As you said: "f.getPath() might only return the relative path", but on line 57
you substring absolute path from this relative path.
I have to admit, that my fix seems to be wrong: if getPath() always returns
relative path, than the whole block does not make any sense.
Made simple test:
File file = new File("test.xml");
System.out.println(file.getPath());
System.out.println(file.getAbsolutePath());
Output:
test.xml
/home/aleksz/projects/koaba/SCMTest/test.xml
Out of bounds comes when you substring
"/home/aleksz/projects/koaba/SCMTest/".length() from "test.xml"
P.S
Ubuntu 10.10
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
> String index out of bounds while trying to commit limited file set to Git
> -------------------------------------------------------------------------
>
> Key: SCM-598
> URL: http://jira.codehaus.org/browse/SCM-598
> Project: Maven SCM
> Issue Type: Bug
> Components: maven-scm-provider-git
> Affects Versions: 1.4
> Environment: Ubuntu 10
> Reporter: Aleksandr Zhuikov
> Assignee: Olivier Lamy
> Fix For: 1.5
>
> Attachments: GitCommandLineUtils.java.patch, Screenshot.png
>
>
> I encountered String index out of bounds while trying to commit limited file
> set to Git.
> if statement was checking if file's absolute path was starting with working
> directory absoulute path, but stripping absoulute path from the value
> returned by getPath(). At least in Linux this getPath and getAbsolutePath did
> not return the same.
> I have actually submitted the fix to Github repo, but it appeared to be a
> wrong place :) Attachment has screenshot with diff from Github.
--
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