I'm asking if there is a way to pass parameter between try/catch block.

in other word:

i have a method:

 

public void invia(OiStorto invioaca) throws Exception {

       

         Long id=0L;

       

        try {

               //some code

     for (VElenpere elenpere : elenperes) {

                popolaScompiute(anno, inviaEOI0, param, opempiute, elenpere,id);

            }

} catch (Exception e) {

            e.printStackTrace();

            logger.error(e, e);

           

            throw e;

the method called in the for:

private void popolaScompiute(Long anno, InviaEOI inviaEOI0, _4IntegerType param, ElOpeIncType opereIncompiute,

            VElencoOpere elencoOpere,Long id) {

 

        try {

          //some code

     for (OiOpera opere : oiOpere){

             

                id=opere.getIdOpera();

                poputa(opereIncompiute, operaSingola, opere);

            }

} catch (NullPointerException e) {

            e.printStackTrace();

            id=opere.getIdOpera();

            throw e;

        }

 

   

and finally the method in which the error can occur (the method poputa is called for every id)

 

private void poputa(ElOpeIncType opereIncompiute, OpeIncType operaSingola, OiOpera opere) {

 

try {

 

//some code

 

} catch (NullPointerException e) {

            e.printStackTrace();

            //return id;

        }

       

So method invia call the method popolaScompiute, inside popolaScompiute there is an iteraction through some id and for some id can occur an error; what i want is the getting the value of id in the first method invia, using the block try/catch.

 

is there a way to accomplish this?

 

thanks really much

Francesco

Italy

FacebookTwitterLinkedin
Pin It
Joomla Tutorials for Beginners