diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2012-03-14 01:29:33 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2012-03-14 01:29:33 +0000 |
commit | 3498d3a97edc55893be3d9c50a43217878ca15bf (patch) | |
tree | 860c2b5f06579da05d74e5679b6ff77e60d847ff /src | |
parent | 0aa749f025e5678a619eb8b3428f10ae91dfec1e (diff) | |
download | jackcess-3498d3a97edc55893be3d9c50a43217878ca15bf.tar.gz jackcess-3498d3a97edc55893be3d9c50a43217878ca15bf.zip |
add explicit exception for unsupported encodings
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@617 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/healthmarketscience/jackcess/DefaultCodecProvider.java | 6 | ||||
-rw-r--r-- | src/java/com/healthmarketscience/jackcess/UnsupportedCodecException.java | 48 |
2 files changed, 51 insertions, 3 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/DefaultCodecProvider.java b/src/java/com/healthmarketscience/jackcess/DefaultCodecProvider.java index 76280b9..e24634a 100644 --- a/src/java/com/healthmarketscience/jackcess/DefaultCodecProvider.java +++ b/src/java/com/healthmarketscience/jackcess/DefaultCodecProvider.java @@ -99,21 +99,21 @@ public class DefaultCodecProvider implements CodecProvider /** * CodecHandler implementation which always throws - * UnsupportedOperationException, useful for databases with unsupported + * UnsupportedCodecException, useful for databases with unsupported * encodings. */ public static class UnsupportedHandler implements CodecHandler { public void decodePage(ByteBuffer page, int pageNumber) throws IOException { - throw new UnsupportedOperationException("Decoding not supported"); + throw new UnsupportedCodecException("Decoding not supported. Please choose a CodecProvider which supports reading the current database encoding."); } public ByteBuffer encodePage(ByteBuffer page, int pageNumber, int pageOffset) throws IOException { - throw new UnsupportedOperationException("Encoding not supported"); + throw new UnsupportedCodecException("Encoding not supported. Please choose a CodecProvider which supports writing the current database encoding."); } } diff --git a/src/java/com/healthmarketscience/jackcess/UnsupportedCodecException.java b/src/java/com/healthmarketscience/jackcess/UnsupportedCodecException.java new file mode 100644 index 0000000..51b772c --- /dev/null +++ b/src/java/com/healthmarketscience/jackcess/UnsupportedCodecException.java @@ -0,0 +1,48 @@ +/* +Copyright (c) 2012 James Ahlborn + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA +*/ + +package com.healthmarketscience.jackcess; + +/** + * Exception thrown by a CodecHandler to indicate that the current encoding is + * not supported. This generally indicates that a different CodecProvider + * needs to be chosen. + * + * @author James Ahlborn + */ +public class UnsupportedCodecException + extends UnsupportedOperationException +{ + private static final long serialVersionUID = 20120313L; + + public UnsupportedCodecException(String msg) + { + super(msg); + } + + public UnsupportedCodecException(String msg, Throwable t) + { + super(msg, t); + } + + public UnsupportedCodecException(Throwable t) + { + super(t); + } +} |