JDK java.lang.IllegalArgumentException: Illegal pattern character 'u'

0 votes
asked May 20, 2016 in Bug by krasa (820 points)

Since version 8037

rendering with a syntax error does not return a nice error image, but fails on 


java.lang.IllegalArgumentException: Illegal pattern character 'u'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:768)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:575)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:500)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:475)
at net.sourceforge.plantuml.graphic.DateEventUtils.addEvent(DateEventUtils.java:60)
at net.sourceforge.plantuml.graphic.GraphicStrings.getTextBlock(GraphicStrings.java:130)
at net.sourceforge.plantuml.graphic.GraphicStrings.calculateDimension(GraphicStrings.java:152)
at net.sourceforge.plantuml.graphic.GraphicStrings.drawU(GraphicStrings.java:135)
at net.sourceforge.plantuml.ugraphic.ImageBuilder.getFinalDimension(ImageBuilder.java:159)
at net.sourceforge.plantuml.ugraphic.ImageBuilder.writeImageInternal(ImageBuilder.java:128)
at net.sourceforge.plantuml.ugraphic.ImageBuilder.writeImageTOBEMOVED(ImageBuilder.java:123)
at net.sourceforge.plantuml.PSystemError.exportDiagram(PSystemError.java:118)
at net.sourceforge.plantuml.SourceStringReader.generateImage(SourceStringReader.java:113)
    SourceStringReader reader = new SourceStringReader("@startuml\n" +
    "xxx\n" +
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    reader.generateImage(os, 0, new FileFormatOption(FileFormat.PNG));


JDK 1.7+ works fine, JDK fails

1 Answer

0 votes
answered May 21, 2016 by plantuml (295,000 points)
selected Jun 8, 2016 by krasa
Best answer
Thanks for the feedback.

It's an issue with the Locale.

This has been fixed in last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

Tell us if it's working for you.

commented May 21, 2016 by krasa (820 points)
It does not, new SimpleDateFormat("MM-dd-u", Locale.US) does not work for me - Illegal pattern character 'u'
commented May 21, 2016 by plantuml (295,000 points)
Could you try : new SimpleDateFormat("MM-dd-u", Locale.ENGLISH)
commented May 21, 2016 by krasa (820 points)
same, I looked into docs, and 'u' is not in the table in JDK 1.6...
commented May 21, 2016 by plantuml (295,000 points)
Ok, let's not use this 'u' anymore.
You'll find a new corrected beta here https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
If you need the patched class, it's here

Tell us if it's still not working for you!
commented May 21, 2016 by krasa (820 points)
that works fine, thanks!