Miguel,

While, I'm not a Java programmer, my understand is different than  
what you describe. AFAIK, once an error is encountered an Exception  
is RAISED even if you do NOT have a catcher for this kind of  
exception. AFAICT, your sample will work exactly the same with the  
direct xHarbour equivalent:

//---------------------------------------------------------------------- 
---------//
#include "error.ch"

PROCEDURE Main()

    LOCAL x := {}, e

    TRY
      #if 0// Change to 1 to see explicit catcher work!
         x[1] := 0
      #else
         x := x / 0
      #endif

      ? "Will never get here, in Java nor xHarbour"
      ? "even if execption does not have any explicit catcher!"
    CATCH e
       SWITCH e:genCode
          CASE EG_BOUND
          CASE EG_NUMERR
             ? e:Description
             EXIT

          DEFAULT
             Throw( e )
       END SWITCH
    END TRY

RETURN
//---------------------------------------------------------------------- 
---------//

Ron

On Jun 26, 2008, at 9:06 AM, Miguel Angel Marchuet wrote:

> sorry but the nature of try ....
>
> i'm too java programmer
>
> and when we use
>
> try
> {
>      int x = Integer.parseInt(argv[0]);
> }
> catch (ArrayIndexOutOfBoundsException e)
> {
>      System.out.println(e);
> }
> catch (NumberFormatException e)
> {
>      System.out.println(e);
> }
>
> for example, we only catch this type of errors the rest works as  
> expected,
> this solves the problem of 0 divisions almost at C++ C# j#, harbour  
> has similar solution.
>
> What is the problem to implement the same at xharbour ?
>
> Best regards,
> Miguel Angel Marchuet
>
>
>
>
> ---------------------------------------------------------------------- 
> ---
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> xHarbour-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
>



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to