1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93 | package Torello.Java.JSON;
import javax.json.*;
import static javax.json.JsonValue.ValueType.*;
/**
* Used to indicate that a specific {@link JsonString} within a {@link JsonObject} or
* {@link JsonArray} was not properly parsed into a target <B STYLE='color: red'>Java-Type</B>.
*
* <EMBED CLASS=globalDefs DATA-STRUCT=JsonArray DATA-TYPE=Array DATA-TYPE_ABBREV=Arr>
* <EMBED CLASS='external-html' DATA-FILE-ID=JE_FIELD_ARR>
* <EMBED CLASS='external-html' DATA-FILE-ID=JE_MSG>
* <EMBED CLASS='external-html' DATA-FILE-ID=JE_MSG_JSPAEX>
*/
@Torello.JavaDoc.JDHeaderBackgroundImg(EmbedTagFileID="JE_SP_UL")
@Torello.JavaDoc.CSSLinks(FileNames="JSONExceptions.css")
public class JsonStrParseArrException extends JsonBindingArrException
{
/** <EMBED CLASS='external-html' DATA-FILE-ID=SVUIDEX> */
public static final long serialVersionUID = 1;
/**
* <EMBED CLASS='external-html' DATA-FILE-ID=EXPF>
*
* <BR /><BR />The {@code String} that couldn't be properly parsed, and has caused this
* exception throw.
*/
public final String s;
// This *SHOULD NOT* be necessary, but there is nothing worse than throwing another exception
// when building an exception. Just in case...
private static String CONVERT(JsonValue v)
{
return (v.getValueType() != JsonValue.ValueType.STRING)
? null
: ((JsonString) v).getString();
}
/**
* Constructs a {@code JsonStrParseArrException} with no specified detail messsage,
* and the user-provided convenience-field values.
*
* @param cause The exception thrown by the user-provided {@code 'parser'}
* @param errorSourceJsonArray <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_ESJA>
* @param index <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_I>
* @param valueRetrieved <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_VR>
* @param methodReturnJavaType <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_MRJT>
*/
public JsonStrParseArrException(
Throwable cause,
JsonArray errorSourceJsonArray,
int index,
JsonValue valueRetrieved,
Class<?> methodReturnJavaType
)
{
super(
cause, errorSourceJsonArray, index, STRING, valueRetrieved,
methodReturnJavaType,
"The User-Provided Parser threw an Exception while attempting to parse / transform " +
"a Json-String"
);
this.s = CONVERT(valueRetrieved);
}
/**
* Constructs a {@code JsonStrParseArrException} with the specified detail message, and
* user-provided convenience-field values.
*
* @param message the detail message.
* @param cause The exception thrown by the user-provided {@code 'parser'}
* @param errorSourceJsonArray <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_ESJA>
* @param index <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_I>
* @param valueRetrieved <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_VR>
* @param methodReturnJavaType <EMBED CLASS='external-html' DATA-FILE-ID=JBEX_MRJT>
*/
public JsonStrParseArrException(
String message,
Throwable cause,
JsonArray errorSourceJsonArray,
int index,
JsonValue valueRetrieved,
Class<?> methodReturnJavaType
)
{
super(
message, cause, errorSourceJsonArray, index, STRING, valueRetrieved,
methodReturnJavaType
);
this.s = CONVERT(valueRetrieved);
}
}
|