Skip to content

Commit

Permalink
UnsatisfiedLinkError on the plugin startup (#381)
Browse files Browse the repository at this point in the history
Fixes following the release of IntelliJ 2023.2:
* a bug that caused throwing an error on IntelliJ startup and sometimes crashing it.
* the plugin icon was black.
  • Loading branch information
asafgabai authored Jul 30, 2023
1 parent 8d1d240 commit 37f88ad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
10 changes: 8 additions & 2 deletions src/main/java/com/jfrog/ide/idea/ui/webview/WebviewManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
public class WebviewManager implements Disposable {
private JBCefBrowser jbCefBrowser;
private MessagePacker messagePacker;
private boolean schemeHandlerRegistered = false;

public CefBrowser createBrowser(Runnable onLoadEnd) {
jbCefBrowser = new JBCefBrowser();
Disposer.register(this, jbCefBrowser);
jbCefBrowser.loadURL("http://jfrog-idea-plugin/index.html");
CefBrowser cefBrowser = jbCefBrowser.getCefBrowser();
jbCefBrowser.createImmediately();
jbCefBrowser.setOpenLinksInExternalBrowser(true);
CefApp.getInstance().registerSchemeHandlerFactory("http", "jfrog-idea-plugin", new WebviewSchemeHandlerFactory());
streamConsoleMessagesToLog();
handleLoadEvent(onLoadEnd);
messagePacker = new MessagePacker(cefBrowser);
Expand Down Expand Up @@ -67,6 +66,13 @@ public boolean onConsoleMessage(CefBrowser browser, CefSettings.LogSeverity leve
}

public void sendMessage(MessageType type, Object data) {
if (!schemeHandlerRegistered) {
// Register the scheme handler factory right before the webview is first opened.
// Performing this action immediately after opening IntelliJ sometimes results in a crash, particularly in IntelliJ 2022.3.
CefApp.getInstance().registerSchemeHandlerFactory("http", "jfrog-idea-plugin", new WebviewSchemeHandlerFactory());
jbCefBrowser.loadURL("http://jfrog-idea-plugin/index.html");
schemeHandlerRegistered = true;
}
messagePacker.send(type, data);
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@

<change-notes>
<![CDATA[
<li>Adds new Secrets and IaC scans.</li>
<li>Adds Contextual Analysis support for Maven and Gradle projects.</li>
<li>Fixed UnsatisfiedLinkError thrown on the plugin startup and sometimes caused IntelliJ crash (in IntelliJ 2023.2).</li>
]]>
</change-notes>

Expand Down
11 changes: 2 additions & 9 deletions src/main/resources/icons/jfrog_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 37f88ad

Please sign in to comment.