List of usage examples for java.lang IllegalAccessException getMessage
public String getMessage()
From source file:com.tonbeller.wcf.convert.EditCtrlConverter.java
/** * updates a bean property as well as the value attribute of element */// w w w .j a va 2 s .c om public void convert(Formatter formatter, Map param, Map fileSource, Element element, Object bean) throws FormatException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { // disabled = true? return if (TypedCtrl.isDisabled(element)) return; String id = EditCtrl.getId(element); String[] inputValue = (String[]) param.get(id); // input available if (inputValue != null && inputValue.length > 0) { XoplonNS.removeAttribute(element, "error"); // parse input String formatString = EditCtrl.getFormatString(element); try { checkRequired(formatter.getLocale(), element, inputValue[0].trim().length() == 0); String type = EditCtrl.getType(element); FormatHandler handler = formatter.getHandler(type); if (handler == null) throw new FormatException("no handler found for type: " + type); Object newValue = handler.parse(inputValue[0], formatString); String strValue = handler.format(newValue, formatString); EditCtrl.setValue(element, strValue); String model = EditCtrl.getModelReference(element); if (bean != null && model.length() > 0) { PropertyUtils.setProperty(bean, model, newValue); } } catch (IllegalAccessException e) { logger.info("exception caught", e); XoplonNS.setAttribute(element, "error", e.getMessage()); XoplonNS.setAttribute(element, "value", inputValue[0]); throw e; } catch (NoSuchMethodException e) { logger.info("exception caught", e); XoplonNS.setAttribute(element, "error", e.getMessage()); XoplonNS.setAttribute(element, "value", inputValue[0]); throw e; } catch (InvocationTargetException e) { logger.info("exception caught", e); XoplonNS.setAttribute(element, "error", e.getMessage()); XoplonNS.setAttribute(element, "value", inputValue[0]); throw e; } catch (FormatException e) { logger.info("invalid user input: " + e.getMessage()); XoplonNS.setAttribute(element, "error", e.getMessage()); XoplonNS.setAttribute(element, "value", inputValue[0]); throw e; } } }
From source file:info.magnolia.cms.beans.config.ModuleLoader.java
private void load(ModuleDefinition def, Content moduleNode) { try {/*w ww .j a v a2 s . c o m*/ Module module = this.getModuleInstance(def.getName()); // instantiate if not yet done (due registraion) if (module == null) { try { String moduleClassName = moduleNode.getNodeData("class").getString(); //$NON-NLS-1$ module = (Module) Class.forName(moduleClassName).newInstance(); this.addModuleInstance(def.getName(), module); } catch (InstantiationException ie) { log.error("Module {} failed to load", moduleNode.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ log.error(ie.getMessage()); } catch (IllegalAccessException ae) { log.error(ae.getMessage()); } } // init the module if (!module.isInitialized()) { if (!module.isRestartNeeded()) { log.info("start initialization of module {}", def.getName()); Content moduleConfigNode = ContentUtil.getCaseInsensitive(moduleNode, CONFIG_NODE); module.init(moduleConfigNode); log.info("module {} initialized", def.getName()); //$NON-NLS-1$ } else { log.warn("won't initialize the module {} since a system restart is needed", module.getName()); } if (module.isRestartNeeded()) { ModuleRegistration.getInstance().setRestartNeeded(true); } } final Module m = module; // add destroy method as a shutdown task ShutdownManager.addShutdownTask(new ShutdownTask() { public boolean execute(info.magnolia.context.Context context) { log.info("Shutting down module: " + m.getName()); m.destroy(); return true; } public String toString() { return getClass().getName() + " " + m; } }); } catch (Exception e) { log.error("can't initialize module " + moduleNode.getHandle(), e); //$NON-NLS-1$ } }
From source file:fr.paris.lutece.plugins.workflow.modules.notifymylutece.web.NotifyMyLuteceTaskComponent.java
/** * {@inheritDoc}/*from www . j av a 2 s.co m*/ */ @Override public String doSaveConfig(HttpServletRequest request, Locale locale, ITask task) { // In case there are no errors, then the config is created/updated boolean bCreate = false; TaskNotifyMyLuteceConfig config = _taskNotifyMyLuteceConfigService.findByPrimaryKey(task.getId()); if (config == null) { config = new TaskNotifyMyLuteceConfig(); config.setIdTask(task.getId()); bCreate = true; } try { BeanUtils.populate(config, request.getParameterMap()); String strApply = request.getParameter(PARAMETER_APPLY); // Check if the AdminUser clicked on "Apply" or on "Save" if (StringUtils.isEmpty(strApply)) { String strJspError = validateConfig(config, request); if (StringUtils.isNotBlank(strJspError)) { return strJspError; } } // The method is overrided becaus of the following setter config.setListUserGuid(getSelectedUsers(request, config)); if (bCreate) { _taskNotifyMyLuteceConfigService.create(config); } else { _taskNotifyMyLuteceConfigService.update(config); } } catch (IllegalAccessException e) { AppLogService.error(e.getMessage(), e); } catch (InvocationTargetException e) { AppLogService.error(e.getMessage(), e); } return null; }
From source file:gov.nih.nci.ncicb.tcga.dcc.datareports.dao.jdbc.ProjectCaseDashboardDAOImpl.java
protected String processOverallProgress(final ProjectCase pc) { final int targetCase = Integer.parseInt(pc.getProjectedCaseBCR()); int totalColumns = requiredMethodNames.size(); double totalRatio = 0; String overallRatio = ""; try {// www .j a v a 2 s . co m for (final Method method : projectCaseClassMethods) { if (requiredMethodNames.contains(method.getName())) { final String result = (String) method.invoke(pc); if (NA.equals(result)) { totalColumns--; } else { totalRatio += getRatio(result); } } } totalRatio = totalRatio / totalColumns; overallRatio = Math.round(totalRatio * targetCase) + "/" + targetCase; } catch (IllegalAccessException ie) { logger.error(ie.getMessage(), ie); } catch (InvocationTargetException ive) { logger.error(ive.getMessage(), ive); } return overallRatio; }
From source file:org.fao.fenix.wds.web.rest.faostat.FAOSTATBulkDownloadsRESTService.java
@GET @Produces(MediaType.APPLICATION_JSON)/*from ww w . j a va 2s . c o m*/ @Path("{datasource}/{domainCode}/{language}") public Response getDomains(@PathParam("datasource") final String datasource, @PathParam("domainCode") final String domainCode, @PathParam("language") final String language) { // Initiate the stream StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream os) throws IOException, WebApplicationException { // Initiate utilities Writer writer = new BufferedWriter(new OutputStreamWriter(os)); Gson g = new Gson(); // compute result DatasourceBean db = datasourcePool.getDatasource(datasource.toUpperCase()); SQLBean sql = SQLBeansRepository.getBulkDownloads(language, domainCode); JDBCIterable it = new JDBCIterable(); try { // Query DB it.query(db, Bean2SQL.convert(sql).toString()); } catch (IllegalAccessException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (InstantiationException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (SQLException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (ClassNotFoundException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (Exception e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } // write the result of the query writer.write("["); while (it.hasNext()) { writer.write(g.toJson(it.next())); if (it.hasNext()) writer.write(","); } writer.write("]"); // Convert and write the output on the stream writer.flush(); } }; /* Stream result */ return Response.status(200).entity(stream).build(); }
From source file:org.fao.fenix.wds.web.rest.faostat.FAOSTATDomainsRESTService.java
@GET @Produces(MediaType.APPLICATION_JSON)/*from w w w .j ava 2 s . c o m*/ @Path("{datasource}/{groupCode}/{language}") public Response getDomains(@PathParam("datasource") final String datasource, @PathParam("groupCode") final String groupCode, @PathParam("language") final String language) { // Initiate the stream StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream os) throws IOException, WebApplicationException { // Initiate utilities Writer writer = new BufferedWriter(new OutputStreamWriter(os)); Gson g = new Gson(); // compute result DatasourceBean db = datasourcePool.getDatasource(datasource.toUpperCase()); SQLBean sql = SQLBeansRepository.getDomains(language, groupCode); JDBCIterable it = new JDBCIterable(); try { // Query DB it.query(db, Bean2SQL.convert(sql).toString()); } catch (IllegalAccessException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (InstantiationException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (SQLException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (ClassNotFoundException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (Exception e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } // write the result of the query writer.write("["); while (it.hasNext()) { writer.write(g.toJson(it.next())); if (it.hasNext()) writer.write(","); } writer.write("]"); // Convert and write the output on the stream writer.flush(); } }; /* Stream result */ return Response.status(200).entity(stream).build(); }
From source file:org.fao.fenix.wds.web.rest.faostat.FAOSTATGroupsRESTService.java
@GET @Produces(MediaType.APPLICATION_JSON)/* w w w . j a va 2s .co m*/ @Path("{datasource}/{language}") public Response getGroups(@PathParam("datasource") final String datasource, @PathParam("language") final String language) { // Initiate the stream StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream os) throws IOException, WebApplicationException { // Initiate utilities Writer writer = new BufferedWriter(new OutputStreamWriter(os)); Gson g = new Gson(); // compute result DatasourceBean db = datasourcePool.getDatasource(datasource.toUpperCase()); SQLBean sql = SQLBeansRepository.getGroups(language); JDBCIterable it = new JDBCIterable(); try { // Query DB it.query(db, Bean2SQL.convert(sql).toString()); } catch (IllegalAccessException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (InstantiationException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (SQLException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (ClassNotFoundException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (Exception e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } // write the result of the query writer.write("["); while (it.hasNext()) { writer.write(g.toJson(it.next())); if (it.hasNext()) writer.write(","); } writer.write("]"); // Convert and write the output on the stream writer.flush(); } }; /* Stream result */ return Response.status(200).entity(stream).build(); }
From source file:org.fao.fenix.wds.web.rest.faostat.FAOSTATGroupsAndDomainsRESTService.java
@GET @Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8") @Path("{datasource}/{language}") public Response getGroupsAndDomains(@PathParam("datasource") final String datasource, @PathParam("language") final String language) { // Initiate the stream StreamingOutput stream = new StreamingOutput() { @Override/*from www . j a v a 2s . co m*/ public void write(OutputStream os) throws IOException, WebApplicationException { // Initiate utilities Writer writer = new BufferedWriter(new OutputStreamWriter(os)); Gson g = new Gson(); // compute result DatasourceBean db = datasourcePool.getDatasource(datasource.toUpperCase()); JDBCIterable it = new JDBCIterable(); try { // Query DB it.query(db, buildSQL(datasource, language)); } catch (IllegalAccessException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (InstantiationException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (SQLException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (ClassNotFoundException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } catch (Exception e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } // write the result of the query writer.write("["); while (it.hasNext()) { writer.write(g.toJson(it.next())); if (it.hasNext()) writer.write(","); } writer.write("]"); // Convert and write the output on the stream writer.flush(); } }; /* Stream result */ return Response.status(200).entity(stream).build(); }
From source file:org.fao.fenix.wds.web.rest.faostat.GeoConverter.java
@GET @Produces(MediaType.APPLICATION_JSON)//from w w w .j ava2s . c o m @Path("/{systemFrom}/{systemTo}/{code}") public Response convertCode(@PathParam("systemFrom") final String systemFrom, @PathParam("systemTo") final String systemTo, @PathParam("code") final String code) { // Initiate the stream StreamingOutput stream = new StreamingOutput() { @Override public void write(OutputStream os) throws IOException, WebApplicationException { // Initiate utilities Writer writer = new BufferedWriter(new OutputStreamWriter(os)); Gson g = new Gson(); // compute result DatasourceBean db = datasourcePool.getDatasource(DATASOURCE.FENIX.name()); JDBCIterable it = new JDBCIterable(); try { // Query DB it.query(db, buildSQL(systemFrom, systemTo, code)); } catch (IllegalAccessException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'convertCode' thrown an error: " + e.getMessage())); } catch (InstantiationException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'convertCode' thrown an error: " + e.getMessage())); } catch (SQLException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'convertCode' thrown an error: " + e.getMessage())); } catch (ClassNotFoundException e) { WDSExceptionStreamWriter.streamException(os, ("Method 'convertCode' thrown an error: " + e.getMessage())); } catch (Exception e) { WDSExceptionStreamWriter.streamException(os, ("Method 'getDomains' thrown an error: " + e.getMessage())); } // write the result of the query writer.write("["); while (it.hasNext()) { writer.write(g.toJson(it.next())); if (it.hasNext()) writer.write(","); } writer.write("]"); // Convert and write the output on the stream writer.flush(); } }; /* Stream result */ return Response.status(200).entity(stream).build(); }
From source file:service.ExcelWorkSheetHandler.java
private T getInstance() { try {//w w w . ja va 2 s .c o m return type.newInstance(); } catch (InstantiationException ie) { LOG.error(ie.getMessage()); } catch (IllegalAccessException iae) { LOG.error(iae.getMessage()); } catch (Exception ex) { return null; } return null; }