Package org.apache.imperius.spl.parser.exceptions

Examples of org.apache.imperius.spl.parser.exceptions.SPLException


            validation = true;
        }
       
        if(!validation)
        {
            throw new SPLException(Messages.getString(
          "SPL_TYPE_NOT_COMPATIBLE_EXCEPTION_MSG", new Object[] {
              lType, rType }));

        }
        else
View Full Code Here


                logger.severe(
                        "validation error: wrong data type passed in "
                        + this._dataType);
            
                throw new SPLException(Messages.getString(
            "SPL_VALIDATION_ERROR_MSG", new Object[] { className }));
            }
        }
        _dataType.setType(TypeConstants.booleanType);
        this._dataType.setIsArray(false);
View Full Code Here

            {

                logger.severe(
                "rhsResult is not of type List");
            
                throw new SPLException(Messages.getString(
              "SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG",
              new Object[] { "RHS","is not", "List" }));

            }
            Boolean result = Boolean.FALSE;
            ArrayList rhsResultArray = (ArrayList) rhsResult;
            //System.out.println("resultArray size " + rhsResultArray.size()+ " to string " + rhsResultArray.toString());
            //System.out.println("LHS expression is of type "+ lhsExpression.getType());
            if ((rhsResultArray != null) && (!rhsResultArray.isEmpty()))
            {
                Object lhsResult = (Object) lhsExpression.evaluate();
                //System.out.println("lhsResult " + lhsResult.toString());
                Iterator rhsResultIt = rhsResultArray.iterator();
                while (rhsResultIt.hasNext())
                {
                    Object value = (Object) rhsResultIt.next();
                    //System.out.println("rhsResult element " + value.toString());
                    //System.out.println("operationString " + operationString);
                    if (operationString.equalsIgnoreCase(LAND))
                    {
                        if ((!(value instanceof Boolean))
                                || (!(lhsResult instanceof Boolean)))
                        {
                            logger.severe(
                            "LHS or RHS result is not of type Boolean");
                        
                            throw new SPLException(Messages.getString(
                          "SPL_NOT_REQUIRED_EXP_EXCEPTION_MSG",
                          new Object[] { "boolean" }));
                        }
                        else
                        {
                            Boolean Value1 = (Boolean) lhsResult;
                            Boolean Value2 = (Boolean) value;
                            boolean res = Value1.booleanValue()
                                    && Value2.booleanValue();
                            if (!res)
                            {
                                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "AllInCollection");
                               
                                return new Boolean(!res);
                            }
                        }
                    }
                    else if (operationString.equalsIgnoreCase(LOR))
                    {
                        if ((!(value instanceof Boolean))
                                || (!(lhsResult instanceof Boolean)))
                        {
                            logger.severe(
                            "LHS or RHS result is not of type Boolean");
                        
                            throw new SPLException(Messages.getString(
                          "SPL_NOT_REQUIRED_EXP_EXCEPTION_MSG",
                          new Object[] { "boolean" }));
                        }
                        else
                        {
                            Boolean Value1 = (Boolean) lhsResult;
                            Boolean Value2 = (Boolean) value;
                            boolean res = Value1.booleanValue()
                                    || Value2.booleanValue();
                            if (!res)
                            {
                                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "AllInCollection");
                               
                                return new Boolean(!res);
                            }
                        }
                       
                    }
                    else if (operationString.equalsIgnoreCase(BXOR))
                    {
                        if ((!(value instanceof Boolean))
                                || (!(lhsResult instanceof Boolean)))
                        {
                            logger.severe(
                            "LHS or RHS result is not of type Boolean");
                        
                            throw new SPLException(Messages.getString(
                          "SPL_NOT_REQUIRED_EXP_EXCEPTION_MSG",
                          new Object[] { "boolean" }));
                        }
                        else
                        {
View Full Code Here

        if (!rightType.getIsArray())
        {
            logger.severe(
            "Last Expression should be a collection");
        
            throw new SPLException(Messages.getString(
          "SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
              "right", "is not", "collection" }));
        }
       
        if (leftType.getIsArray())
        {
            logger.severe(
            "First Expression cannot be a collection");
        
            throw new SPLException(Messages.getString(
          "SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
              "left", "can not", "collection" }));
        }
       
        if (!TypeResolver.isString(middleType))
        {
            logger.severe(
            "Middle Expression should be a string describing the Operation");
           
            throw new SPLException(Messages.getString(
          "SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
              "middle", "should", "string" }));
        }
        this.operationString = (String) expression2.evaluate();
        if (this.operationString == null)
        {
            logger.severe(
            "Operation string is null");
        
            throw new SPLException(Messages.getString(
          "SPL_PASSED_EXPRESSION_ERROR_MSG", new Object[] {
              "middle" }));
        }
