| 1 | package com.github.dakusui.json; | |
| 2 | ||
| 3 | import com.google.gson.JsonElement; | |
| 4 | ||
| 5 | import java.io.Serial; | |
| 6 | import java.util.Arrays; | |
| 7 | ||
| 8 | public class JsonInvalidPathException extends JsonException { | |
| 9 | /** | |
| 10 | * A serial version UID string. | |
| 11 | */ | |
| 12 | @Serial | |
| 13 | private static final long serialVersionUID = 7832147182391783569L; | |
| 14 | ||
| 15 | protected String formatMessage(JsonElement base, Object[] path) { | |
| 16 |
1
1. formatMessage : replaced return value with "" for com/github/dakusui/json/JsonInvalidPathException::formatMessage → KILLED |
return String.format("This element (%s) doesn't have path: %s", JsonSummarizer.focusedElement(base), Arrays.toString(path)); |
| 17 | } | |
| 18 | | |
| 19 | private final JsonElement base; | |
| 20 | ||
| 21 | private final Object[] path; | |
| 22 | ||
| 23 | private final int index; | |
| 24 | ||
| 25 | private final String message; | |
| 26 | ||
| 27 | public JsonInvalidPathException(JsonElement base, Object[] path, int index) { | |
| 28 | super(base); | |
| 29 | this.message = formatMessage(base, path); | |
| 30 | this.base = base; | |
| 31 | this.path = path; | |
| 32 | this.index = index; | |
| 33 | } | |
| 34 | ||
| 35 | public JsonInvalidPathException(JsonElement base, Object[] path) { | |
| 36 | this(base, path, 0); | |
| 37 | } | |
| 38 | ||
| 39 | public JsonElement getProblemCausingNode() { | |
| 40 |
1
1. getProblemCausingNode : replaced return value with null for com/github/dakusui/json/JsonInvalidPathException::getProblemCausingNode → KILLED |
return base; |
| 41 | } | |
| 42 | ||
| 43 | public Object[] getPath() { | |
| 44 |
1
1. getPath : replaced return value with null for com/github/dakusui/json/JsonInvalidPathException::getPath → KILLED |
return path; |
| 45 | } | |
| 46 | ||
| 47 | public int getIndex() { | |
| 48 |
1
1. getIndex : replaced int return with 0 for com/github/dakusui/json/JsonInvalidPathException::getIndex → KILLED |
return this.index; |
| 49 | } | |
| 50 | ||
| 51 | @Override | |
| 52 | public String getMessage() { | |
| 53 |
1
1. getMessage : replaced return value with "" for com/github/dakusui/json/JsonInvalidPathException::getMessage → KILLED |
return this.message; |
| 54 | } | |
| 55 | ||
| 56 | } | |
Mutations | ||
| 16 |
1.1 |
|
| 40 |
1.1 |
|
| 44 |
1.1 |
|
| 48 |
1.1 |
|
| 53 |
1.1 |