Skip to content

Commit de01ef6

Browse files
committed
bug fixes
1 parent 507f08d commit de01ef6

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/Library/DlgAddBooks.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,15 @@ private ImageIcon CreateStretchImageIcon(String imgPath, int width,
212212
try {
213213
img = ImageIO.read(new File(imgPath));
214214
} catch (IOException e) {
215-
e.printStackTrace();
215+
//e.printStackTrace();
216+
System.out.print("cannot read file");
217+
return null;
216218
}
217219

218220
Image scaledImg = img.getScaledInstance(width, height,
219221
java.awt.Image.SCALE_SMOOTH);
220222
ImageIcon imageIcon = new ImageIcon(scaledImg);
223+
221224
return imageIcon;
222225
}
223226

src/Library/FrmBooksManagement.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public FrmBooksManagement(Library lib) {
127127

128128
tStatus.setVisible(true);
129129
tStatus.setBounds(750, 100, 200, 25);
130+
tStatus.setEnabled(false);
130131
this.add(tStatus);
131132

132133
lISBN = new JLabel();

src/Library/Library.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public boolean copyBookImage(String srcImgPath, String srcImgFileName, String ne
116116
try {
117117
fi = new FileInputStream(srcPath);
118118
} catch (FileNotFoundException e) {
119-
e.printStackTrace();
119+
//e.printStackTrace();
120120
return false;
121121
}
122122
BufferedInputStream in = new BufferedInputStream(fi);
@@ -294,9 +294,11 @@ ArrayList<Book> showBookList_overdue(){
294294
while(bookItr.hasNext()){
295295
Book tempBook = bookItr.next();
296296
if(tempBook.isRented()==true){
297-
297+
if(tempBook.getLastRented() == null)
298+
continue;
298299
if(new Date().getTime() - tempBook.getLastRented().getTime() >= OverdueTimeLimit)
299-
tempBookList.add(tempBook);
300+
tempBookList.add(tempBook);
301+
300302

301303

302304
}//end if

0 commit comments

Comments
 (0)