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;
* You should have received a copy of the GNU Lesser General Public License
* 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.ADQLObject;
import adql.query.ClauseADQL;
import adql.query.operand.ADQLOperand;
/**
* It represents any function which is not managed by ADQL.
*
* @author Gr&eacute;gory Mantelet (CDS)
* @version 01/2012
* @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 1.1 (04/2014)
*/
public final class DefaultUDF extends UserDefinedFunction {
......@@ -38,7 +37,6 @@ public final class DefaultUDF extends UserDefinedFunction {
protected final String functionName;
/**
* Creates a user function.
* @param params Parameters of the function.
......@@ -47,8 +45,8 @@ public final class DefaultUDF extends UserDefinedFunction {
functionName = name;
parameters = new ClauseADQL<ADQLOperand>();
if (params != null){
for(int i=0; i<params.length; i++)
parameters.set(i, params[i]);
for(ADQLOperand p : params)
parameters.add(p);
}
}
......@@ -64,19 +62,22 @@ public final class DefaultUDF extends UserDefinedFunction {
parameters = (ADQLList<ADQLOperand>)(toCopy.parameters.getCopy());
}
@Override
public final boolean isNumeric(){
return true;
}
@Override
public final boolean isString(){
return true;
}
@Override
public ADQLObject getCopy() throws Exception{
return new DefaultUDF(this);
}
@Override
public final String getName(){
return functionName;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment