Skip to content

Color.getMatchingColorHexValue - causes Exception and contains System.out.println #22

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?

de.toolforge.googlechartwrapper.Color c = new 
de.toolforge.googlechartwrapper.Color(255, 255, 255, 0);

String rgba = c.getMatchingColorHexValue();

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String 
index out of range: 8
    at java.lang.String.substring(Unknown Source)
    at de.toolforge.googlechartwrapper.Color.getEightCharacterHexValue(Color.java:175)
    at de.toolforge.googlechartwrapper.Color.getMatchingColorHexValue(Color.java:234)
    at com.thunderingherd.incubator.chart.Test.main(Test.java:12)


What is the expected output? What do you see instead?

No exception and no output to std out.


What version of the product are you using? On what operating system?

revision 189, Win 7.


Please provide any additional information below.

As a work around, I replaced getEightCharacterHexValue with the following:

    public String getEightCharacterHexValue() {
        return String.format("%02x%02x%02x%02x", red, green, blue, alpha);
    }

Original issue reported on code.google.com by chris.lo...@gmail.com on 13 Feb 2011 at 11:52

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions