List of usage examples for java.lang IllegalAccessException printStackTrace
public void printStackTrace()
From source file:istata.service.StataService.java
/** * transform a list of estimation properties into a realised list * /*from w w w .j ava 2 s .c o m*/ * this resolves placeholders in the form of <i> or <i(\\d*?)> to their * respective inherient properties. * * @param ests * @return */ public List<EstBean> realiseEstDo(List<EstBean> ests) { ArrayList<EstBean> realised = new ArrayList<EstBean>(); for (EstBean org : ests) { EstBean real = new EstBean(); for (String s : new String[] { "prefix", "command", "depvar", "vars", "restrictions", "options" }) { String orgstr; try { orgstr = BeanUtils.getProperty(org, s); if (orgstr != null) { BeanUtils.setProperty(real, s, replaceEstRefs(orgstr, s, realised)); } } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } } realised.add(real); } return realised; }
From source file:jerry.c2c.action.UploadProductAction.java
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String target = "result"; String resultPageTitle = "error"; String msgTitle = "error"; String msgContent = "error"; NewProductForm productForm = (NewProductForm) form; HttpSession session = request.getSession(); Item item = new Item(); try {/*from w w w . j a va2 s .c o m*/ BeanUtils.copyProperties(item, productForm); item.setCreateTime(DateTimeUtil.getCurrentTimestamp()); Timestamp createTime = DateTimeUtil.getCurrentTimestamp(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, productForm.getDays()); Timestamp endTime = new Timestamp(calendar.getTimeInMillis()); item.setBelongTo((Shop) session.getAttribute("user_shop")); item.setCreateTime(createTime); item.setEndTime(endTime); Category category = categoryService.getById(productForm.getCategoryId()); item.setCategory(category); itemService.save(item); this.handleUploadImage(productForm.getImageFile(), item.getBelongTo().getName(), item.getId()); resultPageTitle = "??"; msgTitle = "??"; msgContent = "?(" + item.getName() + ")?"; } catch (IllegalAccessException e) { itemService.delete(item); resultPageTitle = "?"; msgTitle = "?"; msgContent = "?,?:" + e.getMessage(); } catch (InvocationTargetException e) { itemService.delete(item); resultPageTitle = "?"; msgTitle = "?"; msgContent = "?,?:" + e.getMessage(); } catch (IOException e) { itemService.delete(item); e.printStackTrace(); resultPageTitle = "?"; msgTitle = "?"; msgContent = "?,?:" + e.getMessage(); } catch (BusinessException e) { itemService.delete(item); e.printStackTrace(); resultPageTitle = "?"; msgTitle = "?"; msgContent = "?,?:" + e.getMessage(); } finally { request.setAttribute("title", resultPageTitle); request.setAttribute("message_title", msgTitle); request.setAttribute("message_content", msgContent); } return mapping.findForward(target); }
From source file:geva.Main.AbstractRun.java
/** * Load a GEGrammar. Default is geva.Mapper.GEGrammar * @param p properties file/*from ww w. j av a 2 s .com*/ * @return GEGrammar, null if getProperty failed */ protected GEGrammar getGEGrammar(Properties p) { GEGrammar geg = null; String className; String key; key = Constants.GEGRAMMAR; try { className = p.getProperty(key, Constants.DEFAULT_GEGRAMMAR); Class clazz = Class.forName(className); geg = (GEGrammar) clazz.newInstance(); geg.setProperties(p); } catch (IllegalAccessException e) { System.err.println(this.getClass().getName() + ".getGEGrammar() exception: " + e); } catch (ClassNotFoundException e) { System.err.println(this.getClass().getName() + ".getGEGrammar() exception: " + e); e.printStackTrace(); } catch (InstantiationException e) { System.err.println(this.getClass().getName() + ".getGEGrammar() exception: " + e); e.printStackTrace(); } return geg; }
From source file:com.thinkbiganalytics.feedmgr.rest.controller.FeedRestController.java
private void updateFeedMetadata(FeedMetadata targetFeedMetadata, FeedMetadata modifiedFeedMetadata, FeedPropertySection feedPropertySection) { AnnotationFieldNameResolver annotationFieldNameResolver = new AnnotationFieldNameResolver( FeedPropertyType.class); List<AnnotatedFieldProperty> list = annotationFieldNameResolver.getProperties(FeedMetadata.class); List<AnnotatedFieldProperty> sectionList = list.stream() .filter(annotatedFieldProperty -> feedPropertySection .equals(((FeedPropertyType) annotatedFieldProperty.getAnnotation()).section())) .collect(Collectors.toList()); sectionList.forEach(annotatedFieldProperty -> { try {/* w w w . ja va 2s . c om*/ Object value = FieldUtils.readField(annotatedFieldProperty.getField(), modifiedFeedMetadata); FieldUtils.writeField(annotatedFieldProperty.getField(), targetFeedMetadata, value); } catch (IllegalAccessException e) { e.printStackTrace(); } }); }
From source file:com.mysql.stresstool.RunnableClusterQuerySelect.java
@Override public void setClassConfiguration(Map mConfig) { classConfig = mConfig;/* w w w . j a v a 2 s . c o m*/ for (int i = 0; i < CLASS_PARAMETERS.size(); i++) { try { String methodName = (String) CLASS_PARAMETERS.get(i); methodName = methodName.substring(0, 1).toUpperCase() + methodName.substring(1, methodName.length()); methodName = "set" + methodName; String valueM = (String) classConfig.get(CLASS_PARAMETERS.get(i)); // System.out.println(methodName + " = " + valueM); if (valueM != null) { if (valueM.equals("true") || valueM.equals("false")) { MethodUtils.invokeMethod(this, methodName, Boolean.parseBoolean(valueM)); } else if (Utils.isNumeric(valueM)) { MethodUtils.invokeMethod(this, methodName, Integer.parseInt(valueM)); } else // PropertyUtils.setProperty(this,methodName,valueM); // MethodUtils.setCacheMethods(false); MethodUtils.invokeMethod(this, methodName, valueM); } } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:org.intermine.web.logic.results.ReportObject.java
/** * Resolve an attribute, part of initialise() * @param fd FieldDescriptor/*ww w . j ava2 s. c om*/ */ private void initialiseAttribute(FieldDescriptor fd) { long startTime = System.currentTimeMillis(); // bags attributes = (attributes != null) ? attributes : new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER); attributeDescriptors = (attributeDescriptors != null) ? attributeDescriptors : new HashMap<String, FieldDescriptor>(); Object fieldValue = null; try { fieldValue = object.getFieldValue(fd.getName()); } catch (IllegalAccessException e) { e.printStackTrace(); } if (fieldValue != null) { if (fieldValue instanceof ClobAccess) { ClobAccess fieldClob = (ClobAccess) fieldValue; if (fieldClob.length() > 200) { fieldValue = fieldClob.subSequence(0, 200).toString(); } else { fieldValue = fieldClob.toString(); } } attributes.put(fd.getName(), fieldValue); attributeDescriptors.put(fd.getName(), fd); } long endTime = System.currentTimeMillis(); LOG.info("TIME initialiseAttribute " + fd.getName() + " took: " + (endTime - startTime) + "ms"); }
From source file:org.intermine.web.logic.results.ReportObject.java
/** * Resolve a Collection, part of initialise() * @param fd FieldDescriptor//from ww w .jav a 2 s .c om */ private void initialiseCollection(FieldDescriptor fd) { long startTime = System.currentTimeMillis(); // bag collections = (collections != null) ? collections : new TreeMap<String, DisplayCollection>(String.CASE_INSENSITIVE_ORDER); String colName = fd.getName(); // do not bother with 'em if they WILL be size 0 if (!nullRefsCols.contains(colName)) { Object fieldValue = null; try { fieldValue = object.getFieldValue(colName); } catch (IllegalAccessException e) { e.printStackTrace(); } long queryStartTime = System.currentTimeMillis(); // determine the types in the collection List<Class<?>> listOfTypes = PathQueryResultHelper.queryForTypesInCollection(object, colName, im.getObjectStore()); long queryTime = System.currentTimeMillis() - queryStartTime; LOG.info("TIME - query for types in collection: " + colName + " took: " + queryTime); DisplayCollection newCollection = null; try { newCollection = new DisplayCollection((Collection<?>) fieldValue, (CollectionDescriptor) fd, webConfig, webProperties, im.getClassKeys(), listOfTypes, objectType); } catch (Exception e) { e.printStackTrace(); } if (newCollection != null) { collections.put(colName, newCollection); } } long endTime = System.currentTimeMillis(); LOG.info("TIME initialiseCollection " + fd.getName() + " took: " + (endTime - startTime) + "ms"); }
From source file:org.intermine.web.logic.results.ReportObject.java
/** * Resolve a Reference, part of initialise() * @param fd FieldDescriptor/*from w w w.j av a 2 s .c o m*/ */ private void initialiseReference(FieldDescriptor fd) { long startTime = System.currentTimeMillis(); // bag references = (references != null) ? references : new TreeMap<String, DisplayReference>(String.CASE_INSENSITIVE_ORDER); ReferenceDescriptor ref = (ReferenceDescriptor) fd; String refName = ref.getName(); // do not bother with 'em if they WILL be size 0 if (!nullRefsCols.contains(refName)) { // check whether reference is null without dereferencing Object proxyObject = null; ProxyReference proxy = null; try { proxyObject = object.getFieldProxy(refName); } catch (IllegalAccessException e1) { e1.printStackTrace(); } if (proxyObject instanceof org.intermine.objectstore.proxy.ProxyReference) { proxy = (ProxyReference) proxyObject; } else { // no go on objects that are not Proxies, ie Tests } DisplayReference newReference = null; try { newReference = new DisplayReference(proxy, ref, webConfig, im.getClassKeys(), objectType); } catch (Exception e) { e.printStackTrace(); } if (newReference != null) { references.put(refName, newReference); } } long endTime = System.currentTimeMillis(); LOG.info("TIME initialiseReference " + fd.getName() + " took: " + (endTime - startTime) + "ms"); }
From source file:com.magestore.app.pos.SalesActivity.java
protected void initModel() { // Context s dng xuyn sut h thng magestoreContext = new MagestoreContext(); magestoreContext.setActivity(this); // subjectObserv SubjectObserv subjectObserv = new SubjectObserv(); // chun b service ProductService productService = null; CheckoutService checkoutService = null; CartService cartService = null;// w ww . j a v a2s. c o m CategoryService categoryService = null; ProductOptionService productOptionService = null; CustomerAddressService customerAddressService = null; PluginsService pluginsService = null; try { factory = ServiceFactory.getFactory(magestoreContext); productService = factory.generateProductService(); checkoutService = factory.generateCheckoutService(); cartService = factory.generateCartService(); categoryService = factory.generateCategoryService(); configService = factory.generateConfigService(); customerService = factory.generateCustomerService(); productOptionService = factory.generateProductOptionService(); customerAddressService = factory.generateCustomerAddressService(); pluginsService = factory.generatePluginsService(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } // controller qun l category mCategoryListController = new CategoryListController(); mCategoryListController.setMagestoreContext(magestoreContext); //Felix Edit 27/4 // mCategoryListController.setListPanel(mCategoryListPanel); mCategoryListController.setListPanel(mSpinnerListPanel); //End Felix Edit 27/4 mCategoryListController.setCategoryService(categoryService); mCategoryListController.setSubject(subjectObserv); // controller qun l check out mCheckoutListController = new CheckoutListController(); mCheckoutListController.setSubject(subjectObserv); mCheckoutListController.setContext(getContext()); mCheckoutListController.setMagestoreContext(magestoreContext); mCheckoutListController.setListService(checkoutService); mCheckoutListController.setConfigService(configService); mCheckoutListController.setCustomerAddressService(customerAddressService); mCheckoutListController.setListPanel(mCheckoutListPanel); mCheckoutListPanel.setController(mCheckoutListController); mCheckoutListController.setDetailPanel(mCheckoutDetailPanel); mCheckoutListController.setCheckoutShippingListPanel(mCheckoutShippingListPanel); mCheckoutListController.setCheckoutPaymentListPanel(mCheckoutPaymentListPanel); mCheckoutListController.setPaymentMethodListPanel(mPaymentMethodListPanel); mCheckoutListController.setCheckoutAddPaymentPanel(mCheckoutAddPaymentPanel); mCheckoutListController.setCartOrderListPanel(mCartOrderListPanel); mCheckoutListController.setCheckoutAddressListPanel(mCheckoutAddressListPanel); mCheckoutListController.setCheckoutSuccessPanel(mCheckoutSuccessPanel); mCheckoutListController.setCheckoutPaymentWebviewPanel(mCheckoutPaymentWebviewPanel); mCheckoutListController.setCheckoutPaymentCreditCardPanel(mCheckoutPaymentCreditCardPanel); mCheckoutListController.setCartItemDetailPanel(mCartItemDetailPanel); mCheckoutListController.setPluginsService(pluginsService); mCheckoutListController.setPluginRewardPointPanel(mPluginRewardPointPanel); mCheckoutListController.setPluginStoreCreditPanel(mPluginStoreCreditPanel); mCheckoutListController.setPluginGiftCardPanel(mPluginGiftCardPanel); // controller qun l danh sch khch hng mProductListController = new ProductListController(); mProductListController.setSubject(subjectObserv); mProductListController.setMagestoreContext(magestoreContext); mProductListController.setProdcutService(productService); mProductListController.setListPanel(mProductListPanel); mProductListController.setSubject(subjectObserv); mCheckoutListController.setProductListController(mProductListController); mProductListPanel.setAllowShowWarningWhileEmptyList(); // controller qun l n hng mCheckoutCartItemListController = new CartItemListController(); mCheckoutCartItemListController.setSubject(subjectObserv); mCheckoutCartItemListController.setMagestoreContext(magestoreContext); mCheckoutCartItemListController.setAutoSelectFirstItem(false); mCheckoutCartItemListController.setListPanel(mCartItemListPanel); mCheckoutCartItemListController.setDetailPanel(mCartItemDetailPanel); mCheckoutCartItemListController.setProductOptionPanel(mProductOptionPanel); mCheckoutCartItemListController.setCustomSalePanel(mCheckoutCustomSalePanel); mCheckoutCartItemListController.setChildListService(cartService); mCheckoutCartItemListController.setProductOptionService(productOptionService); mCheckoutCartItemListController.setCheckoutListController(mCheckoutListController); mCheckoutListController.setCartItemListController(mCheckoutCartItemListController); mCheckoutAddPaymentListController = new CheckoutAddPaymentListController(); mCheckoutAddPaymentListController.setMagestoreContext(magestoreContext); mCheckoutAddPaymentListController.setListPanel(mCheckoutAddPaymentPanel); mCheckoutAddPaymentListController.setCheckoutListController(mCheckoutListController); // controller plugin giftcard mPluginGiftCardController = new PluginGiftCardController(); mPluginGiftCardController.setMagestoreContext(magestoreContext); mPluginGiftCardController.setPluginsService(pluginsService); mPluginGiftCardController.setPluginGiftCardListPanel(mPluginGiftCardListPanel); mPluginGiftCardController.setCheckoutListController(mCheckoutListController); mPluginGiftCardController.setView(mPluginGiftCardPanel); mPaymentMethodListPanel.setCheckoutListController(mCheckoutListController); mCheckoutDetailPanel.setCheckoutPaymentListPanel(mCheckoutPaymentListPanel); mCheckoutDetailPanel.setPaymentMethodListPanel(mPaymentMethodListPanel); mCheckoutDetailPanel.setCheckoutShippingListPanel(mCheckoutShippingListPanel); mCheckoutDetailPanel.setCheckoutAddPaymentPanel(mCheckoutAddPaymentPanel); mCheckoutDetailPanel.setCheckoutPaymentCreditCardPanel(mCheckoutPaymentCreditCardPanel); mCheckoutListPanel.setToolbarOrder(toolbar_order); mCheckoutListPanel.setMagestoreContext(magestoreContext); mCheckoutListPanel.setCustomerService(customerService); mCheckoutShippingListPanel.setCheckoutListController(mCheckoutListController); mCheckoutPaymentListPanel.setCheckoutListController(mCheckoutListController); mCheckoutAddPaymentPanel.setCheckoutListController(mCheckoutListController); mCartOrderListPanel.setCheckoutListController(mCheckoutListController); mCheckoutAddressListPanel.setController(mCheckoutListController); mCheckoutSuccessPanel.setCheckoutListController(mCheckoutListController); mCheckoutPaymentWebviewPanel.setCheckoutListController(mCheckoutListController); mCheckoutPaymentCreditCardPanel.setCheckoutListController(mCheckoutListController); mCartItemDetailPanel.setCheckoutListController(mCheckoutListController); // plugins mPluginGiftCardPanel.setVisibility(ConfigUtil.isEnableGiftCard() ? View.VISIBLE : View.GONE); mPluginRewardPointPanel.setVisibility(ConfigUtil.isEnableRewardPoint() ? View.VISIBLE : View.GONE); mPluginStoreCreditPanel.setVisibility(ConfigUtil.isEnableStoreCredit() ? View.VISIBLE : View.GONE); mPluginGiftCardPanel.setPluginGiftCardController(mPluginGiftCardController); mPluginGiftCardListPanel.setPluginGiftCardController(mPluginGiftCardController); mPluginRewardPointPanel.setCheckoutListController(mCheckoutListController); mPluginStoreCreditPanel.setCheckoutListController(mCheckoutListController); mCheckoutPaymentListPanel.setKeyboardView(mKeyboardView); mCheckoutPaymentListPanel.setLayoutCustomKeyboard(ll_custom_keyboard); // TODO: clear quote // DataUtil.removeDataStringToPreferences(getContext(), DataUtil.QUOTE); mProductListPanel.initModel(); mCheckoutListPanel.initModel(); mCartItemDetailPanel.initModel(); mCartItemListPanel.initModel(); mCategoryListPanel.initModel(); // map cc observ ///////////////////////////////// // update product controller mi khi category c ch?n mProductListController.attachListenerObserve().setMethodName("bindCategory") .setStateCode(GenericState.DEFAULT_STATE_CODE_ON_SELECT_ITEM) .setControllerState(mCategoryListController); mSpinnerListPanel.setProductListController(mProductListController); // bt s kin nhn nt custom sales // bt s kin cho php thay i cart item mCheckoutCartItemListController.attachListenerObserve().setMethodName("blnAlowRemoveCartItem") .setStateCode(CheckoutListController.STATE_ENABLE_CHANGE_CART_ITEM) .setControllerState(mCheckoutListController); mCheckoutCartItemListController.attachListenerObserve().setMethodName("blnAlowRemoveCartItem") .setStateCode(CheckoutListController.STATE_DISABLE_CHANGE_CART_ITEM) .setControllerState(mCheckoutListController); // mi khi 1 product trn product list c n ch?n mCheckoutCartItemListController.attachListenerObserve().setMethodName("bindProduct") .setStateCode(GenericState.DEFAULT_STATE_CODE_ON_SELECT_ITEM) .setControllerState(mProductListController); // mi khi 1 product trn product list c n ch?n mCheckoutCartItemListController.attachListenerObserve().setMethodName("showProductDetail") .setStateCode(GenericState.DEFAULT_STATE_CODE_ON_LONG_CLICK_ITEM) .setControllerState(mProductListController); mCheckoutCartItemListController.attachListenerObserve().setMethodName("addCustomSale") .setStateCode(CheckoutListController.STATE_ADD_CUSTOM_SALE) .setControllerState(mCheckoutListController); // s kin mi khi c 1 checkout c ch?n mCheckoutCartItemListController.attachListenerObserve().setMethodName("bindParent") .setStateCode(GenericState.DEFAULT_STATE_CODE_ON_SELECT_ITEM) .setControllerState(mCheckoutListController); // s kin mi khi c 1 re-order mCheckoutCartItemListController.attachListenerObserve().setMethodName("reOrder") .setStateCode(CheckoutListController.STATE_CODE_REORDER) .setControllerState(mCheckoutListController); // // hin th production opption nu product c option // mCheckoutCartItemListController // .attachListenerObserve() // .setMethodName("doShowProductOptionInput") // .setStateCode(CartItemListController.STATE_ON_SHOW_PRODUCT_OPTION) // .setControllerState(mCheckoutCartItemListController); // cp nht gi tng trn view mi khi c 1 cart item c thay i mCheckoutListController.attachListenerObserve().setMethodName("updateTotalPrice") .setStateCode(CartItemListController.STATE_ON_UPDATE_CART_ITEM) .setControllerState(mCheckoutCartItemListController); }
From source file:com.mysql.stresstool.RunnableClusterQueryInsert.java
@Override public void setClassConfiguration(Map mConfig) { classConfig = mConfig;//w ww .ja v a 2 s . com for (int i = 0; i < CLASS_PARAMETERS.size(); i++) { try { String methodName = (String) CLASS_PARAMETERS.get(i); methodName = methodName.substring(0, 1).toUpperCase() + methodName.substring(1, methodName.length()); methodName = "set" + methodName; String valueM = (String) classConfig.get(CLASS_PARAMETERS.get(i)); // System.out.println(methodName + " = " + valueM); if (valueM != null) { if (valueM.equals("true") || valueM.equals("false")) { MethodUtils.invokeMethod(this, methodName, Boolean.parseBoolean(valueM)); } else if (Utils.isNumeric(valueM)) { MethodUtils.invokeMethod(this, methodName, Integer.parseInt(valueM)); } else // PropertyUtils.setProperty(this,methodName,valueM); // MethodUtils.setCacheMethods(false); MethodUtils.invokeMethod(this, methodName, valueM); } } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }