[spotbugs] Fix potential NPE in PackFileSnapshotTest
Path#getFileName can return null. Fix the warning by asserting the file name isn't null. Change-Id: I7f2fe75b46113d8be1d14e3f18dd77da27df25ed Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
cc7a1891ee
commit
1ed6353962
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assume.assumeFalse;
|
import static org.junit.Assume.assumeFalse;
|
||||||
import static org.junit.Assume.assumeTrue;
|
import static org.junit.Assume.assumeTrue;
|
||||||
|
@ -208,8 +209,11 @@ public void testDetectModificationAlthoughSameSizeAndModificationtimeAndFileKey(
|
||||||
// Repack to create initial packfile. Make a copy of it
|
// Repack to create initial packfile. Make a copy of it
|
||||||
PackFile pf = repackAndCheck(5, null, null, null);
|
PackFile pf = repackAndCheck(5, null, null, null);
|
||||||
Path packFilePath = pf.getPackFile().toPath();
|
Path packFilePath = pf.getPackFile().toPath();
|
||||||
Path packFileBasePath = packFilePath.resolveSibling(
|
Path fn = packFilePath.getFileName();
|
||||||
packFilePath.getFileName().toString().replaceAll(".pack", ""));
|
assertNotNull(fn);
|
||||||
|
String packFileName = fn.toString();
|
||||||
|
Path packFileBasePath = packFilePath
|
||||||
|
.resolveSibling(packFileName.replaceAll(".pack", ""));
|
||||||
AnyObjectId chk1 = pf.getPackChecksum();
|
AnyObjectId chk1 = pf.getPackChecksum();
|
||||||
String name = pf.getPackName();
|
String name = pf.getPackName();
|
||||||
Long length = Long.valueOf(pf.getPackFile().length());
|
Long length = Long.valueOf(pf.getPackFile().length());
|
||||||
|
|
Loading…
Reference in New Issue