THRIFT-1006. java: Impossible to correctly qualify an enum constant in an external thrift file

Be a little more sensitive to how we parse out dots; some java generator changes to make sure things stay consistent.

THRIFT-1005. java: Give unions byte[] signature methods to go along with their ByteBuffer counterparts

Some new constructors, getters, and setters to ease migration of unions to ByteBuffer style.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1038399 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
index fa6d3ae..0c561b9 100644
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -715,16 +715,14 @@
       throw "type error: const \"" + name + "\" was declared as enum";
     }
 
+    // see if there's a dot in the identifier
+    std::string name_portion = value->get_identifier_name();
+
     const vector<t_enum_value*>& enum_values = ((t_enum*)type)->get_constants();
     vector<t_enum_value*>::const_iterator c_iter;
     bool found = false;
-    for (c_iter = enum_values.begin(); c_iter != enum_values.end(); ++c_iter) {
-      size_t sub_index = value->get_identifier().find('.');
-      if (sub_index == string::npos) {
-        throw "error: identifier " + value->get_identifier() + " is unqualified!";
-      }
-      std::string name_portion = value->get_identifier().substr(sub_index+1);
 
+    for (c_iter = enum_values.begin(); c_iter != enum_values.end(); ++c_iter) {
       if ((*c_iter)->get_name() == name_portion) {
         found = true;
         break;