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

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git


The following commit(s) were added to refs/heads/master by this push:
     new f919f73  PDFBOX-5660: Sonar fix
f919f73 is described below

commit f919f73a1f4826d6298c495f77f4c72fdbc4b7d2
Author: Tilman Hausherr <[email protected]>
AuthorDate: Thu May 14 11:50:53 2026 +0200

    PDFBOX-5660: Sonar fix
---
 .../pdfbox/jbig2/decoder/huffman/HuffmanTable.java |  4 +--
 .../jbig2/decoder/huffman/StandardTables.java      |  2 +-
 .../pdfbox/jbig2/decoder/mmr/MMRDecompressor.java  | 20 ++++++------
 .../apache/pdfbox/jbig2/image/BitmapScanline.java  | 10 +++---
 .../java/org/apache/pdfbox/jbig2/image/Filter.java | 18 +++++------
 .../org/apache/pdfbox/jbig2/image/Resizer.java     | 16 +++++-----
 .../org/apache/pdfbox/jbig2/image/Scanline.java    | 36 +++++++++++-----------
 .../org/apache/pdfbox/jbig2/io/SubInputStream.java |  2 +-
 .../apache/pdfbox/jbig2/segments/TextRegion.java   |  2 +-
 9 files changed, 55 insertions(+), 55 deletions(-)

diff --git 
a/src/main/java/org/apache/pdfbox/jbig2/decoder/huffman/HuffmanTable.java 
b/src/main/java/org/apache/pdfbox/jbig2/decoder/huffman/HuffmanTable.java
index f630a8b..87e919b 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/decoder/huffman/HuffmanTable.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/decoder/huffman/HuffmanTable.java
@@ -100,14 +100,14 @@ public abstract class HuffmanTable
             maxPrefixLength = Math.max(maxPrefixLength, c.prefixLength);
         }
 
-        int lenCount[] = new int[maxPrefixLength + 1];
+        int[] lenCount = new int[maxPrefixLength + 1];
         for (Code c : codeTable)
         {
             lenCount[c.prefixLength]++;
         }
 
         int curCode;
-        int firstCode[] = new int[lenCount.length + 1];
+        int[] firstCode = new int[lenCount.length + 1];
         lenCount[0] = 0;
 
         /* Annex B.3 3) */
diff --git 
a/src/main/java/org/apache/pdfbox/jbig2/decoder/huffman/StandardTables.java 
b/src/main/java/org/apache/pdfbox/jbig2/decoder/huffman/StandardTables.java
index 5a2c5fd..92fb405 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/decoder/huffman/StandardTables.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/decoder/huffman/StandardTables.java
@@ -47,7 +47,7 @@ public class StandardTables
     }
 
     // Fourth Value (999) is used for the LowerRange-line
