Announcement

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

    Error: Must be no more than 255 characters long

    Hi, I am getting this error when uploading mulitple image files using the FileItem approach. When I select multiple file it seems to reach a point beyond which if the file name string is longer than 255 chars it errors out. If I give it a smaller number of files to upload it does it happily. Do I need to change my datasource definition file in any way?

    I am using SmartGwt Pro 5.0p.

    Thanks.

    Code:
    21:29:54.569 [ERROR] [appname] 21:29:54.563:WARN:validation:isc_DynamicForm_5:Validation errors occurred for the following fields with no visible form items:
    imgfile_filename:- Must be no more than 255 characters long
    com.smartgwt.client.core.JsObject$SGWT_WARN: 21:29:54.563:WARN:validation:isc_DynamicForm_5:Validation errors occurred for the following fields with no visible form items:
    imgfile_filename:- Must be no more than 255 characters long
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        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:337)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
        at com.smartgwt.client.widgets.form.DynamicForm.showErrors(DynamicForm.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        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:337)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        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:213)
        at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        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:292)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
        at java.lang.Thread.run(Unknown Source)
    My datasource definition

    Code:
    		<field name="ser_no" type="integer" primaryKey="true" hidden="true"></field>
    		<field name="caller" length="50" type="text" hidden="true"></field>
    		<field name="type" type="text" hidden="true"></field>
    		<field name="sessionId" type="text" hidden="true"></field>
    		<field name="signedUser" type="text" hidden="true"></field>
    		<field name="mbrId" type="text" hidden="true"></field>
    		<field name="imgfile" type="binary" length="512"> </field> <!-- I set the length attr to see if that would avoid the error -->
    		<field name="status" type="text" hidden="true"></field>
    		<field name="errorMsg" length="255" type="text" hidden="true"></field>
    The file name string when I select all the files that I want to upload. The length of this string is 219 chars. This is the scenario where it errors out. If I remove files 16-20 then it works fine.

    Code:
    "Sample01" "Sample02" "Sample03" "Sample04" "Sample05" "Sample06" "Sample07" "Sample08" "Sample09" "Sample10" "Sample11" "Sample12" "Sample13" "Sample14" "Sample15" "Sample16" "Sample17" "Sample18" "Sample19" "Sample20"

    #2
    Just declare your own "imgfile_filename" field in the dataSource - SmartGWT will use it rather than creating its own default version. The ability to manage your own metadata field declarations is covered here in the docs, but we are going to tweak it slightly for clarity.

    Comment


      #3
      I gave it a try but it seems to create its own default version anyway. Am I doing something wrong?

      Code:
      [ERROR] [appname] - 12:28:11.882:WARN:validation:isc_DynamicForm_5:Validation errors occurred for the following fields with no visible form items:
      imgfile_filename_filename:- Must be no more than 255 characters long
      My updated datasource field
      Code:
      		<field name="ser_no" type="integer" primaryKey="true" hidden="true"></field>
      		<field name="caller" length="50" type="text" hidden="true"></field>
      		<field name="type" type="text" hidden="true"></field>
      		<field name="sessionId" type="text" hidden="true"></field>
      		<field name="signedUser" type="text" hidden="true"></field>
      		<field name="mbrId" type="text" hidden="true"></field>
      		<field name="imgfile_filename" type="binary"></field>
      		<field name="status" type="text" hidden="true"></field>
      		<field name="errorMsg" length="255" type="text" hidden="true"></field>
      Last edited by bc; 26 Mar 2015, 09:02.

      Comment


        #4
        Reread the docs for binary fields previously linked.

        You don't need to change the name of your binary field from "imgfile" to "imgfile_filename" as you attempted. You should retain the original "imgfile" of type "binary", then declare a *second* field, of type "text", called imgfile_filename.

        That second field definition allows you to override the field that the framework implicitly generates when you declare a field of type "binary".

        Comment

        Working...
        X