New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up HtmlUtil and escape hash table keys and values #886

Merged
merged 4 commits into from Mar 19, 2016

Conversation

Projects
None yet
2 participants
@amolenaar
Collaborator

amolenaar commented Mar 10, 2016

Do some cleanup before doing the real work: add HTML escaping to hash table keys and values.

amolenaar added some commits Mar 8, 2016

Clean up fitnesse.html.HtmlUtil.
Move reporting specific (javascript) snippets to reporting package.
@amolenaar

This comment has been minimized.

Show comment
Hide comment
@amolenaar

amolenaar Mar 10, 2016

Collaborator

Should fix #878.

Collaborator

amolenaar commented Mar 10, 2016

Should fix #878.

@amolenaar amolenaar added this to the Next release milestone Mar 15, 2016

@amolenaar amolenaar merged commit 176f4d0 into unclebob:master Mar 19, 2016

amolenaar added a commit that referenced this pull request Mar 19, 2016

Merge pull request #886 from amolenaar/htmlutil-cleanup
Clean up HtmlUtil and escape hash table keys and values

@amolenaar amolenaar deleted the amolenaar:htmlutil-cleanup branch Apr 25, 2016

@JanDuyck

This comment has been minimized.

Show comment
Hide comment
@JanDuyck

JanDuyck May 27, 2016

Hello, we experienced regression problems with fitnesse-20160515.jar

2 simple fixtures to simulate this

public Map<String, String> hashmapNoIssue() throws Exception {
    Map<String, String> tmp = new HashMap<String, String>();
    tmp.put("KEY1", "1");
    tmp.put("KEY2", "2");
    tmp.put("KEY2", "%20 works");
    return tmp; 
}

public Map<String, String> hashmapDecodeIssue() throws Exception {
    Map<String, String> tmp = new HashMap<String, String>();
    tmp.put("KEY1", "1");
    tmp.put("KEY2", "% does not work");
    return tmp; 
}

1 simple fitnesse test

|script|Fitnesse Database Wrapper|
|show |hashmapNoIssue |

|script|Fitnesse Database Wrapper|
|show |hashmapDecodeIssue |

The first fixture shows the hashmap correctly without errors.
The second fixture fails because of the character %

EXCEPTION:java.lang.StringIndexOutOfBoundsException: String index out of range: 66
at java.lang.String.substring(String.java:1963) [rt.jar:1.8.0_92]
at sun.net.www.ParseUtil.unescape(ParseUtil.java:164) [rt.jar:1.8.0_92]
at sun.net.www.ParseUtil.decode(ParseUtil.java:200) [rt.jar:1.8.0_92]
at sun.net.www.protocol.file.Handler.openConnection(Handler.java:82) [rt.jar:1.8.0_92]
at sun.net.www.protocol.file.Handler.openConnection(Handler.java:72) [rt.jar:1.8.0_92]
at java.net.URL.openConnection(URL.java:979) [rt.jar:1.8.0_92]
at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:602) [htmllexer-2.1.jar]
at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:864) [htmllexer-2.1.jar]
at org.htmlparser.Parser.setResource(Parser.java:397) [htmlparser-2.1.jar]
at org.htmlparser.Parser.(Parser.java:316) [htmlparser-2.1.jar]
at org.htmlparser.Parser.(Parser.java:330) [htmlparser-2.1.jar]
at fitnesse.slim.converters.MapConverter.parseHtml(MapConverter.java:138) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.isValidHtml(MapConverter.java:87) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.tableIsValid(MapConverter.java:73) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.addCellContent(MapConverter.java:57) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.createTag(MapConverter.java:48) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.toString(MapConverter.java:28) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.toString(MapConverter.java:16) [fitnesse-20160515.jar]
at fitnesse.slim.MethodExecutionResult.toString(MethodExecutionResult.java:94) [fitnesse-20160515.jar]
at fitnesse.slim.MethodExecutionResult.returnValue(MethodExecutionResult.java:85) [fitnesse-20160515.jar]
at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:108) [fitnesse-20160515.jar]
at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35) [fitnesse-20160515.jar]
at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-20160515.jar]
at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-20160515.jar]
at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-20160515.jar]
at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85) [fitnesse-20160515.jar]
at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84) [fitnesse-20160515.jar]
at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77) [fitnesse-20160515.jar]
at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64) [fitnesse-20160515.jar]
at fitnesse.slim.SlimServer.serve(SlimServer.java:49) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.handle(SlimService.java:154) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.acceptOne(SlimService.java:162) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.accept(SlimService.java:124) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.main(SlimService.java:56) [fitnesse-20160515.jar]

