I'm building a project through GWT and Eclipse for the realization of a site similar to Yahoo Answer, until a few days ago it was working perfectly but since yesterday I noticed a bug that I didn't see before and it's very strange because I would have noticed. Basically on the console of Google Chrome I receive an Uncaught error when I try to visualize the answers related to a question, it seems as if the database (mapdb 1.0.9) does not return anything
For compatibility problems i'm using Eclipse Mars for Java 7 (1.7) and GWT 2.8.0 I will post the part of the code that is not reproduced by clicking on the question
public class MostraRisposte {
private VerticalPanel verticalPanel = null;
public MostraRisposte(VerticalPanel verticalPanel) {
this.verticalPanel = verticalPanel;
}
public void onModuleLoad(Domanda currentSelection) {
this.verticalPanel.add(new HTML("<br>"));
this.verticalPanel.add(new HTML("<br>"));
final Grid answerGridPanel = new Grid(8, 2);
answerGridPanel.setWidget(0, 0, new Label("Utente: "));
answerGridPanel.setWidget(0, 1, new Label(currentSelection.getUserName()));
answerGridPanel.setWidget(1, 0, new Label("Testo: "));
answerGridPanel.setWidget(1, 1, new Label(currentSelection.getText()));
answerGridPanel.setWidget(2, 0, new Label("Data: "));
answerGridPanel.setWidget(2, 1, new Label(currentSelection.getDay()));
answerGridPanel.setWidget(4, 0, new Label("Link1: "));
answerGridPanel.setWidget(4, 1, new Label(currentSelection.getLinkList().get(0)));
answerGridPanel.setWidget(5, 0, new Label("Link2: "));
answerGridPanel.setWidget(5, 1, new Label(currentSelection.getLinkList().get(1)));
answerGridPanel.setWidget(6, 0, new Label("Link3: "));
answerGridPanel.setWidget(6, 1, new Label(currentSelection.getLinkList().get(2)));
answerGridPanel.setWidget(7, 0, new Label("Link4: "));
answerGridPanel.setWidget(7, 1, new Label(currentSelection.getLinkList().get(3)));
this.verticalPanel.add(answerGridPanel);
final GwaServiceAsync gwanswer = GWT.create(GwaService.class);
final int id = currentSelection.getIdQuestion();
gwanswer.ordinaRisposte(id, new AsyncCallback<List<Risposta>>() {
@Override
public void onFailure(Throwable caught) {
PopupPanel popup = new PopupPanel(true);
popup.setWidget(new HTML("<font color='red'>Errore</font>"));
popup.center();
}
@Override
public void onSuccess(List<Risposta> response) {
final CellTable<Risposta> questionsTable = new CellTable<>(20);
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getText();
}
}, "Risposta");
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta answer) {
return answer.getUserName();
}
}, "Utente");
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getDay();
}
}, "Giorno");
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getTime();
}
}, "Ora");
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getJudgeEmail();
}
}, "Giudice");
final TextColumn<Risposta> ratingTextColumn = new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getRating();
}
};
questionsTable.addColumn(ratingTextColumn, "Voto");
ratingTextColumn.setSortable(true);
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getLinkList().get(0);
}
}, "Link");
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getLinkList().get(1);
}
}, "Link");
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getLinkList().get(2);
}
}, "Link");
questionsTable.addColumn(new TextColumn<Risposta>() {
@Override
public String getValue(Risposta risposta) {
return risposta.getLinkList().get(3);
}
}, "Link");
final ListDataProvider<Risposta> dataProvider = new ListDataProvider<>();
dataProvider.addDataDisplay(questionsTable);
final List<Risposta> list = dataProvider.getList();
for (Iterator<Risposta> iterator = response.iterator(); iterator.hasNext();) {
final Risposta risposta = iterator.next();
list.add(risposta);
}
final ListHandler<Risposta> columnSortHandler = new ListHandler<>(list);
columnSortHandler.setComparator(ratingTextColumn, new Comparator<Risposta>() {
@Override
public int compare(Risposta option1, Risposta option2) {
if (option1.getRating().equals(option2.getRating())) {
if (!option1.getDate().after(option2.getDate())) {
return -1;
} else {
return 1;
}
} else {
return (option2 != null && option1 != null) ? option1.getRating().compareTo(option2.getRating())
: 1;
}
}
});
questionsTable.addColumnSortHandler(columnSortHandler);
questionsTable.getColumnSortList().push(ratingTextColumn);
questionsTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
final SingleSelectionModel<Risposta> selectionModel = new SingleSelectionModel<>();
questionsTable.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(new Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
if (UtenteAttuale.accountType == 1) {
final Risposta currentSelection1 = selectionModel.getSelectedObject();
if (currentSelection1 != null) {
final AggiungiVoto iv = new AggiungiVoto(MostraRisposte.this.verticalPanel);
iv.onModuleLoad(currentSelection1);
}
}
}
});
questionsTable.setRowCount(response.size(), true);
questionsTable.setRowData(0, response);
MostraRisposte.this.verticalPanel.add(questionsTable);
}
});
}
}
I expect to display a grid (Grid) with the information of who made the question I selected (CurrentSelection) and immediately below the table containing the answers, I checked and the questions and answers are correctly entered in the database but unfortunately only the answers do not appear.

Try to catch all uncaught exceptions, and unwrap the umbrella.
Somewhere in the beginnen of your onModuleLoad method
And in showError do something like
This way you have a much cleaner stacktrace to see what has happened.