Author: rajikak
Date: Tue Nov 16 06:10:26 2010
New Revision: 1035541

URL: http://svn.apache.org/viewvc?rev=1035541&view=rev
Log:
Fixed class cast exception.

Modified:
    
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java

Modified: 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java?rev=1035541&r1=1035540&r2=1035541&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java
 (original)
+++ 
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java
 Tue Nov 16 06:10:26 2010
@@ -58,8 +58,10 @@ public class StatisticsReporter {
             return;
         }
 
-        StatisticsRecord record =
-                (StatisticsRecord) 
synCtx.getProperty(SynapseConstants.STATISTICS_STACK);
+        StatisticsRecord record = null;
+        if(synCtx.getProperty(SynapseConstants.STATISTICS_STACK) instanceof 
StatisticsRecord){
+            record =  (StatisticsRecord) 
synCtx.getProperty(SynapseConstants.STATISTICS_STACK);
+        }
         if (record == null) {
 
             if (log.isDebugEnabled()) {
@@ -87,8 +89,12 @@ public class StatisticsReporter {
         synCtx.setProperty(SynapseConstants.SENDING_REQUEST, false);
 
         //  if there is a statistics record
-        StatisticsRecord statisticsRecord =
-                (StatisticsRecord) 
synCtx.getProperty(SynapseConstants.STATISTICS_STACK);
+        StatisticsRecord statisticsRecord = null;
+        if (synCtx.getProperty(SynapseConstants.STATISTICS_STACK) instanceof 
StatisticsRecord) {
+            statisticsRecord = (StatisticsRecord) synCtx.getProperty(
+                    SynapseConstants.STATISTICS_STACK);
+        }
+
         if (statisticsRecord != null) {
 
             if (log.isDebugEnabled()) {
@@ -113,8 +119,11 @@ public class StatisticsReporter {
      */
     public static void reportFaultForAll(MessageContext synCtx, ErrorLog 
errorLog) {
 
-        StatisticsRecord statisticsRecord =
-                (StatisticsRecord) 
synCtx.getProperty(SynapseConstants.STATISTICS_STACK);
+        StatisticsRecord statisticsRecord = null;
+        if (synCtx.getProperty(SynapseConstants.STATISTICS_STACK) instanceof 
StatisticsRecord) {
+            statisticsRecord = (StatisticsRecord) synCtx.getProperty(
+                    SynapseConstants.STATISTICS_STACK);
+        }
         if (statisticsRecord != null) {
 
             if (log.isDebugEnabled()) {
@@ -151,8 +160,10 @@ public class StatisticsReporter {
      */
     private static void endReportForAll(MessageContext synCtx) {
 
-        StatisticsRecord record =
-                (StatisticsRecord) 
synCtx.getProperty(SynapseConstants.STATISTICS_STACK);
+        StatisticsRecord record = null;
+        if(synCtx.getProperty(SynapseConstants.STATISTICS_STACK) instanceof 
StatisticsRecord){
+            record =  (StatisticsRecord) 
synCtx.getProperty(SynapseConstants.STATISTICS_STACK);
+        }
         if (record == null) {
             //There is no statistics record.
             return;
@@ -205,8 +216,11 @@ public class StatisticsReporter {
      */
     public static void endReportForAllOnRequestProcessed(MessageContext 
synCtx) {
 
-        StatisticsRecord statisticsRecord =
-                (StatisticsRecord) 
synCtx.getProperty(SynapseConstants.STATISTICS_STACK);
+        StatisticsRecord statisticsRecord = null;
+        if (synCtx.getProperty(SynapseConstants.STATISTICS_STACK) instanceof 
StatisticsRecord) {
+            statisticsRecord = (StatisticsRecord) synCtx.getProperty(
+                    SynapseConstants.STATISTICS_STACK);
+        }
         if (statisticsRecord == null) {
             //There is no statistics record.
             return;


Reply via email to