Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SC.confirm dynamicContents eval error

    Getting a "dynamicContents eval error" when passing certain text into SC.confirm (see code sample below at point 6).

    1. SmartClient Version: v9.1p_2014-05-19/Pro Deployment (built 2014-05-19)

    2. FF ESR 24.5.0

    5.
    Code:
    com.smartgwt.client.core.JsObject$SGWT_WARN: 11:09:32.297:MUP1:WARN:Dialog:isc_globalWarn:dynamicContents eval error - returning empty string for block -->${A}<-- error was: {fileName: "http://127.0.0.1:8888/xxxxxx/sc/modules..."[52],
    lineNumber: 233,
    columnNumber: 0}
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:304)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
        at com.smartgwt.client.util.SC.confirm(SC.java)
        at com.xxxxxx.xxxxxx.client.rpc.commands.TaskCommands.launchTask(TaskCommands.java:39)
        at com.xxxxxx.xxxxxx.client.component.list.AbstractTaskList$1.doAction(AbstractTaskList.java:102)
        at com.xxxxxx.xxxxxx.client.component.list.xxxxxxListGrid$3.onClick(xxxxxxListGrid.java:204)
        at com.smartgwt.client.widgets.menu.events.MenuItemClickEvent.dispatch(MenuItemClickEvent.java:110)
        at com.smartgwt.client.widgets.menu.events.MenuItemClickEvent.dispatch(MenuItemClickEvent.java:1)
        at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
        at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
        at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
        at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
        at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:487)
        at sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:347)
        at sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
        at java.lang.Thread.run(Thread.java:744)
    6.
    Code:
            // taskName	= "A=${A}-V=${V}"
            SC.confirm("Are you sure you want to launch \"" + StringUtil.asHTML(taskName, true) + "\"?",
                new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                        if (value != null && value) {
                            performCommand(new Object[] { sysId }, CommandConstants.LAUNCH_TASK, callback);
                        }
                    }
                });
    The SC.confirm output text looks OK:

    Are you sure you want to launch "A=${A}-V=${V}"?

    What is interesting is that the warning in the development mode console only appears the first time, all subsequent calls to confirm with the same input do not produce the warning.

    #2
    The message for Dialogs in general is a evaluated as a template, because you are able to refer to ${loadingMessage} and other variables.

    To avoid your ${A} sequence being interpreted as a reference to a variable, use a single backslash to escape it (so the value is "\${A}" although of course the Java String literal in your code needs to be "\\${A}").

    Or, if this is difficult, you can safely ignore the warning.

    Comment


      #3
      Thank you.
      I assume no such util method exists, similar to StringUtil.asHTML(taskName, true) which would perform such escaping?

      Comment


        #4
        No, there isn't a utility method for this. We would recommend using String.replace().

        Comment

        Working...
        X