Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ cannot install plugin to intellij #736

Open
5 tasks
hohwille opened this issue Nov 4, 2024 · 0 comments
Open
5 tasks

IntelliJ cannot install plugin to intellij #736

hohwille opened this issue Nov 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@hohwille
Copy link
Member

hohwille commented Nov 4, 2024

Expected behavior

As IDEasy user, I want to be able to install, open and use latest IntelliJ so that I can develop.

Actual behavior

Start: Install plugin plantuml
java.io.IOException: Failed to fetch file headers: HTTP 404
        at com.devonfw.tools.ide.tool.ide.IdeaBasedIdeToolCommandlet.getFileExtensionFromUrl(IdeaBasedIdeToolCommandlet.java:141)
        at com.devonfw.tools.ide.tool.ide.IdeaBasedIdeToolCommandlet.downloadPlugin(IdeaBasedIdeToolCommandlet.java:114)
        at com.devonfw.tools.ide.tool.ide.IdeaBasedIdeToolCommandlet.installPlugin(IdeaBasedIdeToolCommandlet.java:59)
        at com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet.installPlugins(PluginBasedCommandlet.java:118)
        at com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet.postInstall(PluginBasedCommandlet.java:104)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.install(LocalToolCommandlet.java:104)
        at com.devonfw.tools.ide.tool.ToolCommandlet.runTool(ToolCommandlet.java:166)
        at com.devonfw.tools.ide.tool.ToolCommandlet.runTool(ToolCommandlet.java:152)
        at com.devonfw.tools.ide.tool.ide.IdeToolCommandlet.runTool(IdeToolCommandlet.java:55)
        at com.devonfw.tools.ide.tool.ToolCommandlet.run(ToolCommandlet.java:130)
        at com.devonfw.tools.ide.tool.ide.IdeToolCommandlet.run(IdeToolCommandlet.java:49)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:862)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:771)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:89)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:52)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:29)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

Step 'ide (intellij)' failed: java.lang.IllegalStateException: Failed to process installation of plugin: PlantUML+integration
 Step 'Install intellij (2024.2.4)' failed: java.lang.IllegalStateException: Failed to process installation of plugin: PlantUML+integration
  Step 'Install plugin plantuml' failed: java.io.IOException: Failed to fetch file headers: HTTP 404
3 step(s) failed out of 10 steps.
An unexpected error occurred!
We are sorry for the inconvenience.
Please check the error below, resolve it and try again.
If the error is not on your end (network connectivity, lack of permissions, etc.) please file a bug:
https://github.com/devonfw/IDEasy/issues/new?assignees=&labels=bug&projects=&template=bug.md&title=IllegalStateException%3A+Failed+to+process+installation+of+plugin%3A+PlantUML%2Bintegration
java.lang.IllegalStateException: Failed to process installation of plugin: PlantUML+integration
        at com.devonfw.tools.ide.tool.ide.IdeaBasedIdeToolCommandlet.installPlugin(IdeaBasedIdeToolCommandlet.java:65)
        at com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet.installPlugins(PluginBasedCommandlet.java:118)
        at com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet.postInstall(PluginBasedCommandlet.java:104)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.install(LocalToolCommandlet.java:104)
        at com.devonfw.tools.ide.tool.ToolCommandlet.runTool(ToolCommandlet.java:166)
        at com.devonfw.tools.ide.tool.ToolCommandlet.runTool(ToolCommandlet.java:152)
        at com.devonfw.tools.ide.tool.ide.IdeToolCommandlet.runTool(IdeToolCommandlet.java:55)
        at com.devonfw.tools.ide.tool.ToolCommandlet.run(ToolCommandlet.java:130)
        at com.devonfw.tools.ide.tool.ide.IdeToolCommandlet.run(IdeToolCommandlet.java:49)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:862)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:771)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:89)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:52)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:29)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.io.IOException: Failed to fetch file headers: HTTP 404
        at com.devonfw.tools.ide.tool.ide.IdeaBasedIdeToolCommandlet.getFileExtensionFromUrl(IdeaBasedIdeToolCommandlet.java:141)
        at com.devonfw.tools.ide.tool.ide.IdeaBasedIdeToolCommandlet.downloadPlugin(IdeaBasedIdeToolCommandlet.java:114)
        at com.devonfw.tools.ide.tool.ide.IdeaBasedIdeToolCommandlet.installPlugin(IdeaBasedIdeToolCommandlet.java:59)
        ... 14 more

We actually have multiple issues here:

  • the actual bug with plugin id containing space vs. + (see below)
  • exception message needs improvement and should contain the URL that failed
  • check why the logging of the plugin URL (see below on success "Trying to download ..." is not logged before this error occurs what would have helped to see what incorrect URL is created and to double check in the browser if I also get 404 there.
  • we throw IOException from our own code (what we should not do but instead throw an unchecked exception):
    private String getFileExtensionFromUrl(String urlString) throws IOException {
    URL url = new URL(urlString);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.setRequestMethod("HEAD");
    connection.connect();
    int responseCode = connection.getResponseCode();
    if (responseCode != HttpURLConnection.HTTP_OK) {
    throw new IOException("Failed to fetch file headers: HTTP " + responseCode);
    }
    String contentType = connection.getContentType();
    if (contentType == null) {
    return "";
    }
    return switch (contentType) {
    case "application/zip" -> ".zip";
    case "application/java-archive" -> ".jar";
    default -> "";
    };
    }
  • we use HttpURLConnection including an ugly downcast to do a HEAD request. The proper way to do such things can be found here:
    protected HttpResponse<?> doCheckDownloadViaHeadRequest(String url) {
    URI uri = null;
    HttpRequest request = null;
    try {
    uri = URI.create(url);
    request = HttpRequest.newBuilder().uri(uri)
    .method("HEAD", HttpRequest.BodyPublishers.noBody()).timeout(Duration.ofSeconds(5)).build();
    return this.client.send(request, HttpResponse.BodyHandlers.ofString());
    } catch (Exception e) {
    logger.error("Failed to perform HEAD request of URL {}", url, e);
    return new HttpErrorResponse(e, request, uri);
    }
    }

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. configure settings/intellij/plugins/plantuml.properties with
plugin_id=PlantUML+integration
plugin_active=true
  1. ide intellij

Related/Dependent Issues

directly related to #550

Comments/Hints:

When replacing the + sign with a space ( ), it works.

Trying to download intellij-plugin-PlantUML integration.zip from https://plugins.jetbrains.com/pluginManager?action=download&id=PlantUML%20integration&build=IU-242.23726.103
...
Successfully ended step 'Install plugin plantuml'.

However, with space it does not work with devonfw-ide.
Hence, I consider it as a bug in IDEasy that the legacy + sign is not supported anymore.

Affected version:

  • 2024.10.001-beta and 2024.11.001-beta-SNAPSHOT (from today)
@hohwille hohwille added the bug Something isn't working label Nov 4, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in IDEasy board Nov 4, 2024
@leonrohne27 leonrohne27 self-assigned this Nov 11, 2024
@leonrohne27 leonrohne27 moved this from 🆕 New to 🏗 In progress in IDEasy board Nov 11, 2024
@leonrohne27 leonrohne27 moved this from 🏗 In progress to 🆕 New in IDEasy board Nov 11, 2024
@leonrohne27 leonrohne27 removed their assignment Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants