Skip to content
Snippets Groups Projects
Commit 40896809 authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

use try catch

parent 10c21a4c
No related branches found
No related tags found
1 merge request!266Report Version
package gov.usgs.earthquake.nshmp.internal;
import java.io.IOException;
public interface AppVersion {
public VersionInfo getVersionInfo() throws IllegalArgumentException, IOException;
public VersionInfo getVersionInfo();
public static class VersionInfo {
public String branchName;
......
package gov.usgs.earthquake.nshmp.internal;
import java.io.IOException;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import com.google.gson.Gson;
public class LibVersion implements AppVersion {
public VersionInfo getVersionInfo() throws IllegalArgumentException, IOException {
var resource = Resources.getResource("version.json");
return new Gson().fromJson(
Resources.toString(resource, Charsets.UTF_8),
VersionInfo.class);
public VersionInfo getVersionInfo() {
try {
var resource = Resources.getResource("version.json");
return new Gson().fromJson(
Resources.toString(resource, Charsets.UTF_8),
VersionInfo.class);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment