Java 类org.codehaus.jackson.JsonLocation 实例源码

项目:12306-android-Decompile    文件:TextNode.java   
protected void _reportInvalidBase64(Base64Variant paramBase64Variant, char paramChar, int paramInt, String paramString)
  throws JsonParseException
{
  String str;
  if (paramChar <= ' ')
    str = "Illegal white space character (code 0x" + Integer.toHexString(paramChar) + ") as character #" + (paramInt + 1) + " of 4-char base64 unit: can only used between units";
  while (true)
  {
    if (paramString != null)
      str = str + ": " + paramString;
    throw new JsonParseException(str, JsonLocation.NA);
    if (paramBase64Variant.usesPaddingChar(paramChar))
    {
      str = "Unexpected padding character ('" + paramBase64Variant.getPaddingChar() + "') as character #" + (paramInt + 1) + " of 4-char base64 unit: padding only legal as 3rd or 4th character";
      continue;
    }
    if ((!Character.isDefined(paramChar)) || (Character.isISOControl(paramChar)))
    {
      str = "Illegal character (code 0x" + Integer.toHexString(paramChar) + ") in base64 content";
      continue;
    }
    str = "Illegal character '" + paramChar + "' (code 0x" + Integer.toHexString(paramChar) + ") in base64 content";
  }
}
项目:pi    文件:ObjectMetaDataTest.java   
@SuppressWarnings("unchecked")
@Test(expected = EntityMarshallingException.class)
public void testFromfileMapperThrowsJsonParseException() throws Exception {
    // setup
    File file = new File(filename);
    FileUtils.writeStringToFile(new File(filename), "stuff");
    FileUtils.writeStringToFile(new File(metadataFilename), "{\"contentType\":\"text/plain\"}");
    final ObjectMapper objectMapper = Mockito.mock(ObjectMapper.class);
    String message = "shit happens";
    Mockito.when(objectMapper.readValue(Matchers.isA(File.class), Matchers.isA(Class.class))).thenThrow(new JsonParseException(message, new JsonLocation(new String(), 1, 1, 1)));

    // act
    try {
        new ObjectMetaData(file) {
            @Override
            protected ObjectMapper getObjectMapper() {
                return objectMapper;
            }
        };
    } catch (EntityMarshallingException e) {
        // assert
        assertTrue(e.getMessage().contains(message));
        throw e;
    }
}
项目:12306-android-Decompile    文件:TextNode.java   
protected void _reportInvalidBase64(Base64Variant paramBase64Variant, char paramChar, int paramInt, String paramString)
  throws JsonParseException
{
  String str;
  if (paramChar <= ' ')
    str = "Illegal white space character (code 0x" + Integer.toHexString(paramChar) + ") as character #" + (paramInt + 1) + " of 4-char base64 unit: can only used between units";
  while (true)
  {
    if (paramString != null)
      str = str + ": " + paramString;
    throw new JsonParseException(str, JsonLocation.NA);
    if (paramBase64Variant.usesPaddingChar(paramChar))
    {
      str = "Unexpected padding character ('" + paramBase64Variant.getPaddingChar() + "') as character #" + (paramInt + 1) + " of 4-char base64 unit: padding only legal as 3rd or 4th character";
      continue;
    }
    if ((!Character.isDefined(paramChar)) || (Character.isISOControl(paramChar)))
    {
      str = "Illegal character (code 0x" + Integer.toHexString(paramChar) + ") in base64 content";
      continue;
    }
    str = "Illegal character '" + paramChar + "' (code 0x" + Integer.toHexString(paramChar) + ") in base64 content";
  }
}
项目:gora-maven-plugin    文件:AbstractGoraMojo.java   
private void attachErrorMessage(JsonParseException e) {
    JsonLocation location = e.getLocation();
    File file;
    if (location.getSourceRef() instanceof File) {
        file = (File) location.getSourceRef();
    } else {
        file = null;
    }
    context.addMessage(file, location.getLineNr(), location.getColumnNr(), e.getLocalizedMessage(), BuildContext.SEVERITY_ERROR, e);
}
项目:gora    文件:AbstractGoraMojo.java   
private void attachErrorMessage(JsonParseException e) {
  JsonLocation location = e.getLocation();
  File file;
  if (location.getSourceRef() instanceof File) {
    file = (File) location.getSourceRef();
  } else {
    file = null;
  }
  context.addMessage(file, location.getLineNr(), location.getColumnNr(), e.getLocalizedMessage(), BuildContext.SEVERITY_ERROR, e);
}
项目:jee-rest    文件:AbstractJsonExceptionMapperUnitTest.java   
@Test
@RoxableTest(key = "1e94cfd8f281")
public void abstractJsonExceptionMapperShouldReturnLineNumberAndColumnNumberWithLocation() {
    when(jsonProcessingException.getLocation()).thenReturn(new JsonLocation(null, 0, 10000, 20000));
    String location = jsonExceptionMapper.getLocationDetails(jsonProcessingException);
    assertTrue("Location should contain column and line number.", location.contains("10000") && location.contains("20000"));
}
项目:12306-android-Decompile    文件:UnrecognizedPropertyException.java   
public UnrecognizedPropertyException(String paramString1, JsonLocation paramJsonLocation, Class<?> paramClass, String paramString2)
{
  super(paramString1, paramJsonLocation);
  this._referringClass = paramClass;
  this._unrecognizedPropertyName = paramString2;
}
项目:12306-android-Decompile    文件:JsonMappingException.java   
public JsonMappingException(String paramString, JsonLocation paramJsonLocation)
{
  super(paramString, paramJsonLocation);
}
项目:12306-android-Decompile    文件:JsonMappingException.java   
public JsonMappingException(String paramString, JsonLocation paramJsonLocation, Throwable paramThrowable)
{
  super(paramString, paramJsonLocation, paramThrowable);
}
项目:12306-android-Decompile    文件:TokenBuffer.java   
public JsonLocation getCurrentLocation()
{
  if (this._location == null)
    return JsonLocation.NA;
  return this._location;
}
项目:12306-android-Decompile    文件:TokenBuffer.java   
public JsonLocation getTokenLocation()
{
  return getCurrentLocation();
}
项目:12306-android-Decompile    文件:TokenBuffer.java   
public void setLocation(JsonLocation paramJsonLocation)
{
  this._location = paramJsonLocation;
}
项目:12306-android-Decompile    文件:JsonParserDelegate.java   
public JsonLocation getCurrentLocation()
{
  return this.delegate.getCurrentLocation();
}
项目:12306-android-Decompile    文件:JsonParserDelegate.java   
public JsonLocation getTokenLocation()
{
  return this.delegate.getTokenLocation();
}
项目:12306-android-Decompile    文件:JsonParserBase.java   
public JsonLocation getCurrentLocation()
{
  int i = 1 + (this._inputPtr - this._currInputRowStart);
  return new JsonLocation(this._ioContext.getSourceReference(), this._currInputProcessed + this._inputPtr - 1L, this._currInputRow, i);
}
项目:12306-android-Decompile    文件:JsonParserBase.java   
public JsonLocation getTokenLocation()
{
  return new JsonLocation(this._ioContext.getSourceReference(), getTokenCharacterOffset(), getTokenLineNr(), getTokenColumnNr());
}
项目:12306-android-Decompile    文件:JsonReadContext.java   
public final JsonLocation getStartLocation(Object paramObject)
{
  return new JsonLocation(paramObject, -1L, this._lineNr, this._columnNr);
}
项目:12306-android-Decompile    文件:TreeTraversingParser.java   
public JsonLocation getCurrentLocation()
{
  return JsonLocation.NA;
}
项目:12306-android-Decompile    文件:TreeTraversingParser.java   
public JsonLocation getTokenLocation()
{
  return JsonLocation.NA;
}
项目:12306-android-Decompile    文件:TextNode.java   
protected void _reportBase64EOF()
  throws JsonParseException
{
  throw new JsonParseException("Unexpected end-of-String when base64 content", JsonLocation.NA);
}
项目:12306-android-Decompile    文件:UnrecognizedPropertyException.java   
public UnrecognizedPropertyException(String paramString1, JsonLocation paramJsonLocation, Class<?> paramClass, String paramString2)
{
  super(paramString1, paramJsonLocation);
  this._referringClass = paramClass;
  this._unrecognizedPropertyName = paramString2;
}
项目:12306-android-Decompile    文件:JsonMappingException.java   
public JsonMappingException(String paramString, JsonLocation paramJsonLocation)
{
  super(paramString, paramJsonLocation);
}
项目:12306-android-Decompile    文件:JsonMappingException.java   
public JsonMappingException(String paramString, JsonLocation paramJsonLocation, Throwable paramThrowable)
{
  super(paramString, paramJsonLocation, paramThrowable);
}
项目:12306-android-Decompile    文件:TokenBuffer.java   
public JsonLocation getCurrentLocation()
{
  if (this._location == null)
    return JsonLocation.NA;
  return this._location;
}
项目:12306-android-Decompile    文件:TokenBuffer.java   
public JsonLocation getTokenLocation()
{
  return getCurrentLocation();
}
项目:12306-android-Decompile    文件:TokenBuffer.java   
public void setLocation(JsonLocation paramJsonLocation)
{
  this._location = paramJsonLocation;
}
项目:12306-android-Decompile    文件:JsonParserDelegate.java   
public JsonLocation getCurrentLocation()
{
  return this.delegate.getCurrentLocation();
}
项目:12306-android-Decompile    文件:JsonParserDelegate.java   
public JsonLocation getTokenLocation()
{
  return this.delegate.getTokenLocation();
}
项目:12306-android-Decompile    文件:JsonParserBase.java   
public JsonLocation getCurrentLocation()
{
  int i = 1 + (this._inputPtr - this._currInputRowStart);
  return new JsonLocation(this._ioContext.getSourceReference(), this._currInputProcessed + this._inputPtr - 1L, this._currInputRow, i);
}
项目:12306-android-Decompile    文件:JsonParserBase.java   
public JsonLocation getTokenLocation()
{
  return new JsonLocation(this._ioContext.getSourceReference(), getTokenCharacterOffset(), getTokenLineNr(), getTokenColumnNr());
}
项目:12306-android-Decompile    文件:JsonReadContext.java   
public final JsonLocation getStartLocation(Object paramObject)
{
  return new JsonLocation(paramObject, -1L, this._lineNr, this._columnNr);
}
项目:12306-android-Decompile    文件:TreeTraversingParser.java   
public JsonLocation getCurrentLocation()
{
  return JsonLocation.NA;
}
项目:12306-android-Decompile    文件:TreeTraversingParser.java   
public JsonLocation getTokenLocation()
{
  return JsonLocation.NA;
}
项目:12306-android-Decompile    文件:TextNode.java   
protected void _reportBase64EOF()
  throws JsonParseException
{
  throw new JsonParseException("Unexpected end-of-String when base64 content", JsonLocation.NA);
}
项目:ingress-indonesia-dev    文件:UnrecognizedPropertyException.java   
public UnrecognizedPropertyException(String paramString1, JsonLocation paramJsonLocation, Class<?> paramClass, String paramString2)
{
  super(paramString1, paramJsonLocation);
  this._referringClass = paramClass;
  this._unrecognizedPropertyName = paramString2;
}
项目:ingress-indonesia-dev    文件:JsonMappingException.java   
public JsonMappingException(String paramString, JsonLocation paramJsonLocation)
{
  super(paramString, paramJsonLocation);
}
项目:ingress-indonesia-dev    文件:JsonMappingException.java   
public JsonMappingException(String paramString, JsonLocation paramJsonLocation, Throwable paramThrowable)
{
  super(paramString, paramJsonLocation, paramThrowable);
}
项目:ingress-indonesia-dev    文件:TokenBuffer$Parser.java   
public final JsonLocation getCurrentLocation()
{
  if (this._location == null)
    return JsonLocation.NA;
  return this._location;
}
项目:ingress-indonesia-dev    文件:TokenBuffer$Parser.java   
public final JsonLocation getTokenLocation()
{
  return getCurrentLocation();
}
项目:ingress-indonesia-dev    文件:TokenBuffer$Parser.java   
public final void setLocation(JsonLocation paramJsonLocation)
{
  this._location = paramJsonLocation;
}