I agree, that System.exit() should be taken into an account. What to
throwing an error I think it is not a normal control flow as a rule.
Generally there is a certain inspector misbehaiving particullary whean
throwing exceptions and we surely will fix it.

Best regards,
Maxim Shafirov
IntelliJ Software, http://www.intellij.com/
"Develop with pleasure!"


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 13, 2002 11:24 AM
Subject: [Eap-list] 611 local code analysis Bug


I see, that makes sense!

But I found this problem:

      if (cm == null)
      {
          System.exit(1);
      }
      String name = cm.getName();

and code inspections warns that cm.getName() could throw NPE
The same is possible if instead of System.exit there was a call
to a method that throws Error, like SomeClass.throwAssertion()

----
in the your sample o != null is really always true. If not you'll get
java.lang.NullPointerException in the previous line. So if (o != null) will
never get control if o is null.

> JDK1.3.1, NT4, build 611
>
> when running local code analysis I get various results
> where the code checks against null, and IDEA says
> "is always true" or "is always false" - which is not the case.
>
> sometimes, if the (xyz!=null) is in a finally-block,
> and sometimes, it seems, if a method parameter is accessed
> before the check against null, reproducable with this code:
>
> private void getRemaining(Object o)
>  {
>       o.getClass();
>       if (o != null)
>       {
>
>       }
> }

____________________________________________________________________________
__
Tagesgeld: 4% Guthabenzinsen bei t�glicher Verf�gbarkeit. Jetzt informieren!
http://diba.web.de/


_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list



_______________________________________________
Eap-list mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-list

Reply via email to