diff options
| author | Kim van der Riet <kpvdr@apache.org> | 2006-12-04 14:48:13 +0000 |
|---|---|---|
| committer | Kim van der Riet <kpvdr@apache.org> | 2006-12-04 14:48:13 +0000 |
| commit | 8e14fb7d644ec6d437a6fe2f49fd62e057643594 (patch) | |
| tree | 20ad7565ad434726959f4cbcc095c1243a4a3381 | |
| parent | 02e91769d1974ebab4cb32c7af1bb0ac73fb268e (diff) | |
| download | qpid-python-8e14fb7d644ec6d437a6fe2f49fd62e057643594.tar.gz | |
Added check for non-existent domains - throws Exception instead of NPE.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@482194 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java | 9 | ||||
| -rw-r--r-- | qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java | 14 |
2 files changed, 17 insertions, 6 deletions
diff --git a/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java b/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java index 26a9950d8a..cf97e01877 100644 --- a/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java +++ b/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java @@ -176,9 +176,16 @@ public class CppGenerator extends Generator { String domainType = getDomainType(domainName, version); if (domainType == null) + { throw new AmqpTypeMappingException("Domain type \"" + domainName + "\" not found in C++ typemap."); - return typeMap.get(domainType).type; + } + DomainInfo info = typeMap.get(domainType); + if (info == null) + { + throw new AmqpTypeMappingException("Unknown domain: \"" + domainType + "\""); + } + return info.type; } // === Abstract methods from class Generator - C++-specific implementation === diff --git a/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java b/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java index bd83e85090..c465677bff 100644 --- a/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java +++ b/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java @@ -355,11 +355,15 @@ public class JavaGenerator extends Generator { String domainType = globalDomainMap.getDomainType(domainName, version); if (domainType == null) - throw new AmqpTypeMappingException("Domain type \"" + domainName + "\" not found in Java typemap."); - DomainInfo info = typeMap.get(domainType); - if (info == null) { - throw new AmqpTypeMappingException("Unknown type: \"" + domainType + "\""); - } + { + throw new AmqpTypeMappingException("Domain type \"" + domainName + + "\" not found in Java typemap."); + } + DomainInfo info = typeMap.get(domainType); + if (info == null) + { + throw new AmqpTypeMappingException("Unknown domain: \"" + domainType + "\""); + } return info.type; } |
