Beispiel #1
0
 /**
  * When serialized, we eagerly convert sources to strings. This hurts our formatting, but it
  * guarantees that the receiving end will be able to read the message.
  */
 private Object writeReplace() throws ObjectStreamException {
   Object[] sourcesAsStrings = sources.toArray();
   for (int i = 0; i < sourcesAsStrings.length; i++) {
     sourcesAsStrings[i] = Errors.convert(sourcesAsStrings[i]).toString();
   }
   return new Message(Arrays.asList(sourcesAsStrings), message, cause);
 }
Beispiel #2
0
 @Override
 public String getSource() {
   return sources.isEmpty()
       ? SourceProvider.UNKNOWN_SOURCE.toString()
       : Errors.convert(sources.get(sources.size() - 1)).toString();
 }