wellington-junio / gitblit

Automatically exported from code.google.com/p/gitblit
Apache License 2.0
0 stars 0 forks source link

NullPointerException on startup when having symbolically linked directories (non-relative) in the repository folder #595

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.
/tools/repository/test1.git
/tools/repo/test2.git

2. create a symlink in /tools/repository to the 'other' git repo
cd /tools/repository/
ln -s /tools/repo/test2.git

3. use 
"gitblit.properties"
git.repositoriesFolder = /tools/repository/

4. start gitblit (standalone or within tomcat)

1.6.1, 1.6.2, 1.6.3.snapshot

java.lang.NullPointerException
        at com.gitblit.utils.StringUtils.compareRepositoryNames(StringUtils.java:458)
        at com.gitblit.utils.StringUtils$1.compare(StringUtils.java:485)
        at com.gitblit.utils.StringUtils$1.compare(StringUtils.java:482)
        at java.util.TimSort.countRunAndMakeAscending(TimSort.java:324)
        at java.util.TimSort.sort(TimSort.java:189)
        at java.util.TimSort.sort(TimSort.java:173)
        at java.util.Arrays.sort(Arrays.java:659)
        at java.util.Collections.sort(Collections.java:217)
        at com.gitblit.utils.StringUtils.sortRepositorynames(StringUtils.java:482)
        at com.gitblit.utils.JGitUtils.getRepositoryList(JGitUtils.java:475)
        at com.gitblit.manager.RepositoryManager.getRepositoryList(RepositoryManager.java:536)
        at com.gitblit.manager.RepositoryManager.start(RepositoryManager.java:158)
        at com.gitblit.manager.RepositoryManager.start(RepositoryManager.java:102)

The error happens in JGitUtils.java:529
FileUtils.getRelativePath(baseFile, file); will return null for the sym-link, 
which then later results in the NPE when sorting the repository names.

                        // determine repository name relative to base path
                        String repository = FileUtils.getRelativePath(baseFile, file);

Original issue reported on code.google.com by christoph.luder on 31 May 2015 at 7:02

GoogleCodeExporter commented 9 years ago
Try the develop branch.

Original comment by James.Mo...@gmail.com on 31 May 2015 at 4:29