From acbd9daf077588e923093ddf4a89ded423c7c93f Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Sun, 20 Jan 2013 10:26:46 -0800 Subject: [PATCH 1/2] clean up and add .gitignore --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 2 ++ VersionChecker/.DS_Store | Bin 6148 -> 0 bytes 3 files changed, 2 insertions(+) delete mode 100644 .DS_Store create mode 100644 .gitignore delete mode 100644 VersionChecker/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 4e47e720adf22e10a7ae7f3c4cfe738e068cf527..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&1%~~5T13MR3bn4639{XltTz{!H_}@isOXlP$+R|4ozsKDAXc~Hdu0faNLSM zL*Jt>(sN(O{bqMvYTV{%LYaZtZ!|lzBYi9Ohlo^rkTi)JMC3skYd)I42=}wjNzHlc zKxM{wO~iVX1F`E-VPJERW%F@O3x&UB1k{xwdZ+Y=+Oh&Jdg-B6zj zN=Z{rN7TdfHQloJG@Hr&!MV`dWWuSB=f=b0-qrmc-)Cu2?(O|lwWa#<$}`XRy|v4W zG*9%ftp|BhyzBP#u$v|~an!#ub{Um}q8;^3&zq?1p~u+gT4%5?UGznol)d+jt)%z#^lywwHQm2$#>F!1yl;PoMZGKLN-i)QISW3B)|K1LdW z%?C!#2^@wFD~srXD4Pnjsmfh3lud^}aB-o-%A!ptWh!GFS6R6miZa#V4@@|z(4w@$ zfG{x2z>t=6XhqBYy}r_JVbwwo_!GuLrk@7h^i-+Fb>4KHU`pG!4N68IIB zJT>?WzQ8b(IPZ+IRAy)JaI^;k#-Jdjn6_w0Ba$flzyjVr1Yp3e5p~VlTcqqKjzDVFR~C}o*u&I8tQ=p zTUZ7x0~H49y6*A$zjy!pzmjFEmI2Ga|HOc3>~?nBn2|YK@63(QS|9oW%EED_#@iGa i>L^AmAH{1>CGh)f00V=iMtC6hBA{rng=OHcGVl}ERf Date: Sun, 20 Jan 2013 10:28:48 -0800 Subject: [PATCH 2/2] Fix null pointer exception when no component is selected --- .../src/versionchecker/actions/VCArtifactTable.java | 8 ++++++-- .../src/versionchecker/actions/VCMainWindow.java | 11 +++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/VersionChecker/src/versionchecker/actions/VCArtifactTable.java b/VersionChecker/src/versionchecker/actions/VCArtifactTable.java index ad3ae73..a7b0782 100644 --- a/VersionChecker/src/versionchecker/actions/VCArtifactTable.java +++ b/VersionChecker/src/versionchecker/actions/VCArtifactTable.java @@ -84,11 +84,15 @@ public void mouseClicked(MouseEvent e) { } public String getSelectedID() { - return this.selectedAF.getId(); + if (this.selectedAF != null) + return this.selectedAF.getId(); + return null; } public String getSelectedVer() { - return this.selectedAF.getVersion(); + if (this.selectedAF != null) + return this.selectedAF.getVersion(); + return null; } private void addEntry(VCArtifact toAdd) { diff --git a/VersionChecker/src/versionchecker/actions/VCMainWindow.java b/VersionChecker/src/versionchecker/actions/VCMainWindow.java index d660cd9..cce5bdc 100644 --- a/VersionChecker/src/versionchecker/actions/VCMainWindow.java +++ b/VersionChecker/src/versionchecker/actions/VCMainWindow.java @@ -11,6 +11,7 @@ import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; @@ -120,7 +121,10 @@ public void actionPerformed(ActionEvent event) { fetchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { String id = tablePanel.getSelectedID(); - VCCloneTask task = new VCCloneTask(id,null); + if (id != null) + new VCCloneTask(id,null); + else + JOptionPane.showMessageDialog(null, "No component is selected.", "VersionChecker", 1);; } }); @@ -128,7 +132,10 @@ public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) { String id = tablePanel.getSelectedID(); String ver = tablePanel.getSelectedVer(); - VCCloneTask task = new VCCloneTask(id,ver); + if (id != null) + new VCCloneTask(id,ver); + else + JOptionPane.showMessageDialog(null, "No component is selected.", "VersionChecker", 1);; } });