Revision: 4865
http://sourceforge.net/p/vexi/code/4865
Author: clrg
Date: 2016-06-20 16:12:30 +0000 (Mon, 20 Jun 2016)
Log Message:
-----------
Minor. Make debug logging logic only occur during debug logging.
Modified Paths:
--------------
branches/vexi3/org.vexi-library.js/src/main/jpp/org/ibex/js/XMLRPC.jpp
Modified: branches/vexi3/org.vexi-library.js/src/main/jpp/org/ibex/js/XMLRPC.jpp
===================================================================
--- branches/vexi3/org.vexi-library.js/src/main/jpp/org/ibex/js/XMLRPC.jpp
2016-06-20 15:57:09 UTC (rev 4864)
+++ branches/vexi3/org.vexi-library.js/src/main/jpp/org/ibex/js/XMLRPC.jpp
2016-06-20 16:12:30 UTC (rev 4865)
@@ -376,21 +376,20 @@
if (logger.isDebug()) logger.debug(LOG_TYPE, "send:\n" + request);
InputStream is = http.POST("text/xml",
request.getBytes(encoding)).body;
try {
- if(logger.isDebug() || true){
- ByteArrayOutputStream baos = new
ByteArrayOutputStream();
- IOUtil.pipe(is, baos);
- byte[] xmlBytes = baos.toByteArray();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ IOUtil.pipe(is, baos);
+ byte[] xmlBytes = baos.toByteArray();
+ if (logger.isDebug()) {
logger.debug(LOG_TYPE, "received:");
// REMARK this is far from ideal
- try{
+ try {
logger.debug(LOG_TYPE, prettyPrint(xmlBytes));
- }catch(Throwable t){
+ } catch(Throwable t){
logger.debug(LOG_TYPE, "Xml response not formatted
because: "+t.getClass().getSimpleName()+": "+t.getMessage());
logger.debug(LOG_TYPE, new String(xmlBytes,"UTF-8"));
}
-
- is = new ByteArrayInputStream(xmlBytes);
}
+ is = new ByteArrayInputStream(xmlBytes);
new Helper().parse(is);
@@ -422,13 +421,13 @@
// is not ideal, but formatting the xmlrpc responses is not
// core functionality and this way is convenient and small.
public String prettyPrint(byte[] xml) throws Exception {
- Transformer serializer=
SAXTransformerFactory.newInstance().newTransformer();
+ Transformer serializer =
SAXTransformerFactory.newInstance().newTransformer();
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
//serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
//serializer.setOutputProperty("{http://xml.customer.org/xslt}indent-amount",
"2");
- Source xmlSource=new SAXSource(new InputSource(new
ByteArrayInputStream(xml)));
- StreamResult res = new StreamResult(new ByteArrayOutputStream());
+ Source xmlSource = new SAXSource(new InputSource(new
ByteArrayInputStream(xml)));
+ StreamResult res = new StreamResult(new ByteArrayOutputStream());
serializer.transform(xmlSource, res);
return new
String(((ByteArrayOutputStream)res.getOutputStream()).toByteArray());
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://sdm.link/zohomanageengine
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn