View Single Post
Old 09-24-2012, 09:54 PM   #111
ihor
Enthusiast
ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'ihor understands when you whisper 'The dog barks at midnight.'
 
Posts: 43
Karma: 42986
Join Date: Aug 2011
Location: Lviv, Ukraine
Device: Kindle DX Graphite
well, since I fixed my problem now, I would like to tell what I am trying to do.
Here is the code:

Spoiler:
package com.amazon.ebook.booklet.reader.resources;

import java.util.ListResourceBundle;
import java.util.*;
import java.io.*;

public class ReaderResources_en_US extends ListResourceBundle
{
static final Object a[][];

private static String fontSizesStringDefault = "15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,3 1,32,33,34,35";
private static int fontSizesDefault[] = new int[] { 15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 ,32,33,34,35 };
private static String fontLetterDefault = "a";

private static int[] fontSizes = fontSizesDefault;
private static String fontLetter = fontLetterDefault;

private static void readConfig()
{
FileInputStream fis = null;
try {
fis = new FileInputStream("/mnt/us/system/com.amazon.ebook.booklet.reader/fontfix.pref");
Properties p = new Properties();
p.load(fis);
fontLetter = p.getProperty("FONT_LETTER", "a");
String sizes = p.getProperty("FONT_SIZES", fontSizesStringDefault);
String sArray[] = sizes.split(",");
fontSizes = new int[sArray.length];
for (int i = 0; i < sArray.length; ++i) {
fontSizes[i] = Integer.parseInt(sArray[i]);
}
}
catch (Exception e)
{
fontLetter = fontLetterDefault;
fontSizes = fontSizesDefault;
}
try {
if (fis != null) {
fis.close();
}
}
catch (IOException ex) {}
}

public ReaderResources_en_US()
{
}

static
{
readConfig();
a = (new Object[][] {
new Object[] {
"mobireader.default.font.size.list", fontSizes
}
});
}

public Object[][] getContents()
{
return a;
}
}


when I comment the line readConfig(); in static constructor - it works fine: I see my font sizes with just letter a.

when I uncomment the line readConfig();, I see - to my surprise - OLD SET OF FONT SIZES. As if there are no absolutely en_US resource.

Question: why does it happen? It seems as if java runtime doesn't want to load this class when it sees a method call in static constructor. but why?

I am not a java programmer, so if anyone can help with this - I'll be grateful.
ihor is offline   Reply With Quote