Skip to content

Commit

Permalink
Merge pull request #334 from dfa1/minor-cleanups
Browse files Browse the repository at this point in the history
minor fixes
  • Loading branch information
jamezp authored Apr 21, 2022
2 parents 63f7cdf + 33f8d1a commit bd47678
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 18 deletions.
6 changes: 3 additions & 3 deletions core/src/main/java/org/jboss/logmanager/AtomicArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public boolean addIfAbsent(T instance, V value, boolean identity) {
}

/**
* Atomically replace the array with a new array which does not include the first occurrance of the given value, if
* Atomically replace the array with a new array which does not include the first occurrence of the given value, if
* the value is present in the array.
*
* @param instance the instance holding the field
Expand Down Expand Up @@ -205,7 +205,7 @@ public boolean remove(T instance, V value, boolean identity) {
}

/**
* Atomically replace the array with a new array which does not include any occurrances of the given value, if
* Atomically replace the array with a new array which does not include any occurrences of the given value, if
* the value is present in the array.
*
* @param instance the instance holding the field
Expand Down Expand Up @@ -310,7 +310,7 @@ public boolean addIfAbsent(T instance, V value, Comparator<? super V> comparator
}

/**
* Remove a value to a sorted array. Does not check for duplicates. If there are multiple occurrances of a value,
* Remove a value to a sorted array. Does not check for duplicates. If there are multiple occurrences of a value,
* there is no guarantee as to which one is removed.
*
* @param instance the instance holding the field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.Permission;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public final class SubstituteFilter implements Filter {
*
* @param pattern the pattern to match
* @param replacement the string replacement
* @param replaceAll {@code true} if all occurrances should be replaced; {@code false} if only the first occurrance
* @param replaceAll {@code true} if all occurrences should be replaced; {@code false} if only the first occurrence
*/
public SubstituteFilter(final Pattern pattern, final String replacement, final boolean replaceAll) {
this.pattern = pattern;
Expand All @@ -56,7 +56,7 @@ public SubstituteFilter(final Pattern pattern, final String replacement, final b
*
* @param patternString the pattern to match
* @param replacement the string replacement
* @param replaceAll {@code true} if all occurrances should be replaced; {@code false} if only the first occurrance
* @param replaceAll {@code true} if all occurrences should be replaced; {@code false} if only the first occurrence
*/
public SubstituteFilter(final String patternString, final String replacement, final boolean replaceAll) {
this(Pattern.compile(patternString), replacement, replaceAll);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ public ItemType getItemType() {
public String getSegmentedSubject(final ExtLogRecord record) {
final String hostName = record.getHostName();
// Check for a specified precision. This is not passed to the constructor because we want truncate
// segments from the right intsead of the left.
// segments from the right instead of the left.
if (precision != null && PRECISION_INT_PATTERN.matcher(precision).matches()) {
int count = Integer.parseInt(precision);
int end = 0;
Expand Down
3 changes: 0 additions & 3 deletions core/src/test/java/org/jboss/logmanager/FilterTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.jboss.logmanager;

import org.jboss.logmanager.ExtLogRecord.FormatStyle;
import org.jboss.logmanager.formatters.PatternFormatter;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
Expand All @@ -35,9 +34,7 @@
import org.jboss.logmanager.filters.RegexFilter;
import org.jboss.logmanager.filters.SubstituteFilter;

import java.util.logging.ErrorManager;
import java.util.logging.Filter;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.LogRecord;

Expand Down
1 change: 0 additions & 1 deletion core/src/test/java/org/jboss/logmanager/LoggerTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Filter;
import java.util.logging.Handler;
import java.util.logging.LogRecord;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumMap;
import java.util.IdentityHashMap;
Expand Down Expand Up @@ -623,7 +622,7 @@ default Generator add(final String key, final long value) throws Exception {
* By default this processes the map and uses {@link #add(String, String)} to add entries.
* </p>
*
* @param metaData the matp of the meta data, cannot be {@code null}
* @param metaData the map of the meta data, cannot be {@code null}
*
* @return the generator
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public void run() {
addError(e);
final long timeout;
if (attempts++ > 0L) {
timeout = (10 * attempts);
timeout = (10L * attempts);
} else {
timeout = retryTimeout;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ static void compareArchiveContents(final Path archive1, final Path archive2, fin
lines1 = readAllLinesFromZip(archive1, expectedFileName);
lines2 = readAllLinesFromZip(archive2, expectedFileName);
} else if (archive1.getFileName().toString().endsWith(".gz")) {
lines1 = readAllLinesFromGzip(archive1, expectedFileName);
lines2 = readAllLinesFromGzip(archive2, expectedFileName);
lines1 = readAllLinesFromGzip(archive1);
lines2 = readAllLinesFromGzip(archive2);
} else {
Assert.fail(String.format("Files %s and %s are not archives.", archive1, archive2));
}
Expand Down Expand Up @@ -211,7 +211,7 @@ private static Collection<String> readAllLinesFromZip(final Path path, final Str
}
}

private static Collection<String> readAllLinesFromGzip(final Path path, final String expectedFileName) throws IOException {
private static Collection<String> readAllLinesFromGzip(final Path path) throws IOException {
final Collection<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(Files.newInputStream(path))))) {
String line;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private SocketHandler createHandler(final Protocol protocol) throws UnsupportedE

private static <R> R timeout(final Supplier<R> supplier, final int timeout) throws InterruptedException {
R value = null;
long t = timeout * 1000;
long t = timeout * 1000L;
final long sleep = 100L;
while (t > 0) {
final long before = System.currentTimeMillis();
Expand Down

0 comments on commit bd47678

Please sign in to comment.