當前位置: 首頁>>代碼示例>>Java>>正文


Java ConversionException類代碼示例

本文整理匯總了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);
    }

}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:27,代碼來源:DatabaseTestDataDataGenerator.java

示例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);
    }
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:27,代碼來源:MockarooDataGenerator.java

示例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);
    }
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:11,代碼來源:Converters.java

示例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;
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:10,代碼來源:Now.java

示例5: convert

import org.ofbiz.base.conversion.ConversionException; //導入依賴的package包/類
public String convert(SpecialNumber obj) throws ConversionException {
    throw new NullPointerException();
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:4,代碼來源:FlexibleStringExpanderTests.java

示例6: convert

import org.ofbiz.base.conversion.ConversionException; //導入依賴的package包/類
public String convert(MimeMessageWrapper obj) throws ConversionException {
    return obj.toString();
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:4,代碼來源:MimeMessageWrapper.java

示例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;
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:6,代碼來源:Converters.java

示例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());
            }
        }
    }
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:45,代碼來源:Debug.java


注:本文中的org.ofbiz.base.conversion.ConversionException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。