pdfbox-commits mailing list archives

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

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

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java
    pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java?rev=1759326&r1=1759325&r2=1759326&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/DateConverter.java Mon
Sep  5 16:13:07 2016
@@ -165,7 +165,7 @@ public final 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
@@ -186,7 +186,7 @@ public final 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)
@@ -491,11 +491,11 @@ public final 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/2.0/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java?rev=1759326&r1=1759325&r2=1759326&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/util/TestDateUtil.java Mon
Sep  5 16:13:07 2016
@@ -129,9 +129,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 = DateConverter.toCalendar(orig);
@@ -307,9 +307,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

Modified: pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java?rev=1759326&r1=1759325&r2=1759326&view=diff
==============================================================================
--- pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java (original)
+++ pdfbox/branches/2.0/xmpbox/src/main/java/org/apache/xmpbox/DateConverter.java Mon Sep
 5 16:13:07 2016
@@ -27,6 +27,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;
 import java.util.regex.Matcher;
@@ -255,11 +256,11 @@ public final 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
         {
@@ -292,20 +293,20 @@ public final class DateConverter
 
         retval.append(cal.get(Calendar.YEAR));
         retval.append("-");
-        retval.append(String.format("%02d", cal.get(Calendar.MONTH) + 1));
+        retval.append(String.format(Locale.US, "%02d", cal.get(Calendar.MONTH) + 1));
         retval.append("-");
-        retval.append(String.format("%02d", cal.get(Calendar.DAY_OF_MONTH)));
+        retval.append(String.format(Locale.US, "%02d", cal.get(Calendar.DAY_OF_MONTH)));
         retval.append("T");
-        retval.append(String.format("%02d", cal.get(Calendar.HOUR_OF_DAY)));
+        retval.append(String.format(Locale.US, "%02d", cal.get(Calendar.HOUR_OF_DAY)));
         retval.append(":");
-        retval.append(String.format("%02d", cal.get(Calendar.MINUTE)));
+        retval.append(String.format(Locale.US, "%02d", cal.get(Calendar.MINUTE)));
         retval.append(":");
-        retval.append(String.format("%02d", cal.get(Calendar.SECOND)));
+        retval.append(String.format(Locale.US, "%02d", cal.get(Calendar.SECOND)));
         
         if (printMillis)
         {
             retval.append(".");
-            retval.append(String.format("%03d", cal.get(Calendar.MILLISECOND)));
+            retval.append(String.format(Locale.US, "%03d", cal.get(Calendar.MILLISECOND)));
         }
 
         int timeZone = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET);



Mime
View raw message