Fix a bug in ReferenceType.SignatureWithGeneric.

Implicit conversions to bool strike again. Damn you, milkman Stroustrup!
While I'm here, remove the unnecessary duplication between Signature and
SignatureWithGeneric.

Change-Id: Ia1b327e9d00bea43b67898c4941bed17db043515
diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc
index c977979..fed1cf9 100644
--- a/src/jdwp/jdwp_handler.cc
+++ b/src/jdwp/jdwp_handler.cc
@@ -444,24 +444,6 @@
   return handleVM_AllClasses(state, buf, dataLen, pReply, true, true);
 }
 
-/*
- * Given a referenceTypeID, return a string with the JNI reference type
- * signature (e.g. "Ljava/lang/Error;").
- */
-static JdwpError handleRT_Signature(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
-  RefTypeId refTypeId = ReadRefTypeId(&buf);
-
-  VLOG(jdwp) << StringPrintf("  Req for signature of refTypeId=%#llx", refTypeId);
-  std::string signature;
-
-  JdwpError status = Dbg::GetSignature(refTypeId, signature);
-  if (status != ERR_NONE) {
-    return status;
-  }
-  expandBufAddUtf8String(pReply, signature);
-  return ERR_NONE;
-}
-
 static JdwpError handleRT_Modifiers(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
   return Dbg::GetModifiers(refTypeId, pReply);
@@ -547,27 +529,31 @@
   return ERR_ABSENT_INFORMATION;
 }
 
-/*
- * Like RT_Signature but with the possibility of a "generic signature".
- */
-static JdwpError handleRT_SignatureWithGeneric(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
-  static const char genericSignature[1] = "";
-
+static JdwpError handleRT_Signature(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply, bool with_generic) {
   RefTypeId refTypeId = ReadRefTypeId(&buf);
 
   VLOG(jdwp) << StringPrintf("  Req for signature of refTypeId=%#llx", refTypeId);
   std::string signature;
-  if (Dbg::GetSignature(refTypeId, signature)) {
-    expandBufAddUtf8String(pReply, signature);
-  } else {
-    LOG(WARNING) << StringPrintf("No signature for refTypeId=%#llx", refTypeId);
+
+  JdwpError status = Dbg::GetSignature(refTypeId, signature);
+  if (status != ERR_NONE) {
+    return status;
+  }
+  expandBufAddUtf8String(pReply, signature);
+  if (with_generic) {
     expandBufAddUtf8String(pReply, "");
   }
-  expandBufAddUtf8String(pReply, genericSignature);
-
   return ERR_NONE;
 }
 
+static JdwpError handleRT_Signature(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+  return handleRT_Signature(state, buf, dataLen, pReply, false);
+}
+
+static JdwpError handleRT_SignatureWithGeneric(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+  return handleRT_Signature(state, buf, dataLen, pReply, true);
+}
+
 /*
  * Return the instance of java.lang.ClassLoader that loaded the specified
  * reference type, or null if it was loaded by the system loader.