Solve: Strange Session Variable behavior
First I initialise and start my session with this Spript:
session.setVariable("NomPrece", "Initialisation");
session.scrapeFile( "CoolName" );
session.scrapeFile( "CoolName" );
The ScrapeFile "CoolName" extract some text that is save in the session variable CARD_NAME
After each pattern application I call this over simplied script:
session.log(session.getVariable("NomPrece"));
session.setVariable("NomPrece", session.getVariable("CARD_NAME"));
session.setVariable("NomPrece", session.getVariable("CARD_NAME"));
Then this error is return in the log:
Processing script: "Cool clear Artist"
An error occurred while processing the script: Cool clear Artist
The error message was: The application script threw an exception: java.lang.NullPointerException BSF info: null at line: 0 column: columnNo
But if I do this Everything is ok.:
session.setVariable("NomPrece", session.getVariable("CARD_NAME"));
session.log(session.getVariable("NomPrece"));
session.log(session.getVariable("NomPrece"));
What I what to do is to Compare CARD_NAME of the previous pattern application to the current one.
It's like the session variable NomPrece is clear beetween each pattern application
Do you have an idea?
Thank
You're right-- it seems like
You're right-- it seems like the variable is getting cleared...
Do you get the error the first time the script happens? The first time it runs, you expect it to output
Initialisation
to the log. Does it do that, or does it fail?Solve
Youhou!! I find it!
The first time my extractor pattern pass on the scraped stuff, it reconize noting.
(It's normal and I cannot avoid it with the pattern I utilize)
BUT! he put "nothing" in NomPrece.
Then, the second time it pass in the script, he freeze when he tried to log the information "nothing" and then he is never able to put something new into NomPrece.
I simply initialise the CARD_NAME session variable with "something" and then everything is fine.
Thank for aswering