String insertQry = Globals.getDownloadAllInsert();
- Connection connection = null;
- PreparedStatement pst = null;
- try {
- connection = DbUtils.getConnection();
- pst = connection.prepareStatement(insertQry);
+ try(Connection connection = DbUtils.getConnection();
+ PreparedStatement pst = connection.prepareStatement(insertQry)){
if(nvl(emailId).length()>0){
pst.setInt(1, Integer.parseInt(userId));
pst.setInt(2, Integer.parseInt(rr.getReportID()));
connection.commit();
}
}
- pst.close();
- connection.close();
logger.debug(EELFLoggerDelegate.debugLogger, ("Data inserted"));
} catch (SQLException ex) {
throw new RaptorException(ex);
throw new RaptorException(ex);
} catch (Exception ex) {
throw new RaptorException (ex);
- } finally {
- try {
- if(connection!=null)
- connection.close();
- if(pst!=null)
- pst.close();
- } catch (SQLException ex) {
- throw new RaptorException(ex);
- }
- }
+ }
//DbUtils.commitTransaction(connection);
//DbUtils.clearConnection(connection);
* @throws Exception
*/
public static void readJar(File jarFile) throws Exception {
- JarInputStream in = new JarInputStream(new FileInputStream(jarFile));
- JarEntry je;
- while ((je = in.getNextJarEntry()) != null) {
- if (je.isDirectory() == false) {
- if (je.getName().startsWith("org/onap/portalsdk/analytics/config/")) {
- System.out.println(je.getName() + " " + je.getTime());
-
+ try(JarInputStream in = new JarInputStream(new FileInputStream(jarFile)))
+ {
+ JarEntry je;
+ while ((je = in.getNextJarEntry()) != null) {
+ if (je.isDirectory() == false) {
+ if (je.getName().startsWith("org/onap/portalsdk/analytics/config/")) {
+ System.out.println(je.getName() + " " + je.getTime());
+
+ }
}
}
}
- in.close();
}
/**
Class clazz = ExtractJar.class;
URL jarUrl = clazz.getProtectionDomain().getCodeSource().getLocation();
- JarInputStream entryStream = new JarInputStream(jarUrl.openStream());
- JarEntry entry;
-
- while (true) {
- entry = entryStream.getNextJarEntry();
- if (entry == null)
- break;
- if (entry.getName().indexOf("jarutil") < 0) {
- System.out.println(entry.getName());
- File file = new File(directory, entry.getName());
- if (entry.isDirectory()) {
- if (!file.exists())
- file.mkdirs();
- } else {
- File dir = new File(file.getParent());
- if (!dir.exists())
- dir.mkdirs();
- if (file.exists())
- file.delete();
- FileOutputStream fout = new FileOutputStream(file);
- copy(entryStream, fout);
- fout.close();
-
- if (entry.getTime() >= 0)
- file.setLastModified(entry.getTime());
+ try(JarInputStream entryStream = new JarInputStream(jarUrl.openStream())){
+ JarEntry entry;
+
+ while (true) {
+ entry = entryStream.getNextJarEntry();
+ if (entry == null)
+ break;
+ if (entry.getName().indexOf("jarutil") < 0) {
+ System.out.println(entry.getName());
+ File file = new File(directory, entry.getName());
+ if (entry.isDirectory()) {
+ if (!file.exists())
+ file.mkdirs();
+ } else {
+ File dir = new File(file.getParent());
+ if (!dir.exists())
+ dir.mkdirs();
+ if (file.exists())
+ file.delete();
+ try(FileOutputStream fout = new FileOutputStream(file)){
+ copy(entryStream, fout);
+ }
+
+ if (entry.getTime() >= 0)
+ file.setLastModified(entry.getTime());
+ }
+
}
-
+ entryStream.closeEntry();
}
- entryStream.closeEntry();
}
- entryStream.close();
System.out.println("/WEB-INF/classes/org/onap/portalsdk/analytics");
System.out.println("Delete .... ");