You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2006/12/04 15:48:14 UTC

svn commit: r482194 - in /incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools: CppGenerator.java JavaGenerator.java

Author: kpvdr
Date: Mon Dec  4 06:48:13 2006
New Revision: 482194

URL: http://svn.apache.org/viewvc?view=rev&rev=482194
Log:
Added check for non-existent domains - throws Exception instead of NPE.

Modified:
    incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java
    incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java

Modified: incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java?view=diff&rev=482194&r1=482193&r2=482194
==============================================================================
--- incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java (original)
+++ incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/CppGenerator.java Mon Dec  4 06:48:13 2006
@@ -176,9 +176,16 @@
 	{
 		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 ===

Modified: incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java?view=diff&rev=482194&r1=482193&r2=482194
==============================================================================
--- incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java (original)
+++ incubator/qpid/trunk/qpid/gentools/src/org/apache/qpid/gentools/JavaGenerator.java Mon Dec  4 06:48:13 2006
@@ -355,11 +355,15 @@
 	{
 		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;
 	}