You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/01/25 20:37:26 UTC
svn commit: r1852178 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFStampAnnotationAppearance.java
Author: tilman
Date: Fri Jan 25 20:37:26 2019
New Revision: 1852178
URL: http://svn.apache.org/viewvc?rev=1852178&view=rev
Log:
PDFBOX-4437: simplify code
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFStampAnnotationAppearance.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFStampAnnotationAppearance.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFStampAnnotationAppearance.java?rev=1852178&r1=1852177&r2=1852178&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFStampAnnotationAppearance.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFStampAnnotationAppearance.java Fri Jan 25 20:37:26 2019
@@ -77,8 +77,6 @@ class FDFStampAnnotationAppearance imple
LOG.debug("Build dictionary for Appearance based on the appearanceXML");
NodeList nodeList = appearanceXML.getChildNodes();
- Node node = null;
- Element child = null;
String parentAttrKey = appearanceXML.getAttribute("KEY");
LOG.debug("Appearance Root - tag: " + appearanceXML.getTagName() + ", name: " +
appearanceXML.getNodeName() + ", key: " + parentAttrKey + ", children: " +
@@ -89,10 +87,10 @@ class FDFStampAnnotationAppearance imple
{
for (int i = 0; i < nodeList.getLength(); i++)
{
- node = nodeList.item(i);
+ Node node = nodeList.item(i);
if (node instanceof Element)
{
- child = (Element) node;
+ Element child = (Element) node;
if ("STREAM".equalsIgnoreCase(child.getTagName()))
{
LOG.debug(parentAttrKey +
@@ -127,18 +125,16 @@ class FDFStampAnnotationAppearance imple
COSStream stream = new COSStream();
NodeList nodeList = streamEl.getChildNodes();
- Node node;
- Element child;
String childAttrKey;
String childAttrVal;
String parentAttrKey = streamEl.getAttribute("KEY");
for (int i = 0; i < nodeList.getLength(); i++)
{
- node = nodeList.item(i);
+ Node node = nodeList.item(i);
if (node instanceof Element)
{
- child = (Element) node;
+ Element child = (Element) node;
childAttrKey = child.getAttribute("KEY");
childAttrVal = child.getAttribute("VAL");
LOG.debug(parentAttrKey + " => reading child: " + child.getTagName() +
@@ -218,8 +214,6 @@ class FDFStampAnnotationAppearance imple
LOG.debug("Parse " + arrayEl.getAttribute("KEY") + " Array");
COSArray array = new COSArray();
NodeList nodeList = arrayEl.getElementsByTagName("FIXED");
- Node node;
- Element el;
String elAttrKey = arrayEl.getAttribute("KEY");
if ("BBox".equals(elAttrKey))
@@ -243,10 +237,10 @@ class FDFStampAnnotationAppearance imple
for (int i = 0; i < nodeList.getLength(); i++)
{
- node = nodeList.item(i);
+ Node node = nodeList.item(i);
if (node instanceof Element)
{
- el = (Element) node;
+ Element el = (Element) node;
LOG.debug(elAttrKey + " value(" + i + "): " + el.getAttribute("VAL"));
array.add(new COSFloat(el.getAttribute("VAL")));
}
@@ -261,20 +255,16 @@ class FDFStampAnnotationAppearance imple
COSDictionary dict = new COSDictionary();
NodeList nodeList = dictEl.getChildNodes();
- Node node;
- Element child;
- String childAttrKey;
- String childAttrVal;
String parentAttrKey = dictEl.getAttribute("KEY");
for (int i = 0; i < nodeList.getLength(); i++)
{
- node = nodeList.item(i);
+ Node node = nodeList.item(i);
if (node instanceof Element)
{
- child = (Element) node;
- childAttrKey = child.getAttribute("KEY");
- childAttrVal = child.getAttribute("VAL");
+ Element child = (Element) node;
+ String childAttrKey = child.getAttribute("KEY");
+ String childAttrVal = child.getAttribute("VAL");
if ("DICT".equals(child.getTagName()))
{