Export to GitHub

findbugs - issue #31

instanceof will always return false in loadFromStream(LEDataInputStream), since a RuntimeException can't be a java.io.IOException in FileFormat.java


Posted on Feb 17, 2010 by Happy Giraffe

Bug report generated from FindBugs instanceof will always return false in loadFromStream(LEDataInputStream), since a RuntimeException can't be a java.io.IOException

In class org.eclipse.swt.internal.image.FileFormat In method loadFromStream(LEDataInputStream) Actual type RuntimeException Expected java.io.IOException Value loaded from e At FileFormat.java:[line 50]

Relevant source code: 46: try { 47: inputStream = stream; 48: return loadFromByteStream(); 49: } catch (Exception e) { 50: if (e instanceof IOException) { 51: SWT.error(SWT.ERROR_IO, e); 52: } else { 53: SWT.error(SWT.ERROR_INVALID_IMAGE, e); 54: }

Bug pattern explanation: This instanceof test will always return false. Although this is safe, make sure it isn't an indication of some misunderstanding or some other logic error.

FindBugs issue identifier (do not modify or remove): 472230fd849b9300f02de246aa190df3

Comment #1

Posted on Feb 17, 2010 by Happy Giraffe

(No comment was entered for this change.)

Status: Invalid

Labels:
FindBugsGenerated