Io ho una classe che genera dei thread che fanno un certo compito. Questo compito può generare delle eccezioni. Vorrei sapere come si fa a lanciare un'eccezione dal thread chiamato alla funzione chiamante. Per essere più preciso posto il codice:
Codice PHP:
package model;

import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.sql.ResultSet;
import java.util.Iterator;

import org.jdom.Document;
import org.jdom.output.XMLOutputter;

public class 
Converter {
    
Converter(){super();}
    
Db db = new Db();
    public 
void generateXml(String idesame){
        
Esame e db.getEsame(idesame);
        
        
Iterator<Studenteitr e.getStudenti().iterator();
        
Integer i = new Integer(0);
        while(
itr.hasNext()){
            
i++;
            new 
GenerateSingleXml(itr.next(),e,i.toString());
            
        }
    }
    public class 
GenerateSingleXml implements Runnable{
        
Thread t;
        
Studente s;
        
Esame e;
        
GenerateSingleXml(Studente s,Esame eString name){
            
this.s;
            
this.e;
            
= new Thread(thisname);
            
t.start();
        }
        public 
void run() {
            
ResultSet rs db.getFileXml(es);
            
Document xml this.rsToXml(rs);
            
URL url;
            try {
                
url = new URL("ftp://ftpserver/"+
                                    
e.getIdEsame()+"/"s.getCodiceFiscale()+".xml");
                
URLConnection urlc url.openConnection();
                
OutputStream os urlc.getOutputStream();
                
XMLOutputter xmlOutputter = new XMLOutputter();
                
xmlOutputter.setFormat(org.jdom.output.Format.getPrettyFormat());
                
xmlOutputter.output(xmlos);
                
os.close();
            }
            catch (
MalformedURLException e1) {
                
// TODO Auto-generated catch block
                
e1.printStackTrace();
            }
            catch (
IOException e){
                
e.printStackTrace();
            }
        }
        
        public 
Document rsToXml(ResultSet rs){
            return 
null;
        }
    }

Ora se io voglio definire throws il metodo run con le eccezioni MalformedURLException e IOException allo scopo di gestire l'eccezione nel metodo generateXml mi dice che non è compatibile con il metodo run.
Quindi la domanda è: come faccio ad accorgermi dentro il metodo generateXml che è avvenuta un'eccezione nei thread generati?
Grazie per l'attenzione.