Skip to content

Commit

Permalink
Catch PDHexception on object initialization (oshi#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbwiddis authored Dec 30, 2019
1 parent 34562f1 commit 98965e4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,13 @@ private static String localize(String perfObject) {
try {
localized = PdhUtil.PdhLookupPerfNameByIndex(null, PdhUtil.PdhLookupPerfIndexByEnglishName(perfObject));
} catch (Win32Exception e) {
LOG.error("Unable to locate English counter names in registry Perflib 009. Assuming English counters.");
LOG.error(
"Unable to locate English counter names in registry Perflib 009. Assuming English counters. Error {}. {}",
String.format("0x%x", e.getHR().intValue()),
"See https://support.microsoft.com/en-us/help/300956/how-to-manually-rebuild-performance-counter-library-values");
} catch (PdhException e) {
LOG.error("Unable to localize {} performance counter. Error {}.", perfObject,
String.format("0x%x", e.getErrorCode()));
}
if (localized == null || localized.length() == 0) {
return perfObject;
Expand Down

0 comments on commit 98965e4

Please sign in to comment.