Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

JBIDE-13811 - SeamTest are failing with exception in setUp method

added catch block for IllegalStateException with logging. It means
code would not fail and lets tests to be continued

fixed the npe

ss
  • Loading branch information...
commit e89989e646fc7f856a3b4938cf2b51f39a7137d4 1 parent 3549943
Denis Golovin dgolovin authored alexeykazakov committed
24 seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java
View
@@ -31,6 +31,7 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.SeamUtil;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreferenceInitializer;
@@ -225,14 +226,23 @@ private void updateProjectsForRuntime(SeamRuntime rt) {
IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < ps.length; i++) {
ISeamProject sp = SeamCorePlugin.getSeamProject(ps[i], false);
- if (sp != null && rt.getName().equals(sp.getRuntimeName())) {
- IEclipsePreferences prefs = ((SeamProject)sp).getSeamPreferences();
- prefs.remove(ISeamProject.RUNTIME_NAME);
- prefs.put(ISeamProject.RUNTIME_NAME, rt.getName());
+ if (sp != null ) {
+ String tmpName = null;
try {
- prefs.flush();
- } catch (BackingStoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
+ tmpName = sp.getRuntimeName();
+ } catch (IllegalStateException ex) {
+ // JBIDE-13811 fix to avoid IllegalStateExceptions
+ SeamCorePlugin.getDefault().logWarning(ex);
+ }
+ if(rt.getName().equals(tmpName)) {
+ IEclipsePreferences prefs = ((SeamProject)sp).getSeamPreferences();
+ prefs.remove(ISeamProject.RUNTIME_NAME);
+ prefs.put(ISeamProject.RUNTIME_NAME, rt.getName());
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.