ottlinger commented on code in PR #246: URL: https://github.com/apache/creadur-rat/pull/246#discussion_r1597010502
########## apache-rat-core/src/main/java/org/apache/rat/document/impl/FileDocument.java: ########## @@ -19,67 +19,71 @@ package org.apache.rat.document.impl; import java.io.File; -import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.Reader; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.Collections; +import java.util.SortedSet; +import java.util.TreeSet; import org.apache.rat.api.Document; -import org.apache.rat.api.MetaData; /** - * Document wrapping a file of undetermined composition. - * + * Document wrapping a File object */ -public class FileDocument implements Document { +public class FileDocument extends Document { + /** the wrapped file */ private final File file; - private final String name; - private final MetaData metaData = new MetaData(); - + + /** + * Creates a File document. + * @param file the file to wrap. + */ public FileDocument(final File file) { - super(); + super(normalizeFileName(file)); this.file = file; - name = DocumentImplUtils.toName(file); } - public boolean isComposite() { - return DocumentImplUtils.isZip(file); + /** + * Normalizes a file name. Accounts for Windows to Unix conversion. + * @param file + * @return + */ + public final static String normalizeFileName(File file) { + String path = file.getPath(); + return path.replace('\\', '/'); Review Comment: Does this destroy escaped filenames with spaces in their file names? Just wondering -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@creadur.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org