SHA-1771: Improve handling of search term highlighting parameters in script object

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@131681 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Draper
2016-10-21 18:16:52 +00:00
parent 2ca1dffb63
commit 2f24cb6e45

View File

@@ -859,15 +859,10 @@ public class Search extends BaseScopableProcessorExtension implements Initializi
*/
public int getIntegerValue(String attribute, int defaultValue, Map<Serializable, Serializable> sourceObject)
{
int integer = defaultValue;
String stringValue = (String) sourceObject.get(attribute);
try
Integer integer = (Integer) sourceObject.get(attribute);
if (integer == null)
{
integer = Integer.parseInt(stringValue);
}
catch(NumberFormatException nfe)
{
// No action required
integer = defaultValue;
}
return integer;
}
@@ -883,17 +878,12 @@ public class Search extends BaseScopableProcessorExtension implements Initializi
*/
public boolean getBooleanValue(String attribute, boolean defaultValue, Map<Serializable, Serializable> sourceObject)
{
boolean bool = defaultValue;
String stringValue = (String) sourceObject.get(attribute);
try
{
bool = Boolean.getBoolean(stringValue);
}
catch(NumberFormatException nfe)
{
// No action required
}
return bool;
Boolean bool = (Boolean) sourceObject.get(attribute);
if (bool == null)
{
bool = defaultValue;
}
return bool;
}
/**