You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Ramkumar Ramalingam (JIRA)" <tu...@ws.apache.org> on 2008/05/30 13:21:45 UTC

[jira] Created: (TUSCANY-2354) Fix required for the unreachable code in policy processors

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.