continue;
}
boolean typeNotEqual = false;
for (int i = 0; i < argTypeList.size(); i++) {
Expression exp = (Expression)paramList.get(i);
ArgumentImpl arg = (ArgumentImpl)argTypeList.get(i);
TypeInfo expDataType = exp.getType();
TypeInfo argDataType = arg.getType();
// if (expDataType.getIsArray() != argDataType.getIsArray() ||
// expDataType.getType() != argDataType.getType()) {
if (expDataType.getType() != argDataType.getType()) {
typeNotEqual = true;
break;
}
}
if (typeNotEqual) {
continue;
}
break;
}
if (methodSym == null) {
throw new SPLException("invokeClassMethod failed: " + methodName + "does not exit");
}
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.core.Expression)
{
lhsExpression = (Expression) assignmentExpression
.getLHSExpression();
}
if (assignmentExpression.getRHSExpression() instanceof org.apache.imperius.spl.core.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
//get isArray flag from the formal argument list if available
boolean flag = exp.isArray();
if(argTypeList != null && i < argTypeList.size()) {
flag = ((Argument)argTypeList.get(i)).getType().getIsArray();
}
//
Argument arg = new ArgumentImpl(exp.getType().getType(),
// null, exp.isArray(), null);
null, flag, null);
arg.setValue(result);
parameterObjects.add(arg);
}
}
}