Fix required for the unreachable code in policy processors
----------------------------------------------------------

                 Key: TUSCANY-2354
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2354
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Core Runtime
    Affects Versions: Java-SCA-Next
         Environment: Windows XP,
            Reporter: Ramkumar Ramalingam
            Assignee: Ramkumar Ramalingam
             Fix For: Java-SCA-Next


For creating an itests for the validation messages, it was a requirement to 
reproduce all kind of exceptions thrown from various processors in the runtime. 
I came across this issue of unreachable code in the policy processors 
(especially in PolicyIntentProcessor.java and PolicySetProcessor.java). Here is 
the piece of code from resolveProfileIntent method of 
PolicyIntentProcessor.java to explain.....
 
for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
     if (requiredIntent.isUnresolved()) {
      Intent resolvedRequiredIntent = resolver.resolveModel(Intent.class, 
requiredIntent);                 
        if (resolvedRequiredIntent != null) {
           requiredIntents.add(resolvedRequiredIntent);
        } else {
          error("RequiredIntentNotFound", resolver, requiredIntent, 
policyIntent);
          throw new ContributionResolveException("Required Intent - " + 
requiredIntent
          + " not found for ProfileIntent "
             + policyIntent);
        }
    } else {
      requiredIntents.add(requiredIntent);
    }
  }
 
Here the resolver.resolveModel does not seem to return null in any case, what 
happens is if the resolver is unable to resolve the model it just returns the 
unresolved model. So the if condition checking for resolvedRequiredIntent for 
null never fails and the later part of the code in the else condition is never 
reached.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to