aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2011-07-28 11:23:28 (EDT)
committerJohn Arthorne2011-07-28 11:23:28 (EDT)
commit0a3cb477a97bd0ec74e4ef1e0adac9d3c85a468d (patch)
tree9dfd4f44ac6851387d157ac24b4ae133cb393828
parent54353dc7b10ef0e266f10c752ac31edda6be7924 (diff)
downloadegit-pde-0a3cb477a97bd0ec74e4ef1e0adac9d3c85a468d.zip
egit-pde-0a3cb477a97bd0ec74e4ef1e0adac9d3c85a468d.tar.gz
egit-pde-0a3cb477a97bd0ec74e4ef1e0adac9d3c85a468d.tar.bz2
Release fails when non-git map entries encounteredrefs/changes/37/3937/1
This is a squashed version of my previous patch Bug: 353127 Change-Id: I4140b7bc54049ab9e74ffe0e3ce11753eee711b5 Signed-off-by: John Arthorne <John_Arthorne@ca.ibm.com>
-rw-r--r--[-rwxr-xr-x]org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/MapContentDocument.java46
1 files changed, 23 insertions, 23 deletions
diff --git a/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/MapContentDocument.java b/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/MapContentDocument.java
index bbc85eb..3fde337 100755..100644
--- a/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/MapContentDocument.java
+++ b/org.eclipse.egit.relengtools/src/org/eclipse/egit/internal/relengtools/MapContentDocument.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@ import org.eclipse.swt.graphics.Image;
public class MapContentDocument implements ITypedElement,
IStreamContentAccessor {
- private MapFile mapFile;
+ private final MapFile mapFile;
private String oldContents = ""; //$NON-NLS-1$
@@ -42,24 +42,20 @@ public class MapContentDocument implements ITypedElement,
* Update the tag associated with the given project in the new contents.
*/
public void updateTag(IProject project, String tag) throws CoreException {
- InputStream inputStream = new BufferedInputStream(
+ final InputStream inputStream = new BufferedInputStream(
new ByteArrayInputStream(newContents.getBytes()));
boolean match = false;
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
try {
- BufferedReader aReader = new BufferedReader(new InputStreamReader(
- inputStream));
+ final BufferedReader aReader = new BufferedReader(
+ new InputStreamReader(inputStream));
String aLine = aReader.readLine();
while (aLine != null) {
if (aLine.trim().length() != 0 && !aLine.startsWith("!")
&& !aLine.startsWith("#")) {
// Found a possible match
- MapEntry entry = new MapEntry(aLine);
- if (!entry.isValid()) {
- throw new CoreException(new Status(IStatus.ERROR, "",
- "Malformed map file line: " + aLine));
- }
- if (entry.isMappedTo(project)) {
+ final MapEntry entry = new MapEntry(aLine);
+ if (entry.isValid() && entry.isMappedTo(project)) {
// Now for sure we have a match. Replace the line.
entry.setTagName(tag);
aLine = entry.getMapString();
@@ -72,14 +68,14 @@ public class MapContentDocument implements ITypedElement,
buffer.append(System.getProperty("line.separator")); //$NON-NLS-1$
}
}
- } catch (IOException e) {
+ } catch (final IOException e) {
throw new CoreException(new Status(IStatus.ERROR, "",
e.getMessage(), e));
} finally {
if (inputStream != null) {
try {
inputStream.close();
- } catch (IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
@@ -95,36 +91,40 @@ public class MapContentDocument implements ITypedElement,
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.compare.ITypedElement#getName()
*/
+ @Override
public String getName() {
return mapFile.getFile().getName();
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.compare.ITypedElement#getImage()
*/
+ @Override
public Image getImage() {
return null;
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.compare.ITypedElement#getType()
*/
+ @Override
public String getType() {
return mapFile.getFile().getFileExtension();
}
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.compare.IStreamContentAccessor#getContents()
*/
+ @Override
public InputStream getContents() throws CoreException {
return new ByteArrayInputStream(getNewContent().getBytes());
}
@@ -139,11 +139,11 @@ public class MapContentDocument implements ITypedElement,
private void initialize() {
InputStream inputStream;
- StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = new StringBuffer();
try {
inputStream = mapFile.getFile().getContents();
- BufferedReader aReader = new BufferedReader(new InputStreamReader(
- inputStream));
+ final BufferedReader aReader = new BufferedReader(
+ new InputStreamReader(inputStream));
String aLine = aReader.readLine();
while (aLine != null) {
buffer.append(aLine);
@@ -154,9 +154,9 @@ public class MapContentDocument implements ITypedElement,
}
oldContents = buffer.toString();
newContents = new String(oldContents);
- } catch (CoreException e) {
+ } catch (final CoreException e) {
e.printStackTrace();
- } catch (IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}