mainGNU Prolog for Java - Support: sr #107601, runOnce throws a...

 
 

sr #107601: runOnce throws a IllegalArgumentException; prologfile and code snippet included

Submitter:  None
Submitted:  Tue 22 Feb 2011 07:47:54 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  4 - Important Status:  Done
Privacy:  Public Assigned to:  drt24
Originator Email:  -email is unavailable- Open/Closed:  Closed
Operating System:  Microsoft Windows
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 22 Feb 2011 08:32:02 PM UTC, comment #4: 

Only
:- dynamic(inverseOf/1).
is valid prolog.

In prolog all predicates use brackets to take arguments.

ensureLoaded does validate the prolog file but it stores the validation into the List<PrologTextLoaderError> which is obtainable using env.getLoadingErrors(); It is probable that both ensureLoaded and runInitialization should return false if there were errors generated and possibly throw an exception rather than just return void as they do at the moment.

I have taken out a bug with respect to that which should be fixed in the next release.

Daniel Thomas <drt24>
Group administrator
Tue 22 Feb 2011 08:24:06 PM UTC, comment #3: 

headslap

Okay, that explains a lot.

Perhaps ensureLoaded could validate the prolog file...

or are
:- dynamic inverseOf/1.
and
:- dynamic(inverseOf/1).

both syntactically correct prolog inputs?

Anonymous
Tue 22 Feb 2011 08:11:20 PM UTC, comment #2: 

Ok wonderful I have found out what the problem was.

There were syntax errors in the prolog file which were causing things to not work as they should.

Adding in:
// Check to see if there were any errors while running the initialization
//  (syntax errors etc.)
List<PrologTextLoaderError> loadingErrors = env.getLoadingErrors();
if (loadingErrors.size() > 0)
{
System.err.println(loadingErrors);
return;
}

(plus the needed imports) showed up the errors and helped me fix the bug in the prolog file.
It is
:- dynamic(inverseOf/1).
rather than
:- dynamic inverseOf/1 .
I probably wasn't clear enough in my previous email.

I attach the corrected files.

I should look into making the error thrown in this case much easier to understand as that was decidedly non-obvious.

I hope this helps and that your first time at using a bug tracker went well (you did it right),

Daniel

(file #22760, file #22761)

Daniel Thomas <drt24>
Group administrator
Tue 22 Feb 2011 07:59:46 PM UTC, comment #1: 

I also catch this error:

gnu.prolog.vm.PrologException: error(permission_error(modify,static_procedure,inverseOf / 1),error)

Anonymous
Tue 22 Feb 2011 07:47:54 PM UTC, original submission:  

Hello,

using GNU Prolog for Java I get an IllegalArgumentException

and "The goal is not currently active".

Trace:

java.lang.IllegalArgumentException: The goal is not currently active
at gnu.prolog.vm.Interpreter.stop(Interpreter.java:564)
at gnu.prolog.vm.Interpreter.runOnce(Interpreter.java:629)
at GNUPrologBug.generateBug(GNUPrologBug.java:22)


The trace is edited so that you can see where the bug originates.

I'm sorry if I'm not a good bugtracker, I'm doing this for the first time. Please feel free to correct me. :-)

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #22760:  GNUPrologBug.java added by drt24 (2KiB - application/octet-stream - Fixed files - bug now fixed)
file #22761:  umlsecrules.pro added by drt24 (955B - application/octet-stream - Fixed files - bug now fixed)
file #22758:  GNUPrologBug.java added by None (1KiB - application/octet-stream)
file #22759:  umlsecrules.pro added by None (946B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-02-22 drt24 Attached File- Added GNUPrologBug.java, #22760
        Attached File- Added umlsecrules.pro, #22761
        StatusNone Done
        Assigned toNone drt24
        Open/ClosedOpen Closed
    2011-02-22 None Attached File- Added GNUPrologBug.java, #22758
        Attached File- Added umlsecrules.pro, #22759

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code