mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] JnaLoader.isLoaded() should shield callers from exceptions (IDEA-CR-25658)
This commit is contained in:
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.idea;
|
||||
|
||||
import com.intellij.ide.cloudConfig.CloudConfigProvider;
|
||||
@@ -38,7 +24,6 @@ import com.intellij.ui.AppUIUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.EnvironmentUtil;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import com.intellij.util.lang.UrlClassLoader;
|
||||
import org.apache.log4j.ConsoleAppender;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.PatternLayout;
|
||||
@@ -335,12 +320,7 @@ public class StartupUtil {
|
||||
if (System.getProperty("jna.nosys") == null) {
|
||||
System.setProperty("jna.nosys", "true"); // prefer bundled JNA dispatcher lib
|
||||
}
|
||||
try {
|
||||
JnaLoader.load(log);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
log.error("Unable to load JNA library (OS: " + SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION + ")", t);
|
||||
}
|
||||
JnaLoader.load(log);
|
||||
|
||||
if (SystemInfo.isWin2kOrNewer) {
|
||||
IdeaWin32.isAvailable(); // logging is done there
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
package com.intellij.jna;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.sun.jna.Native;
|
||||
|
||||
public class JnaLoader {
|
||||
@@ -22,11 +23,16 @@ public class JnaLoader {
|
||||
public static synchronized void load(Logger logger) {
|
||||
if (ourJnaLoaded == null) {
|
||||
ourJnaLoaded = Boolean.FALSE;
|
||||
long t = System.currentTimeMillis();
|
||||
int ptrSize = Native.POINTER_SIZE;
|
||||
t = System.currentTimeMillis() - t;
|
||||
logger.info("JNA library (" + (ptrSize << 3) + "-bit) loaded in " + t + " ms");
|
||||
ourJnaLoaded = Boolean.TRUE;
|
||||
try {
|
||||
long t = System.currentTimeMillis();
|
||||
int ptrSize = Native.POINTER_SIZE;
|
||||
t = System.currentTimeMillis() - t;
|
||||
logger.info("JNA library (" + (ptrSize << 3) + "-bit) loaded in " + t + " ms");
|
||||
ourJnaLoaded = Boolean.TRUE;
|
||||
}
|
||||
catch (Throwable t) {
|
||||
logger.error("Unable to load JNA library (OS: " + SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION + ")", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user