diff options
author | Nick Burch <nick@apache.org> | 2014-04-28 09:22:58 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2014-04-28 09:22:58 +0000 |
commit | 0eb4f7684c831c37dcbc1fa9936168414499c3f8 (patch) | |
tree | f746f8474eaa6e08175bfb8073a1c9a17f8f0d15 /src/java/org/apache/poi/poifs/filesystem | |
parent | 4e984df1c9acc6754292660d835f809ad2fbeb77 (diff) | |
download | poi-0eb4f7684c831c37dcbc1fa9936168414499c3f8.tar.gz poi-0eb4f7684c831c37dcbc1fa9936168414499c3f8.zip |
Update the HPSF change properties example to use NPOIFS + in-place writes, and have NPOIFS give a helpful error if you try to in-place write on a read only open
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1590577 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/poifs/filesystem')
-rw-r--r-- | src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java index 3f60b4bda2..7aea791b3b 100644 --- a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java +++ b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java @@ -693,6 +693,12 @@ public class NPOIFSFileSystem extends BlockStore "not be called. Use writeFilesystem(OutputStream) instead" ); } + if (! ((FileBackedDataSource)_data).isWriteable()) { + throw new IllegalArgumentException( + "POIFS opened in read only mode, so writeFilesystem() may " + + "not be called. Open the FileSystem in read-write mode first" + ); + } syncWithDataSource(); } |