public FormValidation doCheckUrl(@QueryParameter String value) { if (StringUtils.isEmptyOrNull(value)) { return FormValidation.error(Messages.url_required()); } else { return FormValidation.ok(); } }
public FormValidation doCheckApiTokenId(@QueryParameter String value) { if (StringUtils.isEmptyOrNull(value)) { return FormValidation.error(Messages.apiToken_required()); } else { return FormValidation.ok(); } }
public FormValidation doCheckName(@QueryParameter String id, @QueryParameter String value) { if (StringUtils.isEmptyOrNull(value)) { return FormValidation.error(Messages.name_required()); } else if (connectionMap.containsKey(value) && !connectionMap.get(value).toString().equals(id)) { return FormValidation.error(Messages.name_exists(value)); } else { return FormValidation.ok(); } }
private String retrievePushedBy(final PushHook hook) { final String userName = hook.getUserName(); if (!StringUtils.isEmptyOrNull(userName)) { return userName; } final List<Commit> commits = hook.getCommits(); if (commits != null && !commits.isEmpty()) { return commits.get(commits.size() - 1).getAuthor().getName(); } return null; }
private static boolean eq(String a, String b) { if (a == b) return true; if (StringUtils.isEmptyOrNull(a) && StringUtils.isEmptyOrNull(b)) return true; if (a == null || b == null) return false; return a.equals(b); }
private static String computeVersion() { Package pkg = UserAgent.class.getPackage(); if (pkg != null) { String ver = pkg.getImplementationVersion(); if (!StringUtils.isEmptyOrNull(ver)) { return ver; } } return "unknown"; //$NON-NLS-1$ }
@Override public boolean matchConfigValue(String in) { if (StringUtils.isEmptyOrNull(in)) return false; if (!in.startsWith("--")) //$NON-NLS-1$ return false; return name().equalsIgnoreCase(in.substring(2).replace('-', '_')); }
@Override public boolean matchConfigValue(String s) { if (StringUtils.isEmptyOrNull(s)) { return false; } s = s.replace('-', '_'); return name().equalsIgnoreCase(s) || configValue.equalsIgnoreCase(s); } }
@Override public boolean matchConfigValue(String s) { if (StringUtils.isEmptyOrNull(s)) { return false; } s = s.replace('-', '_'); return name().equalsIgnoreCase(s) || configValue.equalsIgnoreCase(s); } }
/** * Change the user agent string advertised by JGit. * <p> * The new string should start with {@code "JGit/"} (for example * {@code "JGit/4.0"}) to advertise the implementation as JGit based. * <p> * Spaces and other whitespace should be avoided as these will be * automatically converted to {@code "."}. * <p> * User agent strings are restricted to printable ASCII. * * @param agent * new user agent string for this running JGit library. Setting * to null or empty string will avoid sending any identification * to the peer. */ public static void set(String agent) { userAgent = StringUtils.isEmptyOrNull(agent) ? null : clean(agent); }
/** {@inheritDoc} */ @Override public File resolve(File dir, String pn) { String useCygPath = System.getProperty("jgit.usecygpath"); //$NON-NLS-1$ if (useCygPath != null && useCygPath.equals("true")) { //$NON-NLS-1$ String w; try { w = readPipe(dir, // new String[] { cygpath, "--windows", "--absolute", pn }, // //$NON-NLS-1$ //$NON-NLS-2$ UTF_8.name()); } catch (CommandFailedException e) { LOG.warn(e.getMessage()); return null; } if (!StringUtils.isEmptyOrNull(w)) { return new File(w); } } return super.resolve(dir, pn); }
return null; if (StringUtils.isEmptyOrNull(v) || (v != null && v.startsWith("jgit"))) { //$NON-NLS-1$ return null; return null; if (StringUtils.isEmptyOrNull(w)) { return null;
if (StringUtils.isEmptyOrNull(s)) { throw new URISyntaxException("The uri was empty or null", //$NON-NLS-1$ JGitText.get().cannotParseGitURIish);
/** {@inheritDoc} */ @Override protected File discoverGitExe() { String path = SystemReader.getInstance().getenv("PATH"); //$NON-NLS-1$ File gitExe = searchPath(path, "git.exe", "git.cmd"); //$NON-NLS-1$ //$NON-NLS-2$ if (gitExe == null) { if (searchPath(path, "bash.exe") != null) { //$NON-NLS-1$ // This isn't likely to work, but its worth trying: // If bash is in $PATH, git should also be in $PATH. String w; try { w = readPipe(userHome(), new String[]{"bash", "--login", "-c", "which git"}, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Charset.defaultCharset().name()); } catch (CommandFailedException e) { LOG.warn(e.getMessage()); return null; } if (!StringUtils.isEmptyOrNull(w)) { // The path may be in cygwin/msys notation so resolve it right away gitExe = resolve(null, w); } } } return gitExe; }
/** {@inheritDoc} */ @Override protected File discoverGitExe() { String path = SystemReader.getInstance().getenv("PATH"); //$NON-NLS-1$ File gitExe = searchPath(path, "git"); //$NON-NLS-1$ if (gitExe == null) { if (SystemReader.getInstance().isMacOS()) { if (searchPath(path, "bash") != null) { //$NON-NLS-1$ // On MacOSX, PATH is shorter when Eclipse is launched from the // Finder than from a terminal. Therefore try to launch bash as a // login shell and search using that. String w; try { w = readPipe(userHome(), new String[]{"bash", "--login", "-c", "which git"}, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Charset.defaultCharset().name()); } catch (CommandFailedException e) { LOG.warn(e.getMessage()); return null; } if (!StringUtils.isEmptyOrNull(w)) { gitExe = new File(w); } } } } return gitExe; }
private void determineAtomicFileCreationSupport() { // @TODO: enhance SystemReader to support this without copying code AtomicFileCreation ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openUserConfig(null, this)); if (ret == AtomicFileCreation.UNDEFINED && StringUtils.isEmptyOrNull(SystemReader.getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY))) { ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openSystemConfig(null, this)); } supportsAtomicCreateNewFile = ret; }
boolean withUser = false; String uPath = uri.getPath(); boolean hasPath = !StringUtils.isEmptyOrNull(uPath); if (hasPath) { uPath = normalize(uPath); if (StringUtils.isEmptyOrNull(cPath)) { matchLength = 0; } else {
super(options); if (StringUtils.isEmptyOrNull(SystemReader.getInstance().getenv( Constants.GIT_CONFIG_NOSYSTEM_KEY))) systemConfig = SystemReader.getInstance().openSystemConfig(null,
/** * Set the feature branch prefix * * @param feature * @return {@code this} */ public InitContext setFeature(String feature) { checkState(!StringUtils.isEmptyOrNull(feature)); this.feature = feature; return this; }
private void setHistoryDone(CommandContext<StateUpdateRequest> ctx) { StateUpdateRequest request = ctx.getMessage().getBody(); log.debug("Setting history entry {} as done.", request); if(!StringUtils.isEmptyOrNull(request.getUuid())) { historyManager.markHistoryEntryAsFinished(request.getUuid()); } }