Skip to content
Snippets Groups Projects
Commit 0ea1f323 authored by gmantele's avatar gmantele
Browse files

[ADQL,TAP] Update the TableSetParser so that the BOOLEAN datatype is accepted.

While waiting for a clean ADQL-2.1 implementation, the BOOLEAN datatype will
be still considered as SMALLINT. But at least, the TableSetParser (used in the
ADQL-Library Online Validator) won't reject tables.xml with a BOOLEAN datatype.
parent 4dea14fc
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ package tap.metadata; ...@@ -16,7 +16,7 @@ package tap.metadata;
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with TAPLibrary. If not, see <http://www.gnu.org/licenses/>. * along with TAPLibrary. If not, see <http://www.gnu.org/licenses/>.
* *
* Copyright 2015-2016 - Astronomisches Rechen Institut (ARI) * Copyright 2015-2018 - Astronomisches Rechen Institut (ARI)
*/ */
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
...@@ -77,8 +77,14 @@ import tap.metadata.TAPTable.TableType; ...@@ -77,8 +77,14 @@ import tap.metadata.TAPTable.TableType;
* <li><code>&lt;dataType xsi:type="vod:TAPType"&gt;VARCHAR&lt;/dataType&gt;</code> for a TAP datatype</li> * <li><code>&lt;dataType xsi:type="vod:TAPType"&gt;VARCHAR&lt;/dataType&gt;</code> for a TAP datatype</li>
* </ul> * </ul>
* *
* <p><b>WARNING:</b>
* When a vod:TAPType is set to <code>BOOLEAN</code>, this will be interpreted as a SMALLINT.
* Note that this is a convenient hack because BOOLEAN is not a valid TAPType,
* but it is however used a lot of time by TAP implementors.
* </p>
*
* @author Gr&eacute;gory Mantelet (ARI) * @author Gr&eacute;gory Mantelet (ARI)
* @version 2.1 (07/2016) * @version 2.3 (04/2018)
* @since 2.0 * @since 2.0
*/ */
public class TableSetParser extends DefaultHandler { public class TableSetParser extends DefaultHandler {
...@@ -614,6 +620,9 @@ public class TableSetParser extends DefaultHandler { ...@@ -614,6 +620,9 @@ public class TableSetParser extends DefaultHandler {
} }
// build and return the corresponding type: // build and return the corresponding type:
try{ try{
if ("BOOLEAN".equalsIgnoreCase(datatype)){
return new DBType(DBDatatype.SMALLINT, colSize);
}else
return new DBType(DBDatatype.valueOf(datatype.toUpperCase()), colSize); return new DBType(DBDatatype.valueOf(datatype.toUpperCase()), colSize);
}catch(IllegalArgumentException iae){ }catch(IllegalArgumentException iae){
throw new TAPException(getPosition(reader) + " Unknown TAPType: \"" + datatype + "\"!"); throw new TAPException(getPosition(reader) + " Unknown TAPType: \"" + datatype + "\"!");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment