Escaping colons

5 views
Skip to first unread message

WarnerJan Veldhuis

unread,
Dec 14, 2010, 6:29:02 AM12/14/10
to javabu...@googlegroups.com
Hey,

This is not about someones intestines making a run for it, but about how to handle : in a String...

Here's the yaml that I have:

- JPanel(name=ItemPanel3):
    - JLabel(name=Title3, text="Story: How to work with objects")

Even though the colon is escaped by placing it between quotes, the yaml parse still pukes over it:

org.javabuilders.BuildException: Unable to find setter method: javax.swing.JPanel.setJLabel(name=Title0, text="Story
    at org.javabuilders.handler.DefaultPropertyHandler.handle(DefaultPropertyHandler.java:86)
    at org.javabuilders.Builder.handleProperty(Builder.java:867)
    at org.javabuilders.Builder.processDocumentNode(Builder.java:560)
    at org.javabuilders.Builder.processDocumentNode(Builder.java:543)
    at org.javabuilders.Builder.handleType(Builder.java:708)
    at org.javabuilders.Builder.processDocumentNode(Builder.java:510)
    at org.javabuilders.Builder.processDocumentNode(Builder.java:543)
    at org.javabuilders.Builder.handleType(Builder.java:708)
    at org.javabuilders.Builder.processDocumentNode(Builder.java:510)
    at org.javabuilders.Builder.executeBuild(Builder.java:449)
    at org.javabuilders.Builder.buildFromString(Builder.java:324)
    at org.javabuilders.Builder.buildFromString(Builder.java:278)
    at org.javabuilders.swing.SwingJavaBuilder.build(SwingJavaBuilder.java:103)

How do I work around this?

Cheers,

WarnerJan

Jacek Furmankiewicz

unread,
Dec 14, 2010, 8:55:42 AM12/14/10
to JavaBuilders
Unfortunately, there is no simple workaround besides putting the
string into a resource file
and referring to the resource name instead :-(

This is the only shortcoming of our compact YAML syntax.

You can raise it with SnakeYAML as a defect.

But log it as a defect on our end too...maybe we can simply define a
placeholder character like ":"
and I could manually convert it to the proper value.

Actually, try ":" instead of ":" and let me know what
happens...maybe Swing will actually handle it.
if not, submit it as an enhancement on our end

Cheers,
Jacek

WarnerJan Veldhuis

unread,
Dec 14, 2010, 10:19:53 AM12/14/10
to javabu...@googlegroups.com
Using Unicode characters works like a charm:

- JPanel(name=ItemPanel3):
    - JLabel(name=Title3, text="Story\u003A How to work with objects")

It might be worth mentioning this in the docs chapter 2.3.

I'll still report it at SnakeYAML though...


> Date: Tue, 14 Dec 2010 05:55:42 -0800
> Subject: Re: Escaping colons
> From: jac...@gmail.com
> To: javabu...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "JavaBuilders" group.
> To post to this group, send email to javabu...@googlegroups.com.
> To unsubscribe from this group, send email to javabuilders...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/javabuilders?hl=en.
>

Jacek Furmankiewicz

unread,
Dec 14, 2010, 1:56:49 PM12/14/10
to javabu...@googlegroups.com
The previous YAML parser did the same thing, so it's probably a case of us violating the YAML standard with this :-)
Reply all
Reply to author
Forward
0 new messages