下面列出了org.xml.sax.SAXParseException#printStackTrace ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void fatalError(SAXParseException exception) {
if (this.env.isVerbose()) {
exception.printStackTrace();
} else {
System.err.println("Parsing schema fatal error: \n" + exception.toString());
}
}
public void error(SAXParseException e) {
if(debug)
e.printStackTrace();
hasError = true;
if((e.getSystemId() == null && e.getPublicId() == null) && (e.getCause() instanceof UnknownHostException)) {
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.toString()), e);
} else {
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e);
}
}
public void error(SAXParseException e) {
if(debug)
e.printStackTrace();
hasError = true;
if((e.getSystemId() == null && e.getPublicId() == null) && (e.getCause() instanceof UnknownHostException)) {
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.toString()), e);
} else {
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e);
}
}
/**
* Test for GET request
*/
@Test
public void testGetResponseFormat() {
// show test UI for 'customers/{customerId}' resource
tc.expand("customers"); //NOI18N
tc.clickOn("customerId"); //NOI18N
// GET and application/xml should be selected by default - let's check it
// XXX - should the default mime be app/json? IZ #156896
assertEquals("GET", tc.getSelectedRMethod()); //NOI18N
assertEquals("application/xml", tc.getSelectedMIMEType()); //NOI18N
//should have three options:
// GET, PUT, DELETE
assertEquals(3, tc.getAvailableRMethods().length);
// set an ID of a customer
tc.setTestArg("resourceId", "1"); //NOI18N
tc.doTest();
String s = tc.getContentFromView("raw"); //NOI18N
try {
Utils.readXml(s);
} catch (SAXParseException se) {
se.printStackTrace(System.err);
fail("invalid xml response [" + s + "]"); //NOI18N
}
// check app/json response format
tc.setSelectedMIMEType("application/json"); //NOI18N
assertEquals("application/json", tc.getSelectedMIMEType()); //NOI18N
tc.doTest();
s = tc.getContentFromView("raw"); //NOI18N
try {
JSONObject json = new JSONObject(s);
} catch (JSONException ex) {
ex.printStackTrace(System.err);
fail("invalid JSON string: [" + s + "]"); //NOI18N
}
}
public void fatalError(SAXParseException e) {
if(debug)
e.printStackTrace();
hasError = true;
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e);
}
public void fatalError(SAXParseException e) {
if(debug)
e.printStackTrace();
hasError = true;
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e);
}
public void warning(SAXParseException e) {
e.printStackTrace();
}
@Override
public void fatalError(SAXParseException e) throws SAXException {
Log.error("Error parsing Spawn config file: " + e.getMessage());
e.printStackTrace();
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void warning(SAXParseException e) throws SAXException {
e.printStackTrace();
}
public void fatalError(SAXParseException e) {
if(debug)
e.printStackTrace();
hasError = true;
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e);
}
@Override
public void warning(final SAXParseException exception) throws SAXException {
System.err.println(header);
exception.printStackTrace(System.err);
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void warning(SAXParseException e) throws SAXException {
e.printStackTrace();
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void error(SAXParseException e) throws SAXException {
e.printStackTrace();
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void fatalError(SAXParseException e) throws SAXException {
e.printStackTrace();
super.fatalError(e);
}
public void fatalError(SAXParseException e) {
e.printStackTrace();
}
private void printDetail(SAXParseException e) {
if(debug) {
e.printStackTrace(System.out);
}
}
public static void main (String[] args) {
try {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File(args[0]));
doc.getDocumentElement ().normalize ();
NodeList listOfTestResults = doc.getElementsByTagName("TestResult");
String testPath = "";
String message = "";
StringBuffer resultSummary = new StringBuffer();
for(int s=0; s<listOfTestResults.getLength() ; s++) {
Node aResult = listOfTestResults.item(s);
if(aResult.getNodeType() == Node.ELEMENT_NODE) {
Element aResultElement = (Element) aResult;
testPath = aResultElement.getAttribute("url");
NodeList ns = aResultElement.getElementsByTagName("ResultProperties");
if ( ns != null) {
Node resultPropertiesNode = ns.item(0);
if (resultPropertiesNode != null) {
if(resultPropertiesNode.getNodeType() == Node.ELEMENT_NODE) {
Element aResultPropertiesElement = (Element) resultPropertiesNode;
NodeList properties = aResultPropertiesElement.getElementsByTagName("Property");
for (int i = 0 ; i < properties.getLength(); i++) {
Node aProperty = properties.item(i);
if(aProperty.getNodeType() == Node.ELEMENT_NODE) {
Element aPropertyElement = (Element) aProperty;
String name = aPropertyElement.getAttribute("name");
if ( name != null && name.equals("execStatus")) {
message = aPropertyElement.getAttribute("value");
resultSummary.append(testPath + " " + message + "\n");
break;
}
}
}
}
}
}
}
}
FileWriter fw = new FileWriter(new File("summary.txt"));
fw.write(resultSummary.toString());
fw.close();
System.out.println(resultSummary.toString());
} catch (SAXParseException err) {
System.out.println ("Error processing XML JCK output report" + err.getMessage ());
err.printStackTrace();
}catch (SAXException e) {
System.out.println ("Error processing XML JCK output report" + e.getMessage ());
e.printStackTrace();
}catch (Throwable t) {
t.printStackTrace ();
}
}
@Override
public void warning(SAXParseException exception) {
System.out.println("WARN");
exception.printStackTrace();
}
public void error(SAXParseException e) {
e.printStackTrace();
}
@SuppressWarnings(value = "CallToThreadDumpStack")
@Override
public void fatalError(SAXParseException e) throws SAXException {
e.printStackTrace();
super.fatalError(e);
}