Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-21 Thread Andrew Zhang
Dear all, When I investigated the code, I found there was only one error code which needs to be handled. It's HYPORT_ERROR_SOCKET_WOULDBLOCK. The better thing I discovered is that after catching this exception, then handle routine looks like: catch( the exception ) { // it should return null

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-21 Thread Mikhail Loenko
I'd prefer not to throw an exception :) Thanks, Mikhail 2006/7/21, Andrew Zhang [EMAIL PROTECTED]: Dear all, When I investigated the code, I found there was only one error code which needs to be handled. It's HYPORT_ERROR_SOCKET_WOULDBLOCK. The better thing I discovered is that after

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-21 Thread Andrew Zhang
Hi Mikhail, you have agreed with it before :) On 7/21/06, Mikhail Loenko [EMAIL PROTECTED] wrote: I'd prefer not to throw an exception :) Thanks, Mikhail 2006/7/21, Andrew Zhang [EMAIL PROTECTED]: Dear all, When I investigated the code, I found there was only one error code which

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-20 Thread Tim Ellison
Andrew Zhang wrote: Hi everyone, I have one more question: Which exception should be thrown whose error code is unused? Let's consider native throwJavaNetSocketException quoted from nethelp.c: void throwJavaNetSocketException (JNIEnv * env, I_32 errorNumber) { jclass aClass;

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-19 Thread Andrew Zhang
Hi everyone, I have one more question: Which exception should be thrown whose error code is unused? Let's consider native throwJavaNetSocketException quoted from nethelp.c: void throwJavaNetSocketException (JNIEnv * env, I_32 errorNumber) { jclass aClass; char *errorMessage =

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-18 Thread Jimmy, Jing Lv
Alexey Varlamov wrote: IMHO, throwing a subclass certainly fits to specification and can hardly break compatibility with RI. I consider this is the proper workaround for now. Just my $0.02 :) Thanks Alexey, I have no objection if it does not break compatibility guideline :) -- Alexey

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-18 Thread Andrew Zhang
Seems most people prefer subclass to SocketException with ErrorCodeException cause. Does anyone prefer the latter? or both are acceptable? I think we'd better made an agreement about this issue. Mikhail, how do you think about it? Which one do you prefer? :) I'll fix Harmony-815 once decision

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-18 Thread Mikhail Loenko
2006/7/18, Andrew Zhang [EMAIL PROTECTED]: Seems most people prefer subclass to SocketException with ErrorCodeException cause. Does anyone prefer the latter? or both are acceptable? I think we'd better made an agreement about this issue. Mikhail, how do you think about it? Which one do you

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-17 Thread Richard Liang
LvJimmy,Jing wrote: Hi Andrew: Sorry for late, but as this solution does not resolve I18N (working aound for 815 only?) , I guess we may have another way. If I understand correctly, this solution try to analysis error code in native code, throws ErrorCodeException; and java code catch this

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-17 Thread Richard Liang
David Tanzer wrote: On 17.07.2006, at 14:09, Richard Liang wrote: LvJimmy,Jing wrote: Hi Andrew: Sorry for late, but as this solution does not resolve I18N (working aound for 815 only?) , I guess we may have another way. If I understand correctly, this solution try to analysis error

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-17 Thread Andrew Zhang
On 7/17/06, David Tanzer [EMAIL PROTECTED] wrote: On 17.07.2006, at 14:09, Richard Liang wrote: LvJimmy,Jing wrote: Hi Andrew: Sorry for late, but as this solution does not resolve I18N (working aound for 815 only?) , I guess we may have another way. If I understand correctly, this

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-17 Thread Jimmy, Jing Lv
David Tanzer wrote: On 17.07.2006, at 14:09, Richard Liang wrote: LvJimmy,Jing wrote: Hi Andrew: Sorry for late, but as this solution does not resolve I18N (working aound for 815 only?) , I guess we may have another way. If I understand correctly, this solution try to analysis error code

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-17 Thread Alexey Varlamov
IMHO, throwing a subclass certainly fits to specification and can hardly break compatibility with RI. I consider this is the proper workaround for now. Just my $0.02 :) -- Alexey Varlamov In this case, I guess if we set the cause to null when catching the SocketException will properly solve

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-16 Thread LvJimmy,Jing
Hi Andrew: Sorry for late, but as this solution does not resolve I18N (working aound for 815 only?) , I guess we may have another way. If I understand correctly, this solution try to analysis error code in native code, throws ErrorCodeException; and java code catch this exception, get error

