You are viewing a plain text version of this content. The canonical link for it is here.
Posted to imperius-dev@incubator.apache.org by "David Wood (JIRA)" <ji...@apache.org> on 2009/05/27 15:52:45 UTC

[jira] Updated: (IMPERIUS-23) Infinite loop, and then parse error.

     [ https://issues.apache.org/jira/browse/IMPERIUS-23?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Wood updated IMPERIUS-23:
-------------------------------

    Attachment: Imperius23.java

This Imperius23.java file reproduces the problem and generates the following error message.

Number of Formal and passed parameters don't match for method getProperty

> 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
>         Attachments: Imperius23.java
>
>
> 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.