mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
This line is in the form of
String str = ...
str.equals("someOtherString");
//or
str.compareTo("someOtherString");
A NullPointerException may occur if the String variable str is null. If instead the code was restructured to
String str = ...
"someOtherString".equals(str);
//or
"someOtherString".compareTo(str);
that is, call equals() or compareTo() on the string literal, passing the variable as an argument, this exception could never happen as both equals() and compareTo() check for null.
|
||
|---|---|---|
| .. | ||
| org.wso2.carbon.apimgt.annotations | ||
| org.wso2.carbon.apimgt.application.extension | ||
| org.wso2.carbon.apimgt.application.extension.api | ||
| org.wso2.carbon.apimgt.webapp.publisher | ||
| pom.xml | ||