<commit_before>package no.java.submitit.app

import no.java.submitit.common._
import no.java.submitit.ems._
import no.java.submitit.app.pages._
import org.apache.wicket.util.lang.Bytes
import org.apache.wicket.protocol.http.WebApplication
import org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadWebRequest
import org.apache.wicket.protocol.http.WebRequest
import javax.servlet.http.HttpServletRequest
import org.apache.wicket.Request
import org.apache.wicket.Response
import org.apache.wicket.Session
import _root_.java.util.Properties
import org.apache.wicket.Application._
import org.apache.wicket.settings.IExceptionSettings

class SubmititApp extends WebApplication {

  override def init() {
    SubmititApp.propertyFileName = super.getServletContext.getInitParameter("submitit.properties")
    if (SubmititApp.propertyFileName == null) throw new Exception("""You must specify "submitit.properties" as a init parameter.""")
    val props = utils.PropertyIOUtils.loadRessource(SubmititApp.propertyFileName)
    SubmititApp.adminPass = this nullOnEmptyString props.remove(SubmititApp.adminPassPhrase).asInstanceOf[String]
    SubmititApp.emsUrl = this nullOnEmptyString props.remove(SubmititApp.emsUrlKey).asInstanceOf[String]
    SubmititApp.emsUsername = this nullOnEmptyString props.remove(SubmititApp.emsUsernameKey).asInstanceOf[String]
    SubmititApp.emsPwd = this nullOnEmptyString props.remove(SubmititApp.emsPwdKey).asInstanceOf[String]

    val elems = props.keys
    var theMap = Map[String, String]()
    for (i <- 0 to props.size() - 1) {
      val e = elems.nextElement.asInstanceOf[String]
      theMap = theMap + (e -> props.getProperty(e).asInstanceOf[String])
    }
    SubmititApp.properties = theMap

    mountBookmarkablePage("/lookupPresentation", classOf[IdResolverPage]);
    mountBookmarkablePage("/helpit", classOf[HelpPage]);
    mountBookmarkablePage("/admin-login", classOf[admin.AdminLogin])
    getApplicationSettings.setDefaultMaximumUploadSize(Bytes.kilobytes(500))
    getApplicationSettings().setInternalErrorPage(classOf[ErrorPage]);
    getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);<commit_msg>Removed global use of exception page, which would fail. Now only exception page when the app throws an exception.<commit_after>package no.java.submitit.app

import no.java.submitit.common._
import no.java.submitit.ems._
import no.java.submitit.app.pages._
import org.apache.wicket.util.lang.Bytes
import org.apache.wicket.protocol.http.WebApplication
import org.apache.wicket.extensions.ajax.markup.html.form.upload.UploadWebRequest
import org.apache.wicket.protocol.http.WebRequest
import javax.servlet.http.HttpServletRequest
import org.apache.wicket.Request
import org.apache.wicket.Response
import org.apache.wicket.Session
import _root_.java.util.Properties
import org.apache.wicket.Application._
import org.apache.wicket.settings.IExceptionSettings

class SubmititApp extends WebApplication {

  override def init() {
    SubmititApp.propertyFileName = super.getServletContext.getInitParameter("submitit.properties")
    if (SubmititApp.propertyFileName == null) throw new Exception("""You must specify "submitit.properties" as a init parameter.""")
    val props = utils.PropertyIOUtils.loadRessource(SubmititApp.propertyFileName)
    SubmititApp.adminPass = this nullOnEmptyString props.remove(SubmititApp.adminPassPhrase).asInstanceOf[String]
    SubmititApp.emsUrl = this nullOnEmptyString props.remove(SubmititApp.emsUrlKey).asInstanceOf[String]
    SubmititApp.emsUsername = this nullOnEmptyString props.remove(SubmititApp.emsUsernameKey).asInstanceOf[String]
    SubmititApp.emsPwd = this nullOnEmptyString props.remove(SubmititApp.emsPwdKey).asInstanceOf[String]

    val elems = props.keys
    var theMap = Map[String, String]()
    for (i <- 0 to props.size() - 1) {
      val e = elems.nextElement.asInstanceOf[String]
      theMap = theMap + (e -> props.getProperty(e).asInstanceOf[String])
    }
    SubmititApp.properties = theMap

    mountBookmarkablePage("/lookupPresentation", classOf[IdResolverPage]);
    mountBookmarkablePage("/helpit", classOf[HelpPage]);
    mountBookmarkablePage("/admin-login", classOf[admin.AdminLogin])
    getApplicationSettings.setDefaultMaximumUploadSize(Bytes.kilobytes(500))
{'fraction_non_alphanumeric': 0.10064635272391505, 'fraction_numerical': 0.0023084025854108957, 'mean_word_length': 5.666153846153846, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2373174', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1259, 'n_words': 219}