mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-23 16:48:07 +02:00
java: Improved DefaultTemplate.java. It allows displaying details of exception messages
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// MessagePack for Java
|
// MessagePack for Java
|
||||||
//
|
//
|
||||||
// Copyright (C) 2009-2010 FURUHASHI Sadayuki
|
// Copyright (C) 2009-2011 FURUHASHI Sadayuki
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@@ -43,14 +43,14 @@ public class DefaultTemplate implements Template {
|
|||||||
public void pack(Packer pk, Object target) throws IOException {
|
public void pack(Packer pk, Object target) throws IOException {
|
||||||
if(messagePackable) {
|
if(messagePackable) {
|
||||||
if(target == null) {
|
if(target == null) {
|
||||||
throw new MessageTypeException("target is null.");
|
throw new MessageTypeException("target is null: " + target.getClass().getName());
|
||||||
}
|
}
|
||||||
((MessagePackable)target).messagePack(pk);
|
((MessagePackable)target).messagePack(pk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
||||||
if(tmpl == this || tmpl == null) {
|
if(tmpl == this || tmpl == null) {
|
||||||
throw new MessageTypeException();
|
throw new MessageTypeException("Template lookup fail: " + lookupType.getClass().getName());
|
||||||
}
|
}
|
||||||
tmpl.pack(pk, target);
|
tmpl.pack(pk, target);
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ public class DefaultTemplate implements Template {
|
|||||||
}
|
}
|
||||||
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
||||||
if(tmpl == this || tmpl == null) {
|
if(tmpl == this || tmpl == null) {
|
||||||
throw new MessageTypeException();
|
throw new MessageTypeException("Template lookup fail: " + lookupType.getClass().getName());
|
||||||
}
|
}
|
||||||
return tmpl.unpack(pac, to);
|
return tmpl.unpack(pac, to);
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ public class DefaultTemplate implements Template {
|
|||||||
}
|
}
|
||||||
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
Template tmpl = TemplateRegistry.tryLookup(lookupType);
|
||||||
if(tmpl == this || tmpl == null) {
|
if(tmpl == this || tmpl == null) {
|
||||||
throw new MessageTypeException();
|
throw new MessageTypeException("Template lookup fail: " + lookupType.getClass().getName());
|
||||||
}
|
}
|
||||||
return tmpl.convert(from, to);
|
return tmpl.convert(from, to);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user