diff --git a/web/app/controllers/Install.java b/web/app/controllers/Install.java index f221c78207f8c584367ea419ce40981956bc94bb..79b7350979bd7f1d03786d53d193dfad6f13773c 100644 --- a/web/app/controllers/Install.java +++ b/web/app/controllers/Install.java @@ -3,6 +3,8 @@ package controllers; import java.io.*; import java.util.ArrayList; +import javax.swing.JOptionPane; + import play.*; import play.mvc.*; import play.data.*; @@ -31,8 +33,11 @@ public class Install extends Controller { String proxyUser = requestData.get("proxyUser"); String proxyPass = requestData.get("proxyPass"); - if ((inep == null) || (inep.length() < 6) || (inep.length() > 12)) - return badRequest("Inep inválido"); + if ((inep == null) || (inep.length() < 6) || (inep.length() > 12)) { + Object[] options = { "OK" }; + JOptionPane.showOptionDialog(null, "Inep inválido.", "Aviso", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); + return ok(views.html.install.index.render()); + } School school = null; @@ -44,15 +49,17 @@ public class Install extends Controller { return internalServerError(); } - if (school == null) - return badRequest("Inep inválido"); - + if (school == null) { + Object[] options = { "OK" }; + JOptionPane.showOptionDialog(null, "Inep inválido.", "Aviso", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); + return ok(views.html.install.index.render()); + } // build the package String command = "sh " + MAKE_PACKAGE_BIN + " " + inep; if (useProxy) { command += " " + proxyHost + " " + proxyPort + " " + - proxyUser + " " + proxyPass; + proxyUser + " " + proxyPass; } StringBuffer sb = new StringBuffer();