Don't send function names in user reports

This commit is contained in:
serso 2016-05-22 23:12:02 +02:00
parent 908b49f602
commit 7fb081d9a4
3 changed files with 24 additions and 3 deletions

View File

@ -23,7 +23,11 @@
package org.solovyev.android.calculator;
import android.util.Log;
import jscl.CustomFunctionCalculationException;
import jscl.text.msg.JsclMessage;
import jscl.text.msg.Messages;
import org.acra.ACRA;
import org.solovyev.common.msg.MessageType;
import javax.annotation.Nonnull;
@ -37,6 +41,10 @@ public class AcraErrorReporter implements ErrorReporter {
Log.e("Acra", e.getMessage(), e);
return;
}
if (e instanceof CustomFunctionCalculationException) {
final CustomFunctionCalculationException e1 = (CustomFunctionCalculationException) e;
e1.setMessage(new JsclMessage(Messages.msg_19, MessageType.error, "XXX", e1.getCauseMessage().getMessageCode()));
}
ACRA.getErrorReporter().reportBuilder().forceSilent().exception(e).send();
}

View File

@ -8,7 +8,16 @@ import javax.annotation.Nonnull;
public class CustomFunctionCalculationException extends JsclArithmeticException {
public CustomFunctionCalculationException(@Nonnull CustomFunction function, @Nonnull Message message) {
super(Messages.msg_19, function.getName(), message);
@Nonnull
private final Message causeMessage;
public CustomFunctionCalculationException(@Nonnull CustomFunction function, @Nonnull Message causeMessage) {
super(Messages.msg_19, function.getName(), causeMessage);
this.causeMessage = causeMessage;
}
@Nonnull
public Message getCauseMessage() {
return causeMessage;
}
}

View File

@ -12,7 +12,7 @@ import java.util.Locale;
public abstract class JsclArithmeticException extends ArithmeticException implements Message {
@Nonnull
private final Message message;
private Message message;
public JsclArithmeticException(@Nonnull String messageCode, Object... parameters) {
this.message = new JsclMessage(messageCode, MessageType.error, parameters);
@ -58,4 +58,8 @@ public abstract class JsclArithmeticException extends ArithmeticException implem
public int hashCode() {
return message.hashCode();
}
public void setMessage(@Nonnull Message message) {
this.message = message;
}
}