From 11163c437f46824c798dfd86787460f3bec6423e Mon Sep 17 00:00:00 2001 From: Andrei Solntsev Date: Sat, 2 Nov 2024 16:58:36 +0200 Subject: [PATCH 1/6] fix warning "Call to 'toArray()' with pre-sized array argument 'new String[normalized.size()]'" --- .../css/parser/property/PrimitivePropertyBuilders.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/css/parser/property/PrimitivePropertyBuilders.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/css/parser/property/PrimitivePropertyBuilders.java index 3c8093c1f..d84c9ca1c 100644 --- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/css/parser/property/PrimitivePropertyBuilders.java +++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/css/parser/property/PrimitivePropertyBuilders.java @@ -962,7 +962,7 @@ public List buildDeclarations( String text = concat(normalized, ','); PropertyValue result = new PropertyValue( - CSSPrimitiveValue.CSS_STRING, text, text, normalized.toArray(new String[normalized.size()]), null); // HACK cssText can be wrong + CSSPrimitiveValue.CSS_STRING, text, text, normalized.toArray(new String[0]), null); // HACK cssText can be wrong return singletonList( new PropertyDeclaration(cssName, result, important, origin)); From 7d924daba767998990bb8ad357b94f61e7f88cbd Mon Sep 17 00:00:00 2001 From: Andrei Solntsev Date: Sat, 2 Nov 2024 17:00:13 +0200 Subject: [PATCH 2/6] fix warning "Instantiating object to get Class object" --- .../java/org/xhtmlrenderer/demo/browser/BrowserPanel.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flying-saucer-examples/src/main/java/org/xhtmlrenderer/demo/browser/BrowserPanel.java b/flying-saucer-examples/src/main/java/org/xhtmlrenderer/demo/browser/BrowserPanel.java index 0f652f1a7..bb8bd53fc 100755 --- a/flying-saucer-examples/src/main/java/org/xhtmlrenderer/demo/browser/BrowserPanel.java +++ b/flying-saucer-examples/src/main/java/org/xhtmlrenderer/demo/browser/BrowserPanel.java @@ -52,6 +52,8 @@ import java.util.logging.Level; import java.util.logging.Logger; +import static java.util.Objects.requireNonNull; + public final class BrowserPanel extends JPanel implements DocumentListener { private static final org.slf4j.Logger log = LoggerFactory.getLogger(BrowserPanel.class); private static final Logger logger = Logger.getLogger("app.browser"); @@ -145,7 +147,7 @@ private void loadCustomFonts() { SharedContext rc = view.getSharedContext(); try { rc.setFontMapping("Fuzz", Font.createFont(Font.TRUETYPE_FONT, - new DemoMarker().getClass().getResourceAsStream("/demos/fonts/fuzz.ttf"))); + requireNonNull(DemoMarker.class.getResourceAsStream("/demos/fonts/fuzz.ttf")))); } catch (Exception ex) { Uu.p(ex); } From a0c69d4af714b9a62264110769f4e162b2697625 Mon Sep 17 00:00:00 2001 From: Andrei Solntsev Date: Sat, 2 Nov 2024 17:04:12 +0200 Subject: [PATCH 3/6] disable warning "Optional.get() is called without isPresent() check" in tests --- .idea/inspectionProfiles/Project_Default.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index a209b6ae6..0aeb6c70e 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -44,6 +44,9 @@