Search in sources :

Example 41 with OLATRuntimeException

use of org.olat.core.logging.OLATRuntimeException in project OpenOLAT by OpenOLAT.

the class ShibbolethDispatcher method handleException.

/**
 * It first tries to catch the frequent SAMLExceptions and to ask the user to login again.
 * It basically lets the user to login again without getting a RedScreen if one of the most
 * frequent shibboleth error occurs. Else a RedScreen is the last option.
 * @param e
 * @param req
 * @param resp
 */
private void handleException(Throwable e, HttpServletRequest req, HttpServletResponse resp, Translator transl) {
    UserRequest ureq = new UserRequestImpl(ShibbolethDispatcher.PATH_SHIBBOLETH, req, resp);
    if (e instanceof ShibbolethException) {
        String userMsg = "";
        int errorCode = ((ShibbolethException) e).getErrorCode();
        switch(errorCode) {
            case ShibbolethException.GENERAL_SAML_ERROR:
                userMsg = transl.translate("error.shibboleth.generic");
                break;
            case ShibbolethException.UNIQUE_ID_NOT_FOUND:
                userMsg = transl.translate("error.unqueid.notfound");
                break;
            default:
                userMsg = transl.translate("error.shibboleth.generic");
                break;
        }
        showMessage(ureq, "org.opensaml.SAMLException: " + e.getMessage(), e, userMsg, ((ShibbolethException) e).getContactPersonEmail());
        return;
    } else {
        try {
            ChiefController msgcc = MsgFactory.createMessageChiefController(ureq, new OLATRuntimeException("Error processing Shibboleth request: " + e.getMessage(), e), false);
            msgcc.getWindow().dispatchRequest(ureq, true);
        } catch (Throwable t) {
            log.error("We're fucked up....", t);
        }
    }
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) ChiefController(org.olat.core.gui.control.ChiefController) UserRequest(org.olat.core.gui.UserRequest) UserRequestImpl(org.olat.core.gui.UserRequestImpl)

Example 42 with OLATRuntimeException

use of org.olat.core.logging.OLATRuntimeException in project OpenOLAT by OpenOLAT.

the class ShibbolethDispatcher method showMessage.

/**
 * @param ureq
 * @param exceptionLogMessage will be recorded into the log file
 * @param cause
 * @param userMessage gets shown to the user
 * @param supportEmail if any available, else null
 */
private void showMessage(UserRequest ureq, String exceptionLogMessage, Throwable cause, String userMessage, String supportEmail) {
    ChiefController msgcc = MessageWindowController.createMessageChiefController(ureq, new OLATRuntimeException(exceptionLogMessage, cause), userMessage, supportEmail);
    msgcc.getWindow().dispatchRequest(ureq, true);
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) ChiefController(org.olat.core.gui.control.ChiefController)

Example 43 with OLATRuntimeException

use of org.olat.core.logging.OLATRuntimeException in project OpenOLAT by OpenOLAT.

the class PortfolioCourseNode method getCutValueConfiguration.

@Override
public Float getCutValueConfiguration() {
    if (!hasPassedConfigured()) {
        throw new OLATRuntimeException(PortfolioCourseNode.class, "getCutValue not defined when hasPassed set to false", null);
    }
    ModuleConfiguration config = getModuleConfiguration();
    Float cut = (Float) config.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE);
    return cut;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Example 44 with OLATRuntimeException

use of org.olat.core.logging.OLATRuntimeException in project OpenOLAT by OpenOLAT.

the class PortfolioCourseNode method getMinScoreConfiguration.

@Override
public Float getMinScoreConfiguration() {
    if (!hasScoreConfigured()) {
        throw new OLATRuntimeException(PortfolioCourseNode.class, "getMinScore not defined when hasScore set to false", null);
    }
    ModuleConfiguration config = getModuleConfiguration();
    Float min = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
    return min;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Example 45 with OLATRuntimeException

use of org.olat.core.logging.OLATRuntimeException in project OpenOLAT by OpenOLAT.

the class ProjectBrokerCourseNode method getCutValueConfiguration.

/**
 * @see org.olat.course.nodes.AssessableCourseNode#getCutValueConfiguration()
 */
@Override
public Float getCutValueConfiguration() {
    if (!hasPassedConfigured()) {
        throw new OLATRuntimeException(ProjectBrokerCourseNode.class, "getCutValue not defined when hasPassed set to false", null);
    }
    ModuleConfiguration config = getModuleConfiguration();
    Float cut = (Float) config.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE);
    return cut;
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException)

Aggregations

OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)268 IOException (java.io.IOException)104 File (java.io.File)50 ModuleConfiguration (org.olat.modules.ModuleConfiguration)26 ArrayList (java.util.ArrayList)22 AssertException (org.olat.core.logging.AssertException)22 FileOutputStream (java.io.FileOutputStream)20 OutputStream (java.io.OutputStream)20 Properties (java.util.Properties)20 FileInputStream (java.io.FileInputStream)18 HashMap (java.util.HashMap)18 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)18 QTIItemObject (org.olat.ims.qti.export.helper.QTIItemObject)18 DefaultElement (org.dom4j.tree.DefaultElement)16 Element (org.jdom.Element)16 InputStream (java.io.InputStream)14 BufferedInputStream (java.io.BufferedInputStream)12 List (java.util.List)12 Document (org.dom4j.Document)12 CPItem (org.olat.ims.cp.objects.CPItem)12