[jboss-cvs] JBossAS SVN: r104836 - projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun May 16 09:46:32 EDT 2010
Author: alesj
Date: 2010-05-16 09:46:32 -0400 (Sun, 16 May 2010)
New Revision: 104836
Modified:
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard/WildcardClassLoaderPolicy.java
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard/WildcardRequirementDependencyItem.java
Log:
Move check logic.
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard/WildcardClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard/WildcardClassLoaderPolicy.java 2010-05-16 12:06:37 UTC (rev 104835)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard/WildcardClassLoaderPolicy.java 2010-05-16 13:46:32 UTC (rev 104836)
@@ -34,7 +34,6 @@
import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classloading.plugins.metadata.PackageRequirement;
import org.jboss.classloading.spi.dependency.*;
-import org.jboss.classloading.spi.metadata.Requirement;
import org.jboss.util.collection.ConcurrentSet;
/**
@@ -77,18 +76,10 @@
if (item == null)
throw new IllegalArgumentException("Null item");
- Requirement requirement = item.getRequirement();
- if (requirement == null || requirement instanceof PackageRequirement == false)
- throw new IllegalArgumentException("Illegal requirement: " + requirement);
- PackageRequirement pr = (PackageRequirement) requirement;
- if (pr.isWildcard() == false)
- throw new IllegalArgumentException("Requirement is not wildcard: " + pr);
- if (item.getModule() == null)
- throw new IllegalArgumentException("Null module");
-
this.domain = domain;
this.item = item;
- this.requirement = pr;
+
+ this.requirement = item.getRequirement();
this.module = item.getModule();
ClassLoading classLoading = domain.getClassLoading();
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard/WildcardRequirementDependencyItem.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard/WildcardRequirementDependencyItem.java 2010-05-16 12:06:37 UTC (rev 104835)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/dependency/wildcard/WildcardRequirementDependencyItem.java 2010-05-16 13:46:32 UTC (rev 104836)
@@ -21,6 +21,7 @@
*/
package org.jboss.classloading.spi.dependency.wildcard;
+import org.jboss.classloading.plugins.metadata.PackageRequirement;
import org.jboss.classloading.spi.dependency.Module;
import org.jboss.classloading.spi.dependency.RequirementDependencyItem;
import org.jboss.classloading.spi.metadata.Requirement;
@@ -41,14 +42,37 @@
public WildcardRequirementDependencyItem(Module module, Requirement requirement, ControllerState state)
{
super(module, requirement, state);
+ check();
}
public WildcardRequirementDependencyItem(Module module, Requirement requirement, ControllerState whenRequired, ControllerState dependentState)
{
super(module, requirement, whenRequired, dependentState);
+ check();
}
+ /**
+ * Check if inputs are valid.
+ */
+ private void check()
+ {
+ Requirement requirement = super.getRequirement();
+ if (requirement == null || requirement instanceof PackageRequirement == false)
+ throw new IllegalArgumentException("Illegal requirement: " + requirement);
+ PackageRequirement pr = (PackageRequirement) requirement;
+ if (pr.isWildcard() == false)
+ throw new IllegalArgumentException("Requirement is not wildcard: " + pr);
+ if (getModule() == null)
+ throw new IllegalArgumentException("Null module");
+ }
+
@Override
+ public PackageRequirement getRequirement()
+ {
+ return (PackageRequirement) super.getRequirement();
+ }
+
+ @Override
public boolean resolve(Controller controller)
{
// Always resolved
More information about the jboss-cvs-commits
mailing list