Skip to content

Commit 79bc59b

Browse files
Fix SpotBugs warnings in CodenameOneImplementation and UIBuilder (#4321)
Fixed incorrect math logic in `CodenameOneImplementation.getDragSpeed` where `Math.min` used an incorrect variable. Added `synchronized` to `UIBuilder.getComponentRegistry` to prevent race conditions during lazy initialization. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 3407706 commit 79bc59b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,7 @@ protected boolean hasDragStarted(final int x, final int y) {
26802680
break;
26812681
case Component.DRAG_REGION_POSSIBLE_DRAG_X:
26822682
startY = Math.max(5, startY);
2683-
startX = Math.min(startY, 2f);
2683+
startX = Math.min(startX, 2f);
26842684
break;
26852685
case Component.DRAG_REGION_POSSIBLE_DRAG_Y:
26862686
startX = Math.max(5, startX);

CodenameOne/src/com/codename1/ui/util/UIBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public static void setBlockAnalytics(boolean aBlockAnalytics) {
230230
blockAnalytics = aBlockAnalytics;
231231
}
232232

233-
static Hashtable getComponentRegistry() {
233+
static synchronized Hashtable getComponentRegistry() {
234234
if (componentRegistry == null) {
235235
componentRegistry = new Hashtable();
236236
componentRegistry.put("Button", Button.class);

0 commit comments

Comments
 (0)