You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Nikolai Kulagin (JIRA)" <ji...@apache.org> on 2018/08/02 10:40:00 UTC

[jira] [Updated] (IGNITE-9165) FindBugs: Methods may fail to close stream in core module

     [ https://issues.apache.org/jira/browse/IGNITE-9165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikolai Kulagin updated IGNITE-9165:
------------------------------------
    Description: 
The method creates an IO stream object, does not assign it to any fields, pass it to other methods that might close it, or return it, and does not appear to close the stream on all paths out of the method.  This may result in a file descriptor leak.

Example:

 
{code:java}
// GridCacheAbstractLoadTest#GridCacheAbstractLoadTest()

try {
 props.load(new FileReader(GridTestUtils.resolveIgnitePath(
 "modules/tests/config/cache-load.properties")));
}
catch (IOException e) {
 throw new RuntimeException(e);
}{code}
 
 One of possible solutions:
{code:java}
try(Reader reader = new FileReader(GridTestUtils.resolveIgnitePath(
    "modules/tests/config/cache-load.properties"))) {
    props.load(reader);
}
catch (IOException e) {
    throw new RuntimeException(e);
}{code}
List of classes in "core" module:
  
 +org.apache.ignite.internal:+   
 * *BinaryContext*#classesInPackage(String) , line 583
 * *GridClientJdkMarshaller*#marshal(Object, int), line 61
 * *IgniteExplicitImplicitDeploymentSelfTest*$GridDeploymentResourceTestJob#execute(), line 474
 * *OptimizedObjectStreamSelfTest*#testReadLine(), line 793
 * *PageIdDistributionTest*#_testRealHistory(), line 220
 * *HttpIgniteUpdatesChecker*#getUpdates(boolean), line 69
 * *IpcSharedMemoryNativeLoaderSelfTest*#readStreams(Process), line 207

 +org.apache.ignite:+
 * *GridCacheAbstractLoadTest*#GridCacheAbstractLoadTest(), line 123
 * *GridTestUtils*.sslContext(), line 1674

  was:
The method creates an IO stream object, does not assign it to any fields, pass it to other methods that might close it, or return it, and does not appear to close the stream on all paths out of the method.  This may result in a file descriptor leak.

Example:

 
{code:java}
// GridCacheAbstractLoadTest#GridCacheAbstractLoadTest()

try {
 props.load(new FileReader(GridTestUtils.resolveIgnitePath(
 "modules/tests/config/cache-load.properties")));
}
catch (IOException e) {
 throw new RuntimeException(e);
}{code}
 
One of possible solutions:
{code:java}
try(Reader reader = new FileReader(GridTestUtils.resolveIgnitePath(
    "modules/tests/config/cache-load.properties"))) {
    props.load(reader);
}
catch (IOException e) {
    throw new RuntimeException(e);
}{code}
List of classes in "core" module:
 
+org.apache.ignite.internal:+ *   *BinaryContext*#classesInPackage(String) , line 583
 *   *GridClientJdkMarshalle*r#marshal(Object, int), line 61
 *   *IgniteExplicitImplicitDeploymentSelfTest*$GridDeploymentResourceTestJob#execute(), line 474
 *   *OptimizedObjectStreamSelfTest*#testReadLine(), line 793
 *   *PageIdDistributionTest*#_testRealHistory(), line 220
 *   *HttpIgniteUpdatesChecker*#getUpdates(boolean), line 69
 *   *IpcSharedMemoryNativeLoaderSelfTest*#readStreams(Process), line 207

 
+org.apache.ignite:+
  *GridCacheAbstractLoadTest*#GridCacheAbstractLoadTest(), line 123
  *GridTestUtils*.sslContext(), line 1674


> FindBugs: Methods may fail to close stream in core module
> ---------------------------------------------------------
>
>                 Key: IGNITE-9165
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9165
>             Project: Ignite
>          Issue Type: Bug
>          Components: binary
>    Affects Versions: 2.6
>            Reporter: Nikolai Kulagin
>            Assignee: Nikolai Kulagin
>            Priority: Minor
>             Fix For: 2.7
>
>         Attachments: findbugs-result-apache-ignite[ignite-core]_2018_08_02_12_38_02.html
>
>
> The method creates an IO stream object, does not assign it to any fields, pass it to other methods that might close it, or return it, and does not appear to close the stream on all paths out of the method.  This may result in a file descriptor leak.
> Example:
>  
> {code:java}
> // GridCacheAbstractLoadTest#GridCacheAbstractLoadTest()
> try {
>  props.load(new FileReader(GridTestUtils.resolveIgnitePath(
>  "modules/tests/config/cache-load.properties")));
> }
> catch (IOException e) {
>  throw new RuntimeException(e);
> }{code}
>  
>  One of possible solutions:
> {code:java}
> try(Reader reader = new FileReader(GridTestUtils.resolveIgnitePath(
>     "modules/tests/config/cache-load.properties"))) {
>     props.load(reader);
> }
> catch (IOException e) {
>     throw new RuntimeException(e);
> }{code}
> List of classes in "core" module:
>   
>  +org.apache.ignite.internal:+   
>  * *BinaryContext*#classesInPackage(String) , line 583
>  * *GridClientJdkMarshaller*#marshal(Object, int), line 61
>  * *IgniteExplicitImplicitDeploymentSelfTest*$GridDeploymentResourceTestJob#execute(), line 474
>  * *OptimizedObjectStreamSelfTest*#testReadLine(), line 793
>  * *PageIdDistributionTest*#_testRealHistory(), line 220
>  * *HttpIgniteUpdatesChecker*#getUpdates(boolean), line 69
>  * *IpcSharedMemoryNativeLoaderSelfTest*#readStreams(Process), line 207
>  +org.apache.ignite:+
>  * *GridCacheAbstractLoadTest*#GridCacheAbstractLoadTest(), line 123
>  * *GridTestUtils*.sslContext(), line 1674



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)