<%@ page
  language="java"
  pageEncoding="ISO-8859-15"
  contentType="text/html; charset=ISO-8859-15"
  import="org.apache.log4j.Logger, java.io.ByteArrayOutputStream, java.io.PrintStream"
  isErrorPage="true" %>
  
<%!
  static public String stackToString(Throwable throwable) {
    if (throwable == null) {
      return null;
    }
    java.io.StringWriter buffer = new java.io.StringWriter();
    java.io.PrintWriter writer = new java.io.PrintWriter(buffer);
    throwable.printStackTrace(writer);
    try {
      buffer.close();
    } catch (java.io.IOException ioe) {
      throw new RuntimeException(ioe);
    }
    return buffer.toString();
  }
%>
<%
  Logger logger = Logger.getLogger("ERROR.REPORTER");
  String codeErreur = request.getRemoteAddr() + ":" + Long.toString(System.currentTimeMillis());
  if (exception == null) {
    exception = (java.lang.Exception) request.getSession().getAttribute(fr.gouv.finances.dgfip.xemelios.web.WebAppCst.SessionAttributes.ajaxExceptionKey);
  }
  logger.error(codeErreur, exception);
%>
<html>
  <head>
    <link rel="stylesheet" href="css/standard.css" type="text/css">
    <link rel="icon" type="image/png" href="<%=request.getContextPath()%>/img/favicon.png"/>
  </head>
  <body>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top" align="left">
          Une erreur inattendue est survenue.<br/>
          Veuillez contacter votre administrateur en lui précisant le code suivant : <%= codeErreur%>
        </td>
      </tr>
    </table>
    <div style="height: 0; visibility: hidden; overflow: hidden">
      <%= stackToString(exception) %>
    </div>
  </body>
</html>