This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have a maven based Java 7 project. Given final String fileName = "/" + resource + ".txt"; InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); final Path resourcePath = Paths.get("src/test/resources"+fileName); if(inputStream == null && Files.exists(resourcePath, LinkOption.NOFOLLOW_LINKS)) { inputStream = new FileInputStream(resourcePath.toFile()); } if (inputStream == null) // "Unnecessary test for null, the expression is never null" hint { inputStream = new FileInputStream("src/main/resources" + fileName); } The hint that "inputStream" can not be null is wrong, since the condition above may result in "inputStream == null, file exist == false". If I change it to if(inputStream == null && true) { inputStream = new FileInputStream(resourcePath.toFile()); } if (inputStream == null) { inputStream = new FileInputStream("src/main/resources" + fileName); } the hint vanishes, even if it would now make sense.
What exact NB version is that? I tried to reproduce on a recent trunk build, on 7.3 and updated 7.3, and did not see the bug. Is there some more information I could use to reproduce? Thanks.
Product Version: NetBeans IDE 7.3 (Build 201302132200) Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02 System: Linux version 3.5.0-28-generic running on amd64; UTF-8; en_US (nb) Using embedded maven, maven language level set to 1.7 Using features on deman (full IDE install) IDE Platform plugin Version: 1.22.1 Source: NetBeans IDE 7.3 (Build 201302132200) Java Plugin Version: 1.21.1 Source: NetBeans IDE 7.3 (Build 201302132200) RCP Platform Version: 1.20.1 Source: NetBeans IDE 7.3 (Build 201302132200)
Appears to be duplicate of bug #227954. *** This bug has been marked as a duplicate of bug 227954 ***