File tree 1 file changed +17
-6
lines changed
src/main/java/com/ning/http/util 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ public static Cookie parseCookie(String value) {
498
498
}
499
499
500
500
public static int convertExpireField (String timestring ) {
501
- String trimmedTimeString = removeQuote (timestring .trim ());
501
+ String trimmedTimeString = removeQuotes (timestring .trim ());
502
502
long now = System .currentTimeMillis ();
503
503
Date date = null ;
504
504
@@ -515,13 +515,24 @@ public static int convertExpireField(String timestring) {
515
515
throw new IllegalArgumentException ("Not a valid expire field " + trimmedTimeString );
516
516
}
517
517
518
- private final static String removeQuote (String s ) {
518
+ public final static String removeQuotes (String s ) {
519
519
if (MiscUtil .isNonEmpty (s )) {
520
- if (s .charAt (0 ) == '"' )
521
- s = s .substring (1 );
520
+ int start = 0 ;
521
+ int end = s .length ();
522
+ boolean changed = false ;
522
523
523
- if (s .charAt (s .length () - 1 ) == '"' )
524
- s = s .substring (0 , s .length () - 1 );
524
+ if (s .charAt (0 ) == '"' ) {
525
+ changed = true ;
526
+ start ++;
527
+ }
528
+
529
+ if (s .charAt (s .length () - 1 ) == '"' ) {
530
+ changed = true ;
531
+ end --;
532
+ }
533
+
534
+ if (changed )
535
+ s = s .substring (start , end );
525
536
}
526
537
return s ;
527
538
}
You can’t perform that action at this time.
0 commit comments