@@ -113,7 +113,7 @@ int getInteger(final String value) {
113
113
try {
114
114
return Integer .parseInt (value );
115
115
}
116
- catch (final NumberFormatException except ) {
116
+ catch (final NumberFormatException expected ) {
117
117
return 0 ;
118
118
}
119
119
}
@@ -196,16 +196,13 @@ public final NodeList getElementsByTagNameNS(final String namespaceURI, final St
196
196
* @return The capitalized value
197
197
*/
198
198
String capitalize (final String value ) {
199
- final char [] chars ;
200
- int i ;
201
-
202
- // Convert string to charactares. Convert the first one to upper case,
199
+ // Convert string to characters. Convert the first one to upper case,
203
200
// the other characters to lower case, and return the converted string.
204
- chars = value .toCharArray ();
205
- if ( chars . length > 0 ) {
206
- chars [ 0 ] = Character .toUpperCase (chars [ 0 ]);
207
- for (i = 1 ; i < chars .length ; ++i ) {
208
- chars [ i ] = Character .toLowerCase (chars [ i ]);
201
+ if ( value .length () > 0 ) {
202
+ final char [] chars = value . toCharArray ();
203
+ chars [0 ] = Character .toUpperCase (chars [0 ]);
204
+ for (int i = 1 ; i < chars .length ; ++i ) {
205
+ chars [i ] = Character .toLowerCase (chars [i ]);
209
206
}
210
207
return String .valueOf (chars );
211
208
}
@@ -221,22 +218,9 @@ String capitalize(final String value) {
221
218
* @return The capitalized value
222
219
*/
223
220
String getCapitalized (final String attrname ) {
224
- final String value ;
225
- final char [] chars ;
226
- int i ;
227
-
228
- value = getAttribute (attrname );
221
+ final String value = getAttribute (attrname );
229
222
if (value != null ) {
230
- // Convert string to charactares. Convert the first one to upper case,
231
- // the other characters to lower case, and return the converted string.
232
- chars = value .toCharArray ();
233
- if (chars .length > 0 ) {
234
- chars [ 0 ] = Character .toUpperCase (chars [ 0 ]);
235
- for (i = 1 ; i < chars .length ; ++i ) {
236
- chars [ i ] = Character .toLowerCase (chars [ i ]);
237
- }
238
- return String .valueOf (chars );
239
- }
223
+ return capitalize (value );
240
224
}
241
225
return value ;
242
226
}
0 commit comments