Skip to content

Commit 2b0a883

Browse files
committed
gradle support
1 parent 1da2b98 commit 2b0a883

32 files changed

+647
-131
lines changed

src/main/java/org/json/CDL.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private static String getValue(JSONTokener x) throws JSONException {
9898
* Produce a JSONArray of strings from a row of comma delimited values.
9999
* @param x A JSONTokener of the source text.
100100
* @return A JSONArray of strings.
101-
* @throws JSONException
101+
* @throws JSONException if a called function fails
102102
*/
103103
public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
104104
JSONArray ja = new JSONArray();
@@ -134,7 +134,7 @@ public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
134134
* method.
135135
* @param x A JSONTokener of the source text.
136136
* @return A JSONObject combining the names and values.
137-
* @throws JSONException
137+
* @throws JSONException if a called function fails
138138
*/
139139
public static JSONObject rowToJSONObject(JSONArray names, JSONTokener x)
140140
throws JSONException {
@@ -184,7 +184,7 @@ public static String rowToString(JSONArray ja) {
184184
* using the first row as a source of names.
185185
* @param string The comma delimited text.
186186
* @return A JSONArray of JSONObjects.
187-
* @throws JSONException
187+
* @throws JSONException if a called function fails
188188
*/
189189
public static JSONArray toJSONArray(String string) throws JSONException {
190190
return toJSONArray(new JSONTokener(string));
@@ -195,7 +195,7 @@ public static JSONArray toJSONArray(String string) throws JSONException {
195195
* using the first row as a source of names.
196196
* @param x The JSONTokener containing the comma delimited text.
197197
* @return A JSONArray of JSONObjects.
198-
* @throws JSONException
198+
* @throws JSONException if a called function fails
199199
*/
200200
public static JSONArray toJSONArray(JSONTokener x) throws JSONException {
201201
return toJSONArray(rowToJSONArray(x), x);
@@ -207,7 +207,7 @@ public static JSONArray toJSONArray(JSONTokener x) throws JSONException {
207207
* @param names A JSONArray of strings.
208208
* @param string The comma delimited text.
209209
* @return A JSONArray of JSONObjects.
210-
* @throws JSONException
210+
* @throws JSONException if a called function fails
211211
*/
212212
public static JSONArray toJSONArray(JSONArray names, String string)
213213
throws JSONException {
@@ -220,7 +220,7 @@ public static JSONArray toJSONArray(JSONArray names, String string)
220220
* @param names A JSONArray of strings.
221221
* @param x A JSONTokener of the source text.
222222
* @return A JSONArray of JSONObjects.
223-
* @throws JSONException
223+
* @throws JSONException if a called function fails
224224
*/
225225
public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
226226
throws JSONException {
@@ -248,7 +248,7 @@ public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
248248
* JSONObject.
249249
* @param ja A JSONArray of JSONObjects.
250250
* @return A comma delimited text.
251-
* @throws JSONException
251+
* @throws JSONException if a called function fails
252252
*/
253253
public static String toString(JSONArray ja) throws JSONException {
254254
JSONObject jo = ja.optJSONObject(0);
@@ -268,7 +268,7 @@ public static String toString(JSONArray ja) throws JSONException {
268268
* @param names A JSONArray of strings.
269269
* @param ja A JSONArray of JSONObjects.
270270
* @return A comma delimited text.
271-
* @throws JSONException
271+
* @throws JSONException if a called function fails
272272
*/
273273
public static String toString(JSONArray names, JSONArray ja)
274274
throws JSONException {

src/main/java/org/json/Cookie.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static String escape(String string) {
7676
* @param string The cookie specification string.
7777
* @return A JSONObject containing "name", "value", and possibly other
7878
* members.
79-
* @throws JSONException
79+
* @throws JSONException if a called function fails or a syntax error
8080
*/
8181
public static JSONObject toJSONObject(String string) throws JSONException {
8282
String name;
@@ -113,7 +113,7 @@ public static JSONObject toJSONObject(String string) throws JSONException {
113113
* All other members are ignored.
114114
* @param jo A JSONObject
115115
* @return A cookie specification string
116-
* @throws JSONException
116+
* @throws JSONException if a called function fails
117117
*/
118118
public static String toString(JSONObject jo) throws JSONException {
119119
StringBuilder sb = new StringBuilder();

src/main/java/org/json/CookieList.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class CookieList {
4242
* cookieJSONObject.getString("value"));
4343
* @param string A cookie list string
4444
* @return A JSONObject
45-
* @throws JSONException
45+
* @throws JSONException if a called function fails
4646
*/
4747
public static JSONObject toJSONObject(String string) throws JSONException {
4848
JSONObject jo = new JSONObject();
@@ -63,7 +63,7 @@ public static JSONObject toJSONObject(String string) throws JSONException {
6363
* in the names and values are replaced by "%hh".
6464
* @param jo A JSONObject
6565
* @return A cookie list string
66-
* @throws JSONException
66+
* @throws JSONException if a called function fails
6767
*/
6868
public static String toString(JSONObject jo) throws JSONException {
6969
boolean b = false;

src/main/java/org/json/HTTP.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ public class HTTP {
5151
* "Reason-Phrase": "OK" (for example)
5252
* }</pre>
5353
* In addition, the other parameters in the header will be captured, using
54-
* the HTTP field names as JSON names, so that <pre>
54+
* the HTTP field names as JSON names, so that <pre>{@code
5555
* Date: Sun, 26 May 2002 18:06:04 GMT
5656
* Cookie: Q=q2=PPEAsg--; B=677gi6ouf29bn&b=2&f=s
57-
* Cache-Control: no-cache</pre>
57+
* Cache-Control: no-cache}</pre>
5858
* become
59-
* <pre>{...
59+
* <pre>{@code
6060
* Date: "Sun, 26 May 2002 18:06:04 GMT",
6161
* Cookie: "Q=q2=PPEAsg--; B=677gi6ouf29bn&b=2&f=s",
6262
* "Cache-Control": "no-cache",
@@ -66,7 +66,7 @@ public class HTTP {
6666
* @param string An HTTP header string.
6767
* @return A JSONObject containing the elements and attributes
6868
* of the XML string.
69-
* @throws JSONException
69+
* @throws JSONException if a called function fails
7070
*/
7171
public static JSONObject toJSONObject(String string) throws JSONException {
7272
JSONObject jo = new JSONObject();

src/main/java/org/json/HTTPTokener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public HTTPTokener(String string) {
4343

4444
/**
4545
* Get the next token or string. This is used in parsing HTTP headers.
46-
* @throws JSONException
4746
* @return A String.
47+
* @throws JSONException if a syntax error occurs
4848
*/
4949
public String nextToken() throws JSONException {
5050
char c;

src/main/java/org/json/JSONArray.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ public String toString() {
13331333
/**
13341334
* Make a pretty-printed JSON text of this JSONArray.
13351335
*
1336-
* <p>If <code>indentFactor > 0</code> and the {@link JSONArray} has only
1336+
* <p>If <pre> {@code indentFactor > 0}</pre> and the {@link JSONArray} has only
13371337
* one element, then the array will be output on a single line:
13381338
* <pre>{@code [1]}</pre>
13391339
*
@@ -1355,7 +1355,7 @@ public String toString() {
13551355
* object, beginning with <code>[</code>&nbsp;<small>(left
13561356
* bracket)</small> and ending with <code>]</code>
13571357
* &nbsp;<small>(right bracket)</small>.
1358-
* @throws JSONException
1358+
* @throws JSONException if a called function fails
13591359
*/
13601360
public String toString(int indentFactor) throws JSONException {
13611361
StringWriter sw = new StringWriter();
@@ -1370,9 +1370,9 @@ public String toString(int indentFactor) throws JSONException {
13701370
* <p><b>
13711371
* Warning: This method assumes that the data structure is acyclical.
13721372
*</b>
1373-
*
1373+
* @param writer the writer object
13741374
* @return The writer.
1375-
* @throws JSONException
1375+
* @throws JSONException if a called function fails
13761376
*/
13771377
public Writer write(Writer writer) throws JSONException {
13781378
return this.write(writer, 0, 0);
@@ -1381,7 +1381,7 @@ public Writer write(Writer writer) throws JSONException {
13811381
/**
13821382
* Write the contents of the JSONArray as JSON text to a writer.
13831383
*
1384-
* <p>If <code>indentFactor > 0</code> and the {@link JSONArray} has only
1384+
* <p>If <pre>{@code indentFactor > 0}</pre> and the {@link JSONArray} has only
13851385
* one element, then the array will be output on a single line:
13861386
* <pre>{@code [1]}</pre>
13871387
*
@@ -1404,7 +1404,7 @@ public Writer write(Writer writer) throws JSONException {
14041404
* @param indent
14051405
* The indentation of the top level.
14061406
* @return The writer.
1407-
* @throws JSONException
1407+
* @throws JSONException if a called function fails or unable to write
14081408
*/
14091409
public Writer write(Writer writer, int indentFactor, int indent)
14101410
throws JSONException {

src/main/java/org/json/JSONML.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class JSONML {
4141
* if we are at the outermost level.
4242
* @param keepStrings Don't type-convert text nodes and attribute values
4343
* @return A JSONArray if the value is the outermost tag, otherwise null.
44-
* @throws JSONException
44+
* @throws JSONException if a parsing error occurs
4545
*/
4646
private static Object parse(
4747
XMLTokener x,
@@ -238,7 +238,7 @@ private static Object parse(
238238
* attributes, then the second element will be JSONObject containing the
239239
* name/value pairs. If the tag contains children, then strings and
240240
* JSONArrays will represent the child tags.
241-
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
241+
* Comments, prologs, DTDs, and <pre>{@code &lt;[ [ ]]>}</pre> are ignored.
242242
* @param string The source string.
243243
* @return A JSONArray containing the structured data from the XML string.
244244
* @throws JSONException Thrown on error converting to a JSONArray
@@ -258,7 +258,7 @@ public static JSONArray toJSONArray(String string) throws JSONException {
258258
* As opposed to toJSONArray this method does not attempt to convert
259259
* any text node or attribute value to any type
260260
* but just leaves it as a string.
261-
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
261+
* Comments, prologs, DTDs, and <pre>{@code &lt;[ [ ]]>}</pre> are ignored.
262262
* @param string The source string.
263263
* @param keepStrings If true, then values will not be coerced into boolean
264264
* or numeric values and will instead be left as strings
@@ -280,7 +280,7 @@ public static JSONArray toJSONArray(String string, boolean keepStrings) throws J
280280
* As opposed to toJSONArray this method does not attempt to convert
281281
* any text node or attribute value to any type
282282
* but just leaves it as a string.
283-
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
283+
* Comments, prologs, DTDs, and <pre>{@code &lt;[ [ ]]>}</pre> are ignored.
284284
* @param x An XMLTokener.
285285
* @param keepStrings If true, then values will not be coerced into boolean
286286
* or numeric values and will instead be left as strings
@@ -299,7 +299,7 @@ public static JSONArray toJSONArray(XMLTokener x, boolean keepStrings) throws JS
299299
* attributes, then the second element will be JSONObject containing the
300300
* name/value pairs. If the tag contains children, then strings and
301301
* JSONArrays will represent the child content and tags.
302-
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
302+
* Comments, prologs, DTDs, and <pre>{@code &lt;[ [ ]]>}</pre> are ignored.
303303
* @param x An XMLTokener.
304304
* @return A JSONArray containing the structured data from the XML string.
305305
* @throws JSONException Thrown on error converting to a JSONArray
@@ -317,7 +317,7 @@ public static JSONArray toJSONArray(XMLTokener x) throws JSONException {
317317
* contains children, the object will have a "childNodes" property which
318318
* will be an array of strings and JsonML JSONObjects.
319319
320-
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
320+
* Comments, prologs, DTDs, and <pre>{@code &lt;[ [ ]]>}</pre> are ignored.
321321
* @param string The XML source text.
322322
* @return A JSONObject containing the structured data from the XML string.
323323
* @throws JSONException Thrown on error converting to a JSONObject
@@ -335,7 +335,7 @@ public static JSONObject toJSONObject(String string) throws JSONException {
335335
* contains children, the object will have a "childNodes" property which
336336
* will be an array of strings and JsonML JSONObjects.
337337
338-
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
338+
* Comments, prologs, DTDs, and <pre>{@code &lt;[ [ ]]>}</pre> are ignored.
339339
* @param string The XML source text.
340340
* @param keepStrings If true, then values will not be coerced into boolean
341341
* or numeric values and will instead be left as strings
@@ -355,7 +355,7 @@ public static JSONObject toJSONObject(String string, boolean keepStrings) throws
355355
* contains children, the object will have a "childNodes" property which
356356
* will be an array of strings and JsonML JSONObjects.
357357
358-
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
358+
* Comments, prologs, DTDs, and <pre>{@code &lt;[ [ ]]>}</pre> are ignored.
359359
* @param x An XMLTokener of the XML source text.
360360
* @return A JSONObject containing the structured data from the XML string.
361361
* @throws JSONException Thrown on error converting to a JSONObject
@@ -373,7 +373,7 @@ public static JSONObject toJSONObject(XMLTokener x) throws JSONException {
373373
* contains children, the object will have a "childNodes" property which
374374
* will be an array of strings and JsonML JSONObjects.
375375
376-
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
376+
* Comments, prologs, DTDs, and <pre>{@code &lt;[ [ ]]>}</pre> are ignored.
377377
* @param x An XMLTokener of the XML source text.
378378
* @param keepStrings If true, then values will not be coerced into boolean
379379
* or numeric values and will instead be left as strings

src/main/java/org/json/JSONObject.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,16 +2288,16 @@ public String toString() {
22882288
/**
22892289
* Make a pretty-printed JSON text of this JSONObject.
22902290
*
2291-
* <p>If <code>indentFactor > 0</code> and the {@link JSONObject}
2291+
* <p>If <pre>{@code indentFactor > 0}</pre> and the {@link JSONObject}
22922292
* has only one key, then the object will be output on a single line:
22932293
* <pre>{@code {"key": 1}}</pre>
22942294
*
22952295
* <p>If an object has 2 or more keys, then it will be output across
2296-
* multiple lines: <code><pre>{
2296+
* multiple lines: <pre>{@code {
22972297
* "key1": 1,
22982298
* "key2": "value 2",
22992299
* "key3": 3
2300-
* }</pre></code>
2300+
* }}</pre>
23012301
* <p><b>
23022302
* Warning: This method assumes that the data structure is acyclical.
23032303
* </b>
@@ -2409,9 +2409,9 @@ public static Object wrap(Object object) {
24092409
* <p><b>
24102410
* Warning: This method assumes that the data structure is acyclical.
24112411
* </b>
2412-
*
2412+
* @param writer the writer object
24132413
* @return The writer.
2414-
* @throws JSONException
2414+
* @throws JSONException if a called function has an error
24152415
*/
24162416
public Writer write(Writer writer) throws JSONException {
24172417
return this.write(writer, 0, 0);
@@ -2470,16 +2470,16 @@ static final void indent(Writer writer, int indent) throws IOException {
24702470
/**
24712471
* Write the contents of the JSONObject as JSON text to a writer.
24722472
*
2473-
* <p>If <code>indentFactor > 0</code> and the {@link JSONObject}
2473+
* <p>If <pre>{@code indentFactor > 0}</pre> and the {@link JSONObject}
24742474
* has only one key, then the object will be output on a single line:
24752475
* <pre>{@code {"key": 1}}</pre>
24762476
*
24772477
* <p>If an object has 2 or more keys, then it will be output across
2478-
* multiple lines: <code><pre>{
2478+
* multiple lines: <pre>{@code {
24792479
* "key1": 1,
24802480
* "key2": "value 2",
24812481
* "key3": 3
2482-
* }</pre></code>
2482+
* }}</pre>
24832483
* <p><b>
24842484
* Warning: This method assumes that the data structure is acyclical.
24852485
* </b>
@@ -2491,7 +2491,8 @@ static final void indent(Writer writer, int indent) throws IOException {
24912491
* @param indent
24922492
* The indentation of the top level.
24932493
* @return The writer.
2494-
* @throws JSONException
2494+
* @throws JSONException if a called function has an error or a write error
2495+
* occurs
24952496
*/
24962497
public Writer write(Writer writer, int indentFactor, int indent)
24972498
throws JSONException {

src/main/java/org/json/JSONPointer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public static class Builder {
6868
/**
6969
* Creates a {@code JSONPointer} instance using the tokens previously set using the
7070
* {@link #append(String)} method calls.
71+
* @return a JSONPointer object
7172
*/
7273
public JSONPointer build() {
7374
return new JSONPointer(this.refTokens);
@@ -277,6 +278,7 @@ private static String escape(String token) {
277278
/**
278279
* Returns a string representing the JSONPointer path value using URI
279280
* fragment identifier representation
281+
* @return a uri fragment string
280282
*/
281283
public String toURIFragment() {
282284
try {

src/main/java/org/json/JSONWriter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public class JSONWriter {
9393

9494
/**
9595
* Make a fresh JSONWriter. It can be used to build one JSON text.
96+
* @param w an appendable object
9697
*/
9798
public JSONWriter(Appendable w) {
9899
this.comma = false;
@@ -373,7 +374,7 @@ public static String valueToString(Object value) throws JSONException {
373374
* <code>false</code>.
374375
* @param b A boolean.
375376
* @return this
376-
* @throws JSONException
377+
* @throws JSONException if a called function has an error
377378
*/
378379
public JSONWriter value(boolean b) throws JSONException {
379380
return this.append(b ? "true" : "false");
@@ -393,7 +394,7 @@ public JSONWriter value(double d) throws JSONException {
393394
* Append a long value.
394395
* @param l A long.
395396
* @return this
396-
* @throws JSONException
397+
* @throws JSONException if a called function has an error
397398
*/
398399
public JSONWriter value(long l) throws JSONException {
399400
return this.append(Long.toString(l));

0 commit comments

Comments
 (0)