List of usage examples for java.lang IllegalAccessException printStackTrace
public void printStackTrace()
From source file:com.berniesanders.fieldthebern.views.MapScreenView.java
private void injectSelf(Context context) { //This is a hack to safely get a reference to the activity. //Flow is internally already passing around the references in a private Map<Path,Context> //So we use a little hacky reflection tool to steal the activity ref //but hold it in a weak ref //TODO: we could probably change this to a "controller" PathContext pathContext = (PathContext) context; Map<Path, Context> contextMap = new HashMap<>(); try {/*from w ww .jav a2s.c om*/ contextMap = (Map<Path, Context>) FieldUtils.readDeclaredField(context, "contexts", true); } catch (IllegalAccessException e) { Timber.e(e, "error reading path contexts..."); e.printStackTrace(); } for (Context ctx : contextMap.values()) { if (ctx instanceof Activity) { Timber.v("We found an activity!"); activityWeakReference = new WeakReference<>((Activity) ctx); } } DaggerService.<MapScreen.Component>getDaggerComponent(context, DaggerService.DAGGER_SERVICE).inject(this); }
From source file:org.jbuilt.utils.ValueClosure.java
/** * /* w ww.j a v a 2 s . c o m*/ * @param bean * @param prop * @param value * - expecting 0 or 1 value */ public ValueClosure(Object bean, String prop, Object... value) { this.arguments = new Arguments(value); this.bean = bean; this.prop = prop; // FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(bean.getClass().getSimpleName()+"."+prop, bean); // this.expectedType = expectedType; try { this.propertyType = PropertyUtils.getPropertyType(bean, prop); } 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(); } if (value != null) { if (value.length > 0) { if (value[0] != null) { this.value = value[0]; } } } else { this.value = null; } // if (value != null && value.length > 0 && value[0] != null) { // this.value = value[0]; // } }
From source file:eu.comvantage.dataintegration.QueryDistributionServiceImpl.java
private void handleSPARULrequest(Long commandId, Long clientId, HashMap<String, String> params, String[] roles, HttpServletResponse response) throws IOException { //run SPARULComposer to check, if user is allowed to access template and to complete template and viewactions (insertion of params) SparulComposer composer = null;//from w w w . jav a2 s . c om try { composer = SparulComposerFactory.getSparulComposer(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } SPARULComposerDataConnector dataConnector = new SPARULComposerDataConnector(); composer.setDataInterface(dataConnector); String[] commands = composer.compose(clientId, commandId, params, roles); if (commands.length == 0) { response.setStatus(500); print("QueryDistributionServiceImpl.handleSPARULrequest: No commands have been created (cause: false clientId or commandId, no role specified, malformed or missing template parameters", response); return; } //execute template and viewactions via SPARQLConnector (data source url is stored with the template in the repository) DistributedRequestFactory drfactory = new DistributedRequestFactory(); String updateEndpoint = dataConnector.getUpdateEndpoint(clientId, commandId); if (updateEndpoint == null) { response.setStatus(500); print("QueryDistributionServiceImpl.handleSPARULrequest: Invalid template or client id!", response); return; } DistributedRequest disRequest = drfactory.createSPARULRequestForDedicatedSources(commands, updateEndpoint); if (disRequest == null || disRequest.getRequestList().size() == 0) { response.setStatus(500); print("QueryDistributionServiceImpl.handleSPARULrequest: No requests have been created!", response); return; } QueryResultSet result = new QueryResultSet(); DistributedRequestExecutionManager dreManager = new DistributedRequestExecutionManager(); result = dreManager.handleSPARULRequest(disRequest); String outstream = "QueryDistributionServiceImpl.handleSPARULrequest: Update executed!"; response.setStatus(200); print(outstream, response); }
From source file:de.Keyle.MyPet.MyPetPlugin.java
private void replaceLogger() { try {/*www . java 2 s .com*/ Field logger = ReflectionUtil.getField(JavaPlugin.class, "logger"); if (logger != null) { logger.set(this, new MyPetLogger(this)); } } catch (IllegalAccessException e) { e.printStackTrace(); } }
From source file:org.talend.core.ui.context.nattableTree.ExtendedContextColumnPropertyAccessor.java
@Override public Object getDataValue(R rowObj, int columnIndex) { Class<? extends Object> contextRowClas = rowObj.getClass(); try {/*from w ww. j a va 2 s . c o m*/ Method managerMethod = contextRowClas.getMethod("getManager"); IContextModelManager manager = (IContextModelManager) managerMethod.invoke(rowObj); Method dataMethod = contextRowClas.getMethod("getTreeData"); Object treeData = dataMethod.invoke(rowObj); return getPropertyValue(manager, treeData, columnIndex); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return null; }
From source file:org.talend.core.ui.context.nattableTree.ExtendedContextColumnPropertyAccessor.java
@Override public void setDataValue(R rowObj, int columnIndex, Object newValue) { Class<? extends Object> contextRowClas = rowObj.getClass(); try {//w ww .j a v a 2 s . c o m Method managerMethod = contextRowClas.getMethod("getManager"); IContextModelManager manager = (IContextModelManager) managerMethod.invoke(rowObj); Method nameMethod = contextRowClas.getMethod("getName"); String paraName = (String) nameMethod.invoke(rowObj); Method dataMethod = contextRowClas.getMethod("getTreeData"); Object treeData = dataMethod.invoke(rowObj); setPropertyValue(manager, treeData, paraName, columnIndex, newValue); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
From source file:com.legstar.coxb.gen.CoxbBindingGenerator.java
/** * Returns a new instance of the requested JAXB object. * /*from www .j av a2 s. c o m*/ * @param jaxbObjectFactory an instance of a JAXB Object Factory * @param rootObjectName the JAXB root object name (non qualified) * @return an instance of the JAXB root object */ protected Object getRootObject(final Object jaxbObjectFactory, final String rootObjectName) { Object jaxbRootObject = null; if (jaxbObjectFactory == null) { throw (new BuildException("You must provide a JAXB object factory.")); } if (rootObjectName == null || rootObjectName.length() == 0) { throw (new BuildException("You must provide a JAXB object name.")); } try { String createName = "create" + rootObjectName; Method creator = jaxbObjectFactory.getClass().getMethod(createName); jaxbRootObject = creator.invoke(jaxbObjectFactory); } catch (IllegalAccessException e) { e.printStackTrace(); throw (new BuildException( "IllegalAccessException " + e.getMessage() + " rootObjectName=" + rootObjectName)); } catch (SecurityException e) { e.printStackTrace(); throw (new BuildException("SecurityException " + e.getMessage() + " rootObjectName=" + rootObjectName)); } catch (NoSuchMethodException e) { e.printStackTrace(); throw (new BuildException( "NoSuchMethodException " + e.getMessage() + " rootObjectName=" + rootObjectName)); } catch (IllegalArgumentException e) { e.printStackTrace(); throw (new BuildException( "IllegalArgumentException " + e.getMessage() + " rootObjectName=" + rootObjectName)); } catch (InvocationTargetException e) { e.printStackTrace(); throw (new BuildException( "InvocationTargetException " + e.getMessage() + " rootObjectName=" + rootObjectName)); } return jaxbRootObject; }
From source file:org.apache.ranger.service.RangerPolicyService.java
public List<XXTrxLog> getTransactionLog(RangerPolicy vObj, XXPolicy mObj, int action) { if (vObj == null || action == 0 || (action == OPERATION_UPDATE_CONTEXT && mObj == null)) { return null; }//from w w w . j a va2 s . co m List<XXTrxLog> trxLogList = new ArrayList<XXTrxLog>(); Field[] fields = vObj.getClass().getDeclaredFields(); try { Field nameField = vObj.getClass().getDeclaredField("name"); nameField.setAccessible(true); String objectName = "" + nameField.get(vObj); for (Field field : fields) { if (!trxLogAttrs.containsKey(field.getName())) { continue; } XXTrxLog xTrxLog = processFieldToCreateTrxLog(field, objectName, nameField, vObj, mObj, action); if (xTrxLog != null) { trxLogList.add(xTrxLog); } } Field[] superClassFields = vObj.getClass().getSuperclass().getDeclaredFields(); for (Field field : superClassFields) { if (field.getName().equalsIgnoreCase("isEnabled")) { XXTrxLog xTrx = processFieldToCreateTrxLog(field, objectName, nameField, vObj, mObj, action); if (xTrx != null) { trxLogList.add(xTrx); } break; } } } catch (IllegalAccessException illegalAcc) { illegalAcc.printStackTrace(); } catch (NoSuchFieldException noSuchField) { noSuchField.printStackTrace(); } return trxLogList; }
From source file:org.jbuilt.utils.ValueClosure.java
public Object execute(/* Object bean, String prop, Object value */UIComponent component) { context = FacesContext.getCurrentInstance(); this.component = component; Object submittedValue;/*from w w w . j a v a 2 s . c o m*/ Object finalValue = null; if (context != null) { boolean renderResponse = context.getRenderResponse(); // String no = "no"; // String yes = "yes"; // out.println("are we in render response phase? " // + (renderResponse ? yes : no)); boolean hasArg = true; // args.length > 0 && args[0] != null; // if (context != null) { if (hasArg) { Object tempValue = null; Object origProp = null; try { origProp = PropertyUtils.getProperty(bean, prop); } catch (IllegalAccessException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InvocationTargetException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (NoSuchMethodException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String clientId = component.getClientId(context); assert clientId != null; Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap(); // FIXME: we should be getting the submitted value not the raw request value; Object newValue = requestMap.get(clientId); if (newValue != null) { newValue = getConvertedValue(newValue, component); } else { if (origProp != null) { newValue = origProp; } else { newValue = null; } } try { PropertyUtils.setProperty(bean, prop, newValue); finalValue = PropertyUtils.getProperty(bean, prop); Object a = null; } 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(); } // } } } return finalValue; }
From source file:org.kuali.kra.budget.calculator.QueryList.java
/** returns the field value in the base bean for the specified field. * @param fieldName fieldname whose value has to be got. * @param baseBean Bean containing the field. * @return value of the field.//from w ww. j a v a 2s. c o m */ private Object getFieldValue(String fieldName, Object baseBean) { Field field = null; Method method = null; Class dataClass = baseBean.getClass(); Object value = null; try { field = dataClass.getDeclaredField(fieldName); if (!field.isAccessible()) { throw new NoSuchFieldException(); } } catch (NoSuchFieldException noSuchFieldException) { try { String methodName = "get" + (fieldName.charAt(0) + "").toUpperCase() + fieldName.substring(1); method = dataClass.getMethod(methodName, null); } catch (NoSuchMethodException noSuchMethodException) { noSuchMethodException.printStackTrace(); } } try { if (field != null && field.isAccessible()) { value = field.get(baseBean); } else { value = method.invoke(baseBean, null); } } catch (IllegalAccessException illegalAccessException) { illegalAccessException.printStackTrace(); } catch (InvocationTargetException invocationTargetException) { invocationTargetException.printStackTrace(); } return value; }