Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gitblit opened this issue Aug 12, 2015 · 2 comments

Comments

@gitblit
Copy link
Owner

gitblit commented Aug 12, 2015

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

@gitblit
Copy link
Owner Author

gitblit commented Aug 12, 2015

Try the develop branch.

Reported by James.Moger on 2015-05-31 16:29:42

@flaix
Copy link
Collaborator

flaix commented Dec 17, 2016

Looks like a duplicate of issue #837

@flaix flaix modified the milestone: 1.9.0 Jan 18, 2017
@flaix flaix closed this as completed in d52dfc2 Jun 10, 2019
@flaix flaix added Status-Fixed Status-Obsolete Issue has been obsoleted by code changes or become irrelevant or stale and removed Status-New labels Jun 10, 2019
@flaix flaix removed the Status-Obsolete Issue has been obsoleted by code changes or become irrelevant or stale label Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants