[xwiki-devs] [xwiki-notifications] r35963 - platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments

Vincent Massol vincent at massol.net
Thu Mar 24 08:41:26 UTC 2011


On Mar 24, 2011, at 9:35 AM, Thomas Mortagne wrote:

> On Thu, Mar 24, 2011 at 09:34, Thomas Mortagne
> <thomas.mortagne at xwiki.com> wrote:
>> On Thu, Mar 24, 2011 at 09:15, Vincent Massol <vincent at massol.net> wrote:
>>> 
>>> On Mar 24, 2011, at 8:28 AM, tmortagne (SVN) wrote:
>>> 
>>>> Author: tmortagne
>>>> Date: 2011-03-24 08:28:33 +0100 (Thu, 24 Mar 2011)
>>>> New Revision: 35963
>>>> 
>>>> Modified:
>>>>   platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java
>>>> Log:
>>>> XWIKI-6164: PyGments: Failed to highlight content when web server is rendering another page in the same time
>>>> 
>>>> Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java
>>>> ===================================================================
>>>> --- platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java      2011-03-24 02:11:29 UTC (rev 35962)
>>>> +++ platform/core/trunk/xwiki-rendering/xwiki-rendering-macros/xwiki-rendering-macro-code/src/main/java/org/xwiki/rendering/internal/parser/pygments/PygmentsParser.java      2011-03-24 07:28:33 UTC (rev 35963)
>>>> @@ -210,7 +210,7 @@
>>>>      * @return the highlighted version of the provided source.
>>>>      * @throws ParseException the highlighting failed.
>>>>      */
>>>> -    private List<Block> highlight(String syntaxId, String code) throws ParseException
>>>> +    private synchronized List<Block> highlight(String syntaxId, String code) throws ParseException
>>>>     {
>>>>         PythonInterpreter interpreter = getPythonInterpreter();
>>> 
>>> Cool that we fixed this one!
> 
> Note that I was not aware of this issue since nobody ever create a
> jira about it  or even talk to me about it until now.

I remember that on xwiki.org we had a problem several times about code that was not highlighted and a jython excepted was raised. Isn't it the same thing?

Thanks
-Vincent

> 
>>> 
>>> IMO we need a comment mentioning that getPythonInterpreter() is not thread safe (if that's the problem).
>> 
>> The real thing is that we don't recreate an interpreter each time we
>> highlight something and a Jython interpreter seems to be be thread
>> safe it seems.
>> 
>> But I will add something, it's better indeed.
>> 
>>> 
>>> Thanks
>>> -Vincent
>>> 
>>>>         BlocksGeneratorPygmentsListener listener = new BlocksGeneratorPygmentsListener(this.plainTextParser);




More information about the devs mailing list