Closed GoogleCodeExporter closed 9 years ago
I do not see any problem here,
I have just add 2 more JUnit test to check boolean isValue() and getValue(),
both of them works.
Original comment by uriel.chemouni
on 23 Jun 2012 at 4:27
public class Mo {
boolean isPopping;
public boolean isPopping() {
return isPopping;
}
public void setPopping(boolean isPopping) {
this.isPopping = isPopping;
}
public static void main(String[] args) {
Mo mo = new Mo();
mo.setPopping(false);
JSONObject data = new JSONObject();
data.put("mo", mo);
System.out.println(data.toJSONString());
}
}
Exception in thread "main" java.lang.RuntimeException:
java.lang.NoSuchMethodException: org.json.tes
t.Mo.isIsPopping()
at net.minidev.json.JSONValue.writeJSONString(JSONValue.java:625)
at net.minidev.json.JSONObject.writeJSONKV(JSONObject.java:102)
at net.minidev.json.JSONObject.writeJSON(JSONObject.java:169)
at net.minidev.json.JSONObject.toJSONString(JSONObject.java:72)
at net.minidev.json.JSONObject.toJSONString(JSONObject.java:249)
at org.json.test.Mo.main(Mo.java:22)
Caused by: java.lang.NoSuchMethodException: org.json.test.Mo.isIsPopping()
at java.lang.Class.getDeclaredMethod(Class.java:1937)
at net.minidev.json.JSONValue.writeJSONString(JSONValue.java:610)
... 5 more
Original comment by linzuxio...@gmail.com
on 12 Jul 2012 at 6:01
Mo is not a valid beans,
Mo class should be:
public class Mo {
boolean popping;
public boolean isPopping() {
return isPopping;
}
public void setPopping(boolean popping) {
this.isPopping = popping;
}
public static void main(String[] args) {
Mo mo = new Mo();
mo.setPopping(false);
JSONObject data = new JSONObject();
data.put("mo", mo);
System.out.println(data.toJSONString());
}
}
Original comment by uriel.chemouni
on 29 Oct 2012 at 1:35
Original issue reported on code.google.com by
linzuxio...@gmail.com
on 5 Jun 2012 at 8:24