/** * @param message localized text */ public FSException(String message) { super(message); Exceptions.attachLocalizedMessage(this, message); }
/** Annotates the exception with a message. */ public static void annotate(Throwable ex, String msg) { Exceptions.attachLocalizedMessage(ex, msg); }
Exceptions.attachLocalizedMessage(ex, "Cannot createClone for " + this); // NOI18N
Exceptions.attachLocalizedMessage(ex, NbBundle.getMessage(MultiFileObject.class, "EXC_FisRO", name, fs.getDisplayName())); throw ex;
Exceptions.attachLocalizedMessage(ex, "Cannot createClone for " + this); // NOI18N
Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(HtmlBrowser.class, "EXC_Module"));
/** Notifies an exception to error manager or prints its it to stderr. * @param ex exception to notify */ static void notify(Throwable ex) { Throwable d = doNotNotify; doNotNotify = null; if (d == ex) { return; } if( ex instanceof PropertyVetoException ) Exceptions.attachLocalizedMessage(ex, ex.getLocalizedMessage()); Exceptions.printStackTrace(ex); }
public void run() { Exceptions.attachLocalizedMessage(tmp, NbBundle.getMessage(CloneableEditorSupport.class, "EXC_LoadDocument", messageName())); Exceptions.printStackTrace(tmp); } });
private static void notifyProblem(Exception e, String key) { String msg = NbBundle.getMessage(CloneableEditorSupport.class, key, e.getLocalizedMessage()); Exceptions.attachLocalizedMessage(e, msg); DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor.Exception(e)); }
/** Called to store current property value into XML subtree. The property value should be set using the * setValue method prior to calling this method. * @param doc The XML document to store the XML in - should be used for creating nodes only * @return the XML DOM element representing a subtree of XML from which the value should be loaded */ public org.w3c.dom.Node storeToXML(org.w3c.dom.Document doc) { if (font == null) { IllegalArgumentException iae = new IllegalArgumentException(); Exceptions.attachLocalizedMessage(iae, NbBundle.getMessage(FontEditor.class, "MSG_FontIsNotInitialized")); // NOI18N Exceptions.printStackTrace(iae); return null; } org.w3c.dom.Element el = doc.createElement (XML_FONT); el.setAttribute (ATTR_NAME, font.getName ()); el.setAttribute (ATTR_STYLE, Integer.toString (font.getStyle ())); el.setAttribute (ATTR_SIZE, Integer.toString (font.getSize ())); return el; }
private void checkEjbJarXmlJ2eeVersion(FileObject ejbJarXml) { try { BigDecimal version = getEjbJarXmlVersion(ejbJarXml); xmlVersion = version; if (version == null) { return; } if(new BigDecimal(org.netbeans.modules.j2ee.dd.api.ejb.EjbJar.VERSION_2_1).equals(version)) { j2eeSpecComboBox.setSelectedItem(new ProfileItem(Profile.J2EE_14)); } } catch (IOException e) { String message = NbBundle.getMessage(ProjectServerPanel.class, "MSG_EjbJarXmlCorrupted"); // NOI18N Exceptions.printStackTrace(Exceptions.attachLocalizedMessage(e, message)); } }
public String get(Object _k) { if (!(_k instanceof String)) { return null; } String k = (String) _k; Attributes.Name an; try { an = new Attributes.Name(k); } catch (IllegalArgumentException iae) { // Robustness, and workaround for reported MRJ locale bug: Exceptions.attachLocalizedMessage(iae, getMessage(NbBundle.class, "EXC_bad_attributes_name", k, Locale.getDefault().toString()) ); Exceptions.printStackTrace(iae); return null; } return attrs.getValue(an); } }
@Override public void run(Context actionContext) { String msg = NbBundle.getMessage(DatasourceUIHelper.class, "MSG_creatingDS"); actionContext.progress(msg); try { ds[0] = provider.createDatasource(jndiName, url, username, password, driverClassName); } catch (DatasourceAlreadyExistsException daee) { // it should not occur bcs it should be already handled in DatasourceCustomizer StringBuilder sb = new StringBuilder(); for (Object conflict : daee.getDatasources()) { sb.append(conflict.toString() + "\n"); // NOI18N } String message = NbBundle.getMessage(DatasourceUIHelper.class, "ERR_DsConflict", sb.toString()); Logger.getLogger("global").log(Level.INFO, message, Exceptions.attachLocalizedMessage(daee, message)); } catch (ConfigurationException ce) { // TODO: provide a feedback to the user } }
/** Processes <code>Throwable</code> thrown from <code>setAsText</code> * or <code>setValue</code> call on <code>editor</code>. Helper method. */ private static void processThrowable(Throwable throwable, String title, Object newValue) { //Copied from old PropertyPanel impl if (throwable instanceof ThreadDeath) { throw (ThreadDeath) throwable; } String locMsg = Exceptions.findLocalizedMessage(throwable); if (locMsg != null && (throwable.getLocalizedMessage() != throwable.getMessage())) { //XXX See issue 34569 String msg = NbBundle.getMessage( PropUtils.class, "FMT_ErrorSettingProperty", newValue, title); //NOI18N Exceptions.attachLocalizedMessage(throwable, msg); } else if (throwable instanceof NumberFormatException) { //Handle NFE's from the core sun.beans property editors w/o raising stack traces Exceptions.attachLocalizedMessage(throwable, NbBundle.getMessage(PropUtils.class, "FMT_BAD_NUMBER_FORMAT", newValue)); } String msg = Exceptions.findLocalizedMessage(throwable); if( null == msg || msg.isEmpty() ) { msg = throwable.getMessage(); } NotifyDescriptor d = new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE); DialogDisplayer.getDefault().notifyLater(d); }
private void checkACXmlJ2eeVersion(FileObject appClientXML) { try { BigDecimal version = getACXmlVersion(appClientXML); if (version == null) { return; } if(new BigDecimal(org.netbeans.modules.j2ee.dd.api.client.AppClient.VERSION_1_4).equals(version)) { j2eeSpecComboBox.setSelectedItem(new ProfileItem(Profile.J2EE_14)); } else if(new BigDecimal(org.netbeans.modules.j2ee.dd.api.client.AppClient.VERSION_5_0).equals(version)) { j2eeSpecComboBox.setSelectedItem(new ProfileItem(Profile.JAVA_EE_5)); } else if(new BigDecimal(org.netbeans.modules.j2ee.dd.api.client.AppClient.VERSION_6_0).equals(version)) { j2eeSpecComboBox.setSelectedItem(new ProfileItem(Profile.JAVA_EE_6_FULL)); } } catch (IOException e) { String message = NbBundle.getMessage(ProjectServerPanel.class, "MSG_AppClientXmlCorrupted"); // NOI18N Exceptions.printStackTrace(Exceptions.attachLocalizedMessage(e, message)); } }
public static void annotateUser( Throwable t, String msg, String locMsg, Throwable stackTrace, Date date ) { AnnException ex = AnnException.findOrCreate(t, true); LogRecord rec = new LogRecord(OwnLevel.USER, msg); if (stackTrace != null) { rec.setThrown(stackTrace); } ex.addRecord(rec); if (locMsg != null) { Exceptions.attachLocalizedMessage(t, locMsg); } } private static final class OwnLevel extends Level {
@Override public void doDelete(File file) throws IOException { // XXX runnig hg rm for each particular file when removing a whole firectory might no be neccessery: // just delete it via file.delete and call, group the files in afterDelete and schedule a delete // fo the parent or for a bunch of files at once. Mercurial.LOG.log(Level.FINE, "doDelete {0}", file); if (file == null) return; File root = hg.getRepositoryRoot(file); Utils.deleteRecursively(file); if (file.exists()) { IOException ex = new IOException(); Exceptions.attachLocalizedMessage(ex, NbBundle.getMessage(MercurialInterceptor.class, "MSG_DeleteFailed", new Object[] { file })); //NOI18N throw ex; } try { HgCommand.doRemove(root, file, null); } catch (HgException ex) { Mercurial.LOG.log(Level.FINE, "doDelete(): File: {0} {1}", new Object[] {file.getAbsolutePath(), ex.toString()}); // NOI18N } }
/** Tries to save given data object using its save cookie. * Notifies user if excetions appear. */ private void save (Savable sc) { try { if (sc != null) { sc.save(); } // only remove the object if the save succeeded listModel.removeElement(sc); } catch (java.io.IOException exc) { Throwable t = exc; if (Exceptions.findLocalizedMessage(exc) == null) { t = Exceptions.attachLocalizedMessage(exc, NbBundle.getBundle(ExitDialog.class).getString("EXC_Save")); } Exceptions.printStackTrace(t); } }
@Override public void setProperty(String propname, String value) throws IllegalStateException { try { String oldValue = getProperty(propname); if (InstanceProperties.PASSWORD_ATTR.equals(propname)) { ServerRegistry.savePassword(url, value, NbBundle.getMessage(DefaultInstancePropertiesImpl.class, "MSG_KeyringDefaultDisplayName")); getFileObject().setAttribute(propname, null); } else { getFileObject().setAttribute(propname, value); } firePropertyChange(new PropertyChangeEvent(this, propname, oldValue, value)); } catch (IOException ioe) { String message = NbBundle.getMessage(DefaultInstancePropertiesImpl.class, "MSG_InstanceNotExists", url); throw new IllegalStateException(Exceptions.attachLocalizedMessage(ioe, message)); } }
private Task parseObject(int priority) { //reset the state so the next parsing will run normally parsingTaskCancelled = false; //debug #49300: print out current stacktrace when the editor support is not initialized yet if(!wasAnEditorPaneChangeEvent) Exceptions.attachLocalizedMessage(new IllegalStateException(), "The TagLibParseSupport.parseObject() is called before editor support is created!"); //NOI18N synchronized (parseResultLock) { RequestProcessor.Task t = parsingTask; if (t != null) { t.setPriority(Math.max(t.getPriority(), priority)); return t; } setParserStarted(); setDocumentDirty(false); t = REQUEST_PROCESSOR.post(new ParsingRunnable(), 0, priority); parsingTask = t; return parsingTask; } }