-    private static final int TABLES[][][] = {
+    private static final int[][][] TABLES = {
             // B1
             { { 1, 4, 0 }, //
                     { 2, 8, 16 }, //
diff --git 
a/src/main/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressor.java 
b/src/main/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressor.java
index 5183a51..9cf06e6 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressor.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressor.java
@@ -78,12 +78,12 @@ public class MMRDecompressor
             }
         }
 
-        private Code uncompressGetCode(Code table[])
+        private Code uncompressGetCode(Code[] table)
         {
             return uncompressGetCodeLittleEndian(table);
         }
 
-        private Code uncompressGetCodeLittleEndian(Code table[])
+        private Code uncompressGetCodeLittleEndian(Code[] table)
         {
             final int code = uncompressGetNextCodeLittleEndian() & 0xffffff;
             Code result = table[code >> CODE_OFFSET - FIRST_LEVEL_TABLE_SIZE];
@@ -238,11 +238,11 @@ public class MMRDecompressor
 
     private static final class Code
     {
-        Code subTable[] = null;
+        Code[] subTable = null;
 
         final int bitLength, codeWord, runLength;
 
-        Code(int codeData[])
+        Code(int[] codeData)
         {
             bitLength = codeData[0];
             codeWord = codeData[1];
@@ -273,9 +273,9 @@ public class MMRDecompressor
     private static final int SECOND_LEVEL_TABLE_SIZE = 5;
     private static final int SECOND_LEVEL_TABLE_MASK = (1 << 
SECOND_LEVEL_TABLE_SIZE) - 1;
 
-    private static Code whiteTable[] = null;
-    private static Code blackTable[] = null;
-    private static Code modeTable[] = null;
+    private static Code[] whiteTable = null;
+    private static Code[] blackTable = null;
+    private static Code[] modeTable = null;
 
     private final RunData data;
 
@@ -535,7 +535,7 @@ public class MMRDecompressor
             }
 
             // Swap lines
-            int tempOffsets[] = referenceOffsets;
+            int[] tempOffsets = referenceOffsets;
             referenceOffsets = currentOffsets;
             currentOffsets = tempOffsets;
             refRunLength = count;
@@ -672,7 +672,7 @@ public class MMRDecompressor
      */
     private static Code[] createLittleEndianTable(int[][] codes)
     {
-        final Code firstLevelTable[] = new Code[FIRST_LEVEL_TABLE_MASK + 1];
+        final Code[] firstLevelTable = new Code[FIRST_LEVEL_TABLE_MASK + 1];
         for (int[] cod : codes)
         {
             final Code code = new Code(cod);
@@ -703,7 +703,7 @@ public class MMRDecompressor
                 // fill second level table
                 if (code.bitLength <= FIRST_LEVEL_TABLE_SIZE + 
SECOND_LEVEL_TABLE_SIZE)
                 {
-                    final Code secondLevelTable[] = 
firstLevelTable[firstLevelIndex].subTable;
+                    final Code[] secondLevelTable = 
firstLevelTable[firstLevelIndex].subTable;
                     final int variantLength = FIRST_LEVEL_TABLE_SIZE + 
SECOND_LEVEL_TABLE_SIZE
                             - code.bitLength;
                     final int baseWord = (code.codeWord << variantLength) & 
SECOND_LEVEL_TABLE_MASK;
diff --git a/src/main/java/org/apache/pdfbox/jbig2/image/BitmapScanline.java 
b/src/main/java/org/apache/pdfbox/jbig2/image/BitmapScanline.java
index eb19099..f748d5e 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/image/BitmapScanline.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/image/BitmapScanline.java
@@ -69,8 +69,8 @@ final class BitmapScanline extends Scanline
 
         // start sum at 1 << shift - 1 for rounding
         final int start = 1 << postShift[0] - 1;
-        final int srcBuffer[] = lineBuffer;
-        final int dstBuffer[] = dstBitmapScanline.lineBuffer;
+        final int[] srcBuffer = lineBuffer;
+        final int[] dstBuffer = dstBitmapScanline.lineBuffer;
 
         // the next two blocks are duplicated except for the missing shift 
operation if preShift == 0.
         final int preShift0 = preShift[0];
@@ -117,8 +117,8 @@ final class BitmapScanline extends Scanline
     {
         final BitmapScanline dstBitmapScanline = (BitmapScanline) dst;
 
-        final int srcBuffer[] = lineBuffer;
-        final int dstBuffer[] = dstBitmapScanline.lineBuffer;
+        final int[] srcBuffer = lineBuffer;
+        final int[] dstBuffer = dstBitmapScanline.lineBuffer;
 
         for (int b = 0; b < dstBuffer.length; b++)
             dstBuffer[b] += weight * srcBuffer[b];
@@ -130,7 +130,7 @@ final class BitmapScanline extends Scanline
         final int shift0 = shift[0];
         final int half = 1 << shift0 - 1;
 
-        final int srcBuffer[] = lineBuffer;
+        final int[] srcBuffer = lineBuffer;
 
         for (int b = 0; b < srcBuffer.length; b++)
         {
diff --git a/src/main/java/org/apache/pdfbox/jbig2/image/Filter.java 
b/src/main/java/org/apache/pdfbox/jbig2/image/Filter.java
index bdcdad6..ff160e9 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/image/Filter.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/image/Filter.java
@@ -103,12 +103,12 @@ abstract class Filter
 
             int i;
 
-            final double Pone[] = { 0.581199354001606143928050809e+21,
+            final double[] Pone = { 0.581199354001606143928050809e+21,
                     -0.6672106568924916298020941484e+20, 
0.2316433580634002297931815435e+19,
                     -0.3588817569910106050743641413e+17, 
0.2908795263834775409737601689e+15,
                     -0.1322983480332126453125473247e+13, 
0.3413234182301700539091292655e+10,
-                    -0.4695753530642995859767162166e+7, 
0.270112271089232341485679099e+4 },
-                    Qone[] = { 0.11623987080032122878585294e+22, 
0.1185770712190320999837113348e+20,
+                    -0.4695753530642995859767162166e+7, 
0.270112271089232341485679099e+4 };
+            final double[] Qone = { 0.11623987080032122878585294e+22, 
0.1185770712190320999837113348e+20,
                             0.6092061398917521746105196863e+17, 
0.2081661221307607351240184229e+15,
                             0.5243710262167649715406728642e+12, 
0.1013863514358673989967045588e+10,
                             0.1501793594998585505921097578e+7, 
0.1606931573481487801970916749e+4,
@@ -130,11 +130,11 @@ abstract class Filter
 
             int i;
 
-            final double Pone[] = { 0.352246649133679798341724373e+5,
+            final double[] Pone = { 0.352246649133679798341724373e+5,
                     0.62758845247161281269005675e+5, 
0.313539631109159574238669888e+5,
                     0.49854832060594338434500455e+4, 
0.2111529182853962382105718e+3,
-                    0.12571716929145341558495e+1 },
-                    Qone[] = { 0.352246649133679798068390431e+5, 
0.626943469593560511888833731e+5,
+                    0.12571716929145341558495e+1 };
+            final double[] Qone = { 0.352246649133679798068390431e+5, 
0.626943469593560511888833731e+5,
                             0.312404063819041039923015703e+5, 
0.4930396490181088979386097e+4,
                             0.2030775189134759322293574e+3, 0.1e+1 };
 
@@ -154,10 +154,10 @@ abstract class Filter
 
             int i;
 
-            final double Pone[] = { 0.3511751914303552822533318e+3, 
0.7210391804904475039280863e+3,
+            final double[] Pone = { 0.3511751914303552822533318e+3, 
0.7210391804904475039280863e+3,
                     0.4259873011654442389886993e+3, 
0.831898957673850827325226e+2,
-                    0.45681716295512267064405e+1, 0.3532840052740123642735e-1 
},
-                    Qone[] = { 0.74917374171809127714519505e+4, 
0.154141773392650970499848051e+5,
+                    0.45681716295512267064405e+1, 0.3532840052740123642735e-1 
};
+            final double[] Qone = { 0.74917374171809127714519505e+4, 
0.154141773392650970499848051e+5,
                             0.91522317015169922705904727e+4, 
0.18111867005523513506724158e+4,
                             0.1038187585462133728776636e+3, 0.1e+1 };
 
diff --git a/src/main/java/org/apache/pdfbox/jbig2/image/Resizer.java 
b/src/main/java/org/apache/pdfbox/jbig2/image/Resizer.java
index 4a7bf2c..4492553 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/image/Resizer.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/image/Resizer.java
@@ -86,11 +86,11 @@ class Resizer
     private int weightOne = 1 << weightBits;
 
     /** Number of bits per channel */
-    private int bitsPerChannel[] = new int[] { 8, 8, 8 };
+    private int[] bitsPerChannel = new int[] { 8, 8, 8 };
 
-    private static final int NO_SHIFT[] = new int[16];
+    private static final int[] NO_SHIFT= new int[16];
 
-    private int finalShift[] = new int[] { 2 * weightBits - bitsPerChannel[0],
+    private int[] finalShift = new int[] { 2 * weightBits - bitsPerChannel[0],
             2 * weightBits - bitsPerChannel[1], 2 * weightBits - 
bitsPerChannel[2] };
 
     /**
@@ -157,7 +157,7 @@ class Resizer
         final int dstX0 = dstBounds.x;
         final int dstX1 = dstBounds.x + dstBounds.width;
 
-        final Weighttab tabs[] = new Weighttab[dstBounds.width];
+        final Weighttab[] tabs = new Weighttab[dstBounds.width];
         for (int dstX = dstX0; dstX < dstX1; dstX++)
         {
             final double center = mappingX.mapPixelCenter(dstX);
@@ -209,11 +209,11 @@ class Resizer
         final Scanline accumulator = createScanline(src, dst, dstBounds.width);
 
         // a sampled filter for source pixels for each dest x position
-        final Weighttab xWeights[] = createXWeights(srcBounds, dstBounds, 
xFilter);
+        final Weighttab[] xWeights = createXWeights(srcBounds, dstBounds, 
xFilter);
 
         // Circular buffer of active lines
         final int yBufferSize = yFilter.width + 2;
-        final Scanline lineBuffer[] = new Scanline[yBufferSize];
+        final Scanline[] lineBuffer = new Scanline[yBufferSize];
         for (int y = 0; y < yBufferSize; y++)
         {
             lineBuffer[y] = createScanline(src, dst, dstBounds.width);
@@ -287,11 +287,11 @@ class Resizer
         final Scanline accumulator = createScanline(src, dst, srcBounds.width);
 
         // a sampled filter for source pixels for each destination x position
-        final Weighttab xWeights[] = createXWeights(srcBounds, dstBounds, 
xFilter);
+        final Weighttab[] xWeights = createXWeights(srcBounds, dstBounds, 
xFilter);
 
         // Circular buffer of active lines
         final int yBufferSize = yFilter.width + 2;
-        final Scanline lineBuffer[] = new Scanline[yBufferSize];
+        final Scanline[] lineBuffer = new Scanline[yBufferSize];
         for (int y = 0; y < yBufferSize; y++)
         {
             lineBuffer[y] = createScanline(src, dst, srcBounds.width);
diff --git a/src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java 
b/src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java
index 7353a47..8ad6929 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java
@@ -55,8 +55,8 @@ abstract class Scanline
         {
             final ByteBGRScanline bcs = (ByteBGRScanline) dst;
 
-            final int abuf[] = data;
-            final int bbuf[] = bcs.data;
+            final int[] abuf = data;
+            final int[] bbuf = bcs.data;
 
             for (int b = 0; b < bbuf.length; b++)
                 bbuf[b] += weight * abuf[b];
@@ -84,10 +84,10 @@ abstract class Scanline
             final int nx = dst.length;
 
             // start sum at 1<<shift-1 for rounding
-            final int start[] = new int[] { 1 << postShift[0] - 1, 1 << 
postShift[1] - 1,
+            final int[] start = new int[] { 1 << postShift[0] - 1, 1 << 
postShift[1] - 1,
                     1 << postShift[2] - 1 };
-            final int abuf[] = data;
-            final int bbuf[] = bcs.data;
+            final int[] abuf = data;
+            final int[] bbuf = bcs.data;
 
             // the next two blocks are duplicated except for the missing shift
             // operation if preShift==0.
@@ -141,10 +141,10 @@ abstract class Scanline
         @Override
         protected void shift(final int[] shift)
         {
-            final int half[] = new int[] { 1 << shift[0] - 1, 1 << shift[1] - 
1,
+            final int[] half = new int[] { 1 << shift[0] - 1, 1 << shift[1] - 
1,
                     1 << shift[2] - 1 };
 
-            final int abuf[] = data;
+            final int[] abuf = data;
 
             for (int b = 0; b < abuf.length;)
             {
@@ -204,8 +204,8 @@ abstract class Scanline
         {
             final IntegerSinglePixelPackedScanline ispps = 
(IntegerSinglePixelPackedScanline) dst;
 
-            final int abuf[] = data;
-            final int bbuf[] = ispps.data;
+            final int[] abuf = data;
+            final int[] bbuf = ispps.data;
 
             for (int b = 0; b < bbuf.length; b++)
                 bbuf[b] += weight * abuf[b];
@@ -233,12 +233,12 @@ abstract class Scanline
             final int nx = dst.length;
 
             // start sum at 1<<shift-1 for rounding
-            final int start[] = tmp;
+            final int[] start = tmp;
             for (int c = 0; c < componentCount; c++)
                 start[c] = 1 << postShift[c] - 1;
 
-            final int abuf[] = data;
-            final int bbuf[] = ispps.data;
+            final int[] abuf = data;
+            final int[] bbuf = ispps.data;
 
             // the next two blocks are duplicated except for the missing shift
             // operation if preShift==0.
@@ -283,11 +283,11 @@ abstract class Scanline
         @Override
         protected void shift(final int[] shift)
         {
-            final int half[] = tmp;
+            final int[] half = tmp;
             for (int c = 0; c < componentCount; c++)
                 half[c] = 1 << shift[c] - 1;
 
-            final int abuf[] = data;
+            final int[] abuf = data;
 
             for (int b = 0; b < abuf.length;)
             {
@@ -323,7 +323,7 @@ abstract class Scanline
         private final ScanlineFilter inputFilter;
 
         protected GenericRasterScanline(Raster src, WritableRaster dst, final 
int length,
-                int bitsPerChannel[], ScanlineFilter inputFilter)
+                int[] bitsPerChannel, ScanlineFilter inputFilter)
         {
             super(length);
             srcRaster = src;
@@ -536,8 +536,8 @@ abstract class Scanline
 
             // start sum at 1<<shift-1 for rounding
             final int start = 1 << postShift[0] - 1;
-            final int abuf[] = data;
-            final int bbuf[] = bblps.data;
+            final int[] abuf = data;
+            final int[] bbuf = bblps.data;
 
             // the next two blocks are duplicated except for the missing shift
             // operation if preShift==0.
@@ -580,7 +580,7 @@ abstract class Scanline
             final int shift0 = shift[0];
             final int half = 1 << shift0 - 1;
 
-            final int abuf[] = data;
+            final int[] abuf = data;
 
             for (int b = 0; b < abuf.length; b++)
             {
diff --git a/src/main/java/org/apache/pdfbox/jbig2/io/SubInputStream.java 
b/src/main/java/org/apache/pdfbox/jbig2/io/SubInputStream.java
index bd21067..c416e4d 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/io/SubInputStream.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/io/SubInputStream.java
@@ -45,7 +45,7 @@ public class SubInputStream extends ImageInputStreamImpl
     /**
      * A buffer which is used to improve read performance.
      */
-    private final byte buffer[] = new byte[4096];
+    private final byte[] buffer = new byte[4096];
 
     /**
      * Location of the first byte in the buffer with respect to the start of 
the stream.
diff --git a/src/main/java/org/apache/pdfbox/jbig2/segments/TextRegion.java 
b/src/main/java/org/apache/pdfbox/jbig2/segments/TextRegion.java
index 769b5bf..2cd72ca 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/segments/TextRegion.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/segments/TextRegion.java
@@ -1149,7 +1149,7 @@ public class TextRegion implements Region
             short sbCombinationOperator, short transposed, short refCorner, 
short sbdsOffset,
             short sbHuffFS, short sbHuffDS, short sbHuffDT, short 
sbHuffRDWidth,
             short sbHuffRDHeight, short sbHuffRDX, short sbHuffRDY, short 
sbHuffRSize,
-            short sbrTemplate, short sbrATX[], short sbrATY[], 
ArrayList<Bitmap> sbSyms,
+            short sbrTemplate, short[] sbrATX, short[] sbrATY, 
ArrayList<Bitmap> sbSyms,
             int sbSymCodeLen)
     {
 

Reply via email to