diff options
author | Dongjoon Hyun <dongjoon@apache.org> | 2016-03-09 10:12:23 +0000 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-03-09 10:12:23 +0000 |
commit | f3201aeeb06aae3b11e8cf6ee9693182dd896b32 (patch) | |
tree | 1c78b5e1218f3c851743914f1e2444ce59549217 /common/network-common | |
parent | 035d3acdf3c1be5b309a861d5c5beb803b946b5e (diff) | |
download | spark-f3201aeeb06aae3b11e8cf6ee9693182dd896b32.tar.gz spark-f3201aeeb06aae3b11e8cf6ee9693182dd896b32.tar.bz2 spark-f3201aeeb06aae3b11e8cf6ee9693182dd896b32.zip |
[SPARK-13692][CORE][SQL] Fix trivial Coverity/Checkstyle defects
## What changes were proposed in this pull request?
This issue fixes the following potential bugs and Java coding style detected by Coverity and Checkstyle.
- Implement both null and type checking in equals functions.
- Fix wrong type casting logic in SimpleJavaBean2.equals.
- Add `implement Cloneable` to `UTF8String` and `SortedIterator`.
- Remove dereferencing before null check in `AbstractBytesToBytesMapSuite`.
- Fix coding style: Add '{}' to single `for` statement in mllib examples.
- Remove unused imports in `ColumnarBatch` and `JavaKinesisStreamSuite`.
- Remove unused fields in `ChunkFetchIntegrationSuite`.
- Add `stop()` to prevent resource leak.
Please note that the last two checkstyle errors exist on newly added commits after [SPARK-13583](https://issues.apache.org/jira/browse/SPARK-13583).
## How was this patch tested?
manual via `./dev/lint-java` and Coverity site.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes #11530 from dongjoon-hyun/SPARK-13692.
Diffstat (limited to 'common/network-common')
3 files changed, 3 insertions, 3 deletions
diff --git a/common/network-common/src/test/java/org/apache/spark/network/ChunkFetchIntegrationSuite.java b/common/network-common/src/test/java/org/apache/spark/network/ChunkFetchIntegrationSuite.java index d17e986e17..6d62eaf35d 100644 --- a/common/network-common/src/test/java/org/apache/spark/network/ChunkFetchIntegrationSuite.java +++ b/common/network-common/src/test/java/org/apache/spark/network/ChunkFetchIntegrationSuite.java @@ -64,8 +64,6 @@ public class ChunkFetchIntegrationSuite { static ManagedBuffer bufferChunk; static ManagedBuffer fileChunk; - private TransportConf transportConf; - @BeforeClass public static void setUp() throws Exception { int bufSize = 100000; diff --git a/common/network-common/src/test/java/org/apache/spark/network/RequestTimeoutIntegrationSuite.java b/common/network-common/src/test/java/org/apache/spark/network/RequestTimeoutIntegrationSuite.java index e2d026c66f..c0ff9dc5f5 100644 --- a/common/network-common/src/test/java/org/apache/spark/network/RequestTimeoutIntegrationSuite.java +++ b/common/network-common/src/test/java/org/apache/spark/network/RequestTimeoutIntegrationSuite.java @@ -55,7 +55,7 @@ public class RequestTimeoutIntegrationSuite { private TransportConf conf; // A large timeout that "shouldn't happen", for the sake of faulty tests not hanging forever. - private final int FOREVER = 60 * 1000; + private static final int FOREVER = 60 * 1000; @Before public void setUp() throws Exception { diff --git a/common/network-common/src/test/java/org/apache/spark/network/TransportClientFactorySuite.java b/common/network-common/src/test/java/org/apache/spark/network/TransportClientFactorySuite.java index 9a89dd114f..44d16d5422 100644 --- a/common/network-common/src/test/java/org/apache/spark/network/TransportClientFactorySuite.java +++ b/common/network-common/src/test/java/org/apache/spark/network/TransportClientFactorySuite.java @@ -122,6 +122,8 @@ public class TransportClientFactorySuite { for (TransportClient client : clients) { client.close(); } + + factory.close(); } @Test |