Ciao a tutti,
qualcuno sa dirmi come gestire le eccezioni generate dal costruttore di una classe istanziata tramite il Class.forName?
Il problema è che in EccezioneDefinitaDaUtente ho questo errore: exception package1.exception.EccezioneDefinitaDaUtente is never thrown in body of corresponding try statement.codice:try{ Distributor source = null; String className = "package1.distributori."+dst.getDistributorClass(); source = (Distributor) Class.forName(className).getConstructor(String.class).newInstance(child.getPath()); } catch (ClassNotFoundException ex) { msgArea.append(ex.getCause()+"\n"); } catch (NoSuchMethodException ex){ msgArea.append(ex.getCause()+"\n"); } catch (InstantiationException ex) { msgArea.append(ex.getCause()+"\n"); } catch (IllegalAccessException ex) { msgArea.append(ex.getCause()+"\n"); } catch (IllegalArgumentException ex) { msgArea.append(ex.getCause()+"\n"); } catch (InvocationTargetException ex) { msgArea.append(ex.getCause()+"\n"); } catch (EccezioneDefinitaDaUtente ex){ // Gestisci eccezione; }
Suggerimenti?

)
Rispondi quotando