[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orekit Developers] TLE.getLine1 problem



On 01/29/2012 06:34 PM, Petrus Hyvönen wrote:
> Hi,
> 
> JavaError: java.lang.StringIndexOutOfBoundsException: String index out
> of range: 67
>     Java stacktrace:
> java.lang.StringIndexOutOfBoundsException: String index out of range: 67
> 
> 	at java.lang.StringBuffer.charAt(Unknown Source)
> 
> 	at org.orekit.tle.TLE.checksum(TLE.java:630)
> 
> 	at org.orekit.tle.TLE.buildLine1(TLE.java:335)
> 
> 	at org.orekit.tle.TLE.getLine1(TLE.java:271)

> Epoch = 2012-01-26T11:00:00.000

[snip]

Hi,

the problem happens because of a wrong formatting of the TLE epoch:

final DecimalFormat f38  = new DecimalFormat("##0.00000000", SYMBOLS);

For epochs with a day of the year < 100 there will be no leading 0 which
results in a too short line 1.

A quick fix would be to change the format to (in TLE.java, line 295):

final DecimalFormat f38  = new DecimalFormat("000.00000000", SYMBOLS);

I will create a bug report and fix it in trunk.

Thomas