synapse-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raji...@apache.org
Subject svn commit: r1035540 - /synapse/branches/2.0/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java
Date Tue, 16 Nov 2010 06:10:09 GMT
Author: rajikak
Date: Tue Nov 16 06:10:09 2010
New Revision: 1035540

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

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

Modified: synapse/branches/2.0/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java
URL: http://svn.apache.org/viewvc/synapse/branches/2.0/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java?rev=1035540&r1=1035539&r2=1035540&view=diff
==============================================================================
--- synapse/branches/2.0/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java
(original)
+++ synapse/branches/2.0/modules/core/src/main/java/org/apache/synapse/aspects/statistics/StatisticsReporter.java
Tue Nov 16 06:10:09 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,12 @@ 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 +161,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 +217,12 @@ 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;



Mime
View raw message