Java Code Examples for org.apache.brooklyn.util.text.Strings#containsAny()

The following examples show how to use org.apache.brooklyn.util.text.Strings#containsAny() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BundleUpgradeParser.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
private static VersionRangedName parseVersionRangedName(String val, boolean singleVersionIsOsgiRange) {
    try {
        return VersionRangedName.fromString(val, singleVersionIsOsgiRange);
    } catch (Exception e) {
        if (Strings.containsAny(val, "(", ")", "[", "]") &&
                !Strings.containsAny(val, "'", "\"")) {
            throw Exceptions.propagateAnnotated("Entry cannot be parsed. If defining a range on an entry you must quote the entry.", e);
        }
        throw Exceptions.propagate(e);
    }
}
 
Example 2
Source File: BundleUpgradeParser.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
private static VersionRangedName parseVersionRangedName(String name, String range, boolean singleVersionIsOsgiRange) {
    try {
        return new VersionRangedName(name, range, singleVersionIsOsgiRange);
    } catch (Exception e) {
        if (Strings.containsAny(range, "(", ")", "[", "]") &&
                !Strings.containsAny(range, "'", "\"")) {
            throw Exceptions.propagateAnnotated("Entry cannot be parsed. If defining a range on an entry you must quote the entry.", e);
        }
        throw Exceptions.propagate(e);
    }
}