Bug 832910

Summary: Designer doesn't load on Windows
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Lukáš Petrovický <lpetrovi>
Component: BRM (Guvnor)Assignee: manstis
Status: VERIFIED --- QA Contact:
Severity: urgent Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GACC: tkobayas
Target Milestone: CR1   
Target Release: BRMS 5.3.0.GA   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukáš Petrovický 2012-06-18 07:51:38 UTC
From Toshiya:

------------
Error: a is undefined
Source file: http://localhost:8080/designer/jsc/env_combined.js
line: 250

I switched to designer.dev=true and now the error is:

Error: namespace is undefined
Source file: http://localhost:8080/designer/js/Core/StencilSet/stencilsets.js
line: 83

I debugged around stencilsets.js/stencilset.js then I noticed that http://localhost:8080/designer/stencilset/bpmn2.0jbpm returns 0byte in Windows7

Comment 1 Sona Mala 2012-06-18 10:11:47 UTC
I tried this steps:
  - unzip standalone version (BRMS-5.3.0-ER9)
  - check size of designer/stencilset/bpmn2.0jbpm/bpmn2.0jbpm.json (156KB)
  - open Guvnor
  - create/open BPMN process
  - check size of designer/stencilset/bpmn2.0jbpm/bpmn2.0jbpm.json (0B)

I think that somewhere during loading of designer, a contain of this file is removed.

Comment 2 Toshiya Kobayashi 2012-06-18 10:34:25 UTC
Yeah,

designer.war/stencilsets/bpmn2.0jbpm/bpmn2.0jbpm.json

is 0 byte.

Attaching a debugger, I observed

JbpmPreprocessingUnit.readFile() fails to read designer.war/stencilsets/bpmn2.0jbpm/stencildata/bpmn2.0jbpm.orig

    private String readFile(String pathname) throws IOException {
        StringBuilder fileContents = new StringBuilder();
        Scanner scanner = new Scanner(new File(pathname));
        String lineSeparator = System.getProperty("line.separator");
        try {
            while(scanner.hasNextLine()) {        
                fileContents.append(scanner.nextLine() + lineSeparator);
            }
            return fileContents.toString();
        } finally {
            scanner.close();
        }
    }

Scanner.hasNextLine() immediately returns false.  Scanner should be instantiated with charsetName. Without it, Scanner uses platform encoding. (In my case, MS932)

         Scanner scanner = new Scanner(new File(pathname), "UTF-8");

A quick workaround is -Dfile.encoding=UTF-8 for JVM option.

Comment 3 Tihomir Surdilovic 2012-06-18 14:07:17 UTC
Thanks Toshiya! I guess this was introduced with the Japanese translations :)
charset was added to the Scanner init and fix was committed to Designer master and 2.2.x branch (https://github.com/tsurdilo/process-designer/commit/d35b56cecc854f80eb57a8e7930dce8f86cd0876). 

Let me know if there is anything else.

Comment 4 Toshiya Kobayashi 2012-06-19 02:51:00 UTC
Ah, it was not enough. Even if it can read bpmn2.0jbpm.orig, it writes bpmn2.0jbpm.json in the platform encoding (in my case, MS932). It will result in non-UTF-8 JSON which browsers fail to parse.

http://www.ietf.org/rfc/rfc4627.txt
====
3.  Encoding

   JSON text SHALL be encoded in Unicode.  The default encoding is
   UTF-8.
====

Sent a pull request for it.

https://github.com/tsurdilo/process-designer/pull/10

Comment 5 Toshiya Kobayashi 2012-06-19 03:18:02 UTC
Confirmed that the latest 2.2.x (with the pull request) build worked for my Win7.

Comment 6 Lukáš Petrovický 2012-06-19 06:31:17 UTC
(In reply to comment #5)
> Confirmed that the latest 2.2.x (with the pull request) build worked for my
> Win7.

Geoffrey, please, merge the pull request, would you? Tiho's not gonna be able to do that.

Comment 7 Tihomir Surdilovic 2012-06-19 07:04:23 UTC
Was able to merge the pull request to 2.2.x and its also in master too. Thanks again Toshiya.

Comment 8 Ryan Zhang 2012-06-21 02:46:58 UTC
This issue should contain the fixes.
Please verify it on CR1.

Comment 9 Zuzana Krejčová 2012-06-21 13:09:07 UTC
Screenshots from our tests show this was fixed in CR1