This commit is contained in:
Jörg Prante 2022-01-26 17:59:37 +01:00
parent 4b6bee2105
commit 78925aaf12
2 changed files with 10 additions and 1 deletions

View file

@ -1,5 +1,6 @@
package org.xbib.graphics.pdfbox.layout.element.scripting; package org.xbib.graphics.pdfbox.layout.element.scripting;
import java.util.logging.Level;
import org.xbib.graphics.pdfbox.layout.element.scripting.command.Command; import org.xbib.graphics.pdfbox.layout.element.scripting.command.Command;
import org.xbib.settings.Settings; import org.xbib.settings.Settings;
@ -55,7 +56,9 @@ public class Engine implements Closeable {
String className = packageName + ".command." + type.substring(0, 1).toUpperCase() + type.substring(1) + "Command"; String className = packageName + ".command." + type.substring(0, 1).toUpperCase() + type.substring(1) + "Command";
Class<?> cl = classLoader.loadClass(className); Class<?> cl = classLoader.loadClass(className);
Command command = (Command) cl.getConstructor().newInstance(); Command command = (Command) cl.getConstructor().newInstance();
logger.finer("executing element " + type + " settings = " + settings.getAsMap()); if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, "executing element " + type + " settings = " + settings.getAsMap());
}
command.execute(this, state, settings); command.execute(this, state, settings);
} catch (Exception e) { } catch (Exception e) {
throw new IOException(e); throw new IOException(e);

View file

@ -157,6 +157,9 @@ public class TextFlowUtil {
* @return the create char sequence. * @return the create char sequence.
*/ */
public static Iterable<CharSequence> fromPlainText(final CharSequence text) { public static Iterable<CharSequence> fromPlainText(final CharSequence text) {
if (text == null) {
return fromPlainText(Collections.emptyList());
}
return fromPlainText(Collections.singleton(text)); return fromPlainText(Collections.singleton(text));
} }
@ -181,6 +184,9 @@ public class TextFlowUtil {
* @return the create char sequence. * @return the create char sequence.
*/ */
public static Iterable<CharSequence> fromMarkup(final CharSequence markup) { public static Iterable<CharSequence> fromMarkup(final CharSequence markup) {
if (markup == null) {
return fromMarkup(Collections.emptyList());
}
return fromMarkup(Collections.singleton(markup)); return fromMarkup(Collections.singleton(markup));
} }