Skip to content

Commit

Permalink
Removed CharMatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Schönborn committed May 13, 2016
1 parent 5d238e4 commit aef72ef
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.CharMatcher;
import com.google.common.net.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -37,11 +36,12 @@
import java.util.Locale;
import java.util.Map;
import java.util.function.Predicate;
import java.util.regex.Pattern;

public final class JsonHttpLogFormatter implements HttpLogFormatter {

private static final MediaType APPLICATION_JSON = MediaType.create("application", "json");
private static final CharMatcher PRETTY_PRINT = CharMatcher.anyOf("\n\t");
private static final Pattern PRETTY_PRINT = Pattern.compile("[\n\t]");
private static final Logger LOG = LoggerFactory.getLogger(JsonHttpLogFormatter.class);

private final ObjectMapper mapper;
Expand Down Expand Up @@ -170,7 +170,7 @@ private String compactJson(final String json) throws IOException {

// this wouldn't catch spaces in json, but that's ok for our use case here
private boolean isAlreadyCompacted(final String json) {
return PRETTY_PRINT.matchesNoneOf(json);
return !PRETTY_PRINT.matcher(json).find();
}

private static final class JsonBody {
Expand Down

0 comments on commit aef72ef

Please sign in to comment.