File tree Expand file tree Collapse file tree 4 files changed +15
-6
lines changed
cloudinary-http42/src/main/java/com/cloudinary/http42/api
cloudinary-http43/src/main/java/com/cloudinary/http43/api
cloudinary-http44/src/main/java/com/cloudinary/http44/api
cloudinary-test-common/src/main/java/com/cloudinary/test Expand file tree Collapse file tree 4 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 44import java .text .ParseException ;
55import java .text .SimpleDateFormat ;
66import java .util .HashMap ;
7+ import java .util .Locale ;
78import java .util .Map ;
89import java .util .regex .Matcher ;
910import java .util .regex .Pattern ;
@@ -33,8 +34,7 @@ public HttpResponse getRawHttpResponse() {
3334 private static final Pattern RATE_LIMIT_REGEX = Pattern
3435 .compile ("X-Feature(\\ w*)RateLimit(-Limit|-Reset|-Remaining)" );
3536 private static final String RFC1123_PATTERN = "EEE, dd MMM yyyyy HH:mm:ss z" ;
36- private static final DateFormat RFC1123 = new SimpleDateFormat (
37- RFC1123_PATTERN );
37+ private static final DateFormat RFC1123 = new SimpleDateFormat (RFC1123_PATTERN , Locale .ENGLISH );
3838
3939 public Map <String , RateLimit > rateLimits () throws ParseException {
4040 Header [] headers = this .response .getAllHeaders ();
Original file line number Diff line number Diff line change 33import java .text .DateFormat ;
44import java .text .SimpleDateFormat ;
55import java .util .HashMap ;
6+ import java .util .Locale ;
67import java .util .Map ;
78import java .util .regex .Matcher ;
89import java .util .regex .Pattern ;
@@ -32,8 +33,7 @@ public HttpResponse getRawHttpResponse() {
3233 private static final Pattern RATE_LIMIT_REGEX = Pattern
3334 .compile ("X-Feature(\\ w*)RateLimit(-Limit|-Reset|-Remaining)" );
3435 private static final String RFC1123_PATTERN = "EEE, dd MMM yyyyy HH:mm:ss z" ;
35- private static final DateFormat RFC1123 = new SimpleDateFormat (
36- RFC1123_PATTERN );
36+ private static final DateFormat RFC1123 = new SimpleDateFormat (RFC1123_PATTERN , Locale .ENGLISH );
3737
3838 public Map <String , RateLimit > rateLimits () throws java .text .ParseException {
3939 Header [] headers = this .response .getAllHeaders ();
Original file line number Diff line number Diff line change 33import java .text .DateFormat ;
44import java .text .SimpleDateFormat ;
55import java .util .HashMap ;
6+ import java .util .Locale ;
67import java .util .Map ;
78import java .util .regex .Matcher ;
89import java .util .regex .Pattern ;
@@ -32,8 +33,7 @@ public HttpResponse getRawHttpResponse() {
3233 private static final Pattern RATE_LIMIT_REGEX = Pattern
3334 .compile ("X-Feature(\\ w*)RateLimit(-Limit|-Reset|-Remaining)" );
3435 private static final String RFC1123_PATTERN = "EEE, dd MMM yyyyy HH:mm:ss z" ;
35- private static final DateFormat RFC1123 = new SimpleDateFormat (
36- RFC1123_PATTERN );
36+ private static final DateFormat RFC1123 = new SimpleDateFormat (RFC1123_PATTERN , Locale .ENGLISH );
3737
3838 public Map <String , RateLimit > rateLimits () throws java .text .ParseException {
3939 Header [] headers = this .response .getAllHeaders ();
Original file line number Diff line number Diff line change 55import com .cloudinary .Coordinates ;
66import com .cloudinary .Transformation ;
77import com .cloudinary .api .ApiResponse ;
8+ import com .cloudinary .api .RateLimit ;
89import com .cloudinary .api .exceptions .BadRequest ;
910import com .cloudinary .api .exceptions .NotFound ;
1011import com .cloudinary .transformation .TextLayer ;
1314import static org .hamcrest .Matchers .hasItem ;
1415import static org .hamcrest .Matchers .equalTo ;
1516import org .junit .*;
17+ import org .junit .rules .ExpectedException ;
1618import org .junit .rules .TestName ;
1719
1820import java .io .IOException ;
@@ -433,6 +435,13 @@ public void test18Usage() throws Exception {
433435 assertNotNull (result .get ("last_updated" ));
434436 }
435437
438+ @ Test
439+ public void testRateLimitWithNonEnglishLocale () throws Exception {
440+ Locale .setDefault (new Locale ("de" , "DE" ));
441+ ApiResponse result = cloudinary .api ().usage (new HashMap ());
442+ Assert .assertNotNull (result .apiRateLimit ().getReset ());
443+ }
444+
436445 @ Test
437446 public void test19Ping () throws Exception {
438447 // should support ping API call
You can’t perform that action at this time.
0 commit comments