mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-26 19:11:29 +01:00
java 7 updates
This commit is contained in:
@@ -115,7 +115,7 @@ public class HintHandler extends DefaultHandler {
|
|||||||
/**
|
/**
|
||||||
* The list of hint rules.
|
* The list of hint rules.
|
||||||
*/
|
*/
|
||||||
private final List<HintRule> hintRules = new ArrayList<HintRule>();
|
private final List<HintRule> hintRules = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of hint rules.
|
* Returns the list of hint rules.
|
||||||
@@ -129,7 +129,7 @@ public class HintHandler extends DefaultHandler {
|
|||||||
/**
|
/**
|
||||||
* The list of vendor duplicating hint rules.
|
* The list of vendor duplicating hint rules.
|
||||||
*/
|
*/
|
||||||
private final List<VendorDuplicatingHintRule> vendorDuplicatingHintRules = new ArrayList<VendorDuplicatingHintRule>();
|
private final List<VendorDuplicatingHintRule> vendorDuplicatingHintRules = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of vendor duplicating hint rules.
|
* Returns the list of vendor duplicating hint rules.
|
||||||
@@ -170,102 +170,99 @@ public class HintHandler extends DefaultHandler {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void startElement(String uri, String localName, String qName, Attributes attr) throws SAXException {
|
public void startElement(String uri, String localName, String qName, Attributes attr) throws SAXException {
|
||||||
if (HINT.equals(qName)) {
|
if (null != qName) {
|
||||||
rule = new HintRule();
|
switch (qName) {
|
||||||
} else if (ADD.equals(qName)) {
|
case HINT:
|
||||||
nodeType = ParentType.ADD;
|
rule = new HintRule();
|
||||||
} else if (GIVEN.equals(qName)) {
|
break;
|
||||||
nodeType = ParentType.GIVEN;
|
case ADD:
|
||||||
} else if (REMOVE.equals(qName)) {
|
nodeType = ParentType.ADD;
|
||||||
nodeType = ParentType.REMOVE;
|
break;
|
||||||
} else if (EVIDENCE.equals(qName)) {
|
case GIVEN:
|
||||||
final String hintType = attr.getValue(TYPE);
|
nodeType = ParentType.GIVEN;
|
||||||
if (VENDOR.equals(hintType)) {
|
break;
|
||||||
if (null != nodeType) switch (nodeType) {
|
case REMOVE:
|
||||||
case ADD:
|
nodeType = ParentType.REMOVE;
|
||||||
rule.addAddVendor(attr.getValue(SOURCE),
|
break;
|
||||||
attr.getValue(NAME),
|
case EVIDENCE:
|
||||||
attr.getValue(VALUE),
|
final String hintType = attr.getValue(TYPE);
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
if (null != hintType && null != nodeType) {
|
||||||
break;
|
final String source = attr.getValue(SOURCE);
|
||||||
case REMOVE:
|
final String name = attr.getValue(NAME);
|
||||||
rule.addRemoveVendor(attr.getValue(SOURCE),
|
final String value = attr.getValue(VALUE);
|
||||||
attr.getValue(NAME),
|
final Confidence confidence = Confidence.valueOf(attr.getValue(CONFIDENCE));
|
||||||
attr.getValue(VALUE),
|
switch (hintType) {
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
case VENDOR:
|
||||||
break;
|
switch (nodeType) {
|
||||||
case GIVEN:
|
case ADD:
|
||||||
rule.addGivenVendor(attr.getValue(SOURCE),
|
rule.addAddVendor(source, name, value, confidence);
|
||||||
attr.getValue(NAME),
|
break;
|
||||||
attr.getValue(VALUE),
|
case REMOVE:
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
rule.addRemoveVendor(source, name, value, confidence);
|
||||||
break;
|
break;
|
||||||
default:
|
case GIVEN:
|
||||||
break;
|
rule.addGivenVendor(source, name, value, confidence);
|
||||||
}
|
break;
|
||||||
} else if (PRODUCT.equals(hintType)) {
|
default:
|
||||||
if (null != nodeType) switch (nodeType) {
|
break;
|
||||||
case ADD:
|
}
|
||||||
rule.addAddProduct(attr.getValue(SOURCE),
|
break;
|
||||||
attr.getValue(NAME),
|
case PRODUCT:
|
||||||
attr.getValue(VALUE),
|
switch (nodeType) {
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
case ADD:
|
||||||
break;
|
rule.addAddProduct(source, name, value, confidence);
|
||||||
case REMOVE:
|
break;
|
||||||
rule.addRemoveProduct(attr.getValue(SOURCE),
|
case REMOVE:
|
||||||
attr.getValue(NAME),
|
rule.addRemoveProduct(source, name, value, confidence);
|
||||||
attr.getValue(VALUE),
|
break;
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
case GIVEN:
|
||||||
break;
|
rule.addGivenProduct(source, name, value, confidence);
|
||||||
case GIVEN:
|
break;
|
||||||
rule.addGivenProduct(attr.getValue(SOURCE),
|
default:
|
||||||
attr.getValue(NAME),
|
break;
|
||||||
attr.getValue(VALUE),
|
}
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
break;
|
||||||
break;
|
case VERSION:
|
||||||
default:
|
switch (nodeType) {
|
||||||
break;
|
case ADD:
|
||||||
}
|
rule.addAddVersion(source, name, value, confidence);
|
||||||
} else if (VERSION.equals(hintType)) {
|
break;
|
||||||
if (null != nodeType) switch (nodeType) {
|
case REMOVE:
|
||||||
case ADD:
|
rule.addRemoveVersion(source, name, value, confidence);
|
||||||
rule.addAddVersion(attr.getValue(SOURCE),
|
break;
|
||||||
attr.getValue(NAME),
|
case GIVEN:
|
||||||
attr.getValue(VALUE),
|
rule.addGivenVersion(source, name, value, confidence);
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
break;
|
||||||
break;
|
default:
|
||||||
case REMOVE:
|
break;
|
||||||
rule.addRemoveVersion(attr.getValue(SOURCE),
|
}
|
||||||
attr.getValue(NAME),
|
break;
|
||||||
attr.getValue(VALUE),
|
default:
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
break;
|
||||||
break;
|
}
|
||||||
case GIVEN:
|
}
|
||||||
rule.addGivenVersion(attr.getValue(SOURCE),
|
break;
|
||||||
attr.getValue(NAME),
|
case FILE_NAME:
|
||||||
attr.getValue(VALUE),
|
final PropertyType pt = new PropertyType();
|
||||||
Confidence.valueOf(attr.getValue(CONFIDENCE)));
|
pt.setValue(attr.getValue(CONTAINS));
|
||||||
break;
|
if (attr.getLength() > 0) {
|
||||||
default:
|
final String regex = attr.getValue(REGEX);
|
||||||
break;
|
if (regex != null) {
|
||||||
}
|
pt.setRegex(Boolean.parseBoolean(regex));
|
||||||
|
}
|
||||||
|
final String caseSensitive = attr.getValue(CASE_SENSITIVE);
|
||||||
|
if (caseSensitive != null) {
|
||||||
|
pt.setCaseSensitive(Boolean.parseBoolean(caseSensitive));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rule.addFilename(pt);
|
||||||
|
break;
|
||||||
|
case VENDOR_DUPLICATING_RULE:
|
||||||
|
vendorDuplicatingHintRules.add(new VendorDuplicatingHintRule(attr.getValue(VALUE), attr.getValue(DUPLICATE)));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (FILE_NAME.equals(qName)) {
|
|
||||||
final PropertyType pt = new PropertyType();
|
|
||||||
pt.setValue(attr.getValue(CONTAINS));
|
|
||||||
if (attr.getLength() > 0) {
|
|
||||||
final String regex = attr.getValue(REGEX);
|
|
||||||
if (regex != null) {
|
|
||||||
pt.setRegex(Boolean.parseBoolean(regex));
|
|
||||||
}
|
|
||||||
final String caseSensitive = attr.getValue(CASE_SENSITIVE);
|
|
||||||
if (caseSensitive != null) {
|
|
||||||
pt.setCaseSensitive(Boolean.parseBoolean(caseSensitive));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rule.addFilename(pt);
|
|
||||||
} else if (VENDOR_DUPLICATING_RULE.equals(qName)) {
|
|
||||||
vendorDuplicatingHintRules.add(new VendorDuplicatingHintRule(attr.getValue(VALUE), attr.getValue(DUPLICATE)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,44 +35,44 @@ public class HintRule {
|
|||||||
/**
|
/**
|
||||||
* The list of file names to match.
|
* The list of file names to match.
|
||||||
*/
|
*/
|
||||||
private final List<PropertyType> filenames = new ArrayList<PropertyType>();
|
private final List<PropertyType> filenames = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* The list of vendor evidence that is being matched.
|
* The list of vendor evidence that is being matched.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> givenVendor = new ArrayList<Evidence>();
|
private final List<Evidence> givenVendor = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* The list of product evidence that is being matched.
|
* The list of product evidence that is being matched.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> givenProduct = new ArrayList<Evidence>();
|
private final List<Evidence> givenProduct = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* The list of product evidence that is being matched.
|
* The list of product evidence that is being matched.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> givenVersion = new ArrayList<Evidence>();
|
private final List<Evidence> givenVersion = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* The list of vendor hints to add.
|
* The list of vendor hints to add.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> addVendor = new ArrayList<Evidence>();
|
private final List<Evidence> addVendor = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* The list of product evidence to add.
|
* The list of product evidence to add.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> addProduct = new ArrayList<Evidence>();
|
private final List<Evidence> addProduct = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* The list of version evidence to add.
|
* The list of version evidence to add.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> addVersion = new ArrayList<Evidence>();
|
private final List<Evidence> addVersion = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of vendor hints to add.
|
* The list of vendor hints to add.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> removeVendor = new ArrayList<Evidence>();
|
private final List<Evidence> removeVendor = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* The list of product evidence to add.
|
* The list of product evidence to add.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> removeProduct = new ArrayList<Evidence>();
|
private final List<Evidence> removeProduct = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* The list of version evidence to add.
|
* The list of version evidence to add.
|
||||||
*/
|
*/
|
||||||
private final List<Evidence> removeVersion = new ArrayList<Evidence>();
|
private final List<Evidence> removeVersion = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the filename evidence to the collection.
|
* Adds the filename evidence to the collection.
|
||||||
|
|||||||
Reference in New Issue
Block a user