Visual Snippet Editor: Forgets Java Syntax
I have the following visual snippet which does not work. Can you spot the error?
‘RemoveLeadingZeros’ is a java snippet that returns a String. I then need to see if the string is a length greater than one.
My snippet is marked with the error: “length() is not a method of string”.
It’s difficult to spot the error in my code because THERE’S NOTHING WRONG. The editor is just stupid. I have the exact same pattern but using variables defined as the output to my BO Map, and it works fine. The only difference is that I have a local variable in the middle.
The visual snippet editor tells me that “aptn” does not have a method “length()”. If I mouse over “aptn”, it correctly identifies it as a string. My only conclusion (beyond never ever waste your time in this editor) is that because it’s a java snippet call, the editor doesn’t properly map from java.lang.String to an XSD String.
My solution? Make the ridiculous aptn.toString().length() call.
I guess this is why java.util.String has a .toString() method, to account for poor user interfaces.
UPDATE 2:07PM: This is what I really hate about the visual snippet editor. I went and deleted the snippets that used “aptn” and re-created the whole thing from scratch. No problems.
Related Posts
- WebSphere Integration Developer: Visual Snippet Java Code Generation Is Non-Deterministic
- Avoid the WebSphere Integration Developer Debugger
- BOFactory: create(..) or createByElement(..) ?
- WebSphere Integration Developer: Struggling with the Business Object Mapper
- WebSphere Adapter for JDBC: Superfluous RecordNotFound Exceptions
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply