hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scan-ad...@coverity.com
Subject New Defects reported by Coverity Scan for Apache HBase
Date Mon, 08 Dec 2014 18:50:26 GMT

Hi,

Please find the latest report on new defect(s) introduced to Apache HBase found with Coverity
Scan.

13 new defect(s) introduced to Apache HBase found with Coverity Scan.
480 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed
by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 13 of 13 defect(s)


** CID 1223498:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableResource.java: 189 in org.apache.hadoop.hbase.rest.TableResource.getScanResource(javax.ws.rs.core.UriInfo,
java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.util.List,
int, int, long, long, boolean, java.lang.String)()

** CID 1223497:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 494 in org.apache.hadoop.hbase.rest.TestTableScan.testCompoundFilter()()

** CID 1223496:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 513 in org.apache.hadoop.hbase.rest.TestTableScan.testCustomFilter()()

** CID 1223495:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 533 in org.apache.hadoop.hbase.rest.TestTableScan.testNegativeCustomFilter()()

** CID 1223494:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 470 in org.apache.hadoop.hbase.rest.TestTableScan.testSimpleFilter()()

** CID 1223493:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 508 in org.apache.hadoop.hbase.rest.TestTableScan.testCompoundFilter()()

** CID 1223492:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 528 in org.apache.hadoop.hbase.rest.TestTableScan.testCustomFilter()()

** CID 1223491:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 489 in org.apache.hadoop.hbase.rest.TestTableScan.testSimpleFilter()()

** CID 1243908:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java: 102 in org.apache.hadoop.hbase.rest.TestScannerResource.insertData(org.apache.hadoop.conf.Configuration,
org.apache.hadoop.hbase.TableName, java.lang.String, double)()

** CID 1244031:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java: 93 in
org.apache.hadoop.hbase.rest.TestScannersWithLabels.insertData(org.apache.hadoop.hbase.TableName,
java.lang.String, double)()

** CID 1257264:  Ignoring number of bytes read  (CHECKED_RETURN)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java: 121 in org.apache.hadoop.hbase.rest.TestGzipFilter.testGzipFilter()()

** CID 1257352:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java: 102 in org.apache.hadoop.hbase.rest.TestTableResource.setUpBeforeClass()()

** CID 1257323:  Resource leak  (RESOURCE_LEAK)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java: 109 in
org.apache.hadoop.hbase.rest.TestScannersWithLabels.insertData(org.apache.hadoop.hbase.TableName,
java.lang.String, double)()


________________________________________________________________________________________________________
*** CID 1223498:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableResource.java: 189 in org.apache.hadoop.hbase.rest.TableResource.getScanResource(javax.ws.rs.core.UriInfo,
java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.util.List,
int, int, long, long, boolean, java.lang.String)()
183           } else if (filter != null) {
184             tableScan.setFilter(filter);
185           }
186           int fetchSize = this.servlet.getConfiguration().getInt(Constants.SCAN_FETCH_SIZE,
10);
187           tableScan.setCaching(fetchSize);
188          return new TableScanResource(hTable.getScanner(tableScan), userRequestedLimit);
>>>     CID 1223498:  REC: RuntimeException capture  (FB.REC_CATCH_EXCEPTION)
>>>     Catching RuntimeExceptions, perhaps unintentionally, with a catch block for
Exception.
189         } catch (Exception exp) {
190           servlet.getMetrics().incrementFailedScanRequests(1);
191           processException(exp);
192           LOG.warn(exp);
193           return null;
194         }
195       }

