test_class.file: oak-core-spi/src/test/java/org/apache/jackrabbit/oak/commons/jmx/JmxUtilTest.java
test_class.identifier: JmxUtilTest
test_case.body: @Test
      public void quotation() throws Exception{
          assertEquals("text", JmxUtil.quoteValueIfRequired("text"));
          TestCase.assertEquals("", JmxUtil.quoteValueIfRequired(""));
          assertTrue(JmxUtil.quoteValueIfRequired("text*with?chars").startsWith("\""));
      }
test_case.class_method_signature: JmxUtilTest.quotation()
test_case.full_signature: @Test public void quotation()
test_case.identifier: quotation
test_case.invocations: assertEquals quoteValueIfRequired assertEquals quoteValueIfRequired assertTrue startsWith quoteValueIfRequired
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void quotation()
focal_class.file: oak-core-spi/src/main/java/org/apache/jackrabbit/oak/commons/jmx/JmxUtil.java
focal_class.identifier: JmxUtil
focal_class.class_method_signature: JmxUtil.JmxUtil()
focal_class.full_signature: private  JmxUtil()
focal_class.identifier: JmxUtil
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  JmxUtil()
focal_class.class_method_signature: JmxUtil.quoteValueIfRequired(String unquotedValue)
focal_class.full_signature: public static String quoteValueIfRequired(String unquotedValue)
focal_class.identifier: quoteValueIfRequired
focal_class.modifiers: public static
focal_class.parameters: (String unquotedValue)
focal_class.return: String
focal_class.signature: String quoteValueIfRequired(String unquotedValue)
focal_method.body: public static String quoteValueIfRequired(String unquotedValue) {
          String result;
          String quotedValue = ObjectName.quote(unquotedValue);
  
          //Check if some chars are escaped or not. In that case
          //length of quoted string (excluding quotes) would differ
          if (quotedValue.substring(1, quotedValue.length() - 1).equals(unquotedValue)) {
              ObjectName on = null;
              try {
                  //Quoting logic in ObjectName does not escape ',', '='
                  //etc. So try now by constructing ObjectName. If that
                  //passes then value can be used as safely
  
                  //Also we cannot just rely on ObjectName as it treats
                  //*, ? as pattern chars and which should ideally be escaped
                  on = new ObjectName("dummy", "dummy", unquotedValue);
              } catch (MalformedObjectNameException ignore) {
                  //ignore
              }
  
              if (on != null){
                  result = unquotedValue;
              } else {
                  result = quotedValue;
              }
          } else {
              //Some escaping done. So do quote
              result = quotedValue;
          }
          return result;
      }
focal_method.class_method_signature: JmxUtil.quoteValueIfRequired(String unquotedValue)
focal_method.full_signature: public static String quoteValueIfRequired(String unquotedValue)
focal_method.identifier: quoteValueIfRequired
focal_method.invocations: quote equals substring length
focal_method.modifiers: public static
focal_method.parameters: (String unquotedValue)
focal_method.return: String
focal_method.signature: String quoteValueIfRequired(String unquotedValue)