THRIFT-278. java: #validate exceptions should contain the offending value

This patch causes validate to throw exceptions that contain the bad field value as well as the field name. I had to modify it slightly from the patch on the issue to conform with the new style isset checks.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@755454 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index abbba8b..442488e 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -1043,9 +1043,9 @@
         package = program->get_namespace("java") + ".";
       }
 
-      indent(out) << "if (__isset." << field->get_name() << " && !" << package << type->get_name() << ".VALID_VALUES.contains(" << field->get_name() << ")){" << endl;
+      indent(out) << "if (" << generate_isset_check(field) << " && !" << package << type->get_name() << ".VALID_VALUES.contains(" << field->get_name() << ")){" << endl;
       indent_up();
-      indent(out) << "throw new TProtocolException(\"Invalid value of field '" << field->get_name() << "'!\");" << endl;
+      indent(out) << "throw new TProtocolException(\"The field '" << field->get_name() << "' has been assigned the invalid value \" + " << field->get_name() << ");" << endl;
       indent_down();
       indent(out) << "}" << endl;
     }