Re: I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-13 Thread Andrew Zhang
Hi Vladimir, Where exceptions should be thrown is a big question in this thread. Native code or Java code or mixed? Shall we avoid throwing all exceptions in Harmony native code? If all exceptions are thrown in java code, there is no need to involve any other I18N utilities (i.e. log4cXXX).

Re: I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-13 Thread Paulex Yang
Mikhail Loenko wrote: I suggest that we: 1) avoid throwing exceptions from native code I have no strong feelings yet which is better, to throw Exception in native codes directly or always to return error codes to Java. There are different styles in Java and C programming on error handling, C

Re: I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-13 Thread Vladimir Gorr
On 7/13/06, Andrew Zhang [EMAIL PROTECTED] wrote: Hi Vladimir, Where exceptions should be thrown is a big question in this thread. Native code or Java code or mixed? Yes, I'm aware about this. However I'd prefer to have other subject for this thread :-). Thanks, Vladimir. Shall we avoid

Re: I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-13 Thread Mikhail Loenko
Minor note: I havn't insisted that we *always* return error code rather than throw Exception, instead I suggest that we avoid throwing exceptions from native whenever possible. I thought that native calls that don't throw exceptions might be optimized by JIT. But it's only a guess, I leave it

Re: I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-13 Thread Andrew Zhang
On 7/13/06, Mikhail Loenko [EMAIL PROTECTED] wrote: Minor note: I havn't insisted that we *always* return error code rather than throw Exception, AFAIK, luni and nio modules always throw exception rather than return error code. instead I suggest that we avoid throwing exceptions from

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-13 Thread Tim Ellison
Andrew Zhang wrote: How about design a subclass which extends from SocketException, looks like: If you want to preserve the throwable type you could create a o.a.h.luni.ErrorCodeException that has a errorCode field set by the native, and then make that the cause of the SocketException. The

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-13 Thread Geir Magnusson Jr
I like this Tim Ellison wrote: Andrew Zhang wrote: How about design a subclass which extends from SocketException, looks like: If you want to preserve the throwable type you could create a o.a.h.luni.ErrorCodeException that has a errorCode field set by the native, and then make that the

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-13 Thread Andrew Zhang
On 7/14/06, Tim Ellison [EMAIL PROTECTED] wrote: Andrew Zhang wrote: How about design a subclass which extends from SocketException, looks like: If you want to preserve the throwable type you could create a o.a.h.luni.ErrorCodeException that has a errorCode field set by the native, and then

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-13 Thread Andrew Zhang
On 7/14/06, Tim Ellison [EMAIL PROTECTED] wrote: Andrew Zhang wrote: How about design a subclass which extends from SocketException, looks like: If you want to preserve the throwable type you could create a o.a.h.luni.ErrorCodeException that has a errorCode field set by the native, and then

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-13 Thread Richard Liang
Andrew Zhang wrote: On 7/14/06, Tim Ellison [EMAIL PROTECTED] wrote: Andrew Zhang wrote: How about design a subclass which extends from SocketException, looks like: If you want to preserve the throwable type you could create a o.a.h.luni.ErrorCodeException that has a errorCode field set by

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-13 Thread Andrew Zhang
On 7/14/06, Richard Liang [EMAIL PROTECTED] wrote: Andrew Zhang wrote: On 7/14/06, Tim Ellison [EMAIL PROTECTED] wrote: Andrew Zhang wrote: How about design a subclass which extends from SocketException, looks like: If you want to preserve the throwable type you could create a

Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-13 Thread Andrew Zhang
Hi folks, I'd like to adopt Tim's suggestion to solve Harmony-815. It avoids message comparison while keeps current luni native architecture. Before I upload a new patch to JIRA, I want to hear more voices from the community. Any better suggestions? Any comments? Mikhail, what's your opnion?

