Example usage for java.lang RuntimeException printStackTrace

List of usage examples for java.lang RuntimeException printStackTrace

Introduction

In this page you can find the example usage for java.lang RuntimeException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.mbv.web.rest.controller.VpGdnController.java

/**
 * @???Id?/*  w w w.  j a va 2 s  . co m*/
 * @2015917
 * @param
 * @version
 * @throws Exception
 */
@RequestMapping(value = "/deleteVpGdnById", method = RequestMethod.POST)
@ResponseBody
public void deleteVpGdnById(@RequestBody VpGdnVo vo, HttpServletResponse response) throws Exception {
    // vo
    if (vo == null || vo.getEntity() == null || vo.getEntity().getId() < 1
            || vo.getEntity().getDocState() == null || "".equals(vo.getEntity().getDocState())) {
        throw new MbvException("???");
    }
    log.info("id:" + vo.getEntity().getId());
    try {
        boolean deleteResult = vpGdnService.deleteVpGdnByEntity(vo.getEntity());
        if (deleteResult) {
            log.info("??");
        }
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("result", deleteResult);
        // ??
        returnSuccess(response, map);
    } catch (MbvException me) {
        me.printStackTrace();
        throw new MbvException(me.getMessage());
    } catch (RuntimeException re) {
        re.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (Exception e) {
        e.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }
}

From source file:com.nextgis.mobile.fragment.AttributesFragment.java

private void setAttributes() {
    if (mAttributes == null)
        return;/*from  w ww. j  av  a  2  s.c  om*/

    mAttributes.removeAllViews();

    int[] attrs = new int[] { android.R.attr.textColorPrimary };
    TypedArray ta = getContext().obtainStyledAttributes(attrs);
    String textColor = Integer.toHexString(ta.getColor(0, Color.BLACK)).substring(2);
    ta.recycle();

    final WebView webView = new WebView(getContext());
    webView.setVerticalScrollBarEnabled(false);
    String data = "<!DOCTYPE html><html><head><meta charset='utf-8'><style>body{word-wrap:break-word;color:#"
            + textColor
            + ";font-family:Roboto Light,sans-serif;font-weight:300;line-height:1.15em}.flat-table{table-layout:fixed;margin-bottom:20px;width:100%;border-collapse:collapse;border:none;box-shadow:inset 1px -1px #ccc,inset -1px 1px #ccc}.flat-table td{box-shadow:inset -1px -1px #ccc,inset -1px -1px #ccc;padding:.5em}.flat-table tr{-webkit-transition:background .3s,box-shadow .3s;-moz-transition:background .3s,box-shadow .3s;transition:background .3s,box-shadow .3s}</style></head><body><table class='flat-table'><tbody>";

    FragmentActivity activity = getActivity();
    if (null == activity)
        return;

    ((MainActivity) activity).setSubtitle(String.format(getString(R.string.features_count_attributes),
            mItemPosition + 1, mFeatureIDs.size()));
    checkNearbyItems();

    try {
        data = parseAttributes(data);
    } catch (RuntimeException e) {
        e.printStackTrace();
    }

    data += "</tbody></table></body></html>";
    webView.loadDataWithBaseURL(null, data, "text/html", "UTF-8", null);
    mAttributes.addView(webView);
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            webView.setBackgroundColor(Color.TRANSPARENT);
        }

        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
            return true;
        }
    });

    IGISApplication app = (GISApplication) getActivity().getApplication();
    final Map<String, Integer> mAttaches = new HashMap<>();
    PhotoGallery.getAttaches(app, mLayer, mItemId, mAttaches, false);

    if (mAttaches.size() > 0) {
        final PhotoPicker gallery = new PhotoPicker(getActivity(), true);
        int px = ControlHelper.dpToPx(16, getResources());
        gallery.setDefaultPreview(true);
        gallery.setPadding(px, 0, px, 0);
        gallery.post(new Runnable() {
            @Override
            public void run() {
                gallery.restoreImages(new ArrayList<>(mAttaches.keySet()));
            }
        });

        mAttributes.addView(gallery);
    }
}

