allow hivename hxxx and vmxxxx in JsonPillar

This commit is contained in:
Peter Hormanns 2022-09-06 13:22:15 +02:00
parent 139ac93193
commit 40f4429922

View File

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