Bug 699 - When you move a piece to its own location, it throws an exception
Summary: When you move a piece to its own location, it throws an exception
Status: RESOLVED FIXED
Alias: None
Product: Chess Game - Group 24
Classification: Unclassified
Component: Chess (show other bugs)
Version: unspecified
Hardware: All All
: Normal normal
Assignee: Assan Kozhin
URL: https://github.com/glennsalter/cs3343...
Depends on:
Blocks:
 
Reported: 2022-11-06 13:23 HKT by sskawle2-c
Modified: 2022-11-28 02:21 HKT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sskawle2-c 2022-11-06 13:23:27 HKT
Steps to Reproduce:
1.	Execute App.java
2.	Move a piece to its current location

Expected Results: 
The move is illegal, and ignored.

Actual Result :
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
	at chess.chess.Move.setKilledPiece(Move.java:21)
Comment 1 Assan Kozhin 2022-11-19 16:41:33 HKT
The bug was related to the fact that when we release the mouse, the piece tries to move to the same location it is currently at. It tries to it itself and it raises Exception. Solved by checking current and next point of the move `public boolean makeMove(Point start, Point end)` in Game.java.