Browse Source

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
tags/jackcess-1.2.7
James Ahlborn 12 years ago
parent
commit
3498d3a97e

+ 3
- 3
src/java/com/healthmarketscience/jackcess/DefaultCodecProvider.java View File

@@ -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.");
}
}


+ 48
- 0
src/java/com/healthmarketscience/jackcess/UnsupportedCodecException.java View File

@@ -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);
}
}

Loading…
Cancel
Save