File tree 1 file changed +18
-5
lines changed
api/src/main/java/org/asynchttpclient/util 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 46
46
import org .asynchttpclient .multipart .MultipartRequestEntity ;
47
47
import org .asynchttpclient .multipart .PartSource ;
48
48
49
+ import com .ning .http .util .MiscUtil ;
50
+
49
51
/**
50
52
* {@link org.asynchttpclient.AsyncHttpProvider} common utilities.
51
53
* <p/>
@@ -530,13 +532,24 @@ public static int convertExpireField(String timestring) {
530
532
throw new IllegalArgumentException ("Not a valid expire field " + trimmedTimeString );
531
533
}
532
534
533
- private final static String removeQuote (String s ) {
535
+ public final static String removeQuotes (String s ) {
534
536
if (MiscUtil .isNonEmpty (s )) {
535
- if (s .charAt (0 ) == '"' )
536
- s = s .substring (1 );
537
+ int start = 0 ;
538
+ int end = s .length ();
539
+ boolean changed = false ;
540
+
541
+ if (s .charAt (0 ) == '"' ) {
542
+ changed = true ;
543
+ start ++;
544
+ }
545
+
546
+ if (s .charAt (s .length () - 1 ) == '"' ) {
547
+ changed = true ;
548
+ end --;
549
+ }
537
550
538
- if (s . charAt ( s . length () - 1 ) == '"' )
539
- s = s .substring (0 , s . length () - 1 );
551
+ if (changed )
552
+ s = s .substring (start , end );
540
553
}
541
554
return s ;
542
555
}
You can’t perform that action at this time.
0 commit comments