Dear Folks,

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

In class TinyMCESettings.java 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(String.java:1937) ~[na:1.6.0_27]
at wicket.contrib.tinymce.settings.TinyMCESettings.lazyLoadTinyMCEResource(TinyMCESettings.java:971) ~[tinymce-1.4.18.jar:1.4.18 null - mike] at wicket.contrib.tinymce.TinyMceBehavior.renderHead(TinyMceBehavior.java:60) ~[tinymce-1.4.18.jar:1.4.18 null - mike] at org.apache.wicket.Component.renderHead(Component.java:2806) ~[wicket-1.4.18.jar:1.4.18]

Shall I file a bug report on this?

Philipp



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to