Skip to content

Instantly share code, notes, and snippets.

@polyglothacker
Created May 13, 2022 06:00
Show Gist options
  • Save polyglothacker/c0afa4c2da06de2624d02fa9760fd91e to your computer and use it in GitHub Desktop.
Save polyglothacker/c0afa4c2da06de2624d02fa9760fd91e to your computer and use it in GitHub Desktop.
$ javac -cp ./json-simple-1.1.jar MonitorClass.java
MonitorClass.java:24: error: constructor JSONArray in class JSONArray cannot be applied to given types;
JSONArray ja = new JSONArray("[{\"x\":49,\"y\":22,\"z\":72,\"ts\":\"2022-02-0815:43:13\"},{\"x\":60,\"y\":17,\"z\":6,\"ts\":\"2022-02-0815:43:15\"},{\"x\":94,\"y\":36,\"z\":8,\"ts\":\"2022-02-0815:43:17\"},{\"x\":86,\"y\":40,\"z\":5,\"ts\":\"2022-02-0815:43:21\"},{\"x\":25,\"y\":85,\"z\":95,\"ts\":\"2022-02-0815:43:23\"},{\"x\":28,\"y\":71,\"z\":65,\"ts\":\"2022-02-0815:43:26\"},{\"x\":12,\"y\":46,\"z\":70,\"ts\":\"2022-02-0815:43:28\"},{\"x\":30,\"y\":45,\"z\":70,\"ts\":\"2022-02-0815:43:30\"},{\"x\":22,\"y\":74,\"z\":14,\"ts\":\"2022-02-0815:43:31\"},{\"x\":78,\"y\":5,\"z\":4,\"ts\":\"2022-02-0815:43:33\"},{\"x\":18,\"y\":78,\"z\":45,\"ts\":\"2022-02-0815:43:35\"},{\"x\":34,\"y\":7,\"z\":15,\"ts\":\"2022-02-0815:43:36\"},{\"x\":98,\"y\":53,\"z\":42,\"ts\":\"2022-02-0815:43:38\"},{\"x\":28,\"y\":33,\"z\":23,\"ts\":\"2022-02-0815:43:41\"},{\"x\":2,\"y\":34,\"z\":2,\"ts\":\"2022-02-0815:43:45\"},{\"x\":62,\"y\":40,\"z\":37,\"ts\":\"2022-02-0815:43:49\"},{\"x\":52,\"y\":58,\"z\":71,\"ts\":\"2022-02-0815:43:52\"},{\"x\":30,\"y\":81,\"z\":89,\"ts\":\"2022-02-0815:43:54\"},{\"x\":98,\"y\":5,\"z\":5,\"ts\":\"2022-02-0815:43:57\"},{\"x\":61,\"y\":27,\"z\":68,\"ts\":\"2022-02-0815:43:59\"},{\"x\":23,\"y\":22,\"z\":84,\"ts\":\"2022-02-0815:44:00\"},{\"x\":88,\"y\":96,\"z\":86,\"ts\":\"2022-02-0815:44:02\"},{\"x\":44,\"y\":89,\"z\":62,\"ts\":\"2022-02-0815:44:04\"},{\"x\":70,\"y\":16,\"z\":25,\"ts\":\"2022-02-0815:44:06\"},{\"x\":14,\"y\":84,\"z\":23,\"ts\":\"2022-02-0815:44:07\"},{\"x\":62,\"y\":65,\"z\":43,\"ts\":\"2022-02-0815:44:08\"},{\"x\":54,\"y\":17,\"z\":67,\"ts\":\"2022-02-0815:44:10\"},{\"x\":74,\"y\":77,\"z\":7,\"ts\":\"2022-02-0815:44:13\"},{\"x\":9,\"y\":48,\"z\":58,\"ts\":\"2022-02-0815:44:17\"},{\"x\":13,\"y\":78,\"z\":56,\"ts\":\"2022-02-0815:44:21\"},{\"x\":21,\"y\":99,\"z\":53,\"ts\":\"2022-02-0815:44:23\"},{\"x\":74,\"y\":75,\"z\":48,\"ts\":\"2022-02-0815:44:24\"},{\"x\":38,\"y\":19,\"z\":1,\"ts\":\"2022-02-0815:44:26\"},{\"x\":86,\"y\":11,\"z\":11,\"ts\":\"2022-02-0815:44:29\"},{\"x\":46,\"y\":2,\"z\":90,\"ts\":\"2022-02-0815:44:30\"},{\"x\":52,\"y\":90,\"z\":69,\"ts\":\"2022-02-0815:44:32\"},{\"x\":80,\"y\":88,\"z\":33,\"ts\":\"2022-02-0815:44:35\"},{\"x\":70,\"y\":70,\"z\":46,\"ts\":\"2022-02-0815:44:39\"},{\"x\":71,\"y\":8,\"z\":87,\"ts\":\"2022-02-0815:44:41\"},{\"x\":15,\"y\":60,\"z\":23,\"ts\":\"2022-02-0815:44:45\"},{\"x\":26,\"y\":65,\"z\":84,\"ts\":\"2022-02-0815:44:46\"},{\"x\":35,\"y\":32,\"z\":22,\"ts\":\"2022-02-0815:44:49\"},{\"x\":99,\"y\":43,\"z\":97,\"ts\":\"2022-02-0815:44:51\"},{\"x\":97,\"y\":17,\"z\":36,\"ts\":\"2022-02-0815:44:52\"},{\"x\":37,\"y\":74,\"z\":5,\"ts\":\"2022-02-0815:44:55\"},{\"x\":88,\"y\":40,\"z\":4,\"ts\":\"2022-02-0815:44:57\"},{\"x\":8,\"y\":49,\"z\":23,\"ts\":\"2022-02-0815:45:01\"},{\"x\":42,\"y\":61,\"z\":88,\"ts\":\"2022-02-0815:45:04\"},{\"x\":10,\"y\":37,\"z\":70,\"ts\":\"2022-02-0815:45:05\"},{\"x\":84,\"y\":38,\"z\":45,\"ts\":\"2022-02-0815:45:07\"},{\"x\":76,\"y\":81,\"z\":50,\"ts\":\"2022-02-0815:45:11\"},{\"x\":29,\"y\":33,\"z\":65,\"ts\":\"2022-02-0815:45:15\"}]");
^
required: no arguments
found: String
reason: actual and formal argument lists differ in length
MonitorClass.java:26: error: cannot find symbol
for (int i = 0; i < ja.length() ; i++) {
^
symbol: method length()
location: variable ja of type JSONArray
MonitorClass.java:27: error: cannot find symbol
JSONObject obj = ja.getJSONObject(i);
^
symbol: method getJSONObject(int)
location: variable ja of type JSONArray
MonitorClass.java:61: error: incompatible types: Object cannot be converted to double
double xVal = polledItem.get("x");
^
MonitorClass.java:62: error: incompatible types: Object cannot be converted to double
double yVal = polledItem.get("y");
^
MonitorClass.java:63: error: incompatible types: Object cannot be converted to double
double zVal = polledItem.get("z");
^
MonitorClass.java:64: error: bad operand types for binary operator '+'
double totalX = xAvg * size - xVal + metric.get("x");
^
first type: double
second type: Object
MonitorClass.java:65: error: bad operand types for binary operator '+'
double totalY = yAvg * size - yVal + metric.get("y");
^
first type: double
second type: Object
MonitorClass.java:66: error: bad operand types for binary operator '+'
double totalZ = zAvg * size - zVal + metric.get("z");
^
first type: double
second type: Object
MonitorClass.java:72: error: bad operand types for binary operator '+'
double totalX = xAvg * q.size() + metric.get("x");
^
first type: double
second type: Object
MonitorClass.java:73: error: bad operand types for binary operator '+'
double totalY = yAvg * q.size() + metric.get("y");
^
first type: double
second type: Object
MonitorClass.java:74: error: bad operand types for binary operator '+'
double totalZ = zAvg * q.size() + metric.get("z");
^
first type: double
second type: Object
12 errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment