Hi Alex,

2007/5/21, Alex Grigorovich <[EMAIL PROTECTED]>:
Hi!

I thought you may be interested: here's a recollection of problems I
have encountered while trying to use Harmony for a small project at
work.

Thanks for the feedback, we're quite interested indeed.

First, jmock-based unit tests fail when run under Harmony's JVM.
Compiler doesn't seem to matter: both sun's and harmony's work. I have
attached a sample program which reproduces the following error:
[skipped]
This uncovers a bug in JMock2, matching reflection method instances
via identity operator ('==' vs equals()), see
jmock2/src/org/jmock/internal/matcher/MethodMatcher.java:18
I will report this issue to JMock developers until you beat me to it ;)

Second, our java.nio-based network code which works on Sun's JVM
throws a SockectExcepion on innocent-looking code:
java.net.SocketException
       at 
org.apache.harmony.luni.platform.OSNetworkSystem.select(OSNetworkSystem.java:312)
       at 
org.apache.harmony.nio.internal.SelectorImpl.selectInternal(SelectorImpl.java)
       at 
org.apache.harmony.nio.internal.SelectorImpl.select(SelectorImpl.java:167)
       at 
com.shamrock.smf.niosmpp.net.SelectorHandler.run(SelectorHandler.java:156)

These exceptions don't seem to affect the application though. They
seem to happen after setting OP_WRITE on each interesting selection
key. Relevant portion of source code looks like this (unfortunately I
cannot provide a short runnable example):

      while (true) {
           try {
               /* register new channels etc. */
               synchronized(this.writableKeys) {
                   /* for each key in writableKeys */
                   if (key.isValid()) {
                       key.interestOps(key.interestOps() |
SelectionKey.OP_WRITE);
                   }
               }
               selector.select(selectTimeout);
               Set set = selector.selectedKeys();
               /* process selected keys */
               set.clear();
           }
       }

However, the problem might as well be in buggy application code. Any
ideas on how to debug this?

I did not look closer here, we have a few decent networking experts on
the list, just wait them to speak up. BTW, do you mind to file a bug
report to JIRA for this issue?


Third, VM hard-codes default character set to iso-8859-1 instead of
using process' locale settings. Every UTF-8 user then has to manually
set file.encoding system property, or otherwise get garbage on console
when output does not fit in ASCII.
Yep, there is already a bunch of entries in our bug tracker depending
on this same issue, it must be fixed soon.

Lastly, is there a native javac adapter for ant? One can use
build.compiler=extJavac or write a custom CompilerAdapter, but a
drop-in replacement for Sun's javac would be nice. Google even finds
an implementation of com.sun.tools.javac.Main in harmony's subversion
repo, but it seems to have been removed later (for trademark
reasons?).
Sure, there is jdktools subproject which currently provides javac,
javah, keytool & jarsigner, and there is universal native starter for
all of them. The removed sources were mere duplicates between
"classlib" and "jdktools" subprojects.
Seems you've tried M1 binary snapshot, you've probably chosen a JRE
download? I believe JDK snapshots includes javac executable among
other tools...

Harmony & OS details:

$ java -version
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
Foundation or its licensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r533500, (Apr 30 2007), Linux/ia32/gcc 4.1.0, release build
http://incubator.apache.org/harmony

OS: Debian linux 4.0, kernel: 2.6.18-4-686 #1 SMP, libc-2.3.6

Thank you.

--
Alexey Grigorovich



Stay tuned, Harmony advances in a good pace. So hope to hear from you
again once in a while ;)

--
Alexey Varlamov

Reply via email to