qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Moravec (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPID-4177) Writing wrong filter in a QMF method causes the filter is ignored
Date Tue, 07 Aug 2012 13:35:08 GMT

    [ https://issues.apache.org/jira/browse/QPID-4177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13430348#comment-13430348
] 

Pavel Moravec commented on QPID-4177:
-------------------------------------

Preliminary patch that does not resolve adjacent problem when 0 messages matching a filter
cause "invalid parameter" error, though the filter is a valid parameter:


diff -rup _qpid-0.14-orig/cpp/src/qpid/broker/Queue.cpp _qpid-0.14-new/cpp/src/qpid/broker/Queue.cpp
--- _qpid-0.14-orig/cpp/src/qpid/broker/Queue.cpp	2012-08-01 20:03:04.337170947 +0200
+++ _qpid-0.14-new/cpp/src/qpid/broker/Queue.cpp	2012-08-07 14:17:38.705071078 +0200
@@ -623,6 +623,8 @@ uint32_t Queue::purge(const uint32_t pur
                       const qpid::types::Variant::Map *filter)
 {
     std::auto_ptr<MessageFilter> mf(MessageFilter::create(filter));
+    if (typeid(*mf.get()) == typeid(MessageFilter))
+        return 0;
     Collector c(*mf.get(), purge_request);
 
     Mutex::ScopedLock locker(messageLock);
@@ -646,6 +648,8 @@ uint32_t Queue::move(const Queue::shared
                      const qpid::types::Variant::Map *filter)
 {
     std::auto_ptr<MessageFilter> mf(MessageFilter::create(filter));
+    if (typeid(*mf.get()) == typeid(MessageFilter))
+        return 0;
     Collector c(*mf.get(), qty);
 
     Mutex::ScopedLock locker(messageLock);
@@ -1295,8 +1299,12 @@ Manageable::status_t Queue::ManagementMe
     case _qmf::Queue::METHOD_PURGE :
         {
             _qmf::ArgsQueuePurge& purgeArgs = (_qmf::ArgsQueuePurge&) args;
-            purge(purgeArgs.i_request, boost::shared_ptr<Exchange>(), &purgeArgs.i_filter);
-            status = Manageable::STATUS_OK;
+            if (purge(purgeArgs.i_request, boost::shared_ptr<Exchange>(), &purgeArgs.i_filter))
+                status = Manageable::STATUS_OK;
+	    else {
+	        status = Manageable::STATUS_PARAMETER_INVALID;
+	        etext = "Wrong filter syntax";
+	    }
         }
         break;
 
@@ -1316,8 +1324,12 @@ Manageable::status_t Queue::ManagementMe
                 }
             }
 
-            purge(rerouteArgs.i_request, dest, &rerouteArgs.i_filter);
-            status = Manageable::STATUS_OK;
+            if (purge(rerouteArgs.i_request, dest, &rerouteArgs.i_filter))
+                status = Manageable::STATUS_OK;
+	    else {
+	        status = Manageable::STATUS_PARAMETER_INVALID;
+		etext = "Wrong filter syntax";
+	    }
         }
         break;
     }

                
> Writing wrong filter in a QMF method causes the filter is ignored
> -----------------------------------------------------------------
>
>                 Key: QPID-4177
>                 URL: https://issues.apache.org/jira/browse/QPID-4177
>             Project: Qpid
>          Issue Type: Bug
>          Components: Qpid Managment Framework
>    Affects Versions: 0.14
>            Reporter: Pavel Moravec
>            Assignee: Ted Ross
>            Priority: Minor
>
> Invoking e.g. method for moving messages from a queue to another with an invalid filter
like:
> (in qpid-tool)
> call 120 queueMoveMessages SrcQueue DstQueue 0 {'qpid.subject':'key2'}
> will produce an error in qpidd log:
> 2012-07-31 11:50:14 error Ignoring unrecognized message filter: '{qpid.subject:key2}'
> but the messages are moved from SrcQueue to DstQueue. So having an invalid filter in
a QMF method raises an error log but otherwise the filter is ignored and method applied. And
the method returns zero as usual.
> The correct way would be not performing the method, as invalid parameter has been supplied.
> See http://qpid.2158936.n2.nabble.com/Writing-wrong-filter-in-a-QMF-method-causes-the-filter-is-ignored-td7580393.html#none
for a discussion on the topic.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message