From 0a55d577634663301886df8169dbbe398772fd8a Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Tue, 12 Jan 2016 06:34:34 +0000 Subject: [PATCH] added a getBoolean() method git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1724169 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/java/org/apache/solr/util/CommandOperation.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/solr/core/src/java/org/apache/solr/util/CommandOperation.java b/solr/core/src/java/org/apache/solr/util/CommandOperation.java index 3c6e55cccfe..dfc1e4afde9 100644 --- a/solr/core/src/java/org/apache/solr/util/CommandOperation.java +++ b/solr/core/src/java/org/apache/solr/util/CommandOperation.java @@ -19,6 +19,8 @@ package org.apache.solr.util; import java.io.IOException; import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Collections; @@ -26,6 +28,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.apache.commons.io.input.CharSequenceReader; import org.apache.lucene.util.IOUtils; import org.apache.solr.common.SolrException; import org.apache.solr.common.util.ContentStream; @@ -59,6 +62,11 @@ public class CommandOperation { Object o = getMapVal(key); return o == null ? def : String.valueOf(o); } + + public boolean getBoolean(String key, boolean def) { + String v = getStr(key,null); + return v == null? def:Boolean.parseBoolean(v); + } public void setCommandData(Object o){ commandData = o; }