1 2 4 package org.xmlpull.v1; 5 6 11 public class XmlPullParserException extends Exception { 12 protected Throwable detail; 13 protected int row = -1; 14 protected int column = -1; 15 16 18 19 public XmlPullParserException(String s) { 20 super(s); 21 } 22 23 35 36 public XmlPullParserException(String msg, XmlPullParser parser, Throwable chain) { 37 super ((msg == null ? "" : msg+" ") 38 + (parser == null ? "" : "(position:"+parser.getPositionDescription()+") ") 39 + (chain == null ? "" : "caused by: "+chain)); 40 41 if (parser != null) { 42 this.row = parser.getLineNumber(); 43 this.column = parser.getColumnNumber(); 44 } 45 this.detail = chain; 46 } 47 48 public Throwable getDetail() { return detail; } 49 public int getLineNumber() { return row; } 51 public int getColumnNumber() { return column; } 52 53 62 63 public void printStackTrace() { 65 if (detail == null) { 66 super.printStackTrace(); 67 } else { 68 synchronized(System.err) { 69 System.err.println(super.getMessage() + "; nested exception is:"); 70 detail.printStackTrace(); 71 } 72 } 73 } 74 75 } 76 77 | Popular Tags |