This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git

commit d70dde37043e042f688a6630b3fdd3c43fa929d7
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue May 16 10:34:42 2023 -0400

    Encapsulate PngChunkItxt
---
 .../commons/imaging/formats/png/PngImageParser.java   |  2 +-
 .../imaging/formats/png/chunks/PngChunkItxt.java      | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java 
b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
index 55ad873e..3871b9f2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
@@ -457,7 +457,7 @@ public class PngImageParser extends 
ImageParser<PngImagingParameters>  implement
         }
         for (final PngChunk iTXt : iTXts) {
             final PngChunkItxt pngChunkiTXt = (PngChunkItxt) iTXt;
-            comments.add(pngChunkiTXt.keyword + ": " + pngChunkiTXt.text);
+            comments.add(pngChunkiTXt.getKeyword() + ": " + 
pngChunkiTXt.getText());
             textChunks.add(pngChunkiTXt.getContents());
         }
 
diff --git 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java
index 247c574a..55cd8a1d 100644
--- 
a/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java
+++ 
b/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkItxt.java
@@ -30,10 +30,11 @@ import org.apache.commons.imaging.formats.png.PngConstants;
 import org.apache.commons.imaging.formats.png.PngText;
 
 public class PngChunkItxt extends PngTextChunk {
-    public final String keyword;
-    public final String text;
 
-    /*
+    private final String keyword;
+    private final String text;
+
+    /**
      * The language tag defined in [RFC-3066] indicates the human language used
      * by the translated keyword and the text. Unlike the keyword, the language
      * tag is case-insensitive. It is an ISO 646.IRV:1991 [ISO 646] string
@@ -42,9 +43,9 @@ public class PngChunkItxt extends PngTextChunk {
      * is two or three letters long, it is an ISO language code [ISO-639]. If
      * the language tag is empty, the language is unspecified.
      */
-    public final String languageTag;
+    private final String languageTag;
 
-    public final String translatedKeyword;
+    private final String translatedKeyword;
 
     public PngChunkItxt(final int length, final int chunkType, final int crc, 
final byte[] bytes)
             throws ImagingException, IOException {
@@ -108,7 +109,7 @@ public class PngChunkItxt extends PngTextChunk {
     }
 
     /**
-     * @return Returns the keyword.
+     * @return Gets the keyword.
      */
     @Override
     public String getKeyword() {
@@ -116,10 +117,14 @@ public class PngChunkItxt extends PngTextChunk {
     }
 
     /**
-     * @return Returns the text.
+     * @return Gets the text.
      */
     @Override
     public String getText() {
         return text;
     }
+
+    public String getTranslatedKeyword() {
+        return translatedKeyword;
+    }
 }

Reply via email to