Dear Folks,

I think I found a bug in the Wicket Tiny MCE implementation version 1.4.18.

In class there's the following method:

    public static void lazyLoadTinyMCEResource(IHeaderResponse response) {

String url = RequestCycle.get().urlFor(TinyMCESettings.javaScriptReference()).toString(); String base = url.substring(0, url.lastIndexOf(File.separatorChar)); response.renderJavascript("window.tinyMCEPreInit = {base : '" + base + "', suffix : '', query : ''};", "tinyMceHackPreload"); response.renderJavascriptReference(TinyMCESettings.javaScriptReference()); response.renderJavascript("window.tinymce.dom.Event.domLoaded = true;", "tinyMceHackPostload");

The first line returns a URL. In the second line an attempt is made to extract a substring using the index of File.separatorChar. However, File.separatorChar on a Windows systems is "\\". This is a character never found in a URL (there are usually only "/" characters). Thus, always -1 is returned and the substring operation fails with an index ouf of bounds:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring( ~[na:1.6.0_27]
at wicket.contrib.tinymce.settings.TinyMCESettings.lazyLoadTinyMCEResource( ~[tinymce-1.4.18.jar:1.4.18 null - mike] at wicket.contrib.tinymce.TinyMceBehavior.renderHead( ~[tinymce-1.4.18.jar:1.4.18 null - mike] at org.apache.wicket.Component.renderHead( ~[wicket-1.4.18.jar:1.4.18]

Shall I file a bug report on this?


To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to