diff options
author | Randy Rohrbach | 2009-10-18 04:53:48 +0000 |
---|---|---|
committer | Randy Rohrbach | 2009-10-18 04:53:48 +0000 |
commit | 0d66821cc13cd4922df34ace9e60a2aaeb01a17c (patch) | |
tree | 12b4c70d1e4268afbce757990e0b3cc70133066d /memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse | |
parent | 6cb229669edd352f32052e05033d570122b9fc5a (diff) | |
download | org.eclipse.cdt-0d66821cc13cd4922df34ace9e60a2aaeb01a17c.tar.gz org.eclipse.cdt-0d66821cc13cd4922df34ace9e60a2aaeb01a17c.tar.xz org.eclipse.cdt-0d66821cc13cd4922df34ace9e60a2aaeb01a17c.zip |
Bugzilla defects
256775
283586
287540
290710
292059
292120
292293
Diffstat (limited to 'memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse')
7 files changed, 505 insertions, 452 deletions
diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java index ee47c97f95b..7ad1306e5f1 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/ImportMemoryDialog.java @@ -47,6 +47,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.SelectionDialog; import org.eclipse.ui.progress.UIJob; +@SuppressWarnings("restriction") public class ImportMemoryDialog extends SelectionDialog { @@ -179,7 +180,7 @@ public class ImportMemoryDialog extends SelectionDialog data.left = new FormAttachment(textLabel); fFormatCombo.setLayoutData(data); - Vector importers = new Vector(); + Vector<Object> importers = new Vector<Object>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = @@ -194,7 +195,7 @@ public class ImportMemoryDialog extends SelectionDialog { try { - importers.addElement((IMemoryImporter) element.createExecutableExtension("class")); + importers.addElement(element.createExecutableExtension("class")); } catch(Exception e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java index 837f82810bc..d376d9821ca 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextExporter.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.ui.memory.transport; import java.io.File; import java.io.FileWriter; +import java.io.IOException; import java.math.BigInteger; import java.util.Properties; @@ -364,94 +365,98 @@ public class PlainTextExporter implements IMemoryExporter { public void exportMemory() { Job job = new Job("Memory Export to Plain Text File"){ //$NON-NLS-1$ public IStatus run(IProgressMonitor monitor) { - try - { - try - { - // FIXME 4 byte default - - BigInteger CELLSIZE = BigInteger.valueOf(4); - - BigInteger COLUMNS = BigInteger.valueOf(5); // FIXME - - BigInteger DATA_PER_LINE = CELLSIZE.multiply(COLUMNS); + { + // FIXME 4 byte default + + BigInteger CELLSIZE = BigInteger.valueOf(4); + + BigInteger COLUMNS = BigInteger.valueOf(5); // FIXME + + BigInteger DATA_PER_LINE = CELLSIZE.multiply(COLUMNS); + + BigInteger transferAddress = fStartAddress; + + FileWriter writer = new FileWriter(fOutputFile); + + BigInteger jobs = fEndAddress.subtract(transferAddress).divide(DATA_PER_LINE); + BigInteger factor = BigInteger.ONE; + if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) + { + factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); + jobs = jobs.divide(factor); + } - BigInteger transferAddress = fStartAddress; + monitor.beginTask("Transferring Data", jobs.intValue()); + + BigInteger jobCount = BigInteger.ZERO; + while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) + { + BigInteger length = DATA_PER_LINE; + if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) + length = fEndAddress.subtract(transferAddress); - FileWriter writer = new FileWriter(fOutputFile); + monitor.subTask(String.format("Transfering %s bytes at address 0x%s", length.toString(10), transferAddress.toString(16))); - BigInteger jobs = fEndAddress.subtract(transferAddress).divide(DATA_PER_LINE); - BigInteger factor = BigInteger.ONE; - if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) - { - factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); - jobs = jobs.divide(factor); - } - - monitor.beginTask("Transferring Data", jobs.intValue()); + StringBuffer buf = new StringBuffer(); - BigInteger jobCount = BigInteger.ZERO; - while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) - { - BigInteger length = DATA_PER_LINE; - if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) - length = fEndAddress.subtract(transferAddress); - - StringBuffer buf = new StringBuffer(); - // String transferAddressString = transferAddress.toString(16); - - // future option + + // future option // for(int i = 0; i < 8 - transferAddressString.length(); i++) // buf.append("0"); // buf.append(transferAddressString); // buf.append(" "); // TODO tab? - - // data - - for(int i = 0; i < length.divide(CELLSIZE).intValue(); i++) - { - if(i != 0) - buf.append(" "); - MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress( - transferAddress.add(CELLSIZE.multiply(BigInteger.valueOf(i))), - CELLSIZE.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize()); - for(int byteIndex = 0; byteIndex < bytes.length; byteIndex++) - { - String bString = BigInteger.valueOf(0xFF & bytes[byteIndex].getValue()).toString(16); - if(bString.length() == 1) - buf.append("0"); - buf.append(bString); - } - } - - writer.write(buf.toString().toUpperCase()); - writer.write("\n"); - - transferAddress = transferAddress.add(length); - - jobCount = jobCount.add(BigInteger.ONE); - if(jobCount.compareTo(factor) == 0) + + // data + + for(int i = 0; i < length.divide(CELLSIZE).intValue(); i++) + { + if(i != 0) + buf.append(" "); + MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress( + transferAddress.add(CELLSIZE.multiply(BigInteger.valueOf(i))), + CELLSIZE.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize()); + for(int byteIndex = 0; byteIndex < bytes.length; byteIndex++) { - jobCount = BigInteger.ZERO; - monitor.worked(1); + String bString = BigInteger.valueOf(0xFF & bytes[byteIndex].getValue()).toString(16); + if(bString.length() == 1) + buf.append("0"); + buf.append(bString); } - } + } - writer.close(); - monitor.done(); - } - catch(Exception e) - { - MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + writer.write(buf.toString().toUpperCase()); + writer.write("\n"); + + transferAddress = transferAddress.add(length); + + jobCount = jobCount.add(BigInteger.ONE); + if(jobCount.compareTo(factor) == 0) + { + jobCount = BigInteger.ZERO; + monitor.worked(1); + } } - } - catch(Exception e) - { + + writer.close(); + monitor.done(); + } catch (IOException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to file.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to file.", ex); + + } catch (DebugException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could read from target.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could read from target.", ex); + } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure exporting memory", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.INTERNAL_ERROR, "Failure exporting memory", ex); } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java index 02403238339..59bc5968c83 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/PlainTextImporter.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.debug.ui.memory.transport; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Properties; @@ -276,82 +277,92 @@ public class PlainTextImporter implements IMemoryImporter { Job job = new Job("Memory Import from Plain Text File"){ //$NON-NLS-1$ public IStatus run(IProgressMonitor monitor) { - try - { - try - { - BufferedMemoryWriter memoryWriter = new BufferedMemoryWriter((IMemoryBlockExtension) fMemoryBlock, BUFFER_LENGTH); - - BigInteger scrollToAddress = null; - - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile))); - - BigInteger jobs = BigInteger.valueOf(fInputFile.length()); - BigInteger factor = BigInteger.ONE; - if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) - { - factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); - jobs = jobs.divide(factor); - } - - monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ + { + BufferedMemoryWriter memoryWriter = new BufferedMemoryWriter((IMemoryBlockExtension) fMemoryBlock, BUFFER_LENGTH); + + BigInteger scrollToAddress = null; + + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile))); + + BigInteger jobs = BigInteger.valueOf(fInputFile.length()); + BigInteger factor = BigInteger.ONE; + if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) + { + factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); + jobs = jobs.divide(factor); + } - BigInteger jobCount = BigInteger.ZERO; - BigInteger recordAddress = fStartAddress; - String line = reader.readLine(); - while(line != null && !monitor.isCanceled()) + monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ + + BigInteger recordAddress = fStartAddress; + String line = reader.readLine(); + int lineNo = 1; // line error reporting + while(line != null && !monitor.isCanceled()) + { + StringTokenizer st = new StringTokenizer(line, " "); + int bytesRead = 0; + while(st.hasMoreElements()) { - StringTokenizer st = new StringTokenizer(line, " "); - int bytesRead = 0; - while(st.hasMoreElements()) + String valueString = (String) st.nextElement(); + int position = 0; + byte data[] = new byte[valueString.length() / 2]; + for(int i = 0; i < data.length; i++) { - String valueString = (String) st.nextElement(); - int position = 0; - byte data[] = new byte[valueString.length() / 2]; - for(int i = 0; i < data.length; i++) - { + try { data[i] = new BigInteger(valueString.substring(position++, position++ + 1), 16).byteValue(); + } catch (NumberFormatException ex) { + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, String.format("Invalid file format. Expected integer at line %d", lineNo ), ex); } - - if(scrollToAddress == null) - scrollToAddress = recordAddress; - - BigInteger writeAddress = - - recordAddress.subtract(((IMemoryBlockExtension)fMemoryBlock).getBigBaseAddress()).add(BigInteger.valueOf(bytesRead)); - - memoryWriter.write(writeAddress, data); - - bytesRead += data.length; } - recordAddress = recordAddress.add(BigInteger.valueOf(bytesRead)); + if(scrollToAddress == null) + scrollToAddress = recordAddress; - jobCount = jobCount.add(BigInteger.valueOf(bytesRead)); - while(jobCount.compareTo(factor) >= 0) - { - jobCount = jobCount.subtract(factor); - monitor.worked(1); - } + BigInteger writeAddress = + + recordAddress.subtract(((IMemoryBlockExtension)fMemoryBlock).getBigBaseAddress()).add(BigInteger.valueOf(bytesRead)); + + memoryWriter.write(writeAddress, data); - line = reader.readLine(); - } + bytesRead += data.length; + } - memoryWriter.flush(); - reader.close(); - monitor.done(); + recordAddress = recordAddress.add(BigInteger.valueOf(bytesRead)); - if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) - fParentDialog.scrollRenderings(scrollToAddress); - } - catch(Exception e) - { - MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + BigInteger jobCount = BigInteger.valueOf(bytesRead).divide(factor); + monitor.worked(jobCount.intValue()); + + line = reader.readLine(); + lineNo++; } + + if (!monitor.isCanceled()) + memoryWriter.flush(); + + reader.close(); + monitor.done(); + + if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) + fParentDialog.scrollRenderings(scrollToAddress); + } catch (IOException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from file.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from file.", ex); + + } catch (DebugException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to target.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to target.", ex); + } catch (Exception ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.INTERNAL_ERROR, "Failure importing from file", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.INTERNAL_ERROR, "Failure importing from file", ex); } - catch(Exception e) {e.printStackTrace();} return Status.OK_STATUS; }}; job.setUser(true); diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java index 8000ff24075..4b8ec8c532a 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryExporter.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.ui.memory.transport; import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.math.BigInteger; import java.util.Properties; @@ -377,70 +378,74 @@ public class RAWBinaryExporter implements IMemoryExporter { Job job = new Job("Memory Export to RAW Binary File"){ //$NON-NLS-1$ public IStatus run(IProgressMonitor monitor) { - try - { - try - { - BigInteger DATA_PER_RECORD = BigInteger.valueOf(1024); + { + BigInteger DATA_PER_RECORD = BigInteger.valueOf(1024); + + BigInteger transferAddress = fStartAddress; + + FileOutputStream writer = new FileOutputStream(fOutputFile); + + BigInteger jobs = fEndAddress.subtract(transferAddress).divide(DATA_PER_RECORD); + BigInteger factor = BigInteger.ONE; + if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) + { + factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); + jobs = jobs.divide(factor); + } - BigInteger transferAddress = fStartAddress; + monitor.beginTask("Transferring Data", jobs.intValue()); + + BigInteger jobCount = BigInteger.ZERO; + while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) + { + BigInteger length = DATA_PER_RECORD; + if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) + length = fEndAddress.subtract(transferAddress); - FileOutputStream writer = new FileOutputStream(fOutputFile); + monitor.subTask(String.format("Transfering %s bytes at address 0x%s", length.toString(10), transferAddress.toString(16))); + + // data + byte[] byteValues = new byte[length.intValue()]; - BigInteger jobs = fEndAddress.subtract(transferAddress).divide(DATA_PER_RECORD); - BigInteger factor = BigInteger.ONE; - if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) + MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress(transferAddress, + length.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize()); + for(int byteIndex = 0; byteIndex < bytes.length; byteIndex++) { - factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); - jobs = jobs.divide(factor); + byteValues[byteIndex] = bytes[byteIndex].getValue(); } - - monitor.beginTask("Transferring Data", jobs.intValue()); - BigInteger jobCount = BigInteger.ZERO; - while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) - { - BigInteger length = DATA_PER_RECORD; - if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) - length = fEndAddress.subtract(transferAddress); - - // data - byte[] byteValues = new byte[length.intValue()]; - - MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress(transferAddress, - length.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize()); - for(int byteIndex = 0; byteIndex < bytes.length; byteIndex++) - { - byteValues[byteIndex] = bytes[byteIndex].getValue(); - } - - - writer.write(byteValues); - - transferAddress = transferAddress.add(length); - - jobCount = jobCount.add(BigInteger.ONE); - if(jobCount.compareTo(factor) == 0) - { - jobCount = BigInteger.ZERO; - monitor.worked(1); - } - } - writer.close(); - monitor.done(); - } - catch(Exception e) - { - MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + writer.write(byteValues); + + transferAddress = transferAddress.add(length); + + jobCount = jobCount.add(BigInteger.ONE); + if(jobCount.compareTo(factor) == 0) + { + jobCount = BigInteger.ZERO; + monitor.worked(1); + } } - } - catch(Exception e) - { + + writer.close(); + monitor.done(); + } catch (IOException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to file.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to file.", ex); + + } catch (DebugException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from target.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from target.", ex); + } catch (Exception e) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure exporting memory", e)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.INTERNAL_ERROR, "Failure exporting memory", e); } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java index 2026e546fa4..0b58dcbcf1e 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/RAWBinaryImporter.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.ui.memory.transport; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.math.BigInteger; import java.util.Properties; @@ -251,80 +252,79 @@ public class RAWBinaryImporter implements IMemoryImporter { Job job = new Job("Memory Import from RAW Binary File"){ //$NON-NLS-1$ public IStatus run(IProgressMonitor monitor) { - try - { - try - { - BufferedMemoryWriter memoryWriter = new BufferedMemoryWriter((IMemoryBlockExtension) fMemoryBlock, BUFFER_LENGTH); - - BigInteger scrollToAddress = null; - - FileInputStream reader = new FileInputStream(fInputFile); - - BigInteger jobs = BigInteger.valueOf(fInputFile.length()); - BigInteger factor = BigInteger.ONE; - if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) + { + BufferedMemoryWriter memoryWriter = new BufferedMemoryWriter((IMemoryBlockExtension) fMemoryBlock, BUFFER_LENGTH); + + BigInteger scrollToAddress = null; + + FileInputStream reader = new FileInputStream(fInputFile); + + BigInteger jobs = BigInteger.valueOf(fInputFile.length()); + BigInteger factor = BigInteger.ONE; + if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) + { + factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); + jobs = jobs.divide(factor); + } + + byte[] byteValues = new byte[1024]; + + monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ + + int actualByteCount = reader.read(byteValues); + BigInteger recordAddress = fStartAddress; + + while(actualByteCount != -1 && !monitor.isCanceled()) + { + byte data[] = new byte[actualByteCount]; + for(int i = 0; i < data.length; i++) { - factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); - jobs = jobs.divide(factor); + data[i] = byteValues[i]; } + + if(scrollToAddress == null) + scrollToAddress = recordAddress; - byte[] byteValues = new byte[1024]; - - monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ - - BigInteger jobCount = BigInteger.ZERO; - int actualByteCount = reader.read(byteValues); - BigInteger recordAddress = fStartAddress; + BigInteger baseAddress = null; + if(fMemoryBlock instanceof IMemoryBlockExtension) + baseAddress = ((IMemoryBlockExtension) fMemoryBlock).getBigBaseAddress(); + else + baseAddress = BigInteger.valueOf(fMemoryBlock.getStartAddress()); - while(actualByteCount != -1 && !monitor.isCanceled()) - { - byte data[] = new byte[actualByteCount]; - for(int i = 0; i < data.length; i++) - { - data[i] = byteValues[i]; - } + memoryWriter.write(recordAddress.subtract(baseAddress), data); - if(scrollToAddress == null) - scrollToAddress = recordAddress; - - BigInteger baseAddress = null; - if(fMemoryBlock instanceof IMemoryBlockExtension) - baseAddress = ((IMemoryBlockExtension) fMemoryBlock).getBigBaseAddress(); - else - baseAddress = BigInteger.valueOf(fMemoryBlock.getStartAddress()); - - memoryWriter.write(recordAddress.subtract(baseAddress), data); - - jobCount = jobCount.add(BigInteger.valueOf(actualByteCount)); - while(jobCount.compareTo(factor) >= 0) - { - jobCount = jobCount.subtract(factor); - monitor.worked(1); - } - - recordAddress.add(BigInteger.valueOf(actualByteCount)); - actualByteCount = reader.read(byteValues); - } - - memoryWriter.flush(); - reader.close(); - monitor.done(); + BigInteger jobCount = BigInteger.valueOf(actualByteCount).divide(factor); + monitor.worked(jobCount.intValue()); - if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) - fParentDialog.scrollRenderings(scrollToAddress); + recordAddress.add(BigInteger.valueOf(actualByteCount)); + actualByteCount = reader.read(byteValues); } - catch(Exception e) - { - MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); - } - } - catch(Exception e) - { + + if (!monitor.isCanceled()) + memoryWriter.flush(); + + reader.close(); + monitor.done(); + + if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) + fParentDialog.scrollRenderings(scrollToAddress); + } catch (IOException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from file.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from file.", ex); + + } catch (DebugException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to target.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to target.", ex); + } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure importing from file", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.INTERNAL_ERROR, "Failure importing from file", ex); } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java index 83f70cf5c1d..2c818db1d67 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordExporter.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.ui.memory.transport; import java.io.File; import java.io.FileWriter; +import java.io.IOException; import java.math.BigInteger; import java.util.Properties; @@ -379,110 +380,114 @@ public class SRecordExporter implements IMemoryExporter { Job job = new Job("Memory Export to S-Record File"){ //$NON-NLS-1$ public IStatus run(IProgressMonitor monitor) { - try - { - try - { - // FIXME 4 byte default + { + // FIXME 4 byte default + + BigInteger DATA_PER_RECORD = BigInteger.valueOf(16); + + BigInteger transferAddress = fStartAddress; + + FileWriter writer = new FileWriter(fOutputFile); + + BigInteger jobs = fEndAddress.subtract(transferAddress).divide(DATA_PER_RECORD); + BigInteger factor = BigInteger.ONE; + if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) + { + factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); + jobs = jobs.divide(factor); + } + + monitor.beginTask("Transferring Data", jobs.intValue()); + + BigInteger jobCount = BigInteger.ZERO; + while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) + { + BigInteger length = DATA_PER_RECORD; + if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) + length = fEndAddress.subtract(transferAddress); - BigInteger DATA_PER_RECORD = BigInteger.valueOf(16); + monitor.subTask(String.format("Transfering %s bytes at address 0x%s", length.toString(10), transferAddress.toString(16))); + + writer.write("S3"); // FIXME 4 byte address - BigInteger transferAddress = fStartAddress; + StringBuffer buf = new StringBuffer(); - FileWriter writer = new FileWriter(fOutputFile); + BigInteger sRecordLength = BigInteger.valueOf(4); // address size + sRecordLength = sRecordLength.add(length); + sRecordLength = sRecordLength.add(BigInteger.ONE); // checksum - BigInteger jobs = fEndAddress.subtract(transferAddress).divide(DATA_PER_RECORD); - BigInteger factor = BigInteger.ONE; - if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) - { - factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); - jobs = jobs.divide(factor); - } - - monitor.beginTask("Transferring Data", jobs.intValue()); + String transferAddressString = transferAddress.toString(16); - BigInteger jobCount = BigInteger.ZERO; - while(transferAddress.compareTo(fEndAddress) < 0 && !monitor.isCanceled()) + String lengthString = sRecordLength.toString(16); + if(lengthString.length() == 1) + buf.append("0"); + buf.append(lengthString); + for(int i = 0; i < 8 - transferAddressString.length(); i++) + buf.append("0"); + buf.append(transferAddressString); + + // data + + MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress(transferAddress, + length.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize()); + for(int byteIndex = 0; byteIndex < bytes.length; byteIndex++) { - BigInteger length = DATA_PER_RECORD; - if(fEndAddress.subtract(transferAddress).compareTo(length) < 0) - length = fEndAddress.subtract(transferAddress); - - writer.write("S3"); // FIXME 4 byte address - - StringBuffer buf = new StringBuffer(); - - BigInteger sRecordLength = BigInteger.valueOf(4); // address size - sRecordLength = sRecordLength.add(length); - sRecordLength = sRecordLength.add(BigInteger.ONE); // checksum - - String transferAddressString = transferAddress.toString(16); - - String lengthString = sRecordLength.toString(16); - if(lengthString.length() == 1) - buf.append("0"); - buf.append(lengthString); - for(int i = 0; i < 8 - transferAddressString.length(); i++) - buf.append("0"); - buf.append(transferAddressString); - - // data - - MemoryByte bytes[] = ((IMemoryBlockExtension) fMemoryBlock).getBytesFromAddress(transferAddress, - length.longValue() / ((IMemoryBlockExtension) fMemoryBlock).getAddressableSize()); - for(int byteIndex = 0; byteIndex < bytes.length; byteIndex++) - { - String bString = BigInteger.valueOf(0xFF & bytes[byteIndex].getValue()).toString(16); - if(bString.length() == 1) - buf.append("0"); - buf.append(bString); - } - - /* - * The least significant byte of the one's complement of the sum of the values - * represented by the pairs of characters making up the records length, address, - * and the code/data fields. - */ - byte checksum = 0; - - for(int i = 0; i < buf.length(); i+=2) - { - BigInteger value = new BigInteger(buf.substring(i, i+2), 16); - checksum += value.byteValue(); - } - - String bString = BigInteger.valueOf(0xFF - checksum).and(BigInteger.valueOf(0xFF)).toString(16); + String bString = BigInteger.valueOf(0xFF & bytes[byteIndex].getValue()).toString(16); if(bString.length() == 1) buf.append("0"); buf.append(bString); + } + + /* + * The least significant byte of the one's complement of the sum of the values + * represented by the pairs of characters making up the records length, address, + * and the code/data fields. + */ + byte checksum = 0; + + for(int i = 0; i < buf.length(); i+=2) + { + BigInteger value = new BigInteger(buf.substring(i, i+2), 16); + checksum += value.byteValue(); + } + + String bString = BigInteger.valueOf(0xFF - checksum).and(BigInteger.valueOf(0xFF)).toString(16); + if(bString.length() == 1) + buf.append("0"); + buf.append(bString); - writer.write(buf.toString().toUpperCase()); - writer.write("\n"); - - transferAddress = transferAddress.add(length); - - jobCount = jobCount.add(BigInteger.ONE); - if(jobCount.compareTo(factor) == 0) - { - jobCount = BigInteger.ZERO; - monitor.worked(1); - } - } + writer.write(buf.toString().toUpperCase()); + writer.write("\n"); - writer.close(); - monitor.done(); - } - catch(Exception e) - { - MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + transferAddress = transferAddress.add(length); + + jobCount = jobCount.add(BigInteger.ONE); + if(jobCount.compareTo(factor) == 0) + { + jobCount = BigInteger.ZERO; + monitor.worked(1); + } } - } - catch(Exception e) - { + + writer.close(); + monitor.done(); + } catch (IOException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to file.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to file.", ex); + + } catch (DebugException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from target.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from target.", ex); + } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure exporting memory", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.INTERNAL_ERROR, "Failure exporting memory", ex); } return Status.OK_STATUS; }}; diff --git a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java index 550db13bb47..41c62197835 100644 --- a/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java +++ b/memory/org.eclipse.cdt.debug.ui.memory.transport/src/org/eclipse/cdt/debug/ui/memory/transport/SRecordImporter.java @@ -14,6 +14,7 @@ package org.eclipse.cdt.debug.ui.memory.transport; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Properties; @@ -301,126 +302,151 @@ public class SRecordImporter implements IMemoryImporter { public IStatus run(IProgressMonitor monitor) { try - { - try - { - BufferedMemoryWriter memoryWriter = new BufferedMemoryWriter((IMemoryBlockExtension) fMemoryBlock, BUFFER_LENGTH); - - // FIXME 4 byte default - - final int CHECKSUM_LENGTH = 1; + { + BufferedMemoryWriter memoryWriter = new BufferedMemoryWriter((IMemoryBlockExtension) fMemoryBlock, BUFFER_LENGTH); + + // FIXME 4 byte default + + final int CHECKSUM_LENGTH = 1; + + BigInteger scrollToAddress = null; + + BigInteger offset = null; + if(!fProperties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, "false").equals("true")) + offset = BigInteger.ZERO; + + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile))); + + BigInteger jobs = BigInteger.valueOf(fInputFile.length()); + BigInteger factor = BigInteger.ONE; + if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) + { + factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); + jobs = jobs.divide(factor); + } - BigInteger scrollToAddress = null; + monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ + + String line = reader.readLine(); + int lineNo = 1; // line error reporting + while(line != null && !monitor.isCanceled()) + { + String recordType = line.substring(0, 2); + int recordCount = 0; + try { + recordCount = Integer.parseInt(line.substring(2, 4), 16); + } catch (NumberFormatException ex) { + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, String.format("Invalid file format. Invalid line length at line %d", lineNo ), ex); + } + + int bytesRead = 4 + recordCount; + int position = 4; + int addressSize = 0; - BigInteger offset = null; - if(!fProperties.getProperty(TRANSFER_CUSTOM_START_ADDRESS, "false").equals("true")) - offset = BigInteger.ZERO; + BigInteger recordAddress = null; + + if("S3".equals(recordType)) //$NON-NLS-1$ + addressSize = 4; + else if("S1".equals(recordType)) //$NON-NLS-1$ + addressSize = 2; + else if("S2".equals(recordType)) //$NON-NLS-1$ + addressSize = 3; + + try { + recordAddress = new BigInteger(line.substring(position, position + addressSize * 2), 16); + } catch (NumberFormatException ex) { + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, String.format("Invalid file format. Invalid address at line %d", lineNo ), ex); + } + recordCount -= addressSize; + position += addressSize * 2; - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(fInputFile))); + if(offset == null) + offset = fStartAddress.subtract(recordAddress); - BigInteger jobs = BigInteger.valueOf(fInputFile.length()); - BigInteger factor = BigInteger.ONE; - if(jobs.compareTo(BigInteger.valueOf(0x7FFFFFFF)) > 0) - { - factor = jobs.divide(BigInteger.valueOf(0x7FFFFFFF)); - jobs = jobs.divide(factor); - } - - monitor.beginTask("Transferring Data", jobs.intValue()); //$NON-NLS-1$ + recordAddress = recordAddress.add(offset); - BigInteger jobCount = BigInteger.ZERO; - String line = reader.readLine(); - while(line != null && !monitor.isCanceled()) + byte data[] = new byte[recordCount - CHECKSUM_LENGTH]; + for(int i = 0; i < data.length; i++) { - String recordType = line.substring(0, 2); - int recordCount = Integer.parseInt(line.substring(2, 4), 16); - int bytesRead = 4 + recordCount; - int position = 4; - int addressSize = 0; - - BigInteger recordAddress = null; - - if("S3".equals(recordType)) //$NON-NLS-1$ - addressSize = 4; - else if("S1".equals(recordType)) //$NON-NLS-1$ - addressSize = 2; - else if("S2".equals(recordType)) //$NON-NLS-1$ - addressSize = 3; - - recordAddress = new BigInteger(line.substring(position, position + addressSize * 2), 16); - recordCount -= addressSize; - position += addressSize * 2; - - if(offset == null) - offset = fStartAddress.subtract(recordAddress); - - recordAddress = recordAddress.add(offset); - - byte data[] = new byte[recordCount - CHECKSUM_LENGTH]; - for(int i = 0; i < data.length; i++) - { + try { data[i] = new BigInteger(line.substring(position++, position++ + 1), 16).byteValue(); + } catch (NumberFormatException ex) { + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, String.format("Invalid file format. Invalid data at line %d", lineNo ), ex); } + } - /* - * The least significant byte of the one's complement of the sum of the values - * represented by the pairs of characters making up the records length, address, - * and the code/data fields. - */ - StringBuffer buf = new StringBuffer(line.substring(2)); - byte checksum = 0; - - for(int i = 0; i < buf.length(); i+=2) - { - BigInteger value = new BigInteger(buf.substring(i, i+2), 16); - checksum += value.byteValue(); - } - - /* - * Since we included the checksum in the checksum calculation the checksum - * ( if correct ) will always be 0xFF which is -1 using the signed byte size - * calculation here. - */ - if ( checksum != (byte) -1 ) { - reader.close(); - monitor.done(); - return new Status( IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), "Checksum failure of line = " + line); //$NON-NLS-1$ - } - - if(scrollToAddress == null) - scrollToAddress = recordAddress; - - // FIXME error on incorrect checksum - - memoryWriter.write(recordAddress.subtract(((IMemoryBlockExtension) fMemoryBlock).getBigBaseAddress()), data); - - jobCount = jobCount.add(BigInteger.valueOf(bytesRead)); - while(jobCount.compareTo(factor) >= 0) - { - jobCount = jobCount.subtract(factor); - monitor.worked(1); + /* + * The least significant byte of the one's complement of the sum of the values + * represented by the pairs of characters making up the records length, address, + * and the code/data fields. + */ + StringBuffer buf = new StringBuffer(line.substring(2)); + byte checksum = 0; + + for(int i = 0; i < buf.length(); i+=2) + { + BigInteger value = null; + try { + value = new BigInteger(buf.substring(i, i+2), 16); + } catch (NumberFormatException ex) { + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, String.format("Invalid file format. Invalid checksum format at line %d", lineNo ), ex); } - - line = reader.readLine(); - } + checksum += value.byteValue(); + } - memoryWriter.flush(); - reader.close(); - monitor.done(); + /* + * Since we included the checksum in the checksum calculation the checksum + * ( if correct ) will always be 0xFF which is -1 using the signed byte size + * calculation here. + */ + if ( checksum != (byte) -1 ) { + reader.close(); + monitor.done(); + return new Status( IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), "Checksum failure of line = " + line); //$NON-NLS-1$ + } - if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) - fParentDialog.scrollRenderings(scrollToAddress); - } - catch(Exception e) - { - MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + if(scrollToAddress == null) + scrollToAddress = recordAddress; + + // FIXME error on incorrect checksum + + memoryWriter.write(recordAddress.subtract(((IMemoryBlockExtension) fMemoryBlock).getBigBaseAddress()), data); + + BigInteger jobCount = BigInteger.valueOf(bytesRead).divide(factor); + monitor.worked(jobCount.intValue()); + + line = reader.readLine(); + lineNo++; } - } - catch(Exception e) - { + + if (!monitor.isCanceled()) + memoryWriter.flush(); + + reader.close(); + monitor.done(); + + if(fProperties.getProperty(TRANSFER_SCROLL_TO_START, "false").equals("true")) + fParentDialog.scrollRenderings(scrollToAddress); + } catch (IOException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from file.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not read from file.", ex); + + } catch (DebugException ex) { + MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to target.", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.REQUEST_FAILED, "Could not write to target.", ex); + } catch (Exception ex) { MemoryTransportPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), - DebugException.INTERNAL_ERROR, "Failure", e)); + DebugException.INTERNAL_ERROR, "Failure importing from file", ex)); + return new Status(IStatus.ERROR, MemoryTransportPlugin.getUniqueIdentifier(), + DebugException.INTERNAL_ERROR, "Failure importing from file", ex); } return Status.OK_STATUS; }}; |