Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-10778 Address precommit WARNINGS
  3. SOLR-14169

Fix 20 Resource Leak warnings in apache/solr/common

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 8.5, 9.0
    • None
    • None

    Description

      There are 20 resource leak warnings in apache/solr/common

       [ecj-lint] 5. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/java/org/apache/solr/common/cloud/ZkNodeProps.java (at line 98) [ecj-lint] 5. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/java/org/apache/solr/common/cloud/ZkNodeProps.java (at line 98) [ecj-lint]  props = (Map<String, Object>) new JavaBinCodec().unmarshal(bytes); [ecj-lint]                                ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 6. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/java/org/apache/solr/common/util/Utils.java (at line 206) [ecj-lint]  new SolrJSONWriter(writer) [ecj-lint]  ^^^^^^^^^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 2. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java (at line 50) [ecj-lint]  try (InputStream is = new SolrResourceLoader().openResource("solrj/README"); [ecj-lint]                        ^^^^^^^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 3. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java (at line 73) [ecj-lint]  try (InputStream is = new SolrResourceLoader().openResource("solrj/README"); [ecj-lint]                        ^^^^^^^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 4. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java (at line 98) [ecj-lint]  try (InputStream is = new SolrResourceLoader().openResource("solrj/README"); [ecj-lint]                        ^^^^^^^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 5. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java (at line 127) [ecj-lint]  try (InputStream is = new SolrResourceLoader().openResource("solrj/README"); [ecj-lint]                        ^^^^^^^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 6. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java (at line 152) [ecj-lint]  try (InputStream is = new SolrResourceLoader().openResource("solrj/README"); [ecj-lint]                        ^^^^^^^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 7. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/ContentStreamTest.java (at line 177) [ecj-lint]  try (InputStream is = new SolrResourceLoader().openResource("solrj/README"); [ecj-lint]                        ^^^^^^^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 8. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java (at line 48) [ecj-lint]  JavaBinCodec codec = new JavaBinCodec(faos, null); [ecj-lint]               ^^^^^ [ecj-lint] Resource leak: 'codec' is never closed-- [ecj-lint] 9. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java (at line 58) [ecj-lint]  FastJavaBinDecoder.StreamCodec scodec = new FastJavaBinDecoder.StreamCodec(fis); [ecj-lint]                                 ^^^^^^ [ecj-lint] Resource leak: 'scodec' is never closed-- [ecj-lint] 10. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java (at line 81) [ecj-lint]  new JavaBinCodec().marshal(m, baos); [ecj-lint]  ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 11. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java (at line 83) [ecj-lint]  Map m2 = (Map) new JavaBinCodec().unmarshal(new FastInputStream(null, baos.getbuf(), 0, baos.size())); [ecj-lint]                 ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 12. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java (at line 124) [ecj-lint]  SimpleOrderedMap o = (SimpleOrderedMap) new JavaBinCodec().unmarshal(baos.toByteArray()); [ecj-lint]                                          ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 13. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/TestFastJavabinDecoder.java (at line 198) [ecj-lint]  new JavaBinCodec().marshal(orderedMap, baos); [ecj-lint]  ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 14. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/TestSolrJsonWriter.java (at line 45) [ecj-lint]  new SolrJSONWriter(writer) [ecj-lint]  ^^^^^^^^^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 15. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java (at line 38) [ecj-lint]  FastOutputStream fos = new FastOutputStream(baos, buf, 0); [ecj-lint]                   ^^^ [ecj-lint] Resource leak: 'fos' is never closed-- [ecj-lint] 16. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java (at line 53) [ecj-lint]  new JavaBinCodec().marshal(m0, baos); [ecj-lint]  ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 17. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java (at line 55) [ecj-lint]  Map m1 = (Map) new JavaBinCodec() [ecj-lint]                 ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 18. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java (at line 81) [ecj-lint]  new JavaBinCodec().marshal(nl, baos); [ecj-lint]  ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed-- [ecj-lint] 19. WARNING in /Users/andrassalamon/src/lucene-solr-upstream/solr/solrj/src/test/org/apache/solr/common/util/Utf8CharSequenceTest.java (at line 84) [ecj-lint]  NamedList nl1 = (NamedList) new JavaBinCodec() [ecj-lint]                              ^^^^^^^^^^^^^^^^^^ [ecj-lint] Resource leak: '<unassigned Closeable value>' is never closed 

      Attachments

        1. SOLR-14169-01.patch
          13 kB
          Andras Salamon

        Activity

          People

            tflobbe Tomas Eduardo Fernandez Lobbe
            asalamon74 Andras Salamon
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: