Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Compile Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Raft08 committed Jan 18, 2024
1 parent 03be982 commit e604736
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class LocalServerFileSource implements ServerFileSource {

@Override
public void loadSource(String source, String dest, ServerFilesHolder holder) throws IOException {
if (source.isEmpty())
if (source == null || source.isEmpty())
throw new InvalidConfigurationException("Source cannot be an empty string!");

if (source.endsWith("/*")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package fr.atlasworld.network.core.server.sources;

import fr.atlasworld.network.api.file.configuration.exception.InvalidConfigurationException;
import fr.atlasworld.network.api.server.files.ServerFileSource;
import fr.atlasworld.network.api.server.files.ServerFilesHolder;

import java.io.ByteArrayInputStream;
import java.io.IOException;

public class StringServerFileSource implements ServerFileSource {
@Override
public void loadSource(String source, String dest, ServerFilesHolder holder) throws IOException {
if (source == null)
throw new InvalidConfigurationException("Source must be specified!");

try (ByteArrayInputStream stream = new ByteArrayInputStream(source.getBytes())) {
holder.add(dest, stream);
}
}
}

0 comments on commit e604736

Please sign in to comment.