Skip to content

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

@gitblit

Description

@gitblit

Originally reported on Google Code with ID 595

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

Reported by christoph.luder on 2015-05-31 07:02:51

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions