Skip to content

Commit

Permalink
8327096: (fc) java/nio/channels/FileChannel/Size.java fails on partit…
Browse files Browse the repository at this point in the history
…ion incapable of creating large files

Reviewed-by: djelinski
  • Loading branch information
Brian Burkhalter committed Mar 12, 2024
1 parent b9c3dc3 commit 94b4ed5
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions test/jdk/java/nio/channels/FileChannel/Size.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -24,15 +24,18 @@
/* @test
* @bug 4563125
* @summary Test size method of FileChannel
* @library /test/lib
* @run main/othervm Size
* @key randomness
*/

import java.io.*;
import java.nio.MappedByteBuffer;
import java.nio.channels.*;
import java.nio.file.FileStore;
import java.nio.file.Path;
import java.util.Random;

import jtreg.SkippedException;

/**
* Testing FileChannel's size method.
Expand Down Expand Up @@ -65,6 +68,8 @@ private static void testSmallFile() throws Exception {
// Test for bug 4563125
private static void testLargeFile() throws Exception {
File largeFile = new File("largeFileTest");
largeFile.deleteOnExit();

long testSize = ((long)Integer.MAX_VALUE) * 2;
initTestFile(largeFile, 10);
try (FileChannel fc = new RandomAccessFile(largeFile, "rw").getChannel()) {
Expand All @@ -75,8 +80,15 @@ private static void testLargeFile() throws Exception {
+ "Expect size " + (testSize + 10)
+ ", actual size " + fc.size());
}
} catch (IOException ioe) {
if ("File too large".equals(ioe.getMessage())) {
Path p = largeFile.toPath();
FileStore store = p.getFileSystem().provider().getFileStore(p);
if ("msdos".equals(store.type()))
throw new SkippedException("file too big for FAT32");
}
throw ioe;
}
largeFile.deleteOnExit();
}

/**
Expand Down

3 comments on commit 94b4ed5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoniaZaldana
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 94b4ed5 Apr 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SoniaZaldana the backport was successfully created on the branch backport-SoniaZaldana-94b4ed57 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 94b4ed57 from the openjdk/jdk repository.

The commit being backported was authored by Brian Burkhalter on 12 Mar 2024 and was reviewed by Daniel Jeliński.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-SoniaZaldana-94b4ed57:backport-SoniaZaldana-94b4ed57
$ git checkout backport-SoniaZaldana-94b4ed57
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-SoniaZaldana-94b4ed57

Please sign in to comment.