lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1357983 - /lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/RegexReplaceProcessorFactory.java
Date Thu, 05 Jul 2012 22:51:01 GMT
Author: markrmiller
Date: Thu Jul  5 22:51:01 2012
New Revision: 1357983

URL: http://svn.apache.org/viewvc?rev=1357983&view=rev
Log:
fix a small bug around these null checks

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/RegexReplaceProcessorFactory.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/RegexReplaceProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/RegexReplaceProcessorFactory.java?rev=1357983&r1=1357982&r2=1357983&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/RegexReplaceProcessorFactory.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/update/processor/RegexReplaceProcessorFactory.java
Thu Jul  5 22:51:01 2012
@@ -71,25 +71,26 @@ public final class RegexReplaceProcessor
   @Override
   public void init(NamedList args) {
 
-    String patternParam = args.remove(PATTERN_PARAM).toString();
+    Object patternParam = args.remove(PATTERN_PARAM);
 
     if(patternParam == null) {
       throw new SolrException(ErrorCode.SERVER_ERROR, 
                               "Missing required init parameter: " + PATTERN_PARAM);
     }
+    
     try {
-      pattern = Pattern.compile(patternParam);      
+      pattern = Pattern.compile(patternParam.toString());      
     } catch (PatternSyntaxException e) {
       throw new SolrException(ErrorCode.SERVER_ERROR, 
                               "Invalid regex: " + patternParam, e);
     }                                
 
-    String replacementParam = args.remove(REPLACEMENT_PARAM).toString();
+    Object replacementParam = args.remove(REPLACEMENT_PARAM);
     if(replacementParam == null) {
       throw new SolrException(ErrorCode.SERVER_ERROR, 
                               "Missing required init parameter: " + REPLACEMENT_PARAM);
     }
-    replacement = Matcher.quoteReplacement(replacementParam);
+    replacement = Matcher.quoteReplacement(replacementParam.toString());
 
     super.init(args);
   }



Mime
View raw message