[ 
https://issues.apache.org/jira/browse/IMPERIUS-23?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695108#action_12695108
 ] 

David Wood commented on IMPERIUS-23:
------------------------------------

The latter exception seems to be happening because the symbol table is a map of 
only the method name to a MethodSymbol per the following taken from  from 
JavaDataCollectorImpl._populateClassMethods().

                                // construct a method symbol 
                                Symbol s = new MethodSymbol(methodName, 
internalReturnType, isReturnArray, returnReferenceTypeName, argTypeList, null);

                                // Insert into map
                                symbolMap.put(methodName, s);

Any thoughts on how to address this?  On the parsing side, the code in 
AnchorMethodInvokeAction only looks at a single symbol returned from the map 
(which by this time is an SPLSymbolTable and not a simple Map as in the above).

    public static void validateActualParameters(SPLSymbolTable symTab,
            String classNameOrVariableName, String methodName, List pList)
            throws SPLException 
    {
        MethodSymbol methodSym = (MethodSymbol) symTab
                .getSymbol(classNameOrVariableName + "." + methodName);
        List argTypeList = methodSym.getArgumentList();



> Infinite loop, and then parse error.
> ------------------------------------
>
>                 Key: IMPERIUS-23
>                 URL: https://issues.apache.org/jira/browse/IMPERIUS-23
>             Project: Imperius
>          Issue Type: Bug
>         Environment: Windows, Java 1.5.
>            Reporter: David Wood
>            Assignee: Bill Stoddard
>
> The following simple policy when parsed causes a hang, which I believe is an 
> infinite loop (see below):
> Import Class java.util.Properties:prop;
> Strategy Execute_All_Applicable;
> Policy 
> {
>       Condition 
>       {  
>          1 == 1 && prop.getProperty("foo","bar").equals("foo")
>       }
>       Decision 
>       {   
>               prop.getProperty("foo")
>       }
> }:1;
> I found a loop in PrimaryExpression.validate() that may not always execute an 
> Iterator.next() as follows:
>               while(identTupleIt.hasNext())
>               {
>                       if(returnType.getType() == TypeConstants.referenceType)
>                       {
>                               String referenceTypeName = 
> returnType.getReferenceTypeName();
>                               IdentPrimaryTuple ipt = 
> (IdentPrimaryTuple)identTupleIt.next();
>                               if(i++ == 0) // first element in the list has 
> the same symbol table
>                               { // as the primary expression
>                                       ipt.setSymbolTable(_symTab);
>                               }
>                               returnType = ipt.validate(referenceTypeName);
>                       } else {
>                               identTupleIt.next();    // <--- Added by dawood
>                       }
>                       
>                       
>               }
> However, this then causes the following exception....
> Mar 3, 2009 4:35:43 PM 
> org.apache.imperius.spl.parser.expressions.impl.LogicalAnd <init>
> SEVERE: main validation error: 
> org.apache.imperius.spl.parser.expressions.impl.LogicalAnd has wrong data 
> type passed in.
> Mar 3, 2009 4:35:43 PM org.apache.imperius.spl.parser.compiler.SPLTreeParser 
> expr
> SEVERE: main TreeParser::Exception creating Expression at line 7 : validation 
> error: org.apache.imperius.spl.parser.expressions.impl.LogicalAnd has wrong 
> data type passed in.
>  validation error: org.apache.imperius.spl.parser.expressions.impl.LogicalAnd 
> has wrong data type passed in.
> Number of Formal and passed parameters don't match for method getProperty
> Mar 3, 2009 4:35:43 PM 
> org.apache.imperius.spl.datastore.impl.PolicyParserImpl parseFile
> SEVERE: Error encountered while parsing tree
> Exception in thread "main" 
> org.apache.imperius.spl.parser.exceptions.SPLException: Error encountered 
> while parsing tree
>       at 
> org.apache.imperius.spl.datastore.impl.PolicyParserImpl.parseFile(PolicyParserImpl.java:166)
>       at 
> org.apache.imperius.spl.datastore.impl.PolicyParserImpl.createInternalPolicyObject(PolicyParserImpl.java:96)
>       at 
> com.ibm.watson.pml.spl.policy.SPLJavaParser.parse(SPLJavaParser.java:47)
>       at com.ibm.watson.pml.PolicyParser.main(PolicyParser.java:66)

-- 
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