try {
c.getConstructor(HttpServletRequest.class).newInstance(req).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
} catch (ReflectiveOperationException e) {
- new GigiApiException(e.getMessage()).format(resp.getWriter(), getLanguage(req));
+ new GigiApiException().format(resp.getWriter(), getLanguage(req));
}
}
package org.cacert.gigi.pages.admin.support;
import java.io.PrintWriter;
+import java.util.Arrays;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.cacert.gigi.dbObjects.Domain;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.SprintfCommand;
import org.cacert.gigi.output.template.Template;
public class FindDomainForm extends Form {
try {
d = Domain.getById(Integer.parseInt(request.substring(1)));
} catch (IllegalArgumentException e) {
- throw (new GigiApiException("No personal domains found matching the id " + request.substring(1) + "."));
+ throw (new GigiApiException(new SprintfCommand("No personal domains found matching the id %s", Arrays.asList(request.substring(1)))));
}
} else {
d = Domain.searchUserIdByDomain(request);
}
if (d == null) {
- throw (new GigiApiException("No personal domains found matching " + request));
+ throw (new GigiApiException(new SprintfCommand("No personal domains found matching %s", Arrays.asList(request))));
}
res = d.getOwner();
return true;
package org.cacert.gigi.pages.admin.support;
import java.io.PrintWriter;
+import java.util.Arrays;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.SprintfCommand;
import org.cacert.gigi.output.template.Template;
public class FindUserForm extends Form {
public boolean submit(PrintWriter out, HttpServletRequest req) throws GigiApiException {
User[] users = User.findByEmail(req.getParameter("email"));
if (users.length == 0) {
- throw (new GigiApiException("No users found matching " + req.getParameter("email")));
+ throw (new GigiApiException(new SprintfCommand("No users found matching %s", Arrays.asList(req.getParameter("email")))));
}
this.users = users;
return true;
} catch (SQLException e) {
e.printStackTrace();
} catch (GigiApiException e) {
- outputError(out, req, e.getMessage());
+ e.format(out, Page.getLanguage(req));
return false;
}
return true;
package org.cacert.gigi.util;
import java.text.ParseException;
+import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.cacert.gigi.dbObjects.Name;
import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.output.DateSelector;
+import org.cacert.gigi.output.template.SprintfCommand;
public class Notary {
} else if (type == AssuranceType.TTP_ASSISTED) {
assureTTP(assurer, assuree, awarded, location, date);
} else {
- throw new GigiApiException("Unknown Assurance type: " + type);
+ throw new GigiApiException(new SprintfCommand("Unknown Assurance type: %s", Arrays.asList(type.toString())));
}
assurer.invalidateMadeAssurances();
assuree.invalidateReceivedAssurances();