* fix modularity issue
This commit is contained in:
parent
06a342cdef
commit
8a75000ecd
|
@ -1,5 +1,6 @@
|
||||||
package net.filebot.format;
|
package net.filebot.format;
|
||||||
|
|
||||||
|
import static net.filebot.similarity.Normalization.*;
|
||||||
import static net.filebot.util.ExceptionUtilities.*;
|
import static net.filebot.util.ExceptionUtilities.*;
|
||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
import groovy.lang.GroovyClassLoader;
|
import groovy.lang.GroovyClassLoader;
|
||||||
|
@ -23,8 +24,6 @@ import javax.script.ScriptEngine;
|
||||||
import javax.script.ScriptException;
|
import javax.script.ScriptException;
|
||||||
import javax.script.SimpleScriptContext;
|
import javax.script.SimpleScriptContext;
|
||||||
|
|
||||||
import net.filebot.similarity.Normalization;
|
|
||||||
|
|
||||||
import org.codehaus.groovy.control.CompilerConfiguration;
|
import org.codehaus.groovy.control.CompilerConfiguration;
|
||||||
import org.codehaus.groovy.control.MultipleCompilationErrorsException;
|
import org.codehaus.groovy.control.MultipleCompilationErrorsException;
|
||||||
import org.codehaus.groovy.control.customizers.ImportCustomizer;
|
import org.codehaus.groovy.control.customizers.ImportCustomizer;
|
||||||
|
@ -179,10 +178,10 @@ public class ExpressionFormat extends Format {
|
||||||
lastException = null;
|
lastException = null;
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (Object snipped : compilation) {
|
for (Object snippet : compilation) {
|
||||||
if (snipped instanceof CompiledScript) {
|
if (snippet instanceof CompiledScript) {
|
||||||
try {
|
try {
|
||||||
Object value = normalizeExpressionValue(((CompiledScript) snipped).eval(context));
|
CharSequence value = normalizeExpressionValue(((CompiledScript) snippet).eval(context));
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
sb.append(value);
|
sb.append(value);
|
||||||
}
|
}
|
||||||
|
@ -190,11 +189,11 @@ public class ExpressionFormat extends Format {
|
||||||
handleException(e);
|
handleException(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sb.append(snipped);
|
sb.append(snippet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Normalization.replaceSpace(sb.toString(), " ").trim();
|
return normalizeResult(sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object normalizeBindingValue(Object value) {
|
protected Object normalizeBindingValue(Object value) {
|
||||||
|
@ -207,8 +206,12 @@ public class ExpressionFormat extends Format {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object normalizeExpressionValue(Object value) {
|
protected CharSequence normalizeExpressionValue(Object value) {
|
||||||
return value;
|
return value == null ? null : value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String normalizeResult(CharSequence value) {
|
||||||
|
return replaceSpace(value.toString(), " ").trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleException(ScriptException exception) {
|
protected void handleException(ScriptException exception) {
|
||||||
|
|
Loading…
Reference in New Issue