| 1 | package net.minecraft.client.util;
|
| 2 |
|
| 3 | import com.google.common.collect.Lists;
|
| 4 | import java.io.FileNotFoundException;
|
| 5 | import java.io.IOException;
|
| 6 | import java.util.List;
|
| 7 | import org.apache.commons.lang3.StringUtils;
|
| 8 |
|
| 9 | public class JsonException extends IOException
|
| 10 | {
|
| 11 | private final List<JsonException.Entry> field_151383_a = Lists.<JsonException.Entry>newArrayList();
|
| 12 | private final String exceptionMessage;
|
| 13 |
|
| 14 | public JsonException(String message)
|
| 15 | {
|
| 16 | this.field_151383_a.add(new JsonException.Entry());
|
| 17 | this.exceptionMessage = message;
|
| 18 | }
|
| 19 |
|
| 20 | public JsonException(String message, Throwable cause)
|
| 21 | {
|
| 22 | super(cause);
|
| 23 | this.field_151383_a.add(new JsonException.Entry());
|
| 24 | this.exceptionMessage = message;
|
| 25 | }
|
| 26 |
|
| 27 | public void func_151380_a(String p_151380_1_)
|
| 28 | {
|
| 29 | ((JsonException.Entry)this.field_151383_a.get(0)).func_151373_a(p_151380_1_);
|
| 30 | }
|
| 31 |
|
| 32 | public void func_151381_b(String p_151381_1_)
|
| 33 | {
|
| 34 | ((JsonException.Entry)this.field_151383_a.get(0)).field_151376_a = p_151381_1_;
|
| 35 | this.field_151383_a.add(0, new JsonException.Entry());
|
| 36 | }
|
| 37 |
|
| 38 | public String getMessage()
|
| 39 | {
|
| 40 | return "Invalid " + ((JsonException.Entry)this.field_151383_a.get(this.field_151383_a.size() - 1)).toString() + ": " + this.exceptionMessage;
|
| 41 | }
|
| 42 |
|
| 43 | public static JsonException func_151379_a(Exception p_151379_0_)
|
| 44 | {
|
| 45 | if (p_151379_0_ instanceof JsonException)
|
| 46 | {
|
| 47 | return (JsonException)p_151379_0_;
|
| 48 | }
|
| 49 | else
|
| 50 | {
|
| 51 | String s = p_151379_0_.getMessage();
|
| 52 |
|
| 53 | if (p_151379_0_ instanceof FileNotFoundException)
|
| 54 | {
|
| 55 | s = "File not found";
|
| 56 | }
|
| 57 |
|
| 58 | return new JsonException(s, p_151379_0_);
|
| 59 | }
|
| 60 | }
|
| 61 |
|
| 62 | public static class Entry
|
| 63 | {
|
| 64 | private String field_151376_a;
|
| 65 | private final List<String> field_151375_b;
|
| 66 |
|
| 67 | private Entry()
|
| 68 | {
|
| 69 | this.field_151376_a = null;
|
| 70 | this.field_151375_b = Lists.<String>newArrayList();
|
| 71 | }
|
| 72 |
|
| 73 | private void func_151373_a(String p_151373_1_)
|
| 74 | {
|
| 75 | this.field_151375_b.add(0, p_151373_1_);
|
| 76 | }
|
| 77 |
|
| 78 | public String func_151372_b()
|
| 79 | {
|
| 80 | return StringUtils.join((Iterable)this.field_151375_b, "->");
|
| 81 | }
|
| 82 |
|
| 83 | public String toString()
|
| 84 | {
|
| 85 | return this.field_151376_a != null ? (!this.field_151375_b.isEmpty() ? this.field_151376_a + " " + this.func_151372_b() : this.field_151376_a) : (!this.field_151375_b.isEmpty() ? "(Unknown file) " + this.func_151372_b() : "(Unknown file)");
|
| 86 | }
|
| 87 | }
|
| 88 | }
|
| 89 |
|