Skip to content

Commit

Permalink
Minor cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
essiembre committed May 6, 2023
1 parent 7397cad commit 62e4ab5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/norconex/commons/lang/map/Properties.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
import org.apache.commons.text.translate.UnicodeEscaper;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.norconex.commons.lang.EqualsUtil;
import com.norconex.commons.lang.bean.BeanException;
Expand All @@ -69,6 +67,8 @@
import com.norconex.commons.lang.convert.GenericConverter;
import com.norconex.commons.lang.text.TextMatcher;

import lombok.extern.slf4j.Slf4j;

/**
* <p>This class is a enhanced version of {@link java.util.Properties}
* that enforces the use of String keys and values internally, but offers many
Expand Down Expand Up @@ -99,6 +99,7 @@
* <p>Upon encountering a problem in parsing a value to
* its desired type, a {@link PropertiesException} is thrown.</p>
*/
@Slf4j
public class Properties extends ObservableMap<String, List<String>>
implements Serializable {

Expand All @@ -114,7 +115,6 @@ public class Properties extends ObservableMap<String, List<String>>
// entered (to know which case-version to use).

private static final long serialVersionUID = -7215126924574341L;
private static final Logger LOG = LoggerFactory.getLogger(Properties.class);

//MAYBE still support this?
private final boolean caseInsensitiveKeys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.function.Predicate;

Expand Down Expand Up @@ -62,10 +61,10 @@ public boolean addAll(Collection<? extends PropertyMatcher> matchers) {
* @return how many matchers were removed
*/
public synchronized int remove(String field) {
Iterator<PropertyMatcher> it = iterator();
int count = 0;
var it = iterator();
var count = 0;
while (it.hasNext()) {
PropertyMatcher m = it.next();
var m = it.next();
if (m.getFieldMatcher().matches(field)) {
it.remove();
count++;
Expand Down Expand Up @@ -116,12 +115,12 @@ public boolean test(Properties properties) {
* @see #test(Properties)
*/
public Properties match(Properties properties) {
Properties props = new Properties();
var props = new Properties();
if (properties == null) {
return props;
}
for (PropertyMatcher matcher : this) {
Properties matches = matcher.match(properties);
var matches = matcher.match(properties);
if (!matches.isEmpty()) {
props.putAll(matches);
}
Expand All @@ -139,12 +138,12 @@ public Properties match(Properties properties) {
* @return properties that were replaced with their original values
*/
public Properties replace(Properties properties, String replacement) {
Properties props = new Properties();
var props = new Properties();
if (properties == null) {
return props;
}
for (PropertyMatcher matcher : this) {
Properties replaced = matcher.replace(properties, replacement);
var replaced = matcher.replace(properties, replacement);
if (!replaced.isEmpty()) {
props.putAll(replaced);
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/norconex/commons/lang/xml/XML.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ public XML create() {
"$1$2 xml:space=\"empty\" $3$4");
Element node = null;
try {
documentBuilderFactory.setNamespaceAware(false);
node = documentBuilderFactory.newDocumentBuilder()
.parse(new InputSource(new StringReader(xmlStr)))
.getDocumentElement();
Expand Down

0 comments on commit 62e4ab5

Please sign in to comment.