Skip to content

Commit 83fb41e

Browse files
committed
Add visibility constraints; Fix non-compliant code
1 parent dcae1c5 commit 83fb41e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

java/ql/src/Likely Bugs/Concurrency/DateFormatThreadUnsafe.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class DateFormattingThread implements Runnable {
2-
private static DateFormat dateF = new SimpleDateFormat("yyyyMMdd"); // Static field declared
2+
public static DateFormat dateF = new SimpleDateFormat("yyyyMMdd"); // Static field declared
33

44
public void run() {
55
for(int i=0; i < 10; i++){

java/ql/src/Likely Bugs/Concurrency/DateFormatThreadUnsafe.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import java
1616
from Field f, Class dateFormat
1717
where
1818
f.isStatic() and
19+
(f.isPublic() or f.isProtected()) and
1920
dateFormat.hasQualifiedName("java.text", "DateFormat") and
2021
f.getType().(RefType).hasSupertype*(dateFormat) and
2122
exists(MethodAccess m | m.getQualifier().(VarAccess).getVariable() = f)

0 commit comments

Comments
 (0)