List of usage examples for java.lang IllegalArgumentException getLocalizedMessage
public String getLocalizedMessage()
From source file:com.microsoft.tfs.client.common.ui.controls.generic.html.HTMLEditor.java
private void openLink(final String urlString) { Check.notNull(urlString, "urlString"); //$NON-NLS-1$ // TODO handle proprietary TFS link types here try {//from w w w .ja v a2s . c o m final URI uri = URIUtils.newURI(urlString); BrowserFacade.launchURL(uri, null); } catch (final IllegalArgumentException e) { log.error("Could not parse " + urlString, e); //$NON-NLS-1$ MessageBoxHelpers.errorMessageBox(getShell(), Messages.getString("HTMLEditor.ErrorOpeningLink"), //$NON-NLS-1$ MessageFormat.format(Messages.getString("HTMLEditor.LinkCouldNotBeParsedAsURLFormat"), //$NON-NLS-1$ urlString, e.getLocalizedMessage())); return; } }
From source file:org.eclipse.collections.impl.test.Verify.java
/** * @deprecated since 8.2.0 as will not work with Java 9 *//* w w w . j a va2 s . c o m*/ @Deprecated public static void assertShallowClone(String itemName, Cloneable object) { try { Method method = Object.class.getDeclaredMethod("clone", (Class<?>[]) null); method.setAccessible(true); Object clone = method.invoke(object); String prefix = itemName + " and its clone"; Assert.assertNotSame(prefix, object, clone); Verify.assertEqualsAndHashCode(prefix, object, clone); } catch (IllegalArgumentException e) { throw new AssertionError(e.getLocalizedMessage()); } catch (InvocationTargetException e) { throw new AssertionError(e.getLocalizedMessage()); } catch (SecurityException e) { throw new AssertionError(e.getLocalizedMessage()); } catch (NoSuchMethodException e) { throw new AssertionError(e.getLocalizedMessage()); } catch (IllegalAccessException e) { throw new AssertionError(e.getLocalizedMessage()); } catch (AssertionError e) { Verify.throwMangledException(e); } }
From source file:paintbasico2d.VentanaPrincipal.java
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed // TODO add your handling code here: VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame()); if (vi != null) { BufferedImage imgSource = vi.getLienzo().getImage(); if (imgSource != null) { try { SobelOp so = new SobelOp(); BufferedImage imgdest = so.filter(imgSource, null); vi.getLienzo().setImage(imgdest); vi.getLienzo().repaint(); } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); }/*from w ww . j ava2 s.c o m*/ } } }
From source file:paintbasico2d.VentanaPrincipal.java
private void jSliderBrilloStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSliderBrilloStateChanged VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame()); if (vi != null) { BufferedImage ImgSource = vi.getLienzo().getImage(); if (img == null) img = ImgSource;//from w w w . java 2 s . c o m if (ImgSource != null) { try { float slider = jSliderBrillo.getValue(); RescaleOp rop = new RescaleOp(1.0F, slider, null); BufferedImage imgdest = rop.filter(this.img, null); vi.getLienzo().setImage(imgdest); vi.getLienzo().repaint(); } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); } } } }
From source file:paintbasico2d.VentanaPrincipal.java
private void UmbralColorSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_UmbralColorSliderStateChanged // TODO add your handling code here: VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame()); if (vi != null) { BufferedImage ImgSource = vi.getLienzo().getImage(); if (img == null) img = ImgSource;/* w w w.j av a2s. c om*/ if (ImgSource != null) { try { int slider = UmbralColorSlider.getValue(); UmbralizacionOp um = new UmbralizacionOp(slider); //ThresholdOp thOp= new ThresholdOp(slider); //RescaleOp(1.0F, slider, null); BufferedImage imgdest = um.filter(img, null); vi.getLienzo().setImage(imgdest); vi.getLienzo().repaint(); } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); } } } }
From source file:paintbasico2d.VentanaPrincipal.java
private void UmbralGrisSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_UmbralGrisSliderStateChanged // TODO add your handling code here: // VentanaInterna vi=(VentanaInterna) escritorio.getSelectedFrame(); // if(vi.getLienzo().getImage()!=null){ // try{ // // ThresholdOp th=new ThresholdOp(UmbralGrisSlider.getValue()); // th.filterGreyLevel(vi.getLienzo().getImage(), imgdest); // vi.getLienzo().setImage(imgdest); // vi.getLienzo().repaint(); // }catch(IllegalArgumentException e){ // System.err.println(e.getLocalizedMessage()); // } // }/* w w w . jav a2 s . co m*/ VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame()); if (vi != null) { BufferedImage ImgSource = vi.getLienzo().getImage(); if (img == null) img = ImgSource; if (ImgSource != null) { try { int slider = UmbralGrisSlider.getValue(); ThresholdOp thOp = new ThresholdOp(slider); //RescaleOp(1.0F, slider, null); BufferedImage imgdest = thOp.filterGreyLevel(img, null); vi.getLienzo().setImage(imgdest); vi.getLienzo().repaint(); } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); } } } }
From source file:paintbasico2d.VentanaPrincipal.java
private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed int index = jComboBox2.getSelectedIndex(); Kernel k;//from w w w .j ava 2 s.c o m VentanaInterna vi = (VentanaInterna) (escritorio.getSelectedFrame()); if (vi != null) { BufferedImage ImgSource = vi.getLienzo().getImage(); if (ImgSource != null) { try { switch (index) { case 0: k = KernelProducer.createKernel(KernelProducer.TYPE_MEDIA_3x3); break; case 1: k = KernelProducer.createKernel(KernelProducer.TYPE_BINOMIAL_3x3); break; case 2: k = KernelProducer.createKernel(KernelProducer.TYPE_ENFOQUE_3x3); break; case 3: k = KernelProducer.createKernel(KernelProducer.TYPE_RELIEVE_3x3); break; case 4: k = KernelProducer.createKernel(KernelProducer.TYPE_LAPLACIANA_3x3); break; default: k = null; } ConvolveOp cop = new ConvolveOp(k); BufferedImage imgdest = cop.filter(ImgSource, null); vi.getLienzo().setImage(imgdest); vi.getLienzo().repaint(); } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); } } } }
From source file:org.ejbca.core.ejb.ocsp.OcspKeyRenewalSessionBean.java
/** * //from www . ja v a 2 s .c o m * * @param signerSubjectDN signerSubjectDN subject DN of the signing key to be renewed. The string "all" will result in all keys being renewed * @param safetyMargin the number of seconds before actual expiration that a keystore should be renewed * @throws CryptoTokenOfflineException if Crypto Token is not available or connected, or key with alias does not exist. * @throws InvalidKeyException if the public key in the tokenAndChain can not be used to verify a string signed by the private key, because the key * is wrong or the signature operation fails for other reasons such as a NoSuchAlgorithmException or SignatureException. */ private synchronized void renewKeyStores(String signerSubjectDN, long safetyMargin) throws InvalidKeyException, CryptoTokenOfflineException { //Cancel all running timers cancelTimers(); try { final EjbcaWS ejbcaWS = getEjbcaWS(); if (ejbcaWS == null) { if (log.isDebugEnabled()) { log.debug( "Could not locate a suitable web service for automatic OCSP key/certificate renewal."); } return; } final X500Principal target; try { target = signerSubjectDN.trim().equalsIgnoreCase(RENEW_ALL_KEYS) ? null : new X500Principal(signerSubjectDN); } catch (IllegalArgumentException e) { log.error(intres.getLocalizedMessage("ocsp.rekey.triggered.dn.not.valid", signerSubjectDN)); return; } final StringBuffer matched = new StringBuffer(); final StringBuffer unMatched = new StringBuffer(); for (final OcspSigningCacheEntry ocspSigningCacheEntry : OcspSigningCache.INSTANCE.getEntries()) { // Only perform renewal for non CA signing key OCSP signers if (!ocspSigningCacheEntry.isUsingSeparateOcspSigningCertificate()) { continue; } final X509Certificate ocspSigningCertificate = ocspSigningCacheEntry.getOcspSigningCertificate(); final long timeLeftBeforeRenewal = ocspSigningCertificate.getNotAfter().getTime() - new Date().getTime(); if (timeLeftBeforeRenewal < (1000 * safetyMargin)) { final X500Principal src = ocspSigningCertificate.getSubjectX500Principal(); if (target != null && !src.equals(target)) { unMatched.append(" '" + src.getName() + '\''); continue; } matched.append(" '" + ocspSigningCertificate.getIssuerX500Principal().getName() + '\''); try { renewKeyStore(ejbcaWS, ocspSigningCacheEntry); } catch (KeyRenewalFailedException e) { String msg = intres.getLocalizedMessage("ocsp.rekey.failed.unknown.reason", target, e.getLocalizedMessage()); log.error(msg, e); continue; } } } if (matched.length() < 1 && target != null) { log.error(intres.getLocalizedMessage("ocsp.rekey.triggered.dn.not.existing", target.getName(), unMatched)); return; } log.info(intres.getLocalizedMessage("ocsp.rekey.triggered", matched)); } finally { //Set new timer to run, even if something breaks. addTimer(OcspConfiguration.getRekeyingUpdateTimeInSeconds()); } }
From source file:org.deegree.style.se.parser.PostgreSQLReader.java
private Pair<Graphic, Continuation<Styling<?>>> getGraphic(int id, Connection conn, Continuation<Styling<?>> contn) throws SQLException { Graphic graphic = graphics.get(id);//from w w w. j av a2s . c om if (graphic != null) { return new Pair<Graphic, Continuation<Styling<?>>>(graphic, contn); } PreparedStatement stmt = null; ResultSet rs = null; try { stmt = conn.prepareStatement( "select size, sizeexpr, rotation, rotationexpr, anchorx, anchory, displacementx, displacementy, wellknownname, svg, base64raster, fill_id, stroke_id from " + schema + ".graphics where id = ?"); stmt.setInt(1, id); rs = stmt.executeQuery(); if (rs.next()) { Graphic res = new Graphic(); Double size = (Double) rs.getObject("size"); if (size != null) { res.size = size; } String sizeExpr = (String) rs.getObject("sizeexpr"); if (sizeExpr != null) { contn = getContn(sizeExpr, contn, new Updater<Styling<?>>() { @Override public void update(Styling<?> obj, String val) { ((PointStyling) obj).graphic.size = Double.parseDouble(val); } }); } Double rotation = (Double) rs.getObject("rotation"); if (rotation != null) { res.rotation = rotation; } String rotationExpr = (String) rs.getObject("rotationexpr"); if (rotationExpr != null) { contn = getContn(rotationExpr, contn, new Updater<Styling<?>>() { @Override public void update(Styling<?> obj, String val) { ((PointStyling) obj).graphic.rotation = Double.parseDouble(val); } }); } Double ax = (Double) rs.getObject("anchorx"); if (ax != null) { res.anchorPointX = ax; } Double ay = (Double) rs.getObject("anchory"); if (ay != null) { res.anchorPointY = ay; } Double dx = (Double) rs.getObject("displacementx"); if (dx != null) { res.displacementX = dx; } Double dy = (Double) rs.getObject("displacementy"); if (dy != null) { res.displacementY = dy; } String wkn = rs.getString("wellknownname"); if (wkn != null) { try { res.mark.wellKnown = SimpleMark.valueOf(wkn.toUpperCase()); } catch (IllegalArgumentException e) { LOG.debug("Found unknown 'well known name' '{}' for the symbol with " + "id '{}' in the database, using square instead.", wkn, id); res.mark.wellKnown = SQUARE; } } String svg = rs.getString("svg"); if (svg != null) { try { res.mark.shape = getShapeFromSvg(new ByteArrayInputStream(svg.getBytes("UTF-8")), null); } catch (UnsupportedEncodingException e) { LOG.trace("Stack trace:", e); } } String base64raster = rs.getString("base64raster"); if (base64raster != null) { ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decodeBase64(base64raster)); try { res.image = ImageIO.read(bis); } catch (IOException e) { LOG.debug( "A base64 encoded image could not be read from the database," + " for the symbol with id '{}', error was '{}'.", id, e.getLocalizedMessage()); LOG.trace("Stack trace:", e); } } Integer fill = (Integer) rs.getObject("fill_id"); if (fill != null) { res.mark.fill = getFill(fill, conn); } Integer stroke = (Integer) rs.getObject("stroke_id"); if (stroke != null) { Pair<Stroke, Continuation<Styling<?>>> p = getStroke(stroke, conn, contn); res.mark.stroke = p.first; contn = p.second; } graphics.put(id, res); return new Pair<Graphic, Continuation<Styling<?>>>(res, contn); } return null; } finally { if (rs != null) { rs.close(); } if (stmt != null) { stmt.close(); } } }
From source file:com.hybris.mobile.lib.commerce.service.OCCServiceHelper.java
/** * Delete all the catalog data of the content provider *//* ww w . j a v a2s.c o m*/ protected void deleteCatalogData() { try { mContext.getContentResolver() .delete(CatalogContract.Provider.getUriData(mConfiguration.getCatalogAuthority()), null, null); mContext.getContentResolver().delete( CatalogContract.Provider.getUriDataDetails(mConfiguration.getCatalogAuthority()), null, null); } catch (IllegalArgumentException e) { Log.i(TAG, "Unable to delete catalog data. Details: " + e.getLocalizedMessage()); } }