Skip to content

Instantly share code, notes, and snippets.

@emopers
emopers / bugreport1.txt
Last active October 18, 2015 18:52
NO 17 & 18 bug report
Title:
JUnitXMLReporter does not synchronize the two synchronized collections when iterating
Body:
In lines 177 and 180 of JUnitXMLReporter, synchronized collections m_configIssues and m_allTests
are both iterated in an unsynchronized manner, but according to Oracle Java 7 API specification
(http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedList(java.util.List)),
although a synchronizedList is thread-safe for list manipulations like insertion and deletion,
manual synchronization is required when the collection is iterated.
Failure to do so might result in non-deterministic behavior.
This pull request adds a fix by synchronizing m_configIssues and m_allTests when iterating.
@emopers
emopers / httpunit
Last active October 25, 2015 18:59
NO. 168
Title:
HttpUnitUtils does not check the validity of input String
Body:
HttpUnitUtils.java directly calls 'st.nextToken()' on 'java.util.StringTokenizer st'
without checking if there are more tokens. Because 'st' is built from the String header
that can be invalid (e.g., an empty String), this can lead to a runtime exception
without a useful error message. This pull request adds an error message and a test.
@emopers
emopers / visualee
Last active October 25, 2015 19:02
NO. 30
Title:
Examiner does not check the validity of input JavaSource
Body:
Examiner.java calls 'scanner.next()' on 'java.util.Scanner scanner' without checking
if there are more elements. Because the scanner is built from the JavaSource parameter
that can be invalid (e.g., an empty source), this can lead to a runtime exception
without a useful error message. This pull request adds an error message and a test.
@emopers
emopers / xstream
Last active November 20, 2015 23:37
NO. 27 & NO. 141& NO. 421
Title:
DefaultConverterLookup does not synchronize iteration on a synchronized map
Body:
In DefaultConverterLookup.java:59, the synchronized map, typeToConverterMap, is iterated over in an unsynchronized manner, but according to the [Oracle Java 7 API specification](http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedMap%28java.util.Map%29),
this is not thread-safe and can lead to non-deterministic behavior. This pull request adds a fix by synchronizing the iteration on typeToConverterMap.
@emopers
emopers / activemq-all
Last active November 20, 2015 23:41
NO. 140 & NO. 422
Title:
TransportConnection does not synchronize iteration on synchronized list
Body:
In TransportConnection.java:861, the synchronized list returned by cs.getTempDestinations() is iterated
in an unsynchronized manner, but according to the [Oracle Java 7 API specification](http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedList(java.util.List)),
this is not thread-safe and can lead to non-deterministic behavior. This pull request adds a fix by synchronizing the iteration on the list returned by cs.getTempDestinations().
@emopers
emopers / joda-time
Last active November 21, 2015 00:04
NO. 362 & NO. 363
Title:
ZoneInfoCompiler$Zone does not check validity of input file
Body:
In org.joda.time.tz.ZoneInfoCompiler.java, the number of elements in the StringTokenier obtained from parsing the timezone file is not checked. There is an assumption that the input TimeZone file
will always be valid, leading to runtime exceptions with no good error message when the file is invalid. This pull request adds a potential fix
and a test for this issue.
@emopers
emopers / visualee
Last active November 21, 2015 14:58
NO. 29 && NO. 31
Title:
Examiner does not check the validity of input JavaSource
Body:
In Examiner.java, findAndSetPackage method calls 'scanner.next()' on 'java.util.Scanner scanner' without checking
if there are more elements. Because the scanner is built from the JavaSource parameter
that can be invalid (e.g., an empty source), this can lead to a runtime exception
without a useful error message. This pull request adds an error message and a test.
@emopers
emopers / No. 4 randoop
Last active December 8, 2015 07:46
terraform
Title: SshHelper does not catch IllegalArgumentException
Body:
SshHelper.java calls `java.net.InetSocketAddress` without first
checking that port number is within range of valid port values (0 to 65535, inclusive).
This cause an uncaught `IllegalArgumentException`: [Oracle Java 7 API specification](http://docs.oracle.com/javase/7/docs/api/java/net/InetSocketAddress.html#InetSocketAddress%28int%29).
This pull request adds a check and a test for this issue.
@emopers
emopers / No. 43 randoop
Last active December 8, 2015 07:58
lucene-interval-fields
Title: LongInterval does not catch NumberFormatException
Body:
LongInterval.java calls `java.lang.long.parseLong` without first
checking whether the argument parses. This
lead to an uncaught `NumberFormateException`: [Oracle Java 7 API specification](http://docs.oracle.com/javase/7/docs/api/java/lang/Long.html#parseLong%28java.lang.String,%20int%29).
This pull request adds a check and a test for this issue.
@emopers
emopers / Socket_Timeout
Last active December 22, 2015 04:55
JavaMop_bogus_property_1
## Improvement in property ##
Socket_Timeout property [here](http://bit.ly/1m5K3bc) checks that timeout value must be > 0.
While [Javadoc7] (http://bit.ly/22maOIZ) specified that "A timeout of zero is interpreted as an infinite timeout".
So if I want my socket to wait untill connection is established, I will use zero timeout.
Property should check for timeout value >= 0.