# HG changeset patch # User prappo # Date 1509993060 -10800 # Node ID 4ecfe77d0c24dbde89f3423ffc2d2d2956251022 # Parent 2136ad3694e4f5e39135745ed54322d9877f04bd http-client-branch: fixing sloppy merge in HPACK diff -r 2136ad3694e4 -r 4ecfe77d0c24 src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HPACK.java --- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HPACK.java Mon Nov 06 13:06:34 2017 +0000 +++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HPACK.java Mon Nov 06 21:31:00 2017 +0300 @@ -61,11 +61,11 @@ Level l = logLevels.get(upperCasedValue); if (l == null) { LOGGER = new RootLogger(NONE); - LOGGER.log(() -> format("%s value '%s' is not recognized (use %s), logging is disabled", + LOGGER.log(() -> format("%s value '%s' not recognized (use %s); logging disabled", PROPERTY, value, logLevels.keySet().stream().collect(joining(", ")))); } else { LOGGER = new RootLogger(l); - LOGGER.log(() -> format("logging level is %s", l)); + LOGGER.log(() -> format("logging level %s", l)); } } } @@ -151,6 +151,8 @@ private static final class RootLogger extends Logger { private final Level level; + @Stable + private final Logger[] path = { this }; protected RootLogger(Level level) { super(new Logger[]{ }, "hpack"); @@ -163,20 +165,29 @@ } @Override + public void log(Level level, Supplier s) { + log(path, level, s); + } + + @Override protected void log(Logger[] path, Level level, Supplier s) { if (this.level.implies(level)) { - StringBuilder b = new StringBuilder(); - for (Logger p : path) { - b.append('/').append(p.getName()); - } - System.out.println(b.toString() + ' ' + s.get()); + log(path, s); } } public void log(Supplier s) { - System.out.println(getName() + ' ' + s.get()); + log(path, s); + } + + private void log(Logger[] path, Supplier s) { + StringBuilder b = new StringBuilder(); + for (Logger p : path) { + b.append('/').append(p.getName()); + } + System.out.println(b.toString() + ' ' + s.get()); } } } diff -r 2136ad3694e4 -r 4ecfe77d0c24 src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HeaderTable.java --- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HeaderTable.java Mon Nov 06 13:06:34 2017 +0000 +++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/HeaderTable.java Mon Nov 06 21:31:00 2017 +0300 @@ -304,7 +304,7 @@ StringBuilder b = new StringBuilder(); for (int i = 1, size = dynamicTable.size(); i <= size; i++) { HeaderField e = dynamicTable.get(i); - b.append(format("[%3d] (s = %3d) %s: %s%n", i, + b.append(format("[%3d] (s = %3d) %s: %s\n", i, sizeOf(e), e.name, e.value)); } b.append(format(" Table size:%4s", this.size)); diff -r 2136ad3694e4 -r 4ecfe77d0c24 test/jdk/java/net/httpclient/http2/jdk.incubator.httpclient/jdk/incubator/http/internal/hpack/HeaderTableTest.java --- a/test/jdk/java/net/httpclient/http2/jdk.incubator.httpclient/jdk/incubator/http/internal/hpack/HeaderTableTest.java Mon Nov 06 13:06:34 2017 +0000 +++ b/test/jdk/java/net/httpclient/http2/jdk.incubator.httpclient/jdk/incubator/http/internal/hpack/HeaderTableTest.java Mon Nov 06 21:31:00 2017 +0300 @@ -326,10 +326,15 @@ @Test public void testToStringDifferentLocale() { + Locale locale = Locale.getDefault(); Locale.setDefault(Locale.FRENCH); - String s = format("%.1f", 3.1); - assertEquals("3,1", s); // assumption of the test, otherwise the test is useless - testToString0(); + try { + String s = format("%.1f", 3.1); + assertEquals("3,1", s); // assumption of the test, otherwise the test is useless + testToString0(); + } finally { + Locale.setDefault(locale); + } } private void testToString0() {