tyutNo4 / findbugs

Automatically exported from code.google.com/p/findbugs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

GoogleCodeExporter opened this issue · comments

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

Original issue reported on code.google.com by keithl on 17 Feb 2010 at 3:02

Original comment by keithl on 17 Feb 2010 at 3:05

  • Changed state: Invalid