Implement review comments
MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/internal/RubyObjectWrapper.java
asciidoctorj-core/src/main/java/org/asciidoctor/internal/RubyObjectWrapper.java
@@ -14,6 +14,7 @@ import org.jruby.runtime.builtin.IRubyObject;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
public class RubyObjectWrapper {
@@ -40,8 +41,10 @@ public class RubyObjectWrapper {
return null;
} else if (result instanceof RubySymbol) {
return ((RubySymbol) result).asJavaString();
- } else {
+ } else if (result instanceof RubyString){
return ((RubyString) result).asJavaString();
+ } else {
+ return Objects.toString(result);
}
}

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/log/LogHandler.java
asciidoctorj-core/src/main/java/org/asciidoctor/log/LogHandler.java
package org.asciidoctor.log;
-import org.asciidoctor.ast.Cursor;
-
public interface LogHandler {
void log(LogRecord logRecord);

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/log/internal/JULLogHandler.java
asciidoctorj-core/src/main/java/org/asciidoctor/log/internal/JULLogHandler.java
@@ -20,7 +20,7 @@ public class JULLogHandler implements LogHandler {
julLogRecord.setSourceClassName(logRecord.getSourceFileName());
julLogRecord.setSourceMethodName(logRecord.getSourceMethodName());
-
+ julLogRecord.setParameters(new Object[] { logRecord.getCursor() });
LOGGER.log(julLogRecord);
}

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/log/internal/JavaLogger.java
asciidoctorj-core/src/main/java/org/asciidoctor/log/internal/JavaLogger.java
@@ -73,10 +73,8 @@ public class JavaLogger extends RubyObject {
@JRubyMethod(name = "add", required = 1, optional = 2)
public IRubyObject add(final ThreadContext threadContext, final IRubyObject[] args, Block block) {
final IRubyObject rubyMessage;
- final String progname;
if (args.length >= 2 && !args[1].isNil()) {
rubyMessage = args[1];
- progname = args[2].asJavaString();
} else if (block.isGiven()) {
rubyMessage = block.yield(threadContext, getRuntime().getNil());
} else {

MODIFY
asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciidoctorLogsToConsole.java
asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciidoctorLogsToConsole.java
@@ -22,6 +22,8 @@ import static org.asciidoctor.OptionsBuilder.options;
import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
@@ -106,6 +108,13 @@ public class WhenAsciidoctorLogsToConsole {
assertThat(cursor.getDir().replace('\\', '/'), is(inputFile.getParent().replace('\\', '/')));
assertThat(cursor.getFile(), is(inputFile.getName()));
assertThat(cursor.getLineNumber(), is(3));
+
+ for (LogRecord logRecord: logRecords) {
+ assertThat(logRecord.getCursor(), not(nullValue()));
+ assertThat(logRecord.getCursor().getFile(), not(nullValue()));
+ assertThat(logRecord.getCursor().getDir(), not(nullValue()));
+ }
+
}
@Test

MODIFY
asciidoctorj-core/src/test/resources/documentwithnotexistingfile.adoc
asciidoctorj-core/src/test/resources/documentwithnotexistingfile.adoc
@@ -4,6 +4,6 @@ include::unexistingdoc.adoc[]
include::unexistingdoc.adoc[]
-include::https://raw.githubusercontent.com/asciidoctor/asciidoctor-maven-plugin/master/src/test/resources/src/asciidoctor/github-include.adoc[]
+include::https://raw.githubusercontent.com/asciidoctor/asciidoctorj/e47a2c01c563fa624ca61e1bc58e264a114f7fb5/asciidoctorj-core/src/test/resources/rendersample.asciidoc[]
include::unexistingdoc.adoc[]

Implement review comments