Results 1 to 5 of 5

Thread: Filename is not reported in console when json malformed

    You found a bug! We've classified it as SDKTOOLS-407 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User ludoo's Avatar
    Join Date
    Mar 2007
    Location
    France
    Posts
    67
    Vote Rating
    3
      0  

    Default Filename is not reported in console when json malformed

    Sencha Cmd version(s) tested:
    • Sencha Cmd v3.1.0.256


    Operating System:
    • Windows7


    Framework used::
    • ExtJs4.2.0.663


    Description:
    • When a json config file is malformed (comma forgotten as well), log error don't mention the wrong filename. Even in debug mode, stack trace is not more explicit on this file.


    Steps to reproduce the problem:
    • In your theme, remove a comma from the config file package.json

    Code:
    {
        "name": "my-theme-classic",
        "type": "theme",
        "extend": "ext-theme-classic"  //HERE COMMA IS MISSING
        "creator": "LudoO",
        "version": "1.0.0",
        "compatVersion": "1.0.0",
        "local": true,
        "requires": []
    }
    The result that was expected:
    • Log shows which file is malformed


    The result that occurs instead:
    • Error and stacktrace is not useful to retrieve the wrong file.

    Code:
    C:\dev\js\extjs\projects\MyProject>sencha app build
    Sencha Cmd v3.1.0.256
    [ERR] com.google.gson.stream.MalformedJsonException: Unterminated object at line 5 column 6
    Code:
    C:\dev\js\extjs\projects\MyProject>sencha --debug app build
    Sencha Cmd v3.1.0.256
    [DBG] Loading CommandProviders
    [DBG] Scanning for extensions in C:\tools\dev\SenchaSDKTools-3.1.0\Sencha\Cmd\3.1.0.256\extensions
    [DBG] loading extension from C:\tools\dev\SenchaSDKTools-3.1.0\Sencha\Cmd\3.1.0.256\extensions\sencha-compass
    [DBG] Loaded extension sencha-compass
    [DBG] loading extension from C:\tools\dev\SenchaSDKTools-3.1.0\Sencha\Cmd\3.1.0.256\extensions\sencha-io
    ...
    [ERR] com.google.gson.stream.MalformedJsonException: Unterminated object at line 5 column 6
         at com.sencha.exceptions.BasicException.wrap(BasicException.java:44)
         at com.sencha.cli.Command.dispatch(Command.java:64)
         at com.sencha.cli.Commands.dispatch(Commands.java:62)
         at com.sencha.cli.Commands.dispatch(Commands.java:62)
         at com.sencha.command.Sencha.dispatch(Sencha.java:72)
         at com.sencha.command.Sencha.main(Sencha.java:123)
       Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 5 column 6
         at com.google.gson.Gson.fromJson(Gson.java:805)
         at com.google.gson.Gson.fromJson(Gson.java:757)
         at com.google.gson.Gson.fromJson(Gson.java:706)
         at com.google.gson.Gson.fromJson(Gson.java:678)
         at com.sencha.util.JsonUtil.fromJson(JsonUtil.java:99)
         at com.sencha.tools.pkg.Model$Package.load(Model.java:952)
         at com.sencha.command.environment.WorkspaceRepository.scanWorkspacePackages(WorkspaceRepository.java:155)
         at com.sencha.command.environment.WorkspaceRepository.getWorkspaceCatalog(WorkspaceRepository.java:174)
         at com.sencha.command.environment.WorkspaceRepository.getWorkspaceCatalog(WorkspaceRepository.java:169)
         at com.sencha.command.environment.WorkspaceRepository.getCatalog(WorkspaceRepository.java:87)
         at com.sencha.command.environment.WorkspaceRepository.getPackage(WorkspaceRepository.java:123)
         at com.sencha.command.environment.WorkspaceEnvironment.getPackageEnvironment(WorkspaceEnvironment.java:136)
         at com.sencha.command.environment.AppEnvironment.getThemePackageEnvironment(AppEnvironment.java:85)
         at com.sencha.command.environment.AppEnvironment.getThemePackageEnvironments(AppEnvironment.java:294)
         at com.sencha.command.environment.AppEnvironment.getThemePackageNames(AppEnvironment.java:306)
         at com.sencha.command.app.AppCommands$BuildCommand.getParameters(AppCommands.java:124)
         at com.sencha.command.BasePluginCommands$BasePluginCommand.doExecute(BasePluginCommands.java:23)
         at com.sencha.command.app.AppCommands$BuildCommand.execute(AppCommands.java:108)
         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.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:174)
         at com.sencha.cli.Command.dispatch(Command.java:42)
         at com.sencha.cli.Commands.dispatch(Commands.java:62)
         at com.sencha.cli.Commands.dispatch(Commands.java:62)
         at com.sencha.command.Sencha.dispatch(Sencha.java:72)
         at com.sencha.command.Sencha.main(Sencha.java:123)
       Caused by: Unterminated object at line 5 column 6
         at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1310)
         at com.google.gson.stream.JsonReader.nextInObject(JsonReader.java:722)
         at com.google.gson.stream.JsonReader.peek(JsonReader.java:382)
         at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:349)
         at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:166)
         at com.google.gson.Gson.fromJson(Gson.java:791)
         at com.google.gson.Gson.fromJson(Gson.java:757)
         at com.google.gson.Gson.fromJson(Gson.java:706)
         at com.google.gson.Gson.fromJson(Gson.java:678)
         at com.sencha.util.JsonUtil.fromJson(JsonUtil.java:99)
         at com.sencha.tools.pkg.Model$Package.load(Model.java:952)
         at com.sencha.command.environment.WorkspaceRepository.scanWorkspacePackages(WorkspaceRepository.java:155)
         at com.sencha.command.environment.WorkspaceRepository.getWorkspaceCatalog(WorkspaceRepository.java:174)
         at com.sencha.command.environment.WorkspaceRepository.getWorkspaceCatalog(WorkspaceRepository.java:169)
         at com.sencha.command.environment.WorkspaceRepository.getCatalog(WorkspaceRepository.java:87)
         at com.sencha.command.environment.WorkspaceRepository.getPackage(WorkspaceRepository.java:123)
         at com.sencha.command.environment.WorkspaceEnvironment.getPackageEnvironment(WorkspaceEnvironment.java:136)
         at com.sencha.command.environment.AppEnvironment.getThemePackageEnvironment(AppEnvironment.java:85)
         at com.sencha.command.environment.AppEnvironment.getThemePackageEnvironments(AppEnvironment.java:294)
         at com.sencha.command.environment.AppEnvironment.getThemePackageNames(AppEnvironment.java:306)
         at com.sencha.command.app.AppCommands$BuildCommand.getParameters(AppCommands.java:124)
         at com.sencha.command.BasePluginCommands$BasePluginCommand.doExecute(BasePluginCommands.java:23)
         at com.sencha.command.app.AppCommands$BuildCommand.execute(AppCommands.java:108)
         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.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:174)
         at com.sencha.cli.Command.dispatch(Command.java:42)
         at com.sencha.cli.Commands.dispatch(Commands.java:62)
         at com.sencha.cli.Commands.dispatch(Commands.java:62)
         at com.sencha.command.Sencha.dispatch(Sencha.java:72)
         at com.sencha.command.Sencha.main(Sencha.java:123)

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    What happens when you send the verbose flag?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User ludoo's Avatar
    Join Date
    Mar 2007
    Location
    France
    Posts
    67
    Vote Rating
    3
      0  

    Default

    This was the last code section of my post (if I understand well that --debug is the verbose flag...).
    With the command sencha --debug app build, I got the full java stacktrace in Gson parsing error but no filename.
    It's annoying and difficult to retrieve which file is malformed !

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    20
    Vote Rating
    2
      0  

    Default

    Is it any help if you use the more verbose --trace flag?

    Either way, the file should be in the error, so I will create a bug for this issue.

    Thanks so much!

  5. #5
    Sencha User ludoo's Avatar
    Join Date
    Mar 2007
    Location
    France
    Posts
    67
    Vote Rating
    3
      0  

    Default

    I just tried with --trace flag.
    Sure, there are more infos, but stacktrace stays unchanged, and there is no additional information about filename.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •