You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2014/07/24 09:07:08 UTC
svn commit: r1613020 - in /openmeetings: branches/3.0.x/
branches/3.0.x/.settings/ branches/3.0.x/docs/
branches/3.0.x/src/install/java/org/apache/openmeetings/cli/
branches/3.0.x/src/main/java/org/apache/openmeetings/ldap/
branches/3.0.x/src/main/java...
Author: solomax
Date: Thu Jul 24 07:07:07 2014
New Revision: 1613020
URL: http://svn.apache.org/r1613020
Log:
File Input/Output Streams leaks are fixed
Removed:
openmeetings/branches/3.0.x/.settings/org.eclipse.jst.common.project.facet.core.prefs
Modified:
openmeetings/branches/3.0.x/.classpath
openmeetings/branches/3.0.x/.settings/org.eclipse.jdt.core.prefs
openmeetings/branches/3.0.x/.settings/org.eclipse.wst.common.project.facet.core.xml
openmeetings/branches/3.0.x/docs/RoomService.html
openmeetings/branches/3.0.x/src/install/java/org/apache/openmeetings/cli/Admin.java
openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/ldap/LdapLoginManagement.java
openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/servlet/outputhandler/ScreenController.java
openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java
openmeetings/branches/3.0.x/src/util/java/org/apache/openmeetings/util/mail/IcalHandler.java
openmeetings/trunk/singlewebapp/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManagement.java
openmeetings/trunk/singlewebapp/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
openmeetings/trunk/singlewebapp/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java
openmeetings/trunk/singlewebapp/openmeetings-web/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java
Modified: openmeetings/branches/3.0.x/.classpath
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/.classpath?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/.classpath (original)
+++ openmeetings/branches/3.0.x/.classpath Thu Jul 24 07:07:07 2014
@@ -34,7 +34,6 @@
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
- <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=Openmeetings+3.0.x&ivyXmlPath=ivy.xml&confs=*&ivySettingsPath=%24%7Bworkspace_loc%3AOpenmeetings+3.0.x%2Fivysettings.xml%7D&loadSettingsOnDemand=false&propertyFiles="/>
<classpathentry kind="lib" path="build/lib/java_16_tools.jar"/>
<classpathentry kind="lib" path="build/red5/server/dist/lib/red5-io-1.0.4-SNAPSHOT.jar"/>
@@ -63,5 +62,10 @@
<classpathentry kind="lib" path="build/red5/server/dist/lib/bcprov-jdk15on-1.50.jar"/>
<classpathentry kind="lib" path="build/red5/server/dist/lib/cglib-nodep-2.2.2.jar"/>
<classpathentry kind="lib" path="build/red5/client/dist/red5-client-jar-1.0.2-RC2.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="owner.project.facets" value="java"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="build/classes/eclipse"/>
</classpath>
Modified: openmeetings/branches/3.0.x/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/.settings/org.eclipse.jdt.core.prefs?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/.settings/org.eclipse.jdt.core.prefs (original)
+++ openmeetings/branches/3.0.x/.settings/org.eclipse.jdt.core.prefs Thu Jul 24 07:07:07 2014
@@ -1,12 +1,12 @@
-#Sun Nov 06 12:11:27 CET 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.7
Modified: openmeetings/branches/3.0.x/.settings/org.eclipse.wst.common.project.facet.core.xml
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/.settings/org.eclipse.wst.common.project.facet.core.xml?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/.settings/org.eclipse.wst.common.project.facet.core.xml (original)
+++ openmeetings/branches/3.0.x/.settings/org.eclipse.wst.common.project.facet.core.xml Thu Jul 24 07:07:07 2014
@@ -2,6 +2,6 @@
<faceted-project>
<fixed facet="jst.web"/>
<fixed facet="jst.java"/>
- <installed facet="jst.java" version="5.0"/>
<installed facet="jst.web" version="2.5"/>
+ <installed facet="jst.java" version="1.7"/>
</faceted-project>
Modified: openmeetings/branches/3.0.x/docs/RoomService.html
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/docs/RoomService.html?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/docs/RoomService.html (original)
+++ openmeetings/branches/3.0.x/docs/RoomService.html Thu Jul 24 07:07:07 2014
@@ -75,6 +75,10 @@
<div class="navigation_comment"><i >Gets a list of flv recordings</i></div>
</div>
<div>
+ <a href="#getRecordingsByExternalType"><b>getRecordingsByExternalType</b></a><br/>
+ <div class="navigation_comment"><i >Gets a list of recordings</i></div>
+ </div>
+ <div>
<a href="#getFlvRecordingByExternalRoomType"><b>getFlvRecordingByExternalRoomType</b></a><br/>
<div class="navigation_comment"><i >Gets a list of flv recordings</i></div>
</div>
@@ -534,6 +538,58 @@
<div class="method">
<div class="method_header">
<div style="margin-left:10px">
+ <a name="getRecordingsByExternalType" ><b>getRecordingsByExternalType</b></a>
+ </div>
+ </div>
+
+ Method: <i>getRecordingsByExternalType (
+ String SID
+ ,
+ String externalType
+ )
+ </i><br/>
+ <p>
+ Gets a list of recordings
+ </p>
+ <p>
+ Return Type: java.util.List<org.apache.openmeetings.db.entity.record.FlvRecording>
+ </p>
+ <p>Params:</p>
+
+ <table rules="all" border="1">
+ <thead>
+ <tr>
+ <th width="200" align="left">Type</th>
+ <th width="200" align="left">Fieldname</th>
+ <th width="400" align="left">Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td valign="top">
+ String
+ </td>
+ <td valign="top">SID</td>
+ <td valign="top">The SID of the User. This SID must be marked as logged-in</td>
+ </tr>
+
+ <tr>
+ <td valign="top">
+ String
+ </td>
+ <td valign="top">externalType</td>
+ <td valign="top">externalType specified when creating room or user</td>
+ </tr>
+
+ </tbody>
+ </table>
+ <br/>
+ REST Sample Call/URL:<br/>
+ <a href="http://localhost:5080/openmeetings/services/RoomService/getRecordingsByExternalType?SID=VALUE&externalType=VALUE">http://localhost:5080/openmeetings/services/RoomService/getRecordingsByExternalType?SID=VALUE&externalType=VALUE</a>
+ </div>
+ <div class="method">
+ <div class="method_header">
+ <div style="margin-left:10px">
<a name="getFlvRecordingByExternalRoomType" ><b>getFlvRecordingByExternalRoomType</b></a>
</div>
</div>
Modified: openmeetings/branches/3.0.x/src/install/java/org/apache/openmeetings/cli/Admin.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/install/java/org/apache/openmeetings/cli/Admin.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/install/java/org/apache/openmeetings/cli/Admin.java (original)
+++ openmeetings/branches/3.0.x/src/install/java/org/apache/openmeetings/cli/Admin.java Thu Jul 24 07:07:07 2014
@@ -26,6 +26,8 @@ import static org.apache.openmeetings.ut
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.Map;
@@ -625,11 +627,21 @@ public class Admin {
}
private void restoreOm(String ctxName, File backup) {
+ InputStream is = null;
try {
BackupImport importCtrl = getApplicationContext(ctxName).getBean(BackupImport.class);
- importCtrl.performImport(new FileInputStream(backup));
+ is = new FileInputStream(backup);
+ importCtrl.performImport(is);
} catch (Exception e) {
handleError("Restore failed", e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ throw new RuntimeException("Error while closing ldap config file", e);
+ }
+ }
}
}
Modified: openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/ldap/LdapLoginManagement.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/ldap/LdapLoginManagement.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/ldap/LdapLoginManagement.java (original)
+++ openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/ldap/LdapLoginManagement.java Thu Jul 24 07:07:07 2014
@@ -23,6 +23,8 @@ import static org.apache.openmeetings.ut
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.Date;
import java.util.Properties;
import java.util.Set;
@@ -163,12 +165,23 @@ public class LdapLoginManagement {
log.debug("LdapLoginmanagement.doLdapLogin");
Properties config = new Properties();
+ InputStream pis = null;
try {
LdapConfig ldapConfig = ldapConfigDao.get(domainId);
- config.load(new FileInputStream(new File(OmFileHelper.getConfDir(), ldapConfig.getConfigFileName())));
+ pis = new FileInputStream(new File(OmFileHelper.getConfDir(), ldapConfig.getConfigFileName()));
+ config.load(pis);
} catch (Exception e) {
log.error("Error on LdapLogin : Configurationdata couldnt be retrieved!");
return null;
+ } finally {
+ if (pis != null) {
+ try {
+ pis.close();
+ } catch (IOException e) {
+ log.error("Error while closing ldap config file");
+ return null;
+ }
+ }
}
if (config.isEmpty()) {
log.error("Error on LdapLogin : Configurationdata couldnt be retrieved!");
Modified: openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/servlet/outputhandler/ScreenController.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/servlet/outputhandler/ScreenController.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/servlet/outputhandler/ScreenController.java (original)
+++ openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/servlet/outputhandler/ScreenController.java Thu Jul 24 07:07:07 2014
@@ -236,14 +236,15 @@ public class ScreenController {
private void addKeystore(Context ctx) {
log.debug("RTMP Sharer Keystore :: start");
StringBuilder sb = new StringBuilder();
- FileInputStream fis = null;
+ FileInputStream fis = null, ris = null;
try {
File conf = new File(OmFileHelper.getRootDir(), "conf");
File keyStore = new File(conf, "keystore.screen");
if (keyStore.exists()) {
Properties red5Props = new Properties();
- red5Props.load(new FileInputStream(new File(conf, "red5.properties")));
+ ris = new FileInputStream(new File(conf, "red5.properties"));
+ red5Props.load(ris);
byte keyBytes[] = new byte[(int)keyStore.length()];
fis = new FileInputStream(keyStore);
@@ -278,6 +279,13 @@ public class ScreenController {
// no op
}
}
+ if (ris != null) {
+ try {
+ ris.close();
+ } catch (IOException e) {
+ // no op
+ }
+ }
}
ctx.put("KEYSTORE", sb);
}
Modified: openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java (original)
+++ openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java Thu Jul 24 07:07:07 2014
@@ -24,6 +24,8 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import org.apache.openmeetings.backup.BackupImport;
import org.apache.openmeetings.data.conference.RoomManager;
@@ -76,8 +78,10 @@ public class TestOldBackups extends Abst
for (File backup : backupsHome.listFiles()) {
String name = backup.getName();
log.debug("Import of backup file : '" + name + "' is started ...");
+ InputStream is = null;
try {
- backupController.performImport(new FileInputStream(backup));
+ is = new FileInputStream(backup);
+ backupController.performImport(is);
long newOrgCount = organisationDao.count();
long newUserCount = usersDao.count();
long newRoomCount = roomDao.count();
@@ -99,6 +103,14 @@ public class TestOldBackups extends Abst
meetingMembersCount = newMeetingMembersCount;
} catch (Exception e) {
throw new RuntimeException("Unexpected exception while importing backup: " + name, e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ throw new RuntimeException("Error while closing ldap config file", e);
+ }
+ }
}
log.debug("... Done.");
}
Modified: openmeetings/branches/3.0.x/src/util/java/org/apache/openmeetings/util/mail/IcalHandler.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/util/java/org/apache/openmeetings/util/mail/IcalHandler.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/util/java/org/apache/openmeetings/util/mail/IcalHandler.java (original)
+++ openmeetings/branches/3.0.x/src/util/java/org/apache/openmeetings/util/mail/IcalHandler.java Thu Jul 24 07:07:07 2014
@@ -85,8 +85,7 @@ public class IcalHandler {
icsCalendar = new net.fortuna.ical4j.model.Calendar();
- icsCalendar.getProperties().add(
- new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
+ icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
icsCalendar.getProperties().add(Version.VERSION_2_0);
icsCalendar.getProperties().add(CalScale.GREGORIAN);
@@ -117,8 +116,7 @@ public class IcalHandler {
HashMap<String, String> organizer, String uid, java.util.TimeZone normalTimeZone)
throws Exception {
- TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance()
- .createRegistry();
+ TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TimeZone timeZone = registry.getTimeZone(normalTimeZone.getID());
@@ -187,11 +185,7 @@ public class IcalHandler {
HashMap<String, String> oneRecord = new HashMap<String, String>();
oneRecord.put("uri", "mailto:" + emailAdress);
oneRecord.put("cn", displayName);
-
- if (chair)
- oneRecord.put("chair", "1");
- else
- oneRecord.put("chair", "0");
+ oneRecord.put("chair", chair ? "1" : "0");
return oneRecord;
@@ -205,14 +199,15 @@ public class IcalHandler {
// ------------------------------------------------------------------------------------------
public void writeDataToFile(String filerPath) throws Exception {
- if (!filerPath.endsWith(".ics"))
+ if (!filerPath.endsWith(".ics")) {
filerPath = filerPath + ".ics";
+ }
FileOutputStream fout = new FileOutputStream(filerPath);
CalendarOutputter outputter = new CalendarOutputter();
outputter.output(icsCalendar, fout);
-
+ fout.close();
}
// ------------------------------------------------------------------------------------------
Modified: openmeetings/trunk/singlewebapp/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManagement.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManagement.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManagement.java (original)
+++ openmeetings/trunk/singlewebapp/openmeetings-core/src/main/java/org/apache/openmeetings/core/ldap/LdapLoginManagement.java Thu Jul 24 07:07:07 2014
@@ -23,6 +23,8 @@ import static org.apache.openmeetings.ut
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.Date;
import java.util.Properties;
import java.util.Set;
@@ -163,12 +165,23 @@ public class LdapLoginManagement {
log.debug("LdapLoginmanagement.doLdapLogin");
Properties config = new Properties();
+ InputStream pis = null;
try {
LdapConfig ldapConfig = ldapConfigDao.get(domainId);
- config.load(new FileInputStream(new File(OmFileHelper.getConfDir(), ldapConfig.getConfigFileName())));
+ pis = new FileInputStream(new File(OmFileHelper.getConfDir(), ldapConfig.getConfigFileName()));
+ config.load(pis);
} catch (Exception e) {
log.error("Error on LdapLogin : Configurationdata couldnt be retrieved!");
return null;
+ } finally {
+ if (pis != null) {
+ try {
+ pis.close();
+ } catch (IOException e) {
+ log.error("Error while closing ldap config file");
+ return null;
+ }
+ }
}
if (config.isEmpty()) {
log.error("Error on LdapLogin : Configurationdata couldnt be retrieved!");
Modified: openmeetings/trunk/singlewebapp/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java (original)
+++ openmeetings/trunk/singlewebapp/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java Thu Jul 24 07:07:07 2014
@@ -26,6 +26,8 @@ import static org.apache.openmeetings.ut
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Date;
import java.util.Map;
@@ -625,11 +627,21 @@ public class Admin {
}
private void restoreOm(String ctxName, File backup) {
+ InputStream is = null;
try {
BackupImport importCtrl = getApplicationContext(ctxName).getBean(BackupImport.class);
- importCtrl.performImport(new FileInputStream(backup));
+ is = new FileInputStream(backup);
+ importCtrl.performImport(is);
} catch (Exception e) {
handleError("Restore failed", e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ throw new RuntimeException("Error while closing ldap config file", e);
+ }
+ }
}
}
Modified: openmeetings/trunk/singlewebapp/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java (original)
+++ openmeetings/trunk/singlewebapp/openmeetings-util/src/main/java/org/apache/openmeetings/util/mail/IcalHandler.java Thu Jul 24 07:07:07 2014
@@ -85,8 +85,7 @@ public class IcalHandler {
icsCalendar = new net.fortuna.ical4j.model.Calendar();
- icsCalendar.getProperties().add(
- new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
+ icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
icsCalendar.getProperties().add(Version.VERSION_2_0);
icsCalendar.getProperties().add(CalScale.GREGORIAN);
@@ -117,8 +116,7 @@ public class IcalHandler {
HashMap<String, String> organizer, String uid, java.util.TimeZone normalTimeZone)
throws Exception {
- TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance()
- .createRegistry();
+ TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TimeZone timeZone = registry.getTimeZone(normalTimeZone.getID());
@@ -187,11 +185,7 @@ public class IcalHandler {
HashMap<String, String> oneRecord = new HashMap<String, String>();
oneRecord.put("uri", "mailto:" + emailAdress);
oneRecord.put("cn", displayName);
-
- if (chair)
- oneRecord.put("chair", "1");
- else
- oneRecord.put("chair", "0");
+ oneRecord.put("chair", chair ? "1" : "0");
return oneRecord;
@@ -205,14 +199,15 @@ public class IcalHandler {
// ------------------------------------------------------------------------------------------
public void writeDataToFile(String filerPath) throws Exception {
- if (!filerPath.endsWith(".ics"))
+ if (!filerPath.endsWith(".ics")) {
filerPath = filerPath + ".ics";
+ }
FileOutputStream fout = new FileOutputStream(filerPath);
CalendarOutputter outputter = new CalendarOutputter();
outputter.output(icsCalendar, fout);
-
+ fout.close();
}
// ------------------------------------------------------------------------------------------
Modified: openmeetings/trunk/singlewebapp/openmeetings-web/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-web/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java?rev=1613020&r1=1613019&r2=1613020&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/openmeetings-web/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java (original)
+++ openmeetings/trunk/singlewebapp/openmeetings-web/src/test/java/org/apache/openmeetings/test/backup/TestOldBackups.java Thu Jul 24 07:07:07 2014
@@ -24,6 +24,8 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import org.apache.openmeetings.backup.BackupImport;
import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
@@ -73,8 +75,10 @@ public class TestOldBackups extends Abst
for (File backup : backupsHome.listFiles()) {
String name = backup.getName();
log.debug("Import of backup file : '" + name + "' is started ...");
+ InputStream is = null;
try {
- backupController.performImport(new FileInputStream(backup));
+ is = new FileInputStream(backup);
+ backupController.performImport(is);
long newOrgCount = organisationDao.count();
long newUserCount = usersDao.count();
long newRoomCount = roomDao.count();
@@ -96,6 +100,14 @@ public class TestOldBackups extends Abst
meetingMembersCount = newMeetingMembersCount;
} catch (Exception e) {
throw new RuntimeException("Unexpected exception while importing backup: " + name, e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ throw new RuntimeException("Error while closing ldap config file", e);
+ }
+ }
}
log.debug("... Done.");
}