You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2009/04/08 14:59:13 UTC

svn commit: r763227 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java

Author: cziegeler
Date: Wed Apr  8 12:59:13 2009
New Revision: 763227

URL: http://svn.apache.org/viewvc?rev=763227&view=rev
Log:
FELIX-1028 : Throw NPE instead of InvalidSyntaxException if expr is null.

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java?rev=763227&r1=763226&r2=763227&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java Wed Apr  8 12:59:13 2009
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -20,8 +20,8 @@
 
 import java.io.CharArrayReader;
 import java.io.IOException;
-import java.util.*;
 import java.lang.ref.SoftReference;
+import java.util.*;
 
 import org.apache.felix.framework.util.StringMap;
 import org.apache.felix.framework.util.ldap.*;
@@ -56,7 +56,7 @@
         m_logger = logger;
         if (expr == null)
         {
-            throw new InvalidSyntaxException("Filter cannot be null", null);
+            throw new NullPointerException("Filter cannot be null");
         }
         Object[] program = null;
         synchronized (m_programCache)
@@ -127,7 +127,7 @@
         return toString().hashCode();
     }
 
-    private boolean match(Dictionary dict, ServiceReference ref, boolean caseSensitive) 
+    private boolean match(Dictionary dict, ServiceReference ref, boolean caseSensitive)
         throws IllegalArgumentException
     {
         SoftReference tupleRef = (SoftReference) m_cache.get();
@@ -135,36 +135,36 @@
         SimpleMapper mapper = null;
         Object[] tuple = null;
 
-        if (tupleRef != null) 
+        if (tupleRef != null)
         {
             tuple = (Object[]) tupleRef.get();
         }
 
-        if (tuple == null) 
+        if (tuple == null)
         {
             evaluator = new Evaluator(m_program);
             mapper = new SimpleMapper();
         }
-        else 
+        else
         {
             evaluator = (Evaluator) tuple[0];
             mapper = (SimpleMapper) tuple[1];
             m_cache.set(null);
         }
 
-        try 
+        try
         {
-            if (dict != null) 
+            if (dict != null)
             {
                 mapper.setSource(dict, caseSensitive);
             }
-            else 
+            else
             {
                 mapper.setSource(ref);
             }
 
             return evaluator.evaluate(mapper);
-        } 
+        }
         catch (AttributeNotFoundException ex)
         {
             log(Logger.LOG_DEBUG, "FilterImpl: Attribute not found.", ex);
@@ -173,18 +173,18 @@
         {
             log(Logger.LOG_ERROR, "FilterImpl: " + toString(), ex);
         }
-        finally 
+        finally
         {
-            if (dict != null) 
+            if (dict != null)
             {
                 mapper.setSource(null, caseSensitive);
             }
-            else 
+            else
             {
                 mapper.setSource(null);
             }
-            
-            if (tuple == null) 
+
+            if (tuple == null)
             {
                 m_cache.set(new SoftReference(new Object[] {evaluator, mapper}));
             }