MissingResourceException:找不到基本名称sun.util.logging.resources.logging,语言环境en_US的捆绑软件 [英] MissingResourceException: Can't find bundle for base name sun.util.logging.resources.logging, locale en_US

查看:209
本文介绍了MissingResourceException:找不到基本名称sun.util.logging.resources.logging,语言环境en_US的捆绑软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了

Caused by java.lang.InternalError: java.util.MissingResourceException: Can't find bundle for base name sun.util.logging.resources.logging, locale en_US 

在我的应用程序中,从Firebase崩溃报告中获取.

in my application from firebase crash report.

其他详细信息

Manufacturer: HTC
Model: HTC 10 
Android API: 24 

这是堆栈跟踪

java.util.logging.Logger$1.run (Logger.java:1385)
java.util.logging.Logger$1.run (Logger.java:1379)
java.security.AccessController.doPrivileged (AccessController.java:41)
java.util.logging.Logger.findSystemResourceBundle (Logger.java:1378)
java.util.logging.Logger.findResourceBundle (Logger.java:1425)
java.util.logging.Logger.setupResourceInfo (Logger.java:1523)
java.util.logging.Logger.<init> (Logger.java:266)
java.util.logging.Logger.<init> (Logger.java:261)
java.util.logging.LogManager$SystemLoggerContext.demandLogger (LogManager.java:734)
java.util.logging.LogManager.demandSystemLogger (LogManager.java:399)
java.util.logging.Logger.getPlatformLogger (Logger.java:474)
java.util.logging.LoggingProxyImpl.getLogger (LoggingProxyImpl.java:41)
sun.util.logging.LoggingSupport.getLogger (LoggingSupport.java:100)
sun.util.logging.PlatformLogger$JavaLoggerProxy.<init> (PlatformLogger.java:636)
sun.util.logging.PlatformLogger$JavaLoggerProxy.<init> (PlatformLogger.java:631)
sun.util.logging.PlatformLogger.<init> (PlatformLogger.java:246)
sun.util.logging.PlatformLogger.getLogger (PlatformLogger.java:205)
java.net.CookieManager.put (CookieManager.java:262)
okhttp3.JavaNetCookieJar.saveFromResponse (JavaNetCookieJar.java:47)
okhttp3.internal.http.HttpHeaders.receiveHeaders (HttpHeaders.java:182)
okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.java:95)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:92)
okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.java:120)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:92)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:67)
okhttp3.RealCall.getResponseWithInterceptorChain (RealCall.java:185)
okhttp3.RealCall.execute (RealCall.java:69)

这是相关的记录器代码

private static ResourceBundle findSystemResourceBundle(final Locale var0) {
        return (ResourceBundle)AccessController.doPrivileged(new PrivilegedAction() {
            public ResourceBundle run() {
                try {
                    return ResourceBundle.getBundle("sun.util.logging.resources.logging", var0, ClassLoader.getSystemClassLoader());
                } catch (MissingResourceException var2) {
                    throw new InternalError(var2.toString());
                }
            }
        });
    }

我也有关于语言环境en_AU的崩溃报告.

I have got crash report for locale en_AU too.

由于崩溃代码不受我控制,我该如何防止崩溃?

Since the crashing code is not controlled by me, how do I prevent this crash?

推荐答案

分析:

MissingResourceException:找不到基本名称的捆绑软件 sun.util.logging.resources.logging,语言环境en_US

MissingResourceException: Can't find bundle for base name sun.util.logging.resources.logging, locale en_US

系统生成候选包名称

sun/util/logging/resources/logging_en_US
sun/util/logging/resources/logging_en
sun/util/logging/resources/logging

对于每个候选捆绑包名称,它将尝试加载资源捆绑包:

For each candidate bundle name, it attempts to load a resource bundle:

首先,它尝试使用生成的类名加载类.

First, it attempts to load a class using the generated class name.

如果可以找到该类并使用指定的类加载 加载程序,与ResourceBundle兼容,可访问 从ResourceBundle中获取,并且可以实例化,getBundle创建一个新的 此类的实例,并将其用作结果资源包.

If such a class can be found and loaded using the specified class loader, is assignment compatible with ResourceBundle, is accessible from ResourceBundle, and can be instantiated, getBundle creates a new instance of this class and uses it as the result resource bundle.

否则,getBundle尝试使用生成的属性文件名来查找属性资源文件.

Otherwise, getBundle attempts to locate a property resource file using the generated properties file name.

它生成一个路径名 通过替换所有."来删除候选包名称字符与 "/"并附加字符串".properties".它试图找到一个 使用此名称的资源" java.lang.ClassLoader.getResource(java.lang.String). (请注意, getResource的意义上的资源"与 资源束的内容,它只是数据的容器,例如 一个文件.)如果找到资源",它将尝试创建一个新的 PropertyResourceBundle实例的内容.如果成功的话 实例成为结果资源束.

It generates a path name from the candidate bundle name by replacing all "." characters with "/" and appending the string ".properties". It attempts to find a "resource" with this name using java.lang.ClassLoader.getResource(java.lang.String). (Note that a "resource" in the sense of getResource has nothing to do with the contents of a resource bundle, it is just a container of data, such as a file.) If it finds a "resource", it attempts to create a new PropertyResourceBundle instance from its contents. If successful, this instance becomes the result resource bundle.

有更详细的外观

Have a more detailed look here how a ressource is resolved.

由于系统正在以降序查找这些文件中的任何一个的类路径(通常没有_en * .properties)

Since the system is looking in the classpath for any of these files in descending order (usually there are no _en*.properties)

sun/util/logging/resources/logging_en_US.properties
sun/util/logging/resources/logging_en.properties
sun/util/logging/resources/logging.properties

添加这样的文件(或如上所述的类)添加到您的应用. 属性文件的内容类似于:

it would be a workaround to add such a file (or a class as mentioned above) to your app. The content of the property files looks like this:

# Localizations for Level names.  For the US locale
# these are the same as the non-localized level name.

# The following ALL CAPS words should be translated.
ALL=All
# The following ALL CAPS words should be translated.
SEVERE=Severe
# The following ALL CAPS words should be translated.
WARNING=Warning
# The following ALL CAPS words should be translated.
INFO=Info
# The following ALL CAPS words should be translated.
CONFIG= Config
# The following ALL CAPS words should be translated.
FINE=Fine
# The following ALL CAPS words should be translated.
FINER=Finer
# The following ALL CAPS words should be translated.
FINEST=Finest
# The following ALL CAPS words should be translated.
OFF=Off

这篇关于MissingResourceException:找不到基本名称sun.util.logging.resources.logging,语言环境en_US的捆绑软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