diff options
Diffstat (limited to 'bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java')
-rw-r--r-- | bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java index 7b466c710..43b6af515 100644 --- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2005, 2010). All Rights Reserved. + * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Dictionary; import java.util.Hashtable; - import org.osgi.framework.Bundle; import org.osgi.framework.Filter; import org.osgi.framework.FrameworkUtil; @@ -61,34 +60,28 @@ public class BundleLocationCondition { * ignored. * @return Condition object for the requested condition. */ - static public Condition getCondition(final Bundle bundle, - final ConditionInfo info) { + static public Condition getCondition(final Bundle bundle, final ConditionInfo info) { if (!CONDITION_TYPE.equals(info.getType())) - throw new IllegalArgumentException( - "ConditionInfo must be of type \"" + CONDITION_TYPE + "\""); + throw new IllegalArgumentException("ConditionInfo must be of type \"" + CONDITION_TYPE + "\""); String[] args = info.getArgs(); if (args.length != 1 && args.length != 2) throw new IllegalArgumentException("Illegal number of args: " + args.length); - String bundleLocation = AccessController - .doPrivileged(new PrivilegedAction<String>() { - public String run() { - return bundle.getLocation(); - } - }); + String bundleLocation = AccessController.doPrivileged(new PrivilegedAction<String>() { + public String run() { + return bundle.getLocation(); + } + }); Filter filter = null; try { - filter = FrameworkUtil.createFilter("(location=" - + escapeLocation(args[0]) + ")"); - } - catch (InvalidSyntaxException e) { + filter = FrameworkUtil.createFilter("(location=" + escapeLocation(args[0]) + ")"); + } catch (InvalidSyntaxException e) { // this should never happen, but just in case throw new RuntimeException("Invalid filter: " + e.getFilter(), e); } Dictionary<String, String> matchProps = new Hashtable<String, String>(2); matchProps.put("location", bundleLocation); boolean negate = (args.length == 2) ? "!".equals(args[1]) : false; - return (negate ^ filter.match(matchProps)) ? Condition.TRUE - : Condition.FALSE; + return (negate ^ filter.match(matchProps)) ? Condition.TRUE : Condition.FALSE; } private BundleLocationCondition() { |