@NotNull private Kind getKind() { try { return Kind.values()[kind]; } catch (Exception e) { LOG.warn("Unknown kind '" + kind + "' of variable '" + name + "'"); return Kind.Invalid; } }
@Nullable public static BallerinaLSPState getInstance() { try { return ServiceManager.getService(BallerinaLSPState.class); } catch (final Exception e) { LOG.warn("Couldn't load BallerinaLSPState"); LOG.warn(e); ApplicationUtils$.MODULE$.invokeLater(() -> Messages.showErrorDialog("Couldn't load LSP settings, you will need to reconfigure them.", "LSP plugin")); return null; } }
@Nullable public static <T> T transformStdoutLine(@NotNull Function<String, T> lineTransformer, int timeout, @NotNull String workDir, @NotNull String exePath, @NotNull String... arguments) { T transformed = null; try { com.intellij.execution.process.ProcessOutput output = getProcessOutput(timeout, workDir, exePath, arguments); transformed = transformStdoutLine(output, lineTransformer); } catch (ExecutionException executionException) { LOGGER.warn(executionException); } return transformed; }
@Override public String put(String key, String value) { if (key == null || value == null) { LOG.error(new Exception("Nulls are not allowed")); return null; } if (key.isEmpty()) { // Windows: passing an environment variable with empty name causes "CreateProcess error=87, The parameter is incorrect" LOG.warn("Skipping environment variable with empty name, value: " + value); return null; } return super.put(key, value); }
@Nullable private Release detectSdkVersion(@NotNull String sdkHome) { String versionCacheKey = getVersionCacheKey(sdkHome); Release release; if (mySdkHomeToReleaseCache.containsKey(versionCacheKey)) { release = mySdkHomeToReleaseCache.get(versionCacheKey); } else { File elixir = Elixir.getScriptInterpreterExecutable(sdkHome); if (!elixir.canExecute()) { String reason = elixir.getPath() + (elixir.exists() ? " is not executable." : " is missing."); LOG.warn("Can't detect Elixir version: " + reason); release = null; } else { release = transformStdoutLine( Release::fromString, STANDARD_TIMEOUT, sdkHome, elixir.getAbsolutePath(), "-e", "System.version() |> IO.puts()" ); } mySdkHomeToReleaseCache.put(versionCacheKey, release); } return release; }
@Override public void loadState(@NotNull final BallerinaLSPState lspState) { try { XmlSerializerUtil.copyBean(lspState, this); LOG.info("LSP State loaded"); if (extToServ != null && !extToServ.isEmpty()) { PluginMain.setExtToServerDefinition(UserConfigurableServerDefinition$.MODULE$.fromArrayMap(extToServ)); } if (timeouts != null && !timeouts.isEmpty()) { Timeout.setTimeouts(timeouts); } if (forcedAssociations != null && !forcedAssociations.isEmpty()) { PluginMain.setForcedAssociations(forcedAssociations); } } catch (final Exception e) { LOG.warn("Couldn't load BallerinaLSPState"); LOG.warn(e); ApplicationUtils$.MODULE$.invokeLater(() -> Messages.showErrorDialog("Couldn't load LSP settings, you will need to reconfigure them.", "LSP plugin")); } }
/** * Returns the text of the PSI element. * * @return the element text. */ @Override public String getText() { PsiElement mirror = getMirror(); String text; if (mirror != null) { text = mirror.getText(); } else { StringBuilder buffer = new StringBuilder(); appendMirrorText(buffer, 0); LOGGER.warn( "Mirror wasn't set for " + this + " in " + getContainingFile() + ", expected text '" + buffer + "'" ); text = buffer.toString(); } return text; }
LOGGER.warn(stringBuilder.toString()); } else { byte[] readAhead = new byte[readAheadLength];
indicator.setText2("Refreshing"); } catch (ExecutionException e) { LOG.warn(e);
private void disableCheckStyleLogging() { try { // This is a nasty hack to get around IDEA's DialogAppender sending any errors to the Event Log, // which would result in CheckStyle parse errors spamming the Event Log. org.apache.log4j.Logger.getLogger("com.puppycrawl.tools.checkstyle.TreeWalker").setLevel(Level.OFF); } catch (Exception e) { LOG.warn("Unable to suppress logging from CheckStyle's TreeWalker", e); } }
private String detokeniseForPrefix(final String path, final File projectPath, final String prefix) { if (projectPath != null) { return new File(projectPath, path.substring(prefix.length())).getAbsolutePath(); } LOG.warn("Could not detokenise path as project dir is unset: " + path); return path; }
private Optional<PluginConfigurationManager> settings() { final Project project = checkinPanel.getProject(); if (project == null) { LOG.warn("Could not get project for check-in panel"); return empty(); } final CheckStylePlugin plugin = project.getComponent(CheckStylePlugin.class); if (plugin == null) { LOG.warn("Could not get CheckStyle Plug-in, skipping"); return empty(); } return ofNullable(plugin.configurationManager()); }
private static List<URL> pathsOf(final VirtualFile[] files) { final List<URL> outputPaths = new ArrayList<>(); for (final VirtualFile file : files) { try { outputPaths.add(urlFor(pathOf(file))); } catch (MalformedURLException e) { LOG.warn("Malformed virtual file URL: " + file, e); } } return outputPaths; }
public Map<PsiFile, List<Problem>> scanFiles(@NotNull final List<VirtualFile> files) { if (files.isEmpty()) { return Collections.emptyMap(); } try { return whenFinished(runAsyncCheck(new ScanFiles(this, files, null))).get(); } catch (final Throwable e) { LOG.warn("Error scanning files", e); return Collections.emptyMap(); } }
private void addProblemTo(final PsiElement victim, final PsiFile psiFile, @NotNull final Issue event, final boolean afterEndOfLine) { try { addProblem(psiFile, new Problem(victim, event.message, event.severityLevel, event.lineNumber, event.columnNumber, event.sourceName, afterEndOfLine, suppressErrors)); } catch (PsiInvalidElementAccessException e) { LOG.warn("Element access failed", e); } }
@Nullable private ConfigurationLocation deserialiseLocation(@NotNull final Map<String, String> pLoadedMap, @NotNull final String pKey) { final String serialisedLocation = pLoadedMap.get(pKey); try { final ConfigurationLocation location = configurationLocationFactory.create(project, serialisedLocation); location.setProperties(propertiesFor(pLoadedMap, pKey)); return location; } catch (IllegalArgumentException e) { LOG.warn("Could not parse location: " + serialisedLocation, e); return null; } }
private void checkProject() { if(!this.isEnabled() && !Settings.getInstance(project).dismissEnableNotification && VfsUtil.findRelativeFile(this.project.getBaseDir(), "vendor", "symfony") != null ) { IdeHelper.notifyEnableMessage(project); return; } if(this.getContainerFiles().size() == 0) { Symfony2ProjectComponent.getLogger().warn("missing at least one container file"); } }