Package flexjson

Examples of flexjson.JSONException


    {
      return simpleDateFormatter.parse(value.toString());
    }
    catch (ParseException e)
    {
      throw new JSONException(String.format("Failed to parse %s with %s pattern.", value, simpleDateFormatter.toPattern()), e);
    }
  }
View Full Code Here


    {
      throw e;
    }
    catch (Exception e)
    {
      throw new JSONException("Error trying to deepSerialize", e);
    }
  }
View Full Code Here

          catch (ParseException e)
          {
            // try next format
          }
        }
        throw new JSONException(String.format("%s:  Parsing date %s was not recognized as a date format", context.getCurrentPath(), value));
      }
    }
    catch (IllegalAccessException e)
    {
      throw new JSONException(String.format("%s:  Error encountered trying to instantiate %s", context.getCurrentPath(), ((Class) targetType).getName()), e);
    }
    catch (InstantiationException e)
    {
      throw new JSONException(String.format("%s:  Error encountered trying to instantiate %s.  Make sure there is a public constructor that accepts a single Long.", context.getCurrentPath(), ((Class) targetType).getName()), e);
    }
    catch (InvocationTargetException e)
    {
      throw new JSONException(String.format("%s:  Error encountered trying to instantiate %s.  Make sure there is a public constructor that accepts a single Long.", context.getCurrentPath(), ((Class) targetType).getName()), e);
    }
  }
View Full Code Here

    {
      return Enum.valueOf((Class) targetType, value.toString());
    }
    else
    {
      throw new JSONException(String.format("%s:  Don't know how to convert %s to enumerated constant of %s", context.getCurrentPath(), value, targetType));
    }
  }
View Full Code Here

        return context.bindIntoObject(map, target, targetType);
      }
    }
    catch (InstantiationException e)
    {
      throw new JSONException(context.getCurrentPath() + ":There was an exception trying to instantiate an instance of " + targetClass.getName(), e);
    }
    catch (IllegalAccessException e)
    {
      throw new JSONException(context.getCurrentPath() + ":There was an exception trying to instantiate an instance of " + targetClass.getName(), e);
    }
    catch (InvocationTargetException e)
    {
      throw new JSONException(context.getCurrentPath() + ":There was an exception trying to instantiate an instance of " + targetClass.getName(), e);
    }
    catch (NoSuchMethodException e)
    {
      throw new JSONException(context.getCurrentPath() + ": " + targetClass.getName() + " lacks a no argument constructor.  Flexjson will instantiate any protected, private, or public no-arg constructor.", e);
    }
  }
View Full Code Here

    context.getCurrentPath().enqueue("values");
    try
    {
      Class memberClass= targetClass.getComponentType() != null ? targetClass.getComponentType() : context.findClassAtPath(context.getCurrentPath());
      if (memberClass == null)
        throw new JSONException("Missing concrete class for array.  You might require a use() method.");
      Object array= Array.newInstance(memberClass, list.size());
      for (int i= 0; i < list.size(); i++)
      {
        Object v= context.bind(list.get(i), memberClass);
        Array.set(array, i, v);
      }
      return array;
    }
    catch (ClassNotFoundException ex)
    {
      throw new JSONException(String.format("%s: Could not find class %s", context.getCurrentPath(), ex.getMessage()), ex);
    }
    finally
    {
      context.getCurrentPath().pop();
    }
View Full Code Here

TOP

Related Classes of flexjson.JSONException

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.