本文整理汇总了Java中org.codehaus.jackson.map.exc.UnrecognizedPropertyException类的典型用法代码示例。如果您正苦于以下问题:Java UnrecognizedPropertyException类的具体用法?Java UnrecognizedPropertyException怎么用?Java UnrecognizedPropertyException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnrecognizedPropertyException类属于org.codehaus.jackson.map.exc包,在下文中一共展示了UnrecognizedPropertyException类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: manifestJsonValidate
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
/**
* manifest.jsonのバリデート.
* @param jp Jsonパーサー
* @param mapper ObjectMapper
* @return JSONManifestオブジェクト
* @throws IOException データの読み込みに失敗した場合
*/
protected JSONManifest manifestJsonValidate(JsonParser jp, ObjectMapper mapper) throws IOException {
// TODO BARファイルのバージョンチェック
JSONManifest manifest = null;
try {
manifest = mapper.readValue(jp, JSONManifest.class);
} catch (UnrecognizedPropertyException ex) {
throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(
"manifest.json unrecognized property");
}
if (manifest.getBarVersion() == null) {
throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params("manifest.json#barVersion");
}
if (manifest.getBoxVersion() == null) {
throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params("manifest.json#boxVersion");
}
if (manifest.getDefaultPath() == null) {
throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params("manifest.json#DefaultPath");
}
return manifest;
}
开发者ID:personium,项目名称:personium-core,代码行数:28,代码来源:BarFileReadRunner.java
示例2: readJsonEntry
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
/**
* barファイルエントリからJSONファイルを読み込む.
* @param <T> JSONMappedObject
* @param inStream barファイルエントリのInputStream
* @param entryName entryName
* @param clazz clazz
* @return JSONファイルから読み込んだオブジェクト
* @throws IOException JSONファイル読み込みエラー
*/
public static <T> T readJsonEntry(
InputStream inStream, String entryName, Class<T> clazz) throws IOException {
JsonParser jp = null;
ObjectMapper mapper = new ObjectMapper();
JsonFactory f = new JsonFactory();
jp = f.createJsonParser(inStream);
JsonToken token = jp.nextToken(); // JSONルート要素("{")
Pattern formatPattern = Pattern.compile(".*/+(.*)");
Matcher formatMatcher = formatPattern.matcher(entryName);
String jsonName = formatMatcher.replaceAll("$1");
T json = null;
if (token == JsonToken.START_OBJECT) {
try {
json = mapper.readValue(jp, clazz);
} catch (UnrecognizedPropertyException ex) {
throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName);
}
} else {
throw PersoniumCoreException.BarInstall.JSON_FILE_FORMAT_ERROR.params(jsonName);
}
return json;
}
开发者ID:personium,项目名称:personium-core,代码行数:32,代码来源:BarFileUtils.java
示例3: signIn
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
public void signIn(String username, String password) throws Exception {
Entity payload = Entity.json("{ \"ClientType\": 6, \"Password\": \"" + password + "\", \"UserName\": \"" + username + "\"}");
Response response = client.target(endpoint.toString()).request(MediaType.APPLICATION_JSON_TYPE).post(payload);
String res = response.readEntity(String.class);
try {
JSONAuthSession jsonSession = new ObjectMapper().readValue(res, JSONAuthSession.class);
this.session = jsonSession.getSession();
((Stub) this.downloadService).clearHeaders();
((Stub) this.downloadService).setHeader(this.getSoapSessionHeader());
} catch (UnrecognizedPropertyException e) {
JSONAuthFault fault = new ObjectMapper().readValue(res, JSONAuthFault.class);
logger.error("Could not sign in user `" + username + "`, reason:");
logger.error(fault.getMessage());
throw new Exception("Unable to sign in");
}
}
开发者ID:delivered,项目名称:BulkScanDownloader,代码行数:19,代码来源:Authentication.java
示例4: exceptionCaught
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
if (e.getCause() instanceof IllegalStateException) {
// hiding exception logging - expected because of the way we do
// JSON message decoding
// logger.debug("Illegal State exception ",
// e.getCause().toString());
} else if (e.getCause() instanceof UnrecognizedPropertyException) {
logger.error("Jackson unrecognized property error {}",
e.getCause());
} else if (e.getCause() instanceof JsonMappingException) {
logger.error("Jackson mapping error {}",
e.getCause());
} else if (e.getCause() instanceof JsonParseException) {
logger.error("Jackson parsing error {}",
e.getCause());
} else if (e.getCause() instanceof ClosedChannelException) {
logger.error("Netty closed channel error", e.getCause());
} else if (e.getCause() instanceof ConnectException) {
logger.error("Connection refused", e.getCause());
} else if (e.getCause() instanceof IOException) {
logger.error("IO problem", e.getCause());
} else {
super.exceptionCaught(ctx, e);
}
}
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:28,代码来源:JSONMsgHandler.java
示例5: toApiErrorResponse
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
@Override
protected ApiErrorResponse toApiErrorResponse(UnrecognizedPropertyException upe) {
return new ApiErrorResponse(
buildMessage(upe),
getCode(),
getLocationType(),
upe.getUnrecognizedPropertyName()
);
}
开发者ID:lotaris,项目名称:jee-rest,代码行数:10,代码来源:UnrecognizedPropertyExceptionMapper.java
示例6: toResponse
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
public Response toResponse(Exception exception) {
String msg = "General Exception at CXF layer:" +exception.toString();
log.debug(msg,exception);
if(exception instanceof NullPointerException){
return new NullPointerExceptionMapper().toResponse((NullPointerException)exception);
} else if(exception instanceof HomePiAppException){
return new HomePiAppExceptionMapper().toResponse((HomePiAppException)exception);
} else if(exception instanceof JsonProcessingException){
return new JsonProcessingExceptionMapper().toResponse((JsonProcessingException)exception);
} else if(exception instanceof UnrecognizedPropertyException){
return new UnrecognizedPropertyExceptionMapper().toResponse((UnrecognizedPropertyException)exception);
} else if(exception instanceof WebApplicationException){
WebApplicationException wae = (WebApplicationException)exception;
Status status = Status.fromStatusCode(wae.getResponse().getStatus());
String cause = (wae.getCause()!= null)?wae.getCause().toString():"";
if(status == null && wae.getResponse().getStatus() == 405){
msg += (" [Unmapped Status:" + wae.getResponse().getStatus()+"] " + wae.getResponse().getMetadata());
if(cause == null) cause = "Method Not Allowed";
}
return Response
.status(status)
.entity(new HomePiAppException(status, msg, cause,0).toResponse())
.type(MediaType.APPLICATION_JSON)
.build();
}
return Response
.status(Status.BAD_REQUEST)
.entity(new HomePiAppException(Status.BAD_REQUEST, msg, "",0).toResponse())
.type(MediaType.APPLICATION_JSON)
.build();
}
开发者ID:leeclarke,项目名称:homePi,代码行数:33,代码来源:GeneralExceptionMapper.java
示例7: toResponse
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
public Response toResponse(UnrecognizedPropertyException exception)
{
String message = "Invalid JSON field: '"+exception.getUnrecognizedPropertyName()+"'";
return Response
.status(Status.BAD_REQUEST)
.entity(new HomePiAppException(Status.BAD_REQUEST, message, "Invalid JSON, Unrecognized Property.",0).toResponse())
.type( MediaType.APPLICATION_JSON)
.build();
}
开发者ID:leeclarke,项目名称:homePi,代码行数:10,代码来源:UnrecognizedPropertyExceptionMapper.java
示例8: unknownFieldException
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
public JsonMappingException unknownFieldException(Object paramObject, String paramString)
{
return UnrecognizedPropertyException.from(this._parser, paramObject, paramString);
}
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:5,代码来源:StdDeserializationContext.java
示例9: buildMessage
import org.codehaus.jackson.map.exc.UnrecognizedPropertyException; //导入依赖的package包/类
/**
* Builds an error message indicating which property is unknown.
*
* @param upe the cause
* @return a message indicating the position (line and column) of the unknown property in the
* JSON document
*/
private String buildMessage(UnrecognizedPropertyException upe) {
return "JSON parsing error due to unknown JSON object property "
+ upe.getUnrecognizedPropertyName() + getLocationDetails(upe) + ".";
}
开发者ID:lotaris,项目名称:jee-rest,代码行数:12,代码来源:UnrecognizedPropertyExceptionMapper.java
注:本文中的org.codehaus.jackson.map.exc.UnrecognizedPropertyException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论