mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-25 02:21:28 +01:00
Isolated sources of deprecation warnings, and added warning suppression annotations. Also added a minor Enumeration -> Enumeration<JarEntry> "fix"
Former-commit-id: ccfe52d9ed50977ce73b928b09232d8635d7fcf2
This commit is contained in:
@@ -122,6 +122,13 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
"ipojo-components",
|
"ipojo-components",
|
||||||
"ipojo-extension",
|
"ipojo-extension",
|
||||||
"eclipse-sourcereferences");
|
"eclipse-sourcereferences");
|
||||||
|
/**
|
||||||
|
* Deprecated Jar manifest attribute, that is, nonetheless, useful for
|
||||||
|
* analysis.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private static final String IMPLEMENTATION_VENDOR_ID = Attributes.Name.IMPLEMENTATION_VENDOR_ID
|
||||||
|
.toString();
|
||||||
/**
|
/**
|
||||||
* item in some manifest, should be considered medium confidence.
|
* item in some manifest, should be considered medium confidence.
|
||||||
*/
|
*/
|
||||||
@@ -677,7 +684,7 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
foundSomething = true;
|
foundSomething = true;
|
||||||
vendorEvidence.addEvidence(source, key, value, Confidence.HIGH);
|
vendorEvidence.addEvidence(source, key, value, Confidence.HIGH);
|
||||||
addMatchingValues(classInformation, value, vendorEvidence);
|
addMatchingValues(classInformation, value, vendorEvidence);
|
||||||
} else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VENDOR_ID.toString())) {
|
} else if (key.equalsIgnoreCase(IMPLEMENTATION_VENDOR_ID)) {
|
||||||
foundSomething = true;
|
foundSomething = true;
|
||||||
vendorEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
|
vendorEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
|
||||||
addMatchingValues(classInformation, value, vendorEvidence);
|
addMatchingValues(classInformation, value, vendorEvidence);
|
||||||
@@ -926,9 +933,9 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
JarFile jar = null;
|
JarFile jar = null;
|
||||||
try {
|
try {
|
||||||
jar = new JarFile(dependency.getActualFilePath());
|
jar = new JarFile(dependency.getActualFilePath());
|
||||||
final Enumeration entries = jar.entries();
|
final Enumeration<JarEntry> entries = jar.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
final JarEntry entry = (JarEntry) entries.nextElement();
|
final JarEntry entry = entries.nextElement();
|
||||||
final String name = entry.getName().toLowerCase();
|
final String name = entry.getName().toLowerCase();
|
||||||
//no longer stripping "|com\\.sun" - there are some com.sun jar files with CVEs.
|
//no longer stripping "|com\\.sun" - there are some com.sun jar files with CVEs.
|
||||||
if (name.endsWith(".class") && !name.matches("^javax?\\..*$")) {
|
if (name.endsWith(".class") && !name.matches("^javax?\\..*$")) {
|
||||||
|
|||||||
@@ -357,9 +357,22 @@ public class VulnerableSoftware extends IndexEntry implements Serializable, Comp
|
|||||||
try {
|
try {
|
||||||
result = URLDecoder.decode(text, "ASCII");
|
result = URLDecoder.decode(text, "ASCII");
|
||||||
} catch (UnsupportedEncodingException ex1) {
|
} catch (UnsupportedEncodingException ex1) {
|
||||||
result = URLDecoder.decode(text);
|
result = defaultUrlDecode(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call {@link java.net.URLDecoder#decode(String)} to URL decode using the
|
||||||
|
* default encoding.
|
||||||
|
*
|
||||||
|
* @param text
|
||||||
|
* www-form-encoded URL to decode
|
||||||
|
* @return the newly decoded String
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private String defaultUrlDecode(final String text) {
|
||||||
|
return URLDecoder.decode(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user