0
私はJava meのプログラムを作成しています。jsonへの例外 - JavaME
とにかく私はjson形式で捕捉されたJava例外を書くことができますか?どうやってやるの?私が考慮すべきことは何ですか?ありがとう!
それはこのよう...
catch (IOException e) {
String IOExceptionMsg =
"description:Warn exception: OSError. Exc_type: :Caught IOException:" +
e.toString() + ",filename: " + imageName;
out.write(IOExceptionMsg.getBytes())
}
catch (Exception e) {
String Exception =
"description: Unknown Error:Caught Exception:" + e.toString() +
",filename:" + imageName;
out.write(Exception.getBytes());
out.flush();
}
なります私はthis..HowのようなJSON形式を持って、私はそれらを一緒に置くのですか?
`public String toJSON()
{
final String
IMAGENAME = imageName,
description = "",
filename = imageName;
JSONObject outer = new JSONObject();
JSONObject inner = new JSONObject();
try {
outer.put(IMAGENAME, inner);
// Values are added to the JSONObject in pairs, label then value
inner.put(description, description);
inner.put(filename, imageName);
} catch (JSONException ex) {
ex.printStackTrace();
}
return outer.toString();
}`
3つの異なるタイプの例外がある場合はどうなりますか?ファイル名と例外をどのように一致させるのですか? – JohnDoe4136
check update .............. –
上記のコードはjson形式ではありません。どうすればJSONトレースにスローすることができますか? – JohnDoe4136