[pkg-java] r12848 - in trunk/libfreemarker-java/debian: . patches

Torsten Werner twerner at alioth.debian.org
Wed Aug 4 01:53:34 UTC 2010


Author: twerner
Date: 2010-08-04 01:53:34 +0000 (Wed, 04 Aug 2010)
New Revision: 12848

Added:
   trunk/libfreemarker-java/debian/patches/disable-jython-extension.patch
Modified:
   trunk/libfreemarker-java/debian/changelog
   trunk/libfreemarker-java/debian/patches/series
Log:
Disable jython support because it is broken with jython >= 2.5.
(Closes: #591109)

Modified: trunk/libfreemarker-java/debian/changelog
===================================================================
--- trunk/libfreemarker-java/debian/changelog	2010-08-03 10:33:28 UTC (rev 12847)
+++ trunk/libfreemarker-java/debian/changelog	2010-08-04 01:53:34 UTC (rev 12848)
@@ -1,3 +1,10 @@
+libfreemarker-java (2.3.16-3) unstable; urgency=low
+
+  * Disable jython support because it is broken with jython >= 2.5.
+   (Closes: #591109)
+
+ -- Torsten Werner <twerner at debian.org>  Wed, 04 Aug 2010 03:52:11 +0200
+
 libfreemarker-java (2.3.16-2) unstable; urgency=low
 
   [ Niels Thykier ]

Added: trunk/libfreemarker-java/debian/patches/disable-jython-extension.patch
===================================================================
--- trunk/libfreemarker-java/debian/patches/disable-jython-extension.patch	                        (rev 0)
+++ trunk/libfreemarker-java/debian/patches/disable-jython-extension.patch	2010-08-04 01:53:34 UTC (rev 12848)
@@ -0,0 +1,113 @@
+From ecec63b55bf12bef19b2b316071d065b068746ea Mon Sep 17 00:00:00 2001
+From: Torsten Werner <twerner at debian.org>
+Date: Wed, 4 Aug 2010 03:02:05 +0200
+Subject: [PATCH] disable jython extension
+
+Freemarker 2.3.16 fails to build against jython 2.5 because the PyJavaInstance
+class has been removed. See
+<https://sourceforge.net/tracker/index.php?func=detail&aid=2831150&group_id=794&atid=100794>
+for the upstream bug.
+---
+ build.xml                                       |    1 -
+ src/freemarker/ext/jython/JythonHashModel.java  |    4 +-
+ src/freemarker/ext/jython/JythonModelCache.java |   45 +----------------------
+ 3 files changed, 3 insertions(+), 47 deletions(-)
+
+diff --git a/build.xml b/build.xml
+index 25c5328..bb5631a 100644
+--- a/build.xml
++++ b/build.xml
+@@ -513,7 +513,6 @@ Version: $Id: build.xml,v 1.138.2.4 2006/12/27 16:11:23 szegedia Exp $
+         <antcall target="compile-logkit"/>
+         <antcall target="compile-jdk14"/>
+         <antcall target="compile-jdk15"/>
+-        <antcall target="compile-jython"/>
+         <antcall target="compile-dom4j"/>
+         <antcall target="compile-jdom"/>
+         <antcall target="compile-xalan"/>
+diff --git a/src/freemarker/ext/jython/JythonHashModel.java b/src/freemarker/ext/jython/JythonHashModel.java
+index f6ea9d3..1104bb8 100644
+--- a/src/freemarker/ext/jython/JythonHashModel.java
++++ b/src/freemarker/ext/jython/JythonHashModel.java
+@@ -137,7 +137,7 @@ implements
+         {
+             throw new TemplateModelException(e);
+         }
+-        throw new TemplateModelException("'?keys' is not supported as there is no 'keys' nor 'keySet' attribute on an instance of " + object.getType().getFullName());
++        throw new TemplateModelException("'?keys' is not supported as there is no 'keys' nor 'keySet' attribute");
+     }
+ 
+     /**
+@@ -157,6 +157,6 @@ implements
+         {
+             throw new TemplateModelException(e);
+         }
+-        throw new TemplateModelException("'?values' is not supported as there is no 'values' attribute on an instance of " + object.getType().getFullName());
++        throw new TemplateModelException("'?values' is not supported as there is no 'values' attribute");
+     }
+ }
+diff --git a/src/freemarker/ext/jython/JythonModelCache.java b/src/freemarker/ext/jython/JythonModelCache.java
+index 9d29ca5..e506e9f 100644
+--- a/src/freemarker/ext/jython/JythonModelCache.java
++++ b/src/freemarker/ext/jython/JythonModelCache.java
+@@ -10,7 +10,6 @@ import org.python.core.Py;
+ import org.python.core.PyDictionary;
+ import org.python.core.PyFloat;
+ import org.python.core.PyInteger;
+-import org.python.core.PyJavaInstance;
+ import org.python.core.PyLong;
+ import org.python.core.PyNone;
+ import org.python.core.PyObject;
+@@ -35,48 +34,6 @@ class JythonModelCache extends ModelCache
+     }
+     
+     protected TemplateModel create(Object obj) {
+-        boolean asHash = false;
+-        boolean asSequence = false;
+-        if(obj instanceof PyJavaInstance) {
+-            Object jobj = ((PyJavaInstance)obj).__tojava__(java.lang.Object.class);
+-            // FreeMarker-aware, Jython-wrapped Java objects are left intact 
+-            if(jobj instanceof TemplateModel) {
+-                return (TemplateModel)jobj; 
+-            }
+-            if(jobj instanceof Map) {
+-                asHash = true;
+-            }
+-            if (jobj instanceof Date) {
+-                return new DateModel((Date) jobj, BeansWrapper.getDefaultInstance());
+-            }
+-            else if(jobj instanceof Collection) {
+-                asSequence = true;
+-                // FIXME: This is an ugly hack, but AFAIK, there's no better
+-                // solution if we want to have Sets and other non-List
+-                // collections managed by this layer, as Jython quite clearly
+-                // doesn't support sets.  
+-                if(!(jobj instanceof List)) {
+-                    obj = new ArrayList((Collection)jobj); 
+-                }
+-            }
+-        }
+-        
+-        // If it's not a PyObject, first make a PyObject out of it.
+-        if(!(obj instanceof PyObject)) {
+-            obj = Py.java2py(obj);
+-        }
+-        if(asHash || obj instanceof PyDictionary || obj instanceof PyStringMap) {
+-            return JythonHashModel.FACTORY.create(obj, wrapper);
+-        }
+-        if(asSequence || obj instanceof PySequence) {
+-            return JythonSequenceModel.FACTORY.create(obj, wrapper);
+-        }
+-        if(obj instanceof PyInteger || obj instanceof PyLong || obj instanceof PyFloat) {
+-            return JythonNumberModel.FACTORY.create(obj, wrapper);
+-        }
+-        if(obj instanceof PyNone) {
+-            return null;
+-        }
+-        return JythonModel.FACTORY.create(obj, wrapper);
++        throw new RuntimeException("Jython support is broken!");
+     }
+ }
+-- 
+1.7.1
+

Modified: trunk/libfreemarker-java/debian/patches/series
===================================================================
--- trunk/libfreemarker-java/debian/patches/series	2010-08-03 10:33:28 UTC (rev 12847)
+++ trunk/libfreemarker-java/debian/patches/series	2010-08-04 01:53:34 UTC (rev 12848)
@@ -4,3 +4,4 @@
 javacc.diff
 jsp_api.diff
 def-jdk-doc.patch
+disable-jython-extension.patch




More information about the pkg-java-commits mailing list