summaryrefslogtreecommitdiff
path: root/cpp/src/slice2javae/Gen.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2005-08-19 10:08:10 +0000
committerMark Spruiell <mes@zeroc.com>2005-08-19 10:08:10 +0000
commit9347ab84e26ef674b0cd66f8e19b57c445942bfb (patch)
treeea1855d66e15d471c9cc4971f76dbbd924847915 /cpp/src/slice2javae/Gen.cpp
parentFix for http://www.zeroc.com/vbulletin/showthread.php?t=1653 (diff)
downloadice-9347ab84e26ef674b0cd66f8e19b57c445942bfb.tar.bz2
ice-9347ab84e26ef674b0cd66f8e19b57c445942bfb.tar.xz
ice-9347ab84e26ef674b0cd66f8e19b57c445942bfb.zip
Hashtable constructor fix
Diffstat (limited to 'cpp/src/slice2javae/Gen.cpp')
-rw-r--r--cpp/src/slice2javae/Gen.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/cpp/src/slice2javae/Gen.cpp b/cpp/src/slice2javae/Gen.cpp
index bd0cd732d45..a6b08020003 100644
--- a/cpp/src/slice2javae/Gen.cpp
+++ b/cpp/src/slice2javae/Gen.cpp
@@ -2550,8 +2550,11 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sp << nl << "public static java.util.Hashtable";
out << nl << "read(IceInternal.BasicStream __is)";
out << sb;
+ //
+ // JDK 1.1 raises IllegalArgumentException if you pass 0 to the Hashtable constructor.
+ //
out << nl << "int __sz = __is.readSize();";
- out << nl << "java.util.Hashtable __r = new java.util.Hashtable(__sz);";
+ out << nl << "java.util.Hashtable __r = new java.util.Hashtable(__sz == 0 ? 1 : __sz);";
out << nl << "for(int __i = 0; __i < __sz; __i++)";
out << sb;
iter = 0;