Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A19149683 for ; Sun, 15 Jan 2012 15:08:17 +0000 (UTC) Received: (qmail 5356 invoked by uid 500); 15 Jan 2012 15:08:17 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 5251 invoked by uid 500); 15 Jan 2012 15:08:16 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 5244 invoked by uid 99); 15 Jan 2012 15:08:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Jan 2012 15:08:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Jan 2012 15:08:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6768E2388993 for ; Sun, 15 Jan 2012 15:07:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1231685 - in /commons/proper/bsf/trunk/src/main/java/org/apache/bsf/util: BSFEventProcessor.java BSFEventProcessorReturningEventInfos.java Date: Sun, 15 Jan 2012 15:07:52 -0000 To: commits@commons.apache.org From: rony@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120115150752.6768E2388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rony Date: Sun Jan 15 15:07:51 2012 New Revision: 1231685 URL: http://svn.apache.org/viewvc?rev=1231685&view=rev Log: [BSF-19] Modified: commons/proper/bsf/trunk/src/main/java/org/apache/bsf/util/BSFEventProcessor.java commons/proper/bsf/trunk/src/main/java/org/apache/bsf/util/BSFEventProcessorReturningEventInfos.java Modified: commons/proper/bsf/trunk/src/main/java/org/apache/bsf/util/BSFEventProcessor.java URL: http://svn.apache.org/viewvc/commons/proper/bsf/trunk/src/main/java/org/apache/bsf/util/BSFEventProcessor.java?rev=1231685&r1=1231684&r2=1231685&view=diff ============================================================================== --- commons/proper/bsf/trunk/src/main/java/org/apache/bsf/util/BSFEventProcessor.java (original) +++ commons/proper/bsf/trunk/src/main/java/org/apache/bsf/util/BSFEventProcessor.java Sun Jan 15 15:07:51 2012 @@ -5,14 +5,17 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * + * 2012-01-15, Rony G. Flatscher + * - make event name comparisons case independent, Jira issue [BSF-19] */ package org.apache.bsf.util; @@ -82,12 +85,34 @@ public class BSFEventProcessor implement public void processExceptionableEvent (String inFilter, Object[] evtInfo) throws Exception { - if ((filter != null) && !filter.equals (inFilter)) { + if ((filter != null) && !isFilteredEvent(filter, inFilter)) { // ignore this event return; } // run the script engine.exec (source, lineNo, columnNo, script); +// System.err.println("returned from engine.exec."); + } + + + private static boolean isFilteredEvent(final String filter, String inFilter) + { + boolean bRes=filter.equalsIgnoreCase(inFilter); + if (bRes) + { + return bRes; + } + + String chunks[]=filter.replace('+',' ').split(" "); + for (int i=0;i. + * + * 2012-01-15, Rony G. Flatscher + * - make event name comparisons case independent, Jira issue [BSF-19] */ package org.apache.bsf.util; @@ -17,28 +20,28 @@ import org.apache.bsf.util.event.EventPr /* * Copyright (C) 2001-2006 Rony G. Flatscher - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. - * + * */ /** - * + * * This is used to support binding scripts to be run when an event occurs, * forwarding the arguments supplied to the event listener. It is an adapted * version of org.apache.bsf.util.BSFEventProcessor. - * + * * @author Rony G. Flatscher, but most of the code copied from * org.apache.bsf.util.BSFEventProcessor by Sanjiva Weerawarana */ @@ -65,7 +68,7 @@ public class BSFEventProcessorReturningE /** * Package-protected constructor makes this class unavailable for public * use. - * + * * @param dataFromScriptingEngine * this contains any object supplied by the scripting engine and * gets sent back with the supplied script. This could be used @@ -119,7 +122,7 @@ public class BSFEventProcessorReturningE // System.err.println(this+": inFilter=["+inFilter+"], // filter=["+filter+"]"); - if ((filter != null) && !filter.equals(inFilter)) { + if ((filter != null) && !isFilteredEvent(filter, inFilter)) { // ignore this event return; } @@ -160,5 +163,28 @@ public class BSFEventProcessorReturningE engine.apply(source, lineNo, columnNo, this.script, paramNames, paramValues); +// System.err.println("returned from engine.exec."); + + } + + + private static boolean isFilteredEvent(final String filter, String inFilter) + { + boolean bRes=filter.equalsIgnoreCase(inFilter); + if (bRes) + { + return bRes; + } + + String chunks[]=filter.replace('+',' ').split(" "); + for (int i=0;i