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

Commit

Permalink
Load index template resource using ESExporter.class rather than the E…
Browse files Browse the repository at this point in the history
…S utility method

Closes elastic#149
  • Loading branch information
bleskes authored and simianhacker committed Mar 12, 2014
1 parent 645a28b commit dd6b0ac
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
import org.elasticsearch.marvel.agent.event.Event;
import org.elasticsearch.node.settings.NodeSettingsService;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
Expand Down Expand Up @@ -398,7 +395,11 @@ private boolean checkAndUpload(String path, byte[] bytes) throws IOException {
private boolean checkAndUploadIndexTemplate() {
byte[] template;
try {
template = Streams.copyToBytesFromClasspath("/marvel_index_template.json");
InputStream is = ESExporter.class.getResourceAsStream("/marvel_index_template.json");
if (is == null) {
throw new FileNotFoundException("Resource [/marvel_index_template.json] not found in classpath");
}
template = Streams.copyToByteArray(is);
} catch (IOException e) {
// throwing an exception to stop exporting process - we don't want to send data unless
// we put in the template for it.
Expand Down

0 comments on commit dd6b0ac

Please sign in to comment.