[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6817) Logging of strings containing the percent character broken

Fred Toussi (JIRA) noreply at atlassian.com
Fri Nov 11 17:46:22 EST 2011


Logging of strings containing the percent character broken
----------------------------------------------------------

                 Key: HHH-6817
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6817
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 4.0.0.CR6
         Environment: HSQLDB 2.2.6 snapshot
            Reporter: Fred Toussi
            Priority: Blocker


The method AbstractTypeDescriptor#extractLoggableRepresentation(T value) does not escape the percent character. Possible workaround below:



	public String extractLoggableRepresentation(T value) {
        if (value == null)
            return null;

        String stringValue = value.toString();

        return stringValue.replace("%", "%%");
	}


The return value is used for logging, where the string is used as the format argument to java.lang.String#format(String format, Object... args). The percent character is interpreted as a format identifier and causes an exception as what follows is not necessarily a valid format template.  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list