Author: gadams
Date: Sat Apr  7 20:23:56 2012
New Revision: 1310853

URL: http://svn.apache.org/viewvc?rev=1310853&view=rev
Log:
Bugzilla #49763: Incorrect message when encountering a block in an inline in a 
footnote

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FONode.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FONode.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FONode.java?rev=1310853&r1=1310852&r2=1310853&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FONode.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FONode.java Sat Apr  7 
20:23:56 2012
@@ -405,6 +405,27 @@ public abstract class FONode implements 
     }
 
     /**
+     * Helper function to obtain standard usage prefix for FOP related
+     * namespace URIs.
+     * @param namespaceURI URI of node found
+     *         (e.g., "http://www.w3.org/1999/XSL/Format";)
+     * @return the prefix or null if none
+     */
+    public static String getNodePrefix(String namespaceURI) {
+        if (namespaceURI.equals(FOElementMapping.URI)) {
+            return "fo";
+        } else if (namespaceURI.equals(ExtensionElementMapping.URI)) {
+            return "fox";
+        } else if (namespaceURI.equals(InternalElementMapping.URI)) {
+            return "foi";
+        } else if (namespaceURI.equals(SVGElementMapping.URI)) {
+            return "svg";
+        } else {
+            return null;
+        }
+    }
+
+    /**
      * Helper function to standardize the names of all namespace URI - local
      * name pairs in text messages.
      * For readability, using fo:, fox:, svg:, for those namespaces even
@@ -416,14 +437,9 @@ public abstract class FONode implements 
      * with the unabbreviated URI otherwise.
      */
     public static String getNodeString(String namespaceURI, String localName) {
-        if (namespaceURI.equals(FOElementMapping.URI)) {
-            return "fo:" + localName;
-        } else if (namespaceURI.equals(ExtensionElementMapping.URI)) {
-            return "fox:" + localName;
-        } else if (namespaceURI.equals(InternalElementMapping.URI)) {
-            return "foi:" + localName;  // used FOP internally for 
accessibility
-        } else if (namespaceURI.equals(SVGElementMapping.URI)) {
-            return "svg:" + localName;
+        String prefix = getNodePrefix ( namespaceURI );
+        if ( prefix != null ) {
+            return prefix + ":" + localName;
         } else {
             return "(Namespace URI: \"" + namespaceURI + "\", "
                     + "Local Name: \"" + localName + "\")";
@@ -527,16 +543,22 @@ public abstract class FONode implements 
      *
      * @param loc org.xml.sax.Locator object of the error (*not* parent node)
      * @param parentName the name of the parent element
-     * @param nsURI namespace URI of incoming invalid node
-     * @param lName local name (i.e., no prefix) of incoming node
+     * @param nsURI namespace URI of incoming offending node
+     * @param lName local name (i.e., no prefix) of incoming offending node
      * @param ruleViolated name of the rule violated (used to lookup a 
resource in a bundle)
      * @throws ValidationException the validation error provoked by the method 
call
      */
     protected void invalidChildError(Locator loc, String parentName, String 
nsURI, String lName,
                 String ruleViolated)
                 throws ValidationException {
-        getFOValidationEventProducer().invalidChild(this, parentName,
-                new QName(nsURI, lName), ruleViolated, loc);
+        String prefix = getNodePrefix ( nsURI );
+        QName qn; // qualified name of offending node
+        if ( prefix != null ) {
+            qn = new QName(nsURI, prefix, lName);
+        } else {
+            qn = new QName(nsURI, lName);
+        }
+        getFOValidationEventProducer().invalidChild(this, parentName, qn, 
ruleViolated, loc);
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java?rev=1310853&r1=1310852&r2=1310853&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Inline.java Sat Apr  
7 20:23:56 2012
@@ -118,8 +118,7 @@ public class Inline extends InlineLevel 
                 invalidChildError(loc, nsURI, localName);
             } else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, 
localName)
                        && !isNeutralItem(nsURI, localName)) {
-                invalidChildError(loc, getParent().getName(), nsURI, getName(),
-                                  "rule.inlineContent");
+                invalidChildError(loc, getName(), nsURI, localName, 
"rule.inlineContent");
             } else {
                 blockOrInlineItemFound = true;
             }

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java?rev=1310853&r1=1310852&r2=1310853&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/ps/NativeTextHandler.java 
Sat Apr  7 20:23:56 2012
@@ -31,7 +31,6 @@ import org.apache.xmlgraphics.ps.PSGener
 import org.apache.fop.fonts.Font;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontSetup;
-import org.apache.fop.fonts.FontTriplet;
 
 /**
  * Specialized TextHandler implementation that the PSGraphics2D class 
delegates to to paint text

Modified: xmlgraphics/fop/trunk/status.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1310853&r1=1310852&r2=1310853&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Sat Apr  7 20:23:56 2012
@@ -62,6 +62,9 @@
       documents. Example: the fix of marks layering will be such a case when 
it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Code" dev="GA" type="fix" fixes-bug="49763" 
due-to="Adrian Buza">
+        Incorrect message when encountering a block in an inline in a footnote.
+      </action>
       <action context="Code" dev="GA" type="fix" fixes-bug="47380" 
due-to="Georg Datterl">
         Specified rule-thickness applies only when leader-pattern is rule, 
otherwise should use default thickness.
       </action>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to