Re: Solution on Harmony-815 (was Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-13 Thread Mikhail Loenko
Hi Andrew this seems reasonable Thanks, Mikhail 2006/7/14, Andrew Zhang [EMAIL PROTECTED]: Hi folks, I'd like to adopt Tim's suggestion to solve Harmony-815. It avoids message comparison while keeps current luni native architecture. Before I upload a new patch to JIRA, I want to hear more

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-12 Thread Andrew Zhang
Hello Mikhail, Please see my comments inline. Thanks! On 7/12/06, Mikhail Loenko [EMAIL PROTECTED] wrote: 2006/7/12, Andrew Zhang [EMAIL PROTECTED]: Hi Mikhail, It's a NON-NLS message. Native code is designed in this way. Currently, Harmony socket native code uses messages in

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-12 Thread Jimmy, Jing Lv
Andrew Zhang wrote: Hello Mikhail, Please see my comments inline. Thanks! On 7/12/06, Mikhail Loenko [EMAIL PROTECTED] wrote: 2006/7/12, Andrew Zhang [EMAIL PROTECTED]: Hi Mikhail, It's a NON-NLS message. Native code is designed in this way. Currently, Harmony socket native code uses

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-12 Thread Mikhail Loenko
-1 for applying the patch Applying this patch means creating a hidden problem Thanks, Mikhail 2006/7/12, Jimmy, Jing Lv [EMAIL PROTECTED]: Andrew Zhang wrote: Hello Mikhail, Please see my comments inline. Thanks! On 7/12/06, Mikhail Loenko [EMAIL PROTECTED] wrote: 2006/7/12, Andrew

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-12 Thread Andrew Zhang
Hello Mikhail, I think it's about native source architecture design. The patch is made based on current native source code. Of course, Ihow to design a native and java interface is a good topi for discussion on mailing list. But, could you please suggest what shall I do next? Change all native

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-12 Thread LvJimmy,Jing
Hi Mikhail: This applying is not creating a hidden problem, as this code exists already. If I remember correctly, the last patch to DatagramChannelImpl removes this code, however later find it still necessary. And I remember SocketChannel also contain such code similar to this. I see no

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-12 Thread Geir Magnusson Jr
I agree with the reason why (I think I understand it - you don't want to rely on the result of getMessage() to determine the problem...) Could you wrap the socket exception to carry a simple integer error code? geir Mikhail Loenko wrote: -1 for applying the patch Applying this patch means

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-12 Thread Andrew Zhang
Hello Geir, I also mention this solution as option.1. But it has to be portable error code, which should be defined in portlib. Thanks! On 7/13/06, Geir Magnusson Jr [EMAIL PROTECTED] wrote: I agree with the reason why (I think I understand it - you don't want to rely on the result of

I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-12 Thread Jimmy, Jing Lv
Hi: I'd like to raise the topic on I18N of native code. As discussed about patch-815, we found there are exceptions thrown by native code with un-internationalized error message. To resolve this problem, there may be two solutions: 1) make native code return error code instead of throw

Re: I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-12 Thread Andrew Zhang
On 7/13/06, Jimmy, Jing Lv [EMAIL PROTECTED] wrote: Hi: I'd like to raise the topic on I18N of native code. As discussed about patch-815, we found there are exceptions thrown by native code with un-internationalized error message. To resolve this problem, there may be two solutions:

Re: I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-12 Thread Mikhail Loenko
I suggest that we: 1) avoid throwing exceptions from native code 2) don't parse exception messages in the code (use subclasses of exceptions when necessary) Thanks, Mikhail 2006/7/13, Andrew Zhang [EMAIL PROTECTED]: On 7/13/06, Jimmy, Jing Lv [EMAIL PROTECTED] wrote: Hi: I'd like to

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-12 Thread Paulex Yang
Seems workable, but the exception messages thrown by native codes still need to be internationalized, you may want to invoke Msg.getString() to get the localized message as what Java codes do, but of course this is another issue. Andrew Zhang wrote: How about design a subclass which extends

Re: I18N on native (was:Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.)

2006-07-12 Thread Vladimir Gorr
On 7/13/06, Jimmy, Jing Lv [EMAIL PROTECTED] wrote: Hi: I'd like to raise the topic on I18N of native code. As discussed about patch-815, we found there are exceptions thrown by native code with un-internationalized error message. To resolve this problem, there may be two solutions: 1)

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-11 Thread Andrew Zhang
Hi Mikhail, It's a NON-NLS message. Native code is designed in this way. Currently, Harmony socket native code uses messages in SocketException to identify error type. To avoid the confusion, two alternatives way I could image are: 1. Native code returns platform-independent error code. 2.

Re: [jira] Commented: (HARMONY-815) [classlib][nio] Refine implConfigureBlocking(boolean) method of DatagramChannel and SocketChannel.

2006-07-11 Thread Mikhail Loenko
2006/7/12, Andrew Zhang [EMAIL PROTECTED]: Hi Mikhail, It's a NON-NLS message. Native code is designed in this way. Currently, Harmony socket native code uses messages in SocketException to identify error type. To avoid the confusion, two alternatives way I could image are: 1. Native code