to com uma duvida aqui, que acho estranho.
Tenho uma aplicação que faz conexão via WS com meu banco de dados, no momento que estou recebendo os dados no palm ele acusa java.lang.NullPointerException, daí ele para a sincronização. Eu sei que o dado que estou recebendo está nulo. Quero q se mantenha nulo e ele ignore essa exceção.
public void run() {
System.out.println("SyncJazidas.run()");
JazidaMobileWSService_Stub stub = new JazidaMobileWSService_Stub();
String protocolo = "http";
String servidor = getMidlet().getConfSisDAO().getConfSis().getUrlServidor();
String porta = getMidlet().getConfSisDAO().getConfSis().getPortaServidor();
String url = protocolo + "://" +
servidor + ":" +
porta + "/" +
Constantes.SISTEMA_REMOTO + "/" +
urlServico;
System.out.println("Conectando a " + url);
stub._setProperty(JazidaMobileWSService_Stub.ENDPOINT_ADDRESS_PROPERTY,
url);
try {
Jazida[] jazidas = stub.getJazidas();
if (jazidas == null) {
getMidlet().adicionaProgressoGA();
} else {
JazidaDAO jazidaDAO = new JazidaDAO();
jazidaDAO.removeAll();
System.out.println("Recebendo " + jazidas.length + " jazidas");
for (int i = 0; i < jazidas.length; i++) {
System.out.println("jazidas[i]>>" + jazidas[i].getNome() + " cd >>" + jazidas[i].getCd());
jazidaDAO.addImpl(jazidas[i]);
}
getMidlet().adicionaProgressoGA();
}
} catch (RemoteException ex) {
Alert a = new Alert("ERRO", "Erro na comunica" + Constantes.cedilha + Constantes.a_minusculo_til + "o com o servidor!", null, AlertType.WARNING);
a.setTimeout(Alert.FOREVER);
getMidlet().showAlert(a);
ex.printStackTrace();
} catch (FloggyException ex) {
Alert a = new Alert("ERRO", "Erro na armazanagem dos dados!", null, AlertType.WARNING);
a.setTimeout(Alert.FOREVER);
getMidlet().showAlert(a);
ex.printStackTrace();
}
}
O estranho é que a mensagem de erro nao é nenhuma dessas aí em cima e sim em outra classe
public void run(){
try {
ServicesMovelService_Stub stub = new ServicesMovelService_Stub();
String protocolo = "http";
String servidor = getMidlet().getConfSisDAO().getConfSis().getUrlServidor();
String porta = getMidlet().getConfSisDAO().getConfSis().getPortaServidor();
String url = protocolo + "://" +
servidor + ":" +
porta + "/" +
Constantes.SISTEMA_REMOTO + "/" +
urlServico;
System.out.println("Conectando a " + url);
stub._setProperty(ServicesMovelService_Stub.ENDPOINT_ADDRESS_PROPERTY,
url);
xml.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
xml.append("<root>");
//Fichas diarias de centro de custo, Alimentacao e Transporte
montaFDCC(xml);
//Fichas de Manutencao, Lubrificacao e abastecimento
this.syncFMNT.adicionaFMNTXML(xml);
//Fichas Distribuicao de FM e EPI
this.syncFDFE.adicionaFDFEXML(xml);
//Ficha de Carga de Material
this.syncCargaMaterial.adicionaXML(xml);
//Ficha de Descarga de Material
this.syncDescargaMaterial.adicionaXML(xml);
xml.append("</root>");
System.out.println(xml.toString());
String resultado = stub.receberXML(xml.toString());
System.out.println("Resultado do envio: " + resultado);
if (resultado.equals("sucesso")) {
getMidlet().adicionaProgressoGA();
fdccDAO.removeAll();
fmevDAO.removeAll();
fdfeDAO.removeAll();
cargaMaterialDAO.removeAll();
descargaMaterialDAO.removeAll();
getMidlet().atualizaBanco();
Alert a = new Alert("OK", "Dados Envidos/Recebidos com sucesso!", null, AlertType.INFO);
a.setTimeout(Alert.FOREVER);
getMidlet().showAlert(a);
} else {
getMidlet().cancelaSincronismo();
Alert a = new Alert("ERRO", "Não foi possível enviar os dados. Tente mais tarde.", null, AlertType.WARNING);
a.setTimeout(Alert.FOREVER);
getMidlet().showAlert(a);
}
} catch (FloggyException ex) {
ex.printStackTrace();
} catch (RemoteException ex) {
Alert a = new Alert("ERRO", "Não foi possível receber jazida", null, AlertType.WARNING);
a.setTimeout(Alert.FOREVER);
getMidlet().showAlert(a);
ex.printStackTrace();
}catch(Exception ex){
Alert a = new Alert("ERRO", "Erro no sync...", null, AlertType.WARNING); // é essa mensagem q no palm aparece
a.setTimeout(Alert.FOREVER);
getMidlet().showAlert(a);
ex.printStackTrace();
}
}
se alguem puder me ajudar eu agradeço
abraços