while (lineNumber >= 0 && StringUtil.isEmptyOrSpaces(myStdOut.get(lineNumber))) { lineNumber--; while (lineNumber >= 0 && !StringUtil.isEmptyOrSpaces(myStdOut.get(lineNumber))) { detailsMessage.insert(0, myStdOut.get(lineNumber)); lineNumber--; if (lineNumber >= 0 && (matcher = PANIC_VALUE.matcher(myStdOut.get(lineNumber))).matches()) { String stdoutLeftover = matcher.group(1); if (!StringUtil.isEmptyOrSpaces(stdoutLeftover)) { myStdOut.set(lineNumber, stdoutLeftover); lineNumber++;
private void processStdOut(@NotNull String testName, Key outputType, ServiceMessageVisitor visitor) throws ParseException { if (myStdOut == null) { return; } String allStdOut = StringUtil.join(myStdOut, ""); if (!StringUtil.isEmptyOrSpaces(allStdOut)) { String testStdOutMsg = ServiceMessageBuilder.testStdOut(testName).addAttribute("out", allStdOut).toString(); super.processServiceMessages(testStdOutMsg, outputType, visitor); } myStdOut = null; }
@Override public void checkConfiguration() throws RuntimeConfigurationException { super.checkBaseConfiguration(); super.checkFileConfiguration(); Module module = getConfigurationModule().getModule(); assert module != null; if (StringUtil.isEmptyOrSpaces(myPackage) && StringUtil.isEmptyOrSpaces(getFilePath())) { throw new RuntimeConfigurationError("Both file path and package are not specified. Need to specify at " + "least one."); } }
if ((matcher = TEST_START.matcher(text)).matches()) { String stdOutLeftover = matcher.group(1); if (!StringUtil.isEmptyOrSpaces(stdOutLeftover)) { myStdOut.add(stdOutLeftover);
@SuppressWarnings("UnresolvedPropertyKey") @NotNull public Process createProcess() throws ExecutionException { if (LOG.isDebugEnabled()) { LOG.debug("Executing [" + getCommandLineString() + "]"); } List<String> commands; try { checkWorkingDirectory(); if (StringUtil.isEmptyOrSpaces(myExePath)) { throw new ExecutionException(IdeBundle.message("run.configuration.error.executable.not.specified")); } commands = CommandLineUtil.toCommandLine(myExePath, myProgramParams.getList()); } catch (ExecutionException e) { LOG.info(e); throw e; } try { return startProcess(commands); } catch (IOException e) { LOG.info(e); throw new ProcessNotCreatedException(e.getMessage(), e, this); } }
@Override public void checkConfiguration() throws RuntimeConfigurationException { checkBaseConfiguration(); switch (myKind) { case PACKAGE: Module module = getConfigurationModule().getModule(); assert module != null; if (StringUtil.isEmptyOrSpaces(myPackage)) { throw new RuntimeConfigurationError("Package is not specified"); } VirtualFile packageDirectory = GoPackageUtil.findByImportPath(myPackage, module.getProject(), module); if (packageDirectory == null || !packageDirectory.isDirectory()) { throw new RuntimeConfigurationError("Cannot find package '" + myPackage + "'"); } if (GoRunUtil.findMainFileInDirectory(packageDirectory, getProject()) == null) { throw new RuntimeConfigurationError("Cannot find Go file with main in '" + myPackage + "'"); } break; case FILE: checkFileConfiguration(); break; } }
private void checkNotNullOrEmpty(String componentFromSonar, String fullFilePathFromLocalFileSystem) { if (isEmptyOrSpaces(componentFromSonar) || isEmptyOrSpaces(fullFilePathFromLocalFileSystem)) { match = false; processing = false; } }
/** * checks if component starts with resource key, like: * component = "sonar:project:src/main/java/org/sonar/batch/DefaultSensorContext.java"; * resource key = "sonar:project" */ private void checkSonarComponentStartsWithResourceKeyFromConfiguration() { if (!isEmptyOrSpaces(this.resourceKeyFromConfiguration) && !this.componentFromSonar.startsWith (this.resourceKeyFromConfiguration)) { match = false; processing = false; } }
@NotNull public static String getNonEmptyMessage(@NotNull Throwable t, @NotNull String defaultMessage) { String message = t.getMessage(); return !StringUtil.isEmptyOrSpaces(message) ? message : defaultMessage; } }
@Contract(value = "null -> true",pure = true) // we need to keep this method to preserve backward compatibility public static boolean isEmptyOrSpaces(@Nullable String s) { return isEmptyOrSpaces((CharSequence)s); }
public static boolean isProxyException(HttpConfigurable httpConfigurable, @org.jetbrains.annotations.Nullable String uriHost) { if (StringUtil.isEmptyOrSpaces(uriHost) || StringUtil.isEmptyOrSpaces(httpConfigurable.PROXY_EXCEPTIONS)) { return false; } List<String> hosts = StringUtil.split(httpConfigurable.PROXY_EXCEPTIONS, ","); for (String hostPattern : hosts) { String regexpPattern = StringUtil.escapeToRegexp(hostPattern.trim()).replace("\\*", ".*"); if (Pattern.compile(regexpPattern).matcher(uriHost).matches()) { return true; } } return false; }
@NotNull @Contract(pure = true) public static String fixVariableNameDerivedFromPropertyName(@NotNull String name) { if (isEmptyOrSpaces(name)) return name; char c = name.charAt(0); if (isVowel(c)) { return "an" + Character.toUpperCase(c) + name.substring(1); } return "a" + Character.toUpperCase(c) + name.substring(1); }
@Nullable @Contract(pure = true) public static String nullize(@Nullable final String s, boolean nullizeSpaces) { if (nullizeSpaces) { if (isEmptyOrSpaces(s)) return null; } else { if (isEmpty(s)) return null; } return s; }
@Override public void onTextAvailable(ProcessEvent event, Key outputType) { final String text = event.getText(); if (!StringUtil.isEmptyOrSpaces(text)) { CompilerMessage compilerMessage = compilerMessageFromOutputLine(text.trim()); context.processMessage(compilerMessage); } } });
@Nullable @Override public AuthData getAuthData(@NotNull String url) { if (!gerritSettings.getHost().equalsIgnoreCase(url)) { return null; } String password = gerritSettings.getPassword(); if (StringUtil.isEmptyOrSpaces(gerritSettings.getLogin()) || StringUtil.isEmptyOrSpaces(password)) { return null; } return new AuthData(gerritSettings.getLogin(), password); }
private boolean useToken(SonarServerConfig sonarServerConfig) { return !sonarServerConfig.isAnonymous() && !StringUtil.isEmptyOrSpaces(sonarServerConfig.loadToken()); }
public static long getEncodingCode(@Nullable String encodingName) { if (StringUtil.isEmptyOrSpaces(encodingName)) return -1; ID converted = nsString(encodingName); long cfEncoding = myFoundationLibrary.CFStringConvertIANACharSetNameToEncoding(converted); ID restored = myFoundationLibrary.CFStringConvertEncodingToIANACharSetName(cfEncoding); if (ID.NIL.equals(restored)) return -1; return convertCFEncodingToNS(cfEncoding); }
@Nullable @Override public PsiClass fromString(@Nullable @NonNls String s, ConvertContext context) { if (StringUtil.isEmptyOrSpaces(s)) { return null; } if (!s.contains(MybatisConstants.DOT_SEPARATOR)) { return AliasFacade.getInstance(context.getProject()).findPsiClass(context.getXmlElement(), s).orNull(); } return DomJavaUtil.findClass(s.trim(), context.getFile(), context.getModule(), GlobalSearchScope.allScope(context.getProject())); }
public VirtualFile compute() { final String path = FileUtil.toSystemIndependentName(myPathToSonarReportTextFieldWithBrowseButton.getText ()); return !StringUtil.isEmptyOrSpaces(path) ? LocalFileSystem.getInstance().refreshAndFindFileByPath(path) : null; } }
@Nullable private Block getInjectedLanguageRoot() { if (myInjectedPsiFile == null || StringUtil.isEmptyOrSpaces(getInjectedTreeRange().subSequence(myInjectedPsiFile.getNode().getChars()))) { return null; } FormattingModelBuilder builder = getInjectedBuilder(); if (builder == null) { return null; } final FormattingModel childModel = builder.createModel(myInjectedPsiFile, mySettings); return new PerlInjectedLanguageBlockWrapper(childModel.getRootBlock(), this); }