} else {\r
logger.debug("State key change. Was: [" + currentKey + "]. Will be ["+key+"]");\r
if (states.get(key)==null) {\r
- logger.error("The back-end received an unknow state key: ["+ key +"]."); \r
- } else {\r
- if (states.get(key).getCommand("search").equals(states.get(currentKey).getCommand("search"))) {\r
- logger.debug("No search change detected");\r
- } else {\r
- hasPendingStateChange("search",true);\r
- }\r
- if (states.get(key).getCommand("record").equals(states.get(currentKey).getCommand("record"))) {\r
- logger.debug("No record change detected");\r
+ logger.error("The back-end received an unknow state key, probably UI generated: ["+ key +"].");\r
+ if (key == null || key.length()==0) {\r
+ logger.info("Empty key received, treating it as identical to current key going forward.");\r
+ key = currentKey;\r
} else {\r
- hasPendingStateChange("record",true);\r
+ if (states.get(currentKey) != null) {\r
+ logger.info("Current search state cached under both of [" + key + "] and [" + currentKey + "]");\r
+ states.put(key,states.get(currentKey));\r
+ }\r
}\r
- currentKey = key;\r
- } \r
+ }\r
+ \r
+ if (states.get(key).getCommand("search").equals(states.get(currentKey).getCommand("search"))) {\r
+ logger.debug("No search change detected");\r
+ } else {\r
+ hasPendingStateChange("search",true);\r
+ }\r
+ if (states.get(key).getCommand("record").equals(states.get(currentKey).getCommand("record"))) {\r
+ logger.debug("No record change detected");\r
+ } else {\r
+ hasPendingStateChange("record",true);\r
+ }\r
+ currentKey = key; \r
}\r
}\r
\r