Author: vyemialyanchyk
Date: 2009-04-08 09:14:17 -0400 (Wed, 08 Apr 2009)
New Revision: 14604
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
Log:
JBIDE-4138 - close fis in ResourcesUtils.findLineInFile - cosmetic change - cause this is
never call function
Modified:
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java
===================================================================
---
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2009-04-08
13:13:30 UTC (rev 14603)
+++
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ResourcesUtils.java 2009-04-08
13:14:17 UTC (rev 14604)
@@ -36,7 +36,6 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-import org.jboss.tools.tests.ImportBean;
import org.jboss.tools.tests.ImportProvider;
import org.osgi.framework.Bundle;
@@ -111,16 +110,37 @@
}
public static boolean findLineInFile(IFile file, String pattern) throws CoreException,
IOException {
- InputStream content = file.getContents(true);
- LineNumberReader contentReader = new LineNumberReader(new InputStreamReader(content));
- String line;
+ InputStream content = null;
+ InputStreamReader isr = null;
boolean patternIsFound = false;
- do {
- line = contentReader.readLine();
- if(line!=null && !patternIsFound) {
- patternIsFound = line.trim().matches(pattern);
+ try {
+ content = file.getContents(true);
+ isr = new InputStreamReader(content);
+ LineNumberReader contentReader = new LineNumberReader(isr);
+ String line;
+ do {
+ line = contentReader.readLine();
+ if(line!=null && !patternIsFound) {
+ patternIsFound = line.trim().matches(pattern);
+ }
+ } while (line != null && !patternIsFound);
+ }
+ finally {
+ if (isr != null) {
+ try {
+ isr.close();
+ } catch (IOException e) {
+ // ignore
+ }
}
- } while (line != null && !patternIsFound);
+ if (content != null) {
+ try {
+ content.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
return patternIsFound;
}
@@ -164,9 +184,9 @@
return oldAutoBuilding;
}
- static public void importProjectIntoWorkspace(ImportBean bean) {
- importProjectIntoWorkspace(bean);
- }
+ //static public void importProjectIntoWorkspace(ImportBean bean) {
+ // importProjectIntoWorkspace(bean);
+ //}
private static final long IMPORT_DELAY = 50;
Show replies by date