List of usage examples for java.lang ClassNotFoundException getLocalizedMessage
public String getLocalizedMessage()
From source file:org.apache.openaz.xacml.admin.view.components.SQLPIPConfigurationComponent.java
protected void testJDBCConnection() { try {/*from w ww .jav a 2 s .c om*/ if (this.comboBoxSQLDriver.getValue() != null) { Class.forName(this.comboBoxSQLDriver.getValue().toString()); } else { throw new ClassNotFoundException("Please select a JDBC driver to load."); } } catch (ClassNotFoundException e) { logger.error(e); new Notification("Driver Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Is the JDBC driver's jar in the J2EE container path?", Type.ERROR_MESSAGE, true).show(Page.getCurrent()); return; } Connection connection = null; try { connection = DriverManager.getConnection(this.textFieldConnectionURL.getValue(), this.textFieldUser.getValue(), this.textFieldPassword.getValue()); new Notification("Success!", "Connection Established!", Type.HUMANIZED_MESSAGE, true) .show(Page.getCurrent()); } catch (SQLException e) { logger.error(e); new Notification("SQL Exception", "<br/>" + e.getLocalizedMessage() + "<br/>Are the configuration parameters correct?", Type.ERROR_MESSAGE, true).show(Page.getCurrent()); } finally { if (connection != null) { try { connection.close(); } catch (SQLException idontcare) { //NOPMD } } } }
From source file:de.burlov.amazon.s3.dirsync.DirSync.java
private Object downloadObject(String s3key, byte[] encKey) throws IOException { InputStream in = downloadData(s3key); if (in == null) { return null; }//from ww w . ja v a2 s . c om CountingInputStream cin = new CountingInputStream( new InflaterInputStream(new CryptInputStream(in, cipher, encKey))); ObjectInputStream oin = new ObjectInputStream(cin); try { Object o = oin.readObject(); transferredData += cin.getByteCount(); return o; } catch (ClassNotFoundException e) { /* * sollte eigentlich nie vorkommen */ throw new IOException(e.getLocalizedMessage()); } finally { IOUtils.closeQuietly(in); } }
From source file:org.apache.jmeter.JMeter.java
/** * *///from w ww.jav a 2s . co m private void startOptionalServers() { int bshport = JMeterUtils.getPropDefault("beanshell.server.port", 0);// $NON-NLS-1$ String bshfile = JMeterUtils.getPropDefault("beanshell.server.file", "");// $NON-NLS-1$ $NON-NLS-2$ if (bshport > 0) { log.info("Starting Beanshell server (" + bshport + "," + bshfile + ")"); Runnable t = new BeanShellServer(bshport, bshfile); t.run(); } // Should we run a beanshell script on startup? String bshinit = JMeterUtils.getProperty("beanshell.init.file");// $NON-NLS-1$ if (bshinit != null) { log.info("Run Beanshell on file: " + bshinit); try { BeanShellInterpreter bsi = new BeanShellInterpreter(); bsi.source(bshinit); } catch (ClassNotFoundException e) { log.warn("Could not start Beanshell: " + e.getLocalizedMessage()); } catch (JMeterException e) { log.warn("Could not process Beanshell file: " + e.getLocalizedMessage()); } } int mirrorPort = JMeterUtils.getPropDefault("mirror.server.port", 0);// $NON-NLS-1$ if (mirrorPort > 0) { log.info("Starting Mirror server (" + mirrorPort + ")"); try { Object instance = ClassTools.construct("org.apache.jmeter.protocol.http.control.HttpMirrorControl", // $NON-NLS-1$ mirrorPort); ClassTools.invoke(instance, "startHttpMirror"); } catch (JMeterException e) { log.warn("Could not start Mirror server", e); } } }
From source file:org.opencms.workplace.CmsWorkplaceManager.java
/** * Returns the object used for translating group names.<p> * /*from w ww . j av a 2s. c o m*/ * @return the group name translator */ public I_CmsGroupNameTranslation getGroupNameTranslation() { if (m_groupNameTranslation != null) { return m_groupNameTranslation; } if (m_groupTranslationClass != null) { try { m_groupNameTranslation = (I_CmsGroupNameTranslation) Class.forName(m_groupTranslationClass) .newInstance(); return m_groupNameTranslation; } catch (ClassNotFoundException e) { LOG.error(e.getLocalizedMessage(), e); } catch (IllegalAccessException e) { LOG.error(e.getLocalizedMessage(), e); } catch (InstantiationException e) { LOG.error(e.getLocalizedMessage(), e); } catch (ClassCastException e) { LOG.error(e.getLocalizedMessage(), e); } m_groupNameTranslation = getDefaultGroupNameTranslation(); return m_groupNameTranslation; } else { m_groupNameTranslation = getDefaultGroupNameTranslation(); return m_groupNameTranslation; } }
From source file:edu.uchc.octane.OctanePlugin.java
@Override public void run(String cmd) { if (!IJ.isJava16()) { IJ.error("Octane requires Java version 1.6 or higher. Please upgrade the JVM."); return;//from w w w. j a v a2 s . co m } try { Class.forName("org.apache.commons.math3.util.FastMath"); } catch (ClassNotFoundException e) { IJ.error("This version of Octane requires Apache Commons Math v3.0 or later. Please install."); return; } imp_ = WindowManager.getCurrentImage(); if (imp_ == null || imp_.getStack().getSize() < 2) { IJ.error("This only works on an opened image stack."); return; } FileInfo fi = imp_.getOriginalFileInfo(); String path; if (fi != null) { path = fi.directory; } else { IJ.error("Can't find image's disk location. You must save the data on disk first."); return; } if (dict_.containsKey(imp_)) { // window already open OctanePlugin plugin = dict_.get(imp_); if (plugin != null && cmd.equals("load")) { plugin.ctl_.getWindow().setVisible(true); return; } else { // do nothing } } if (cmd.startsWith("analyze")) { if (startImageAnalysis(cmd)) { // wasOked? SmNode[][] nodes = dlg_.processAllFrames(); if (TrackingParameters.openDialog(dlg_.pixelSize_)) { //wasOKed ? TrajDataset data = TrajDataset.createDatasetFromNodes(nodes); data.setPixelSize(dlg_.pixelSize_); ctl_ = new OctaneWindowControl(imp_); String filename = ctl_.defaultSaveFilename(); File file = new File(filename); if (file.exists()) { int idx = 1; File newFile; do { String backupName = filename + ".b" + idx; newFile = new File(backupName); idx++; } while (newFile.exists()); if (!file.renameTo(newFile)) { IJ.error("Problem renaming old dataset file"); return; } } openWindow(data); ctl_.saveDataset(); return; } } dict_.remove(imp_); } if (cmd.startsWith("calibration")) { startImageAnalysis(cmd); dict_.remove(imp_); } if (cmd.equals("load")) { assert (path != null); File file = new File(path + File.separator + imp_.getTitle() + ".dataset"); if (file.exists()) { try { ctl_ = new OctaneWindowControl(imp_); openWindow(readDataset(file)); } catch (IOException e) { IJ.error("An IO error occured reading file: " + file.getName() + "\n " + e.getLocalizedMessage()); } catch (ClassNotFoundException e) { IJ.error("Can't recognize the file format: " + file.getName() + "\n" + e.getLocalizedMessage()); } } else { IJ.error("Can't find previous analysis results." + " It needs to be saved in the same folder as your image data."); } return; } if (cmd.equals("import")) { JFileChooser fc = new JFileChooser(); if (fc.showOpenDialog(IJ.getApplet()) == JFileChooser.APPROVE_OPTION) { try { ctl_ = new OctaneWindowControl(imp_); openWindow(TrajDataset.importDatasetFromText(fc.getSelectedFile())); ctl_.saveDataset(); } catch (IOException e) { IJ.error("An IO error occured reading file: " + fc.getSelectedFile().getName()); return; } } return; } }