mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
Added an alternative constructor to PGSQLException so that debugging
some more osteric bugs is easier. If only 1 arg is supplied and it's of type Exception, then that Exception's stacktrace is now included. This was done as there's been a report of an unusual bug during connection. This will make this sort of bug hunting easier from now on.
This commit is contained in:
parent
97f447b2cd
commit
f118c36a78
@ -1,3 +1,8 @@
|
|||||||
|
Thu Jan 25 09:11:00 GMT 2001 peter@retep.org.uk
|
||||||
|
- Added an alternative constructor to PGSQLException so that debugging
|
||||||
|
some more osteric bugs is easier. If only 1 arg is supplied and it's
|
||||||
|
of type Exception, then that Exception's stacktrace is now included.
|
||||||
|
|
||||||
Wed Jan 24 09:18:00 GMT 2001 peter@retep.org.uk
|
Wed Jan 24 09:18:00 GMT 2001 peter@retep.org.uk
|
||||||
- Removed the 8k limit by setting it to 64k
|
- Removed the 8k limit by setting it to 64k
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.postgresql.util;
|
package org.postgresql.util;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -45,6 +46,34 @@ public class PSQLException extends SQLException
|
|||||||
translate(error,argv);
|
translate(error,argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper version for 1 arg. This is used for debug purposes only with
|
||||||
|
* some unusual Exception's. It allows the originiating Exceptions stack
|
||||||
|
* trace to be returned.
|
||||||
|
*/
|
||||||
|
public PSQLException(String error,Exception ex)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
Object[] argv = new Object[1];
|
||||||
|
|
||||||
|
try {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
PrintWriter pw = new PrintWriter(baos);
|
||||||
|
pw.println("Exception: "+ex.toString()+"\nStack Trace:\n");
|
||||||
|
ex.printStackTrace(pw);
|
||||||
|
pw.println("End of Stack Trace");
|
||||||
|
pw.flush();
|
||||||
|
argv[0] = baos.toString();
|
||||||
|
pw.close();
|
||||||
|
baos.close();
|
||||||
|
} catch(Exception ioe) {
|
||||||
|
argv[0] = ex.toString()+"\nIO Error on stack trace generation! "+ioe.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
translate(error,argv);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper version for 2 args
|
* Helper version for 2 args
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user