Commit 2a59f8fd authored by Jonathan Shahen's avatar Jonathan Shahen

Reordering of variables to allows for better error log messages; now dumps out...

Reordering of variables to allows for better error log messages; now dumps out the roles and their hashed values to a file if an error occurs
parent 6b537321
Pipeline #7962 skipped
......@@ -30,18 +30,19 @@ public class ConvertToMohawk extends ConvertTo {
@Override
public String convert(MohawkT m, File f, Boolean writeToFile) {
try {
ArrayList<MohawkCA_Rule> newCARules = new ArrayList<MohawkCA_Rule>();
ArrayList<MohawkCR_Rule> newCRRules = new ArrayList<MohawkCR_Rule>();
ArrayList<Rule> workableRules = new ArrayList<Rule>();
// Deep Copy Helpers
/* Timing */timing.startTimer(tPrefix + "_" + "deepcopy");
RoleHelper roleHelper = new RoleHelper(m.roleHelper);
TimeIntervalHelper timeIntervalHelper = new TimeIntervalHelper(m.timeIntervalHelper);
Query workableQuery = new Query(m.query);
/* Timing */timing.stopTimer(tPrefix + "_deepcopy");
ArrayList<MohawkCA_Rule> newCARules = new ArrayList<MohawkCA_Rule>();
ArrayList<MohawkCR_Rule> newCRRules = new ArrayList<MohawkCR_Rule>();
ArrayList<Rule> workableRules = new ArrayList<Rule>();
// Deep Copy Helpers
/* Timing */timing.startTimer(tPrefix + "_" + "deepcopy");
RoleHelper roleHelper = new RoleHelper(m.roleHelper);
RoleHelper roleHelperTemporality = null;
TimeIntervalHelper timeIntervalHelper = new TimeIntervalHelper(m.timeIntervalHelper);
Query workableQuery = new Query(m.query);
/* Timing */timing.stopTimer(tPrefix + "_deepcopy");
try {
/* Timing */timing.startTimer(tPrefix + "_removeEnableDisableRules");
switch (canEnableVersion) {
case 1:
......@@ -87,7 +88,7 @@ public class ConvertToMohawk extends ConvertTo {
}
/* Timing */timing.startTimer(tPrefix + "_removeTemporality");
RoleHelper roleHelperTemporality = new RoleHelper(roleHelper);
roleHelperTemporality = new RoleHelper(roleHelper);
ArrayList<Object> reducedRules = roleHelperTemporality.removeTemporality(workableRules, timeIntervalHelper);
/* Timing */timing.stopTimer(tPrefix + "_removeTemporality");
......@@ -161,10 +162,20 @@ public class ConvertToMohawk extends ConvertTo {
} catch (Exception e) {
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
logger.fine(errors.toString());
logger.warning(errors.toString());
logger.warning("[ERROR] Unable to convert to Mohawk: " + e.getMessage());
lastError = "Error ConvertToRanise.convert.Exception #1";
if (logger.isLoggable(Level.FINE)) {
if (roleHelperTemporality == null) {
roleHelper.dumpRoleSet("ToMohawkRoleHelperDump.txt");
roleHelper.dumpHashedRoles("ToMohawkRoleHelperDump_Hashed.txt");
} else {
roleHelperTemporality.dumpRoleSet("ToMohawkRoleHelperDump.txt");
roleHelperTemporality.dumpHashedRoles("ToMohawkRoleHelperDump_Hashed.txt");
}
}
}
return convertedStr;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment