summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorNeil Guzman2013-07-10 09:46:18 (EDT)
committer Camilo Bernal2013-07-12 13:17:46 (EDT)
commit062888d198fd24e0075251244a05f4aad11903b2 (patch)
tree31c75640911bda93720c50abaa49a8598cb51799
parent4d85f3e2fc95fc9b17f41c67a0b24007ef10843c (diff)
downloadorg.eclipse.linuxtools-062888d198fd24e0075251244a05f4aad11903b2.zip
org.eclipse.linuxtools-062888d198fd24e0075251244a05f4aad11903b2.tar.gz
org.eclipse.linuxtools-062888d198fd24e0075251244a05f4aad11903b2.tar.bz2
Fix sonar violations for RPM and lttngrefs/changes/46/14446/4
Violations such as duplicate literals, string to string, anon inner length, collapsible if statements, etc.. o Amend1: use NLS, fix if conditional Change-Id: I47ac5320bfead822bc1ac470a1a80094ac063edc Signed-off-by: Neil Guzman <nguzman@redhat.com> Reviewed-on: https://git.eclipse.org/r/14446 Tested-by: Hudson CI Reviewed-by: Camilo Bernal <cabernal@redhat.com> IP-Clean: Camilo Bernal <cabernal@redhat.com> Tested-by: Camilo Bernal <cabernal@redhat.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java4
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java5
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java8
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java7
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java106
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties19
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java19
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/messages.properties3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/utils/RPMUtils.java5
11 files changed, 100 insertions, 82 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java
index f40f33f..c256a31 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/statesystem/TmfStateSystemExplorer.java
@@ -374,10 +374,8 @@ public class TmfStateSystemExplorer extends TmfView {
item.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)) ;
- if (!filterStatus) {
- if (!value.equals(item.getText(VALUE_COL)) || fCurrentTimestamp == startTime.getValue()) {
+ if (!filterStatus && (!value.equals(item.getText(VALUE_COL)) || fCurrentTimestamp == startTime.getValue())) {
item.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_YELLOW));
- }
}
item.setText(VALUE_COL, value) ;
diff --git a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java
index f2c2ecb..af8c7d9 100644
--- a/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java
+++ b/rpm/org.eclipse.linuxtools.rpm.core/src/org/eclipse/linuxtools/rpm/core/utils/DownloadJob.java
@@ -36,7 +36,8 @@ import org.eclipse.osgi.util.NLS;
public class DownloadJob extends Job {
private IFile file;
private URLConnection content;
-
+ private static final int MULTIPLIER = 5;
+ private static final int KB = 1024;
/**
* Creates the download job.
* @param file The file to store the remote content.
@@ -58,7 +59,7 @@ public class DownloadJob extends Job {
FileOutputStream fos = new FileOutputStream(tempFile);
InputStream is = new BufferedInputStream(content.getInputStream());
int b;
- byte buf[] = new byte[5 * 1024];
+ byte buf[] = new byte[MULTIPLIER * KB]; // 5kB buffer
boolean canceled = false;
while ((b = is.read(buf)) != -1) {
if (monitor.isCanceled()) {
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java
index aa8e156..4d527c3 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/RPMHandlerUtils.java
@@ -37,6 +37,11 @@ import org.eclipse.ui.part.EditorPart;
public class RPMHandlerUtils {
/**
+ * Utility classes should not have a public or default constructor.
+ */
+ private RPMHandlerUtils() {}
+
+ /**
* Extract the IResource that was selected when the event was fired.
* @param event The fired execution event.
* @return The resource that was selected.
@@ -69,8 +74,7 @@ public class RPMHandlerUtils {
return (IResource) element;
} else if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element;
- Object adapted = adaptable.getAdapter(IResource.class);
- return (IResource) adapted;
+ return (IResource) adaptable.getAdapter(IResource.class);
} else {
return null;
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java
index e3d82d6..bf17718 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/Messages.java
@@ -22,10 +22,13 @@ public final class Messages extends NLS {
public static String DownloadSources_cannotConnectToURL;
// SpecfileEditorPrepareSourcesActionDelegate
+ public static String PrepareSources_error;
public static String PrepareSources_downloadSourcesMalformedURL;
public static String PrepareSources_downloadCancelled;
public static String PrepareSources_downloadConnectionFail;
public static String PrepareSources_coreException;
+ public static String PrepareSources_prepareSources;
+ public static String PrepareSources_consoleName;
// RPMHandlerUtils
public static String RPMHandlerUtils_cannotCreateRPMProject;
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java
index d27bfca..eeab9d6 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java
@@ -33,6 +33,7 @@ import org.eclipse.linuxtools.rpm.core.utils.DownloadJob;
import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser;
import org.eclipse.linuxtools.rpm.ui.editor.utils.RPMUtils;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -55,14 +56,14 @@ public class SpecfileEditorDownloadSourcesActionDelegate extends AbstractHandler
for (final SpecfileSource sourceurls : sourceURLList) {
try {
String rawURL = sourceurls.getFileName().toString();
- String resolvedURL = UiUtils.resolveDefines(specfile, rawURL.toString());
+ String resolvedURL = UiUtils.resolveDefines(specfile, rawURL);
URL url = null;
try {
url = new URL(resolvedURL);
} catch(MalformedURLException e) {
- SpecfileLog.logError(Messages.DownloadSources_malformedURL + resolvedURL, e);
+ SpecfileLog.logError(NLS.bind(Messages.DownloadSources_malformedURL, resolvedURL), e);
RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$
- Messages.DownloadSources_malformedURL + resolvedURL);
+ NLS.bind(Messages.DownloadSources_malformedURL, resolvedURL));
return null;
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java
index 1df4b69..dc6c007 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java
@@ -36,6 +36,7 @@ import org.eclipse.linuxtools.rpm.core.utils.DownloadJob;
import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser;
import org.eclipse.linuxtools.rpm.ui.editor.utils.RPMUtils;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
@@ -53,27 +54,59 @@ public class SpecfileEditorPrepareSourcesActionDelegate extends AbstractHandler
final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource);
final IFile workFile = (IFile) rpj.getSpecFile();
final Specfile specfile = specparser.parse(workFile);
+
+ if (!DownloadFile(shell, rpj, specfile))
+ return null;
+
+ Job job = new Job("Preparing sources") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask(
+ NLS.bind(Messages.PrepareSources_prepareSources, rpj.getSpecFile().getName()), IProgressMonitor.UNKNOWN);
+ int offset = rpj.getSpecFile().getName().toString()
+ .lastIndexOf("."); //$NON-NLS-1$
+ MessageConsoleStream out = getConsole(
+ rpj.getSpecFile().getName().toString()
+ .substring(0, offset)).newMessageStream();
+ IStatus is = null;
+ try {
+ is = rpj.buildPrep(out);
+ } catch (CoreException e) {
+ SpecfileLog.logError(Messages.PrepareSources_coreException,
+ e);
+ RPMUtils.showErrorDialog(shell,
+ Messages.PrepareSources_error,
+ Messages.PrepareSources_coreException);
+ return is;
+ } finally {
+ monitor.done();
+ }
+ return is;
+ }
+ };
+ job.setUser(true); // suppress UI. That's done in encapsulated
+ job.schedule();
+ return null;
+ }
+
+ public boolean DownloadFile(Shell shell, RPMProject rpj, Specfile specfile) {
// retrieve source(s) from specfile
final List<SpecfileSource> sourceURLList = specfile != null ? (List<SpecfileSource>) specfile
.getSources() : null;
-
- // need to download sources THEN prepare it
for (final SpecfileSource sourceurls : sourceURLList) {
try {
- String rawURL = sourceurls.getFileName().toString();
String resolvedURL = UiUtils.resolveDefines(specfile,
- rawURL.toString());
+ sourceurls.getFileName().toString());
URL url = null;
try {
url = new URL(resolvedURL);
} catch (MalformedURLException e) {
SpecfileLog.logError(
- Messages.PrepareSources_downloadSourcesMalformedURL
- + resolvedURL, e);
- RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$
- Messages.PrepareSources_downloadSourcesMalformedURL
- + resolvedURL);
- return null;
+ NLS.bind(Messages.PrepareSources_downloadSourcesMalformedURL, resolvedURL), e);
+ RPMUtils.showErrorDialog(shell,
+ Messages.PrepareSources_error,
+ NLS.bind(Messages.PrepareSources_downloadSourcesMalformedURL, resolvedURL));
+ return false;
}
HttpURLConnection connection = (HttpURLConnection) url
@@ -85,78 +118,49 @@ public class SpecfileEditorPrepareSourcesActionDelegate extends AbstractHandler
String filename = url.toString().substring(offset + 1);
// create the path to the "to be downloaded" file
- IFile file = rpj.getConfiguration().getSourcesFolder().getFile(new Path(filename));
+ IFile file = rpj.getConfiguration().getSourcesFolder()
+ .getFile(new Path(filename));
Job downloadJob = new DownloadJob(file, connection);
downloadJob.setUser(true);
downloadJob.schedule();
try {
- // wait for download job to finish
downloadJob.join();
} catch (InterruptedException e1) {
- throw new OperationCanceledException();
+ return false;
}
if (!downloadJob.getResult().isOK()) {
- // bail if something failed
- return downloadJob.getResult();
+ return false;
}
}
} catch (OperationCanceledException e) {
SpecfileLog.logError(Messages.PrepareSources_downloadCancelled,
e);
- RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$
+ RPMUtils.showErrorDialog(shell, Messages.PrepareSources_error,
Messages.PrepareSources_downloadCancelled);
- return null;
+ return false;
} catch (IOException e) {
SpecfileLog.logError(
Messages.PrepareSources_downloadConnectionFail, e);
- RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$
+ RPMUtils.showErrorDialog(shell, Messages.PrepareSources_error,
Messages.PrepareSources_downloadConnectionFail);
- return null;
+ return false;
}
}
-
- Job job = new Job("Preparing sources") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(
- "Preparing sources for " + rpj.getSpecFile().getName(), //$NON-NLS-1$
- IProgressMonitor.UNKNOWN);
- int offset = rpj.getSpecFile().getName().toString().lastIndexOf("."); //$NON-NLS-1$
- String projname = rpj.getSpecFile().getName().toString().substring(0,offset);
- MessageConsole myConsole = getConsole(projname);
- MessageConsoleStream out = myConsole.newMessageStream();
- IStatus is = null;
- try {
- // just need to get current stream
- is = rpj.buildPrep(out);
- } catch (CoreException e) {
- SpecfileLog.logError(Messages.PrepareSources_coreException,
- e);
- RPMUtils.showErrorDialog(shell, "Error", //$NON-NLS-1$
- Messages.PrepareSources_coreException);
- return is;
- } finally {
- monitor.done();
- }
- return is;
- }
- };
- job.setUser(true); // suppress UI. That's done in encapsulated
- job.schedule();
- return null;
+ return true;
}
/**
* Get the console.
*
- * @param packageName The name of the package(RPM) this console will be for.
+ * @param packageName
+ * The name of the package(RPM) this console will be for.
* @return A console instance.
*/
public MessageConsole getConsole(String packageName) {
ConsolePlugin plugin = ConsolePlugin.getDefault();
IConsoleManager conMan = plugin.getConsoleManager();
- String projectConsoleName = "rpmbuild"+'('+packageName+')'; //$NON-NLS-1$
+ String projectConsoleName = NLS.bind(Messages.PrepareSources_consoleName, packageName);
MessageConsole ret = null;
for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager()
.getConsoles()) {
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties
index e47ac98..5200c20 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/messages.properties
@@ -8,25 +8,28 @@
# Contributors:
# Red Hat - initial API and implementation
###############################################################################
-SpecfileChangelogAction_0=Did not get changelog partition. Please make me one\!
-SpecfileChangelogAction_1=Got specfile partition:
-SpecfileChangelogAction_2=,
-SpecfileChangelogAction_3=Got
-SpecfileChangelogAction_4=\ editor
-SpecfileChangelogAction_5=EEE MMM d yyyy
+#SpecfileChangelogAction_0=Did not get changelog partition. Please make me one\!
+#SpecfileChangelogAction_1=Got specfile partition:
+#SpecfileChangelogAction_2=,
+#SpecfileChangelogAction_3=Got
+#SpecfileChangelogAction_4=\ editor
+#SpecfileChangelogAction_5=EEE MMM d yyyy
SpecfileChangelogFormatter_0=Got
SpecfileChangelogFormatter_1=\ editor
# SpecfileEditorDownloadSourcesActionDelegate
-DownloadSources_malformedURL=Unable to create URL using:
+DownloadSources_malformedURL=Unable to create URL using: {0}
DownloadSources_cannotConnectToURL=Cannot open a connection using the URL.
# SpecfileEditorPrepareSourcesActionDelegate
-PrepareSources_downloadSourcesMalformedURL=During preparing of sources, unable to create URL using:
+PrepareSources_error=Error
+PrepareSources_downloadSourcesMalformedURL=During preparing of sources, unable to create URL using: {0}
PrepareSources_downloadCancelled=While preparing the sources, the download process was interrupted.
PrepareSources_downloadConnectionFail=During preparing of sources, cannot open a connection using the URL.
PrepareSources_coreException=There was a core exception thrown while trying to prepare the sources \
for the build.
+PrepareSources_prepareSources=Preparing sources for {0}
+PrepareSources_consoleName=rpmbuild({0})
# RPMHandlerUtils
RPMHandlerUtils_cannotCreateRPMProject=Error trying to retrieve the RPM Project. \ No newline at end of file
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java
index 7ca9947..c02e9bd 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileElement.java
@@ -14,7 +14,9 @@ package org.eclipse.linuxtools.rpm.ui.editor.parser;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileLog;
import org.eclipse.linuxtools.internal.rpm.ui.editor.UiUtils;
+import org.eclipse.linuxtools.internal.rpm.ui.editor.parser.Messages;
import org.eclipse.linuxtools.rpm.core.utils.RPMQuery;
+import org.eclipse.osgi.util.NLS;
public class SpecfileElement {
private Specfile specfile;
@@ -79,8 +81,8 @@ public class SpecfileElement {
public String resolve(String toResolve) {
if (specfile == null || toResolve.equals("")) {//$NON-NLS-1$
if (toResolve.length() > 2
- && toResolve.substring(2, toResolve.length() - 1)
- .equals(name)) {
+ && toResolve.substring(2, toResolve.length() - 1).equals(
+ name)) {
return toResolve;
}
}
@@ -90,22 +92,19 @@ public class SpecfileElement {
/**
* Resolve using RPM to evaluate string
*
- * @param toResolve The string to be evaluated
+ * @param toResolve
+ * The string to be evaluated
* @return The evaluated string
*/
public String resolveEval(String toResolve) {
String str = ""; //$NON-NLS-1$
try {
- if (specfile == null || toResolve.equals("")) {//$NON-NLS-1$
- if (toResolve.length() > 2
- && toResolve.substring(2, toResolve.length() - 1)
- .equals(name)) {
- return toResolve;
- }
+ if ((specfile == null || toResolve.equals("")) && toResolve.length() > 2 && toResolve.substring(2, toResolve.length() - 1).equals(name)) { //$NON-NLS-1$
+ return toResolve;
}
str = RPMQuery.eval(UiUtils.resolveDefines(specfile, toResolve)).trim();
} catch (CoreException e) {
- SpecfileLog.logError("Unable to evaluate " + toResolve, e); //$NON-NLS-1$
+ SpecfileLog.logError(NLS.bind(Messages.getString("SpecfileElement_unableToResolve"), toResolve), e); //$NON-NLS-1$
}
return str;
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java
index 644b1cf..089ee9e 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/SpecfileParser.java
@@ -193,8 +193,7 @@ public class SpecfileParser {
} catch (CoreException e) {
SpecfileLog.logError(Messages.getString("SpecfileParseFile.2"), e); //$NON-NLS-1$
}
- Specfile specfile = parser.parse(sb.toString());
- return specfile;
+ return parser.parse(sb.toString());
}
private void generateTaskMarker(int lineNumber, String line) {
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/messages.properties b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/messages.properties
index 5eb8bc6..6e04686 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/messages.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/parser/messages.properties
@@ -26,4 +26,5 @@ SpecfileSource.0=error: can't match
SpecfileSource.1=%patch
SpecfileSource.2=error: can't match
SpecfileParseFile.1=Unable to read from IFile when trying to parse to Specfile
-SpecfileParseFile.2=Problem with trying to get contents of IFile when parsing \ No newline at end of file
+SpecfileParseFile.2=Problem with trying to get contents of IFile when parsing
+SpecfileElement_unableToResolve=Unable to evaluate {0} \ No newline at end of file
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/utils/RPMUtils.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/utils/RPMUtils.java
index 345e38c..dcae79d 100644
--- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/utils/RPMUtils.java
+++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/rpm/ui/editor/utils/RPMUtils.java
@@ -21,6 +21,11 @@ import org.eclipse.ui.PlatformUI;
public class RPMUtils {
/**
+ * Utility classes should not have a public or default constructor.
+ */
+ private RPMUtils() {}
+
+ /**
* Show an error dialog.
*
* @param shell A valid shell