Examples of MethodConfigUserObjectException


Examples of org.apache.jmeter.ejb.jndi.config.MethodConfigUserObjectException

      {
        // it's a primitive but the user has not input a value for it
        String errorStr = type.getName() +
    " is a primitive with uninitialized values";
        catClass.error("formObject1 : " + errorStr);
        throw new MethodConfigUserObjectException(errorStr);
      }
      else
      {
        // then node is an object which contains other primitives
        if(catClass.isDebugEnabled())
        {
          catClass.debug("formObject1 : Creating object - " + type);
        }
        int childCount = node.getChildCount();
        Object[] constituents = new Object[childCount];
        for(int i = 0; i < childCount; i++)
        {
          constituents[i] = formObject((DefaultMutableTreeNode)
    treeModelHome.getChild(node, i));
        }
        // get the fields of the class
        // gather all constituents to form object
        Field[] fields = type.getFields();
        try
        {
          for(int i = 0; i < constituents.length; i++)
          {
            catClass.debug("formObject1 : setting - " + fields[i].getName());
            catClass.debug("formObject1 : to value - " + constituents[i]
    + " of - " + constituents[i].getClass());
            returnVal = type.newInstance();
            fields[i].set(returnVal, constituents[i]);
          }
        }
        catch(IllegalAccessException e)
        {
          catClass.error(e);
          throw new MethodConfigUserObjectException(e.getMessage());
        }
        catch(InstantiationException e)
        {
          catClass.error(e);
          throw new MethodConfigUserObjectException(e.getMessage());
        }
      }
    }
    catClass.info("End : formObject1");
    return returnVal;
View Full Code Here

Examples of org.apache.jmeter.ejb.jndi.config.MethodConfigUserObjectException

  public MethodConfigUserObject(Class type, String value)
  throws MethodConfigUserObjectException
  {
    if(type == null || value == null)
    {
      throw new MethodConfigUserObjectException(
  "Parameters of MethodConfigUserObject constructor cannot be null");
    }
    this.type = type;
    // ensure that the class type is one of the 8 primitives
    try
    {
      if(type.getName().equals(INTEGER))
      {
        object = new Integer(value);
      }
      else if(type.getName().equals(LONG))
      {
        object = new Long(value);
      }
      else if(type.getName().equals(FLOAT))
      {
        object = new Float(value);
      }
      else if(type.getName().equals(DOUBLE))
      {
        object = new Double(value);
      }
      else if(type.getName().equals(BOOLEAN))
      {
        object = Boolean.valueOf(value);
      }
      else if(type.getName().equals(CHAR))
      {
        if(value.length() == 1)
        {
          object = new Character(value.charAt(0));
        }
        else
        {
          throw new MethodConfigUserObjectException(
    "Value format not compatible with class");
        }
      }
      else if(type.getName().equals(BYTE))
      {
        object = new Byte(value);
      }
      else if(type.getName().equals(SHORT))
      {
        object = new Short(value);
      }
      else if(type.getName().equals(STRING_CLASS))
      {
        object = new String(value);
      }
    }
    catch(NumberFormatException e)
    {
      throw new MethodConfigUserObjectException(
  "Value format not compatible with class");
    }
  }
View Full Code Here

Examples of org.apache.jmeter.ejb.jndi.config.MethodConfigUserObjectException

  public MethodConfigUserObject(Class type, String value)
  throws MethodConfigUserObjectException
  {
    if(type == null || value == null)
    {
      throw new MethodConfigUserObjectException(
  "Parameters of MethodConfigUserObject constructor cannot be null");
    }
    this.type = type;
    // ensure that the class type is one of the 8 primitives
    try
    {
      if(type.getName().equals(INTEGER))
      {
        object = new Integer(value);
      }
      else if(type.getName().equals(LONG))
      {
        object = new Long(value);
      }
      else if(type.getName().equals(FLOAT))
      {
        object = new Float(value);
      }
      else if(type.getName().equals(DOUBLE))
      {
        object = new Double(value);
      }
      else if(type.getName().equals(BOOLEAN))
      {
        object = new Boolean(value);
      }
      else if(type.getName().equals(CHAR))
      {
        if(value.length() == 1)
        {
          object = new Character(value.charAt(0));
        }
        else
        {
          throw new MethodConfigUserObjectException(
    "Value format not compatible with class");
        }
      }
      else if(type.getName().equals(BYTE))
      {
        object = new Byte(value);
      }
      else if(type.getName().equals(SHORT))
      {
        object = new Short(value);
      }
      else if(type.getName().equals(STRING_CLASS))
      {
        object = new String(value);
      }
    }
    catch(NumberFormatException e)
    {
      throw new MethodConfigUserObjectException(
  "Value format not compatible with class");
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.