8189272: CLDR and JRE LocaleProviderAdapters silently swallow exceptions

Reviewed-by: mchung
This commit is contained in:
Naoto Sato 2017-10-24 08:56:47 -07:00
parent ab49e12b7f
commit 483595f375
3 changed files with 7 additions and 61 deletions

View file

@ -27,6 +27,7 @@ package sun.util.cldr;
import java.security.AccessController;
import java.security.AccessControlException;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.text.spi.BreakIteratorProvider;
import java.text.spi.CollatorProvider;
@ -83,11 +84,8 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
return null;
}
});
} catch (Exception e) {
// Catch any exception, and continue as if only CLDR's base locales exist.
} catch (ServiceConfigurationError sce) {
Throwable cause = sce.getCause();
if (!(cause instanceof AccessControlException)) throw sce;
} catch (PrivilegedActionException pae) {
throw new InternalError(pae.getCause());
}
nonBaseMetaInfo = nbmi;

View file

@ -28,6 +28,7 @@ package sun.util.locale.provider;
import java.security.AccessController;
import java.security.AccessControlException;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.text.spi.BreakIteratorProvider;
import java.text.spi.CollatorProvider;
@ -478,11 +479,8 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
if (nonBaseTags != null) {
supportedLocaleString += " " + nonBaseTags;
}
} catch (Exception e) {
// catch any exception, and ignore them as if non-EN locales do not exist.
} catch (ServiceConfigurationError sce) {
Throwable cause = sce.getCause();
if (!(cause instanceof AccessControlException)) throw sce;
} catch (PrivilegedActionException pae) {
throw new InternalError(pae.getCause());
}
return supportedLocaleString;