summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/postgresql/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/jdbc/postgresql/util')
-rw-r--r--src/interfaces/jdbc/postgresql/util/PGmoney.java2
-rw-r--r--src/interfaces/jdbc/postgresql/util/PSQLException.java12
-rw-r--r--src/interfaces/jdbc/postgresql/util/Serialize.java12
3 files changed, 19 insertions, 7 deletions
diff --git a/src/interfaces/jdbc/postgresql/util/PGmoney.java b/src/interfaces/jdbc/postgresql/util/PGmoney.java
index c2dcb3fad77..0d094dbf108 100644
--- a/src/interfaces/jdbc/postgresql/util/PGmoney.java
+++ b/src/interfaces/jdbc/postgresql/util/PGmoney.java
@@ -65,7 +65,7 @@ public class PGmoney extends PGobject implements Serializable,Cloneable
val = negative ? -val : val;
} catch(NumberFormatException e) {
- throw new SQLException("conversion of money failed - "+e.toString());
+ throw new PSQLException("postgresql.money",e);
}
}
diff --git a/src/interfaces/jdbc/postgresql/util/PSQLException.java b/src/interfaces/jdbc/postgresql/util/PSQLException.java
index 1a0d1973587..317176a341b 100644
--- a/src/interfaces/jdbc/postgresql/util/PSQLException.java
+++ b/src/interfaces/jdbc/postgresql/util/PSQLException.java
@@ -46,6 +46,18 @@ public class PSQLException extends SQLException
}
/**
+ * Helper version for 2 args
+ */
+ public PSQLException(String error,Object arg1,Object arg2)
+ {
+ super();
+ Object[] argv = new Object[2];
+ argv[0] = arg1;
+ argv[1] = arg2;
+ translate(error,argv);
+ }
+
+ /**
* This does the actual translation
*/
private void translate(String id,Object[] args)
diff --git a/src/interfaces/jdbc/postgresql/util/Serialize.java b/src/interfaces/jdbc/postgresql/util/Serialize.java
index 56018490688..3209f58105e 100644
--- a/src/interfaces/jdbc/postgresql/util/Serialize.java
+++ b/src/interfaces/jdbc/postgresql/util/Serialize.java
@@ -45,7 +45,7 @@ public class Serialize
className = toClassName(type);
ourClass = Class.forName(className);
} catch(ClassNotFoundException cnfe) {
- throw new SQLException("No class found for '"+type+"`");
+ throw new PSQLException("postgresql.serial.noclass",type);
}
// Second check, the type must be a table
@@ -58,7 +58,7 @@ public class Serialize
}
// This should never occur, as postgresql has it's own internal checks
if(!status)
- throw new SQLException("The table for "+type+" is not in the database. Contact the DBA, as the database is in an inconsistent state.");
+ throw new PSQLException("postgresql.serial.table",type);
// Finally cache the fields within the table
}
@@ -106,7 +106,7 @@ public class Serialize
}
rs.close();
} else
- throw new SQLException("Unexpected result from query");
+ throw new PSQLException("postgresql.unexpected");
return obj;
} catch(IllegalAccessException iae) {
throw new SQLException(iae.toString());
@@ -231,7 +231,7 @@ public class Serialize
public static void create(postgresql.Connection con,Class c) throws SQLException
{
if(c.isInterface())
- throw new SQLException("Cannot serialize an Interface");
+ throw new PSQLException("postgresql.serial.interface");
// See if the table exists
String tableName = toPostgreSQL(c.getName());
@@ -316,10 +316,10 @@ public class Serialize
name = name.toLowerCase();
if(name.indexOf("_")>-1)
- throw new SQLException("Class names may not have _ in them: "+name);
+ throw new PSQLException("postgresql.serial.underscore");
if(name.length()>32)
- throw new SQLException("Class & Package name length cannot be longer than 32 characters. "+name+" is "+name.length()+" characters.");
+ throw new PSQLException("postgresql.serial.namelength",name,new Integer(name.length()));
return name.replace('.','_');
}