Skip to content

Commit

Permalink
Update deprecated api usage
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsteiner1984 committed Oct 10, 2024
1 parent 890cbb3 commit 5dbd31f
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ protected static IOFileFilter getDirectoryFilter() {
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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void setUp() throws Exception {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void doTest(InputStream inStream, URI fopConf, String expectedEventID, St
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testFlowNamedNotMapped() throws Exception {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private CommonFont makeCommonFont() throws PropertyException {
@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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public void testParserToPDF() throws Exception {
out = new FileOutputStream(tgtFile);
out = new BufferedOutputStream(out);
} else {
out = NullOutputStream.NULL_OUTPUT_STREAM;
out = NullOutputStream.INSTANCE;
}
try {
Source src = new DOMSource(intermediate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void eatMemory(int callIndex, File foFile, int replicatorRepeats, FopFac
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@ public void testFOEventHandlerLevel() throws Exception {

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
Expand All @@ -139,7 +139,7 @@ public void testFOEventHandlerLevel() throws Exception {
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public void execute() throws Exception {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void runBatch(Configuration cfg) {
manualFilter = manualFilter + '*';
}
filter = new AndFileFilter(
new WildcardFileFilter(manualFilter), filter);
WildcardFileFilter.builder().setWildcards(manualFilter).get(), filter);
}

int maxfiles = cfg.getChild("max-files").getValueAsInteger(-1);
Expand Down

0 comments on commit 5dbd31f

Please sign in to comment.