fixed xlint unchecked call warnings

Former-commit-id: b74ee0e63568b7b222f0459ad66a7e281b2f2e2f
This commit is contained in:
Jeremy Long
2014-11-11 13:41:20 -05:00
parent 1b31268f59
commit 06cd811ae4
6 changed files with 11 additions and 10 deletions

View File

@@ -54,6 +54,7 @@ import org.owasp.dependencycheck.utils.Pair;
* @author Jeremy Long <jeremy.long@owasp.org> * @author Jeremy Long <jeremy.long@owasp.org>
*/ */
public final class CpeMemoryIndex { public final class CpeMemoryIndex {
/** /**
* The logger. * The logger.
*/ */
@@ -160,7 +161,7 @@ public final class CpeMemoryIndex {
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private Analyzer createSearchingAnalyzer() { private Analyzer createSearchingAnalyzer() {
final Map fieldAnalyzers = new HashMap(); final Map<String, Analyzer> fieldAnalyzers = new HashMap<String, Analyzer>();
fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer()); fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer());
productSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); productSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION);
vendorSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION); vendorSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION);

View File

@@ -306,14 +306,14 @@ public class CveDB {
* @throws DatabaseException thrown when there is an error retrieving the data from the DB * @throws DatabaseException thrown when there is an error retrieving the data from the DB
*/ */
public Set<Pair<String, String>> getVendorProductList() throws DatabaseException { public Set<Pair<String, String>> getVendorProductList() throws DatabaseException {
final HashSet data = new HashSet<Pair<String, String>>(); final Set<Pair<String, String>> data = new HashSet<Pair<String, String>>();
ResultSet rs = null; ResultSet rs = null;
PreparedStatement ps = null; PreparedStatement ps = null;
try { try {
ps = getConnection().prepareStatement(SELECT_VENDOR_PRODUCT_LIST); ps = getConnection().prepareStatement(SELECT_VENDOR_PRODUCT_LIST);
rs = ps.executeQuery(); rs = ps.executeQuery();
while (rs.next()) { while (rs.next()) {
data.add(new Pair(rs.getString(1), rs.getString(2))); data.add(new Pair<String, String>(rs.getString(1), rs.getString(2)));
} }
} catch (SQLException ex) { } catch (SQLException ex) {
final String msg = "An unexpected SQL Exception occurred; please see the verbose log for more details."; final String msg = "An unexpected SQL Exception occurred; please see the verbose log for more details.";

View File

@@ -142,8 +142,8 @@ public class DatabaseProperties {
* *
* @return a map of the database meta data * @return a map of the database meta data
*/ */
public Map getMetaData() { public Map<String, String> getMetaData() {
final TreeMap map = new TreeMap(); final TreeMap<String, String> map = new TreeMap<String, String>();
for (Entry<Object, Object> entry : properties.entrySet()) { for (Entry<Object, Object> entry : properties.entrySet()) {
final String key = (String) entry.getKey(); final String key = (String) entry.getKey();
if (!"version".equals(key)) { if (!"version".equals(key)) {
@@ -156,10 +156,10 @@ public class DatabaseProperties {
map.put(key, formatted); map.put(key, formatted);
} catch (Throwable ex) { //deliberately being broad in this catch clause } catch (Throwable ex) { //deliberately being broad in this catch clause
LOGGER.log(Level.FINE, "Unable to parse timestamp from DB", ex); LOGGER.log(Level.FINE, "Unable to parse timestamp from DB", ex);
map.put(key, entry.getValue()); map.put(key, (String) entry.getValue());
} }
} else { } else {
map.put(key, entry.getValue()); map.put(key, (String) entry.getValue());
} }
} }
} }

View File

@@ -40,7 +40,7 @@ public class ArchiveAnalyzerIntegrationTest extends AbstractDatabaseTestCase {
@Test @Test
public void testGetSupportedExtensions() { public void testGetSupportedExtensions() {
ArchiveAnalyzer instance = new ArchiveAnalyzer(); ArchiveAnalyzer instance = new ArchiveAnalyzer();
Set expResult = new HashSet<String>(); Set<String> expResult = new HashSet<String>();
expResult.add("zip"); expResult.add("zip");
expResult.add("war"); expResult.add("war");
expResult.add("ear"); expResult.add("ear");

View File

@@ -93,7 +93,7 @@ public class JarAnalyzerTest extends BaseTest {
@Test @Test
public void testGetSupportedExtensions() { public void testGetSupportedExtensions() {
JarAnalyzer instance = new JarAnalyzer(); JarAnalyzer instance = new JarAnalyzer();
Set expResult = new HashSet(); Set<String> expResult = new HashSet<String>();
expResult.add("jar"); expResult.add("jar");
expResult.add("war"); expResult.add("war");
Set result = instance.getSupportedExtensions(); Set result = instance.getSupportedExtensions();

View File

@@ -38,7 +38,7 @@ public class JavaScriptAnalyzerTest extends BaseTest {
@Test @Test
public void testGetSupportedExtensions() { public void testGetSupportedExtensions() {
JavaScriptAnalyzer instance = new JavaScriptAnalyzer(); JavaScriptAnalyzer instance = new JavaScriptAnalyzer();
Set expResult = new HashSet<String>(); Set<String> expResult = new HashSet<String>();
expResult.add("js"); expResult.add("js");
Set result = instance.getSupportedExtensions(); Set result = instance.getSupportedExtensions();
assertEquals(expResult, result); assertEquals(expResult, result);