1 16 package com.google.gwt.xml.client.impl; 17 18 import com.google.gwt.xml.client.DOMException; 19 20 23 public class DOMParseException extends DOMException { 24 25 28 private static final int MAX_SUMMARY_LENGTH = 128; 29 30 static String summarize(String text) { 31 return text.substring(0, Math.min(text.length(), MAX_SUMMARY_LENGTH)); 32 } 33 34 private String contents; 35 36 public DOMParseException() { 37 super(DOMException.SYNTAX_ERR, "Parse error"); 38 } 39 40 public DOMParseException(String contents) { 41 super(DOMException.SYNTAX_ERR, "Failed to parse: " + summarize(contents)); 42 this.contents = contents; 43 } 44 45 public DOMParseException(String contents, Throwable e) { 46 super(DOMException.SYNTAX_ERR, "Failed to parse: " + summarize(contents)); 47 initCause(e); 48 this.contents = contents; 49 } 50 51 public String getContents() { 52 return contents; 53 } 54 } 55 | Popular Tags |