Crash fixed
Stack trace: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.solovyev.android.calculator/org.solovyev.android.calculator.CalculatorDialogActivity}: java.lang.ArrayIndexOutOfBoundsException: length=3; index=100
This commit is contained in:
parent
e0ff803442
commit
40687b891e
@ -24,13 +24,12 @@ package org.solovyev.android.calculator;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import org.solovyev.common.msg.Message;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.common.msg.Message;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 11/17/12
|
||||
@ -70,14 +69,8 @@ public class FixableMessage implements Parcelable {
|
||||
|
||||
public FixableMessage(@Nonnull Message message) {
|
||||
this.message = message.getLocalizedMessage();
|
||||
int messageLevel = message.getMessageLevel().getMessageLevel();
|
||||
if (messageLevel < MessageType.info.getMessageLevel()) {
|
||||
this.messageType = MessageType.info;
|
||||
} else if (messageLevel < MessageType.warning.getMessageLevel()) {
|
||||
this.messageType = MessageType.warning;
|
||||
} else {
|
||||
this.messageType = MessageType.error;
|
||||
}
|
||||
final int messageLevel = message.getMessageLevel().getMessageLevel();
|
||||
this.messageType = CalculatorMessages.toMessageType(messageLevel);
|
||||
this.fixableError = CalculatorFixableError.getErrorByMessageCode(message.getMessageCode());
|
||||
}
|
||||
|
||||
|
@ -24,13 +24,12 @@ package org.solovyev.android.calculator;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import org.solovyev.common.msg.MessageLevel;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.solovyev.common.msg.MessageLevel;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 1/20/13
|
||||
@ -93,7 +92,7 @@ public final class ParcelableDialogData implements DialogData, Parcelable {
|
||||
@Nonnull
|
||||
public static ParcelableDialogData fromParcel(@Nonnull Parcel in) {
|
||||
final String message = in.readString();
|
||||
final MessageType messageType = MessageType.values()[in.readInt()];
|
||||
final MessageType messageType = CalculatorMessages.toMessageType(in.readInt());
|
||||
final String title = in.readString();
|
||||
return wrap(StringDialogData.newInstance(message, messageType, title));
|
||||
}
|
||||
|
@ -31,6 +31,10 @@ import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import static org.solovyev.common.msg.MessageType.error;
|
||||
import static org.solovyev.common.msg.MessageType.info;
|
||||
import static org.solovyev.common.msg.MessageType.warning;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 9/20/12
|
||||
@ -94,6 +98,17 @@ public final class CalculatorMessages {
|
||||
|
||||
@Nonnull
|
||||
public static CalculatorMessage newErrorMessage(@Nonnull String messageCode, @Nullable Object... parameters) {
|
||||
return new CalculatorMessage(messageCode, MessageType.error, parameters);
|
||||
return new CalculatorMessage(messageCode, error, parameters);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
static MessageType toMessageType(int messageLevel) {
|
||||
if (messageLevel < info.getMessageLevel()) {
|
||||
return info;
|
||||
} else if (messageLevel < warning.getMessageLevel()) {
|
||||
return warning;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user