summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Queinnec2011-10-04 16:44:44 (EDT)
committerBrian Payton2011-10-04 16:44:44 (EDT)
commitf00a03f3d74f7b6284171d28c4f344b187964dfc (patch)
tree99db2e79c179e0474f18762580dd01ced3da94fc
parent62390f577d82096b8d03a1971253f937c67b30f9 (diff)
downloadorg.eclipse.datatools.sqltools-f00a03f3d74f7b6284171d28c4f344b187964dfc.zip
org.eclipse.datatools.sqltools-f00a03f3d74f7b6284171d28c4f344b187964dfc.tar.gz
org.eclipse.datatools.sqltools-f00a03f3d74f7b6284171d28c4f344b187964dfc.tar.bz2
Checked in changes for Bug 357327.
* Remove a useless double assignment in class ParsingResult in plugin o.e.d.sqltools.sql * Fix a FileInputStream leak in class DataFileTokenizer in plugin o.e.d.sqltools.data.core * Fix a possible infinite loop in class DebugAction in plugin o.e.d.sqltools.routineeditor.ui
-rw-r--r--plugins/org.eclipse.datatools.sqltools.data.core/src/org/eclipse/datatools/sqltools/data/internal/core/load/DataFileTokenizer.java35
-rw-r--r--plugins/org.eclipse.datatools.sqltools.routineeditor.ui/src/org/eclipse/datatools/sqltools/routineeditor/ui/actions/DebugAction.java4
-rw-r--r--plugins/org.eclipse.datatools.sqltools.sql/src/org/eclipse/datatools/sqltools/sql/parser/ParsingResult.java2
3 files changed, 23 insertions, 18 deletions
diff --git a/plugins/org.eclipse.datatools.sqltools.data.core/src/org/eclipse/datatools/sqltools/data/internal/core/load/DataFileTokenizer.java b/plugins/org.eclipse.datatools.sqltools.data.core/src/org/eclipse/datatools/sqltools/data/internal/core/load/DataFileTokenizer.java
index 56b0ad8..042bcc3 100644
--- a/plugins/org.eclipse.datatools.sqltools.data.core/src/org/eclipse/datatools/sqltools/data/internal/core/load/DataFileTokenizer.java
+++ b/plugins/org.eclipse.datatools.sqltools.data.core/src/org/eclipse/datatools/sqltools/data/internal/core/load/DataFileTokenizer.java
@@ -42,21 +42,26 @@ public class DataFileTokenizer
* Before loading the file, a check is made if BOM are introduced in the UTF-8 encoded file.
* If the first three bytes are 0xEF, 0xBB, 0xBF the first character is skipped as it is BOM.
*/
- public boolean bomEncoding() throws IOException
- {
- FileInputStream fis=new FileInputStream(filePath);
- boolean isBOM=false;
- int byteOne = fis.read();
- int byteTwo = fis.read();
- int byteThree = fis.read();
-
- //Check the BOM for UTF-8 encoding
- if (byteOne == 0xEF && byteTwo == 0xBB && byteThree == 0xBF)
- {
- // UTF-8
- isBOM=true;
- }
- return isBOM;
+ public boolean bomEncoding() throws IOException {
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(filePath);
+ boolean isBOM = false;
+ int byteOne = fis.read();
+ int byteTwo = fis.read();
+ int byteThree = fis.read();
+
+ // Check for BOM that indicates UTF-8 encoding
+ if (byteOne == 0xEF && byteTwo == 0xBB && byteThree == 0xBF) {
+ // UTF-8 BOM is present
+ isBOM = true;
+ }
+ return isBOM;
+ } finally {
+ if (fis != null) {
+ fis.close();
+ }
+ }
}
/**
diff --git a/plugins/org.eclipse.datatools.sqltools.routineeditor.ui/src/org/eclipse/datatools/sqltools/routineeditor/ui/actions/DebugAction.java b/plugins/org.eclipse.datatools.sqltools.routineeditor.ui/src/org/eclipse/datatools/sqltools/routineeditor/ui/actions/DebugAction.java
index dc8bffa..4890cda 100644
--- a/plugins/org.eclipse.datatools.sqltools.routineeditor.ui/src/org/eclipse/datatools/sqltools/routineeditor/ui/actions/DebugAction.java
+++ b/plugins/org.eclipse.datatools.sqltools.routineeditor.ui/src/org/eclipse/datatools/sqltools/routineeditor/ui/actions/DebugAction.java
@@ -19,8 +19,8 @@ import org.eclipse.datatools.sqltools.core.ProcIdentifier;
import org.eclipse.datatools.sqltools.internal.SQLDevToolsUtil;
import org.eclipse.datatools.sqltools.routineeditor.ui.ProcEditorInput;
import org.eclipse.datatools.sqltools.routineeditor.ui.RoutineEditor;
-import org.eclipse.datatools.sqltools.routineeditor.ui.RoutineEditorUIActivator;
import org.eclipse.datatools.sqltools.routineeditor.ui.RoutineEditorImages;
+import org.eclipse.datatools.sqltools.routineeditor.ui.RoutineEditorUIActivator;
import org.eclipse.datatools.sqltools.routineeditor.ui.launching.LaunchingJob;
import org.eclipse.datatools.sqltools.sqleditor.ISQLEditorActionConstants;
import org.eclipse.datatools.sqltools.sqleditor.SQLEditor;
@@ -160,6 +160,6 @@ public class DebugAction extends RoutineAction
}
public void run(IAction action) {
- run(null);
+ run();
}
}
diff --git a/plugins/org.eclipse.datatools.sqltools.sql/src/org/eclipse/datatools/sqltools/sql/parser/ParsingResult.java b/plugins/org.eclipse.datatools.sqltools.sql/src/org/eclipse/datatools/sqltools/sql/parser/ParsingResult.java
index 3a91694..6752b88 100644
--- a/plugins/org.eclipse.datatools.sqltools.sql/src/org/eclipse/datatools/sqltools/sql/parser/ParsingResult.java
+++ b/plugins/org.eclipse.datatools.sqltools.sql/src/org/eclipse/datatools/sqltools/sql/parser/ParsingResult.java
@@ -725,7 +725,7 @@ public abstract class ParsingResult
public String[] getEntries(String type)
{
String[] items = null;
- List objects = objects = (ArrayList) fEntries.get(type);
+ List objects = (ArrayList) fEntries.get(type);
if (objects == null)
{