//        if (this.operationString == null)
//        {
//            logger.severe(
//                    "Operation type is "
//                    + this.operationString);
//        
//            throw new SPLException("Operation type is "
//                    + this.operationString);
//        }
       
        if (operationString.equalsIgnoreCase(LAND)
                || operationString.equalsIgnoreCase(LOR)
                || operationString.equalsIgnoreCase(BXOR))
        {
            if (TypeResolver.isBoolean(leftType))
            {
                if (TypeResolver.isBoolean(rightType))
                {
                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
                   
                    return true;
                   
                }
                else
                {
                    logger.severe(
                    "LHS is of type Boolean but RHS is not of type Boolean");
                
                    throw new SPLException(Messages.getString(
              "SPL_TYPE_NOT_COMPATIBLE_EXCEPTION_MSG",
              new Object[] { leftType, rightType }));
                }
            }
            else
            {
                logger.severe(
                "Operation is of type Boolean but LHS is not of type boolean");
            
                throw new SPLException(Messages.getString(
            "SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
                "left", "is not", "boolean" }));
            }
        }
        else if (operationString.equalsIgnoreCase(EQUAL)
                || operationString.equalsIgnoreCase(NOT_EQUAL)
                || operationString.equalsIgnoreCase(GT)
                || operationString.equalsIgnoreCase(GE)
                || operationString.equalsIgnoreCase(LT)
                || operationString.equalsIgnoreCase(LE))
        {
           
            if (TypeResolver.isTypeAssignableForEquality(leftType, rightType))
            {
                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
               
                return true;
            }
            else if (TypeResolver.isTypeAssignableForRelation(leftType,
                    rightType))
            {
                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
               
                return true;
            }
            else
            {
                logger.severe(
                "types are not assignable for Relation or Equality");
            
                throw new SPLException(Messages.getString(
            "SPL_TYPE_NOT_COMPATIBLE_EXCEPTION_MSG",
            new Object[] { leftType, rightType }));
            }
        }
        else
        {

            logger.severe(
            "operationString is not supported by AllInCollection");
        
            throw new SPLException(Messages.getString("SPL_OPERATION_NOT_SUPPORTED_EXCEPTION_MSG"));
        }
       
    }
View Full Code Here

            if (!validate())
            {
                logger.severe(Thread.currentThread().getName()+" "+"validation error: " + className
                        + " has wrong data type passed in.");
               
                throw new SPLException(Messages.getString(
              "SPL_VALIDATION_ERROR_MSG", new Object[] { className }));
            }
        }
        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "GetSecond");
       
View Full Code Here

        }
        catch (Exception e)
        {
            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
           
            throw new SPLException(Messages.getString(
          "SPL_EVALUATION_ERROR_MSG", new Object[] { e
              .getLocalizedMessage() }));

        }
    }
View Full Code Here

            _dataType.setType(TypeConstants.intType);
            return true;
        }
        else
        {
            throw new SPLException(Messages.getString(
          "SPL_NOT_REQUIRED_EXP_EXCEPTION_MSG", new Object[] { eType }));

        }

       
View Full Code Here

            if (!validate())
            {

                logger.severe
               ("validation error: wrong data type passed in"+ this._dataType);
                throw new SPLException(Messages.getString(
            "SPL_VALIDATION_ERROR_MSG", new Object[] { className }));
            }
        }
        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "ApplyToCollection");
       
View Full Code Here

            Object rhsResult = rhsExpression.evaluate();
            //System.out.println("rhsResult , class " + rhsResult + " "+ rhsResult.getClass());
            if (!(rhsResult instanceof java.util.List))
            {
                //System.out.println("rhsResult is not of type List");
                throw new SPLException(Messages.getString(
              "SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG",
              new Object[] { "RHS","is not", "List" }));

            }
            List resultList = new ArrayList();
View Full Code Here

       
        if (!expression3.isArray())
        {
            logger.severe(Thread.currentThread().getName()+" "+"Last Expression should be a collection");
           
            throw new SPLException("Last Expression should be a collection");
        }
       
        if (expression1.isArray())
        {
            logger.severe(Thread.currentThread().getName()+" "+"First Expression cannot be a collection");
           
            throw new SPLException(Messages.getString(
          "SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
              "right", "should not", "collection" }));
        }
       
        if (!TypeResolver.isString(middleType))
        {
            logger.severe(
            "Middle Expression should be a string describing the Operation");
           
            throw new SPLException(Messages.getString(
          "SPL_PASSED_EXPRESSION_TYPE_ERROR_MSG", new Object[] {
              "middle", "should", "string" }));
        }
        this._operationString = (String) expression2.evaluate();
        if (this._operationString == null)
        {
            logger.severe(Thread.currentThread().getName()+" "+"Operation string is null");
           
            throw new SPLException(Messages.getString(
          "SPL_PASSED_EXPRESSION_ERROR_MSG", new Object[] {
              "middle" }));

        }
//        if (this._operationString == null)
//        {
//            logger.severe(Thread.currentThread().getName()+" "+"Operation type is "
//                    + this._operationString);
//           
//            throw new SPLException("Operation type is "
//                    + this._operationString);
//        }
       
        if (_operationString.equalsIgnoreCase(DIV)
                || _operationString.equalsIgnoreCase(PLUS)
                || _operationString.equalsIgnoreCase(MINUS)
                || _operationString.equalsIgnoreCase(STAR))
        {
           
            if (TypeResolver.isNumeric(leftType))
            {
                if (TypeResolver.isNumeric(rightType))
                {
                    this._dataType = TypeResolver
                            .binaryNumericPromotionResolver(leftType, rightType);
                   _dataType.setIsArray(true);
                    logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
                   
                    return true;
                }
                else
                {
                    logger.severe(
                    "RHS is not numeric, and hence not applicable to ApplyToCollection");
                   
                   
                    throw new SPLException(Messages.getString(
              "SPL_TYPE_NOT_COMPATIBLE_EXCEPTION_MSG",
              new Object[] { leftType, rightType }));
                }
            }
            else
            {
                logger.severe(
                "LHS is not numeric, and hence not applicable to ApplyToCollection");
               
               
                throw new SPLException(Messages.getString(
            "SPL_TYPE_NOT_COMPATIBLE_EXCEPTION_MSG",
            new Object[] { leftType, rightType }));
            }
        }
        else
        {
            logger.severe(
            "operationString is not supported by ApplyToCollection");
            throw new SPLException(Messages.getString("SPL_OPERATION_NOT_SUPPORTED_EXCEPTION_MSG"));       
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.imperius.spl.parser.exceptions.SPLException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.