List of usage examples for java.lang RuntimeException getLocalizedMessage
public String getLocalizedMessage()
From source file:es.urjc.mctwp.image.management.ImagePluginManager.java
/** * Writes into outputDir a DICOM representation of the Image * //from w w w . j a v a 2 s . c om * @param image * @param outputDir * @return List<File> * @throws ImageException */ public List<File> obtainDICOM(Image image, File outputDir) throws ImageException { List<File> result = null; List<ImagePlugin> lstPlugins = getPlugins(image); if (lstPlugins != null) for (ImagePlugin plugin : lstPlugins) { try { result = plugin.toDicom(image, outputDir); if (result != null) break; } catch (RuntimeException re) { logger.error(re.getLocalizedMessage()); re.printStackTrace(); } } return result; }
From source file:es.urjc.mctwp.image.management.ImagePluginManager.java
/** * Builds an image from a file//from w w w. j av a2 s .c o m * * @param file * file that represent the image * @return null if there is no creator for this file * @throws ImageException */ public PatientInfo obtainPatientStudyInfo(Image image) throws ImageException { PatientInfo result = null; List<ImagePlugin> lstPlugins = getPlugins(image); if (lstPlugins != null) for (ImagePlugin plugin : lstPlugins) { try { result = plugin.getPatientInfo(image); if (result != null) break; } catch (RuntimeException re) { logger.error(re.getLocalizedMessage()); re.printStackTrace(); } } return result; }
From source file:es.urjc.mctwp.image.management.ImagePluginManager.java
/** * Obtain a thumbnail from an image//w w w. ja va 2 s.co m * * @param image * @return thumbnail * @throws ImageException */ public ThumbNail obtainThumb(Image image) throws ImageException { ThumbNail result = null; List<ImagePlugin> lstPlugins = getPlugins(image); if (lstPlugins != null) for (ImagePlugin plugin : lstPlugins) { try { File thumb = plugin.toPng(image); if (thumb != null) { result = new ThumbNail(); result.setContent(thumb); result.setId(image.getId()); PatientInfo info = plugin.getPatientInfo(image); if (info != null) result.setPatInfo(info); break; } } catch (RuntimeException re) { logger.error(re.getLocalizedMessage()); re.printStackTrace(); } } return result; }
From source file:com.thalesgroup.hudson.plugins.klocwork.KloSource.java
private void initializeContent() { InputStream is = null;/*from w ww .j av a 2 s. co m*/ try { File tempFile = new File(kloWorkspaceFile.getTempName(owner)); if (tempFile.exists()) { is = new FileInputStream(tempFile); } else { if (kloWorkspaceFile.getFileName() == null) { throw new IOException("The file doesn't exist."); } File file = new File(kloWorkspaceFile.getFileName()); if (!file.exists()) { throw new IOException("Can't access the file: " + file.toURI()); } is = new FileInputStream(file); } splitSourceFile(highlightSource(is)); } catch (IOException exception) { sourceCode = "Can't read file: " + exception.getLocalizedMessage(); } catch (RuntimeException re) { sourceCode = "Problem for display the source code content: " + re.getLocalizedMessage(); } finally { IOUtils.closeQuietly(is); } }
From source file:com.amazonaws.mobileconnectors.pinpoint.PinpointManager.java
/** * Constructor./* w ww . j av a 2 s. c om*/ * * @param config {@link PinpointConfiguration} object. */ public PinpointManager(final PinpointConfiguration config) { try { Preconditions.checkNotNull(config, "The config provided must not be null"); final AWSCredentialsProvider credentialsProvider = config.getCredentialsProvider(); final Context appContext = config.getAppContext(); final String appId = config.getAppId(); final Regions region = config.getRegion(); final PinpointCallback<PinpointManager> initCompletionCallback = config.getInitCompletionCallback(); Preconditions.checkNotNull(credentialsProvider, "The credentialsProvider provided must not be null"); Preconditions.checkNotNull(appContext, "The application pinpointContext provided must not be null"); Preconditions.checkNotNull(appId, "The app ID specified must not be null"); final AmazonPinpointAnalyticsClient analyticsServiceClient = new AmazonPinpointAnalyticsClient( credentialsProvider, config.getClientConfiguration()); final AmazonPinpointClient targetingServiceClient = new AmazonPinpointClient(credentialsProvider, config.getClientConfiguration()); INTERNET_PERMISSION_VALIDATOR.validate(appContext); ACCESS_NETWORK_STATE_PERMISSION_VALIDATOR.validate(appContext); ENCODING_VALIDATOR.validate(); this.pinpointContext = new PinpointContext(analyticsServiceClient, targetingServiceClient, appContext, appId, SDL_INFO, config); this.notificationClient = new NotificationClient(this.pinpointContext); this.pinpointContext.setNotificationClient(this.notificationClient); PinpointNotificationReceiver.setNotificationClient(this.notificationClient); if (config.getEnableEvents()) { this.analyticsClient = new AnalyticsClient(this.pinpointContext); this.pinpointContext.setAnalyticsClient(this.analyticsClient); this.sessionClient = new SessionClient(this.pinpointContext); this.pinpointContext.setSessionClient(this.sessionClient); } else { this.analyticsClient = null; this.sessionClient = null; } if (config.getEnableTargeting()) { this.targetingClient = new TargetingClient(pinpointContext); this.pinpointContext.setTargetingClient(this.targetingClient); this.notificationClient.addGCMTokenRegisteredHandler(new GCMTokenRegisteredHandler() { @Override public void tokenRegistered(String deviceToken) { PinpointManager.this.targetingClient.updateEndpointProfile(); } }); } else { this.targetingClient = null; } if (initCompletionCallback != null) { initCompletionCallback.onComplete(this); } log.debug(String.format("Pinpoint SDK(%s) initialization successfully completed", SDK_VERSION)); } catch (final RuntimeException e) { log.debug("Cannot initialize Pinpoint SDK", e); throw new AmazonClientException(e.getLocalizedMessage()); } }
From source file:com.ibm.mobilefirstplatform.clientsdk.android.core.internal.ResponseImpl.java
@Override public String toString() { try {//from w ww . j ava2s . c o m return "Response: Status=" + getStatus() + ", Response Text: " + getResponseText(); } catch (RuntimeException e) { return "Response: Status=" + getStatus() + ", Exception occurred when constructing response text string: " + e.getLocalizedMessage(); } }
From source file:org.kalypso.model.wspm.tuhh.ui.chart.layers.PointMarkerLayer.java
@Override protected String getTooltipInfo(final IProfileRecord point) { final Double width = point.getBreite(); try {//from w w w. j a v a 2 s . c om final IComponent domainComponent = getDomainComponent(); final IComponent targetComponent = getTargetComponent(); final String header = targetComponent.getName(); final TooltipFormatter formatter = new TooltipFormatter(header, new String[] { "%s", "%,.2f", "%s" }, //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ new int[] { SWT.LEFT, SWT.RIGHT, SWT.LEFT }); final String domainUnit = ComponentUtilities.getComponentUnitLabel(domainComponent); //$NON-NLS-1$ formatter.addLine(domainComponent.getName(), width, domainUnit); return formatter.format(); } catch (final RuntimeException e) { return e.getLocalizedMessage(); } }
From source file:com.thalesgroup.hudson.plugins.cppcheck.CppcheckSource.java
/** * Builds the file content./* ww w. j av a2 s .c om*/ */ private void buildFileContent() { InputStream is = null; try { File tempFile = new File(cppcheckWorkspaceFile.getTempName(owner)); if (tempFile.exists()) { is = new FileInputStream(tempFile); } else { // Reading real workspace file is more incorrect than correct, // but the code is left here for backward compatibility with // plugin version 1.14 and less if (cppcheckWorkspaceFile.getFileName() == null) { throw new IOException("The file doesn't exist."); } File file = new File(cppcheckWorkspaceFile.getFileName()); if (!file.exists()) { throw new IOException("Can't access the file: " + file.toURI()); } is = new FileInputStream(file); } splitSourceFile(highlightSource(is)); } catch (IOException exception) { sourceCode = "Can't read file: " + exception.getLocalizedMessage(); } catch (RuntimeException re) { sourceCode = "Problem for display the source code content: " + re.getLocalizedMessage(); } finally { IOUtils.closeQuietly(is); } }
From source file:org.jenkinsci.plugins.autozoil.AutozoilSource.java
/** * Builds the file content./*from www . ja v a2s .c om*/ */ private void buildFileContent() { InputStream is = null; try { File tempFile = new File(autozoilWorkspaceFile.getTempName(owner)); if (tempFile.exists()) { is = new FileInputStream(tempFile); } else { if (autozoilWorkspaceFile.getFileName() == null) { throw new IOException("The file doesn't exist."); } File file = new File(autozoilWorkspaceFile.getFileName()); if (!file.exists()) { throw new IOException("Can't access the file: " + file.toURI()); } is = new FileInputStream(file); } splitSourceFile(highlightSource(is)); } catch (IOException exception) { sourceCode = "Can't read file: " + exception.getLocalizedMessage(); } catch (RuntimeException re) { sourceCode = "Problem for display the source code content: " + re.getLocalizedMessage(); } finally { IOUtils.closeQuietly(is); } }
From source file:org.polymap.core.data.report.HtmlReportFactory.java
@Override public List<IReport> createReports(IReportSite site) { List<IReport> result = new ArrayList(); try {/*w ww.j a v a 2 s . c o m*/ IFolder reportsFolder = getOrCreateReportsFolder(); // get changes from the filesystem reportsFolder.refreshLocal(IFolder.DEPTH_INFINITE, null); for (IResource file : reportsFolder.members()) { if (file instanceof IFile //&& ((IFile)file).getName().startsWith( "report" ) && ((IFile) file).getName().endsWith("html")) { result.add(new HtmlReport(site, (IFile) file)); } } } // without IDE catch (RuntimeException e) { throw e; } catch (Exception e) { PolymapWorkbench.handleError(DataPlugin.PLUGIN_ID, null, e.getLocalizedMessage(), e); } return result; }