close entitymanager on fail

This commit is contained in:
Peter Hormanns 2019-06-12 17:45:14 +02:00
parent f2d9c3b4a8
commit bf4e9daaee

View File

@ -39,6 +39,7 @@ public class JsonPillarServlet extends HttpServlet {
if (hiveFqdn != null && hiveFqdn.length() == 19 && hiveFqdn.endsWith(".hostsharing.net") && hiveFqdn.startsWith("h")) {
hiveName = hiveFqdn.substring(0, 3);
} else {
em.close();
throw new ServletException("error in hive parameter");
}
final Query hiveQuery = em.createQuery("SELECT h FROM Hives h WHERE h.name = :hive");