From ad25cab4f551674b4adf932e48532c2c8fc6a0d0 Mon Sep 17 00:00:00 2001 From: Ruanito Santos <rds11@c3sl.ufpr.br> Date: Mon, 24 Jun 2013 11:13:58 -0300 Subject: [PATCH] web/app/controllers/Install.java: Add show dialog invalid inep --- web/app/controllers/Install.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/web/app/controllers/Install.java b/web/app/controllers/Install.java index f221c78..79b7350 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(); -- GitLab