polish
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
package org.springframework.binding.format;
|
||||
|
||||
public class NoSuchFormatterException extends RuntimeException {
|
||||
|
||||
private Class formatterFormattedClass;
|
||||
|
||||
private String formatterId;
|
||||
|
||||
public NoSuchFormatterException(Class formatterFormattedClass) {
|
||||
super("No default formatter for class " + formatterFormattedClass + "; make sure a formatter is registered");
|
||||
this.formatterFormattedClass = formatterFormattedClass;
|
||||
}
|
||||
|
||||
public NoSuchFormatterException(String formatterId, Class formatterFormattedClass) {
|
||||
super("No custom formatter could be found with id '" + formatterId + "' for class " + formatterFormattedClass
|
||||
+ "; check your spelling and make sure the formatter is registered");
|
||||
this.formatterId = formatterId;
|
||||
}
|
||||
|
||||
public Class getFormatterFormattedClass() {
|
||||
return formatterFormattedClass;
|
||||
}
|
||||
|
||||
public String getFormatterId() {
|
||||
return formatterId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import java.util.Map;
|
||||
import org.springframework.binding.format.Formatter;
|
||||
import org.springframework.binding.format.FormatterFactory;
|
||||
import org.springframework.binding.format.FormatterRegistry;
|
||||
import org.springframework.binding.format.NoSuchFormatterException;
|
||||
import org.springframework.context.i18n.LocaleContext;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.context.i18n.SimpleLocaleContext;
|
||||
@@ -70,7 +69,7 @@ public class FormatterRegistryImpl implements FormatterRegistry {
|
||||
context.setFormattedClass(clazz);
|
||||
return factory.createFormatter(context);
|
||||
} else {
|
||||
throw new NoSuchFormatterException(clazz);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +81,7 @@ public class FormatterRegistryImpl implements FormatterRegistry {
|
||||
context.setFormattedClass(clazz);
|
||||
return factory.createFormatter(context);
|
||||
} else {
|
||||
throw new NoSuchFormatterException(id, clazz);
|
||||
return getFormatter(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,9 @@ class MvcView implements View {
|
||||
|
||||
public void resume() {
|
||||
determineEventId(context);
|
||||
if (eventId == null) {
|
||||
return;
|
||||
}
|
||||
Object model = getModelObject();
|
||||
if (model == null) {
|
||||
postbackSuccess = true;
|
||||
@@ -110,10 +113,8 @@ class MvcView implements View {
|
||||
if (!mappingResults.hasErrorResults()) {
|
||||
postbackSuccess = true;
|
||||
} else {
|
||||
if (onlyPropertyNotFoundErrors()) {
|
||||
if (onlyPropertyNotFoundErrorsPresent(mappingResults)) {
|
||||
postbackSuccess = true;
|
||||
} else {
|
||||
postbackSuccess = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,8 +194,8 @@ class MvcView implements View {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean onlyPropertyNotFoundErrors() {
|
||||
return mappingResults.getResults(PROPERTY_NOT_FOUND_ERRORS).size() == mappingResults.getErrorResults().size();
|
||||
private boolean onlyPropertyNotFoundErrorsPresent(MappingResults results) {
|
||||
return results.getResults(PROPERTY_NOT_FOUND_ERRORS).size() == mappingResults.getErrorResults().size();
|
||||
}
|
||||
|
||||
private void determineEventId(RequestContext context) {
|
||||
|
||||
Reference in New Issue
Block a user