1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-10-16 22:27:59 +03:00

Removed some printStackTrace in favour of throwing RuntimeExceptions. DefaultUncoughtExceptionHandler will handle them

This commit is contained in:
Federico Fissore
2015-02-23 13:33:17 +01:00
parent fe6718ce4f
commit 6007403834
9 changed files with 70 additions and 85 deletions

View File

@@ -166,8 +166,7 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
return getUpdatedCellComponent(value, true, row);
}
private Component getUpdatedCellComponent(Object value, boolean isSelected,
int row) {
private Component getUpdatedCellComponent(Object value, boolean isSelected, int row) {
ContributedLibraryReleases releases = (ContributedLibraryReleases) value;
ContributedLibrary selectedLib = releases.getSelected();
ContributedLibrary installedLib = releases.getInstalled();
@@ -245,26 +244,25 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
description.setText(desc);
description.setBackground(Color.WHITE);
// for modelToView to work, the text area has to be sized. It doesn't
// matter if it's visible or not.
// See:
// http://stackoverflow.com/questions/3081210/how-to-set-jtextarea-to-have-height-that-matches-the-size-of-a-text-it-contains
int width = parentTable.getBounds().width;
width -= installButtonPlaceholder.getPreferredSize().width;
width -= removeButtonPlaceholder.getPreferredSize().width;
Dimension minimalSize = new Dimension(width, 10);
description.setPreferredSize(minimalSize);
description.setSize(minimalSize);
try {
// for modelToView to work, the text area has to be sized. It doesn't
// matter if it's visible or not.
// See:
// http://stackoverflow.com/questions/3081210/how-to-set-jtextarea-to-have-height-that-matches-the-size-of-a-text-it-contains
int width = parentTable.getBounds().width;
width -= installButtonPlaceholder.getPreferredSize().width;
width -= removeButtonPlaceholder.getPreferredSize().width;
Dimension minimalSize = new Dimension(width, 10);
description.setPreferredSize(minimalSize);
description.setSize(minimalSize);
Rectangle r = description.modelToView(description.getDocument()
.getLength());
Rectangle r = description.modelToView(description.getDocument().getLength());
r.height += description.modelToView(0).y; // add margins
Dimension d = new Dimension(minimalSize.width, r.y + r.height);
description.setPreferredSize(d);
} catch (BadLocationException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
if (isSelected) {

View File

@@ -137,8 +137,7 @@ public class LibraryManagerUI extends InstallerJDialog {
installer.updateIndex();
onIndexesUpdated();
} catch (Exception e) {
// TODO Show ERROR
e.printStackTrace();
throw new RuntimeException(e);
} finally {
setProgressVisible(false);
}
@@ -156,8 +155,7 @@ public class LibraryManagerUI extends InstallerJDialog {
installer.install(lib);
getContribModel().updateLibrary(lib);
} catch (Exception e) {
// TODO Show ERROR
e.printStackTrace();
throw new RuntimeException(e);
} finally {
setProgressVisible(false);
}
@@ -175,8 +173,7 @@ public class LibraryManagerUI extends InstallerJDialog {
installer.remove(lib);
getContribModel().updateLibrary(lib);
} catch (Exception e) {
// TODO Show ERROR
e.printStackTrace();
throw new RuntimeException(e);
} finally {
setProgressVisible(false);
}

View File

@@ -136,8 +136,7 @@ public class ContributionManagerUI extends InstallerJDialog {
installer.updateIndex();
onIndexesUpdated();
} catch (Exception e) {
// TODO Show ERROR
e.printStackTrace();
throw new RuntimeException(e);
} finally {
setProgressVisible(false);
}
@@ -157,8 +156,7 @@ public class ContributionManagerUI extends InstallerJDialog {
installer.remove(platformToRemove);
}
} catch (Exception e) {
// TODO Show ERROR
e.printStackTrace();
throw new RuntimeException(e);
} finally {
setProgressVisible(false);
}
@@ -175,8 +173,7 @@ public class ContributionManagerUI extends InstallerJDialog {
setProgressVisible(true);
installer.remove(platform);
} catch (Exception e) {
// TODO Show ERROR
e.printStackTrace();
throw new RuntimeException(e);
} finally {
setProgressVisible(false);
}

View File

@@ -64,7 +64,7 @@ public class AStyle implements Tool {
try {
formatterConfiguration = FileUtils.readFileToString(formatterConf);
} catch (IOException e) {
// noop
// ignored
}
this.formatterConfiguration = formatterConfiguration;
}