Author: dreiss
Date: Tue Jun 10 15:56:34 2008
New Revision: 666371

URL: http://svn.apache.org/viewvc?rev=666371&view=rev
Log:
Fix a bug with initialization in JavaBean-style generated code.

Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc?rev=666371&r1=666370&r2=666371&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc 
(original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc Tue 
Jun 10 15:56:34 2008
@@ -384,7 +384,15 @@
         throw "type error: " + type->get_name() + " has no field " + 
v_iter->first->get_string();
       }
       string val = render_const_value(out, name, field_type, v_iter->second);
-      indent(out) << name << "." << v_iter->first->get_string() << " = " << 
val << ";" << endl;
+      indent(out) << name << ".";
+      if (bean_style_) {
+        std::string cap_name = v_iter->first->get_string();
+        cap_name[0] = toupper(cap_name[0]);
+        out << "set" << cap_name << "(" << val << ")";
+      } else {
+        out << v_iter->first->get_string() << " = " << val;
+      }
+      out << ";" << endl;
       indent(out) << name << ".__isset." << v_iter->first->get_string() << " = 
true;" << endl;
     }
     if (!in_static) {


Reply via email to