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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations