rt/emul/compact/src/main/java/java/util/Calendar.java
changeset 1340 41046f76a76a
parent 1334 588d5bf7a560
     1.1 --- a/rt/emul/compact/src/main/java/java/util/Calendar.java	Thu Oct 03 15:40:35 2013 +0200
     1.2 +++ b/rt/emul/compact/src/main/java/java/util/Calendar.java	Fri Oct 04 12:01:56 2013 +0200
     1.3 @@ -43,19 +43,13 @@
     1.4  import java.io.ObjectOutputStream;
     1.5  import java.io.OptionalDataException;
     1.6  import java.io.Serializable;
     1.7 -import java.security.AccessControlContext;
     1.8  import java.security.AccessController;
     1.9 -import java.security.PermissionCollection;
    1.10  import java.security.PrivilegedActionException;
    1.11  import java.security.PrivilegedExceptionAction;
    1.12 -import java.security.ProtectionDomain;
    1.13  import java.text.DateFormat;
    1.14  import java.text.DateFormatSymbols;
    1.15  import java.util.concurrent.ConcurrentHashMap;
    1.16  import java.util.concurrent.ConcurrentMap;
    1.17 -import sun.util.BuddhistCalendar;
    1.18 -import sun.util.calendar.ZoneInfo;
    1.19 -import sun.util.resources.LocaleData;
    1.20  
    1.21  /**
    1.22   * The <code>Calendar</code> class is an abstract class that provides methods
    1.23 @@ -1025,18 +1019,18 @@
    1.24              // returns a BuddhistCalendar instance.
    1.25              if ("th".equals(aLocale.getLanguage())
    1.26                      && ("TH".equals(aLocale.getCountry()))) {
    1.27 -                cal = new BuddhistCalendar(zone, aLocale);
    1.28 +//                cal = new BuddhistCalendar(zone, aLocale);
    1.29              } else {
    1.30 -                cal = new GregorianCalendar(zone, aLocale);
    1.31 +//                cal = new GregorianCalendar(zone, aLocale);
    1.32              }
    1.33          } else if (caltype.equals("japanese")) {
    1.34 -            cal = new JapaneseImperialCalendar(zone, aLocale);
    1.35 +//            cal = new JapaneseImperialCalendar(zone, aLocale);
    1.36          } else if (caltype.equals("buddhist")) {
    1.37 -            cal = new BuddhistCalendar(zone, aLocale);
    1.38 +//            cal = new BuddhistCalendar(zone, aLocale);
    1.39          } else {
    1.40              // Unsupported calendar type.
    1.41              // Use Gregorian calendar as a fallback.
    1.42 -            cal = new GregorianCalendar(zone, aLocale);
    1.43 +//            cal = new GregorianCalendar(zone, aLocale);
    1.44          }
    1.45  
    1.46          return cal;
    1.47 @@ -1130,10 +1124,10 @@
    1.48      public void setTimeInMillis(long millis) {
    1.49          // If we don't need to recalculate the calendar field values,
    1.50          // do nothing.
    1.51 -        if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet
    1.52 -            && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) {
    1.53 -            return;
    1.54 -        }
    1.55 +//        if (time == millis && isTimeSet && areFieldsSet && areAllFieldsSet
    1.56 +//            && (zone instanceof ZoneInfo) && !((ZoneInfo)zone).isDirty()) {
    1.57 +//            return;
    1.58 +//        }
    1.59          time = millis;
    1.60          isTimeSet = true;
    1.61          areFieldsSet = false;
    1.62 @@ -2587,10 +2581,10 @@
    1.63          /* try to get the Locale data from the cache */
    1.64          int[] data = cachedLocaleData.get(desiredLocale);
    1.65          if (data == null) {  /* cache miss */
    1.66 -            ResourceBundle bundle = LocaleData.getCalendarData(desiredLocale);
    1.67 +//            ResourceBundle bundle = LocaleData.getCalendarData(desiredLocale);
    1.68              data = new int[2];
    1.69 -            data[0] = Integer.parseInt(bundle.getString("firstDayOfWeek"));
    1.70 -            data[1] = Integer.parseInt(bundle.getString("minimalDaysInFirstWeek"));
    1.71 +//            data[0] = Integer.parseInt(bundle.getString("firstDayOfWeek"));
    1.72 +//            data[1] = Integer.parseInt(bundle.getString("minimalDaysInFirstWeek"));
    1.73              cachedLocaleData.putIfAbsent(desiredLocale, data);
    1.74          }
    1.75          firstDayOfWeek = data[0];
    1.76 @@ -2721,14 +2715,14 @@
    1.77          // SimpleTimeZone equivalent (as a single DST schedule) for
    1.78          // backward compatibility.
    1.79          TimeZone savedZone = null;
    1.80 -        if (zone instanceof ZoneInfo) {
    1.81 -            SimpleTimeZone stz = ((ZoneInfo)zone).getLastRuleInstance();
    1.82 -            if (stz == null) {
    1.83 -                stz = new SimpleTimeZone(zone.getRawOffset(), zone.getID());
    1.84 -            }
    1.85 -            savedZone = zone;
    1.86 -            zone = stz;
    1.87 -        }
    1.88 +//        if (zone instanceof ZoneInfo) {
    1.89 +//            SimpleTimeZone stz = ((ZoneInfo)zone).getLastRuleInstance();
    1.90 +//            if (stz == null) {
    1.91 +//                stz = new SimpleTimeZone(zone.getRawOffset(), zone.getID());
    1.92 +//            }
    1.93 +//            savedZone = zone;
    1.94 +//            zone = stz;
    1.95 +//        }
    1.96  
    1.97          // Write out the 1.1 FCS object.
    1.98          stream.defaultWriteObject();
    1.99 @@ -2742,18 +2736,6 @@
   1.100          }
   1.101      }
   1.102  
   1.103 -    private static class CalendarAccessControlContext {
   1.104 -        private static final AccessControlContext INSTANCE;
   1.105 -        static {
   1.106 -            RuntimePermission perm = new RuntimePermission("accessClassInPackage.sun.util.calendar");
   1.107 -            PermissionCollection perms = perm.newPermissionCollection();
   1.108 -            perms.add(perm);
   1.109 -            INSTANCE = new AccessControlContext(new ProtectionDomain[] {
   1.110 -                                                    new ProtectionDomain(null, perms)
   1.111 -                                                });
   1.112 -        }
   1.113 -    }
   1.114 -
   1.115      /**
   1.116       * Reconstitutes this object from a stream (i.e., deserialize it).
   1.117       */
   1.118 @@ -2783,28 +2765,28 @@
   1.119          serialVersionOnStream = currentSerialVersion;
   1.120  
   1.121          // If there's a ZoneInfo object, use it for zone.
   1.122 -        ZoneInfo zi = null;
   1.123 -        try {
   1.124 -            zi = AccessController.doPrivileged(
   1.125 -                    new PrivilegedExceptionAction<ZoneInfo>() {
   1.126 -                        public ZoneInfo run() throws Exception {
   1.127 -                            return (ZoneInfo) input.readObject();
   1.128 -                        }
   1.129 -                    },
   1.130 -                    CalendarAccessControlContext.INSTANCE);
   1.131 -        } catch (PrivilegedActionException pae) {
   1.132 -            Exception e = pae.getException();
   1.133 -            if (!(e instanceof OptionalDataException)) {
   1.134 -                if (e instanceof RuntimeException) {
   1.135 -                    throw (RuntimeException) e;
   1.136 -                } else if (e instanceof IOException) {
   1.137 -                    throw (IOException) e;
   1.138 -                } else if (e instanceof ClassNotFoundException) {
   1.139 -                    throw (ClassNotFoundException) e;
   1.140 -                }
   1.141 -                throw new RuntimeException(e);
   1.142 -            }
   1.143 -        }
   1.144 +        TimeZone zi = null;
   1.145 +//        try {
   1.146 +//            zi = AccessController.doPrivileged(
   1.147 +//                    new PrivilegedExceptionAction<ZoneInfo>() {
   1.148 +//                        public ZoneInfo run() throws Exception {
   1.149 +//                            return (ZoneInfo) input.readObject();
   1.150 +//                        }
   1.151 +//                    },
   1.152 +//                    CalendarAccessControlContext.INSTANCE);
   1.153 +//        } catch (PrivilegedActionException pae) {
   1.154 +//            Exception e = pae.getException();
   1.155 +//            if (!(e instanceof OptionalDataException)) {
   1.156 +//                if (e instanceof RuntimeException) {
   1.157 +//                    throw (RuntimeException) e;
   1.158 +//                } else if (e instanceof IOException) {
   1.159 +//                    throw (IOException) e;
   1.160 +//                } else if (e instanceof ClassNotFoundException) {
   1.161 +//                    throw (ClassNotFoundException) e;
   1.162 +//                }
   1.163 +//                throw new RuntimeException(e);
   1.164 +//            }
   1.165 +//        }
   1.166          if (zi != null) {
   1.167              zone = zi;
   1.168          }