Pessoal,
Tenho um método que retorna uma lista de strings e quando eu faço dessa forma funciona:
public java.lang.String[] search(java.lang.String searchRequest) throws java.rmi.RemoteException {
String[] presentationURLList = new String[5];
presentationURLList[0]="oi1";
presentationURLList[1]="oi2";
presentationURLList[2]="oi3";
presentationURLList[3]="oi4";
presentationURLList[4]="oi5";
return presentationURLList;
}
Mas quando eu faço assim não:
public java.lang.String[] search(java.lang.String searchRequest) throws java.rmi.RemoteException {
ClientDAO cDAO = (ClientDAO)DAOFactory.getDAOInstance(DAOFactory.CLIENT_DAO);
ClientFilter filter = new ClientFilter();
String[] presentationURLList = null;
try {
filter.setLink(searchRequest);
} catch(Exception e) { }
List l = null;
try {
l = cDAO.searchObjects(filter);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
long clientId = 0;
for(int i = 0; i < l.size(); i++) {
Client c = (Client) l.get(i);
clientId = c.getId();
System.out.println(c.getName());
}
DAO daoPresentation = DAOFactory.getDAOInstance(DAOFactory.PRESENTATION_DAO);
PresentationFilter filterPresentation = new PresentationFilter();
try {
filterPresentation.setClientId(clientId);
} catch(Exception e) { }
System.out.println(filterPresentation);
List presentationList;
try {
presentationList = daoPresentation.searchObjects(filterPresentation);
System.out.println("presentationList:"+presentationList.size());
presentationURLList = new String[presentationList.size()];
System.out.println("presentationURLList(antes):"+presentationURLList.length);
for(int i = 0; i < presentationList.size(); i++) {
Presentation p = (Presentation) presentationList.get(i);
presentationURLList = new String[presentationList.size()];
String teste = p.getPath().toString();
teste = teste.replace('\\', '/');
teste = teste.substring(teste.indexOf("dmdweb"));
presentationURLList[i] = "http://10.202.22.146:8082/"+teste+"/pres.ram";
System.out.println("presentationURLList["+i+"]:"+presentationURLList[i]);
}
System.out.println("presentationURLList(depois):"+presentationURLList.length);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return presentationURLList;
}
Alguém pod eme ajudar?
Obrigado.