Skip to content

Commit

Permalink
JBIDE-13811 - SeamTest are failing with exception in setUp method
Browse files Browse the repository at this point in the history
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
dgolovin authored and alexeykazakov committed Mar 18, 2013
1 parent 3549943 commit e89989e
Showing 1 changed file with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit e89989e

Please sign in to comment.