O que está errado com a lógica deste trecho. O eclipse gera um warning neste últime if… else…, dizendo que:
Statement unnecessarily nested within else clause. The corresponding
then clause does not complete normally
não entendi?!
public class LookupUtils {
public LookupUtils() {
}
private Object getService(String url, Class ServiceType[]) throws Exception{
Exception ex = null;
Object item = null;
if (System.getSecurityManager() == null)
System.setSecurityManager(new RMISecurityManager());
try {
LookupLocator locator = new LookupLocator(url);
ServiceRegistrar registrar = locator.getRegistrar();
ServiceTemplate template = new ServiceTemplate(null, ServiceType, null);
item = registrar.lookup(template);
} catch (MalformedURLException mue) {
ex = mue;
} catch (RemoteException re){
ex = re;
} catch (Exception e){
e.printStackTrace();
}
if (item == null)
throw ex;
else
return item;
}
}