JanDuyck commented May 27, 2016

Hello, we experienced regression problems with fitnesse-20160515.jar

2 simple fixtures to simulate this

public Map<String, String> hashmapNoIssue() throws Exception {
    Map<String, String> tmp = new HashMap<String, String>();
    tmp.put("KEY1", "1");
    tmp.put("KEY2", "2");
    tmp.put("KEY2", "%20 works");
    return tmp; 
}

public Map<String, String> hashmapDecodeIssue() throws Exception {
    Map<String, String> tmp = new HashMap<String, String>();
    tmp.put("KEY1", "1");
    tmp.put("KEY2", "% does not work");
    return tmp; 
}

1 simple fitnesse test

|script|Fitnesse Database Wrapper|
|show |hashmapNoIssue |

|script|Fitnesse Database Wrapper|
|show |hashmapDecodeIssue |

The first fixture shows the hashmap correctly without errors.
The second fixture fails because of the character %

EXCEPTION:java.lang.StringIndexOutOfBoundsException: String index out of range: 66
at java.lang.String.substring(String.java:1963) [rt.jar:1.8.0_92]
at sun.net.www.ParseUtil.unescape(ParseUtil.java:164) [rt.jar:1.8.0_92]
at sun.net.www.ParseUtil.decode(ParseUtil.java:200) [rt.jar:1.8.0_92]
at sun.net.www.protocol.file.Handler.openConnection(Handler.java:82) [rt.jar:1.8.0_92]
at sun.net.www.protocol.file.Handler.openConnection(Handler.java:72) [rt.jar:1.8.0_92]
at java.net.URL.openConnection(URL.java:979) [rt.jar:1.8.0_92]
at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:602) [htmllexer-2.1.jar]
at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:864) [htmllexer-2.1.jar]
at org.htmlparser.Parser.setResource(Parser.java:397) [htmlparser-2.1.jar]
at org.htmlparser.Parser.(Parser.java:316) [htmlparser-2.1.jar]
at org.htmlparser.Parser.(Parser.java:330) [htmlparser-2.1.jar]
at fitnesse.slim.converters.MapConverter.parseHtml(MapConverter.java:138) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.isValidHtml(MapConverter.java:87) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.tableIsValid(MapConverter.java:73) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.addCellContent(MapConverter.java:57) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.createTag(MapConverter.java:48) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.toString(MapConverter.java:28) [fitnesse-20160515.jar]
at fitnesse.slim.converters.MapConverter.toString(MapConverter.java:16) [fitnesse-20160515.jar]
at fitnesse.slim.MethodExecutionResult.toString(MethodExecutionResult.java:94) [fitnesse-20160515.jar]
at fitnesse.slim.MethodExecutionResult.returnValue(MethodExecutionResult.java:85) [fitnesse-20160515.jar]
at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:108) [fitnesse-20160515.jar]
at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35) [fitnesse-20160515.jar]
at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29) [fitnesse-20160515.jar]
at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49) [fitnesse-20160515.jar]
at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43) [fitnesse-20160515.jar]
at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85) [fitnesse-20160515.jar]
at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84) [fitnesse-20160515.jar]
at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77) [fitnesse-20160515.jar]
at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64) [fitnesse-20160515.jar]
at fitnesse.slim.SlimServer.serve(SlimServer.java:49) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.handle(SlimService.java:154) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.acceptOne(SlimService.java:162) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.accept(SlimService.java:124) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76) [fitnesse-20160515.jar]
at fitnesse.slim.SlimService.main(SlimService.java:56) [fitnesse-20160515.jar]

@JanDuyck

This comment has been minimized.

Show comment
Hide comment
@JanDuyck

JanDuyck commented May 27, 2016

parseutil decode issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment