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 <da...@us.ibm.com> on 2009/06/01 14:10:51 UTC
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
Xiping,
As to change1, won't that cause other problems, won't? The fix
essentially turns off type checking for array types, which will cause a
different exception when an array is passed to a non-array, or vice versa.
Is there a way to properly set the isArray bit on the input argument?
David Wood
Policy Technologies Group
IBM TJ Watson Research Center
dawood@us.ibm.com
914-784-5123 (office), 914-396-6515 (mobile)
From:
Xiping Wang/Watson/IBM@IBMUS
To:
imperius-dev@incubator.apache.org
Date:
05/29/2009 09:35 AM
Subject:
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
After investigation, I think this problem can probably be fixed by
changing the following two places in AnchorMethodInvokeAction,java
I've tested my local changes and it works, but not sure if there will be
any side effects.
Neeraj could you please comment on this.
Xiping
=======================================================
change 1:
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();
Iterator formalParamTypeIt = argTypeList.iterator();
Iterator actualParamIt = pList.iterator();
if (argTypeList.size() == pList.size())
{
while (formalParamTypeIt.hasNext() && actualParamIt.hasNext())
{
Argument formalArg = (Argument) formalParamTypeIt.next();
Expression actualParam = (Expression) actualParamIt.next();
//Xiping 05/29/09
// if (!TypeResolver.isTypeAssignableForEquality(formalArg
// .getType(), actualParam.getType())
// || formalArg.getIsArray() != actualParam.isArray())
if (!TypeResolver.isTypeAssignableForEquality(formalArg
.getType(), actualParam.getType()))
{
throw new SPLException(
Messages
.getString("SPL_METHOD_PASSED_ARGUMENTS_EXCEPTION_MSG")
+ " " + methodName);
}
}
}
else
{
System.err
.println("Number of Formal and passed parameters don't match for method "
+ methodName);
// throw new SPLException("Number of Formal and passed parameters don't
match for method "
// + methodName);
}
}
change 2:
public static Object invokeClassMethod(SPLSymbolTable symTab,
String className, String qualifier, String methodName,
List paramList, Object targetObject) throws SPLException
{
List parameterObjects = new ArrayList();
try
{
MethodSymbol methodSym = (MethodSymbol) symTab.getSymbol(className
+ "." + methodName);
List argTypeList = methodSym.getArgumentList();
for (int i = 0; i < paramList.size(); i++)
{
Expression exp = (Expression) paramList.get(i);
if (exp instanceof AssignmentExpression) {
//System.out.println("assignment Expression");
Expression lhsExpression = null;
Expression rhsExpression = null;
AssignmentExpression assignmentExpression = (AssignmentExpression) exp;
if (assignmentExpression.getLHSExpression() instanceof
org.apache.imperius.spl.external.Expression)
{
lhsExpression = (Expression) assignmentExpression
.getLHSExpression();
}
if (assignmentExpression.getRHSExpression() instanceof
org.apache.imperius.spl.external.Expression) {
rhsExpression = (Expression) assignmentExpression
.getRHSExpression();
}
if ((lhsExpression == null) || (rhsExpression == null))
{
logger
.severe("LHS or RHS or argument in method call is null : "
+ lhsExpression.toString()
+ " "
+ rhsExpression);
throw new SPLException(Messages.getString(
"SPL_ASSIGNMENT_EXP_EXCEPTION_MSG",
new Object[] { lhsExpression, rhsExpression }));
}
//System.out.println("lhsExpression class "+ lhsExpression.getClass());
//System.out.println("lhsExpression getPropertyName() "+
((PrimaryExpression) lhsExpression).getPropertyName());
// ((PrimaryExpression)lhsExpression).getPropertyName();
String keyName = ((PrimaryExpression) lhsExpression)
.getclassNameOrInstanceVariableName();
//System.out.println("argument name= " + keyName);
Object keyValue = rhsExpression.evaluate();
//System.out.println("argument value= " + keyValue);
String referenceTypeName = "";
if (TypeResolver.isReference(rhsExpression.getType()))
{
referenceTypeName = rhsExpression.getType()
.getReferenceTypeName();
}
if (keyValue != null)
{
Argument arg = new ArgumentImpl(rhsExpression.getType()
.getType(), keyName, rhsExpression.isArray(),
referenceTypeName);
arg.setValue(keyValue);
//System.out.println("created new arg :"+keyName+" "+keyValue.toString());
/*
* Expression expression=(Expression)pList.get(i); String
* nameAndValue=(String)expression.evaluate(); Key
*/
parameterObjects.add(arg);
}
}
else
{
Object result = exp.evaluate();
boolean isArgCreated = false;
if(argTypeList != null && argTypeList.size() > 0)
{
Argument tempArg = null;
if(i < argTypeList.size())
{
tempArg = (Argument)argTypeList.get(i);
if(TypeResolver.isReference(tempArg.getType()))
{
if (TypeResolver.OBJECT_STRING.equals(tempArg
.getType().getReferenceTypeName())
&& TypeResolver.isString(exp.getType()))
{
Argument arg = new ArgumentImpl(tempArg
.getType().getType(), null, tempArg
.getType().getIsArray(),
TypeResolver.OBJECT_STRING);
arg.setValue(result);
parameterObjects.add(arg);
isArgCreated = true;
}
}
}
else
{
// throw exception
}
}
if(!isArgCreated)
{
//Xiping 05/29/09
Argument tempArg = null;
tempArg = (Argument)argTypeList.get(i);
//
Argument arg = new ArgumentImpl(exp.getType().getType(),
// null, exp.isArray(), null);
null, tempArg.getType().getIsArray(), null);
arg.setValue(result);
parameterObjects.add(arg);
}
}
}
Actuator ac = ActuatorFactory.getActuator();
Object result = ac.invokeMethod(className, qualifier, targetObject,
methodName, parameterObjects);
//System.out.println("method invokation complete : "+className+"
"+qualifier+" "+methodName+" "+targetObject);
//System.out.println("method invokation result of invokation : "+result);
// TO DO COMPARE RESULT WITH CONSTANT
if (result == null)
result = "";
return result;
}
catch (SPLException e)
{
logger.severe(e.getMessage());
logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+ "execute");
// return null;
throw e;
}
}
Xiping Wang/Watson/IBM@IBMUS
Xiping Wang/Watson/IBM@IBMUS
05/28/2009 04:28 PM
Please respond to
imperius-dev@incubator.apache.org
To
imperius-dev@incubator.apache.org
cc
Subject
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
Hi Neeraj,
You are right, but the flag gets set when a policy is parsed without
looking at the corresponding anchor class. A mismatch could occur at
evaluation time depending the return type of a method,
Xiping
IBM TJ Watson Research Center
Neeraj Joshi/Durham/IBM@IBMUS
Neeraj Joshi/Durham/IBM@IBMUS
05/28/2009 01:48 PM
Please respond to
imperius-dev@incubator.apache.org
To
imperius-dev@incubator.apache.org
cc
Subject
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
Hey guys,
There is an isArray variable that gets set automatically based on
reflection. There must be some other issue involved here
Neeraj
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"The light at the end of the tunnel...may be you"
Neeraj Joshi
WebSphere XD - Compute Grid
AIM, IBM
Apache Imperius - http://incubator.apache.org/imperius
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From:
Xiping Wang/Watson/IBM@IBMUS
To:
imperius-dev@incubator.apache.org
Cc:
imperius-dev@incubator.apache.org
Date:
05/28/2009 01:01 PM
Subject:
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
Let's take a look at the line in red in the policy you provided. In you
example, you have getByteArray() method that returns a byte[] return type.
Assume I add another method to the anchor class with the same name but
renturns a byte type. How do you write a SPL policy to distinguish between
these two?
Import Class com.ibm.watson.pml.bytearray.ByteArrayFactory:baf;
Strategy Execute_All_Applicable;
Policy {
Condition { baf.takeByteArray(baf.getByteArray()) }
Decision { ReturnValue(\"OK\") }
}:1;
Xiping
IBM TJ Watson Research Center
David Wood/Watson/IBM@IBMUS
David Wood/Watson/IBM@IBMUS
05/28/2009 12:23 PM
Please respond to
imperius-dev@incubator.apache.org
To
imperius-dev@incubator.apache.org
cc
imperius-dev@incubator.apache.org
Subject
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
I don't think this is an SPL specification issue. This is strictly a
problem with the definition of the method's return type as indicated in
the Java Class object. Somehow that definition is not being picked up as
an array and instead just as a single byte. It _is_ getting the formal
parameter definition correct (i.e. a byte[]).
David Wood
Policy Technologies Group
IBM TJ Watson Research Center
dawood@us.ibm.com
914-784-5123 (office), 914-396-6515 (mobile)
From:
Xiping Wang/Watson/IBM@IBMUS
To:
imperius-dev@incubator.apache.org
Cc:
imperius-dev@incubator.apache.org
Date:
05/28/2009 11:51 AM
Subject:
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
David,
It seems to me that Imperius is not capable of handling array return type
because the SPL does not distinguish between primitive return type and
array return type syntactically.
Xiping
IBM T.J. Watson Research Center
"David Wood (JIRA)" <ji...@apache.org>
"David Wood (JIRA)" <ji...@apache.org>
05/26/2009 08:29 PM
Please respond to
imperius-dev@incubator.apache.org
To
imperius-dev@incubator.apache.org
cc
Subject
[jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
[
https://issues.apache.org/jira/browse/IMPERIUS-28?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
David Wood updated IMPERIUS-28:
-------------------------------
Attachment: ByteArrayFactory.java
PolicyParser.java
> byte[] method return type does not match formal parameter
> ---------------------------------------------------------
>
> Key: IMPERIUS-28
> URL: https://issues.apache.org/jira/browse/IMPERIUS-28
> Project: Imperius
> Issue Type: Bug
> Environment: Windows, Java 1.5
> Reporter: David Wood
> Assignee: Bill Stoddard
> Attachments: ByteArrayFactory.java, PolicyParser.java
>
> Original Estimate: 96h
> Remaining Estimate: 96h
>
> It appears that a method's byte[] return type is not being properly
matched with a byte[] method argument. The attached Java program includes
a policy that passes the byte[] return value of a method to another method
that expects the same. This gives the following message:
> May 26, 2009 8:20:52 PM
org.apache.imperius.spl.parser.compiler.SPLTreeParser identPrimary
> SEVERE: main TreeParser::Exception creating Expression at line 4 :
Formal and passed parameter types don't match for method takeByteArray
> Formal and passed parameter types don't match for method takeByteArray
> May 26, 2009 8:20:52 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.bytearray.PolicyParser.main(PolicyParser.java:55)
> I've attached both the Java program and the ByteArrayFactory interface
that is used in the policy (also found in the Java file).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
Posted by Xiping Wang <xi...@us.ibm.com>.
David,
In the Imperius implementation, it seems to me that an SPL policy is parsed
without looking at the corresponding anchor class, so the internal policy
object generated after parsing actually does not carry the correct type
information except for SPL collections which SPL language can describe
correctly. Since the correct return type info of a method has to be
determined by the anchor class anyway, why can't we just rely on the anchor
class? This is just my thought and we can do more tests to find out if it
really works.
Here are the anchor class and policy I used for test and it works for both
simple byte type and array [] byte type.
package com.ibm.watson.pml.bytearray;
public class ByteArrayFactory {
private byte x[];
private int y;
public ByteArrayFactory(byte[] array) {
x = array;
}
public byte[] getByteArray() {
return x;
}
public boolean takeByteArray(byte[] barray) {
return (barray[0] + barray[1] > 0 ? true : false);
}
// public byte getByteArray() {
// return 3;
// }
//
// public boolean takeByteArray(byte barray) {
// return (barray > 0 ? true : false);
// }
public void setValueY(int value) {
y = value;
}
}
package com.ibm.watson.pml.bytearray;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
import org.apache.imperius.javaspl.JavaActuatorImpl;
import org.apache.imperius.javaspl.JavaDataCollectorImpl;
import org.apache.imperius.javaspl.Java_SPLPolicyRuleProvider;
import org.apache.imperius.spl.datastore.impl.PolicyParserImpl;
import org.apache.imperius.spl.parser.exceptions.SPLException;
import org.apache.imperius.spl.parser.util.ActuatorFactory;
import org.apache.imperius.spl.parser.util.DataCollectorFactory;
public class PolicyParser {
final static String policy =
"Import Class
com.ibm.watson.pml.bytearray.ByteArrayFactory:baf;\n"
+ "Strategy Execute_All_Applicable;\n"
+ "Policy {\n"
+ "Condition { baf.takeByteArray(baf.getByteArray()) }\n"
+ "Decision { baf.setValueY(1) }\n"
+ "}:1;";
public static void main(String[] args) throws SPLException,
IOException {
// PolicyParserImpl imperiusParser = null;
//
// ActuatorFactory.registerActuator(new JavaActuatorImpl());
// DataCollectorFactory.registerDataCollector(new
JavaDataCollectorImpl());
//
// imperiusParser = PolicyParserImpl.getInstance();
// imperiusParser.createInternalPolicyObject("dummy", policy);
//
/////
Map objMap = new Hashtable();
byte array[] = {0, 1};
ByteArrayFactory baf = new ByteArrayFactory(array);
objMap.put("baf", baf);
Java_SPLPolicyRuleProvider jspl =
Java_SPLPolicyRuleProvider.getInstance();
String policyName = "dummy";
try {
jspl.deletePolicy(policyName);
} catch(Exception e) { }
boolean createReturn=jspl.createPolicy(policyName, policy);
System.out.println("Policy Created : " + policyName +createReturn);
System.out.println("");
Object result = jspl.executePolicy(policyName, objMap);
System.out.println("Result is " + result);
}
}
David
Wood/Watson/IBM@I
BMUS To
imperius-dev@incubator.apache.org
06/01/2009 10:10 cc
AM imperius-dev@incubator.apache.org
Subject
Re: [jira] Updated: (IMPERIUS-28)
Please respond to byte[] method return type does not
imperius-dev@incu match formal parameter
bator.apache.org
Xiping,
As to change1, won't that cause other problems, won't? The fix
essentially turns off type checking for array types, which will cause a
different exception when an array is passed to a non-array, or vice versa.
Is there a way to properly set the isArray bit on the input argument?
David Wood
Policy Technologies Group
IBM TJ Watson Research Center
dawood@us.ibm.com
914-784-5123 (office), 914-396-6515 (mobile)
From:
Xiping Wang/Watson/IBM@IBMUS
To:
imperius-dev@incubator.apache.org
Date:
05/29/2009 09:35 AM
Subject:
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
After investigation, I think this problem can probably be fixed by
changing the following two places in AnchorMethodInvokeAction,java
I've tested my local changes and it works, but not sure if there will be
any side effects.
Neeraj could you please comment on this.
Xiping
=======================================================
change 1:
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();
Iterator formalParamTypeIt = argTypeList.iterator();
Iterator actualParamIt = pList.iterator();
if (argTypeList.size() == pList.size())
{
while (formalParamTypeIt.hasNext() && actualParamIt.hasNext())
{
Argument formalArg = (Argument) formalParamTypeIt.next();
Expression actualParam = (Expression) actualParamIt.next();
//Xiping 05/29/09
// if (!TypeResolver.isTypeAssignableForEquality(formalArg
// .getType(), actualParam.getType())
// || formalArg.getIsArray() != actualParam.isArray())
if (!TypeResolver.isTypeAssignableForEquality(formalArg
.getType(), actualParam.getType()))
{
throw new SPLException(
Messages
.getString("SPL_METHOD_PASSED_ARGUMENTS_EXCEPTION_MSG")
+ " " + methodName);
}
}
}
else
{
System.err
.println("Number of Formal and passed parameters don't match for method "
+ methodName);
// throw new SPLException("Number of Formal and passed parameters don't
match for method "
// + methodName);
}
}
change 2:
public static Object invokeClassMethod(SPLSymbolTable symTab,
String className, String qualifier, String methodName,
List paramList, Object targetObject) throws SPLException
{
List parameterObjects = new ArrayList();
try
{
MethodSymbol methodSym = (MethodSymbol) symTab.getSymbol(className
+ "." + methodName);
List argTypeList = methodSym.getArgumentList();
for (int i = 0; i < paramList.size(); i++)
{
Expression exp = (Expression) paramList.get(i);
if (exp instanceof AssignmentExpression) {
//System.out.println("assignment Expression");
Expression lhsExpression = null;
Expression rhsExpression = null;
AssignmentExpression assignmentExpression = (AssignmentExpression) exp;
if (assignmentExpression.getLHSExpression() instanceof
org.apache.imperius.spl.external.Expression)
{
lhsExpression = (Expression) assignmentExpression
.getLHSExpression();
}
if (assignmentExpression.getRHSExpression() instanceof
org.apache.imperius.spl.external.Expression) {
rhsExpression = (Expression) assignmentExpression
.getRHSExpression();
}
if ((lhsExpression == null) || (rhsExpression == null))
{
logger
.severe("LHS or RHS or argument in method call is null : "
+ lhsExpression.toString()
+ " "
+ rhsExpression);
throw new SPLException(Messages.getString(
"SPL_ASSIGNMENT_EXP_EXCEPTION_MSG",
new Object[] { lhsExpression, rhsExpression }));
}
//System.out.println("lhsExpression class "+ lhsExpression.getClass());
//System.out.println("lhsExpression getPropertyName() "+
((PrimaryExpression) lhsExpression).getPropertyName());
// ((PrimaryExpression)lhsExpression).getPropertyName();
String keyName = ((PrimaryExpression) lhsExpression)
.getclassNameOrInstanceVariableName();
//System.out.println("argument name= " + keyName);
Object keyValue = rhsExpression.evaluate();
//System.out.println("argument value= " + keyValue);
String referenceTypeName = "";
if (TypeResolver.isReference(rhsExpression.getType()))
{
referenceTypeName = rhsExpression.getType()
.getReferenceTypeName();
}
if (keyValue != null)
{
Argument arg = new ArgumentImpl(rhsExpression.getType()
.getType(), keyName, rhsExpression.isArray(),
referenceTypeName);
arg.setValue(keyValue);
//System.out.println("created new arg :"+keyName+" "+keyValue.toString());
/*
* Expression expression=(Expression)pList.get(i); String
* nameAndValue=(String)expression.evaluate(); Key
*/
parameterObjects.add(arg);
}
}
else
{
Object result = exp.evaluate();
boolean isArgCreated = false;
if(argTypeList != null && argTypeList.size() > 0)
{
Argument tempArg = null;
if(i < argTypeList.size())
{
tempArg = (Argument)argTypeList.get(i);
if(TypeResolver.isReference(tempArg.getType()))
{
if (TypeResolver.OBJECT_STRING.equals(tempArg
.getType().getReferenceTypeName())
&& TypeResolver.isString(exp.getType()))
{
Argument arg = new ArgumentImpl(tempArg
.getType().getType(), null, tempArg
.getType().getIsArray(),
TypeResolver.OBJECT_STRING);
arg.setValue(result);
parameterObjects.add(arg);
isArgCreated = true;
}
}
}
else
{
// throw exception
}
}
if(!isArgCreated)
{
//Xiping 05/29/09
Argument tempArg = null;
tempArg = (Argument)argTypeList.get(i);
//
Argument arg = new ArgumentImpl(exp.getType().getType(),
// null, exp.isArray(), null);
null, tempArg.getType().getIsArray(), null);
arg.setValue(result);
parameterObjects.add(arg);
}
}
}
Actuator ac = ActuatorFactory.getActuator();
Object result = ac.invokeMethod(className, qualifier, targetObject,
methodName, parameterObjects);
//System.out.println("method invokation complete : "+className+"
"+qualifier+" "+methodName+" "+targetObject);
//System.out.println("method invokation result of invokation : "+result);
// TO DO COMPARE RESULT WITH CONSTANT
if (result == null)
result = "";
return result;
}
catch (SPLException e)
{
logger.severe(e.getMessage());
logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+ "execute");
// return null;
throw e;
}
}
Xiping Wang/Watson/IBM@IBMUS
Xiping Wang/Watson/IBM@IBMUS
05/28/2009 04:28 PM
Please respond to
imperius-dev@incubator.apache.org
To
imperius-dev@incubator.apache.org
cc
Subject
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
Hi Neeraj,
You are right, but the flag gets set when a policy is parsed without
looking at the corresponding anchor class. A mismatch could occur at
evaluation time depending the return type of a method,
Xiping
IBM TJ Watson Research Center
Neeraj Joshi/Durham/IBM@IBMUS
Neeraj Joshi/Durham/IBM@IBMUS
05/28/2009 01:48 PM
Please respond to
imperius-dev@incubator.apache.org
To
imperius-dev@incubator.apache.org
cc
Subject
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
Hey guys,
There is an isArray variable that gets set automatically based on
reflection. There must be some other issue involved here
Neeraj
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"The light at the end of the tunnel...may be you"
Neeraj Joshi
WebSphere XD - Compute Grid
AIM, IBM
Apache Imperius - http://incubator.apache.org/imperius
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From:
Xiping Wang/Watson/IBM@IBMUS
To:
imperius-dev@incubator.apache.org
Cc:
imperius-dev@incubator.apache.org
Date:
05/28/2009 01:01 PM
Subject:
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
Let's take a look at the line in red in the policy you provided. In you
example, you have getByteArray() method that returns a byte[] return type.
Assume I add another method to the anchor class with the same name but
renturns a byte type. How do you write a SPL policy to distinguish between
these two?
Import Class com.ibm.watson.pml.bytearray.ByteArrayFactory:baf;
Strategy Execute_All_Applicable;
Policy {
Condition { baf.takeByteArray(baf.getByteArray()) }
Decision { ReturnValue(\"OK\") }
}:1;
Xiping
IBM TJ Watson Research Center
David Wood/Watson/IBM@IBMUS
David Wood/Watson/IBM@IBMUS
05/28/2009 12:23 PM
Please respond to
imperius-dev@incubator.apache.org
To
imperius-dev@incubator.apache.org
cc
imperius-dev@incubator.apache.org
Subject
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
I don't think this is an SPL specification issue. This is strictly a
problem with the definition of the method's return type as indicated in
the Java Class object. Somehow that definition is not being picked up as
an array and instead just as a single byte. It _is_ getting the formal
parameter definition correct (i.e. a byte[]).
David Wood
Policy Technologies Group
IBM TJ Watson Research Center
dawood@us.ibm.com
914-784-5123 (office), 914-396-6515 (mobile)
From:
Xiping Wang/Watson/IBM@IBMUS
To:
imperius-dev@incubator.apache.org
Cc:
imperius-dev@incubator.apache.org
Date:
05/28/2009 11:51 AM
Subject:
Re: [jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
David,
It seems to me that Imperius is not capable of handling array return type
because the SPL does not distinguish between primitive return type and
array return type syntactically.
Xiping
IBM T.J. Watson Research Center
"David Wood (JIRA)" <ji...@apache.org>
"David Wood (JIRA)" <ji...@apache.org>
05/26/2009 08:29 PM
Please respond to
imperius-dev@incubator.apache.org
To
imperius-dev@incubator.apache.org
cc
Subject
[jira] Updated: (IMPERIUS-28) byte[] method return type does not match
formal parameter
[
https://issues.apache.org/jira/browse/IMPERIUS-28?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
David Wood updated IMPERIUS-28:
-------------------------------
Attachment: ByteArrayFactory.java
PolicyParser.java
> byte[] method return type does not match formal parameter
> ---------------------------------------------------------
>
> Key: IMPERIUS-28
> URL: https://issues.apache.org/jira/browse/IMPERIUS-28
> Project: Imperius
> Issue Type: Bug
> Environment: Windows, Java 1.5
> Reporter: David Wood
> Assignee: Bill Stoddard
> Attachments: ByteArrayFactory.java, PolicyParser.java
>
> Original Estimate: 96h
> Remaining Estimate: 96h
>
> It appears that a method's byte[] return type is not being properly
matched with a byte[] method argument. The attached Java program includes
a policy that passes the byte[] return value of a method to another method
that expects the same. This gives the following message:
> May 26, 2009 8:20:52 PM
org.apache.imperius.spl.parser.compiler.SPLTreeParser identPrimary
> SEVERE: main TreeParser::Exception creating Expression at line 4 :
Formal and passed parameter types don't match for method takeByteArray
> Formal and passed parameter types don't match for method takeByteArray
> May 26, 2009 8:20:52 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.bytearray.PolicyParser.main(PolicyParser.java:55)
> I've attached both the Java program and the ByteArrayFactory interface
that is used in the policy (also found in the Java file).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.