This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: | |
FailedReporter does not synchronize iteration on a synchronized map | |
Body: | |
In FailedReporter.java:63, the synchronized map, results, | |
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 results. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: | |
Field does not synchronize iteration on synchronized list | |
Body: | |
In Field.java:908, the synchronized list `dependencyList` 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: | |
XMLReporter does not synchronize iteration on a synchronized map | |
Body: | |
In XMLReporter.java:46, the synchronized map returned by getResults method | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: | |
SuiteHTMLReporter does not synchronize iteration on a synchronized map | |
Body: | |
In SuiteHTMLReporter.java:575, the synchronized map, suiteResults, | |
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 suiteResults. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: | |
SuiteHTMLReporter does not synchronize iteration on a synchronized map | |
Body: | |
In SuiteHTMLReporter.java:575, the synchronized map, suiteResults, | |
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 suiteResults. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: | |
Closing ObjectOutputStream before calling toByteArray on the underlying ByteArrayOutputStream | |
Subject: | |
When an ObjectOutputStream instance wraps an underlying ByteArrayOutputStream instance, | |
it is recommended to flush or close the ObjectOutputStream before invoking the underlying instances's toByteArray(). | |
Although in these cases this is not strictly necessary because the | |
writeObject method is invoked right before toByteArray, and writeObject | |
internally calls flush/drain. However, it is a good practice to call | |
flush/close explicitly as mentioned for example (here) | |
[http://stackoverflow.com/questions/2984538/how-to-use-bytearrayoutputstream-and-dataoutputstream-simultaneously-java] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title: Hybi00Handshake does not catch NumberFormatException | |
Body: | |
Hybi00Handshake.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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**NOTE to myself** I am only looking at output streams that are relevant to our violations. | |
** NOT TOO Specific ** | |
ByteArrayOutputStream_FlushBeforeRetrieve property [here](http://bit.ly/1S6ZLih) checks that if OutputStream (or its subclass) | |
instance is built on top of an | |
underlying ByteArrayOutputStream instance, it should call flush or close methods before the underlying instance's toByteArray() is invoked. | |
Note that flush and close methods of both OutputStream and ByteArrayOutputStream has no effect according to [Javadoc7](http://bit.ly/1QDICO9 ). | |
There are two issues with this property: | |
First this property does not exist in Javadoc 6 or 7 or 8 | |
Second, some of the OutputStream flush and close methods are Nop. So calling them has no effect. Following are the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Unneccessary property ## | |
HttpURLConnection_SetBeforeConnect property [here](http://bit.ly/1MsSrGw) warns if setFixedLengthStreamingMode(), setChunkedStreamingMode() or setRequestMethod() | |
are invoked after the URLConnection was made. | |
But there is no documentation that says that setRequestMethod() should be called before conneciton is made. | |
Only documentation for setFixedLengthStreamingMode() and setChunkedStreamingMode() exists. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Improvement in property ## | |
Iterator_RemoveOnce property [here](http://bit.ly/1MsOIc7) checks for Iterator.remove() is not preceded by next() and | |
warns if this not is case. | |
In cases, where iteration is in backward fashion like in the following code snippet | |
if(Iterator.hasPrevious){ | |
Iterator.previous(); | |
Iterator.remove(); | |
} | |
warning generated by Javamp will be false alarm. |