Skip to content

Commit

Permalink
- cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
benhur1999 committed Jan 10, 2022
1 parent be19a84 commit 0091fca
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public List<SRUQueryParser<?>> getQueryParsers() {
* Builder for creating {@link SRUQueryParserRegistry} instances.
*/
public static class Builder {
private final List<SRUQueryParser<?>> parsers =
new ArrayList<SRUQueryParser<?>>();
private final List<SRUQueryParser<?>> parsers = new ArrayList<>();


/**
Expand All @@ -95,7 +94,7 @@ public Builder(boolean registerDefaults) {


/**
* Constructor. Automaticaly registers registers SRU/CQL standard query
* Constructor. Automatically registers registers SRU/CQL standard query
* parsers (queryType <em>cql</em> and <em>searchTerms</em>).
*/
public Builder() {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/eu/clarin/sru/server/SRURequestImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ private boolean checkParameters2() {
* QueryParser implementation
*/
final Map<String, String> queryParameters =
new HashMap<String, String>();
new HashMap<>();
List<String> missingParameter = null;
for (String name : queryParser.getQueryParameterNames()) {
parameterNames.remove(name);
Expand All @@ -626,7 +626,7 @@ private boolean checkParameters2() {
queryParameters.put(name, value);
} else {
if (missingParameter == null) {
missingParameter = new ArrayList<String>();
missingParameter = new ArrayList<>();
}
missingParameter.add(name);
}
Expand Down Expand Up @@ -1008,7 +1008,7 @@ public List<String> getExtraRequestDataNames() {
String name = (String) i.nextElement();
if (name.startsWith(PARAM_EXTENSION_PREFIX)) {
if (result == null) {
result = new ArrayList<String>();
result = new ArrayList<>();
}
result.add(name);
}
Expand Down Expand Up @@ -1051,14 +1051,14 @@ public void addDiagnostic(String uri, String details, String message) {

private void addDiagnostic(SRUDiagnostic diagnostic) {
if (diagnostics == null) {
diagnostics = new ArrayList<SRUDiagnostic>();
diagnostics = new ArrayList<>();
}
diagnostics.add(diagnostic);
}


private List<String> getParameterNames() {
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
for (Enumeration<?> i = request.getParameterNames();
i.hasMoreElements();) {
String name = (String) i.nextElement();
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/eu/clarin/sru/server/SRUServerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ private static IndexInfo buildIndexInfo(XPath xpath, Document doc)
XPathExpression expr = xpath.compile("//sru:indexInfo/sru:set");
NodeList result = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
if (result.getLength() > 0) {
sets = new ArrayList<IndexInfo.Set>(result.getLength());
sets = new ArrayList<>(result.getLength());
for (int i = 0; i < result.getLength(); i++) {
Element e = (Element) result.item(i);
String identifier = e.getAttribute("identifier");
Expand All @@ -1257,7 +1257,7 @@ private static IndexInfo buildIndexInfo(XPath xpath, Document doc)
expr = xpath.compile("//sru:indexInfo/sru:index");
result = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
if (result.getLength() > 0) {
indexes = new ArrayList<IndexInfo.Index>(result.getLength());
indexes = new ArrayList<>(result.getLength());
for (int i = 0; i < result.getLength(); i++) {
Element e = (Element) result.item(i);
List<LocalizedString> title =
Expand All @@ -1268,7 +1268,7 @@ private static IndexInfo buildIndexInfo(XPath xpath, Document doc)
List<IndexInfo.Index.Map> maps = null;
NodeList result2 = e.getElementsByTagName("map");
if ((result2 != null) && (result2.getLength() > 0)) {
maps = new ArrayList<IndexInfo.Index.Map>(
maps = new ArrayList<>(
result2.getLength());
boolean foundPrimary = false;
for (int j = 0; j < result2.getLength(); j++) {
Expand Down Expand Up @@ -1331,7 +1331,7 @@ private static List<SchemaInfo> buildSchemaInfo(XPath xpath, Document doc)
XPathExpression expr = xpath.compile("//sru:schemaInfo/sru:schema");
NodeList result = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
if (result.getLength() > 0) {
schemaInfos = new ArrayList<SchemaInfo>(result.getLength());
schemaInfos = new ArrayList<>(result.getLength());
for (int i = 0; i < result.getLength(); i++) {
Element e = (Element) result.item(i);
String identifier = e.getAttribute("identifier");
Expand Down Expand Up @@ -1376,7 +1376,7 @@ private static List<LocalizedString> fromNodeList(NodeList nodes)
throws SRUConfigException {
List<LocalizedString> list = null;
if (nodes.getLength() > 0) {
list = new ArrayList<LocalizedString>(nodes.getLength());
list = new ArrayList<>(nodes.getLength());
boolean foundPrimary = false;
for (int i = 0; i < nodes.getLength(); i++) {
Element e = (Element) nodes.item(i);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/clarin/sru/server/SRUXMLStreamWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void write(String s, int off, int len) throws IOException {
if (indent > 0) {
this.indent = indent;
this.state = IndentingState.SEEN_NOTHING;
this.stateStack = new ArrayDeque<IndentingState>(16);
this.stateStack = new ArrayDeque<>(16);
}
}

Expand Down

0 comments on commit 0091fca

Please sign in to comment.