Search in sources :

Example 71 with AssertException

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

the class URLBuilder method encodeUrl.

/**
 * @param url
 * @return encoded string
 */
public String encodeUrl(String url) {
    String encodedURL;
    try {
        encodedURL = URLEncoder.encode(url, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        /*
			 * from java.nio.Charset Standard charsets Every implementation of the
			 * Java platform is required to support the following standard charsets...
			 * ... UTF-8 Eight-bit UCS Transformation Format ...
			 */
        throw new AssertException("utf-8 encoding is needed for proper encoding, but not offered on this java platform????");
    }
    encodedURL = p1.matcher(encodedURL).replaceAll("%20");
    encodedURL = p2.matcher(encodedURL).replaceAll("/");
    return encodedURL;
}
Also used : AssertException(org.olat.core.logging.AssertException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 72 with AssertException

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

the class CommandFactory method createParentRedirectForExternalResource.

/**
 * @param res
 * @return
 */
public static Command createParentRedirectForExternalResource(String redirectMapperURL) {
    JSONObject root = new JSONObject();
    try {
        root.put("rurl", redirectMapperURL);
    } catch (JSONException e) {
        throw new AssertException("wrong data put into json object", e);
    }
    Command c = new Command(5);
    c.setSubJSON(root);
    return c;
}
Also used : AssertException(org.olat.core.logging.AssertException) JSONObject(org.json.JSONObject) JSONException(org.json.JSONException)

Example 73 with AssertException

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

the class CommandFactory method createPrepareClientCommand.

/**
 * - resets the js flag which is set when the user changes form data and is checked when an other link is clicked.(to prevent form data loss).<br>
 * @return the command
 */
public static Command createPrepareClientCommand(String businessControlPath) {
    JSONObject root = new JSONObject();
    try {
        root.put("bc", businessControlPath == null ? "" : businessControlPath);
    } catch (JSONException e) {
        throw new AssertException("wrong data put into json object", e);
    }
    Command c = new Command(6);
    c.setSubJSON(root);
    return c;
}
Also used : AssertException(org.olat.core.logging.AssertException) JSONObject(org.json.JSONObject) JSONException(org.json.JSONException)

Example 74 with AssertException

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

the class WindowBackOfficeImpl method createInlineTranslationDispatcherController.

/**
 * Factory method to create the inline translation tool dispatcher controller.
 * This implicitly sets the translation controller on the window back office
 *
 * @param ureq
 * @param windowControl
 * @return
 */
@Override
public Controller createInlineTranslationDispatcherController(UserRequest ureq, WindowControl windowControl) {
    if (inlineTranslationC != null)
        throw new AssertException("Can't set the inline translation dispatcher twice!", null);
    inlineTranslationC = I18nUIFactory.createInlineTranslationIntercepHandlerController(ureq, windowControl);
    this.inlineTranslation_interceptHandler = inlineTranslationC;
    return inlineTranslationC;
}
Also used : AssertException(org.olat.core.logging.AssertException)

Example 75 with AssertException

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

the class ExcelMediaResource method setFilename.

/**
 * @param fileName String without extension and only with valid chars
 */
public void setFilename(String fileName) {
    Pattern p = Pattern.compile("[a-zA-Z0-9]*");
    if (!p.matcher(fileName).matches()) {
        throw new AssertException(fileName + " is not a valid filename");
    }
    this.optionalFilename = fileName;
}
Also used : Pattern(java.util.regex.Pattern) AssertException(org.olat.core.logging.AssertException)

Aggregations

AssertException (org.olat.core.logging.AssertException)364 IOException (java.io.IOException)38 File (java.io.File)28 Identity (org.olat.core.id.Identity)28 ArrayList (java.util.ArrayList)26 HashMap (java.util.HashMap)24 Controller (org.olat.core.gui.control.Controller)22 OLATResourceable (org.olat.core.id.OLATResourceable)22 RepositoryEntry (org.olat.repository.RepositoryEntry)22 WindowControl (org.olat.core.gui.control.WindowControl)20 UnsupportedEncodingException (java.io.UnsupportedEncodingException)18 JSONException (org.json.JSONException)18 BusinessGroup (org.olat.group.BusinessGroup)18 JSONObject (org.json.JSONObject)16 UserRequest (org.olat.core.gui.UserRequest)16 VFSContainer (org.olat.core.util.vfs.VFSContainer)16 VFSItem (org.olat.core.util.vfs.VFSItem)16 Date (java.util.Date)14 Properties (java.util.Properties)14 Property (org.olat.properties.Property)14