Skip to content

Commit

Permalink
Refactoring, less guava, more standard JDK
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Mar 3, 2018
1 parent 4561d85 commit bd022f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
package org.openqa.selenium.logging;

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;

import java.util.Collections;
import java.util.List;
import java.util.Set;

/**
* LocalLogs instance that extracts entries from a logging handler.
*/
class HandlerBasedLocalLogs extends LocalLogs {
final LoggingHandler loggingHandler;
final Set<String> logTypesToInclude;
private final LoggingHandler loggingHandler;
private final Set<String> logTypesToInclude;

protected HandlerBasedLocalLogs(LoggingHandler loggingHandler, Set<String> logTypesToInclude) {
super();
Expand All @@ -42,11 +42,11 @@ public LogEntries get(String logType) {
loggingHandler.flush();
return new LogEntries(entries);
}
return new LogEntries(Lists.<LogEntry>newArrayList());
return new LogEntries(Collections.emptyList());
}

public Set<String> getAvailableLogTypes() {
return ImmutableSet.<String>of(LogType.CLIENT);
return ImmutableSet.of(LogType.CLIENT);
}

public void addEntry(String logType, LogEntry entry) {
Expand Down
8 changes: 3 additions & 5 deletions java/client/src/org/openqa/selenium/logging/LocalLogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@

package org.openqa.selenium.logging;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;

import java.util.Collections;
import java.util.Set;

/**
Expand All @@ -29,11 +27,11 @@ public abstract class LocalLogs implements Logs {

private static final LocalLogs NULL_LOGGER = new LocalLogs() {
public LogEntries get(String logType) {
return new LogEntries(ImmutableList.<LogEntry>of());
return new LogEntries(Collections.emptyList());
}

public Set<String> getAvailableLogTypes() {
return ImmutableSet.of();
return Collections.emptySet();
}

public void addEntry(String logType, LogEntry entry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public SessionLogs() {

public LogEntries getLogs(String logType) {
if (logType == null || !logTypeToEntriesMap.containsKey(logType)) {
return new LogEntries(Collections.<LogEntry>emptyList());
return new LogEntries(Collections.emptyList());
}
return logTypeToEntriesMap.get(logType);
}
Expand Down

0 comments on commit bd022f4

Please sign in to comment.