Skip to content

Commit 14b52eb

Browse files
committed
Use final for parameters.
1 parent fcca356 commit 14b52eb

41 files changed

Lines changed: 115 additions & 115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/org/apache/commons/io/FileSystemUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ long freeSpaceOS(final String path, final int os, final boolean kb, final long t
293293
* @return the amount of free drive space on the drive
294294
* @throws IOException if an error occurs
295295
*/
296-
long freeSpaceWindows(String path, final long timeout) throws IOException {
296+
long freeSpaceWindows(final String path, final long timeout) throws IOException {
297297
String normPath = FilenameUtils.normalize(path, false);
298298
if (normPath == null) {
299299
throw new IllegalArgumentException(path);

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ public static void copyDirectory(final File srcDir, final File destDir,
13721372
* @param dest the destination
13731373
* @throws FileNotFoundException if the destination does not exist
13741374
*/
1375-
private static void checkFileRequirements(File src, File dest) throws FileNotFoundException {
1375+
private static void checkFileRequirements(final File src, final File dest) throws FileNotFoundException {
13761376
if (src == null) {
13771377
throw new NullPointerException("Source must not be null");
13781378
}
@@ -1735,7 +1735,7 @@ public static void cleanDirectory(final File directory) throws IOException {
17351735
* @return The files in the directory, never null.
17361736
* @throws IOException if an I/O error occurs
17371737
*/
1738-
private static File[] verifiedListFiles(File directory) throws IOException {
1738+
private static File[] verifiedListFiles(final File directory) throws IOException {
17391739
if (!directory.exists()) {
17401740
final String message = directory + " does not exist";
17411741
throw new IllegalArgumentException(message);
@@ -2636,7 +2636,7 @@ private static long sizeOfDirectory0(final File directory) {
26362636
* @param file the file to check
26372637
* @return the size of the file
26382638
*/
2639-
private static long sizeOf0(File file) {
2639+
private static long sizeOf0(final File file) {
26402640
if (file.isDirectory()) {
26412641
return sizeOfDirectory0(file);
26422642
} else {

src/main/java/org/apache/commons/io/FilenameUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ public static String getName(final String filename) {
982982
* This may be used for poison byte attacks.
983983
* @param path the path to check
984984
*/
985-
private static void failIfNullBytePresent(String path) {
985+
private static void failIfNullBytePresent(final String path) {
986986
int len = path.length();
987987
for (int i = 0; i < len; i++) {
988988
if (path.charAt(i) == 0) {

src/main/java/org/apache/commons/io/IOUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ public static InputStream toBufferedInputStream(final InputStream input) throws
585585
* @throws IOException if an I/O error occurs
586586
* @since 2.5
587587
*/
588-
public static InputStream toBufferedInputStream(final InputStream input, int size) throws IOException {
588+
public static InputStream toBufferedInputStream(final InputStream input, final int size) throws IOException {
589589
return ByteArrayOutputStream.toBufferedInputStream(input, size);
590590
}
591591

@@ -614,7 +614,7 @@ public static BufferedReader toBufferedReader(final Reader reader) {
614614
* @see #buffer(Reader)
615615
* @since 2.5
616616
*/
617-
public static BufferedReader toBufferedReader(final Reader reader, int size) {
617+
public static BufferedReader toBufferedReader(final Reader reader, final int size) {
618618
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader, size);
619619
}
620620

@@ -641,7 +641,7 @@ public static BufferedReader buffer(final Reader reader) {
641641
* @throws NullPointerException if the input parameter is null
642642
* @since 2.5
643643
*/
644-
public static BufferedReader buffer(final Reader reader, int size) {
644+
public static BufferedReader buffer(final Reader reader, final int size) {
645645
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader, size);
646646
}
647647

@@ -668,7 +668,7 @@ public static BufferedWriter buffer(final Writer writer) {
668668
* @throws NullPointerException if the input parameter is null
669669
* @since 2.5
670670
*/
671-
public static BufferedWriter buffer(final Writer writer, int size) {
671+
public static BufferedWriter buffer(final Writer writer, final int size) {
672672
return writer instanceof BufferedWriter ? (BufferedWriter) writer : new BufferedWriter(writer, size);
673673
}
674674

@@ -700,7 +700,7 @@ public static BufferedOutputStream buffer(final OutputStream outputStream) {
700700
* @throws NullPointerException if the input parameter is null
701701
* @since 2.5
702702
*/
703-
public static BufferedOutputStream buffer(final OutputStream outputStream, int size) {
703+
public static BufferedOutputStream buffer(final OutputStream outputStream, final int size) {
704704
// reject null early on rather than waiting for IO operation to fail
705705
if (outputStream == null) { // not checked by BufferedOutputStream
706706
throw new NullPointerException();
@@ -737,7 +737,7 @@ public static BufferedInputStream buffer(final InputStream inputStream) {
737737
* @throws NullPointerException if the input parameter is null
738738
* @since 2.5
739739
*/
740-
public static BufferedInputStream buffer(final InputStream inputStream, int size) {
740+
public static BufferedInputStream buffer(final InputStream inputStream, final int size) {
741741
// reject null early on rather than waiting for IO operation to fail
742742
if (inputStream == null) { // not checked by BufferedInputStream
743743
throw new NullPointerException();
@@ -1289,7 +1289,7 @@ public static String resourceToString(final String name, final Charset encoding)
12891289
*
12901290
* @since 2.6
12911291
*/
1292-
public static String resourceToString(final String name, final Charset encoding, ClassLoader classLoader) throws IOException {
1292+
public static String resourceToString(final String name, final Charset encoding, final ClassLoader classLoader) throws IOException {
12931293
return toString(resourceToURL(name, classLoader), encoding);
12941294
}
12951295

src/main/java/org/apache/commons/io/ThreadMonitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void run() {
121121
* @param ms the number of milliseconds to sleep for
122122
* @throws InterruptedException if interrupted
123123
*/
124-
private static void sleep(long ms) throws InterruptedException {
124+
private static void sleep(final long ms) throws InterruptedException {
125125
long finishAt = System.currentTimeMillis() + ms;
126126
long remaining = ms;
127127
do {

src/main/java/org/apache/commons/io/input/BOMInputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public synchronized void reset() throws IOException {
401401
* if an I/O error occurs
402402
*/
403403
@Override
404-
public long skip(long n) throws IOException {
404+
public long skip(final long n) throws IOException {
405405
int skipped = 0;
406406
while ((n > skipped) && (readFirstBytes() >= 0)) {
407407
skipped++;

src/main/java/org/apache/commons/io/input/BoundedReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class BoundedReader
5757
* @param maxCharsFromTargetReader The maximum number of characters that can be read from target
5858
* @throws IOException if mark fails
5959
*/
60-
public BoundedReader( Reader target, int maxCharsFromTargetReader ) throws IOException {
60+
public BoundedReader( final Reader target, final int maxCharsFromTargetReader ) throws IOException {
6161
this.target = target;
6262
this.maxCharsFromTargetReader = maxCharsFromTargetReader;
6363
}
@@ -98,7 +98,7 @@ public void reset() throws IOException {
9898
* @see java.io.Reader#mark(int).
9999
*/
100100
@Override
101-
public void mark( int readAheadLimit ) throws IOException {
101+
public void mark( final int readAheadLimit ) throws IOException {
102102
this.readAheadLimit = readAheadLimit - charsRead;
103103

104104
markedAt = charsRead;
@@ -138,7 +138,7 @@ public int read() throws IOException {
138138
* @see java.io.Reader#read(char[], int, int)
139139
*/
140140
@Override
141-
public int read( char[] cbuf, int off, int len ) throws IOException {
141+
public int read( final char[] cbuf, final int off, final int len ) throws IOException {
142142
int c;
143143
for ( int i = 0; i < len; i++ ) {
144144
c = read();

src/main/java/org/apache/commons/io/input/InfiniteCircularInputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class InfiniteCircularInputStream extends InputStream {
3838
* @param repeatedContent
3939
* Input buffer to be repeated (not copied)
4040
*/
41-
public InfiniteCircularInputStream(byte[] repeatedContent) {
41+
public InfiniteCircularInputStream(final byte[] repeatedContent) {
4242
this.repeatedContent = repeatedContent;
4343
}
4444

src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ public static class MessageDigestMaintainingObserver extends Observer {
4141
* Creates an MessageDigestMaintainingObserver for the given MessageDigest.
4242
* @param pMd the message digest to use
4343
*/
44-
public MessageDigestMaintainingObserver(MessageDigest pMd) {
44+
public MessageDigestMaintainingObserver(final MessageDigest pMd) {
4545
md = pMd;
4646
}
4747

4848
@Override
49-
void data(int pByte) throws IOException {
49+
void data(final int pByte) throws IOException {
5050
md.update((byte) pByte);
5151
}
5252

5353
@Override
54-
void data(byte[] pBuffer, int pOffset, int pLength) throws IOException {
54+
void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {
5555
md.update(pBuffer, pOffset, pLength);
5656
}
5757
}
@@ -63,7 +63,7 @@ void data(byte[] pBuffer, int pOffset, int pLength) throws IOException {
6363
* @param pStream the stream to calculate the message digest for
6464
* @param pDigest the message digest to use
6565
*/
66-
public MessageDigestCalculatingInputStream(InputStream pStream, MessageDigest pDigest) {
66+
public MessageDigestCalculatingInputStream(final InputStream pStream, final MessageDigest pDigest) {
6767
super(pStream);
6868
messageDigest = pDigest;
6969
add(new MessageDigestMaintainingObserver(pDigest));
@@ -75,7 +75,7 @@ public MessageDigestCalculatingInputStream(InputStream pStream, MessageDigest pD
7575
* @param pAlgorithm the name of the algorithm to use
7676
* @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
7777
*/
78-
public MessageDigestCalculatingInputStream(InputStream pStream, String pAlgorithm) throws NoSuchAlgorithmException {
78+
public MessageDigestCalculatingInputStream(final InputStream pStream, final String pAlgorithm) throws NoSuchAlgorithmException {
7979
this(pStream, MessageDigest.getInstance(pAlgorithm));
8080
}
8181

@@ -84,7 +84,7 @@ public MessageDigestCalculatingInputStream(InputStream pStream, String pAlgorith
8484
* @param pStream the stream to calculate the message digest for
8585
* @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
8686
*/
87-
public MessageDigestCalculatingInputStream(InputStream pStream) throws NoSuchAlgorithmException {
87+
public MessageDigestCalculatingInputStream(final InputStream pStream) throws NoSuchAlgorithmException {
8888
this(pStream, MessageDigest.getInstance("MD5"));
8989
}
9090

src/main/java/org/apache/commons/io/input/ObservableInputStream.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static abstract class Observer {
4444
* because, in that case, {@link #finished()} will be invoked instead.
4545
* @throws IOException if an i/o-error occurs
4646
*/
47-
void data(int pByte) throws IOException {}
47+
void data(final int pByte) throws IOException {}
4848

4949
/** Called to indicate, that {@link InputStream#read(byte[])}, or
5050
* {@link InputStream#read(byte[], int, int)} have been called, and are about to
@@ -55,7 +55,7 @@ void data(int pByte) throws IOException {}
5555
* @param pLength The number of bytes, which have been stored in the byte array.
5656
* @throws IOException if an i/o-error occurs
5757
*/
58-
void data(byte[] pBuffer, int pOffset, int pLength) throws IOException {}
58+
void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {}
5959

6060
/** Called to indicate, that EOF has been seen on the underlying stream.
6161
* This method may be called multiple times, if the reader keeps invoking
@@ -74,7 +74,7 @@ void closed() throws IOException {}
7474
* Called to indicate, that an error occurred on the underlying stream.
7575
* @throws IOException if an i/o-error occurs
7676
*/
77-
void error(IOException pException) throws IOException { throw pException; }
77+
void error(final IOException pException) throws IOException { throw pException; }
7878
}
7979

8080
private final List<Observer> observers = new ArrayList<>();
@@ -83,23 +83,23 @@ void closed() throws IOException {}
8383
* Creates a new ObservableInputStream for the given InputStream.
8484
* @param pProxy the input stream to proxy
8585
*/
86-
public ObservableInputStream(InputStream pProxy) {
86+
public ObservableInputStream(final InputStream pProxy) {
8787
super(pProxy);
8888
}
8989

9090
/**
9191
* Adds an Observer.
9292
* @param pObserver the observer to add
9393
*/
94-
public void add(Observer pObserver) {
94+
public void add(final Observer pObserver) {
9595
observers.add(pObserver);
9696
}
9797

9898
/**
9999
* Removes an Observer.
100100
* @param pObserver the observer to remove
101101
*/
102-
public void remove(Observer pObserver) {
102+
public void remove(final Observer pObserver) {
103103
observers.remove(pObserver);
104104
}
105105

@@ -130,7 +130,7 @@ public int read() throws IOException {
130130
}
131131

132132
@Override
133-
public int read(byte[] pBuffer) throws IOException {
133+
public int read(final byte[] pBuffer) throws IOException {
134134
int result = 0;
135135
IOException ioe = null;
136136
try {
@@ -149,7 +149,7 @@ public int read(byte[] pBuffer) throws IOException {
149149
}
150150

151151
@Override
152-
public int read(byte[] pBuffer, int pOffset, int pLength) throws IOException {
152+
public int read(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {
153153
int result = 0;
154154
IOException ioe = null;
155155
try {
@@ -175,7 +175,7 @@ public int read(byte[] pBuffer, int pOffset, int pLength) throws IOException {
175175
* @throws IOException Some observer has thrown an exception, which is being
176176
* passed down.
177177
*/
178-
protected void noteDataBytes(byte[] pBuffer, int pOffset, int pLength) throws IOException {
178+
protected void noteDataBytes(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {
179179
for (Observer observer : getObservers()) {
180180
observer.data(pBuffer, pOffset, pLength);
181181
}
@@ -197,7 +197,7 @@ protected void noteFinished() throws IOException {
197197
* @throws IOException Some observer has thrown an exception, which is being
198198
* passed down.
199199
*/
200-
protected void noteDataByte(int pDataByte) throws IOException {
200+
protected void noteDataByte(final int pDataByte) throws IOException {
201201
for (Observer observer : getObservers()) {
202202
observer.data(pDataByte);
203203
}
@@ -210,7 +210,7 @@ protected void noteDataByte(int pDataByte) throws IOException {
210210
* passed down. This may be the same exception, which has been passed as an
211211
* argument.
212212
*/
213-
protected void noteError(IOException pException) throws IOException {
213+
protected void noteError(final IOException pException) throws IOException {
214214
for (Observer observer : getObservers()) {
215215
observer.error(pException);
216216
}

0 commit comments

Comments
 (0)