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
3 changes: 3 additions & 0 deletions .github/scripts/generate-quality-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ def main() -> None:
"NM_CONFUSING",
"NM_FIELD_NAMING_CONVENTION",
"NM_METHOD_NAMING_CONVENTION",
"NN_NAKED_NOTIFY",
"NO_NOTIFY_NOT_NOTIFYALL",
"NP_LOAD_OF_KNOWN_NULL_VALUE",
"NP_BOOLEAN_RETURN_NULL",
Expand Down Expand Up @@ -851,6 +852,8 @@ def _is_exempt(f: Finding) -> bool:
return True
if f.rule == "URF_UNREAD_FIELD" and "GridBagLayoutInfo" in loc:
return True
if f.rule == "NN_NAKED_NOTIFY" and "Display.java" in loc:
return True
return False


Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/capture/Capture.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ public void actionPerformed(ActionEvent evt) {
} else {
url = (String) evt.getSource();
}
completed = true;
synchronized (this) {
completed = true;
this.notifyAll();
}
}
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/components/WebBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ protected void readResponse(InputStream input) throws IOException {
if (callback != null) {
callback.streamReady(input, docInfo);
} else {
response[0] = input;
synchronized (LOCK) {
response[0] = input;
LOCK.notifyAll();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7177,13 +7177,9 @@ protected final void pushReceived(String data) {
* Sets the frequency for polling the server in case of polling based push notification
*
* @param freq the frequency in milliseconds
* @deprecated we no longer support push polling
*/
public void setPollingFrequency(int freq) {
if (callback != null && pollingThreadRunning) {
synchronized (callback) {
callback.notifyAll();
}
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions CodenameOne/src/com/codename1/io/NetworkManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ public void shutdown() {
}
}
}
networkThreads = null;
synchronized (LOCK) {
networkThreads = null;
LOCK.notifyAll();
}

Expand Down Expand Up @@ -970,10 +970,10 @@ public void run() {
if (!runCurrentRequest(currentRequest)) {
continue;
}
currentRequest = null;

// wakeup threads waiting for the completion of this network operation
synchronized (LOCK) {
currentRequest = null;
LOCK.notifyAll();
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions CodenameOne/src/com/codename1/ui/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,8 @@ public static void init(Object m) {
* Notice that minimize (being a Codename One method) MUST be invoked before invoking this method!
*/
public static void deinitialize() {

INSTANCE.codenameOneRunning = false;
synchronized (lock) {
INSTANCE.codenameOneRunning = false;
lock.notifyAll();
}
}
Expand Down Expand Up @@ -4684,6 +4683,7 @@ public String getDatabasePath(String databaseName) {
* Sets the frequency for polling the server in case of polling based push notification
*
* @param freq the frequency in milliseconds
* @deprecated we no longer support push polling
*/
public void setPollingFrequency(int freq) {
impl.setPollingFrequency(freq);
Expand Down
2 changes: 1 addition & 1 deletion CodenameOne/src/com/codename1/ui/RunnableWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ public void run() {
switch (type) {
case 0:
internal.run();
done = true;
synchronized (Display.lock) {
done = true;
Display.lock.notifyAll();
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ protected void readResponse(InputStream input) throws IOException {
if (callback != null) {
callback.streamReady(input, docInfo);
} else {
response[0] = input;
synchronized (LOCK) {
response[0] = input;
LOCK.notifyAll();
}
}
Expand Down
9 changes: 9 additions & 0 deletions maven/core-unittests/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@
<Bug pattern="SF_SWITCH_FALLTHROUGH" />
</Match>

<!--
This rule is a bit broad for the complex threading logic in Display.
Ideally, this code should be rewritten, but it's battle tested and deep.
-->
<Match>
<Class name="~com\.codename1\.ui\.Display.*" />
<Bug pattern="NN_NAKED_NOTIFY" />
</Match>

<!-- Excluding since the class explicitly compares interned strings -->
<Match>
<Class name="~com\.codename1\.io\.ConnectionRequest.*" />
Expand Down
Loading