| Summary: | Unresolved compilation problem | ||
|---|---|---|---|
| Product: | River-Crossing-Puzzle-Solver | Reporter: | tsunychau2-c |
| Component: | Logic | Assignee: | tsunychau2-c |
| Status: | RESOLVED FIXED | ||
| Severity: | critical | ||
| Priority: | Normal | ||
| Version: | v1.0.0 | ||
| Hardware: | PC | ||
| OS: | Mac OS | ||
|
Description
tsunychau2-c
2022-11-05 21:29:18 HKT
Bug is confirmed The problem is fixed now. The error exist since missing of (Rule) type on line 12 in RuleFactory.java.
Modification of code:
package Puzzle.Logic;
import org.json.JSONException;
import org.json.JSONObject;
public class RuleFactory {
public Rule createRule(JSONObject json) throws JSONException, InstantiationException, IllegalAccessException, ClassNotFoundException {
if(json.length() == 0) //empty json object
return null;
String ruleType = json.getString("RuleType");
Rule rule = (Rule) Class.forName("Puzzle.Logic."+ruleType+"Rule").newInstance();
rule.parseJSON(json);
return rule;
}
}
|