[pkg-java] r14389 - trunk/fop/debian/patches

Mathieu Malaterre malat-guest at alioth.debian.org
Mon Aug 22 14:31:16 UTC 2011


Author: malat-guest
Date: 2011-08-22 14:31:16 +0000 (Mon, 22 Aug 2011)
New Revision: 14389

Added:
   trunk/fop/debian/patches/debian-changes-1:1.0.dfsg-4
Modified:
   trunk/fop/debian/patches/series
Log:
Adding patch to get qdox 1.12 to work

Added: trunk/fop/debian/patches/debian-changes-1:1.0.dfsg-4
===================================================================
--- trunk/fop/debian/patches/debian-changes-1:1.0.dfsg-4	                        (rev 0)
+++ trunk/fop/debian/patches/debian-changes-1:1.0.dfsg-4	2011-08-22 14:31:16 UTC (rev 14389)
@@ -0,0 +1,345 @@
+Description: Upstream changes introduced in version 1:1.0.dfsg-4
+ This patch has been created by dpkg-source during the package build.
+ Here's the last changelog entry, hopefully it gives details on why
+ those changes were made:
+ .
+ fop (1:1.0.dfsg-4) unstable; urgency=low
+ .
+   [ Sylvestre Ledru ]
+   * Upload to unstable
+   * Dependency on libxp removed (Closes: #623639)
+   * Standards-Version updated to version 3.9.2
+   * Description updated. Thanks to Ivan Shmakov (Closes: #604008)
+ .
+   [ Vincent Fourmond ]
+   * NativeTextHandler is now properly redefined (closes: #626069)
+   * Reupload with a tarball cleaned of upstream JAR files (closes: #625869)
+     - add a lib/build directory as dirty workaround for a missing dir
+     - add libqdox-java as build dependency
+ .
+   [ Mathieu Malaterre ]
+   * Revert changelog numbering to please tar script
+   * Fix JAVA_HOME value in debian/rules
+   * Remove qdox from build. Closes: #638532
+ .
+ The person named in the Author field signed this changelog entry.
+Author: Vincent Fourmond <fourmond at debian.org>
+Bug-Debian: http://bugs.debian.org/604008
+Bug-Debian: http://bugs.debian.org/623639
+Bug-Debian: http://bugs.debian.org/625869
+Bug-Debian: http://bugs.debian.org/626069
+Bug-Debian: http://bugs.debian.org/638532
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- fop-1.0.dfsg.orig/build.xml
++++ fop-1.0.dfsg/build.xml
+@@ -149,8 +149,8 @@ list of possible build targets.
+   <property name="javac.debug" value="on"/>
+   <property name="javac.optimize" value="off"/>
+   <property name="javac.deprecation" value="on"/>
+-  <property name="javac.source" value="1.4"/>
+-  <property name="javac.target" value="1.4"/>
++  <property name="javac.source" value="1.5"/>
++  <property name="javac.target" value="1.5"/>
+   <property name="javac.fork" value="no"/>
+   <property name="junit.fork" value="on"/>
+   <property name="junit.haltonfailure" value="off"/>
+--- /dev/null
++++ fop-1.0.dfsg/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java.old
+@@ -0,0 +1,204 @@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements.  See the NOTICE file distributed with
++ * this work for additional information regarding copyright ownership.
++ * The ASF licenses this file to You under the Apache License, Version 2.0
++ * (the "License"); you may not use this file except in compliance with
++ * the License.  You may obtain a copy of the License at
++ *
++ *      http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++/* $Id: EventProducerCollector.java 932502 2010-04-09 16:48:27Z vhennebert $ */
++
++package org.apache.fop.tools;
++
++import java.io.File;
++import java.io.IOException;
++import java.util.ArrayList;
++import java.util.Collections;
++import java.util.List;
++import java.util.Map;
++
++import org.apache.fop.events.EventProducer;
++import org.apache.fop.events.model.EventMethodModel;
++import org.apache.fop.events.model.EventModel;
++import org.apache.fop.events.model.EventProducerModel;
++import org.apache.fop.events.model.EventSeverity;
++
++import com.thoughtworks.qdox.JavaDocBuilder;
++import com.thoughtworks.qdox.model.DefaultDocletTagFactory;
++import com.thoughtworks.qdox.model.DocletTag;
++import com.thoughtworks.qdox.model.DocletTagFactory;
++import com.thoughtworks.qdox.model.JavaClass;
++import com.thoughtworks.qdox.model.JavaMethod;
++import com.thoughtworks.qdox.model.JavaParameter;
++import com.thoughtworks.qdox.model.Type;
++
++/**
++ * Finds EventProducer interfaces and builds the event model for them.
++ */
++class EventProducerCollector {
++
++    private static final String CLASSNAME_EVENT_PRODUCER = EventProducer.class.getName();
++    private static final Map PRIMITIVE_MAP;
++
++    static {
++        Map m = new java.util.HashMap();
++        m.put("boolean", Boolean.class);
++        m.put("byte", Byte.class);
++        m.put("char", Character.class);
++        m.put("short", Short.class);
++        m.put("int", Integer.class);
++        m.put("long", Long.class);
++        m.put("float", Float.class);
++        m.put("double", Double.class);
++        PRIMITIVE_MAP = Collections.unmodifiableMap(m);
++    }
++
++    private DocletTagFactory tagFactory;
++    private List models = new ArrayList();
++
++    /**
++     * Creates a new EventProducerCollector.
++     */
++    EventProducerCollector() {
++        this.tagFactory = createDocletTagFactory();
++    }
++
++    /**
++     * Creates the {@link DocletTagFactory} to be used by the collector.
++     * @return the doclet tag factory
++     */
++    protected DocletTagFactory createDocletTagFactory() {
++        return new DefaultDocletTagFactory();
++    }
++
++    /**
++     * Scans a file and processes it if it extends the {@link EventProducer} interface.
++     * @param src the source file (a Java source file)
++     * @return true if the file contained an EventProducer interface
++     * @throws IOException if an I/O error occurs
++     * @throws EventConventionException if the EventProducer conventions are violated
++     * @throws ClassNotFoundException if a required class cannot be found
++     */
++    public boolean scanFile(File src)
++            throws IOException, EventConventionException, ClassNotFoundException {
++        JavaDocBuilder builder = new JavaDocBuilder(this.tagFactory);
++        builder.addSource(src);
++        JavaClass[] classes = builder.getClasses();
++        boolean eventProducerFound = false;
++        for (int i = 0, c = classes.length; i < c; i++) {
++            JavaClass clazz = classes[i];
++            if (clazz.isInterface() && implementsInterface(clazz, CLASSNAME_EVENT_PRODUCER)) {
++                processEventProducerInterface(clazz);
++                eventProducerFound = true;
++            }
++        }
++        return eventProducerFound;
++    }
++
++    private boolean implementsInterface(JavaClass clazz, String intf) {
++        JavaClass[] classes = clazz.getImplementedInterfaces();
++        for (int i = 0, c = classes.length; i < c; i++) {
++            JavaClass cl = classes[i];
++            if (cl.getFullyQualifiedName().equals(intf)) {
++                return true;
++            }
++        }
++        return false;
++    }
++
++    /**
++     * Processes an EventProducer interface and creates an EventProducerModel from it.
++     * @param clazz the EventProducer interface
++     * @throws EventConventionException if the event producer conventions are violated
++     * @throws ClassNotFoundException if a required class cannot be found
++     */
++    protected void processEventProducerInterface(JavaClass clazz)
++                throws EventConventionException, ClassNotFoundException {
++        EventProducerModel prodMeta = new EventProducerModel(clazz.getFullyQualifiedName());
++        JavaMethod[] methods = clazz.getMethods(true);
++        for (int i = 0, c = methods.length; i < c; i++) {
++            JavaMethod method = methods[i];
++            EventMethodModel methodMeta = createMethodModel(method);
++            prodMeta.addMethod(methodMeta);
++        }
++        EventModel model = new EventModel();
++        model.addProducer(prodMeta);
++        models.add(model);
++    }
++
++    private EventMethodModel createMethodModel(JavaMethod method)
++            throws EventConventionException, ClassNotFoundException {
++        JavaClass clazz = method.getParentClass();
++        //Check EventProducer conventions
++        if (!method.getReturns().isVoid()) {
++            throw new EventConventionException("All methods of interface "
++                    + clazz.getFullyQualifiedName() + " must have return type 'void'!");
++        }
++        String methodSig = clazz.getFullyQualifiedName() + "." + method.getCallSignature();
++        JavaParameter[] params = method.getParameters();
++        if (params.length < 1) {
++            throw new EventConventionException("The method " + methodSig
++                    + " must have at least one parameter: 'Object source'!");
++        }
++        Type firstType = params[0].getType();
++        if (firstType.isPrimitive() || !"source".equals(params[0].getName())) {
++            throw new EventConventionException("The first parameter of the method " + methodSig
++                    + " must be: 'Object source'!");
++        }
++
++        //build method model
++        DocletTag tag = method.getTagByName("event.severity");
++        EventSeverity severity;
++        if (tag != null) {
++            severity = EventSeverity.valueOf(tag.getValue());
++        } else {
++            severity = EventSeverity.INFO;
++        }
++        EventMethodModel methodMeta = new EventMethodModel(
++                method.getName(), severity);
++        if (params.length > 1) {
++            for (int j = 1, cj = params.length; j < cj; j++) {
++                JavaParameter p = params[j];
++                Class type;
++                JavaClass pClass = p.getType().getJavaClass();
++                if (p.getType().isPrimitive()) {
++                    type = (Class)PRIMITIVE_MAP.get(pClass.getName());
++                    if (type == null) {
++                        throw new UnsupportedOperationException(
++                                "Primitive datatype not supported: " + pClass.getName());
++                    }
++                } else {
++                    String className = pClass.getFullyQualifiedName();
++                    type = Class.forName(className);
++                }
++                methodMeta.addParameter(type, p.getName());
++            }
++        }
++        Type[] exceptions = method.getExceptions();
++        if (exceptions != null && exceptions.length > 0) {
++            //We only use the first declared exception because that is always thrown
++            JavaClass cl = exceptions[0].getJavaClass();
++            methodMeta.setExceptionClass(cl.getFullyQualifiedName());
++            methodMeta.setSeverity(EventSeverity.FATAL); //In case it's not set in the comments
++        }
++        return methodMeta;
++    }
++
++    /**
++     * Returns the event model that has been accumulated.
++     * @return the event model.
++     */
++    public List getModels() {
++        return this.models;
++    }
++
++}
+--- fop-1.0.dfsg.orig/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java
++++ fop-1.0.dfsg/src/codegen/java/org/apache/fop/tools/EventProducerCollector.java
+@@ -15,13 +15,12 @@
+  * limitations under the License.
+  */
+ 
+-/* $Id: EventProducerCollector.java 932502 2010-04-09 16:48:27Z vhennebert $ */
++/* $Id: EventProducerCollector.java 1066078 2011-02-01 16:04:41Z jeremias $ */
+ 
+ package org.apache.fop.tools;
+ 
+ import java.io.File;
+ import java.io.IOException;
+-import java.util.ArrayList;
+ import java.util.Collections;
+ import java.util.List;
+ import java.util.Map;
+@@ -47,10 +46,10 @@ import com.thoughtworks.qdox.model.Type;
+ class EventProducerCollector {
+ 
+     private static final String CLASSNAME_EVENT_PRODUCER = EventProducer.class.getName();
+-    private static final Map PRIMITIVE_MAP;
++    private static final Map<String, Class<?>> PRIMITIVE_MAP;
+ 
+     static {
+-        Map m = new java.util.HashMap();
++        Map <String, Class<?>> m = new java.util.HashMap<String, Class<?>>();
+         m.put("boolean", Boolean.class);
+         m.put("byte", Byte.class);
+         m.put("char", Character.class);
+@@ -63,7 +62,7 @@ class EventProducerCollector {
+     }
+ 
+     private DocletTagFactory tagFactory;
+-    private List models = new ArrayList();
++    private List<EventModel> models = new java.util.ArrayList<EventModel>();
+ 
+     /**
+      * Creates a new EventProducerCollector.
+@@ -123,6 +122,9 @@ class EventProducerCollector {
+      */
+     protected void processEventProducerInterface(JavaClass clazz)
+                 throws EventConventionException, ClassNotFoundException {
++    	if (clazz.getParentClass() == null || clazz.getParentClass().getName().equals("java.lang.Object")) {
++    		return;
++    	}
+         EventProducerModel prodMeta = new EventProducerModel(clazz.getFullyQualifiedName());
+         JavaMethod[] methods = clazz.getMethods(true);
+         for (int i = 0, c = methods.length; i < c; i++) {
+@@ -139,7 +141,7 @@ class EventProducerCollector {
+             throws EventConventionException, ClassNotFoundException {
+         JavaClass clazz = method.getParentClass();
+         //Check EventProducer conventions
+-        if (!method.getReturns().isVoid()) {
++        if (!method.getReturnType().isVoid()) {
+             throw new EventConventionException("All methods of interface "
+                     + clazz.getFullyQualifiedName() + " must have return type 'void'!");
+         }
+@@ -168,10 +170,10 @@ class EventProducerCollector {
+         if (params.length > 1) {
+             for (int j = 1, cj = params.length; j < cj; j++) {
+                 JavaParameter p = params[j];
+-                Class type;
++                Class<?> type;
+                 JavaClass pClass = p.getType().getJavaClass();
+                 if (p.getType().isPrimitive()) {
+-                    type = (Class)PRIMITIVE_MAP.get(pClass.getName());
++                    type = PRIMITIVE_MAP.get(pClass.getName());
+                     if (type == null) {
+                         throw new UnsupportedOperationException(
+                                 "Primitive datatype not supported: " + pClass.getName());
+@@ -197,7 +199,7 @@ class EventProducerCollector {
+      * Returns the event model that has been accumulated.
+      * @return the event model.
+      */
+-    public List getModels() {
++    public List<EventModel> getModels() {
+         return this.models;
+     }
+ 

Modified: trunk/fop/debian/patches/series
===================================================================
--- trunk/fop/debian/patches/series	2011-08-22 14:30:22 UTC (rev 14388)
+++ trunk/fop/debian/patches/series	2011-08-22 14:31:16 UTC (rev 14389)
@@ -0,0 +1 @@
+debian-changes-1:1.0.dfsg-4




More information about the pkg-java-commits mailing list