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

parent 68db9ecf
...@@ -159,11 +159,13 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -159,11 +159,13 @@ public class Vocabulary implements Iterable<Picto> {
Picto[] pictos = new Picto[result.length()]; Picto[] pictos = new Picto[result.length()];
JSONObject picto = null, expression = null, attributes = null; JSONObject picto = null, expression = null, attributes = null;
JSONObject ojpicto=null;
try { try {
for (int i = 0; i < result.length(); i++) { for (int i=0; i < result.length(); i++) {
picto = result.getJSONObject(i).getJSONObject(jpicto); ojpicto=result.getJSONObject(i);
expression = result.getJSONObject(i).getJSONObject(jexpression); picto = ojpicto.getJSONObject(jpicto);
attributes = result.getJSONObject(i).getJSONObject(jattributes); expression = ojpicto.getJSONObject(jexpression);
attributes = ojpicto.getJSONObject(jattributes);
pictos[i] = new Picto(picto.getInt(jid), pictos[i] = new Picto(picto.getInt(jid),
picto.getString(juri), picto.getString(juri),
expression.getString(jexpression_text), expression.getString(jexpression_text),
...@@ -176,7 +178,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -176,7 +178,7 @@ public class Vocabulary implements Iterable<Picto> {
StackTraceElement traces[] = e.getStackTrace(); StackTraceElement traces[] = e.getStackTrace();
for (StackTraceElement s: traces) for (StackTraceElement s: traces)
Log.e(s.getClassName()+"."+s.getFileName()+"."+s.getLineNumber(),s.toString()); 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); this.error(e);
} }
} }
......
...@@ -212,7 +212,14 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -212,7 +212,14 @@ public class StudentFragmentGrid extends Fragment{
wrapper.ask(operation, new iRestapiListener() { wrapper.ask(operation, new iRestapiListener() {
@Override @Override
public void error(Exception e) { public void error(Exception e) {
Log.e(this.getClass().getName(), " Server restapi error: " + e.getLocalizedMessage()); 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 @Override
public void preExecute() { public void preExecute() {
......
...@@ -60,7 +60,9 @@ public class ServerLogin { ...@@ -60,7 +60,9 @@ public class ServerLogin {
@Override @Override
public void error(Exception e) { 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