[Bug] ResultSetMetaData.getCatalogName throws IndexOutOfBoundsException instead of SQLException for out-of-range columns
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza en la clase que contiene IoTDBResultMetadata.getCatalogName(int) y compárala con los siete accesores hermanos de ResultSetMetaData que llaman primero a checkColumnIndex(column). Reproduce el problema con getCatalogName(0) u otra columna fuera de rango y verifica después que los índices no válidos produzcan sistemáticamente SQLException en lugar de IndexOutOfBoundsException.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Search before asking
- I searched in the issues and found nothing similar.
Version
master (2.0.x). The affected code is also present in released 2.0.x versions.
Describe the bug and provide the minimal reproduce step
IoTDBResultMetadata.getCatalogName(int column) reads columnInfoList.get(column - 1) before its range check runs, so an out-of-range column index throws a raw IndexOutOfBoundsException instead of the SQLException required by the ResultSetMetaData contract. The subsequent range check (if (column < 1 || column > columnInfoList.size())) is therefore unreachable for an out-of-range column. The seven sibling ResultSetMetaData accessors in the same class all call checkColumnIndex(column) first; getCatalogName is the only one missing that guard.
Minimal reproduce step:
- Obtain a
ResultSetMetaDatafrom any (non-empty) query result. - Call
metaData.getCatalogName(0)(or any column index<= 0or> column count). - A raw
IndexOutOfBoundsExceptionis thrown instead of aSQLException.
What did you expect to see?
getCatalogName throws a SQLException for an out-of-range column index, consistent with the ResultSetMetaData contract and with the sibling accessors.
What did you see instead?
A raw java.lang.IndexOutOfBoundsException from columnInfoList.get(column - 1).
Anything else?
The fix is to call checkColumnIndex(column) first, as the sibling accessors already do — it throws SQLException on column <= 0, column > size, and an empty column list. I'd like to work on this and will open a PR.
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Lenguaje dominante
- Java
- Estrellas
- 6.4k
- Forks
- 1.2k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 129
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/iotdb
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
IoTDB Edge: stop-edge.sh does not stop its own process when IOTDB_HOME is set, and reports success Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
[Bug] 执行start-all.sh后无法启动集群问题 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
[Bug] findColumn throws NullPointerException instead of SQLException for an unknown column name Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Todos los issues de apache/iotdb
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
FasterXML/jackson-databind#6229 ·