Fixes from audit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2253 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2014-03-10 22:22:33 +00:00
parent 2d31c523cd
commit affdaf3c76
1 changed files with 30 additions and 24 deletions

View File

@ -31,6 +31,7 @@ public class VProperty {
}
protected static final HashSet<String> MULTIVALUED_PROPERTIES = new HashSet<String>();
static {
MULTIVALUED_PROPERTIES.add("RESOURCES");
MULTIVALUED_PROPERTIES.add("LOCATION");
@ -250,7 +251,7 @@ public class VProperty {
public void setParam(String paramName, String paramValue) {
Param currentParam = getParam(paramName);
if (currentParam != null) {
getParams().remove(currentParam);
params.remove(currentParam);
}
addParam(paramName, paramValue);
}
@ -291,6 +292,11 @@ public class VProperty {
return null;
}
/**
* Return param value.
* @param paramName param name
* @return value
*/
public String getParamValue(String paramName) {
Param param = getParam(paramName);
if (param != null) {
@ -386,12 +392,9 @@ public class VProperty {
if (params != null) {
for (Param param : params) {
buffer.append(';').append(param.name);
if (param.values != null) {
buffer.append('=');
appendParamValues(buffer, param);
}
}
}
buffer.append(':');
if (values != null) {
boolean firstValue = true;
@ -410,6 +413,8 @@ public class VProperty {
}
protected void appendParamValues(StringBuilder buffer, Param param) {
if (param.values != null) {
buffer.append('=');
boolean first = true;
for (String value : param.values) {
if (first) {
@ -429,6 +434,7 @@ public class VProperty {
}
}
}
}
/**
* Append and encode \n to \\n in value.