Heartstopper Commit

Enabled every catch block in the project to log parsed exceptions.
This commit is contained in:
ronancpl
2017-04-02 21:38:07 -03:00
parent 3990a08202
commit 5f01d3b7fd
88 changed files with 13325 additions and 40964 deletions

View File

@@ -73,12 +73,14 @@ public class CreateINI {
out = new FileOutputStream("moople.ini", false);
out.write(sb.toString().getBytes());
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
@@ -113,12 +115,14 @@ public class CreateINI {
}
out.write(sb.toString().getBytes());
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
System.out.println("\r\nMake sure that ServerConstants in modified too, and clean+compiled before you start the server.");

View File

@@ -130,6 +130,7 @@ public class Server implements Runnable {
try {
p.load(new FileInputStream("world.ini"));
} catch (Exception e) {
e.printStackTrace();
System.out.println("Please start create_server.bat");
System.exit(0);
}
@@ -200,8 +201,8 @@ public class Server implements Runnable {
System.out.println("Finished loading world " + i + "\r\n");
}
} catch (Exception e) {
System.out.println("Error in moople.ini, start CreateINI.bat to re-make the file.");
e.printStackTrace();//For those who get errors
System.out.println("Error in moople.ini, start CreateINI.bat to re-make the file.");
System.exit(0);
}
@@ -574,6 +575,7 @@ public class Server implements Runnable {
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
ie.printStackTrace();
System.err.println("FUCK MY LIFE");
}
}

View File

@@ -124,6 +124,7 @@ public final class Channel {
finishedShutdown = true;
System.out.println("Successfully shut down Channel " + channel + " on World " + world + "\r\n");
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error while shutting down Channel " + channel + " on World " + world + "\r\n" + e);
}
}
@@ -138,9 +139,9 @@ public final class Channel {
hmit.remove();
}
} catch (Exception e) {
e.printStackTrace();
e.printStackTrace();
} finally {
wlock.unlock();
wlock.unlock();
}
}

View File

@@ -154,6 +154,7 @@ public class BuddylistModifyHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.serverNotice(1, "A character called \"" + addName + "\" does not exist"));
}
} catch (SQLException e) {
e.printStackTrace();
}
} else {
ble.changeGroup(group);
@@ -185,6 +186,7 @@ public class BuddylistModifyHandler extends AbstractMaplePacketHandler {
notifyRemoteChannel(c, channel, otherCid, ADDED);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
nextPendingRequest(c);

View File

@@ -238,6 +238,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
try {
chr.sendNote(partner.getName(), text, (byte) 1);
} catch (SQLException ex) {
ex.printStackTrace();
}
partner.showNote();
}

View File

@@ -59,6 +59,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
switch (type) {
@@ -98,6 +99,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
return item;
}
@@ -113,6 +115,7 @@ public final class CouponCodeHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
return validcode;
}

View File

@@ -117,6 +117,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
c.announce(MaplePacketCreator.sendMTS(items, 1, 0, 0, pages));
c.announce(MaplePacketCreator.transferInventory(getTransfer(chr.getId())));
@@ -163,6 +164,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return items;
}
@@ -208,6 +210,7 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return items;
}

View File

@@ -115,6 +115,7 @@ public class FredrickHandler extends AbstractMaplePacketHandler {
}
return true;
} catch (SQLException e) {
e.printStackTrace();
return false;
}

View File

@@ -47,6 +47,7 @@ public final class HiredMerchantRequest extends AbstractMaplePacketHandler {
chr.announce(MaplePacketCreator.retrieveFirstMessage());
}
} catch (SQLException ex) {
ex.printStackTrace();
}
} else {
chr.dropMessage(1, "You already have a store open.");

View File

@@ -202,6 +202,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
ps.close();
MapleInventoryManipulator.removeFromSlot(c, type, slot, quantity, false);
} catch (SQLException e) {
e.printStackTrace();
}
c.getPlayer().gainMeso(-5000, false);
c.announce(MaplePacketCreator.MTSConfirmSell());
@@ -329,6 +330,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println("MTS Transfer error: " + e);
}
} else if (op == 9) { //add to cart
@@ -441,6 +443,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
c.announce(MaplePacketCreator.MTSFailBuy());
}
} else if (op == 17) { //buy from cart
@@ -498,6 +501,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
c.announce(MaplePacketCreator.MTSFailBuy());
}
} else {
@@ -551,6 +555,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return items;
}
@@ -616,6 +621,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return MaplePacketCreator.sendMTS(items, 4, 0, 0, pages);
}
@@ -663,6 +669,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return items;
}
@@ -735,6 +742,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
return MaplePacketCreator.sendMTS(items, tab, type, page, pages); // resniff
}
@@ -828,6 +836,7 @@ public final class MTSHandler extends AbstractMaplePacketHandler {
ps.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
return MaplePacketCreator.sendMTS(items, tab, type, page, pages);
}

