use of org.apache.commons.text.StringTokenizer in project synopsys-detect by blackducksoftware.
the class CommandParser method parseCommandString.
public List<String> parseCommandString(String commandString) {
logger.trace(String.format("origCommand : %s", commandString));
String quotesRemovedCommand = encodeQuotedWhitespace(commandString);
logger.trace(String.format("quotesRemovedCommand: %s", quotesRemovedCommand));
StringTokenizer tokenizer = new StringTokenizer(quotesRemovedCommand);
tokenizer.setQuoteMatcher(StringMatcherFactory.INSTANCE.quoteMatcher());
List<String> commandList = new ArrayList<>();
while (tokenizer.hasNext()) {
String token = tokenizer.nextToken();
String part = restoreWhitespace(token);
commandList.add(part);
}
return commandList;
}
use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class DesktopExternalUIComponentsSource method _registerAppComponents.
protected void _registerAppComponents() {
String configNames = AppContext.getProperty(DESKTOP_COMPONENTS_CONFIG_XML_PROP);
if (Strings.isNullOrEmpty(configNames)) {
return;
}
log.debug("Loading UI components from {}", configNames);
StringTokenizer tokenizer = new StringTokenizer(configNames);
for (String location : tokenizer.getTokenArray()) {
Resource resource = resources.getResource(location);
if (resource.exists()) {
InputStream stream = null;
try {
stream = resource.getInputStream();
_registerComponent(stream);
} catch (ClassNotFoundException | IOException e) {
throw new RuntimeException("Unable to load components config " + location, e);
} finally {
IOUtils.closeQuietly(stream);
}
} else {
log.warn("Resource {} not found, ignore it", location);
}
}
}
use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class TestContainer method initAppContext.
protected void initAppContext() {
EclipseLinkCustomizer.initTransientCompatibleAnnotations();
String configProperty = AppContext.getProperty(AbstractAppContextLoader.SPRING_CONTEXT_CONFIG);
StringTokenizer tokenizer = new StringTokenizer(configProperty);
List<String> locations = tokenizer.getTokenList();
StringTokenizer configTokenizer = new StringTokenizer(getSpringConfig());
locations.addAll(configTokenizer.getTokenList());
springAppContext = new CubaClassPathXmlApplicationContext(locations.toArray(new String[0]));
AppContext.Internals.setApplicationContext(springAppContext);
Events events = springAppContext.getBean(Events.NAME, Events.class);
events.publish(new AppContextInitializedEvent(springAppContext));
}
use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class DefaultPermissionValuesConfig method init.
protected void init() {
permissionValues.clear();
String configName = AppContext.getProperty("cuba.defaultPermissionValuesConfig");
if (!StringUtils.isBlank(configName)) {
StringTokenizer tokenizer = new StringTokenizer(configName);
for (String fileName : tokenizer.getTokenArray()) {
parseConfigFile(fileName);
}
}
}
use of org.apache.commons.text.StringTokenizer in project cuba by cuba-platform.
the class AppPropertiesTest method testEmptyStringSubstitution.
@Test
public void testEmptyStringSubstitution() {
AppProperties appProperties = new AppProperties(new AppComponents("test"));
appProperties.setProperty("refapp.myConfig", "1.xml ${ext.myConfig} 2.xml");
appProperties.setProperty("ext.myConfig", "");
String propValue = appProperties.getProperty("refapp.myConfig");
log.debug("Property value: '" + propValue + "'");
StringTokenizer tokenizer = new StringTokenizer(propValue);
String[] locations = tokenizer.getTokenArray();
Assertions.assertArrayEquals(new String[] { "1.xml", "2.xml" }, locations);
}
Aggregations