Révision 3173
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ReferencePattern.java (revision 3173) | ||
---|---|---|
85 | 85 |
*/ |
86 | 86 |
public static boolean isGsonString(String gsonString) { |
87 | 87 |
try { |
88 |
new Gson().fromJson(gsonString, HashMap.class); |
|
89 |
return true; |
|
88 |
return new Gson().fromJson(gsonString, HashMap.class) != null; |
|
90 | 89 |
} catch(Exception e) { |
91 | 90 |
return false; |
92 | 91 |
} |
... | ... | |
103 | 102 |
Gson gson = new Gson(); |
104 | 103 |
|
105 | 104 |
HashMap<?, ?> values = gson.fromJson(gsonString, HashMap.class); |
105 |
if (values == null) return ""; |
|
106 |
|
|
106 | 107 |
Object oFormat = values.get("format"); |
107 | 108 |
if (oFormat != null) { |
108 | 109 |
return oFormat.toString(); |
... | ... | |
126 | 127 |
Gson gson = new Gson(); |
127 | 128 |
|
128 | 129 |
HashMap<?, ?> values = gson.fromJson(gsonString, HashMap.class); |
130 |
if (values == null) return props; |
|
131 |
|
|
129 | 132 |
Object oProperties = values.get("properties"); |
130 | 133 |
|
131 | 134 |
if (oProperties != null && oProperties instanceof List) { |
... | ... | |
155 | 158 |
Gson gson = new Gson(); |
156 | 159 |
|
157 | 160 |
HashMap<?, ?> values = gson.fromJson(v, HashMap.class); |
161 |
|
|
162 |
if (values == null) return new ReferencePattern(); |
|
163 |
|
|
158 | 164 |
Object oProperties = values.get("properties"); |
159 | 165 |
Object oFormat = values.get("format"); |
160 | 166 |
String pattern = null; |
Formats disponibles : Unified diff