Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public CompositeEncodingDetector(List<EncodingDetector> detectors,

public CompositeEncodingDetector(List<EncodingDetector> detectors) {
this.detectors = new LinkedList<>();
for (EncodingDetector encodingDetector : detectors) {
this.detectors.add(encodingDetector);
}
this.detectors.addAll(detectors);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,7 @@ public void embed(final Metadata metadata, final InputStream inputStream,
}
if (commandSegment.indexOf(METADATA_COMMAND_ARGUMENTS_TOKEN) != -1) {
if (hasMetadataCommandArguments) {
for (String commandMetadataSegment : commandMetadataSegments) {
cmd.add(commandMetadataSegment);
}
cmd.addAll(commandMetadataSegments);
}
replacedMetadataCommandArgumentsToken = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.tika.mime.MediaType;
import org.junit.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

Expand Down Expand Up @@ -161,10 +162,6 @@ public void testMimeClearingFilterConfig() throws Exception {
}

private static Set<String> set(String ... items) {
Set<String> set = new HashSet<>();
for (String item : items) {
set.add(item);
}
return set;
return new HashSet<>(Arrays.asList(items));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ public void parse(InputStream stream, ContentHandler handler,
// Get the comments in the file to display in xhtml
List<String> unModifiableComments = fontMetrics.getComments();
//have to copy because we modify list in extractCreationDate
List<String> comments = new ArrayList<>();
for (String comment : unModifiableComments) {
comments.add(comment);
}
List<String> comments = new ArrayList<>(unModifiableComments);
// Get the creation date
extractCreationDate( metadata, comments );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.tika.parser.html;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -106,11 +107,7 @@ public class DefaultHtmlMapper implements HtmlMapper {
}};

private static Set<String> attrSet(String... attrs) {
Set<String> result = new HashSet<String>();
for (String attr : attrs) {
result.add(attr);
}
return result;
return new HashSet<>(Arrays.asList(attrs));
}

public String mapSafeElement(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
Expand Down Expand Up @@ -238,9 +239,7 @@ public static void addMulti(Metadata metadata, Property property, String string)
String[] current = metadata.getValues(property);
Set<String> seen = new HashSet<>();
if (current != null) {
for (String val : current) {
seen.add(val);
}
seen.addAll(Arrays.asList(current));
}
for (String part : parts) {
if (! seen.contains(part)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,7 @@ protected List<PackagePart> getMainDocumentParts() throws TikaException {

//add main document so that macros can be extracted
//by AbstractOOXMLExtractor
for (PackagePart part : extractor.getPackage().
getPartsByRelationshipType(PackageRelationshipTypes.CORE_DOCUMENT)) {
parts.add(part);
}
parts.addAll(extractor.getPackage().getPartsByRelationshipType(PackageRelationshipTypes.CORE_DOCUMENT));

return parts;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,7 @@ public void testVersions() throws Exception {
}
//now test full 11.x
XMLResult r = getXML("testPDF_Version.11.x.PDFA-1b.pdf");
Set<String> versions = new HashSet<String>();
for (String fmt : r.metadata.getValues("dc:format")) {
versions.add(fmt);
}
Set<String> versions = new HashSet<>(Arrays.asList(r.metadata.getValues("dc:format")));

for (String hit : new String[]{"application/pdf; version=1.7",
"application/pdf; version=\"A-1b\"",
Expand Down