View File

@@ -126,6 +126,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
pss.executeUpdate();
pss.close();
} catch (SQLException e) {
e.printStackTrace();
}
c.announce(MaplePacketCreator.sendDueyMSG((byte) 0x1B));
}

View File

@@ -84,6 +84,7 @@ public final class RingActionHandler extends AbstractMaplePacketHandler {
ps.executeUpdate();
ps.close();
} catch (Exception ex) {
ex.printStackTrace();
}
c.getPlayer().dropMessage(1, "Your engagement has been broken up.");
break;

View File

@@ -47,6 +47,7 @@ public final class SpouseChatHandler extends AbstractMaplePacketHandler {
// } else
// c.getPlayer().message("You are either not married or your spouse is currently offline.");
// } catch (Exception e) {
// e.printStackTrace();
// c.getPlayer().message("You are either not married or your spouse is currently offline.");
// c.getChannelServer().reconnectWorld();
// }

View File

@@ -357,6 +357,7 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler {
try {
player.sendNote(sendTo, msg, (byte) 0);
} catch (SQLException e) {
e.printStackTrace();
}
remove(c, itemId);
} else if (itemType == 510) {

View File

@@ -79,6 +79,7 @@ public class MapleAlliance {
ps.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
return alliance;
}
@@ -107,6 +108,7 @@ public class MapleAlliance {
ps.executeQuery();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
@@ -146,6 +148,7 @@ public class MapleAlliance {
ps.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
return ret;
}

View File

@@ -103,6 +103,7 @@ public class MapleGuild {
ps.close();
rs.close();
} catch (SQLException se) {
se.printStackTrace();
System.out.println("unable to read guild information from sql" + se);
}
}
@@ -171,6 +172,7 @@ public class MapleGuild {
this.broadcast(MaplePacketCreator.guildDisband(this.id));
}
} catch (SQLException se) {
se.printStackTrace();
}
}
@@ -267,6 +269,7 @@ public class MapleGuild {
}
}
} catch (Exception re) {
re.printStackTrace();
System.out.println("Failed to contact channel(s) for broadcast.");//fu?
}
}
@@ -337,6 +340,7 @@ public class MapleGuild {
ps.close();
return guildid;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
@@ -389,6 +393,7 @@ public class MapleGuild {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
System.out.println("expelMember - MapleGuild " + e);
}
Server.getInstance().getWorld(mgc.getWorld()).setOfflineGuildStatus((short) 0, (byte) 5, cid);
@@ -531,6 +536,7 @@ public class MapleGuild {
}
rs.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println("failed to display guild ranks. " + e);
}
}
@@ -548,6 +554,7 @@ public class MapleGuild {
ps.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
}
}

View File

@@ -49,6 +49,7 @@ public final class CharSelectedHandler extends AbstractMaplePacketHandler {
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException | NumberFormatException e) {
e.printStackTrace();
}
}
}

View File

@@ -35,6 +35,7 @@ public class CharSelectedWithPicHandler extends AbstractMaplePacketHandler {
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException | NumberFormatException e) {
e.printStackTrace();
}
} else {
c.announce(MaplePacketCreator.wrongPic());

View File

@@ -46,6 +46,7 @@ public final class PickCharHandler extends AbstractMaplePacketHandler {
try {
c.setChannel(Randomizer.nextInt(Server.getInstance().getWorld(world).getChannels().size()));
} catch (Exception e) {
e.printStackTrace();
c.setChannel(1);
}
if (c.getIdleTask() != null) {
@@ -56,6 +57,7 @@ public final class PickCharHandler extends AbstractMaplePacketHandler {
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}

View File

@@ -37,6 +37,7 @@ public final class RegisterPicHandler extends AbstractMaplePacketHandler {
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException e) {
e.printStackTrace();
}
} else {
c.getSession().close(true);

View File

@@ -38,6 +38,7 @@ public class ViewAllCharSelectedWithPicHandler extends AbstractMaplePacketHandle
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException e) {
e.printStackTrace();
}
} else {

View File

@@ -36,6 +36,7 @@ public final class ViewAllPicRegisterHandler extends AbstractMaplePacketHandler
try {
c.announce(MaplePacketCreator.getServerIP(InetAddress.getByName(socket[0]), Integer.parseInt(socket[1]), charId));
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
}

View File

@@ -76,6 +76,7 @@ public final class ViewCharHandler extends AbstractMaplePacketHandler {
c.announce(MaplePacketCreator.showAllCharacterInfo(w, chrsinworld));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}