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
Loading
Loading
Loading
Loading
+101 −92
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ package tap.metadata;
 * You should have received a copy of the GNU Lesser General Public License
 * 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;
@@ -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>
 * </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)
 * @version 2.1 (07/2016)
 * @version 2.3 (04/2018)
 * @since 2.0
 */
public class TableSetParser extends DefaultHandler {
@@ -614,6 +620,9 @@ public class TableSetParser extends DefaultHandler {
			}
			// build and return the corresponding type:
			try{
				if ("BOOLEAN".equalsIgnoreCase(datatype)){
					return new DBType(DBDatatype.SMALLINT, colSize);
				}else
					return new DBType(DBDatatype.valueOf(datatype.toUpperCase()), colSize);
			}catch(IllegalArgumentException iae){
				throw new TAPException(getPosition(reader) + " Unknown TAPType: \"" + datatype + "\"!");