List of usage examples for java.lang InstantiationException getMessage
public String getMessage()
From source file:org.dspace.app.cris.discovery.NestedAwardsEnhancer.java
@Override protected <P extends Property<TP>, TP extends PropertiesDefinition> List<P> calculateProperties( AnagraficaSupport<P, TP> anagraficaSupport, String path) { List<P> results = new ArrayList<P>(); Set<String> temporaryAwardsWith = new TreeSet<String>(); TypeSupport<P, TP> cris = (TypeSupport<P, TP>) anagraficaSupport; if (cris.getTypo().getShortName().equals("awards")) { StringBuffer sb = new StringBuffer(); boolean create = false; for (P subprop : cris.getAnagrafica4view().get("awardswith")) { String ssss = subprop.toString(); Pattern p = Pattern.compile(".*rp(.*?)"); Matcher m = p.matcher(ssss); String authority = ""; if (m.matches()) { authority = m.group(1);/* w ww .ja v a 2s . co m*/ } String result = ""; String[] split = ssss.split("\\|\\|\\|"); String replace = split[0]; result += replace.toLowerCase(); result += "|||" + replace; if (authority != null && !authority.isEmpty()) { result += "|||rp" + authority; } if (!result.isEmpty()) { temporaryAwardsWith.add(result); create = true; } } if (create) { for (P subprop : cris.getAnagrafica4view().get("awardsdate")) { sb.append("###").append("awardsdate").append(":").append(subprop.toString()); } for (P subprop : cris.getAnagrafica4view().get("awardsfreetext")) { sb.append("###").append("awardsfreetext").append(":").append(subprop.toString()); } for (P subprop : cris.getAnagrafica4view().get("awardscategory")) { sb.append("###").append("awardscategory").append(":").append(subprop.toString()); } String awardsWith = ""; for (String s : temporaryAwardsWith) { awardsWith += s + "###"; } String value = sb + "|#|#|#" + awardsWith; WidgetTesto widget = new WidgetTesto(); TP propDef; P prop; try { propDef = cris.getClassPropertiesDefinition().newInstance(); propDef.setRendering(widget); prop = cris.getClassProperty().newInstance(); TextValue avalue = new TextValue(); avalue.setReal(value); prop.setValue(avalue); prop.setVisibility(VisibilityConstants.PUBLIC); prop.setTypo(propDef); results.add(prop); } catch (InstantiationException e) { log.error(e.getMessage(), e); } catch (IllegalAccessException e) { log.error(e.getMessage(), e); } } } return results; }
From source file:org.jahia.services.content.nodetypes.DynamicValueImpl.java
public Value[] expand(Locale locale) { Value[] v = null;/*w w w.ja v a2 s . c o m*/ String classname; if (fn.equals("useClass")) { classname = getParams().get(0); } else { classname = "org.jahia.services.content.nodetypes.initializers." + StringUtils.capitalize(fn); } try { ValueInitializer init = (ValueInitializer) Class.forName(classname).newInstance(); if (init instanceof I15dValueInitializer) { v = ((I15dValueInitializer) init).getValues(declaringPropertyDefinition, getParams(), locale); } else { v = init.getValues(declaringPropertyDefinition, getParams()); } } catch (InstantiationException e) { logger.error(e.getMessage(), e); } catch (IllegalAccessException e) { logger.error(e.getMessage(), e); } catch (ClassNotFoundException e) { logger.error(e.getMessage(), e); } List<Value> res = new ArrayList<Value>(); if (v != null) { for (int i = 0; i < v.length; i++) { Value value = v[i]; if (value instanceof DynamicValueImpl) { res.addAll(Arrays.asList(((DynamicValueImpl) value).expand(locale))); } else { res.add(value); } } } return res.toArray(new Value[res.size()]); }
From source file:org.opencds.knowledgeRepository.SimpleKnowledgeRepository.java
public static synchronized Object getPayloadCreatorInstanceForClassNameCache(String className) throws DSSRuntimeExceptionFault { Object payloadCreator = myPayloadCreatorNameToInstanceCache.get(className); if (payloadCreator == null) { log.debug(className + ": creating payloadCreator instance"); @SuppressWarnings("rawtypes") Class c;// w w w . j a v a 2 s . co m try { c = Class.forName(className); } catch (ClassNotFoundException e1) { throw new DSSRuntimeExceptionFault("requested Payload Creator name does not exist: " + className); } try { payloadCreator = c.newInstance(); } catch (InstantiationException e) { throw new DSSRuntimeExceptionFault( "requested Payload Creator InstantiationException: " + className + ", " + e.getMessage()); } catch (IllegalAccessException e) { throw new DSSRuntimeExceptionFault( "requested Payload Creator IllegalAccessException: " + className + ", " + e.getMessage()); } myPayloadCreatorNameToInstanceCache.putIfAbsent(className, payloadCreator); return payloadCreator; } else { log.debug(className + ": using payloadCreator instance from cache"); return payloadCreator; } }
From source file:org.apache.oodt.filemgringest.FilemgrIngestStep.java
/** * This method is called by PDI during transformation startup. * /*from ww w. j a va 2 s .co m*/ * It should initialize required for step execution. * * The meta and data implementations passed in can safely be cast * to the step's respective implementations. * * It is mandatory that super.init() is called to ensure correct behavior. * * Typical tasks executed here are establishing the connection to a database, * as wall as obtaining resources, like file handles. * * @param smi step meta interface implementation, containing the step settings * @param sdi step data interface implementation, used to store runtime information * * @return true if initialization completed successfully, false if there was an error preventing the step from working. * */ public boolean init(StepMetaInterface smi, StepDataInterface sdi) { // Casting to step-specific implementation classes is safe FilemgrIngestStepMeta meta = (FilemgrIngestStepMeta) smi; FilemgrIngestStepData data = (FilemgrIngestStepData) sdi; try { oodt.loadIngester(meta.getServerURLField()); } catch (InstantiationException e) { logError(e.getMessage()); } return super.init(meta, data); }
From source file:org.jahia.utils.osgi.parsers.cnd.DynamicValueImpl.java
public Value[] expand() { Value[] v = null;//ww w. j a v a2 s. c om String classname; if (fn.equals("useClass")) { classname = getParams().get(0); } else { classname = "org.jahia.services.content.nodetypes.initializers." + StringUtils.capitalize(fn); } try { ValueInitializer init = (ValueInitializer) Class.forName(classname).newInstance(); v = init.getValues(declaringPropertyDefinition, getParams()); } catch (InstantiationException e) { logger.error(e.getMessage(), e); } catch (IllegalAccessException e) { logger.error(e.getMessage(), e); } catch (ClassNotFoundException e) { logger.error(e.getMessage(), e); } List<Value> res = new ArrayList<Value>(); if (v != null) { for (int i = 0; i < v.length; i++) { Value value = v[i]; if (value instanceof DynamicValueImpl) { res.addAll(Arrays.asList(((DynamicValueImpl) value).expand())); } else { res.add(value); } } } return res.toArray(new Value[res.size()]); }
From source file:org.apache.cayenne.dbimport.DefaultReverseEngineeringLoader.java
private <T extends PatternParam> Collection<T> loadPatternParams(Class<T> clazz, List<Node> nodes) { Collection<T> res = new LinkedList<T>(); for (Node node : nodes) { try {//from ww w.ja va2 s. c o m T obj = clazz.newInstance(); obj.setPattern(loadPattern(node)); res.add(obj); } catch (InstantiationException e) { LOG.info(e.getMessage(), e); } catch (IllegalAccessException e) { LOG.info(e.getMessage(), e); } } return res; }
From source file:org.codehaus.groovy.grails.web.metaclass.DataBindingDynamicConstructor.java
public Object invoke(Class clazz, Object[] args) { Object map = args.length > 0 ? args[0] : null; Object instance;/* www .j a va2 s . c om*/ if (applicationContext != null && applicationContext.containsBean(clazz.getName())) { instance = applicationContext.getBean(clazz.getName()); } else { try { instance = clazz.newInstance(); } catch (InstantiationException e1) { throw new GrailsDomainException("Error instantiated class [" + clazz + "]: " + e1.getMessage(), e1); } catch (IllegalAccessException e1) { throw new GrailsDomainException( "Illegal access instantiated class [" + clazz + "]: " + e1.getMessage(), e1); } } if (map != null) { DataBindingUtils.bindObjectToInstance(instance, map); GrailsDomainClass domainClass = null; String domainClassBeanName = clazz.getName() + "DomainClass"; if (applicationContext != null && applicationContext.containsBean(domainClassBeanName)) { domainClass = (GrailsDomainClass) applicationContext.getBean(domainClassBeanName); } if (map instanceof Map && domainClass != null) { Map theMap = (Map) map; for (Iterator i = theMap.keySet().iterator(); i.hasNext();) { Object key = i.next(); String propertyName = key.toString(); if (propertyName.indexOf('.') > -1) { propertyName = propertyName.substring(0, propertyName.indexOf('.')); } if (domainClass.hasPersistentProperty(propertyName)) { GrailsDomainClassProperty prop = domainClass.getPropertyByName(propertyName); if (prop != null && prop.isOneToOne() && prop.isBidirectional()) { Object val = theMap.get(key); GrailsDomainClassProperty otherSide = prop.getOtherSide(); if (val != null && otherSide != null) { MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(val.getClass()); try { mc.setProperty(val, otherSide.getName(), instance); } catch (Exception e) { // ignore } } } } } } } return instance; }
From source file:presentation.foundation.BaseFragmentActivity.java
protected <T extends BasePresenterFragment> BasePresenterFragment replaceFragment(Class<T> clazz) { try {/*from w w w . ja v a2 s .c o m*/ BasePresenterFragment fragment = clazz.newInstance(); getSupportFragmentManager().beginTransaction().replace(R.id.fl_fragment, fragment).commit(); return fragment; } catch (InstantiationException e) { throw new IllegalStateException(e.getMessage()); } catch (IllegalAccessException e) { throw new IllegalStateException(e.getMessage()); } }
From source file:net.reichholf.dreamdroid.activities.SimpleFragmentActivity.java
@Override public void showDialogFragment(Class<? extends DialogFragment> fragmentClass, Bundle args, String tag) { DialogFragment f = null;// w w w . java2 s .c o m try { f = fragmentClass.newInstance(); f.setArguments(args); showDialogFragment(f, tag); } catch (InstantiationException e) { Log.e(DreamDroid.LOG_TAG, e.getMessage()); } catch (IllegalAccessException e) { Log.e(DreamDroid.LOG_TAG, e.getMessage()); } }
From source file:org.wso2.carbon.identity.workflow.mgt.workflow.AbstractWorkflow.java
public WorkFlowExecutor getWorkFlowExecutor() { WorkFlowExecutor workFlowExecutor = null; try {/*w w w . ja v a 2s . c om*/ workFlowExecutor = workFlowExecutorClass.newInstance(); } catch (InstantiationException e) { String errorMsg = "Error occurred while initializing WorkFlowExecutor : " + e.getMessage(); log.error(errorMsg); throw new WorkflowRuntimeException(errorMsg, e); } catch (IllegalAccessException e) { String errorMsg = "Error occurred while initializing WorkFlowExecutor : " + e.getMessage(); log.error(errorMsg); throw new WorkflowRuntimeException(errorMsg, e); } return workFlowExecutor; }