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.
Product Version: NetBeans IDE Dev (Build 201408170001) Java: 1.8.0_20; Java HotSpot(TM) 64-Bit Server VM 25.20-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26 System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb) User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev Given: private Path relativeToWebapp(String path) throws IllegalArgumentException { Preconditions.requireThat(path, "path").isNotNull().isNotEmpty(); String trimmedPath = path.trim(); if (trimmedPath.startsWith("/")) throw new IllegalArgumentException("path must be relative: " + trimmedPath); ServletContext servletContext = requestScope.getServletContext(); try { URI resource = servletContext.getResource("/" + trimmedPath).toURI(); try { return Paths.get(resource); } catch (FileSystemNotFoundException e) { throw (FileSystemNotFoundException) new FileSystemNotFoundException(resource.toString()).initCause(e); } } catch (MalformedURLException | URISyntaxException e) { throw new AssertionError(e); } } 2. Netbeans hints "Type cast to FileSystemNotFoundException is too strong. <unknown> should be used instead" on the line that invokes initCause(). I expect: 1. This hint to not occur since the cast is not too strong. 2. Netbeans to assert that the proposed type is never <unknown> (so the Exception Reporter will pick up such cases).
re. 1/ assuming that FileSystemNotFoundException extends IllegalArgumentException(?), wouldn't it be sufficient to cat to IllegalArgumentException instead of FSNFE ?
Svata, Yes, in this case (since the method always declares throwing IllegalArgumentException, and initCause() is declared on that superclass) then that cast would be sufficient. You'd need to fix #2 and check that for #1 the hint suggests IllegalArgumentException.
I've found a stupid code completion typo in expected type resolution code. Fixed in jet-main#20fc504e826d
Integrated into 'main-silver', will be available in build *201505120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/20fc504e826d User: Svata Dedic <sdedic@netbeans.org> Log: #246583: fixed typo - wrong processing of union types in catch clauses