List of usage examples for org.apache.commons.lang StringUtils trim
public static String trim(String str)
Removes control characters (char <= 32) from both ends of this String, handling null
by returning null
.
From source file:com.bstek.dorado.core.el.ExpressionUtilsObject.java
public String trim(String s) { return StringUtils.trim(s); }
From source file:com.edgenius.wiki.PageTheme.java
public String getSpaceMenuMarkup() { return StringUtils.trim(spaceMenuMarkup); }
From source file:eu.arthepsy.sonar.plugins.scapegoat.rule.ScapegoatReportSensor.java
private void parseWarning(SensorContext context, SMInputCursor cursor) throws XMLStreamException { String warnText = StringUtils.trim(cursor.getAttrValue("text")); int warnLine = Integer.valueOf(StringUtils.trim(cursor.getAttrValue("line"))); String warnFile = StringUtils.trim(cursor.getAttrValue("file")); String warnInspection = StringUtils.trim(cursor.getAttrValue("inspection")); RuleKey ruleKey = RuleKey.of(ScapegoatRulesDefinition.SCAPEGOAT_REPOSITORY, warnInspection); ActiveRule rule = context.activeRules().find(ruleKey); if (rule != null) { warnFile = this.parseFilePath(warnFile); FilePredicates p = context.fileSystem().predicates(); InputFile inputFile = context.fileSystem().inputFile(p.hasAbsolutePath(warnFile)); //handle relative path if (inputFile == null) { File sourceFolder = new File(context.fileSystem().baseDir(), context.settings().getString("sonar.sources")); warnFile = new File(sourceFolder, warnFile).getAbsolutePath(); inputFile = context.fileSystem().inputFile(p.hasAbsolutePath(warnFile)); }//from w ww.j a va2s .com if (inputFile != null) { Resource resource = org.sonar.api.resources.File.create(inputFile.relativePath()); Issuable issuable = perspectives.as(Issuable.class, resource); if (issuable != null) { IssueBuilder builder = context.issueBuilder(); Issue issue = builder.ruleKey(ruleKey).onFile(inputFile).atLine(warnLine) .severity(rule.severity().toString()).message(warnText).build(); String componentKey = getComponentKey(project, resource); DefaultIssue di = new org.sonar.core.issue.DefaultIssueBuilder().componentKey(componentKey) .projectKey(project.key()) .ruleKey(RuleKey.of(issue.ruleKey().repository(), issue.ruleKey().rule())) .effortToFix(issue.effortToFix()).line(issue.line()).message(issue.message()) .severity(issue.severity()).build(); issuable.addIssue(di); } else { LOG.warn(LOG_PREFIX + "could not create issue from file: " + inputFile.toString()); } } else { LOG.warn(LOG_PREFIX + "report source file not found: " + warnFile); } } else { LOG.warn(LOG_PREFIX + "report rule not active: " + warnInspection); } }
From source file:com.carlos.projects.billing.ExcelToMySQLImporter.java
private Family createFamilyFromRow(Row row) { Family family = new Family(); family.setCode(StringUtils.trim(row.getCell(FAMILY_CODE).getStringCellValue())); family.setDescription(StringUtils.trim(row.getCell(FAMILY_DESCRIPTION).getStringCellValue())); return family; }
From source file:jp.ikedam.jenkins.plugins.extensible_choice_parameter.FilenameChoiceListProvider.java
/** * The constructor called when a user posts a form. * /*from w ww. j av a 2 s.com*/ * @param baseDirPath a path to the directory to scan. * @param includePattern a pattern of file names to include to the list. * @param excludePattern a pattern of file names to exclude from the list. * @param scanType a type of files to list. */ @DataBoundConstructor public FilenameChoiceListProvider(String baseDirPath, String includePattern, String excludePattern, ScanType scanType, boolean reverseOrder) { this.baseDirPath = StringUtils.trim(baseDirPath); this.includePattern = StringUtils.trim(includePattern); this.excludePattern = StringUtils.trim(excludePattern); this.scanType = scanType; this.reverseOrder = reverseOrder; }
From source file:hudson.plugins.sonar.utils.PathResolverOperator.java
protected Set<String> doResolvePathSegments(String key, String value) throws IOException, InterruptedException { if (!PATH_PROPERTIES.contains(key)) { return Sets.newHashSet(value); }//from ww w. j av a2 s . c om String trimmedValue = StringUtils.trim(value); if (StringUtils.isEmpty(trimmedValue)) { return Sets.newHashSet(value); } Iterable<String> pathIterable = Splitter.on(",").trimResults().omitEmptyStrings().split(trimmedValue); Set<String> result = Sets.newHashSet(); for (String path : pathIterable) { result.addAll(doResolvePath(key, path)); } return result; }
From source file:com.sonicle.webtop.core.bol.model.UserEntity.java
private String buildDisplayName() { String dn = StringUtils .trim(StringUtils.defaultIfBlank(firstName, "") + " " + StringUtils.defaultIfBlank(lastName, "")); return StringUtils.isBlank(dn) ? userId : dn; }
From source file:com.hangum.tadpole.rdb.core.viewers.object.sub.rdb.table.columns.TableColumnComposite.java
/** * Create the composite./*from w ww .j ava2 s . c o m*/ * @param parentFolder * @param style */ public TableColumnComposite(TadpoleTableComposite tableComposite, CTabFolder parentFolder, int style) { super(tableComposite, parentFolder, style); CTabItem tbtmTable = new CTabItem(parentFolder, SWT.NONE); tbtmTable.setText(Messages.get().Columns); tbtmTable.setData(Messages.get().Columns); Composite compositeColumn = new Composite(parentFolder, SWT.NONE); tbtmTable.setControl(compositeColumn); GridLayout gl_compositeTables = new GridLayout(1, false); gl_compositeTables.verticalSpacing = 2; gl_compositeTables.horizontalSpacing = 2; gl_compositeTables.marginHeight = 2; gl_compositeTables.marginWidth = 2; compositeColumn.setLayout(gl_compositeTables); SashForm sashForm = new SashForm(compositeColumn, SWT.NONE); sashForm.setOrientation(SWT.VERTICAL); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tableColumnViewer = new TableViewer(sashForm, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.Move); tableColumnViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { IStructuredSelection is = (IStructuredSelection) event.getSelection(); if (null != is) { TableColumnDAO tableDAO = (TableColumnDAO) is.getFirstElement(); FindEditorAndWriteQueryUtil.runAtPosition(StringUtils.trim(tableDAO.getField())); } } }); Table tableTableColumn = tableColumnViewer.getTable(); tableTableColumn.setHeaderVisible(true); tableTableColumn.setLinesVisible(true); tableColumnComparator = new TableColumnComparator(); tableColumnViewer.setSorter(tableColumnComparator); createTableColumne(); createTableColumnMenu(); tableColumnViewer.setContentProvider(new ArrayContentProvider()); tableColumnViewer.setLabelProvider(new TableColumnLabelprovider(getTableComposite().getTableListViewer(), getTableComposite().getTableDecorationExtension())); sashForm.setWeights(new int[] { 1 }); }
From source file:com.flexive.shared.media.impl.FxMimeType.java
/** * Construct a MimeType from a given String. If the parameterized mime type cannot be identified, * a DEFAULT mime type of "application/octet-stream" will be constructed * A null input will return "unknown/unknown" * * @param mimeType the mimetype as a String, e.g. "application/pdf" * @return returns a MimeType/*from w ww . j a v a 2s. co m*/ */ public static FxMimeType getMimeType(String mimeType) { if (mimeType == null) mimeType = ""; final String[] s = mimeType.split("/"); final String type = StringUtils.trim(s[0].toLowerCase()); final String subType; if (s.length > 1 && !StringUtils.isBlank(type)) subType = StringUtils.trim(s[1].toLowerCase()); else if (StringUtils.isBlank(type)) return new FxMimeType(FxMimeType.UNKNOWN, FxMimeType.UNKNOWN); else subType = UNKNOWN; return new FxMimeType(type, subType); }
From source file:com.qualogy.qafe.business.resource.rdb.RDBDatasource.java
private List<FileLocation> getFileLocations(final ApplicationContext context) { final List<FileLocation> fileLocations = new ArrayList<FileLocation>(); final FileLocation stmtFileNameTemp = getResource().getStatementsFileUrl(); if (stmtFileNameTemp != null) { if (stmtFileNameTemp.getLocation().contains(",")) { final String[] stmtFiles = getResource().getStatementsFileUrl().getLocation().split(","); for (final String stmtFile : stmtFiles) { String root = stmtFileNameTemp.getRoot(); final FileLocation fileLocation; if (root == null && stmtFile.startsWith(FileLocation.SCHEME_FILE)) { fileLocation = new FileLocation(stmtFile); } else { root = context.getRoot(); fileLocation = new FileLocation(StringUtils.trim(root), StringUtils.trim(stmtFile)); }// w w w . jav a 2s . c o m fileLocations.add(fileLocation); } } else { fileLocations.add(getResource().getStatementsFileUrl()); } } return fileLocations; }