Revision 529e3037
ref #6636: IOResultBase needs to implement Serializable
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/IoResultBase.java | ||
---|---|---|
19 | 19 |
* @date 24.03.2017 |
20 | 20 |
* |
21 | 21 |
*/ |
22 |
public abstract class IoResultBase { |
|
22 |
public abstract class IoResultBase implements Serializable{
|
|
23 | 23 |
|
24 |
private static final long serialVersionUID = -2077936463767046918L; |
|
24 | 25 |
private List<IoInfo> errors = new ArrayList<>(); |
25 | 26 |
private List<IoInfo> warnings = new ArrayList<>(); |
26 | 27 |
private List<IoInfo> exceptions = new ArrayList<>(); |
27 | 28 |
|
28 | 29 |
public class IoInfo implements Serializable{ |
30 |
private static final long serialVersionUID = -8077358746590123757L; |
|
29 | 31 |
String message; |
30 | 32 |
Exception exception; |
31 | 33 |
String location; |
... | ... | |
48 | 50 |
} |
49 | 51 |
} |
50 | 52 |
|
53 |
|
|
54 |
|
|
51 | 55 |
// ************* GETTERS / SETTERS / ADDERS ***********************/ |
52 | 56 |
|
53 | 57 |
public List<IoInfo> getErrors() {return errors;} |
... | ... | |
70 | 74 |
public void addWarning(String warning) { |
71 | 75 |
// warnings.add(warning.getBytes(StandardCharsets.UTF_8)); |
72 | 76 |
warnings.add(new IoInfo(warning, null)); |
77 |
|
|
73 | 78 |
} |
74 | 79 |
public void addWarning(String message, int location) { |
75 | 80 |
warnings.add(new IoInfo(message, null, String.valueOf(location))); |
... | ... | |
142 | 147 |
for (IoInfo ioInfo : list){ |
143 | 148 |
String location = ioInfo.location == null ? "" : (ioInfo.location + ": "); |
144 | 149 |
String message = ioInfo.message != null ? ioInfo.message : ioInfo.exception != null ? ioInfo.exception.getMessage() : ""; |
150 |
|
|
145 | 151 |
message = StringUtils.isBlank(message)? "no message" : message; |
146 |
Object stacktrace = ioInfo.exception == null? null : ioInfo.exception.getStackTrace();
|
|
152 |
Object stacktrace = ioInfo.exception == null? null : ioInfo.exception.getStackTrace(); |
|
147 | 153 |
String available = (stacktrace != null ? " (stacktrace available)" : ""); |
148 | 154 |
report.append("\n" + location + message + available); |
149 | 155 |
} |
Also available in: Unified diff