This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit c2160db20e5e9a02aba3ae5acab2c357e3e0ae3b Author: Martin Desruisseaux <[email protected]> AuthorDate: Sat Oct 11 17:24:23 2025 +0200 Remove an OS-specific code, and minor cleanup. --- .../org/apache/sis/buildtools/coding/ReorganizeImports.java | 1 + .../apache/sis/coverage/grid/ResampledGridCoverageTest.java | 3 ++- .../main/org/apache/sis/util/logging/MonolineFormatter.java | 13 ++----------- .../org/apache/sis/util/logging/MonolineFormatterTest.java | 10 ++++++---- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/buildSrc/src/main/java/org/apache/sis/buildtools/coding/ReorganizeImports.java b/buildSrc/src/main/java/org/apache/sis/buildtools/coding/ReorganizeImports.java index 1f9ebc2c51..bd78f28389 100644 --- a/buildSrc/src/main/java/org/apache/sis/buildtools/coding/ReorganizeImports.java +++ b/buildSrc/src/main/java/org/apache/sis/buildtools/coding/ReorganizeImports.java @@ -150,6 +150,7 @@ public final class ReorganizeImports extends SimpleFileVisitor<Path> { "org.junit", "org.opentest4j", "org.opengis.test", + "org.apache.sis.metadata.TreeTableViewTest", "org.apache.sis.referencing.cs.HardCodedAxes", "org.apache.sis.referencing.cs.HardCodedCS", "org.apache.sis.referencing.crs.HardCodedCRS", diff --git a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/coverage/grid/ResampledGridCoverageTest.java b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/coverage/grid/ResampledGridCoverageTest.java index 815ee1ff17..8771f50569 100644 --- a/endorsed/src/org.apache.sis.feature/test/org/apache/sis/coverage/grid/ResampledGridCoverageTest.java +++ b/endorsed/src/org.apache.sis.feature/test/org/apache/sis/coverage/grid/ResampledGridCoverageTest.java @@ -75,6 +75,7 @@ import static org.opengis.test.Assertions.assertAxisDirectionsEqual; * @author Alexis Manin (Geomatys) * @author Johann Sorel (Geomatys) */ +@SuppressWarnings("exports") public final class ResampledGridCoverageTest extends TestCase { /** * The random number generator used for generating some grid coverage values. @@ -315,7 +316,7 @@ public final class ResampledGridCoverageTest extends TestCase { final GridCoverage target = processor.resample(source, targetGG); assertInstanceOf(TranslatedGridCoverage.class, target, "Expected fast path."); assertSame(targetGG, target.getGridGeometry()); - assertEnvelopeEquals(sourceGG.getEnvelope(), targetGG.getEnvelope(), 0); + assertEnvelopeEquals(sourceGG.getEnvelope(), targetGG.getEnvelope()); /* * The envelope is BOX(20 15, 80 77). Evaluate a single point inside that envelope. * The result for identical "real world" coordinates should be the same for both coverages. diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/MonolineFormatter.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/MonolineFormatter.java index 72f51579d9..da5eeeb935 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/MonolineFormatter.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/logging/MonolineFormatter.java @@ -202,12 +202,6 @@ public class MonolineFormatter extends Formatter { */ private SortedMap<Level,X364> colors; - /** - * {@code true} if the faint X.364 code is supported. - * On MacOS, faint colors produce bad output. - */ - private final boolean faintSupported; - /** * Numerical values of levels for which to apply colors in increasing order. * Computed from {@link #colors} when first needed or when the color map changes. @@ -351,7 +345,6 @@ public class MonolineFormatter extends Formatter { if (handler instanceof ConsoleHandler && X364.isAnsiSupported()) { resetLevelColors(); } - faintSupported = System.getProperty("os.name", "").contains("Mac OS"); /* * Creates the buffer and the printer. We will expand the tabulations with 4 characters. * This apply to the stack trace formatted by Throwable.printStackTrace(PrintWriter); @@ -689,7 +682,6 @@ loop: for (int i=0; ; i++) { */ @Override public String format(final LogRecord record) { - boolean faint = false; // Whether to use faint text for level < INFO. String emphasisStart = ""; // ANSI escape sequence for bold text if we use it. String emphasisEnd = ""; // ANSI escape sequence for stopping bold text if we use it. final Level level = record.getLevel(); @@ -698,7 +690,6 @@ loop: for (int i=0; ; i++) { if (colored && level.intValue() >= LEVEL_THRESHOLD.intValue()) { emphasisStart = X364.BOLD.sequence(); emphasisEnd = X364.NORMAL.sequence(); - faint = faintSupported; } buffer.setLength(header.length()); /* @@ -773,7 +764,7 @@ loop: for (int i=0; ; i++) { } writer.setLineSeparator(bodyLineSeparator); } - if (faint) { + if (colored) { buffer.append(X364.FAINT.sequence()); } final Throwable exception = record.getThrown(); @@ -826,7 +817,7 @@ loop: for (int i=0; ; i++) { buffer.setLength(length); length -= lastMargin; } while (length > 0 && length <= bodyLineSeparator.length()); - if (faint) { + if (colored) { buffer.append(X364.NORMAL.sequence()); } /* diff --git a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/logging/MonolineFormatterTest.java b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/logging/MonolineFormatterTest.java index adfd3b5e96..5e97eb7fe5 100644 --- a/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/logging/MonolineFormatterTest.java +++ b/endorsed/src/org.apache.sis.util/test/org/apache/sis/util/logging/MonolineFormatterTest.java @@ -35,16 +35,18 @@ import static org.apache.sis.test.Assertions.assertMultilinesEquals; * * @author Martin Desruisseaux (Geomatys) */ +@SuppressWarnings("exports") public final class MonolineFormatterTest extends TestCase { /** * The formatter to be tested. */ - private final MonolineFormatter formatter = new MonolineFormatter(null); + private final MonolineFormatter formatter; /** * Creates a new test case. */ public MonolineFormatterTest() { + formatter = new MonolineFormatter(null); } /** @@ -91,7 +93,7 @@ public final class MonolineFormatterTest extends TestCase { @Test @ResourceLock(Resources.LOCALE) public void testMultilines() { - final LogRecord record = new LogRecord(Level.INFO, "First line\n Indented line\nLast line\n"); + final var record = new LogRecord(Level.INFO, "First line\n Indented line\nLast line\n"); final String formatted = formatter.format(record); assertMultilinesEquals(localize(Level.INFO, "INFO\t First line\n" + @@ -105,8 +107,8 @@ public final class MonolineFormatterTest extends TestCase { @Test @ResourceLock(Resources.LOCALE) public void testException() { - final LogRecord record = new LogRecord(Level.WARNING, "An exception occured."); - final Exception exception = new Exception(); + final var record = new LogRecord(Level.WARNING, "An exception occured."); + final var exception = new Exception(); exception.setStackTrace(new StackTraceElement[] { new StackTraceElement("org.apache.sis.NonExistent", "foo", "NonExistent.java", 10), new StackTraceElement("org.junit.WhoKnows", "main", "WhoKnows.java", 20)
