Commit 544e5d72 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #332 in ZP/z-push from...

Merge pull request #332 in ZP/z-push from bugfix/ZP-1007-wbxml-in-not-logged-if-requesthandler--handle to develop

* commit '58517e5b':
  ZP-1007 Changed wbxml debug output to FATAL loglevel.
  ZP-1007 Always log Wbxml debug data in case there is an error during RequestHandler->Handle().

Conflicts:
	src/lib/request/requestprocessor.php
parent 324cd15b
...@@ -269,7 +269,7 @@ include_once('version.php'); ...@@ -269,7 +269,7 @@ include_once('version.php');
// This could be a WBXML problem.. try to get the complete request // This could be a WBXML problem.. try to get the complete request
else if ($ex instanceof WBXMLException) { else if ($ex instanceof WBXMLException) {
ZLog::Write(LOGLEVEL_FATAL, "Request could not be processed correctly due to a WBXMLException. Please report this including WBXML debug data logged. Be aware that the debug data could contain confidential information."); ZLog::Write(LOGLEVEL_FATAL, "Request could not be processed correctly due to a WBXMLException. Please report this including the 'WBXML debug data' logged. Be aware that the debug data could contain confidential information.");
} }
// Try to output some kind of error information. This is only possible if // Try to output some kind of error information. This is only possible if
...@@ -296,4 +296,4 @@ include_once('version.php'); ...@@ -296,4 +296,4 @@ include_once('version.php');
// end gracefully // end gracefully
ZLog::WriteEnd(); ZLog::WriteEnd();
?> ?>
\ No newline at end of file
...@@ -128,13 +128,19 @@ abstract class RequestProcessor { ...@@ -128,13 +128,19 @@ abstract class RequestProcessor {
$handler = ZPush::GetRequestHandlerForCommand(Request::GetCommandCode()); $handler = ZPush::GetRequestHandlerForCommand(Request::GetCommandCode());
// if there is an error decoding wbxml, consume remaining data and include it in the WBXMLException // if there is an error decoding wbxml, consume remaining data and include it in the WBXMLException
if (!$handler->Handle(Request::GetCommandCode())) { try {
if (!$handler->Handle(Request::GetCommandCode())) {
throw new WBXMLException(sprintf("Unknown error in %s->Handle()", get_class($handler)));
}
}
catch (Exception $ex) {
$wbxmlLog = "no decoder"; $wbxmlLog = "no decoder";
if (self::$decoder) { if (self::$decoder) {
self::$decoder->readRemainingData(); self::$decoder->readRemainingData();
$wbxmlLog = self::$decoder->getWBXMLLog(); $wbxmlLog = self::$decoder->getWBXMLLog();
} }
throw new WBXMLException("Debug data: " . $wbxmlLog); ZLog::Write(LOGLEVEL_FATAL, "WBXML debug data: " . $wbxmlLog, false);
throw $ex;
} }
// also log WBXML in happy case // also log WBXML in happy case
...@@ -166,4 +172,4 @@ abstract class RequestProcessor { ...@@ -166,4 +172,4 @@ abstract class RequestProcessor {
*/ */
abstract public function Handle($commandCode); abstract public function Handle($commandCode);
} }
?> ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment