summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-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;