Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/scripts/generate-quality-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ def main() -> None:
if spotbugs:
forbidden_rules = {
"NP_ALWAYS_NULL",
"NP_NULL_PARAM_DEREF",
"RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE",
"RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE",
"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
Expand All @@ -772,6 +773,7 @@ def main() -> None:
"IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD",
"LI_LAZY_INIT_STATIC",
"RpC_REPEATED_CONDITIONAL_TEST",
"NS_NON_SHORT_CIRCUIT",
"ES_COMPARING_PARAMETER_STRING_WITH_EQ",
"FE_FLOATING_POINT_EQUALITY",
"FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER",
Expand All @@ -787,7 +789,9 @@ def main() -> None:
"EQ_DOESNT_OVERRIDE_EQUALS",
"CO_COMPARETO_INCORRECT_FLOATING",
"DL_SYNCHRONIZATION_ON_SHARED_CONSTANT",
"SSD_DO_NOT_USE_INSTANCE_LOCK_ON_SHARED_STATIC_DATA",
"DLS_DEAD_LOCAL_STORE",
"DLS_DEAD_LOCAL_STORE_OF_NULL",
"DM_NUMBER_CTOR",
"DMI_INVOKING_TOSTRING_ON_ARRAY",
"EC_NULL_ARG",
Expand Down Expand Up @@ -819,6 +823,7 @@ def main() -> None:
"NO_NOTIFY_NOT_NOTIFYALL",
"NP_LOAD_OF_KNOWN_NULL_VALUE",
"NP_BOOLEAN_RETURN_NULL",
"RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN",
"REFLC_REFLECTION_MAY_INCREASE_ACCESSIBILITY_OF_CLASS",
"REC_CATCH_EXCEPTION",
"RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ public void numericToken(double tok) {
}

public void keyValue(String key, String value) {
if (key == null) {
return;
}
//make sure value is not null to prevent NPE
if (key != null && value == null) {
if (value == null) {
value = "";
}
getCurrent().put(key, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void write(int b) throws IOException {
public void write(byte[] b, int off, int len) throws IOException {
if (deflater.finished()) {
throw new IOException("finished");
} else if (off < 0 | len < 0 | off + len > b.length) {
} else if (off < 0 || len < 0 || off + len > b.length) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
} else {
Expand Down
5 changes: 3 additions & 2 deletions CodenameOne/src/com/codename1/location/LocationManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public abstract class LocationManager {
public static final int OUT_OF_SERVICE = 1;
public static final int TEMPORARILY_UNAVAILABLE = 2;
private static LocationListener listener;
private static final Object LISTENER_LOCK = new Object();
private LocationRequest request;
private static Class backgroundlistener;
private int status = TEMPORARILY_UNAVAILABLE;
Expand Down Expand Up @@ -198,7 +199,7 @@ protected LocationListener getLocationListener() {
* from getting updates
*/
public void setLocationListener(final LocationListener l) {
synchronized (this) {
synchronized (LISTENER_LOCK) {
if (listener != null) {
clearListener();
request = null;
Expand Down Expand Up @@ -243,7 +244,7 @@ protected Class getBackgroundLocationListener() {
* try to create an instance and invoke the locationUpdated method
*/
public void setBackgroundLocationListener(Class locationListener) {
synchronized (this) {
synchronized (LISTENER_LOCK) {
if (backgroundlistener != null) {
clearBackgroundListener();
}
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/properties/InstantUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void excludeProperties(PropertyBase... exclude) {
* @return true if the property was excluded from the GUI
*/
public boolean isExcludedProperty(PropertyBase exclude) {
return exclude.getClientProperty("cn1$excludeFromUI") == Boolean.TRUE;
return Boolean.TRUE.equals(exclude.getClientProperty("cn1$excludeFromUI"));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/ui/BrowserComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ public void putClientProperty(String key, Object value) {
* @return true if debug mode was activated
*/
public boolean isDebugMode() {
return getClientProperty("BrowserComponent.firebug") == Boolean.TRUE;
return Boolean.TRUE.equals(getClientProperty("BrowserComponent.firebug"));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions CodenameOne/src/com/codename1/ui/html/HTMLComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,13 @@ public HTMLComponent(DocumentRequestHandler handler) {
* @param font The actual Codename One font object
*/
public static void addFont(String fontKey, Font font) {
if (fontKey != null) {
fontKey = fontKey.toLowerCase();
} else {
if (fontKey == null) {
if (font.getCharset() != null) {
throw new IllegalArgumentException("Font key must be non-null for bitmap fonts");
}
throw new IllegalArgumentException("Font key must be non-null");
}
fontKey = fontKey.toLowerCase();
fonts.put(fontKey, new HTMLFont(fontKey, font));
}

Expand Down
1 change: 0 additions & 1 deletion CodenameOne/src/com/codename1/ui/plaf/UIManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,6 @@ Style createStyle(String id, String prefix, boolean selected) {
style = new Style(getComponentStyle(baseStyle));
}
} else {
baseStyle = null;
if (selected) {
style = new Style(defaultSelectedStyle);
} else {
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/util/TBigInteger.java
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ public TBigInteger modPow(TBigInteger exponent, TBigInteger m) {
}
TBigInteger base = this;

if (m.isOne() | (exponent.sign > 0 & base.sign == 0)) {
if (m.isOne() || (exponent.sign > 0 && base.sign == 0)) {
return TBigInteger.ZERO;
}
if (exponent.sign == 0) {
Expand Down
Loading