From source file:com.mbv.web.rest.controller.VpGdnController.java

/**
 * @???docCode?/*  w ww  . ja  v a  2  s.  c  o m*/
 * @2015915
 * @param
 * @version
 */
@RequestMapping(value = "/findVpGdnByDocCode", method = RequestMethod.POST)
@ResponseBody
public void findVpGdnByDocCode(@RequestBody VpGdnVo vo, HttpServletRequest request,
        HttpServletResponse response) throws MbvException {
    // vo
    if (vo == null || vo.getEntity() == null || vo.getEntity().getDocCode() == null
            || "".equals(vo.getEntity().getDocCode())) {
        throw new MbvException("??");
    }
    log.info("findVpGdnByDocCode:" + vo.getEntity().getDocCode());
    try {
        VpGdnBean bean = vpGdnService.getVpGdnBeanByEntity(vo.getEntity());
        if (bean == null) {
            throw new MbvException("????");
        }
        log.info("findVpGdnByDocCode:" + vo.getEntity().getDocCode());
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("data", bean);
        // ??
        returnSuccess(response, map);
    } catch (MbvException me) {
        me.printStackTrace();
        throw new MbvException(me.getMessage());
    } catch (RuntimeException re) {
        re.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (Exception e) {
        e.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }
}

From source file:com.mbv.web.rest.controller.VpGrnController.java

/**
 * @??//from w  w w .j a  v a  2  s . com
 * @201596
 * @param
 * @version
 * @throws MbvException
 */
@RequestMapping(value = "/queryByParams", method = RequestMethod.POST)
@ResponseBody
public JqGridBaseEntityVo<VpGrnEntity> queryByParams(JqGridBaseEntityVo<VpGrnEntity> entity, VpGrnVo vo,
        HttpServletRequest request, HttpServletResponse response) throws MbvException {
    String warehCode = request.getSession().getAttribute(MbvConstant.WAREH_CODE).toString();
    String unitCode = request.getSession().getAttribute(MbvConstant.UNIT_CODE).toString();
    if (unitCode == null || "".equals(unitCode) || warehCode == null || "".equals(warehCode)) {
        throw new MbvException("Session?????");
    }
    if (vo == null) {
        vo = new VpGrnVo();
        VpGrnBean bean = new VpGrnBean();
        bean.setWarehCode(warehCode);
        bean.setUnitCode(unitCode);
        vo.setBean(bean);
    } else {
        if (vo.getBean() == null) {
            VpGrnBean bean = new VpGrnBean();
            bean.setWarehCode(warehCode);
            bean.setUnitCode(unitCode);
            vo.setBean(bean);
        } else {
            vo.getBean().setWarehCode(warehCode);
            vo.getBean().setUnitCode(unitCode);
        }
    }
    String rcptTime1 = vo.getBean().getRcptTime1();
    String rcptTime2 = vo.getBean().getRcptTime2();

    if (StringUtils.isNotEmpty(rcptTime1) && StringUtils.isNotEmpty(rcptTime2)) {
        vo.getBean().setRcptTime2(rcptTime2 + " 23:59:59");
    } else if (StringUtils.isNotEmpty(rcptTime1) && StringUtils.isEmpty(rcptTime2)) {
        if (rcptTime1.length() == 7) {
            vo.getBean().setQueryMonth(rcptTime1);
        } else if (rcptTime1.length() == 10) {
            vo.getBean().setQueryDay(rcptTime1);
        }
    } else if (StringUtils.isNotEmpty(rcptTime2) && StringUtils.isEmpty(rcptTime1)) {
        if (rcptTime2.length() == 7) {
            vo.getBean().setQueryMonth(rcptTime2);
            vo.getBean().setRcptTime2("");
        } else if (rcptTime2.length() == 10) {
            vo.getBean().setQueryDay(rcptTime2);
            vo.getBean().setRcptTime2("");
        }
    }
    List<VpGrnEntity> list = new ArrayList<VpGrnEntity>();
    try {
        // ?
        int totalCount = this.vpGrnService.queryByParamsCount(vo.getBean());
        log.info("totalCount:" + totalCount);
        // ?
        if (totalCount > 0) {
            // ?
            int offset = (entity.getPage() - 1) * entity.getRows();
            int limit = entity.getRows();
            log.info("offset:" + offset);
            log.info("limit:" + limit);
            // ??
            list = this.vpGrnService.queryByParams(vo.getBean(), offset, limit);
            // ?
            JqGridPagesUtils.setPagingParams(entity, list, totalCount);

        }
        // 
        return entity;
    } catch (MbvException me) {
        me.printStackTrace();
        throw new MbvException(me.getMessage());
    } catch (RuntimeException re) {
        re.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (Exception e) {
        e.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }
}

From source file:com.mbv.web.rest.controller.VpGdnController.java

/**
 * @???/*ww  w.j a va  2  s. co  m*/
 * @2015917
 * @param
 * @version
 * @throws Exception
 */
@RequestMapping(value = "/deleteVpGdn", method = RequestMethod.POST)
@ResponseBody
public void deleteVpGdn(@RequestBody VpGdnVo vo, HttpServletResponse response) throws Exception {
    // vo
    if (vo == null) {
        throw new MbvException("??");
    }
    List<Integer> deleteIds = vo.getDeleteIds();
    // ?id ?
    List<VpGdnEntity> vpGdnEntityList = new ArrayList<VpGdnEntity>();
    try {
        for (int id : deleteIds) {
            VpGdnEntity vde = new VpGdnEntity();
            vde.setId((long) id);
            vpGdnEntityList.add(vpGdnService.getVpGdnByEntity(vde));
        }
        boolean deleteResult = vpGdnService.deleteVpGdnBatch(vpGdnEntityList);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("result", deleteResult);
        // ??
        returnSuccess(response, map);
    } catch (MbvException me) {
        me.printStackTrace();
        throw new MbvException(me.getMessage());
    } catch (RuntimeException re) {
        re.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (Exception e) {
        e.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }
}

From source file:com.mbv.web.rest.controller.VpGdnController.java

/**
 * @??excel//from ww  w. j a  v a2 s  . c om
 * @2015916
 * @param
 * @version
 */
@RequestMapping(value = "/importGdn", method = RequestMethod.POST)
@ResponseBody
public void importVpGdnAddBill(
        @RequestParam(value = "add_vpGdn_importedFile", required = false) MultipartFile file,
        HttpServletRequest request, HttpServletResponse response) throws IOException {
    JSONObject json = new JSONObject();
    try {
        // ?
        if (file.isEmpty()) {
            throw new MbvException("??");
        }
        // ??
        if (file.getSize() > 20971520) {
            throw new Exception("?20M?");
        }
        json = importFile(file);
    } catch (MbvException me) {
        me.printStackTrace();
        json.put("success", false);
        json.put("msg", me.getMessage());
    } catch (RuntimeException re) {
        re.printStackTrace();
        json.put("success", false);
        json.put("msg", re.getMessage());
    } catch (Exception e) {
        e.printStackTrace();
        json.put("success", false);
        json.put("msg", e.getMessage());
    }
    // ???
    outPrintJson(response, json.toString());
}

From source file:com.mbv.web.rest.controller.VpGdnController.java

/**
 * @??excel//from  w ww .j  av a 2s  .c o  m
 * @2015916
 * @param
 * @version
 */
@RequestMapping(value = "/importUpdateGdn", method = RequestMethod.POST)
@ResponseBody
public void importVpGdnUpdateBill(
        @RequestParam(value = "update_vpGdn_importedFile", required = false) MultipartFile file,
        HttpServletRequest request, HttpServletResponse response) throws IOException {
    JSONObject json = new JSONObject();
    try {
        // ?
        if (file.isEmpty()) {
            throw new MbvException("??");
        }
        // ??
        if (file.getSize() > 20971520) {
            throw new Exception("?20M?");
        }
        json = importFile(file);
    } catch (MbvException me) {
        me.printStackTrace();
        json.put("success", false);
        json.put("msg", me.getMessage());
    } catch (RuntimeException re) {
        re.printStackTrace();
        json.put("success", false);
        json.put("msg", re.getMessage());
    } catch (Exception e) {
        e.printStackTrace();
        json.put("success", false);
        json.put("msg", e.getMessage());
    }
    // ???
    outPrintJson(response, json.toString());
}

From source file:me.xiaopan.sketchsample.activity.MainActivity.java

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    boolean result = true;
    try {/* w  w w. ja va  2 s  .  c  o  m*/
        result = super.dispatchTouchEvent(ev);
    } catch (RuntimeException e) {
        e.printStackTrace();
    }

    return result;
}

From source file:com.mbv.web.rest.controller.VpGdnController.java

/**
 * ??//from   ww w .  j  a va 2s .c  o  m
 */
@RequestMapping(value = "/getDefaultValue", method = RequestMethod.POST)
@ResponseBody
public void getDefaultValue(HttpServletRequest request, HttpServletResponse response) {
    try {
        String docCode = vpGdnService.getVpGdnMaxDocCode(MbvConstant.SEQ_NAME_VPGDN);
        if (docCode == null || "".equals(docCode)) {
            throw new MbvException("????");
        }
        log.info("docCode:" + docCode);
        VpGdnEntity entity = new VpGdnEntity();
        entity.setDocCode(docCode);

        // session??
        String orgCode = request.getSession().getAttribute(MbvConstant.UNIT_CODE).toString();
        String warehCode = request.getSession().getAttribute(MbvConstant.WAREH_CODE).toString();
        if (orgCode == null || "".equals(orgCode) || warehCode == null || "".equals(warehCode)) {
            throw new MbvException("Session?????");
        }
        log.info("orgCode:" + orgCode);
        log.info("warehCode:" + warehCode);
        entity.setUnitCode(orgCode);
        entity.setWarehCode(warehCode);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("data", entity);
        // ??
        returnSuccess(response, map);
    } catch (MbvException me) {
        me.printStackTrace();
        throw new MbvException(me.getMessage());
    } catch (RuntimeException re) {
        re.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (Exception e) {
        e.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }
}

From source file:com.mbv.web.rest.controller.VpGdnController.java

/**
 * @????/* w w  w  .  j a  v a  2s .  c  o  m*/
 * @2015915
 * @param
 * @version
 * @throws Exception
 */
@RequestMapping(value = "/updateVpGdn", method = RequestMethod.POST)
@ResponseBody
public void updateVpGdn(@RequestBody VpGdnVo vo, HttpServletResponse response) throws Exception {
    // vo
    if (vo == null || vo.getEntity().getId() == null || vo.getEntity().getId() == 0) {
        throw new MbvException("??");
    }
    VpGdnEntity entity = vo.getEntity();
    try {
        // ??
        String errMessage = vpGdnService.validate(entity);
        if (errMessage != null && !"".equals(errMessage)) {
            throw new MbvException(errMessage);
        }
        List<VpGdnDtlEntity> details = vo.getDetails();
        // ????
        errMessage = vpGdnService.validateDetail(entity, details);
        if (errMessage != null && !"".equals(errMessage)) {
            throw new MbvException(errMessage);
        }

        boolean updateResult = vpGdnService.updateVpGdn(entity, details);
        log.info("updateVpGdn updateResult:" + updateResult);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("result", updateResult);
        // ??
        returnSuccess(response, map);
    } catch (MbvException me) {
        me.printStackTrace();
        throw new MbvException(me.getMessage());
    } catch (RuntimeException re) {
        re.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    } catch (Exception e) {
        e.printStackTrace();
        throw new MbvException(MbvConstant.MBV_SYS_ERROR_TIP);
    }
}