diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2014-02-28 07:15:08 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2014-02-28 10:44:54 +0100 |
commit | 7b01a5369210ef68dd2934db72861b3145495d3f (patch) | |
tree | 4959f05d613f2398b6a0f7f8f4d0633b815dbefe /org.eclipse.jgit/src/org/eclipse/jgit | |
parent | 2670fd427cd4aad49ccdb6dde66271fdffff86f8 (diff) | |
download | jgit-7b01a5369210ef68dd2934db72861b3145495d3f.tar.gz jgit-7b01a5369210ef68dd2934db72861b3145495d3f.zip |
Fix NPE when WorkingTreeIterator does not have a repository set
It's strange that we have that member since it is not so clear
when it it set or not.
Change-Id: I53903a264f46866d249901a3cd9f9295028aa6bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 633865ed4d..dd59afc389 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -922,7 +922,8 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { } else { if (mode == FileMode.SYMLINK.getBits()) return !new File(readContentAsNormalizedString(current())) - .equals(new File((readContentAsNormalizedString(entry)))); + .equals(new File((readContentAsNormalizedString(entry, + reader)))); // Content differs: that's a real change, perhaps if (reader == null) // deprecated use, do no further checks return true; @@ -971,9 +972,9 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { } } - private String readContentAsNormalizedString(DirCacheEntry entry) - throws MissingObjectException, IOException { - ObjectLoader open = repository.open(entry.getObjectId()); + private static String readContentAsNormalizedString(DirCacheEntry entry, + ObjectReader reader) throws MissingObjectException, IOException { + ObjectLoader open = reader.open(entry.getObjectId()); byte[] cachedBytes = open.getCachedBytes(); return FS.detect().normalize(RawParseUtils.decode(cachedBytes)); } |