Skip to content
Closed
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 @@ -45,11 +45,11 @@ public class TextReader implements DocumentReader {
private final Resource resource;

/**
* @return Character set to be used when loading data from the
* Character set to be used when loading data from the
*/
private Charset charset = StandardCharsets.UTF_8;

private Map<String, Object> customMetadata = new HashMap<>();
private final Map<String, Object> customMetadata = new HashMap<>();

public TextReader(String resourceUrl) {
this(new DefaultResourceLoader().getResource(resourceUrl));
Expand Down Expand Up @@ -85,7 +85,8 @@ public List<Document> get() {

// Inject source information as a metadata.
this.customMetadata.put(CHARSET_METADATA, this.charset.name());
this.customMetadata.put(SOURCE_METADATA, this.resource.getFilename());
this.customMetadata.put(SOURCE_METADATA, this.resource.getFilename() != null ? this.resource.getFilename()
: Objects.toIdentityString(this.resource));

return List.of(new Document(document, this.customMetadata));

Expand Down