/** * Bug 72214: [Preferences] IAE when opening project preferences * * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=72214" */ public void testBug72214() throws CoreException, BackingStoreException { // Remove JavaCore instance prefs JavaModelManager manager = JavaModelManager.getJavaModelManager(); IEclipsePreferences preferences = manager.getInstancePreferences(); int size = JavaCore.getOptions().size(); preferences.removeNode(); // verify that JavaCore preferences have been reset assertFalse( "JavaCore preferences should have been reset", preferences == manager.getInstancePreferences()); assertEquals( "JavaCore preferences should have been resotred!", size, JavaCore.getOptions().size()); }
@Override protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { IEclipsePreferences node = getNode(req, resp, false); if (node == null) { // should not fail on delete when resource doesn't exist resp.setStatus(HttpServletResponse.SC_NO_CONTENT); return; } String key = req.getParameter("key"); try { // if a key is specified write that single value, otherwise write the entire node if (key != null) node.remove(key); else node.removeNode(); prefRoot.flush(); resp.setStatus(HttpServletResponse.SC_NO_CONTENT); } catch (Exception e) { handleException( resp, NLS.bind("Failed to retrieve preferences for path {0}", req.getPathInfo()), e); return; } }