________________________________________________________________________________________________________
*** CID 1223497:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 494 in org.apache.hadoop.hbase.rest.TestTableScan.testCompoundFilter()()
488         assertEquals(1, count);
489         assertEquals("aab", new String(model.getRows().get(0).getCells().get(0).getValue()));
490       }
491     
492       @Test
493       public void testCompoundFilter() throws IOException, JAXBException {
>>>     CID 1223497:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
>>>     Dead store to builder.
494         StringBuilder builder = new StringBuilder();
495         builder = new StringBuilder();
496         builder.append("/*");
497         builder.append("?");
498         builder.append(Constants.SCAN_FILTER + "="
499             + URLEncoder.encode("PrefixFilter('abc') AND QualifierFilter(=,'binary:1')",
"UTF-8"));

________________________________________________________________________________________________________
*** CID 1223496:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 513 in org.apache.hadoop.hbase.rest.TestTableScan.testCustomFilter()()
507         assertEquals(1, count);
508         assertEquals("abc", new String(model.getRows().get(0).getCells().get(0).getValue()));
509       }
510     
511       @Test
512       public void testCustomFilter() throws IOException, JAXBException {
>>>     CID 1223496:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
>>>     Dead store to builder.
513         StringBuilder builder = new StringBuilder();
514         builder = new StringBuilder();
515         builder.append("/a*");
516         builder.append("?");
517         builder.append(Constants.SCAN_COLUMN + "=" + COLUMN_1);
518         builder.append("&");

________________________________________________________________________________________________________
*** CID 1223495:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 533 in org.apache.hadoop.hbase.rest.TestTableScan.testNegativeCustomFilter()()
527         assertEquals(1, count);
528         assertEquals("abc", new String(model.getRows().get(0).getCells().get(0).getValue()));
529       }
530       
531       @Test
532       public void testNegativeCustomFilter() throws IOException, JAXBException {
>>>     CID 1223495:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
>>>     Dead store to builder.
533         StringBuilder builder = new StringBuilder();
534         builder = new StringBuilder();
535         builder.append("/b*");
536         builder.append("?");
537         builder.append(Constants.SCAN_COLUMN + "=" + COLUMN_1);
538         builder.append("&");

________________________________________________________________________________________________________
*** CID 1223494:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 470 in org.apache.hadoop.hbase.rest.TestTableScan.testSimpleFilter()()
464         int count = TestScannerResource.countCellSet(model);
465         assertEquals(0, count);
466       }
467       
468       @Test
469       public void testSimpleFilter() throws IOException, JAXBException {
>>>     CID 1223494:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
>>>     Dead store to builder.
470         StringBuilder builder = new StringBuilder();
471         builder = new StringBuilder();
472         builder.append("/*");
473         builder.append("?");
474         builder.append(Constants.SCAN_COLUMN + "=" + COLUMN_1);
475         builder.append("&");

________________________________________________________________________________________________________
*** CID 1223493:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 508 in org.apache.hadoop.hbase.rest.TestTableScan.testCompoundFilter()()
502         assertEquals(200, response.getCode());
503         JAXBContext ctx = JAXBContext.newInstance(CellSetModel.class);
504         Unmarshaller ush = ctx.createUnmarshaller();
505         CellSetModel model = (CellSetModel) ush.unmarshal(response.getStream());
506         int count = TestScannerResource.countCellSet(model);
507         assertEquals(1, count);
>>>     CID 1223493:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
>>>     Found reliance on default encoding: new String(byte[]).
508         assertEquals("abc", new String(model.getRows().get(0).getCells().get(0).getValue()));
509       }
510     
511       @Test
512       public void testCustomFilter() throws IOException, JAXBException {
513         StringBuilder builder = new StringBuilder();

________________________________________________________________________________________________________
*** CID 1223492:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 528 in org.apache.hadoop.hbase.rest.TestTableScan.testCustomFilter()()
522         assertEquals(200, response.getCode());
523         JAXBContext ctx = JAXBContext.newInstance(CellSetModel.class);
524         Unmarshaller ush = ctx.createUnmarshaller();
525         CellSetModel model = (CellSetModel) ush.unmarshal(response.getStream());
526         int count = TestScannerResource.countCellSet(model);
527         assertEquals(1, count);
>>>     CID 1223492:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
>>>     Found reliance on default encoding: new String(byte[]).
528         assertEquals("abc", new String(model.getRows().get(0).getCells().get(0).getValue()));
529       }
530       
531       @Test
532       public void testNegativeCustomFilter() throws IOException, JAXBException {
533         StringBuilder builder = new StringBuilder();

________________________________________________________________________________________________________
*** CID 1223491:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java: 489 in org.apache.hadoop.hbase.rest.TestTableScan.testSimpleFilter()()
483         assertEquals(200, response.getCode());
484         JAXBContext ctx = JAXBContext.newInstance(CellSetModel.class);
485         Unmarshaller ush = ctx.createUnmarshaller();
486         CellSetModel model = (CellSetModel) ush.unmarshal(response.getStream());
487         int count = TestScannerResource.countCellSet(model);
488         assertEquals(1, count);
>>>     CID 1223491:  Dm: Dubious method used  (FB.DM_DEFAULT_ENCODING)
>>>     Found reliance on default encoding: new String(byte[]).
489         assertEquals("aab", new String(model.getRows().get(0).getCells().get(0).getValue()));
490       }
491     
492       @Test
493       public void testCompoundFilter() throws IOException, JAXBException {
494         StringBuilder builder = new StringBuilder();

________________________________________________________________________________________________________
*** CID 1243908:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java: 102 in org.apache.hadoop.hbase.rest.TestScannerResource.insertData(org.apache.hadoop.conf.Configuration,
org.apache.hadoop.hbase.TableName, java.lang.String, double)()
96                 table.put(put);
97                 count++;
98               }
99             }
100           }
101         }
>>>     CID 1243908:  Resource leak on an exceptional path  (RESOURCE_LEAK)
>>>     Variable "table" going out of scope leaks the resource it refers to.
102         table.flushCommits();
103         table.close();
104         return count;
105       }
106     
107       static int countCellSet(CellSetModel model) {

________________________________________________________________________________________________________
*** CID 1244031:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java: 93 in
org.apache.hadoop.hbase.rest.TestScannersWithLabels.insertData(org.apache.hadoop.hbase.TableName,
java.lang.String, double)()
87       private static JAXBContext context;
88       private static Marshaller marshaller;
89       private static Unmarshaller unmarshaller;
90       private static Configuration conf;
91     
92       private static int insertData(TableName tableName, String column, double prob) throws
IOException {
>>>     CID 1244031:  DLS: Dead local store  (FB.DLS_DEAD_LOCAL_STORE)
>>>     Dead store to rng.
93         Random rng = new Random();
94         int count = 0;
95         Table table = new HTable(TEST_UTIL.getConfiguration(), tableName);
96         byte[] k = new byte[3];
97         byte[][] famAndQf = KeyValue.parseColumn(Bytes.toBytes(column));
98     

________________________________________________________________________________________________________
*** CID 1257264:  Ignoring number of bytes read  (CHECKED_RETURN)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java: 121 in org.apache.hadoop.hbase.rest.TestGzipFilter.testGzipFilter()()
115         headers[1] = new Header("Accept-Encoding", "gzip");
116         response = client.get(path, headers);
117         assertEquals(response.getCode(), 200);
118         ByteArrayInputStream bis = new ByteArrayInputStream(response.getBody());
119         GZIPInputStream is = new GZIPInputStream(bis);
120         value = new byte[VALUE_1.length];
>>>     CID 1257264:  Ignoring number of bytes read  (CHECKED_RETURN)
>>>     "java.util.zip.GZIPInputStream.read(byte[], int, int)" returns the number
of bytes read, but it is ignored.
121         is.read(value, 0, VALUE_1.length);
122         assertTrue(Bytes.equals(value, VALUE_1));
123         is.close();
124         table.close();
125     
126         testScannerResultCodes();

________________________________________________________________________________________________________
*** CID 1257352:  Resource leak on an exceptional path  (RESOURCE_LEAK)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java: 102 in org.apache.hadoop.hbase.rest.TestTableResource.setUpBeforeClass()()
96               k[0] = b1;
97               k[1] = b2;
98               k[2] = b3;
99               Put put = new Put(k);
100               put.setDurability(Durability.SKIP_WAL);
101               put.add(famAndQf[0], famAndQf[1], k);
>>>     CID 1257352:  Resource leak on an exceptional path  (RESOURCE_LEAK)
>>>     Variable "table" going out of scope leaks the resource it refers to.
102               table.put(put);
103             }
104           }
105         }
106         table.flushCommits();
107         // get the initial layout (should just be one region)

________________________________________________________________________________________________________
*** CID 1257323:  Resource leak  (RESOURCE_LEAK)
/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java: 109 in
org.apache.hadoop.hbase.rest.TestScannersWithLabels.insertData(org.apache.hadoop.hbase.TableName,
java.lang.String, double)()
103           put.setCellVisibility(new CellVisibility("(" + SECRET + "|" + CONFIDENTIAL +
")" + "&" + "!"
104               + TOPSECRET));
105           table.put(put);
106           count++;
107         }
108         table.flushCommits();
>>>     CID 1257323:  Resource leak  (RESOURCE_LEAK)
>>>     Variable "table" going out of scope leaks the resource it refers to.
109         return count;
110       }
111     
112       private static int countCellSet(CellSetModel model) {
113         int count = 0;
114         Iterator<RowModel> rows = model.getRows().iterator();


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, http://scan.coverity.com/projects/728?tab=overview

To manage Coverity Scan email notifications for "dev@hbase.apache.org", click http://scan.coverity.com/subscriptions/edit?email=dev%40hbase.apache.org&token=f39a6e4847cf82e3baf7112deb7aed44
.


Mime
View raw message