String upgradestepClassName = line.substring(13).trim();
DbUpgradeStep dbUpgradeStep = null;
try {
dbUpgradeStep = (DbUpgradeStep) ReflectUtil.instantiate(upgradestepClassName);
} catch (ActivitiException e) {
throw new ActivitiException("database update java class '"+upgradestepClassName+"' can't be instantiated: "+e.getMessage(), e);
}
try {
log.fine("executing upgrade step java class "+upgradestepClassName);
dbUpgradeStep.execute(this);
} catch (Exception e) {
throw new ActivitiException("error while executing database update java class '"+upgradestepClassName+"': "+e.getMessage(), e);
}
} else if (line.length()>0) {
if (line.endsWith(";")) {
sqlStatement = addSqlStatementPiece(sqlStatement, line.substring(0, line.length()-1));
Statement jdbcStatement = connection.createStatement();
try {
// no logging needed as the connection will log it
log.fine("SQL: "+sqlStatement);
jdbcStatement.execute(sqlStatement);
jdbcStatement.close();
} catch (Exception e) {
if (exception == null) {
exception = e;
exceptionSqlStatement = sqlStatement;
}
log.log(Level.SEVERE, "problem during schema " + operation + ", statement '" + sqlStatement, e);
} finally {
sqlStatement = null;
}
} else {
sqlStatement = addSqlStatementPiece(sqlStatement, line);
}
}
line = readNextTrimmedLine(reader);
}
if (exception != null) {
throw exception;
}
log.fine("activiti db schema " + operation + " for component "+component+" successful");
} catch (Exception e) {
throw new ActivitiException("couldn't "+operation+" db schema: "+exceptionSqlStatement, e);
}
}