Skip to content
Permalink
Browse files

Fixed: Add converter for StringWrapper and StringBuffer

(OFBIZ-5028)
To escape exception on native conversion, we add converter for StringBuffer and StringWrapper on MiscConverters
Thanks to Christoph Neuroth for this issue

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1857371 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
nmalin committed Apr 12, 2019
1 parent 2c0cd81 commit 61cf2fa8917acae58edc7c0f84231a60a112a9d3
Showing with 21 additions and 0 deletions.
  1. +21 −0 framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java
@@ -30,6 +30,7 @@
import java.util.UUID;
import java.util.regex.Pattern;

import org.apache.ofbiz.base.util.StringUtil;
import org.apache.ofbiz.base.util.UtilGenerics;
import org.apache.ofbiz.base.util.UtilMisc;

@@ -298,6 +299,26 @@ public Charset convert(String obj) throws ConversionException {
}
}

public static class StringBufferToString extends AbstractConverter<StringBuffer, String> {
public StringBufferToString() {
super(StringBuffer.class, String.class);
}

public String convert(StringBuffer obj) throws ConversionException {
return obj.toString();
}
}

public static class StringWrapperToString extends AbstractConverter<StringUtil.StringWrapper, String> {
public StringWrapperToString() {
super(StringUtil.StringWrapper.class, String.class);
}

public String convert(StringUtil.StringWrapper obj) {
return obj.toString();
}
}

public static class UUIDToString extends AbstractConverter<UUID, String> {
public UUIDToString() {
super(UUID.class, String.class);

0 comments on commit 61cf2fa

Please sign in to comment.
You can’t perform that action at this time.