Skip to content
Snippets Groups Projects
Commit c96d120f authored by jakubs's avatar jakubs
Browse files

SSDM-1730: Fix the problem when it was impossible to set tab character as a...

SSDM-1730: Fix the problem when it was impossible to set tab character as a csv reader delimiter, becuase of the trim method called on a tab character.

SVN: 33805
parent ae4dbd62
No related branches found
No related tags found
No related merge requests found
...@@ -103,6 +103,19 @@ public final class PropertyUtils ...@@ -103,6 +103,19 @@ public final class PropertyUtils
return StringUtils.isBlank(property) ? null : property.trim(); return StringUtils.isBlank(property) ? null : property.trim();
} }
/**
* Searches for the property with the specified key in this property list. <code>null</code> is returned if there is no property for the specified
* key or it contains only white space characters.
*
* @return <code>null</code> or the non-trimmed value if found.
*/
public final static String getPropertyDontTrim(final Properties properties, final String propertyKey)
{
assertParameters(properties, propertyKey);
final String property = properties.getProperty(propertyKey);
return property;
}
/** /**
* Searches for the property with the specified key in this property list. * Searches for the property with the specified key in this property list.
* *
...@@ -466,21 +479,29 @@ public final class PropertyUtils ...@@ -466,21 +479,29 @@ public final class PropertyUtils
final char defaultValue, final ISimpleLogger loggerOrNull) final char defaultValue, final ISimpleLogger loggerOrNull)
{ {
assertParameters(properties, propertyKey); assertParameters(properties, propertyKey);
final String charOrNull = getProperty(properties, propertyKey); String charOrNull = getPropertyDontTrim(properties, propertyKey);
if (charOrNull == null) if (charOrNull == null)
{ {
return defaultValue; return defaultValue;
} }
if (charOrNull.length() != 1) if (charOrNull.length() == 1)
{
return charOrNull.charAt(0);
}
charOrNull = charOrNull.trim();
if (charOrNull.length() == 1)
{
return charOrNull.charAt(0);
}
else
{ {
if (loggerOrNull != null) if (loggerOrNull != null)
{ {
loggerOrNull.log(LogLevel.INFO, String.format(NON_CHAR_VALUE_FORMAT, charOrNull, loggerOrNull.log(LogLevel.INFO, String.format(NON_CHAR_VALUE_FORMAT, charOrNull,
defaultValue)); defaultValue));
return defaultValue;
} }
return defaultValue;
} }
return charOrNull.charAt(0);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment