Merge pull request #235 from TouchInstinct/fix/valid_error_logging_for_null_fields
Fix/valid error logging for null fields
This commit is contained in:
commit
c9678f8080
|
|
@ -22,6 +22,7 @@ package ru.touchin.templates.logansquare;
|
|||
import androidx.annotation.Nullable;
|
||||
|
||||
import ru.touchin.roboswag.core.log.Lc;
|
||||
import ru.touchin.roboswag.core.log.LcGroup;
|
||||
import ru.touchin.templates.ApiModel;
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +39,9 @@ public abstract class LoganSquareJsonModel extends ApiModel {
|
|||
*/
|
||||
protected static void validateNotNull(@Nullable final Object object) throws ValidationException {
|
||||
if (object == null) {
|
||||
throw new ValidationException("Not nullable object is null or missed at " + Lc.getCodePoint(null, 1));
|
||||
ValidationException exception = new ValidationException("Not nullable object is null or missed at " + Lc.getCodePoint(null, 1));
|
||||
LcGroup.API_VALIDATION.e(exception, "Invalid item");
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ import android.util.Log;
|
|||
*/
|
||||
public class ConsoleLogProcessor extends LogProcessor {
|
||||
|
||||
private static final int MAX_LOG_LENGTH = 4000;
|
||||
|
||||
public ConsoleLogProcessor(@NonNull final LcLevel lclevel) {
|
||||
super(lclevel);
|
||||
}
|
||||
|
|
@ -46,18 +44,8 @@ public class ConsoleLogProcessor extends LogProcessor {
|
|||
public void processLogMessage(@NonNull final LcGroup group, @NonNull final LcLevel level,
|
||||
@NonNull final String tag, @NonNull final String message, @Nullable final Throwable throwable) {
|
||||
final String messageToLog = normalize(message + (throwable != null ? '\n' + Log.getStackTraceString(throwable) : ""));
|
||||
final int length = messageToLog.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int newline = messageToLog.indexOf('\n', i);
|
||||
newline = newline != -1 ? newline : length;
|
||||
do {
|
||||
final int end = Math.min(newline, i + MAX_LOG_LENGTH);
|
||||
Log.println(level.getPriority(), tag, messageToLog.substring(i, end));
|
||||
i = end;
|
||||
}
|
||||
while (i < newline);
|
||||
}
|
||||
|
||||
Log.println(level.getPriority(), tag, messageToLog);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue