Implementing converter API

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Implementing converter API

asotobu
Hi I am implementing the API of converters for AsciidoctorJ, but it throws me an expcetion a bit strange.

Code can be found https://github.com/asciidoctor/asciidoctorj/tree/converters/asciidoctorj-core/src/main/java/org/asciidoctor/converter

https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb

and the test https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/test/java/org/asciidoctor/converter/WhenConverterIsRegistered.java

When I execute the test which registers a new converter it throws next exception:

Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to parse source, wrong number of arguments (2 for 0)
        at RUBY.load(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1362)
        at RUBY.convert(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
        at RUBY.convert(<script>:72)
        at org.jruby.gen.InterfaceImpl2025330510.convert(org/jruby/gen/InterfaceImpl2025330510.gen:13)

But the load method is expecting input and options which both are provided in test. The strange is that if I comment the line where I register the converter then the test passes, but now I can't see relationship between converter implementation and load method.

Any hint?

Alex.


Reply | Threaded
Open this post in threaded view
|

Re: Implementing converter API

mojavelinux
Administrator
Alex,

The source of the exception is being masked by this line of code in Asciidoctor:


This is not the first time I've hit this problem and it's definitely something I need to address in core.

The real problem could literally be anything. I'm going to dig in by removing this rescue and trying to discover the real source of the issue.

-Dan

On Sun, Dec 14, 2014 at 12:07 PM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi I am implementing the API of converters for AsciidoctorJ, but it throws me an expcetion a bit strange.

Code can be found https://github.com/asciidoctor/asciidoctorj/tree/converters/asciidoctorj-core/src/main/java/org/asciidoctor/converter

https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb

and the test https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/test/java/org/asciidoctor/converter/WhenConverterIsRegistered.java

When I execute the test which registers a new converter it throws next exception:

Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to parse source, wrong number of arguments (2 for 0)
        at RUBY.load(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1362)
        at RUBY.convert(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
        at RUBY.convert(<script>:72)
        at org.jruby.gen.InterfaceImpl2025330510.convert(org/jruby/gen/InterfaceImpl2025330510.gen:13)

But the load method is expecting input and options which both are provided in test. The strange is that if I comment the line where I register the converter then the test passes, but now I can't see relationship between converter implementation and load method.

Any hint?

Alex.





If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Implementing-converter-API-tp2537.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Reply | Threaded
Open this post in threaded view
|

Re: Implementing converter API

mojavelinux
Administrator
In reply to this post by asotobu
Here's the real exception:

....
Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) wrong number of arguments (2 for 0)
at RUBY.create(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/converter/factory.rb:188)
at RUBY.create_converter(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:998)
at RUBY.update_backend_attributes(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:918)
at RUBY.initialize(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:388)
at RUBY.load(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1356)
at RUBY.convert(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
at RUBY.convert(<script>:72)
at org.jruby.gen.InterfaceImpl1507147774.convert(org/jruby/gen/InterfaceImpl1507147774.gen:13)
....

-Dan

On Sun, Dec 14, 2014 at 2:38 PM, Dan Allen <[hidden email]> wrote:
Alex,

The source of the exception is being masked by this line of code in Asciidoctor:


This is not the first time I've hit this problem and it's definitely something I need to address in core.

The real problem could literally be anything. I'm going to dig in by removing this rescue and trying to discover the real source of the issue.

-Dan

On Sun, Dec 14, 2014 at 12:07 PM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi I am implementing the API of converters for AsciidoctorJ, but it throws me an expcetion a bit strange.

Code can be found https://github.com/asciidoctor/asciidoctorj/tree/converters/asciidoctorj-core/src/main/java/org/asciidoctor/converter

https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb

and the test https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/test/java/org/asciidoctor/converter/WhenConverterIsRegistered.java

When I execute the test which registers a new converter it throws next exception:

Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to parse source, wrong number of arguments (2 for 0)
        at RUBY.load(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1362)
        at RUBY.convert(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
        at RUBY.convert(<script>:72)
        at org.jruby.gen.InterfaceImpl2025330510.convert(org/jruby/gen/InterfaceImpl2025330510.gen:13)

But the load method is expecting input and options which both are provided in test. The strange is that if I comment the line where I register the converter then the test passes, but now I can't see relationship between converter implementation and load method.

Any hint?

Alex.





If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Implementing-converter-API-tp2537.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--


--
Reply | Threaded
Open this post in threaded view
|

Re: Implementing converter API

mojavelinux
Administrator
In reply to this post by asotobu
...which is caused because the converter class is missing the necessary constructor. If I add the constructor, the test passes.

Stay tuned for some implementation suggestions.

-Dan

On Sun, Dec 14, 2014 at 3:18 PM, Dan Allen <[hidden email]> wrote:
Here's the real exception:

....
Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) wrong number of arguments (2 for 0)
at RUBY.create(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/converter/factory.rb:188)
at RUBY.create_converter(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:998)
at RUBY.update_backend_attributes(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:918)
at RUBY.initialize(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:388)
at RUBY.load(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1356)
at RUBY.convert(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
at RUBY.convert(<script>:72)
at org.jruby.gen.InterfaceImpl1507147774.convert(org/jruby/gen/InterfaceImpl1507147774.gen:13)
....

-Dan

On Sun, Dec 14, 2014 at 2:38 PM, Dan Allen <[hidden email]> wrote:
Alex,

The source of the exception is being masked by this line of code in Asciidoctor:


This is not the first time I've hit this problem and it's definitely something I need to address in core.

The real problem could literally be anything. I'm going to dig in by removing this rescue and trying to discover the real source of the issue.

-Dan

On Sun, Dec 14, 2014 at 12:07 PM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi I am implementing the API of converters for AsciidoctorJ, but it throws me an expcetion a bit strange.

Code can be found https://github.com/asciidoctor/asciidoctorj/tree/converters/asciidoctorj-core/src/main/java/org/asciidoctor/converter

https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb

and the test https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/test/java/org/asciidoctor/converter/WhenConverterIsRegistered.java

When I execute the test which registers a new converter it throws next exception:

Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to parse source, wrong number of arguments (2 for 0)
        at RUBY.load(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1362)
        at RUBY.convert(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
        at RUBY.convert(<script>:72)
        at org.jruby.gen.InterfaceImpl2025330510.convert(org/jruby/gen/InterfaceImpl2025330510.gen:13)

But the load method is expecting input and options which both are provided in test. The strange is that if I comment the line where I register the converter then the test passes, but now I can't see relationship between converter implementation and load method.

Any hint?

Alex.





If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Implementing-converter-API-tp2537.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--


--


--
Reply | Threaded
Open this post in threaded view
|

Re: Implementing converter API

asotobu
Please trust me I was sleeping and i have just waken up and said oh i know it is the constructor, and now i see your msg :) BTW in future we will need to pass instance too as it happens in extensions
El dg., 14 de des., 2014 a les 23.22 mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> va escriure:
...which is caused because the converter class is missing the necessary constructor. If I add the constructor, the test passes.

Stay tuned for some implementation suggestions.

-Dan

On Sun, Dec 14, 2014 at 3:18 PM, Dan Allen <[hidden email]> wrote:
Here's the real exception:

....
Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) wrong number of arguments (2 for 0)
at RUBY.create(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/converter/factory.rb:188)
at RUBY.create_converter(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:998)
at RUBY.update_backend_attributes(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:918)
at RUBY.initialize(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:388)
at RUBY.load(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1356)
at RUBY.convert(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
at RUBY.convert(<script>:72)
at org.jruby.gen.InterfaceImpl1507147774.convert(org/jruby/gen/InterfaceImpl1507147774.gen:13)
....

-Dan

On Sun, Dec 14, 2014 at 2:38 PM, Dan Allen <[hidden email]> wrote:
Alex,

The source of the exception is being masked by this line of code in Asciidoctor:


This is not the first time I've hit this problem and it's definitely something I need to address in core.

The real problem could literally be anything. I'm going to dig in by removing this rescue and trying to discover the real source of the issue.

-Dan

On Sun, Dec 14, 2014 at 12:07 PM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi I am implementing the API of converters for AsciidoctorJ, but it throws me an expcetion a bit strange.

Code can be found https://github.com/asciidoctor/asciidoctorj/tree/converters/asciidoctorj-core/src/main/java/org/asciidoctor/converter

https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb

and the test https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/test/java/org/asciidoctor/converter/WhenConverterIsRegistered.java

When I execute the test which registers a new converter it throws next exception:

Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to parse source, wrong number of arguments (2 for 0)
        at RUBY.load(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1362)
        at RUBY.convert(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
        at RUBY.convert(<script>:72)
        at org.jruby.gen.InterfaceImpl2025330510.convert(org/jruby/gen/InterfaceImpl2025330510.gen:13)

But the load method is expecting input and options which both are provided in test. The strange is that if I comment the line where I register the converter then the test passes, but now I can't see relationship between converter implementation and load method.

Any hint?

Alex.





If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Implementing-converter-API-tp2537.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--


--


--



If you reply to this email, your message will be added to the discussion below:
To unsubscribe from Implementing converter API, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Implementing converter API

mojavelinux
Administrator
No problem at all. The message was very misleading and only because I knew of the problem spot was I able to get past it quickly. I'm going to file an issue to fix the masked exception in Asciidoctor core.

I sent a pull request to the converters branch with suggestions:


On Sun, Dec 14, 2014 at 3:46 PM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Please trust me I was sleeping and i have just waken up and said oh i know it is the constructor, and now i see your msg :) BTW in future we will need to pass instance too as it happens in extensions
El dg., 14 de des., 2014 a les 23.22 mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> va escriure:
...which is caused because the converter class is missing the necessary constructor. If I add the constructor, the test passes.

Stay tuned for some implementation suggestions.

-Dan

On Sun, Dec 14, 2014 at 3:18 PM, Dan Allen <[hidden email]> wrote:
Here's the real exception:

....
Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) wrong number of arguments (2 for 0)
at RUBY.create(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/converter/factory.rb:188)
at RUBY.create_converter(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:998)
at RUBY.update_backend_attributes(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:918)
at RUBY.initialize(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor/document.rb:388)
at RUBY.load(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1356)
at RUBY.convert(/home/dallen/projects/asciidoctor/asciidoctorj/asciidoctorj-core/build/vendor/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
at RUBY.convert(<script>:72)
at org.jruby.gen.InterfaceImpl1507147774.convert(org/jruby/gen/InterfaceImpl1507147774.gen:13)
....

-Dan

On Sun, Dec 14, 2014 at 2:38 PM, Dan Allen <[hidden email]> wrote:
Alex,

The source of the exception is being masked by this line of code in Asciidoctor:


This is not the first time I've hit this problem and it's definitely something I need to address in core.

The real problem could literally be anything. I'm going to dig in by removing this rescue and trying to discover the real source of the issue.

-Dan

On Sun, Dec 14, 2014 at 12:07 PM, asotobu [via Asciidoctor :: Discussion] <[hidden email]> wrote: Hi I am implementing the API of converters for AsciidoctorJ, but it throws me an expcetion a bit strange.

Code can be found https://github.com/asciidoctor/asciidoctorj/tree/converters/asciidoctorj-core/src/main/java/org/asciidoctor/converter

https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/main/resources/org/asciidoctor/internal/asciidoctorclass.rb

and the test https://github.com/asciidoctor/asciidoctorj/blob/converters/asciidoctorj-core/src/test/java/org/asciidoctor/converter/WhenConverterIsRegistered.java

When I execute the test which registers a new converter it throws next exception:

Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) asciidoctor: FAILED: <stdin>: Failed to parse source, wrong number of arguments (2 for 0)
        at RUBY.load(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1362)
        at RUBY.convert(/Users/alexsotobueno/git/asciidoctorj/asciidoctorj-core/build/resources/main/gems/asciidoctor-1.5.2/lib/asciidoctor.rb:1458)
        at RUBY.convert(<script>:72)
        at org.jruby.gen.InterfaceImpl2025330510.convert(org/jruby/gen/InterfaceImpl2025330510.gen:13)

But the load method is expecting input and options which both are provided in test. The strange is that if I comment the line where I register the converter then the test passes, but now I can't see relationship between converter implementation and load method.

Any hint?

Alex.





If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Implementing-converter-API-tp2537.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--


--


--



If you reply to this email, your message will be added to the discussion below:
To unsubscribe from Implementing converter API, click here.
NAML



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Implementing-converter-API-tp2537p2541.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--