1 package org.codehaus.plexus.interpolation.object;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.io.PrintWriter;
20 import java.io.StringWriter;
21
22
23
24
25
26
27
28
29
30
31 public class ObjectInterpolationWarning {
32
33 private final String message;
34 private Throwable cause;
35 private final String path;
36
37 public ObjectInterpolationWarning(String path, String message) {
38 this.path = path;
39 this.message = message;
40 }
41
42 public ObjectInterpolationWarning(String path, String message, Throwable cause) {
43 this.path = path;
44 this.message = message;
45 this.cause = cause;
46 }
47
48 public String getPath() {
49 return path;
50 }
51
52 public String getMessage() {
53 return message;
54 }
55
56 public Throwable getCause() {
57 return cause;
58 }
59
60 public String toString() {
61 if (cause == null) {
62 return path + ": " + message;
63 } else {
64 StringWriter w = new StringWriter();
65 PrintWriter pw = new PrintWriter(w);
66
67 pw.print(path);
68 pw.print(": ");
69 pw.println(message);
70 pw.println("Cause: ");
71 cause.printStackTrace(pw);
72
73 return w.toString();
74 }
75 }
76 }