Skip to content
Snippets Groups Projects
Commit 5ba927a5 authored by gmantele's avatar gmantele
Browse files

ADQL: Fix ArrayIndexOutOfBoundsException while initializing a DefaultUDF (User...

ADQL: Fix ArrayIndexOutOfBoundsException while initializing a DefaultUDF (User Defined Function) object with several parameters.
parent 988578f5
No related branches found
No related tags found
No related merge requests found
...@@ -16,20 +16,19 @@ package adql.query.operand.function; ...@@ -16,20 +16,19 @@ package adql.query.operand.function;
* 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 ADQLLibrary. If not, see <http://www.gnu.org/licenses/>. * along with ADQLLibrary. If not, see <http://www.gnu.org/licenses/>.
* *
* Copyright 2012 - UDS/Centre de Données astronomiques de Strasbourg (CDS) * Copyright 2012-2014 - UDS/Centre de Données astronomiques de Strasbourg (CDS), Astronomisches Rechen Institute (ARI)
*/ */
import adql.query.ADQLList; import adql.query.ADQLList;
import adql.query.ADQLObject; import adql.query.ADQLObject;
import adql.query.ClauseADQL; import adql.query.ClauseADQL;
import adql.query.operand.ADQLOperand; import adql.query.operand.ADQLOperand;
/** /**
* It represents any function which is not managed by ADQL. * It represents any function which is not managed by ADQL.
* *
* @author Gr&eacute;gory Mantelet (CDS) * @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 01/2012 * @version 1.1 (04/2014)
*/ */
public final class DefaultUDF extends UserDefinedFunction { public final class DefaultUDF extends UserDefinedFunction {
...@@ -38,7 +37,6 @@ public final class DefaultUDF extends UserDefinedFunction { ...@@ -38,7 +37,6 @@ public final class DefaultUDF extends UserDefinedFunction {
protected final String functionName; protected final String functionName;
/** /**
* Creates a user function. * Creates a user function.
* @param params Parameters of the function. * @param params Parameters of the function.
...@@ -47,8 +45,8 @@ public final class DefaultUDF extends UserDefinedFunction { ...@@ -47,8 +45,8 @@ public final class DefaultUDF extends UserDefinedFunction {
functionName = name; functionName = name;
parameters = new ClauseADQL<ADQLOperand>(); parameters = new ClauseADQL<ADQLOperand>();
if (params != null){ if (params != null){
for(int i=0; i<params.length; i++) for(ADQLOperand p : params)
parameters.set(i, params[i]); parameters.add(p);
} }
} }
...@@ -64,19 +62,22 @@ public final class DefaultUDF extends UserDefinedFunction { ...@@ -64,19 +62,22 @@ public final class DefaultUDF extends UserDefinedFunction {
parameters = (ADQLList<ADQLOperand>)(toCopy.parameters.getCopy()); parameters = (ADQLList<ADQLOperand>)(toCopy.parameters.getCopy());
} }
@Override
public final boolean isNumeric(){ public final boolean isNumeric(){
return true; return true;
} }
@Override
public final boolean isString(){ public final boolean isString(){
return true; return true;
} }
@Override
public ADQLObject getCopy() throws Exception{ public ADQLObject getCopy() throws Exception{
return new DefaultUDF(this); return new DefaultUDF(this);
} }
@Override
public final String getName(){ public final String getName(){
return functionName; return functionName;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment