Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7ab25ff

Browse files
author
Barry Lind
committed
Patch submitted by Kris Jurka to fix arrayindexoutofbounds exception caused
by improper array initialization. Modified Files: jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
1 parentfc5c577 commit7ab25ff

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

‎src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,7 @@ public java.sql.ResultSet getProcedureColumns(String catalog, String schemaPatte
18541854

18551855
// decide if we are returning a single column result.
18561856
if (!returnTypeType.equals("c")) {
1857-
byte[][]tuple =newbyte[13][0];
1857+
byte[][]tuple =newbyte[13][];
18581858
tuple[0] =null;
18591859
tuple[1] =schema;
18601860
tuple[2] =procedureName;
@@ -1874,7 +1874,7 @@ public java.sql.ResultSet getProcedureColumns(String catalog, String schemaPatte
18741874
// Add a row for each argument.
18751875
for (inti=0;i<argTypes.size();i++) {
18761876
intargOid = ((Integer)argTypes.elementAt(i)).intValue();
1877-
byte[][]tuple =newbyte[13][0];
1877+
byte[][]tuple =newbyte[13][];
18781878
tuple[0] =null;
18791879
tuple[1] =schema;
18801880
tuple[2] =procedureName;
@@ -1897,7 +1897,7 @@ public java.sql.ResultSet getProcedureColumns(String catalog, String schemaPatte
18971897
ResultSetcolumnrs =connection.createStatement().executeQuery(columnsql);
18981898
while (columnrs.next()) {
18991899
intcolumnTypeOid =columnrs.getInt("atttypid");
1900-
byte[][]tuple =newbyte[13][0];
1900+
byte[][]tuple =newbyte[13][];
19011901
tuple[0] =null;
19021902
tuple[1] =schema;
19031903
tuple[2] =procedureName;
@@ -2199,7 +2199,7 @@ public java.sql.ResultSet getTableTypes() throws SQLException
21992199
f[0] =newField(connection,newString("TABLE_TYPE"),iVarcharOid,getMaxNameLength());
22002200
for (i=0;i <types.length;i++)
22012201
{
2202-
byte[][]tuple =newbyte[1][0];
2202+
byte[][]tuple =newbyte[1][];
22032203
tuple[0] =types[i].getBytes();
22042204
v.addElement(tuple);
22052205
}
@@ -2318,7 +2318,7 @@ public java.sql.ResultSet getColumns(String catalog, String schemaPattern, Strin
23182318
ResultSetrs =connection.createStatement().executeQuery(sql);
23192319
while (rs.next())
23202320
{
2321-
byte[][]tuple =newbyte[18][0];
2321+
byte[][]tuple =newbyte[18][];
23222322
inttypeOid =rs.getInt("atttypid");
23232323

23242324
tuple[0] =null;// Catalog name, not supported
@@ -2329,6 +2329,11 @@ public java.sql.ResultSet getColumns(String catalog, String schemaPattern, Strin
23292329
StringpgType =connection.getPGType(typeOid);
23302330
tuple[5] =pgType.getBytes();// Type name
23312331

2332+
// by default no decimal_digits
2333+
// if the type is numeric or decimal we will
2334+
// overwrite later.
2335+
tuple[8] ="0".getBytes();
2336+
23322337
if (pgType.equals("bpchar") ||pgType.equals("varchar"))
23332338
{
23342339
intatttypmod =rs.getInt("atttypmod");
@@ -2465,7 +2470,7 @@ public java.sql.ResultSet getColumnPrivileges(String catalog, String schema, Str
24652470
for (intj=0;j<grantees.size();j++) {
24662471
Stringgrantee = (String)grantees.elementAt(j);
24672472
Stringgrantable =owner.equals(grantee) ?"YES" :"NO";
2468-
byte[][]tuple =newbyte[8][0];
2473+
byte[][]tuple =newbyte[8][];
24692474
tuple[0] =null;
24702475
tuple[1] =schemaName;
24712476
tuple[2] =tableName;
@@ -2567,7 +2572,7 @@ public java.sql.ResultSet getTablePrivileges(String catalog, String schemaPatter
25672572
for (intj=0;j<grantees.size();j++) {
25682573
Stringgrantee = (String)grantees.elementAt(j);
25692574
Stringgrantable =owner.equals(grantee) ?"YES" :"NO";
2570-
byte[][]tuple =newbyte[7][0];
2575+
byte[][]tuple =newbyte[7][];
25712576
tuple[0] =null;
25722577
tuple[1] =schema;
25732578
tuple[2] =table;
@@ -2819,7 +2824,7 @@ public java.sql.ResultSet getVersionColumns(String catalog, String schema, Strin
28192824
f[6] =newField(connection,"DECIMAL_DIGITS",iInt2Oid,2);
28202825
f[7] =newField(connection,"PSEUDO_COLUMN",iInt2Oid,2);
28212826

2822-
bytetuple[][] =newbyte[8][0];
2827+
bytetuple[][] =newbyte[8][];
28232828

28242829
/* Postgresql does not have any column types that are
28252830
* automatically updated like some databases' timestamp type.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp