This is an automated email from the ASF dual-hosted git repository. tilman pushed a commit to branch branch_2x in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/branch_2x by this push: new 37adc5b4f TIKA-4290: replace deprecated 37adc5b4f is described below commit 37adc5b4f61d3de94ae6a08ddf7a4541168a5988 Author: Tilman Hausherr <til...@apache.org> AuthorDate: Mon Aug 12 15:42:24 2024 +0200 TIKA-4290: replace deprecated --- .../java/org/apache/tika/parser/isatab/ISArchiveParser.java | 10 ++++++---- .../html/charsetdetector/StandardHtmlEncodingDetector.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/isatab/ISArchiveParser.java b/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/isatab/ISArchiveParser.java index 7fd6f39c0..6c7975f82 100644 --- a/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/isatab/ISArchiveParser.java +++ b/tika-parsers/tika-parsers-extended/tika-parser-scientific-module/src/main/java/org/apache/tika/parser/isatab/ISArchiveParser.java @@ -116,7 +116,7 @@ public class ISArchiveParser implements Parser { } String investigation = investigationList[0]; // TODO add to metadata? - try (InputStream stream = TikaInputStream.get(new File(this.location + investigation))) { + try (InputStream stream = TikaInputStream.get(new File(this.location + investigation).toPath())) { ISATabUtils.parseInvestigation(stream, xhtml, metadata, context, this.studyFileName); } xhtml.element("h1", "INVESTIGATION " + metadata.get("Investigation Identifier")); @@ -134,9 +134,11 @@ public class ISArchiveParser implements Parser { for (String assayFileName : metadata.getValues(studyAssayFileNameField)) { xhtml.startElement("div"); xhtml.element("h3", "ASSAY " + assayFileName); - InputStream stream = TikaInputStream.get(new File(this.location + assayFileName)); - ISATabUtils.parseAssay(stream, xhtml, metadata, context); - stream.close(); + // location starts with "/C:" on windows, can't use Paths.get() + try (InputStream stream = TikaInputStream.get(new File(this.location + assayFileName).toPath())) + { + ISATabUtils.parseAssay(stream, xhtml, metadata, context); + } xhtml.endElement("div"); } } diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/charsetdetector/StandardHtmlEncodingDetector.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/charsetdetector/StandardHtmlEncodingDetector.java index 53c89f1f2..90af81e18 100644 --- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/charsetdetector/StandardHtmlEncodingDetector.java +++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-html-module/src/main/java/org/apache/tika/parser/html/charsetdetector/StandardHtmlEncodingDetector.java @@ -78,7 +78,7 @@ public final class StandardHtmlEncodingDetector implements EncodingDetector { int limit = getMarkLimit(); input.mark(limit); // Never read more than the first META_TAG_BUFFER_SIZE bytes - InputStream limitedStream = new BoundedInputStream(input, limit); + InputStream limitedStream = BoundedInputStream.builder().setInputStream(input).setMaxCount(limit).get(); PreScanner preScanner = new PreScanner(limitedStream); // The order of priority for detection is: