本文整理汇总了Java中org.ofbiz.base.conversion.ConversionException类的典型用法代码示例。如果您正苦于以下问题:Java ConversionException类的具体用法?Java ConversionException怎么用?Java ConversionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConversionException类属于org.ofbiz.base.conversion包,在下文中一共展示了ConversionException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveData
import org.ofbiz.base.conversion.ConversionException; //导入依赖的package包/类
@Override
protected List<T> retrieveData(Integer count) {
HttpClient httpClient = new HttpClient();
DatabaseTestDataSettings settings = new DatabaseTestDataSettings();
String format = properties.getProperty("demosuite.test.data.provider." + getDataGeneratorName() + ".exportFormat");
String url = properties.getProperty("demosuite.test.data.provider." + getDataGeneratorName() + ".url") + "?";
httpClient.setContentType("application/json");
httpClient.setUrl(url + "&x__format=" + format + "&x__no_entries=" + count);
ListToJSON listJsonConverter = new JSONConverters.ListToJSON();
try {
JSON json = listJsonConverter.convert(settings.getFields());
Debug.log(json.toString());
httpClient.setRawStream(json.toString());
} catch (ConversionException e1) {
Debug.logError(e1.getMessage(), "");
}
try {
String r = httpClient.sendHttpRequest(settings.getMethod());
return handleData(r, format);
} catch (HttpClientException e) {
throw new RuntimeException(e);
}
}
示例2: retrieveData
import org.ofbiz.base.conversion.ConversionException; //导入依赖的package包/类
@Override
protected List<T> retrieveData(Integer count) {
HttpClient httpClient = new HttpClient();
MockarooSettings settings = new MockarooSettings();
String format = properties.getProperty("demosuite.test.data.provider." + getDataGeneratorName() + ".exportFormat");
String url = properties.getProperty("demosuite.test.data.provider." + getDataGeneratorName() + ".url") + format + "?key="
+ settings.getQueryParameters().get("key");
httpClient.setContentType("application/json");
httpClient.setUrl(url + "&count=" + count + "&array=true");
ListToJSON listJsonConverter = new JSONConverters.ListToJSON();
try {
JSON json = listJsonConverter.convert(settings.getFields());
Debug.log(json.toString());
httpClient.setRawStream(json.toString());
} catch (ConversionException e1) {
Debug.logError(e1.getMessage(), "");
}
try {
String r = httpClient.sendHttpRequest(settings.getMethod());
return handleData(r, format);
} catch (HttpClientException e) {
throw new RuntimeException(e);
}
}
示例3: convert
import org.ofbiz.base.conversion.ConversionException; //导入依赖的package包/类
public JSON convert(GenericValue obj) throws ConversionException {
Map<String, Object> fieldMap = new HashMap<String, Object>(obj);
fieldMap.put("_DELEGATOR_NAME_", obj.getDelegator().getDelegatorName());
fieldMap.put("_ENTITY_NAME_", obj.getEntityName());
try {
return JSON.from(fieldMap);
} catch (IOException e) {
throw new ConversionException(e);
}
}
示例4: exec
import org.ofbiz.base.conversion.ConversionException; //导入依赖的package包/类
@Override
public boolean exec(MethodContext methodContext) throws MiniLangException {
try {
this.fieldFma.put(methodContext.getEnvMap(), this.converter.convert(System.currentTimeMillis()));
} catch (ConversionException e) {
throw new MiniLangRuntimeException(e.getMessage(), this);
}
return true;
}
示例5: convert
import org.ofbiz.base.conversion.ConversionException; //导入依赖的package包/类
public String convert(SpecialNumber obj) throws ConversionException {
throw new NullPointerException();
}
示例6: convert
import org.ofbiz.base.conversion.ConversionException; //导入依赖的package包/类
public String convert(MimeMessageWrapper obj) throws ConversionException {
return obj.toString();
}
示例7: convert
import org.ofbiz.base.conversion.ConversionException; //导入依赖的package包/类
public List<GenericValue> convert(GenericValue obj) throws ConversionException {
List<GenericValue> tempList = new LinkedList<GenericValue>();
tempList.add(obj);
return tempList;
}
示例8: log
import org.ofbiz.base.conversion.ConversionException; //导入依赖的package包/类
public static void log(int level, Throwable t, String msg, String module, String callingClass, Object... params) {
if (isOn(level)) {
if (msg != null && params.length > 0) {
StringBuilder sb = new StringBuilder();
Formatter formatter = new Formatter(sb);
formatter.format(msg, params);
msg = sb.toString();
}
// log
if (useLog4J) {
Logger logger = getLogger(module);
//callingClass
logger.log(levelObjs[level], msg, t);
} else {
StringBuilder prefixBuf = new StringBuilder();
DateToString dateToString = new DateToString();
try {
prefixBuf.append(dateToString.convert(new java.util.Date(), Locale.getDefault(),
TimeZone.getDefault(), UtilDateTime.DATE_TIME_FORMAT));
} catch (ConversionException e) {
logFatal(e, Debug.class.getName());
}
prefixBuf.append(" [OFBiz");
if (module != null) {
prefixBuf.append(":");
prefixBuf.append(module);
}
prefixBuf.append(":");
prefixBuf.append(levels[level]);
prefixBuf.append("] ");
if (msg != null) {
getPrintWriter().print(prefixBuf.toString());
getPrintWriter().println(msg);
}
if (t != null) {
getPrintWriter().print(prefixBuf.toString());
getPrintWriter().println("Received throwable:");
t.printStackTrace(getPrintWriter());
}
}
}
}