mirror of
https://github.com/apache/openjpa.git
synced 2025-02-22 01:55:29 +00:00
OPENJPA-1700 FindBugs - Method invokes inefficient new String() constructor
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@956878 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a7c61414ca
commit
af772a734b
@ -113,8 +113,7 @@ public class DB2Dictionary
|
|||||||
fixedSizeTypeNameSet.addAll(Arrays.asList(new String[]{
|
fixedSizeTypeNameSet.addAll(Arrays.asList(new String[]{
|
||||||
"LONG VARCHAR FOR BIT DATA", "LONG VARCHAR", "LONG VARGRAPHIC",
|
"LONG VARCHAR FOR BIT DATA", "LONG VARCHAR", "LONG VARGRAPHIC",
|
||||||
}));
|
}));
|
||||||
systemSchemas = new String(
|
systemSchemas = "SYSCAT,SYSIBM,SYSSTAT,SYSIBMADM,SYSTOOLS";
|
||||||
"SYSCAT,SYSIBM,SYSSTAT,SYSIBMADM,SYSTOOLS");
|
|
||||||
maxConstraintNameLength = 18;
|
maxConstraintNameLength = 18;
|
||||||
maxIndexNameLength = 18;
|
maxIndexNameLength = 18;
|
||||||
maxColumnNameLength = 30;
|
maxColumnNameLength = 30;
|
||||||
@ -573,7 +572,6 @@ public class DB2Dictionary
|
|||||||
*/
|
*/
|
||||||
private String appendExtendedExceptionMsg(String msg, SQLException sqle){
|
private String appendExtendedExceptionMsg(String msg, SQLException sqle){
|
||||||
final String GETSQLCA ="getSqlca";
|
final String GETSQLCA ="getSqlca";
|
||||||
String exceptionMsg = new String();
|
|
||||||
try {
|
try {
|
||||||
Method sqlcaM2 = sqle.getNextException().getClass()
|
Method sqlcaM2 = sqle.getNextException().getClass()
|
||||||
.getMethod(GETSQLCA,null);
|
.getMethod(GETSQLCA,null);
|
||||||
@ -591,17 +589,23 @@ public class DB2Dictionary
|
|||||||
for (int i = 0; i < errds.length; i++)
|
for (int i = 0; i < errds.length; i++)
|
||||||
errdStr.append(errdStr.length() > 0 ? ", " : "").
|
errdStr.append(errdStr.length() > 0 ? ", " : "").
|
||||||
append(errds[i]);
|
append(errds[i]);
|
||||||
exceptionMsg = exceptionMsg.concat( "SQLCA OUTPUT" +
|
StringBuilder exceptionMsg = new StringBuilder();
|
||||||
"[Errp=" + getSqlErrpMethd.invoke(sqlca, new Object[]{})
|
exceptionMsg.append("SQLCA OUTPUT");
|
||||||
+ ", Errd=" + errdStr);
|
exceptionMsg.append("[Errp=");
|
||||||
|
exceptionMsg.append(getSqlErrpMethd.invoke(sqlca, new Object[]{}));
|
||||||
|
exceptionMsg.append(", Errd=");
|
||||||
|
exceptionMsg.append(errdStr);
|
||||||
|
|
||||||
String Warn = new String((char[]) getSqlWarnMethd.
|
String Warn = new String((char[]) getSqlWarnMethd.
|
||||||
invoke(sqlca, new Object[]{}));
|
invoke(sqlca, new Object[]{}));
|
||||||
if (Warn.trim().length() != 0)
|
if (Warn.trim().length() != 0) {
|
||||||
exceptionMsg = exceptionMsg.concat(", Warn=" +Warn + "]" );
|
exceptionMsg.append(", Warn=");
|
||||||
else
|
exceptionMsg.append(Warn);
|
||||||
exceptionMsg = exceptionMsg.concat( "]" );
|
exceptionMsg.append("]");
|
||||||
msg = msg.concat(exceptionMsg);
|
} else {
|
||||||
|
exceptionMsg.append("]");
|
||||||
|
}
|
||||||
|
msg = msg.concat(exceptionMsg.toString());
|
||||||
|
|
||||||
// for batched execution failures, SQLExceptions are nested
|
// for batched execution failures, SQLExceptions are nested
|
||||||
SQLException sqle2 = sqle.getNextException();
|
SQLException sqle2 = sqle.getNextException();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user