Skip to content

Commit

Permalink
JBIDE-27730 : fix NPE (#323)
Browse files Browse the repository at this point in the history
* JBIDE-27730 : fix NPE

Signed-off-by: Stephane Bouchet <sbouchet@redhat.com>

* JBIDE-27730 : added more info in the log

Signed-off-by: Stephane Bouchet <sbouchet@redhat.com>
  • Loading branch information
sbouchet committed Jun 9, 2021
1 parent 741607f commit ce90afb
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -18,6 +18,8 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
Expand All @@ -37,6 +39,7 @@
import org.jboss.tools.ws.jaxrs.core.internal.utils.Logger;
import org.jboss.tools.ws.jaxrs.core.metamodel.domain.IJaxrsApplication;
import org.jboss.tools.ws.jaxrs.core.wtp.WtpUtils;
import org.jboss.tools.ws.jaxrs.ui.JBossJaxrsUIPlugin;

/**
* Utility class for JAX-RS elements creation.
Expand Down Expand Up @@ -221,10 +224,10 @@ public static IPackageFragment getProjectTopLevelPackage(final IPackageFragmentR
currentFolder = (IFolder) currentFolder.members()[0];
}
if(currentFolder != null) {
return (IPackageFragment) packageFragmentRoot.getJavaProject().findPackageFragment(currentFolder.getFullPath());
return packageFragmentRoot.getJavaProject().findPackageFragment(currentFolder.getFullPath());
}

return null;
throw new CoreException(new Status(IStatus.ERROR, JBossJaxrsUIPlugin.PLUGIN_ID, "Cannot retrieve the currentFolder for the given packageFragmentRoot("+packageFragmentRoot.getElementName()+")."));
}

/**
Expand All @@ -241,7 +244,6 @@ private static boolean hasUniqueChildFolder(final IFolder parentFolder) throws C
return true;
}
return false;

}

}

0 comments on commit ce90afb

Please sign in to comment.