Apply strict comments to digest.txt file as well.
This commit is contained in:
@@ -582,6 +582,9 @@ public class Application
|
|||||||
throw new IOException("m.missing_class");
|
throw new IOException("m.missing_class");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// determine whether we want strict comments
|
||||||
|
_strictComments = Boolean.parseBoolean((String)cdata.get("strict_comments"));
|
||||||
|
|
||||||
// check to see if we're using a custom java.version property and regex
|
// check to see if we're using a custom java.version property and regex
|
||||||
vstr = (String)cdata.get("java_version_prop");
|
vstr = (String)cdata.get("java_version_prop");
|
||||||
if (vstr != null) _javaVersionProp = vstr;
|
if (vstr != null) _javaVersionProp = vstr;
|
||||||
@@ -1166,7 +1169,7 @@ public class Application
|
|||||||
|
|
||||||
// this will read in the contents of the digest file and validate itself
|
// this will read in the contents of the digest file and validate itself
|
||||||
try {
|
try {
|
||||||
_digest = new Digest(_appdir);
|
_digest = new Digest(_appdir, _strictComments);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
log.info("Failed to load digest: " + ioe.getMessage() + ". Attempting recovery...");
|
log.info("Failed to load digest: " + ioe.getMessage() + ". Attempting recovery...");
|
||||||
}
|
}
|
||||||
@@ -1180,7 +1183,7 @@ public class Application
|
|||||||
try {
|
try {
|
||||||
status.updateStatus("m.checking");
|
status.updateStatus("m.checking");
|
||||||
downloadDigestFiles();
|
downloadDigestFiles();
|
||||||
_digest = new Digest(_appdir);
|
_digest = new Digest(_appdir, _strictComments);
|
||||||
if (!olddig.equals(_digest.getMetaDigest())) {
|
if (!olddig.equals(_digest.getMetaDigest())) {
|
||||||
log.info("Unversioned digest changed. Revalidating...");
|
log.info("Unversioned digest changed. Revalidating...");
|
||||||
status.updateStatus("m.validating");
|
status.updateStatus("m.validating");
|
||||||
@@ -1198,7 +1201,7 @@ public class Application
|
|||||||
if (_digest == null) {
|
if (_digest == null) {
|
||||||
status.updateStatus("m.updating_metadata");
|
status.updateStatus("m.updating_metadata");
|
||||||
downloadDigestFiles();
|
downloadDigestFiles();
|
||||||
_digest = new Digest(_appdir);
|
_digest = new Digest(_appdir, _strictComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now verify the contents of our main config file
|
// now verify the contents of our main config file
|
||||||
@@ -1209,7 +1212,7 @@ public class Application
|
|||||||
// caller because there's nothing we can do to automatically recover
|
// caller because there's nothing we can do to automatically recover
|
||||||
downloadConfigFile();
|
downloadConfigFile();
|
||||||
downloadDigestFiles();
|
downloadDigestFiles();
|
||||||
_digest = new Digest(_appdir);
|
_digest = new Digest(_appdir, _strictComments);
|
||||||
// revalidate everything if we end up downloading new metadata
|
// revalidate everything if we end up downloading new metadata
|
||||||
clearValidationMarkers();
|
clearValidationMarkers();
|
||||||
// if the new copy validates, reinitialize ourselves; otherwise report baffling hoseage
|
// if the new copy validates, reinitialize ourselves; otherwise report baffling hoseage
|
||||||
@@ -1817,6 +1820,7 @@ public class Application
|
|||||||
protected String _class;
|
protected String _class;
|
||||||
protected String _name;
|
protected String _name;
|
||||||
protected String _dockIconPath;
|
protected String _dockIconPath;
|
||||||
|
protected boolean _strictComments;
|
||||||
protected boolean _windebug;
|
protected boolean _windebug;
|
||||||
protected boolean _allowOffline;
|
protected boolean _allowOffline;
|
||||||
|
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ public class Digest
|
|||||||
* Creates a digest instance which will parse and validate the digest in the supplied
|
* Creates a digest instance which will parse and validate the digest in the supplied
|
||||||
* application directory, using the current digest version.
|
* application directory, using the current digest version.
|
||||||
*/
|
*/
|
||||||
public Digest (File appdir) throws IOException {
|
public Digest (File appdir, boolean strictComments) throws IOException {
|
||||||
this(appdir, VERSION);
|
this(appdir, VERSION, strictComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,13 +107,14 @@ public class Digest
|
|||||||
* application directory.
|
* application directory.
|
||||||
* @param version the version of the digest protocol to use.
|
* @param version the version of the digest protocol to use.
|
||||||
*/
|
*/
|
||||||
public Digest (File appdir, int version) throws IOException
|
public Digest (File appdir, int version, boolean strictComments) throws IOException
|
||||||
{
|
{
|
||||||
// parse and validate our digest file contents
|
// parse and validate our digest file contents
|
||||||
String filename = digestFile(version);
|
String filename = digestFile(version);
|
||||||
StringBuilder data = new StringBuilder();
|
StringBuilder data = new StringBuilder();
|
||||||
File dfile = new File(appdir, filename);
|
File dfile = new File(appdir, filename);
|
||||||
ConfigUtil.ParseOpts opts = ConfigUtil.createOpts(false);
|
ConfigUtil.ParseOpts opts = ConfigUtil.createOpts(false);
|
||||||
|
opts.strictComments = strictComments;
|
||||||
// bias = toward key: the key is the filename and could conceivably contain = signs, value
|
// bias = toward key: the key is the filename and could conceivably contain = signs, value
|
||||||
// is the hex encoded hash which will not contain =
|
// is the hex encoded hash which will not contain =
|
||||||
opts.biasToKey = true;
|
opts.biasToKey = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user