From 823f3202d07224ad16231cc673b715af63310560 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Thu, 3 Feb 2022 15:00:46 +0000 Subject: [PATCH] Fix compile warnings git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1897728 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/fonts/autodetect/FontFileFinder.java | 4 ++-- .../accessibility/pdf/MissingLanguageWarningTestCase.java | 2 +- .../org/apache/fop/events/EventProcessingTestCase.java | 2 +- .../org/apache/fop/events/FlowNamedNotMappedTestCase.java | 2 +- .../apache/fop/intermediate/AbstractIntermediateTest.java | 2 +- .../src/test/java/org/apache/fop/memory/MemoryEater.java | 2 +- .../org/apache/fop/render/RendererFactoryTestCase.java | 8 ++++---- .../org/apache/fop/render/ps/ImageHandlingTestCase.java | 2 +- .../org/apache/fop/render/ps/svg/GradientTestCase.java | 2 +- .../test/java/org/apache/fop/threading/FOPTestbed.java | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fop-core/src/main/java/org/apache/fop/fonts/autodetect/FontFileFinder.java b/fop-core/src/main/java/org/apache/fop/fonts/autodetect/FontFileFinder.java index 8100c4b9b..e6b9a2c9e 100644 --- a/fop-core/src/main/java/org/apache/fop/fonts/autodetect/FontFileFinder.java +++ b/fop-core/src/main/java/org/apache/fop/fonts/autodetect/FontFileFinder.java @@ -71,7 +71,7 @@ public class FontFileFinder extends DirectoryWalker implements FontFinder { * @return IOFileFilter font directory filter */ protected static IOFileFilter getDirectoryFilter() { - return FileFilterUtils.andFileFilter( + return FileFilterUtils.and( FileFilterUtils.directoryFileFilter(), FileFilterUtils.notFileFilter(FileFilterUtils.prefixFileFilter(".")) ); @@ -82,7 +82,7 @@ public class FontFileFinder extends DirectoryWalker implements FontFinder { * @return IOFileFilter font file filter */ protected static IOFileFilter getFileFilter() { - return FileFilterUtils.andFileFilter( + return FileFilterUtils.and( FileFilterUtils.fileFileFilter(), new WildcardFileFilter( new String[] {"*.ttf", "*.otf", "*.pfb", "*.ttc"}, diff --git a/fop-core/src/test/java/org/apache/fop/accessibility/pdf/MissingLanguageWarningTestCase.java b/fop-core/src/test/java/org/apache/fop/accessibility/pdf/MissingLanguageWarningTestCase.java index c5d161194..97383e9e2 100644 --- a/fop-core/src/test/java/org/apache/fop/accessibility/pdf/MissingLanguageWarningTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/accessibility/pdf/MissingLanguageWarningTestCase.java @@ -79,7 +79,7 @@ public class MissingLanguageWarningTestCase { userAgent.setAccessibility(true); eventChecker = new MissingLanguageEventChecker(); userAgent.getEventBroadcaster().addEventListener(eventChecker); - fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new NullOutputStream()); + fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.NULL_OUTPUT_STREAM); } @Test diff --git a/fop-core/src/test/java/org/apache/fop/events/EventProcessingTestCase.java b/fop-core/src/test/java/org/apache/fop/events/EventProcessingTestCase.java index 5e96883ec..778837104 100644 --- a/fop-core/src/test/java/org/apache/fop/events/EventProcessingTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/events/EventProcessingTestCase.java @@ -79,7 +79,7 @@ public class EventProcessingTestCase { FOUserAgent userAgent = fopFactory.newFOUserAgent(); userAgent.getEventBroadcaster().addEventListener(eventChecker); - Fop fop = fopFactory.newFop(mimeType, userAgent, new NullOutputStream()); + Fop fop = fopFactory.newFop(mimeType, userAgent, NullOutputStream.NULL_OUTPUT_STREAM); Transformer transformer = tFactory.newTransformer(); Source src = new StreamSource(inStream); Result res = new SAXResult(fop.getDefaultHandler()); diff --git a/fop-core/src/test/java/org/apache/fop/events/FlowNamedNotMappedTestCase.java b/fop-core/src/test/java/org/apache/fop/events/FlowNamedNotMappedTestCase.java index 802c97450..12d23dac3 100644 --- a/fop-core/src/test/java/org/apache/fop/events/FlowNamedNotMappedTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/events/FlowNamedNotMappedTestCase.java @@ -64,7 +64,7 @@ public class FlowNamedNotMappedTestCase { FOUserAgent userAgent = fopFactory.newFOUserAgent(); flowChecker = new FlowNameNotMappedEventChecker(); userAgent.getEventBroadcaster().addEventListener(flowChecker); - fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new NullOutputStream()); + fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.NULL_OUTPUT_STREAM); Source src = new StreamSource(new FileInputStream("test/events/flowNameNotMapped.fo")); SAXResult res = new SAXResult(fop.getDefaultHandler()); Transformer transformer = TransformerFactory.newInstance().newTransformer(); diff --git a/fop-core/src/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java b/fop-core/src/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java index 1ebf69866..35b84be48 100644 --- a/fop-core/src/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java +++ b/fop-core/src/test/java/org/apache/fop/intermediate/AbstractIntermediateTest.java @@ -192,7 +192,7 @@ public abstract class AbstractIntermediateTest { out = new FileOutputStream(tgtFile); out = new BufferedOutputStream(out); } else { - out = new NullOutputStream(); + out = NullOutputStream.NULL_OUTPUT_STREAM; } try { Source src = new DOMSource(intermediate); diff --git a/fop-core/src/test/java/org/apache/fop/memory/MemoryEater.java b/fop-core/src/test/java/org/apache/fop/memory/MemoryEater.java index 537003b6e..788b101b8 100644 --- a/fop-core/src/test/java/org/apache/fop/memory/MemoryEater.java +++ b/fop-core/src/test/java/org/apache/fop/memory/MemoryEater.java @@ -77,7 +77,7 @@ public final class MemoryEater { Transformer transformer = replicatorTemplates.newTransformer(); transformer.setParameter("repeats", replicatorRepeats); - OutputStream out = new NullOutputStream(); //write to /dev/nul + OutputStream out = NullOutputStream.NULL_OUTPUT_STREAM; //write to /dev/nul try { FOUserAgent userAgent = fopFactory.newFOUserAgent(); Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out); diff --git a/fop-core/src/test/java/org/apache/fop/render/RendererFactoryTestCase.java b/fop-core/src/test/java/org/apache/fop/render/RendererFactoryTestCase.java index 1fa4ae0fa..c2597ad7e 100644 --- a/fop-core/src/test/java/org/apache/fop/render/RendererFactoryTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/render/RendererFactoryTestCase.java @@ -112,18 +112,18 @@ public class RendererFactoryTestCase { ua = fopFactory.newFOUserAgent(); foEventHandler = factory.createFOEventHandler( - ua, MimeConstants.MIME_PDF, new NullOutputStream()); + ua, MimeConstants.MIME_PDF, NullOutputStream.NULL_OUTPUT_STREAM); assertTrue(foEventHandler instanceof AreaTreeHandler); ua = fopFactory.newFOUserAgent(); foEventHandler = factory.createFOEventHandler( - ua, MimeConstants.MIME_RTF, new NullOutputStream()); + ua, MimeConstants.MIME_RTF, NullOutputStream.NULL_OUTPUT_STREAM); assertTrue(foEventHandler instanceof RTFHandler); ua = fopFactory.newFOUserAgent(); try { foEventHandler = factory.createFOEventHandler( - ua, "invalid/format", new NullOutputStream()); + ua, "invalid/format", NullOutputStream.NULL_OUTPUT_STREAM); fail("Expected UnsupportedOperationException"); } catch (UnsupportedOperationException uoe) { //expected @@ -139,7 +139,7 @@ public class RendererFactoryTestCase { } ua = fopFactory.newFOUserAgent(); - overrideFOEventHandler = new RTFHandler(ua, new NullOutputStream()); + overrideFOEventHandler = new RTFHandler(ua, NullOutputStream.NULL_OUTPUT_STREAM); ua.setFOEventHandlerOverride(overrideFOEventHandler); foEventHandler = factory.createFOEventHandler( ua, null, null); diff --git a/fop-core/src/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java b/fop-core/src/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java index 3c05e9ad7..c8baf8ad7 100644 --- a/fop-core/src/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java @@ -184,7 +184,7 @@ public class ImageHandlingTestCase extends AbstractPostScriptTest { + "rotate=\"30 30 0 15\">Hello SVG with FOP\n" + ""; SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(null); - Document doc = factory.createDocument(null, IOUtils.toInputStream(svg)); + Document doc = factory.createDocument(null, IOUtils.toInputStream(svg, "utf-8")); ByteArrayOutputStream bos = new ByteArrayOutputStream(); new PSImageHandlerSVG().handleImage( new PSRenderingContext(ua, new PSGenerator(bos), new FontInfo()), diff --git a/fop-core/src/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java b/fop-core/src/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java index 35b3bc9b7..80e40dbfd 100644 --- a/fop-core/src/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/render/ps/svg/GradientTestCase.java @@ -68,7 +68,7 @@ public class GradientTestCase { svgGraphics2D.setGraphicContext(new GraphicContext()); svgGraphics2D.translate(100, 100); svgGraphics2D.applyPaint(gradient, true); - String expected = IOUtils.toString(getClass().getResourceAsStream(expectedResourceName)); + String expected = IOUtils.toString(getClass().getResourceAsStream(expectedResourceName), "utf-8"); assertEquals(expected.replace("\r", ""), out.toString()); } diff --git a/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java b/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java index 7f6319ba8..bfc341920 100644 --- a/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java +++ b/fop-core/src/test/java/org/apache/fop/threading/FOPTestbed.java @@ -266,7 +266,7 @@ public class FOPTestbed File outfile = new File(outputDir, df.format(num) + fop.getTargetFileExtension()); OutputStream out; if (writeToDevNull) { - out = new NullOutputStream(); + out = NullOutputStream.NULL_OUTPUT_STREAM; } else { out = new java.io.FileOutputStream(outfile); out = new java.io.BufferedOutputStream(out); -- 2.39.5