Re: Japanese Locale Throws Exception

"Nair, Biju" <[email protected]>
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <F29E6034141FEC43A391FFDC5EEC42C22507DF@MSPM1BMSGM41.ent.core.medtronic.com>
Hi Jeroen,

That helped and the app works fine on the Japanese OS. Used the 7.2.4630.5 version.

Thank you very much.

--- Biju

From: Jeroen Frijters [mailto:[email protected]]
Sent: Wednesday, December 04, 2013 12:07 AM
To: Nair, Biju; [email protected]
Subject: RE: Japanese Locale Throws Exception

Hi Biju,

It did some more investigation and it appears to be caused by an unrecognized file.encoding (which is not surprising given that this value is derived from the .NET default encoding in the hopes this matches with the Java names). Manually setting the file.encoding system property (before running any Java code) should solve the problem.

        Dictionary<string, string> props = new Dictionary<string, string>();
        props.Add("file.encoding", "UTF-8");
        ikvm.runtime.Startup.setProperties(props);

BTW, I was able to reproduce the problem with 7.0 and 7.1, but not with 7.2.4630.7 due to optimizations in ConcurrentHashMap to avoid reflection.

Regards,
Jeroen

From: Nair, Biju [mailto:[email protected]]
Sent: Tuesday, December 3, 2013 22:58
To: Jeroen Frijters; [email protected]<mailto:[email protected]>
Subject: RE: Japanese Locale Throws Exception

Hi Jeroen,

I investigated further and seems like the errors are caused the static blocks in java which seems to be in line with what you were suggesting. So I tried doing the dummy ConcurrentHashMap() after upgrading to the latest IKVM version. Now the exception seems to be around charsets. Code and exception are below. Any ideas on how to proceed would be really helpful.

    static {
       try {
              java.util.concurrent.ConcurrentHashMap hash = new java.util.concurrent.ConcurrentHashMap();
              hash.put(new Object(), new Object());
       } catch (Exception e) { }
        // Format for logging timestamp.
        DATE_FORMATTER = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss:SSSS");
    }

    static {
       try {
              java.util.concurrent.ConcurrentHashMap hash = new java.util.concurrent.ConcurrentHashMap();
              hash.put(new Object(), new Object());
       } catch (Exception e) { }

       // default timezone to UTC
        try {
            TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
        } catch (Exception e) { }

        // create instance of Gregorian Calendar here to save performance
        GREGORIAN_CALENDAR = GregorianCalendar.getInstance(TimeZone.getDefault());

        // calendar instance used for various functions
        m_calendar = new GregorianCalendar();
    }


System.TypeInitializationException: The type initializer for 'com.medtronic.diabetes.device.common.Util' threw an exception. ---> System.TypeInitializationException: The type initializer for 'sun.util.calendar.ZoneInfoFile' threw an exception. ---> System.TypeInitializationException: The type initializer for 'java.nio.charset.StandardCharsets' threw an exception. ---> System.TypeInitializationException: The type initializer for 'java.lang.StdIO' threw an exception. ---> java.lang.NullPointerException: charset is null
   --- End of inner exception stack trace ---
   at java.lang.System.get_out()
   at java.lang.Class$3.run()
   at java.lang.Class$3.run()
   at java.security.AccessController.doPrivileged(Object , AccessControlContext , CallerID )
   at java.security.AccessController.doPrivileged(PrivilegedAction action, CallerID )
   at java.lang.Class.checkInitted()
   at java.lang.Class.privateGetDeclaredConstructors(Boolean )
   at java.lang.Class.getConstructor0(Class[] , Int32 )
   at java.lang.Class.newInstance0(CallerID )
   at java.lang.Class.newInstance(CallerID )
   at sun.nio.cs.FastCharsetProvider.lookup(String )
   at sun.nio.cs.FastCharsetProvider.charsetForName(String charsetName)
   at java.nio.charset.Charset.lookup2(String )
   at java.nio.charset.Charset.lookup(String )
   at java.nio.charset.Charset.forName(String charsetName)
   at java.nio.charset.StandardCharsets..cctor()
   --- End of inner exception stack trace ---
   at java.util.zip.ZipFile..ctor(File file, Int32 mode)
   at java.util.zip.ZipFile..ctor(String name)
   at IKVM.Internal.VirtualFileSystem.Initialize()
   at IKVM.Internal.VirtualFileSystem.GetVfsEntry(String name)
   at IKVM.Internal.VirtualFileSystem.GetBooleanAttributes(String path)
   at IKVM.NativeCode.java.io.Win32FileSystem.getBooleanAttributes(Object _this, File f)
   at java.io.Win32FileSystem.getBooleanAttributes(File )
   at java.io.File.exists()
   at java.io.Win32FileSystem.canonicalize(String )
   at IKVM.NativeCode.sun.nio.fs.NetPath.toRealPathImpl(String path)
   at sun.nio.fs.NetPath.toRealPath(LinkOption[] )
   at sun.util.calendar.ZoneInfoFile$1.run()
   at sun.util.calendar.ZoneInfoFile$1.run()
   at java.security.AccessController.doPrivileged(Object , AccessControlContext , CallerID )
   at java.security.AccessController.doPrivileged(PrivilegedAction action, CallerID )
   at sun.util.calendar.ZoneInfoFile..cctor()
   --- End of inner exception stack trace ---
   at sun.util.calendar.ZoneInfoFile.getZoneInfo(String id)
   at sun.util.calendar.ZoneInfo.getTimeZone(String ID)
   at java.util.TimeZone.getTimeZone(String , Boolean )
   at java.util.TimeZone.setDefaultZone()
   at java.util.TimeZone.getDefaultRef()
   at java.util.TimeZone.getDefault()
   at java.text.SimpleDateFormat.initializeCalendar(Locale )
   at java.text.SimpleDateFormat..ctor(String pattern, Locale locale)
   at java.text.SimpleDateFormat..ctor(String pattern)
   at com.medtronic.diabetes.device.common.Util..cctor()
   --- End of inner exception stack trace ---
   at com.medtronic.diabetes.device.common.Util.setUseProviderBasedLogging(Boolean useProviderBasedLogging)

--- Biju


[CONFIDENTIALITY AND PRIVACY NOTICE]

Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain information that is private, privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please delete this mail from your records.
 
To view this notice in other languages you can either select the following link or manually copy and paste the link into the address bar of a web browser: http://emaildisclaimer.medtronic.com

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.