public static String getRuleSetFilename(String rulesetFileName) { return FilenameUtils.getBaseName(StringUtils.chomp(rulesetFileName)); }
public static String getRuleSetClasspath(RuleSet ruleset) { final String RESOURCES_PATH = "/resources/"; String filename = FilenameUtils.normalize(StringUtils.chomp(ruleset.getFileName()), true); int startIndex = filename.lastIndexOf(RESOURCES_PATH); if (startIndex > -1) { return filename.substring(startIndex + RESOURCES_PATH.length()); } else { return filename; } }
final String expectedResult = chompCase[1]; assertEquals("chomp(String) failed", expectedResult, StringUtils.chomp(original)); "foo", StringUtils.chomp("foobar", "bar")); assertEquals("chomp(String, String) failed", "foobar", StringUtils.chomp("foobar", "baz")); assertEquals("chomp(String, String) failed", "foo", StringUtils.chomp("foo", "foooo")); assertEquals("chomp(String, String) failed", "foobar", StringUtils.chomp("foobar", "")); assertEquals("chomp(String, String) failed", "foobar", StringUtils.chomp("foobar", null)); assertEquals("chomp(String, String) failed", "", StringUtils.chomp("", "foo")); assertEquals("chomp(String, String) failed", "", StringUtils.chomp("", null)); assertEquals("chomp(String, String) failed", "", StringUtils.chomp("", "")); assertEquals("chomp(String, String) failed", null, StringUtils.chomp(null, "foo")); assertEquals("chomp(String, String) failed", null, StringUtils.chomp(null, null)); assertEquals("chomp(String, String) failed", null, StringUtils.chomp(null, "")); assertEquals("chomp(String, String) failed", "", StringUtils.chomp("foo", "foo")); assertEquals("chomp(String, String) failed", " ", StringUtils.chomp(" foo", "foo"));
@Override public Object apply(List<Object> strings) { if(strings == null || strings.size() == 0 ) { throw new IllegalArgumentException("[CHOMP] missing argument: string to be chopped"); } String var = strings.get(0) == null?null: (String) strings.get(0); if(var == null) { return null; } else if(var.length() == 0) { return var; } else { return StringUtils.chomp(var); } } }
strippedComments = StringUtils.chomp(strippedComments);
public PartialBootstrapTask(String name, String description, String resource, String itemPath, int importUUIDBehavior) { super(name, description); this.importUUIDBehavior = importUUIDBehavior; this.resource = resource; this.itemPath = StringUtils.chomp(itemPath, "/").replace(".", ".."); this.itemName = StringUtils.substringAfterLast(itemPath, "/"); }
@Override public void parse(byte[] buf) { String value = new String(buf); value = StringUtils.chomp(value); groupId = new BigInteger(value); }
private Set<String> convertPathsToPackages(Set<String> resources) { Set<String> packageNames = new HashSet<String>(resources.size()); for(String resource : resources) { packageNames.add(StringUtils.chomp(StringUtils.replace(resource, "/", "."), ".")); } return packageNames; }
private static String getUsage(List<String> lines) { StringBuilder sb = new StringBuilder(); if (lines != null) { for (String line : lines) { if (line != null) { sb.append(StringUtils.chomp(line)); sb.append(line.length() < 27 ? " " : ""); } } } return WordUtils.capitalizeFully(sb.toString().trim(), ' ', '/'); }
/** * cleans the final markup * * @param content the markup to clean up * @return cleaned markup. */ protected String cleanContent(final String content) { return chomp(nullToEmpty(content)).replaceAll("\"", "\\\""); }
@Override public void parse(byte[] buf) { String value = new String(buf); value = StringUtils.chomp(value); this.gtIdSet = GtIdSet.buildFromString(value); }
/** * @param path path relative to the root of webapp * @return Full absolute path including protocol, domain and webapp prefix */ public String composeFullAbsolutePath(String path) { String webAppUrl = configuration.getConfig(GlobalConfig.class).getWebAppUrl(); webAppUrl = StringUtils.chomp(webAppUrl, "/"); //remove last slash return path.startsWith("/") ? webAppUrl.concat(path) : webAppUrl.concat("/").concat(path); }
@Override public void parse(byte[] buf) { String info = new String(buf); info = StringUtils.chomp(info); String[] array = info.split(";"); for (String val : array) { MysqlSyncPoint pt = new MysqlSyncPoint(); pt.fromString(val); syncPointGroup.add(pt); } }
public static String chomp(ActionContext actionContext){ Thing self = actionContext.getObject("self"); String str = (String) self.doAction("getStr", actionContext); return StringUtils.chomp(str); }
@Override public void protocolReplyReceived(final ProtocolCommandEvent event) { this.log(Type.response, StringUtils.chomp(event.getMessage())); }
@Override public void run() { String currentVersion = getVersion(); System.out.println("Current Version: " + currentVersion); try { String latestVersion = chomp(Resources.asCharSource(new URL("http://repo.joist.ws/mirror-version"), Charsets.UTF_8).read()); System.out.println("Latest Version: " + latestVersion); if (!currentVersion.equals(latestVersion)) { System.out.println("Comparison: https://github.com/stephenh/mirror/compare/" + toRef(currentVersion) + "..." + toRef(latestVersion)); } } catch (Exception e) { log.error("Could not find latest version", e); } }
public BackgroundException map(final String message, final T failure) { final BackgroundException exception = this.map(failure); final StringBuilder m = new StringBuilder(); this.append(m, StringUtils.chomp(LocaleFactory.localizedString(message, "Error"))); exception.setMessage(m.toString()); return exception; }
@Override public String getModificationTime(final String file) throws IOException { final String status = super.getModificationTime(file); if(null == status) { throw new FTPException(this.getReplyCode(), this.getReplyString()); } return StringUtils.chomp(status.substring(3).trim()); } }
@Override public void protocolCommandSent(final ProtocolCommandEvent event) { final String message = StringUtils.chomp(event.getMessage()); if(message.startsWith(FTPCmd.PASS.name())) { this.log(Type.request, String.format("%s %s", FTPCmd.PASS.name(), StringUtils.repeat("*", StringUtils.length(StringUtils.removeStart(message, FTPCmd.PASS.name()))))); } else { this.log(Type.request, message); } }