From b63a656dc4f0806227ce9a6e47906c86c6cb2b50 Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Tue, 28 Feb 2017 11:45:04 -0800 Subject: [PATCH] [infer][tests] cleanup of the Cursor NPE test file Summary: - The package declaration was wrong - There was a leftover copy-pasted resource leak test from `CursorLeak.java`. Reviewed By: sblackshear Differential Revision: D4612687 fbshipit-source-id: 42c1a35 --- infer/tests/build_systems/ant/issues.exp | 1 - infer/tests/build_systems/buck/issues.exp | 1 - .../tests/codetoanalyze/java/infer/CursorNPEs.java | 13 +------------ infer/tests/codetoanalyze/java/infer/issues.exp | 1 - 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/infer/tests/build_systems/ant/issues.exp b/infer/tests/build_systems/ant/issues.exp index b62a11be4..fc0068b20 100644 --- a/infer/tests/build_systems/ant/issues.exp +++ b/infer/tests/build_systems/ant/issues.exp @@ -23,7 +23,6 @@ codetoanalyze/java/infer/CursorLeaks.java, int CursorLeaks.getImageCountHelperNo codetoanalyze/java/infer/CursorLeaks.java, void CursorLeaks.loadPrefsFromContentProviderNotClosed(), 11, RESOURCE_LEAK, [start of procedure loadPrefsFromContentProviderNotClosed(),Taking false branch,Taking true branch] codetoanalyze/java/infer/CursorLeaks.java, void CursorLeaks.queryUVMLegacyDbNotClosed(), 4, RESOURCE_LEAK, [start of procedure queryUVMLegacyDbNotClosed(),Taking true branch] codetoanalyze/java/infer/CursorNPEs.java, int CursorNPEs.cursorFromDownloadManagerNPE(DownloadManager), 5, NULL_DEREFERENCE, [start of procedure cursorFromDownloadManagerNPE(...)] -codetoanalyze/java/infer/CursorNPEs.java, int CursorNPEs.cursorNotClosed(SQLiteDatabase), 7, RESOURCE_LEAK, [start of procedure cursorNotClosed(...),Taking false branch] codetoanalyze/java/infer/CursorNPEs.java, void CursorNPEs.cursorFromContentResolverNPE(String), 12, NULL_DEREFERENCE, [start of procedure cursorFromContentResolverNPE(...)] codetoanalyze/java/infer/CursorNPEs.java, void CursorNPEs.cursorFromMediaNPE(), 3, NULL_DEREFERENCE, [start of procedure cursorFromMediaNPE()] codetoanalyze/java/infer/DynamicDispatch.java, void DynamicDispatch$WithField.dispatchOnFieldBad(), 3, NULL_DEREFERENCE, [start of procedure dispatchOnFieldBad(),start of procedure DynamicDispatch$Subtype(),start of procedure DynamicDispatch$Supertype(),return from a call to DynamicDispatch$Supertype.(),return from a call to DynamicDispatch$Subtype.(),start of procedure DynamicDispatch$WithField(...),return from a call to DynamicDispatch$WithField.(DynamicDispatch$Subtype),start of procedure foo(),return from a call to Object DynamicDispatch$Subtype.foo()] diff --git a/infer/tests/build_systems/buck/issues.exp b/infer/tests/build_systems/buck/issues.exp index d9b0dbb03..14bce939a 100644 --- a/infer/tests/build_systems/buck/issues.exp +++ b/infer/tests/build_systems/buck/issues.exp @@ -23,7 +23,6 @@ infer/tests/codetoanalyze/java/infer/CursorLeaks.java, int CursorLeaks.getImageC infer/tests/codetoanalyze/java/infer/CursorLeaks.java, void CursorLeaks.loadPrefsFromContentProviderNotClosed(), 11, RESOURCE_LEAK, [start of procedure loadPrefsFromContentProviderNotClosed(),Taking false branch,Taking true branch] infer/tests/codetoanalyze/java/infer/CursorLeaks.java, void CursorLeaks.queryUVMLegacyDbNotClosed(), 4, RESOURCE_LEAK, [start of procedure queryUVMLegacyDbNotClosed(),Taking true branch] infer/tests/codetoanalyze/java/infer/CursorNPEs.java, int CursorNPEs.cursorFromDownloadManagerNPE(DownloadManager), 5, NULL_DEREFERENCE, [start of procedure cursorFromDownloadManagerNPE(...)] -infer/tests/codetoanalyze/java/infer/CursorNPEs.java, int CursorNPEs.cursorNotClosed(SQLiteDatabase), 7, RESOURCE_LEAK, [start of procedure cursorNotClosed(...),Taking false branch] infer/tests/codetoanalyze/java/infer/CursorNPEs.java, void CursorNPEs.cursorFromContentResolverNPE(String), 12, NULL_DEREFERENCE, [start of procedure cursorFromContentResolverNPE(...)] infer/tests/codetoanalyze/java/infer/CursorNPEs.java, void CursorNPEs.cursorFromMediaNPE(), 3, NULL_DEREFERENCE, [start of procedure cursorFromMediaNPE()] infer/tests/codetoanalyze/java/infer/DynamicDispatch.java, void DynamicDispatch$WithField.dispatchOnFieldBad(), 3, NULL_DEREFERENCE, [start of procedure dispatchOnFieldBad(),start of procedure DynamicDispatch$Subtype(),start of procedure DynamicDispatch$Supertype(),return from a call to DynamicDispatch$Supertype.(),return from a call to DynamicDispatch$Subtype.(),start of procedure DynamicDispatch$WithField(...),return from a call to DynamicDispatch$WithField.(DynamicDispatch$Subtype),start of procedure foo(),return from a call to Object DynamicDispatch$Subtype.foo()] diff --git a/infer/tests/codetoanalyze/java/infer/CursorNPEs.java b/infer/tests/codetoanalyze/java/infer/CursorNPEs.java index 65c658685..4c0128894 100644 --- a/infer/tests/codetoanalyze/java/infer/CursorNPEs.java +++ b/infer/tests/codetoanalyze/java/infer/CursorNPEs.java @@ -7,7 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -package codetoanalyze.java.errors; +package codetoanalyze.java.infer; import android.app.DownloadManager; @@ -33,17 +33,6 @@ public class CursorNPEs { } } - public int cursorNotClosed(SQLiteDatabase sqLiteDatabase) { - Cursor cursor = sqLiteDatabase.query( - "events", null, - null, null, null, null, null); - if (cursor == null) { - return 0; - } else { - return cursor.getCount(); - } - } - Context mContext; ContentResolver mContentResolver; diff --git a/infer/tests/codetoanalyze/java/infer/issues.exp b/infer/tests/codetoanalyze/java/infer/issues.exp index b6b3730ca..20f1bede5 100644 --- a/infer/tests/codetoanalyze/java/infer/issues.exp +++ b/infer/tests/codetoanalyze/java/infer/issues.exp @@ -47,7 +47,6 @@ codetoanalyze/java/infer/CursorLeaks.java, void CursorLeaks.loadPrefsFromContent codetoanalyze/java/infer/CursorLeaks.java, void CursorLeaks.loadPrefsFromContentProviderNotClosed(), 11, RESOURCE_LEAK, [start of procedure loadPrefsFromContentProviderNotClosed(),Taking false branch,Taking true branch] codetoanalyze/java/infer/CursorLeaks.java, void CursorLeaks.queryUVMLegacyDbNotClosed(), 4, RESOURCE_LEAK, [start of procedure queryUVMLegacyDbNotClosed(),Taking true branch] codetoanalyze/java/infer/CursorNPEs.java, int CursorNPEs.cursorFromDownloadManagerNPE(DownloadManager), 5, NULL_DEREFERENCE, [start of procedure cursorFromDownloadManagerNPE(...)] -codetoanalyze/java/infer/CursorNPEs.java, int CursorNPEs.cursorNotClosed(SQLiteDatabase), 7, RESOURCE_LEAK, [start of procedure cursorNotClosed(...),Taking false branch] codetoanalyze/java/infer/CursorNPEs.java, void CursorNPEs.cursorFromContentProviderClient(), 3, NULL_TEST_AFTER_DEREFERENCE, [start of procedure cursorFromContentProviderClient(),Taking false branch] codetoanalyze/java/infer/CursorNPEs.java, void CursorNPEs.cursorFromContentResolverNPE(String), 12, NULL_DEREFERENCE, [start of procedure cursorFromContentResolverNPE(...)] codetoanalyze/java/infer/CursorNPEs.java, void CursorNPEs.cursorFromMediaNPE(), 3, NULL_DEREFERENCE, [start of procedure cursorFromMediaNPE()]