mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
SEARCH-506: Handling a null properties
This commit is contained in:
+12
-9
@@ -35,17 +35,20 @@ public class DocRouterFactory
|
||||
|
||||
public static DocRouter getRouter(Properties properties, ShardMethodEnum method) {
|
||||
|
||||
String shardDotId = properties.getProperty("shard.id");
|
||||
if (shardDotId != null && !shardDotId.isEmpty())
|
||||
if (properties != null)
|
||||
{
|
||||
try
|
||||
String shardDotId = properties.getProperty("shard.id");
|
||||
if (shardDotId != null && !shardDotId.isEmpty())
|
||||
{
|
||||
int shardid = Integer.parseInt(shardDotId);
|
||||
log.info("Sharding via an ExplicitRouter for shard "+shardid);
|
||||
return new ExplicitRouter(shardid);
|
||||
} catch (NumberFormatException e)
|
||||
{
|
||||
log.error("Failed to parse a shard.id of "+shardDotId);
|
||||
try
|
||||
{
|
||||
int shardid = Integer.parseInt(shardDotId);
|
||||
log.info("Sharding via an ExplicitRouter for shard "+shardid);
|
||||
return new ExplicitRouter(shardid);
|
||||
} catch (NumberFormatException e)
|
||||
{
|
||||
log.error("Failed to parse a shard.id of "+shardDotId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user