List of usage examples for java.lang Throwable toString
public String toString()
From source file:hsa.awp.scire.controller.ScireController.java
/** * Starts the timer if it is currently running. *///w ww . j ava 2s.c om @Override public synchronized void startTimer() { if (timerIsRunning) { throw new IllegalStateException("timer is already running."); } logger.debug("starting timer"); lastCheck = Calendar.getInstance(); lastCheck.add(Calendar.YEAR, -30); timer = new Timer(); timer.scheduleAtFixedRate(timerTaskFactory.getTask(new Runnable() { @Override public void run() { // TODO remove that one!!! SecurityContextHolder.getContext() .setAuthentication(new UsernamePasswordAuthenticationToken("admin", "password")); try { check(); } catch (Throwable e) { logger.error(e.toString(), e); } } }), 0, checkInterval); timerIsRunning = true; }
From source file:com.emc.ecs.sync.service.DbService.java
public void setStatus(final SyncObject object, final ObjectStatus status, final String error, final boolean newRow) { initCheck();//from w w w .j a v a 2 s. c o m final String dateField = getDateFieldForStatus(status); final Date dateValue = getDateValueForStatus(status); Long contentLength = null; Date mtime = null; try { contentLength = object.getMetadata().getContentLength(); mtime = object.getMetadata().getModificationTime(); } catch (Throwable t) { log.info("could not pull metadata from object {}: {}", object, t.toString()); } final Long fContentLength = contentLength; final Date fMtime = mtime; TimingUtil.time(timingPlugin, OPERATION_OBJECT_UPDATE, new Function<Void>() { @Override public Void call() { if (newRow) { String insert = SyncRecord.insert(objectsTableName, SyncRecord.SOURCE_ID, SyncRecord.TARGET_ID, SyncRecord.IS_DIRECTORY, SyncRecord.SIZE, SyncRecord.MTIME, SyncRecord.STATUS, dateField, SyncRecord.RETRY_COUNT, SyncRecord.ERROR_MESSAGE); getJdbcTemplate().update(insert, object.getSourceIdentifier(), object.getTargetIdentifier(), object.isDirectory(), fContentLength, getDateParam(fMtime), status.getValue(), getDateParam(dateValue), object.getFailureCount(), fitString(error, maxErrorSize)); } else { // don't want to overwrite last error message unless there is a new error message List<String> fields = new ArrayList<>( Arrays.asList(SyncRecord.TARGET_ID, SyncRecord.IS_DIRECTORY, SyncRecord.SIZE, SyncRecord.MTIME, SyncRecord.STATUS, dateField, SyncRecord.RETRY_COUNT)); if (error != null) fields.add(SyncRecord.ERROR_MESSAGE); String update = SyncRecord.updateBySourceId(objectsTableName, fields.toArray(new String[fields.size()])); List<Object> params = new ArrayList<>(Arrays.asList(object.getTargetIdentifier(), object.isDirectory(), fContentLength, getDateParam(fMtime), status.getValue(), getDateParam(dateValue), object.getFailureCount())); if (error != null) params.add(fitString(error, maxErrorSize)); params.add(object.getSourceIdentifier()); getJdbcTemplate().update(update, params.toArray()); } return null; } }); }
From source file:com.nesscomputing.syslog4j.impl.AbstractSyslog.java
public void backLog(SyslogLevel level, String message, Throwable reasonThrowable) { backLog(level, message, reasonThrowable != null ? reasonThrowable.toString() : "UNKNOWN"); }
From source file:it.biztech.btable.olap.OlapUtils.java
private Connection getMdxConnectionFromConnectionString(String connectStr) { Util.PropertyList properties = Util.parseConnectString(connectStr); try {/*w ww . j a va 2 s . co m*/ String dataSourceName = properties.get(RolapConnectionProperties.DataSource.name()); if (dataSourceName != null) { IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory() .get(IDBDatasourceService.class, null); DataSource dataSourceImpl = datasourceService.getDataSource(dataSourceName); if (dataSourceImpl != null) { properties.remove(RolapConnectionProperties.DataSource.name()); nativeConnection = DriverManager.getConnection(properties, null, dataSourceImpl); } else { nativeConnection = DriverManager.getConnection(properties, null); } } else { nativeConnection = DriverManager.getConnection(properties, null); } if (nativeConnection == null) { logger.error("Invalid connection: " + connectStr); } } catch (Throwable t) { logger.error("Invalid connection: " + connectStr + " - " + t.toString()); } return nativeConnection; }
From source file:com.raceup.fsae.test.TesterGui.java
/** * Shows dialog with info about unsuccessful test submission *//* www.ja va 2s .c o m*/ private void showUnSuccessfulTestSubmissionDialog() { totalTestTimer.start(); // re-start total timer String message = test.toString(); message += "\nDon't worry, be happy: this box will automatically " + "close after " + Integer.toString(SECONDS_WAIT_BETWEEN_SUBMISSIONS) + " seconds of your " + "submission.\nEnjoy."; JOptionPane opt = new JOptionPane(message, JOptionPane.WARNING_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[] {}); // no buttons final JDialog dlg = opt.createDialog("Error"); new Thread(() -> { try { Thread.sleep(SECONDS_WAIT_BETWEEN_SUBMISSIONS * 1000); dlg.dispose(); } catch (Throwable t) { System.err.println(t.toString()); } }).start(); dlg.setVisible(true); }
From source file:com.mirth.connect.plugins.directoryresource.DirectoryResourcePropertiesPanel.java
@Override public void setProperties(ResourceProperties properties) { final DirectoryResourceProperties props = (DirectoryResourceProperties) properties; directoryField.setText(props.getDirectory()); includeSubdirectoriesCheckBox.setSelected(props.isDirectoryRecursion()); descriptionTextPane.setText(props.getDescription()); final String workingId = PlatformUI.MIRTH_FRAME.startWorking("Loading libraries..."); SwingWorker<List<String>, Void> worker = new SwingWorker<List<String>, Void>() { @Override/*w ww. j a v a 2s . co m*/ public List<String> doInBackground() throws ClientException { return (List<String>) PlatformUI.MIRTH_FRAME.mirthClient .getServlet(DirectoryResourceServletInterface.class).getLibraries(props.getId()); } @Override public void done() { try { List<String> libraries = get(); if (libraries == null) { libraries = new ArrayList<String>(); } Object[][] data = new Object[libraries.size()][1]; int i = 0; for (String library : libraries) { data[i++][0] = library; } ((RefreshTableModel) libraryTable.getModel()).refreshDataVector(data); } catch (Throwable t) { if (t instanceof ExecutionException) { t = t.getCause(); } PlatformUI.MIRTH_FRAME.alertThrowable(PlatformUI.MIRTH_FRAME, t, "Error loading libraries: " + t.toString()); } finally { PlatformUI.MIRTH_FRAME.stopWorking(workingId); } } }; worker.execute(); }
From source file:jp.co.acroquest.endosnipe.common.logger.ENdoSnipeLogger.java
/** * WARN???<br />/*from w w w .j av a2 s. co m*/ * * @param throwable * @deprecated ???????????????? log() ??????? */ @Deprecated public void warn(final Throwable throwable) { this.warn(throwable.toString(), throwable); }
From source file:lia.gsi.net.GSIGssSocketFactory.java
/** * @param inetAddress ://from w w w. ja v a 2 s . c o m * the remote address * @param port : * the remote port * @param doDelegation : * if true, the client credential is delegated * @param fullDelegation : * if doDelegation is set, this parameter specifies the type of delegation (FULL or LIMITED) * @return the GSI-protected socket connected to the remote host * @throws IOException */ public java.net.Socket createSocket(java.net.InetAddress inetAddress, int port, boolean doDelegation, boolean fullDelegation) throws IOException { // raw socket Socket socket = null; try { //override the search path for the CA directory: (GSI-SSHTERM writes in the ~/.globus/certificates so we don;t use this) //1) java X509_CERT_DIR property //2) override with X509_CERT_DIR env var //3) default /etc/grid-security/certificates String x509CertDir = System.getProperty("X509_CERT_DIR"); if (x509CertDir == null) { x509CertDir = System.getenv("X509_CERT_DIR"); if (x509CertDir == null) x509CertDir = "/etc/grid-security/certificates"; System.setProperty("X509_CERT_DIR", x509CertDir); } String x509UserProxy = System.getenv("X509_USER_PROXY"); if (x509UserProxy == null) x509UserProxy = CoGProperties.getDefault().getProxyFile(); System.out.println("Trying " + x509UserProxy); GSSCredential credential = createUserCredential(x509UserProxy); if (credential == null) { throw new IOException("User credential not initialized !"); } logger.info("createSocket() user credential is " + credential.getName()); GSSManager manager = ExtendedGSSManager.getInstance(); org.globus.gsi.gssapi.auth.GSSAuthorization gssAuth = org.globus.gsi.gssapi.auth.HostAuthorization .getInstance(); GSSName targetName = gssAuth.getExpectedName(null, inetAddress.getCanonicalHostName()); ExtendedGSSContext context = (ExtendedGSSContext) manager.createContext(targetName, GSSConstants.MECH_OID, credential, GSSContext.DEFAULT_LIFETIME); context.setOption(GSSConstants.GSS_MODE, GSIConstants.MODE_GSI); context.requestCredDeleg(doDelegation); if (doDelegation) { if (fullDelegation) { context.setOption(GSSConstants.DELEGATION_TYPE, GSIConstants.DELEGATION_TYPE_FULL); } else { context.setOption(GSSConstants.DELEGATION_TYPE, GSIConstants.DELEGATION_TYPE_LIMITED); } } SocketAddress socketAddress = new InetSocketAddress(inetAddress, port); socket = new Socket(); socket.connect(socketAddress, GSI_CONNECT_TIMEOUT); GSIGssSocket gsiSocket = new GSIGssSocket(socket, context); gsiSocket.setUseClientMode(true); gsiSocket.setAuthorization(gssAuth); // Should be GSI_MODE ? gsiSocket.setWrapMode(GssSocket.SSL_MODE); gsiSocket.startHandshake(); socket = gsiSocket; } catch (Throwable e) { if (socket != null) { try { socket.close(); } catch (Exception e1) { logger.debug("Socket is already closed."); } } throw new IOException(e.toString()); } // return the wrapped socket return socket; }