}
// almost finally check the startup file arguments
- for (String f : _startupFiles) {
- _appargs.add(HttpUtils.isPlausibleUri(f)?f:new File(f).getAbsolutePath());
+ for (String f : _startupFiles)
+ {
+ _appargs.add(HttpUtils.isPlausibleUri(f) ? f
+ : new File(f).getAbsolutePath());
}
// check if one arg with recognised extension
return new File(appdir, path);
}
- public static void setStartupFilesFromParameters(List<String> parameters) {
+ public static void setStartupFilesFromParameters(
+ List<String> parameters)
+ {
// multiple files *might* be passed in as space separated quoted filenames
String q = "\"";
- for (String p: parameters) {
- if (!StringUtil.isBlank(p)) {
+ for (String p : parameters)
+ {
+ if (!StringUtil.isBlank(p))
+ {
String filename;
// split quoted params or treat as single string array
- if (p.startsWith(q) && p.endsWith(q)) {
- filename = p.substring(q.length(),p.length()-q.length());
- } else {
+ if (p.startsWith(q) && p.endsWith(q))
+ {
+ filename = p.substring(q.length(), p.length() - q.length());
+ }
+ else
+ {
// single unquoted filename
filename = p;
}
-
+
/* Now letting Jalview convert these URIs.
// convert jalviewX://... URLs
if (HttpUtils.isJalviewSchemeUri(filename)) {
}
*/
- // check for locator file. Only allow one locator file to be double clicked (if multiple files opened, ignore locator files)
- if (filename.toLowerCase(Locale.ROOT).endsWith("."+Application.LOCATOR_FILE_EXTENSION)) {
+ // check for locator file. Only allow one locator file to be double
+ // clicked (if multiple files opened, ignore locator files)
+ if (filename.toLowerCase(Locale.ROOT)
+ .endsWith("." + Application.LOCATOR_FILE_EXTENSION))
+ {
// convert jalviewX://... JVL files
setLocatorFile(HttpUtils.equivalentJalviewUrl(filename));
- } else {
+ }
+ else
+ {
// skip any other locator files in a multiple file list
addStartupFile(filename);
}
}
}
}
-
- public static String getStartupFilesParameterString(List<String> parameters, boolean changeJalviewSchemeUris) {
+
+ public static String getStartupFilesParameterString(
+ List<String> parameters, boolean changeJalviewSchemeUris)
+ {
StringBuilder sb = new StringBuilder();
boolean first = true;
- for(String f : parameters) {
- if (first) {
+ for (String f : parameters)
+ {
+ if (first)
+ {
first = false;
- } else {
+ }
+ else
+ {
sb.append(' ');
}
- String p = changeJalviewSchemeUris ? HttpUtils.equivalentJalviewUrl(f) : f;
- if (p.contains(" ")) {
+ String p = changeJalviewSchemeUris
+ ? HttpUtils.equivalentJalviewUrl(f)
+ : f;
+ if (p.contains(" "))
+ {
sb.append('"');
sb.append(p);
sb.append('"');
- } else {
+ }
+ else
+ {
sb.append(p);
}
}
Config locatorConfig = null;
- try {
+ try
+ {
Config tmpConfig = null;
Map<String, Object> tmpData = new HashMap<>();
- if (HttpUtils.startsWithHttpOrHttps(_locatorFile)) {
+ if (HttpUtils.startsWithHttpOrHttps(_locatorFile))
+ {
URL locatorUrl = new URL(_locatorFile);
- try (InputStream in = ConnectionUtil.open(proxy, locatorUrl, 0, 0).getInputStream();
- InputStreamReader reader = new InputStreamReader(in, UTF_8);
- BufferedReader bin = new BufferedReader(reader)) {
- tmpConfig = Config.parseConfig(bin, opts);
+ try (InputStream in = ConnectionUtil.open(proxy, locatorUrl, 0, 0)
+ .getInputStream();
+ InputStreamReader reader = new InputStreamReader(in,
+ UTF_8);
+ BufferedReader bin = new BufferedReader(reader))
+ {
+ tmpConfig = Config.parseConfig(bin, opts);
}
- } else if (new File(_locatorFile).exists()) {
- tmpConfig = Config.parseConfig(new File(_locatorFile), opts);
}
+ else if (new File(_locatorFile).exists())
+ {
+ tmpConfig = Config.parseConfig(new File(_locatorFile), opts);
+ }
+
if (tmpConfig != null) {
// appbase is sanitised in HostWhitelist
Map<String, Object> tmpConfigData = tmpConfig.getData();