@@ -174,6 +174,20 @@ public void writeCustomHeader(CommandCustomHeader customHeader) {
174
174
this .customHeader = customHeader ;
175
175
}
176
176
177
+ private static final String StringName = String .class .getCanonicalName ();//
178
+
179
+ private static final String IntegerName1 = Integer .class .getCanonicalName ();//
180
+ private static final String IntegerName2 = int .class .getCanonicalName ();//
181
+
182
+ private static final String LongName1 = Long .class .getCanonicalName ();//
183
+ private static final String LongName2 = long .class .getCanonicalName ();//
184
+
185
+ private static final String BooleanName1 = Boolean .class .getCanonicalName ();//
186
+ private static final String BooleanName2 = boolean .class .getCanonicalName ();//
187
+
188
+ private static final String DoubleName1 = Double .class .getCanonicalName ();//
189
+ private static final String DoubleName2 = double .class .getCanonicalName ();//
190
+
177
191
178
192
public CommandCustomHeader decodeCommandCustomHeader (Class <? extends CommandCustomHeader > classHeader )
179
193
throws RemotingCommandException {
@@ -203,37 +217,27 @@ public CommandCustomHeader decodeCommandCustomHeader(Class<? extends CommandCust
203
217
throw new RemotingCommandException ("the custom field <" + fieldName
204
218
+ "> is null" );
205
219
}
220
+
221
+ continue ;
206
222
}
207
223
208
224
field .setAccessible (true );
209
- String type = field .getType ().getSimpleName ();
225
+ String type = field .getType ().getCanonicalName ();
210
226
Object valueParsed = null ;
211
227
212
- if (type .equals ("String" )) {
228
+ if (type .equals (StringName )) {
213
229
valueParsed = value ;
214
230
}
215
- else if (type .equals ("Integer" )) {
216
- valueParsed = Integer .parseInt (value );
217
- }
218
- else if (type .equals ("Long" )) {
219
- valueParsed = Long .parseLong (value );
220
- }
221
- else if (type .equals ("Boolean" )) {
222
- valueParsed = Boolean .parseBoolean (value );
223
- }
224
- else if (type .equals ("Double" )) {
225
- valueParsed = Double .parseDouble (value );
226
- }
227
- else if (type .equals ("int" )) {
231
+ else if (type .equals (IntegerName1 ) || type .equals (IntegerName2 )) {
228
232
valueParsed = Integer .parseInt (value );
229
233
}
230
- else if (type .equals ("long" )) {
234
+ else if (type .equals (LongName1 ) || type . equals ( LongName2 )) {
231
235
valueParsed = Long .parseLong (value );
232
236
}
233
- else if (type .equals ("boolean" )) {
237
+ else if (type .equals (BooleanName1 ) || type . equals ( BooleanName2 )) {
234
238
valueParsed = Boolean .parseBoolean (value );
235
239
}
236
- else if (type .equals ("double" )) {
240
+ else if (type .equals (DoubleName1 ) || type . equals ( DoubleName2 )) {
237
241
valueParsed = Double .parseDouble (value );
238
242
}
239
243
else {
0 commit comments