From: Simon Steiner Date: Thu, 10 Oct 2024 09:49:24 +0000 (+0100) Subject: Update deprecated api usage X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5dbd31f18f7b6681639ac72b739fd2a8b8cfcf11;p=xmlgraphics-fop.git Update deprecated api usage --- 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 e6b9a2c9e..11b18ef34 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 @@ -84,10 +84,8 @@ public class FontFileFinder extends DirectoryWalker implements FontFinder { protected static IOFileFilter getFileFilter() { return FileFilterUtils.and( FileFilterUtils.fileFileFilter(), - new WildcardFileFilter( - new String[] {"*.ttf", "*.otf", "*.pfb", "*.ttc"}, - IOCase.INSENSITIVE) - ); + WildcardFileFilter.builder().setIoCase(IOCase.INSENSITIVE) + .setWildcards("*.ttf", "*.otf", "*.pfb", "*.ttc").get()); } /** 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 02551c8da..7a95300fa 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, NullOutputStream.NULL_OUTPUT_STREAM); + fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.INSTANCE); } @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 778837104..0addf16dc 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, NullOutputStream.NULL_OUTPUT_STREAM); + Fop fop = fopFactory.newFop(mimeType, userAgent, NullOutputStream.INSTANCE); 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 12d23dac3..3e6ba3aaf 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, NullOutputStream.NULL_OUTPUT_STREAM); + fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.INSTANCE); 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/fonts/FontSelectorTestCase.java b/fop-core/src/test/java/org/apache/fop/fonts/FontSelectorTestCase.java index 10c907296..90671d59d 100644 --- a/fop-core/src/test/java/org/apache/fop/fonts/FontSelectorTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/fonts/FontSelectorTestCase.java @@ -148,7 +148,7 @@ public class FontSelectorTestCase { @Test public void testFontCacheWithThreads() throws Exception { PrintStream old = System.err; - System.setErr(new NullPrintStream()); + System.setErr(NullPrintStream.INSTANCE); ExecutorService executor = Executors.newFixedThreadPool(10); for (int i = 0; i < 100000; i++) { executor.submit(new FontTask()); 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 35b84be48..598bcfbb4 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 = NullOutputStream.NULL_OUTPUT_STREAM; + out = NullOutputStream.INSTANCE; } 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 788b101b8..428f53eac 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 = NullOutputStream.NULL_OUTPUT_STREAM; //write to /dev/nul + OutputStream out = NullOutputStream.INSTANCE; //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 c2597ad7e..90afb97cd 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, NullOutputStream.NULL_OUTPUT_STREAM); + ua, MimeConstants.MIME_PDF, NullOutputStream.INSTANCE); assertTrue(foEventHandler instanceof AreaTreeHandler); ua = fopFactory.newFOUserAgent(); foEventHandler = factory.createFOEventHandler( - ua, MimeConstants.MIME_RTF, NullOutputStream.NULL_OUTPUT_STREAM); + ua, MimeConstants.MIME_RTF, NullOutputStream.INSTANCE); assertTrue(foEventHandler instanceof RTFHandler); ua = fopFactory.newFOUserAgent(); try { foEventHandler = factory.createFOEventHandler( - ua, "invalid/format", NullOutputStream.NULL_OUTPUT_STREAM); + ua, "invalid/format", NullOutputStream.INSTANCE); fail("Expected UnsupportedOperationException"); } catch (UnsupportedOperationException uoe) { //expected @@ -139,7 +139,7 @@ public class RendererFactoryTestCase { } ua = fopFactory.newFOUserAgent(); - overrideFOEventHandler = new RTFHandler(ua, NullOutputStream.NULL_OUTPUT_STREAM); + overrideFOEventHandler = new RTFHandler(ua, NullOutputStream.INSTANCE); ua.setFOEventHandlerOverride(overrideFOEventHandler); foEventHandler = factory.createFOEventHandler( ua, null, null); 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 bfc341920..5dc87d9c1 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 = NullOutputStream.NULL_OUTPUT_STREAM; + out = NullOutputStream.INSTANCE; } else { out = new java.io.FileOutputStream(outfile); out = new java.io.BufferedOutputStream(out); diff --git a/fop-core/src/test/java/org/apache/fop/visual/BatchDiffer.java b/fop-core/src/test/java/org/apache/fop/visual/BatchDiffer.java index c9a2d477e..8a4b44b7a 100644 --- a/fop-core/src/test/java/org/apache/fop/visual/BatchDiffer.java +++ b/fop-core/src/test/java/org/apache/fop/visual/BatchDiffer.java @@ -175,7 +175,7 @@ public class BatchDiffer { manualFilter = manualFilter + '*'; } filter = new AndFileFilter( - new WildcardFileFilter(manualFilter), filter); + WildcardFileFilter.builder().setWildcards(manualFilter).get(), filter); } int maxfiles = cfg.getChild("max-files").getValueAsInteger(-1);