@@ -145,7 +145,7 @@ public FileSystemUtils() {
145145 */
146146 @ Deprecated
147147 public static long freeSpace (final String path ) throws IOException {
148- return INSTANCE .freeSpaceOS (path , OS , false , - 1 );
148+ return INSTANCE .freeSpaceOS (path , OS , false , Duration . ofMillis (- 1 ) );
149149 }
150150
151151 //-----------------------------------------------------------------------
@@ -207,7 +207,7 @@ public static long freeSpaceKb(final String path) throws IOException {
207207 */
208208 @ Deprecated
209209 public static long freeSpaceKb (final String path , final long timeout ) throws IOException {
210- return INSTANCE .freeSpaceOS (path , OS , true , timeout );
210+ return INSTANCE .freeSpaceOS (path , OS , true , Duration . ofMillis ( timeout ) );
211211 }
212212
213213 /**
@@ -271,7 +271,7 @@ public static long freeSpaceKb(final long timeout) throws IOException {
271271 * @throws IllegalStateException if an error occurred in initialisation
272272 * @throws IOException if an error occurs when finding the free space
273273 */
274- long freeSpaceOS (final String path , final int os , final boolean kb , final long timeout ) throws IOException {
274+ long freeSpaceOS (final String path , final int os , final boolean kb , final Duration timeout ) throws IOException {
275275 if (path == null ) {
276276 throw new IllegalArgumentException ("Path must not be null" );
277277 }
@@ -300,7 +300,7 @@ long freeSpaceOS(final String path, final int os, final boolean kb, final long t
300300 * @return the amount of free drive space on the drive
301301 * @throws IOException if an error occurs
302302 */
303- long freeSpaceWindows (final String path , final long timeout ) throws IOException {
303+ long freeSpaceWindows (final String path , final Duration timeout ) throws IOException {
304304 String normPath = FilenameUtils .normalize (path , false );
305305 if (normPath == null ) {
306306 throw new IllegalArgumentException (path );
@@ -395,7 +395,7 @@ long parseDir(final String line, final String path) throws IOException {
395395 * @return the amount of free drive space on the volume
396396 * @throws IOException if an error occurs
397397 */
398- long freeSpaceUnix (final String path , final boolean kb , final boolean posix , final long timeout )
398+ long freeSpaceUnix (final String path , final boolean kb , final boolean posix , final Duration timeout )
399399 throws IOException {
400400 if (path .isEmpty ()) {
401401 throw new IllegalArgumentException ("Path must not be empty" );
@@ -479,7 +479,7 @@ long parseBytes(final String freeSpace, final String path) throws IOException {
479479 * @return the lines returned by the command, converted to lower-case
480480 * @throws IOException if an error occurs
481481 */
482- List <String > performCommand (final String [] cmdAttribs , final int max , final long timeout ) throws IOException {
482+ List <String > performCommand (final String [] cmdAttribs , final int max , final Duration timeout ) throws IOException {
483483 // this method does what it can to avoid the 'Too many open files' error
484484 // based on trial and error and these links:
485485 // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4784692
@@ -496,7 +496,7 @@ List<String> performCommand(final String[] cmdAttribs, final int max, final long
496496 BufferedReader inr = null ;
497497 try {
498498
499- final Thread monitor = ThreadMonitor .start (Duration . ofMillis ( timeout ) );
499+ final Thread monitor = ThreadMonitor .start (timeout );
500500
501501 proc = openProcess (cmdAttribs );
502502 in = proc .getInputStream ();
0 commit comments