From 55ae6b2001272f1c8e1ea824c9f6cac70191bace Mon Sep 17 00:00:00 2001 From: kimchy Date: Tue, 28 Sep 2010 12:32:40 +0200 Subject: [PATCH] fix possible problem when trying to convert a binary format to a string --- .../main/java/org/elasticsearch/search/SearchService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java index 6754af89831..b9c30a9b305 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/SearchService.java @@ -389,7 +389,13 @@ public class SearchService extends AbstractLifecycleComponent { } parser.close(); } catch (Exception e) { - throw new SearchParseException(context, "Failed to parse [" + Unicode.fromBytes(source, offset, length) + "]", e); + String sSource = "_na_"; + try { + sSource = Unicode.fromBytes(source, offset, length); + } catch (Exception e1) { + // ignore + } + throw new SearchParseException(context, "Failed to parse [" + sSource + "]", e); } }