Java 类org.codehaus.jackson.map.JsonMappingException.Reference 实例源码

项目:communote-server    文件:JsonMappingExceptionMapper.java   
/**
 * {@inheritDoc}
 */
@Override
public Status mapException(JsonMappingException exception) {
    LOGGER.error(exception.getMessage(), exception);
    List<Reference> references = exception.getPath();
    if (references != null) {
        String message = new String("Wrong elements: ");
        for (Reference reference : references) {
            message += reference.getFieldName() + ", ";
        }
        message = message.substring(0, message.length() - 2);
        message += ".";
        return new Status("error.rest.badrequest", null, BAD_REQUEST, new Reason(
                new StaticLocalizedMessage(message), null, null));
    }
    return new Status("error.rest.badrequest", null, BAD_REQUEST);
}
项目:communote-server    文件:JsonMappingExceptionMapper.java   
/**
 * Handle messages of {@link JsonMappingException}
 * 
 * @param exception
 *            {@link JsonMappingException}
 * @param apiResult
 *            error result
 * @return {@link ApiResult} with error messages
 */
@Override
public ApiResult<Object> handle(JsonMappingException exception, ApiResult<Object> apiResult) {
    apiResult.setMessage(getErrorMessage(exception));
    List<Reference> references = exception.getPath();
    List<ApiResultError> apiResultErrors = new ArrayList<ApiResultError>();
    if (references != null) {
        ApiResultError error = new ApiResultError();
        error.setCause("Exception");
        String message = new String("wrong elements: ");
        for (Reference reference : references) {
            message += reference.getFieldName() + ", ";
        }
        message = message.substring(0, message.length() - 2);
        message += ".";
        error.setMessage(message);
        apiResultErrors.add(error);
    }
    apiResult.setErrors(apiResultErrors);
    return apiResult;
}
项目:12306-android-Decompile    文件:BeanSerializer.java   
protected void serializeFields(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  BeanPropertyWriter[] arrayOfBeanPropertyWriter;
  if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
    arrayOfBeanPropertyWriter = this._filteredProps;
  int i;
  JsonMappingException localJsonMappingException;
  while (true)
  {
    i = 0;
    try
    {
      int j = arrayOfBeanPropertyWriter.length;
      while (true)
        if (i < j)
        {
          BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
          if (localBeanPropertyWriter != null)
            localBeanPropertyWriter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider);
          i++;
          continue;
          arrayOfBeanPropertyWriter = this._props;
          break;
        }
      if (this._anyGetterWriter != null)
        this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
      return;
    }
    catch (Exception localException)
    {
      if (i == arrayOfBeanPropertyWriter.length);
      for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
      {
        wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
        return;
      }
    }
    catch (StackOverflowError localStackOverflowError)
    {
      localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
      if (i != arrayOfBeanPropertyWriter.length);
    }
  }
  for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
  {
    localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
    throw localJsonMappingException;
  }
}
项目:12306-android-Decompile    文件:BeanSerializer.java   
protected void serializeFieldsFiltered(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  BeanPropertyWriter[] arrayOfBeanPropertyWriter;
  if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
    arrayOfBeanPropertyWriter = this._filteredProps;
  int i;
  JsonMappingException localJsonMappingException;
  while (true)
  {
    BeanPropertyFilter localBeanPropertyFilter = findFilter(paramSerializerProvider);
    i = 0;
    try
    {
      int j = arrayOfBeanPropertyWriter.length;
      while (true)
        if (i < j)
        {
          BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
          if (localBeanPropertyWriter != null)
            localBeanPropertyFilter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider, localBeanPropertyWriter);
          i++;
          continue;
          arrayOfBeanPropertyWriter = this._props;
          break;
        }
      if (this._anyGetterWriter != null)
        this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
      return;
    }
    catch (Exception localException)
    {
      if (i == arrayOfBeanPropertyWriter.length);
      for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
      {
        wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
        return;
      }
    }
    catch (StackOverflowError localStackOverflowError)
    {
      localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
      if (i != arrayOfBeanPropertyWriter.length);
    }
  }
  for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
  {
    localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
    throw localJsonMappingException;
  }
}
项目:12306-android-Decompile    文件:BeanSerializer.java   
protected void serializeFields(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  BeanPropertyWriter[] arrayOfBeanPropertyWriter;
  if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
    arrayOfBeanPropertyWriter = this._filteredProps;
  int i;
  JsonMappingException localJsonMappingException;
  while (true)
  {
    i = 0;
    try
    {
      int j = arrayOfBeanPropertyWriter.length;
      while (true)
        if (i < j)
        {
          BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
          if (localBeanPropertyWriter != null)
            localBeanPropertyWriter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider);
          i++;
          continue;
          arrayOfBeanPropertyWriter = this._props;
          break;
        }
      if (this._anyGetterWriter != null)
        this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
      return;
    }
    catch (Exception localException)
    {
      if (i == arrayOfBeanPropertyWriter.length);
      for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
      {
        wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
        return;
      }
    }
    catch (StackOverflowError localStackOverflowError)
    {
      localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
      if (i != arrayOfBeanPropertyWriter.length);
    }
  }
  for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
  {
    localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
    throw localJsonMappingException;
  }
}
项目:12306-android-Decompile    文件:BeanSerializer.java   
protected void serializeFieldsFiltered(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
  throws IOException, JsonGenerationException
{
  BeanPropertyWriter[] arrayOfBeanPropertyWriter;
  if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
    arrayOfBeanPropertyWriter = this._filteredProps;
  int i;
  JsonMappingException localJsonMappingException;
  while (true)
  {
    BeanPropertyFilter localBeanPropertyFilter = findFilter(paramSerializerProvider);
    i = 0;
    try
    {
      int j = arrayOfBeanPropertyWriter.length;
      while (true)
        if (i < j)
        {
          BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
          if (localBeanPropertyWriter != null)
            localBeanPropertyFilter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider, localBeanPropertyWriter);
          i++;
          continue;
          arrayOfBeanPropertyWriter = this._props;
          break;
        }
      if (this._anyGetterWriter != null)
        this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
      return;
    }
    catch (Exception localException)
    {
      if (i == arrayOfBeanPropertyWriter.length);
      for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
      {
        wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
        return;
      }
    }
    catch (StackOverflowError localStackOverflowError)
    {
      localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
      if (i != arrayOfBeanPropertyWriter.length);
    }
  }
  for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
  {
    localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
    throw localJsonMappingException;
  }
}
项目:ingress-indonesia-dev    文件:BeanSerializerBase.java   
protected void serializeFields(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider)
{
  BeanPropertyWriter[] arrayOfBeanPropertyWriter;
  if ((this._filteredProps != null) && (paramSerializerProvider.getSerializationView() != null))
    arrayOfBeanPropertyWriter = this._filteredProps;
  int i;
  JsonMappingException localJsonMappingException;
  while (true)
  {
    i = 0;
    try
    {
      int j = arrayOfBeanPropertyWriter.length;
      while (true)
        if (i < j)
        {
          BeanPropertyWriter localBeanPropertyWriter = arrayOfBeanPropertyWriter[i];
          if (localBeanPropertyWriter != null)
            localBeanPropertyWriter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider);
          i++;
          continue;
          arrayOfBeanPropertyWriter = this._props;
          break;
        }
      if (this._anyGetterWriter != null)
        this._anyGetterWriter.getAndSerialize(paramObject, paramJsonGenerator, paramSerializerProvider);
      return;
    }
    catch (Exception localException)
    {
      if (i == arrayOfBeanPropertyWriter.length);
      for (String str2 = "[anySetter]"; ; str2 = arrayOfBeanPropertyWriter[i].getName())
      {
        wrapAndThrow(paramSerializerProvider, localException, paramObject, str2);
        return;
      }
    }
    catch (StackOverflowError localStackOverflowError)
    {
      localJsonMappingException = new JsonMappingException("Infinite recursion (StackOverflowError)");
      if (i != arrayOfBeanPropertyWriter.length);
    }
  }
  for (String str1 = "[anySetter]"; ; str1 = arrayOfBeanPropertyWriter[i].getName())
  {
    localJsonMappingException.prependPath(new JsonMappingException.Reference(paramObject, str1));
    throw localJsonMappingException;
  }
}