review fixes
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
indent_size=2
|
||||
indent_style=space
|
||||
insert_final_newline=true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.java]
|
||||
indent_size=4
|
||||
|
||||
# also configure imports order manually as follows:
|
||||
# import java.*
|
||||
# <blank line>
|
||||
# import javax.*
|
||||
# <blank line>
|
||||
# import com.samskivert.*
|
||||
# import com.threerings.*
|
||||
# import all other imports
|
||||
# import static all other imports
|
||||
@@ -211,10 +211,10 @@ public class Application
|
||||
* Used by {@link #verifyMetadata} to communicate status in circumstances where it needs to
|
||||
* take network actions.
|
||||
*/
|
||||
public interface StatusDisplay
|
||||
public static interface StatusDisplay
|
||||
{
|
||||
/** Requests that the specified status message be displayed. */
|
||||
void updateStatus (String message);
|
||||
public void updateStatus (String message);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,8 +238,9 @@ public class Application
|
||||
public Proxy proxy = Proxy.NO_PROXY;
|
||||
|
||||
/**
|
||||
* Creates an application instance which records the location of the {@code getdown.txt}
|
||||
* Creates an application instance which records the location of the <code>getdown.txt</code>
|
||||
* configuration file from the supplied application directory.
|
||||
*
|
||||
*/
|
||||
public Application (EnvConfig envc) {
|
||||
_envc = envc;
|
||||
@@ -367,7 +368,8 @@ public class Application
|
||||
*/
|
||||
public List<Resource> getActiveCodeResources ()
|
||||
{
|
||||
List<Resource> codes = new ArrayList<>(getCodeResources());
|
||||
ArrayList<Resource> codes = new ArrayList<>();
|
||||
codes.addAll(getCodeResources());
|
||||
for (AuxGroup aux : getAuxGroups()) {
|
||||
if (isAuxGroupActive(aux.name)) {
|
||||
codes.addAll(aux.codes);
|
||||
@@ -395,7 +397,8 @@ public class Application
|
||||
*/
|
||||
public List<Resource> getActiveResources ()
|
||||
{
|
||||
List<Resource> rsrcs = new ArrayList<>(getResources());
|
||||
ArrayList<Resource> rsrcs = new ArrayList<>();
|
||||
rsrcs.addAll(getResources());
|
||||
for (AuxGroup aux : getAuxGroups()) {
|
||||
if (isAuxGroupActive(aux.name)) {
|
||||
rsrcs.addAll(aux.rsrcs);
|
||||
@@ -598,7 +601,7 @@ public class Application
|
||||
_vappbase = createVAppBase(_version);
|
||||
} catch (MalformedURLException mue) {
|
||||
String err = MessageUtil.tcompose("m.invalid_appbase", _appbase);
|
||||
throw new IOException(err, mue);
|
||||
throw (IOException) new IOException(err).initCause(mue);
|
||||
}
|
||||
|
||||
// check for a latest config URL
|
||||
@@ -763,7 +766,7 @@ public class Application
|
||||
/**
|
||||
* Adds strings of the form pair0=pair1 to collector for each pair parsed out of pairLocation.
|
||||
*/
|
||||
protected void fillAssignmentListFromPairs (String pairLocation, Collection<String> collector)
|
||||
protected void fillAssignmentListFromPairs (String pairLocation, List<String> collector)
|
||||
{
|
||||
File pairFile = getLocalPath(pairLocation);
|
||||
if (pairFile.exists()) {
|
||||
@@ -899,7 +902,7 @@ public class Application
|
||||
_vappbase = createVAppBase(_targetVersion);
|
||||
} catch (MalformedURLException mue) {
|
||||
String err = MessageUtil.tcompose("m.invalid_appbase", _appbase);
|
||||
throw new IOException(err, mue);
|
||||
throw (IOException) new IOException(err).initCause(mue);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -1430,7 +1433,7 @@ public class Application
|
||||
protected URL createVAppBase (long version)
|
||||
throws MalformedURLException
|
||||
{
|
||||
String url = version < 0 ? _appbase : _appbase.replace("%VERSION%", String.valueOf(version));
|
||||
String url = version < 0 ? _appbase : _appbase.replace("%VERSION%", "" + version);
|
||||
return HostWhitelist.verify(new URL(url));
|
||||
}
|
||||
|
||||
@@ -1601,7 +1604,7 @@ public class Application
|
||||
} catch (Exception e) {
|
||||
log.warning("Requested to download invalid control file",
|
||||
"appbase", _vappbase, "path", path, "error", e);
|
||||
throw new IOException("Invalid path '" + path + "'.", e);
|
||||
throw (IOException) new IOException("Invalid path '" + path + "'.").initCause(e);
|
||||
}
|
||||
|
||||
log.info("Attempting to refetch '" + path + "' from '" + targetURL + "'.");
|
||||
@@ -1636,9 +1639,11 @@ public class Application
|
||||
}
|
||||
|
||||
/** Helper function to add all values in {@code values} (if non-null) to {@code target}. */
|
||||
protected static void addAll (String[] values, Collection<String> target) {
|
||||
protected static void addAll (String[] values, List<String> target) {
|
||||
if (values != null) {
|
||||
Collections.addAll(target, values);
|
||||
for (String value : values) {
|
||||
target.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,20 @@ public abstract class Getdown extends Thread
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warning("run() failed.", e);
|
||||
fail(e);
|
||||
String msg = e.getMessage();
|
||||
if (msg == null) {
|
||||
msg = MessageUtil.compose("m.unknown_error", _ifc.installError);
|
||||
} else if (!msg.startsWith("m.")) {
|
||||
// try to do something sensible based on the type of error
|
||||
if (e instanceof FileNotFoundException) {
|
||||
msg = MessageUtil.compose(
|
||||
"m.missing_resource", MessageUtil.taint(msg), _ifc.installError);
|
||||
} else {
|
||||
msg = MessageUtil.compose(
|
||||
"m.init_error", MessageUtil.taint(msg), _ifc.installError);
|
||||
}
|
||||
}
|
||||
fail(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +423,22 @@ public abstract class Getdown extends Thread
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warning("getdown() failed.", e);
|
||||
fail(e);
|
||||
String msg = e.getMessage();
|
||||
if (msg == null) {
|
||||
msg = MessageUtil.compose("m.unknown_error", _ifc.installError);
|
||||
} else if (!msg.startsWith("m.")) {
|
||||
// try to do something sensible based on the type of error
|
||||
if (e instanceof FileNotFoundException) {
|
||||
msg = MessageUtil.compose(
|
||||
"m.missing_resource", MessageUtil.taint(msg), _ifc.installError);
|
||||
} else {
|
||||
msg = MessageUtil.compose(
|
||||
"m.init_error", MessageUtil.taint(msg), _ifc.installError);
|
||||
}
|
||||
}
|
||||
// Since we're dead, clear off the 'time remaining' label along with displaying the
|
||||
// error message
|
||||
fail(msg);
|
||||
_app.releaseLock();
|
||||
}
|
||||
}
|
||||
@@ -808,21 +836,6 @@ public abstract class Getdown extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
private void fail(Exception e) {
|
||||
String msg = e.getMessage();
|
||||
if (msg == null) {
|
||||
msg = MessageUtil.compose("m.unknown_error", _ifc.installError);
|
||||
} else if (!msg.startsWith("m.")) {
|
||||
// try to do something sensible based on the type of error
|
||||
if (e instanceof FileNotFoundException) {
|
||||
msg = MessageUtil.compose("m.missing_resource", MessageUtil.taint(msg), _ifc.installError);
|
||||
} else {
|
||||
msg = MessageUtil.compose("m.init_error", MessageUtil.taint(msg), _ifc.installError);
|
||||
}
|
||||
}
|
||||
fail(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the status to indicate getdown has failed for the reason in <code>message</code>.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user