bug #497, #498 fixed. Working on #503

parent 68db9ecf
......@@ -159,11 +159,13 @@ public class Vocabulary implements Iterable<Picto> {
Picto[] pictos = new Picto[result.length()];
JSONObject picto = null, expression = null, attributes = null;
JSONObject ojpicto=null;
try {
for (int i = 0; i < result.length(); i++) {
picto = result.getJSONObject(i).getJSONObject(jpicto);
expression = result.getJSONObject(i).getJSONObject(jexpression);
attributes = result.getJSONObject(i).getJSONObject(jattributes);
for (int i=0; i < result.length(); i++) {
ojpicto=result.getJSONObject(i);
picto = ojpicto.getJSONObject(jpicto);
expression = ojpicto.getJSONObject(jexpression);
attributes = ojpicto.getJSONObject(jattributes);
pictos[i] = new Picto(picto.getInt(jid),
picto.getString(juri),
expression.getString(jexpression_text),
......@@ -176,7 +178,7 @@ public class Vocabulary implements Iterable<Picto> {
StackTraceElement traces[] = e.getStackTrace();
for (StackTraceElement s: traces)
Log.e(s.getClassName()+"."+s.getFileName()+"."+s.getLineNumber(),s.toString());
Log.e(this.getClass().getName(), " Picto json error from server: " + picto.toString()+" expression:"+expression.toString()+" attributes:"+attributes.toString());
Log.e(this.getClass().getName(), " Picto JSON error from server: " + ojpicto.toString());
this.error(e);
}
}
......
......@@ -213,6 +213,13 @@ public class StudentFragmentGrid extends Fragment{
@Override
public void error(Exception e) {
Log.e(this.getClass().getName(), " Server restapi error: " + e.getLocalizedMessage());
progressDialog.dismiss();
GUITools.show_alert(getActivity(), R.string.loginErrorTxt, getString(R.string.serverError), new GUITools.iOKListener() {
@Override
public void ok() {
PCBcontext.restart_app();
}
});
}
@Override
public void preExecute() {
......
......@@ -60,7 +60,9 @@ public class ServerLogin {
@Override
public void error(Exception e) {
listener.error(new LoginException(e.getMessage(),LoginException.BAD_LOGIN));
listener.error(new LoginException(e.getMessage(),e.getMessage().contains("User without students")
? LoginException.NO_STUDENTS
: LoginException.BAD_LOGIN));
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment