Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ((parserFailureConditions != null)
- && (parserFailureConditions.length != 0)) {
- numberOfParserFailureConditions = getNumberOfFailureConditions(parserFailureConditions[0]);
- }
- /*
- * As the the passed array holds JSON String at first location,
- * this method initialize the 'number_failureConditions' based on no. of JSON elements.
- */
- public int getNumberOfFailureConditions(String condition) {
- int number_failureConditions = 0;
- if ((condition != null) && (condition.startsWith("["))) {
- try {
- JSONArray temp_object_array = new JSONArray(condition);
- for (int i = 0; i < temp_object_array.length(); i++) {
- number_failureConditions++;
- }
- } catch (JSONException ex) {
- System.out.println("Could not create JSONArray");
- }
- } else if ((condition != null) && (condition.startsWith("{"))) {
- for (@SuppressWarnings("unused")
- String retval : condition.split("}")) {
- if (number_failureConditions < 50) {
- number_failureConditions++;
- }
- }
- } else {
- if (condition != null) {
- System.out.println("Invalid condition");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement