pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1759325 - in /pdfbox/branches/1.8: jempbox/src/main/java/org/apache/jempbox/impl/DateConverter.java pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java
Date Mon, 05 Sep 2016 16:13:01 GMT
Author: tilman
Date: Mon Sep  5 16:13:01 2016
New Revision: 1759325

URL: http://svn.apache.org/viewvc?rev=1759325&view=rev
Log:
PDFBOX-3481: avoid arab digits if Arab numbering is default

Modified:
    pdfbox/branches/1.8/jempbox/src/main/java/org/apache/jempbox/impl/DateConverter.java
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java
    pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java

Modified: pdfbox/branches/1.8/jempbox/src/main/java/org/apache/jempbox/impl/DateConverter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/jempbox/src/main/java/org/apache/jempbox/impl/DateConverter.java?rev=1759325&r1=1759324&r2=1759325&view=diff
==============================================================================
--- pdfbox/branches/1.8/jempbox/src/main/java/org/apache/jempbox/impl/DateConverter.java (original)
+++ pdfbox/branches/1.8/jempbox/src/main/java/org/apache/jempbox/impl/DateConverter.java Mon
Sep  5 16:13:01 2016
@@ -22,6 +22,7 @@ import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
+import java.util.Locale;
 import java.util.SimpleTimeZone;
 import java.util.TimeZone;
 
@@ -226,11 +227,11 @@ public class DateConverter
         }
         else if (pm == '+' && hh <= 12)
         {
-            tz.setID(String.format("GMT+%02d:%02d", hh, mm));
+            tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
         }
         else if (pm == '-' && hh <= 14)
         {
-            tz.setID(String.format("GMT-%02d:%02d", hh, mm));
+            tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
         }
         else
         {

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java?rev=1759325&r1=1759324&r2=1759325&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java Mon
Sep  5 16:13:01 2016
@@ -195,7 +195,7 @@ public class DateConverter
         }
         String offset = formatTZoffset(cal.get(Calendar.ZONE_OFFSET)
                 + cal.get(Calendar.DST_OFFSET), "'");
-        return String.format("D:"
+        return String.format(Locale.US, "D:"
                 + "%1$4tY%1$2tm%1$2td"   // yyyyMMdd 
                 + "%1$2tH%1$2tM%1$2tS"   // HHmmss 
                 + "%2$s"                // time zone
@@ -216,7 +216,7 @@ public class DateConverter
     {
         String offset = formatTZoffset(cal.get(Calendar.ZONE_OFFSET)
                 + cal.get(Calendar.DST_OFFSET), ":");
-        return String.format(
+        return String.format(Locale.US, 
                 "%1$4tY"   // yyyy
                 + "-%1$2tm"   // -mm  (%tm adds one to cal month value)
                 + "-%1$2td"  // -dd  (%tm adds one to cal month value)
@@ -544,11 +544,11 @@ public class DateConverter
         }
         else if (pm == '+' && hh <= 12)
         {
-            tz.setID(String.format("GMT+%02d:%02d", hh, mm));
+            tz.setID(String.format(Locale.US, "GMT+%02d:%02d", hh, mm));
         }
         else if (pm == '-' && hh <= 14)
         {
-            tz.setID(String.format("GMT-%02d:%02d", hh, mm));
+            tz.setID(String.format(Locale.US, "GMT-%02d:%02d", hh, mm));
         }
         else
         {

Modified: pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java?rev=1759325&r1=1759324&r2=1759325&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java Mon
Sep  5 16:13:01 2016
@@ -151,9 +151,9 @@ public class TestDateUtil extends TestCa
                 int hr, int min, int sec, int offsetHours, int offsetMinutes,
                 String orig) throws Exception 
     {
-        String pdfDate = String.format("D:%04d%02d%02d%02d%02d%02d%+03d'%02d'", 
+        String pdfDate = String.format(Locale.US, "D:%04d%02d%02d%02d%02d%02d%+03d'%02d'",

                 yr,mon,day,hr,min,sec,offsetHours,offsetMinutes);
-        String iso8601Date = String.format("%04d-%02d-%02d"
+        String iso8601Date = String.format(Locale.US, "%04d-%02d-%02d"
                 + "T%02d:%02d:%02d%+03d:%02d", 
                 yr,mon,day,hr,min,sec,offsetHours,offsetMinutes);
         Calendar cal = null;
@@ -340,9 +340,9 @@ public class TestDateUtil extends TestCa
         GregorianCalendar cal = new GregorianCalendar(tz, Locale.ENGLISH);
         cal.set(yr, mon-1, day, hr, min, sec);
         // create expected strings
-        String pdfDate = String.format("D:%04d%02d%02d%02d%02d%02d%+03d'%02d'", 
+        String pdfDate = String.format(Locale.US, "D:%04d%02d%02d%02d%02d%02d%+03d'%02d'",

                 yr,mon,day,hr,min,sec,offsetHours, offsetMinutes);
-        String iso8601Date = String.format("%04d-%02d-%02d"
+        String iso8601Date = String.format(Locale.US, "%04d-%02d-%02d"
                 + "T%02d:%02d:%02d%+03d:%02d", 
                 yr,mon,day,hr,min,sec,offsetHours, offsetMinutes);
         // compare outputs from toString and toISO8601 with expected values



Mime
View raw message