	/**
	 * Saves all Seven Signs player data.<br>
	 * Should be called on period change and shutdown only.
	 */
	public void saveSevenSignsData()
	{
		if (Config.DEBUG)
			_log.info("SevenSigns: Saving data to disk.");

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement(UPDATE_PLAYER))
			{
				for (StatsSet sevenDat : _signsPlayerData.values())
				{
					ps.setString(1, sevenDat.getString("cabal"));
					ps.setInt(2, sevenDat.getInteger("seal"));
					ps.setInt(3, sevenDat.getInteger("red_stones"));
					ps.setInt(4, sevenDat.getInteger("green_stones"));
					ps.setInt(5, sevenDat.getInteger("blue_stones"));
					ps.setDouble(6, sevenDat.getDouble("ancient_adena_amount"));
					ps.setDouble(7, sevenDat.getDouble("contribution_score"));
					ps.setInt(8, sevenDat.getInteger("charId"));
					ps.execute();
					ps.clearParameters();
					if (Config.DEBUG)
					{
						_log.info("SevenSigns: Updated data in database for char ID " + sevenDat.getInteger("charId") + " (" + sevenDat.getString("cabal") + ")");
					}
				}
			}
		}
		catch (SQLException e)
		{
			_log.log(Level.SEVERE, "SevenSigns: Unable to save data to database: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	/**
	 * Saves all Seven Signs player data.<br>
	 * Should be called on period change and shutdown only.
	 */
	public void saveSevenSignsData()
	{
		if (Config.DEBUG)
			_log.info("SevenSigns: Saving data to disk.");

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement(UPDATE_PLAYER);

			for (StatsSet sevenDat : _signsPlayerData.values())
			{
				statement.setString(1, sevenDat.getString("cabal"));
				statement.setInt(2, sevenDat.getInteger("seal"));
				statement.setInt(3, sevenDat.getInteger("red_stones"));
				statement.setInt(4, sevenDat.getInteger("green_stones"));
				statement.setInt(5, sevenDat.getInteger("blue_stones"));
				statement.setDouble(6, sevenDat.getDouble("ancient_adena_amount"));
				statement.setDouble(7, sevenDat.getDouble("contribution_score"));
				statement.setInt(8, sevenDat.getInteger("charId"));
				statement.execute();
				statement.clearParameters();
				if (Config.DEBUG)
					_log.info("SevenSigns: Updated data in database for char ID " + sevenDat.getInteger("charId") + " (" + sevenDat.getString("cabal") + ")");
			}
			statement.close();
		}
		catch (SQLException e)
		{
			_log.log(Level.SEVERE, "SevenSigns: Unable to save data to database: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement(UPDATE_PLAYER)) in method public saveSevenSignsData() : void from class com.l2jserver.gameserver.SevenSigns


	public final void saveSevenSignsStatus()
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement(UPDATE_STATUS))
			{
				ps.setInt(1, _currentCycle);
				ps.setInt(2, _activePeriod);
				ps.setInt(3, _previousWinner);
				ps.setDouble(4, _dawnStoneScore);
				ps.setInt(5, _dawnFestivalScore);
				ps.setDouble(6, _duskStoneScore);
				ps.setInt(7, _duskFestivalScore);
				ps.setInt(8, _signsSealOwners.get(SEAL_AVARICE));
				ps.setInt(9, _signsSealOwners.get(SEAL_GNOSIS));
				ps.setInt(10, _signsSealOwners.get(SEAL_STRIFE));
				ps.setInt(11, _signsDawnSealTotals.get(SEAL_AVARICE));
				ps.setInt(12, _signsDawnSealTotals.get(SEAL_GNOSIS));
				ps.setInt(13, _signsDawnSealTotals.get(SEAL_STRIFE));
				ps.setInt(14, _signsDuskSealTotals.get(SEAL_AVARICE));
				ps.setInt(15, _signsDuskSealTotals.get(SEAL_GNOSIS));
				ps.setInt(16, _signsDuskSealTotals.get(SEAL_STRIFE));
				ps.setInt(17, SevenSignsFestival.getInstance().getCurrentFestivalCycle());

				for (int i = 0; i < SevenSignsFestival.FESTIVAL_COUNT; i++)
				{
					ps.setInt(18 + i, SevenSignsFestival.getInstance().getAccumulatedBonus(i));
				}
				_lastSave = Calendar.getInstance();
				ps.setLong(18 + SevenSignsFestival.FESTIVAL_COUNT, _lastSave.getTimeInMillis());
				ps.execute();
			}
			if (Config.DEBUG)
				_log.info("SevenSigns: Updated data in database.");
		}
		catch (SQLException e)
		{
			_log.log(Level.SEVERE, "SevenSigns: Unable to save data to database: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	public final void saveSevenSignsStatus()
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();

			PreparedStatement statement = con.prepareStatement(UPDATE_STATUS);
			statement.setInt(1, _currentCycle);
			statement.setInt(2, _activePeriod);
			statement.setInt(3, _previousWinner);
			statement.setDouble(4, _dawnStoneScore);
			statement.setInt(5, _dawnFestivalScore);
			statement.setDouble(6, _duskStoneScore);
			statement.setInt(7, _duskFestivalScore);
			statement.setInt(8, _signsSealOwners.get(SEAL_AVARICE));
			statement.setInt(9, _signsSealOwners.get(SEAL_GNOSIS));
			statement.setInt(10, _signsSealOwners.get(SEAL_STRIFE));
			statement.setInt(11, _signsDawnSealTotals.get(SEAL_AVARICE));
			statement.setInt(12, _signsDawnSealTotals.get(SEAL_GNOSIS));
			statement.setInt(13, _signsDawnSealTotals.get(SEAL_STRIFE));
			statement.setInt(14, _signsDuskSealTotals.get(SEAL_AVARICE));
			statement.setInt(15, _signsDuskSealTotals.get(SEAL_GNOSIS));
			statement.setInt(16, _signsDuskSealTotals.get(SEAL_STRIFE));
			statement.setInt(17, SevenSignsFestival.getInstance().getCurrentFestivalCycle());

			for (int i = 0; i < SevenSignsFestival.FESTIVAL_COUNT; i++)
				statement.setInt(18 + i, SevenSignsFestival.getInstance().getAccumulatedBonus(i));

			_lastSave = Calendar.getInstance();
			statement.setLong(18 + SevenSignsFestival.FESTIVAL_COUNT, _lastSave.getTimeInMillis());
			statement.execute();
			statement.close();
			if (Config.DEBUG)
				_log.info("SevenSigns: Updated data in database.");
		}
		catch (SQLException e)
		{
			_log.log(Level.SEVERE, "SevenSigns: Unable to save data to database: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement(UPDATE_STATUS)) in method public saveSevenSignsStatus() : void from class com.l2jserver.gameserver.SevenSigns


	/**
	 * Stores current festival data, basic settings to the properties file
	 * and past high score data to the database.
	 *
	 * If updateSettings = true, then all Seven Signs data is updated in the database.
	 *
	 * @param updateSettings
	 */
	public void saveFestivalData(boolean updateSettings)
	{
		Connection con = null;

		if (Config.DEBUG)
			_log.info("SevenSignsFestival: Saving festival data to disk.");

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement psUpdate = con.prepareStatement("UPDATE seven_signs_festival SET date=?, score=?, members=? WHERE cycle=? AND cabal=? AND festivalId=?");
				PreparedStatement psInsert = con.prepareStatement("INSERT INTO seven_signs_festival (festivalId, cabal, cycle, date, score, members) VALUES (?,?,?,?,?,?)"))
			{
				for (Map<Integer, StatsSet> currCycleData : _festivalData.values())
				{
					for (StatsSet festivalDat : currCycleData.values())
					{
						int festivalCycle = festivalDat.getInteger("cycle");
						int festivalId = festivalDat.getInteger("festivalId");
						String cabal = festivalDat.getString("cabal");

						// Try to update an existing record.
						psUpdate.setLong(1, Long.valueOf(festivalDat.getString("date")));
						psUpdate.setInt(2, festivalDat.getInteger("score"));
						psUpdate.setString(3, festivalDat.getString("members"));
						psUpdate.setInt(4, festivalCycle);
						psUpdate.setString(5, cabal);
						psUpdate.setInt(6, festivalId);

						// If there was no record to update, assume it doesn't exist and add a new one,
						// otherwise continue with the next record to store.
						if (psUpdate.executeUpdate() > 0)
						{
							if (Config.DEBUG)
								_log.info("SevenSignsFestival: Updated data in DB (Cycle = " + festivalCycle + ", Cabal = " + cabal + ", FestID = " + festivalId + ")");
							continue;
						}

						psInsert.setInt(1, festivalId);
						psInsert.setString(2, cabal);
						psInsert.setInt(3, festivalCycle);
						psInsert.setLong(4, Long.valueOf(festivalDat.getString("date")));
						psInsert.setInt(5, festivalDat.getInteger("score"));
						psInsert.setString(6, festivalDat.getString("members"));
						psInsert.execute();
						psInsert.clearParameters();

						if (Config.DEBUG)
							_log.info("SevenSignsFestival: Inserted data in DB (Cycle = " + festivalCycle + ", Cabal = " + cabal + ", FestID = " + festivalId + ")");
					}
				}
			}

			// Updates Seven Signs DB data also, so call only if really necessary.
			if (updateSettings)
				SevenSigns.getInstance().saveSevenSignsStatus();
		}
		catch (SQLException e)
		{
			_log.log(Level.SEVERE, "SevenSignsFestival: Failed to save configuration: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	/**
	 * Stores current festival data, basic settings to the properties file
	 * and past high score data to the database.
	 *
	 * If updateSettings = true, then all Seven Signs data is updated in the database.
	 *
	 * @param updateSettings
	 */
	public void saveFestivalData(boolean updateSettings)
	{
		Connection con = null;

		if (Config.DEBUG)
			_log.info("SevenSignsFestival: Saving festival data to disk.");

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statementUpdate = con.prepareStatement("UPDATE seven_signs_festival SET date=?, score=?, members=? WHERE cycle=? AND cabal=? AND festivalId=?");
			PreparedStatement statementInsert = con.prepareStatement("INSERT INTO seven_signs_festival (festivalId, cabal, cycle, date, score, members) VALUES (?,?,?,?,?,?)");
			for (Map<Integer, StatsSet> currCycleData : _festivalData.values())
			{
				for (StatsSet festivalDat : currCycleData.values())
				{
					int festivalCycle = festivalDat.getInteger("cycle");
					int festivalId = festivalDat.getInteger("festivalId");
					String cabal = festivalDat.getString("cabal");

					// Try to update an existing record.
					statementUpdate.setLong(1, Long.valueOf(festivalDat.getString("date")));
					statementUpdate.setInt(2, festivalDat.getInteger("score"));
					statementUpdate.setString(3, festivalDat.getString("members"));
					statementUpdate.setInt(4, festivalCycle);
					statementUpdate.setString(5, cabal);
					statementUpdate.setInt(6, festivalId);

					// If there was no record to update, assume it doesn't exist and add a new one,
					// otherwise continue with the next record to store.
					if (statementUpdate.executeUpdate() > 0)
					{
						if (Config.DEBUG)
							_log.info("SevenSignsFestival: Updated data in DB (Cycle = " + festivalCycle + ", Cabal = " + cabal + ", FestID = " + festivalId + ")");
						continue;
					}

					statementInsert.setInt(1, festivalId);
					statementInsert.setString(2, cabal);
					statementInsert.setInt(3, festivalCycle);
					statementInsert.setLong(4, Long.valueOf(festivalDat.getString("date")));
					statementInsert.setInt(5, festivalDat.getInteger("score"));
					statementInsert.setString(6, festivalDat.getString("members"));
					statementInsert.execute();
					statementInsert.clearParameters();

					if (Config.DEBUG)
						_log.info("SevenSignsFestival: Inserted data in DB (Cycle = " + festivalCycle + ", Cabal = " + cabal + ", FestID = " + festivalId + ")");
				}
			}
			statementUpdate.close();
			statementInsert.close();

			// Updates Seven Signs DB data also, so call only if really necessary.
			if (updateSettings)
				SevenSigns.getInstance().saveSevenSignsStatus();
		}
		catch (SQLException e)
		{
			_log.log(Level.SEVERE, "SevenSignsFestival: Failed to save configuration: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(PreparedStatement psUpdate=con.prepareStatement("UPDATE seven_signs_festival SET date=?, score=?, members=? WHERE cycle=? AND cabal=? AND festivalId=?"); PreparedStatement psInsert=con.prepareStatement("INSERT INTO seven_signs_festival (festivalId, cabal, cycle, date, score, members) VALUES (?,?,?,?,?,?)")) in method public saveFestivalData(updateSettings boolean) : void from class com.l2jserver.gameserver.SevenSignsFestival


	private void addReputationPointsForPartyMemberClan(String partyMemberName)
	{
		L2PcInstance player = L2World.getInstance().getPlayer(partyMemberName);
		if (player != null)
		{
			if (player.getClan() != null)
			{
				player.getClan().addReputationScore(Config.FESTIVAL_WIN_POINTS, true);
				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_C1_WAS_IN_HIGHEST_RANKED_PARTY_IN_FESTIVAL_OF_DARKNESS_AND_GAINED_S2_REPUTATION);
				sm.addString(partyMemberName);
				sm.addNumber(Config.FESTIVAL_WIN_POINTS);
				player.getClan().broadcastToOnlineMembers(sm);
			}
		}
		else
		{
			Connection con = null;

			try
			{
				con = L2DatabaseFactory.getInstance().getConnection();
				try (PreparedStatement ps = con.prepareStatement(GET_CLAN_NAME))
				{
					ps.setString(1, partyMemberName);
					try (ResultSet rs = ps.executeQuery())
					{
						if (rs.next())
						{
							String clanName = rs.getString("clan_name");
							if (clanName != null)
							{
								L2Clan clan = ClanTable.getInstance().getClanByName(clanName);
								if (clan != null)
								{
									clan.addReputationScore(Config.FESTIVAL_WIN_POINTS, true);
									SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_C1_WAS_IN_HIGHEST_RANKED_PARTY_IN_FESTIVAL_OF_DARKNESS_AND_GAINED_S2_REPUTATION);
									sm.addString(partyMemberName);
									sm.addNumber(Config.FESTIVAL_WIN_POINTS);
									clan.broadcastToOnlineMembers(sm);
								}
							}
						}
					}
				}
			}
			catch (Exception e)
			{
				_log.log(Level.WARNING, "Could not get clan name of " + partyMemberName + ": " + e.getMessage(), e);
			}
			finally
			{
				L2DatabaseFactory.close(con);
			}
		}
	}

	private void addReputationPointsForPartyMemberClan(String partyMemberName)
	{
		L2PcInstance player = L2World.getInstance().getPlayer(partyMemberName);
		if (player != null)
		{
			if (player.getClan() != null)
			{
				player.getClan().addReputationScore(Config.FESTIVAL_WIN_POINTS, true);
				SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_C1_WAS_IN_HIGHEST_RANKED_PARTY_IN_FESTIVAL_OF_DARKNESS_AND_GAINED_S2_REPUTATION);
				sm.addString(partyMemberName);
				sm.addNumber(Config.FESTIVAL_WIN_POINTS);
				player.getClan().broadcastToOnlineMembers(sm);
			}
		}
		else
		{
			Connection con = null;

			try
			{
				con = L2DatabaseFactory.getInstance().getConnection();
				PreparedStatement statement = con.prepareStatement(GET_CLAN_NAME);
				statement.setString(1, partyMemberName);
				ResultSet rset = statement.executeQuery();
				if (rset.next())
				{
					String clanName = rset.getString("clan_name");
					if (clanName != null)
					{
						L2Clan clan = ClanTable.getInstance().getClanByName(clanName);
						if (clan != null)
						{
							clan.addReputationScore(Config.FESTIVAL_WIN_POINTS, true);
							SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_C1_WAS_IN_HIGHEST_RANKED_PARTY_IN_FESTIVAL_OF_DARKNESS_AND_GAINED_S2_REPUTATION);
							sm.addString(partyMemberName);
							sm.addNumber(Config.FESTIVAL_WIN_POINTS);
							clan.broadcastToOnlineMembers(sm);
						}
					}
				}

				rset.close();
				statement.close();
			}
			catch (Exception e)
			{
				_log.log(Level.WARNING, "Could not get clan name of " + partyMemberName + ": " + e.getMessage(), e);
			}
			finally
			{
				L2DatabaseFactory.close(con);
			}
		}
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement(GET_CLAN_NAME)) in method private addReputationPointsForPartyMemberClan(partyMemberName String) : void from class com.l2jserver.gameserver.SevenSignsFestival


	protected TradeController()
	{
		_lists.clear();
		Connection con = null;

		// Initialize Shop buy list
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (Statement s = con.createStatement();
				ResultSet rs1 = s.executeQuery("SELECT  shop_id, npc_id FROM merchant_shopids"))
			{
				int itemId, price, maxCount, currentCount, time;
				long saveTimer;
				try (PreparedStatement ps = con.prepareStatement("SELECT item_id, price, shop_id, "
						+ L2DatabaseFactory.getInstance().safetyString("order")
						+ ", count, currentCount, time, savetimer FROM merchant_buylists WHERE shop_id=? ORDER BY "
						+ L2DatabaseFactory.getInstance().safetyString("order") + " ASC"))
				{
					while (rs1.next())
					{
						ps.setString(1, String.valueOf(rs1.getInt("shop_id")));
						try (ResultSet rs2 = ps.executeQuery())
						{
							ps.clearParameters();

							int shopId = rs1.getInt("shop_id");
							L2TradeList buy1 = new L2TradeList(shopId);

							while (rs2.next())
							{
								itemId = rs2.getInt("item_id");
								price = rs2.getInt("price");
								maxCount = rs2.getInt("count");
								currentCount = rs2.getInt("currentCount");
								time = rs2.getInt("time");
								saveTimer = rs2.getLong("saveTimer");

								L2TradeItem item = new L2TradeItem(shopId, itemId);
								if (ItemTable.getInstance().getTemplate(itemId) == null)
								{
									_log.warning("Skipping itemId: " + itemId + " on buylistId: " + buy1.getListId() + ", missing data for that item.");
									continue;
								}

								if (price <= -1)
								{
									price = ItemTable.getInstance().getTemplate(itemId).getReferencePrice();
								}

								if (Config.DEBUG)
								{
									// debug
									double diff = ((double) (price)) / ItemTable.getInstance().getTemplate(itemId).getReferencePrice();
									if (diff < 0.8 || diff > 1.2)
									{
										_log.severe("PRICING DEBUG: TradeListId: " + buy1.getListId() + " -  ItemId: " + itemId + " ("
												+ ItemTable.getInstance().getTemplate(itemId).getName() + ") diff: " + diff + " - Price: " + price
												+ " - Reference: " + ItemTable.getInstance().getTemplate(itemId).getReferencePrice());
									}
								}

								item.setPrice(price);

								item.setRestoreDelay(time);
								item.setNextRestoreTime(saveTimer);
								item.setMaxCount(maxCount);

								if (currentCount > -1)
								{
									item.setCurrentCount(currentCount);
								}
								else
								{
									item.setCurrentCount(maxCount);
								}

								buy1.addItem(item);
							}

							buy1.setNpcId(rs1.getString("npc_id"));
							_lists.put(buy1.getListId(), buy1);
							_nextListId = Math.max(_nextListId, buy1.getListId() + 1);
						}
					}
				}
			}
			_log.info("TradeController: Loaded " + _lists.size() + " Buylists.");
		}
		catch (Exception e)
		{
			// problem with initializing spawn, go to next one
			_log.log(Level.WARNING, "TradeController: Buylists could not be initialized: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		// If enabled, initialize the custom buy list
		if (Config.CUSTOM_MERCHANT_TABLES)
		{
			try
			{
				int initialSize = _lists.size();
				con = L2DatabaseFactory.getInstance().getConnection();
				PreparedStatement statement1 = con.prepareStatement("SELECT  shop_id, npc_id FROM custom_merchant_shopids");
				ResultSet rset1 = statement1.executeQuery();

				int itemId, price, maxCount, currentCount, time;
				long saveTimer;
				PreparedStatement statement = con.prepareStatement("SELECT item_id, price, shop_id, "
						+ L2DatabaseFactory.getInstance().safetyString("order")
						+ ", count, currentCount, time, savetimer FROM custom_merchant_buylists WHERE shop_id=? ORDER BY "
						+ L2DatabaseFactory.getInstance().safetyString("order") + " ASC");
				while (rset1.next())
				{
					statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
					ResultSet rset = statement.executeQuery();
					statement.clearParameters();

					int shopId = rset1.getInt("shop_id");
					L2TradeList buy1 = new L2TradeList(shopId);

					while (rset.next())
					{
						itemId = rset.getInt("item_id");
						price = rset.getInt("price");
						maxCount = rset.getInt("count");
						currentCount = rset.getInt("currentCount");
						time = rset.getInt("time");
						saveTimer = rset.getLong("saveTimer");

						L2TradeItem item = new L2TradeItem(shopId, itemId);
						if (ItemTable.getInstance().getTemplate(itemId) == null)
						{
							_log.warning("Skipping itemId: " + itemId + " on buylistId: " + buy1.getListId()
									+ ", missing data for that item.");
							continue;
						}

						if (price <= -1)
						{
							price = ItemTable.getInstance().getTemplate(itemId).getReferencePrice();
						}

						if (Config.DEBUG)
						{
							// debug
							double diff = ((double) (price)) / ItemTable.getInstance().getTemplate(itemId).getReferencePrice();
							if (diff < 0.8 || diff > 1.2)
							{
								_log.severe("PRICING DEBUG: TradeListId: " + buy1.getListId() + " -  ItemId: " + itemId + " ("
										+ ItemTable.getInstance().getTemplate(itemId).getName() + ") diff: " + diff + " - Price: " + price
										+ " - Reference: " + ItemTable.getInstance().getTemplate(itemId).getReferencePrice());
							}
						}

						item.setPrice(price);

						item.setRestoreDelay(time);
						item.setNextRestoreTime(saveTimer);
						item.setMaxCount(maxCount);

						if (currentCount > -1)
						{
							item.setCurrentCount(currentCount);
						}
						else
						{
							item.setCurrentCount(maxCount);
						}

						buy1.addItem(item);
					}

					buy1.setNpcId(rset1.getString("npc_id"));
					_lists.put(buy1.getListId(), buy1);
					_nextListId = Math.max(_nextListId, buy1.getListId() + 1);

					rset.close();
				}
				statement.close();
				rset1.close();
				statement1.close();

				_log.info("TradeController: Loaded " + (_lists.size() - initialSize) + " Custom Buylists.");

			}
			catch (Exception e)
			{
				// problem with initializing spawn, go to next one
				_log.log(Level.WARNING, "TradeController: Buylists could not be initialized: " + e.getMessage(), e);
			}
			finally
			{
				L2DatabaseFactory.close(con);
			}
		}
	}

	protected TradeController()
	{
		_lists.clear();
		Connection con = null;

		/*
		 * Initialize Shop buylist
		 */
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement1 = con.prepareStatement("SELECT  shop_id, npc_id FROM merchant_shopids");
			ResultSet rset1 = statement1.executeQuery();

			int itemId, price, maxCount, currentCount, time;
			long saveTimer;
			PreparedStatement statement = con.prepareStatement("SELECT item_id, price, shop_id, "
					+ L2DatabaseFactory.getInstance().safetyString("order")
					+ ", count, currentCount, time, savetimer FROM merchant_buylists WHERE shop_id=? ORDER BY "
					+ L2DatabaseFactory.getInstance().safetyString("order") + " ASC");
			while (rset1.next())
			{
				statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
				ResultSet rset = statement.executeQuery();
				statement.clearParameters();

				int shopId = rset1.getInt("shop_id");
				L2TradeList buy1 = new L2TradeList(shopId);

				while (rset.next())
				{
					itemId = rset.getInt("item_id");
					price = rset.getInt("price");
					maxCount = rset.getInt("count");
					currentCount = rset.getInt("currentCount");
					time = rset.getInt("time");
					saveTimer = rset.getLong("saveTimer");

					L2TradeItem item = new L2TradeItem(shopId, itemId);
					if (ItemTable.getInstance().getTemplate(itemId) == null)
					{
						_log.warning("Skipping itemId: " + itemId + " on buylistId: " + buy1.getListId() + ", missing data for that item.");
						continue;
					}

					if (price <= -1)
					{
						price = ItemTable.getInstance().getTemplate(itemId).getReferencePrice();
					}

					if (Config.DEBUG)
					{
						// debug
						double diff = ((double) (price)) / ItemTable.getInstance().getTemplate(itemId).getReferencePrice();
						if (diff < 0.8 || diff > 1.2)
						{
							_log.severe("PRICING DEBUG: TradeListId: " + buy1.getListId() + " -  ItemId: " + itemId + " ("
									+ ItemTable.getInstance().getTemplate(itemId).getName() + ") diff: " + diff + " - Price: " + price
									+ " - Reference: " + ItemTable.getInstance().getTemplate(itemId).getReferencePrice());
						}
					}

					item.setPrice(price);

					item.setRestoreDelay(time);
					item.setNextRestoreTime(saveTimer);
					item.setMaxCount(maxCount);

					if (currentCount > -1)
					{
						item.setCurrentCount(currentCount);
					}
					else
					{
						item.setCurrentCount(maxCount);
					}

					buy1.addItem(item);
				}

				buy1.setNpcId(rset1.getString("npc_id"));
				_lists.put(buy1.getListId(), buy1);
				_nextListId = Math.max(_nextListId, buy1.getListId() + 1);

				rset.close();
			}
			statement.close();
			rset1.close();
			statement1.close();

			_log.info("TradeController: Loaded " + _lists.size() + " Buylists.");
		}
		catch (Exception e)
		{
			// problem with initializing spawn, go to next one
			_log.log(Level.WARNING, "TradeController: Buylists could not be initialized: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		/*
		 * If enabled, initialize the custom buylist
		 */
		if (Config.CUSTOM_MERCHANT_TABLES)
		{
			try
			{
				int initialSize = _lists.size();
				con = L2DatabaseFactory.getInstance().getConnection();
				PreparedStatement statement1 = con.prepareStatement("SELECT  shop_id, npc_id FROM custom_merchant_shopids");
				ResultSet rset1 = statement1.executeQuery();

				int itemId, price, maxCount, currentCount, time;
				long saveTimer;
				PreparedStatement statement = con.prepareStatement("SELECT item_id, price, shop_id, "
						+ L2DatabaseFactory.getInstance().safetyString("order")
						+ ", count, currentCount, time, savetimer FROM custom_merchant_buylists WHERE shop_id=? ORDER BY "
						+ L2DatabaseFactory.getInstance().safetyString("order") + " ASC");
				while (rset1.next())
				{
					statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
					ResultSet rset = statement.executeQuery();
					statement.clearParameters();

					int shopId = rset1.getInt("shop_id");
					L2TradeList buy1 = new L2TradeList(shopId);

					while (rset.next())
					{
						itemId = rset.getInt("item_id");
						price = rset.getInt("price");
						maxCount = rset.getInt("count");
						currentCount = rset.getInt("currentCount");
						time = rset.getInt("time");
						saveTimer = rset.getLong("saveTimer");

						L2TradeItem item = new L2TradeItem(shopId, itemId);
						if (ItemTable.getInstance().getTemplate(itemId) == null)
						{
							_log.warning("Skipping itemId: " + itemId + " on buylistId: " + buy1.getListId()
									+ ", missing data for that item.");
							continue;
						}

						if (price <= -1)
						{
							price = ItemTable.getInstance().getTemplate(itemId).getReferencePrice();
						}

						if (Config.DEBUG)
						{
							// debug
							double diff = ((double) (price)) / ItemTable.getInstance().getTemplate(itemId).getReferencePrice();
							if (diff < 0.8 || diff > 1.2)
							{
								_log.severe("PRICING DEBUG: TradeListId: " + buy1.getListId() + " -  ItemId: " + itemId + " ("
										+ ItemTable.getInstance().getTemplate(itemId).getName() + ") diff: " + diff + " - Price: " + price
										+ " - Reference: " + ItemTable.getInstance().getTemplate(itemId).getReferencePrice());
							}
						}

						item.setPrice(price);

						item.setRestoreDelay(time);
						item.setNextRestoreTime(saveTimer);
						item.setMaxCount(maxCount);

						if (currentCount > -1)
						{
							item.setCurrentCount(currentCount);
						}
						else
						{
							item.setCurrentCount(maxCount);
						}

						buy1.addItem(item);
					}

					buy1.setNpcId(rset1.getString("npc_id"));
					_lists.put(buy1.getListId(), buy1);
					_nextListId = Math.max(_nextListId, buy1.getListId() + 1);

					rset.close();
				}
				statement.close();
				rset1.close();
				statement1.close();

				_log.info("TradeController: Loaded " + (_lists.size() - initialSize) + " Custom Buylists.");

			}
			catch (Exception e)
			{
				// problem with initializing spawn, go to next one
				_log.log(Level.WARNING, "TradeController: Buylists could not be initialized: " + e.getMessage(), e);
			}
			finally
			{
				L2DatabaseFactory.close(con);
			}
		}
	}

Try With Resources try(Statement s=con.createStatement(); ResultSet rs1=s.executeQuery("SELECT  shop_id, npc_id FROM merchant_shopids")) in method protected TradeController() from class com.l2jserver.gameserver.TradeController


	private void getChildren()
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
			{
				ps.setInt(1, _forumId);
				try (ResultSet rs = ps.executeQuery())
				{
					while (rs.next())
					{
						Forum f = new Forum(rs.getInt("forum_id"), this);
						_children.add(f);
						ForumsBBSManager.getInstance().addForum(f);
					}
				}
			}
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Data error on Forum (children): " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	/**
	 *
	 */
	private void getChildren()
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?");
			statement.setInt(1, _forumId);
			ResultSet result = statement.executeQuery();

			while (result.next())
			{
				Forum f = new Forum(result.getInt("forum_id"), this);
				_children.add(f);
				ForumsBBSManager.getInstance().addForum(f);
			}
			result.close();
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Data error on Forum (children): " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?")) in method private getChildren() : void from class com.l2jserver.gameserver.communitybbs.BB.Forum


	/**
	 * @param t
	 */
	private void load(Topic t)
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
			{
				ps.setInt(1, t.getForumID());
				ps.setInt(2, t.getID());
				try (ResultSet rs = ps.executeQuery())
				{
					while(rs.next())
					{
						CPost cp = new CPost();
						cp.postId = rs.getInt("post_id");
						cp.postOwner = rs.getString("post_owner_name");
						cp.postOwnerId = rs.getInt("post_ownerid");
						cp.postDate = rs.getLong("post_date");
						cp.postTopicId = rs.getInt("post_topic_id");
						cp.postForumId = rs.getInt("post_forum_id");
						cp.postTxt = rs.getString("post_txt");
						_post.add(cp);
					}
				}
			}
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/"+t.getID()+" : " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	/**
	 * @param t
	 */
	private void load(Topic t)
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC");
			statement.setInt(1, t.getForumID());
			statement.setInt(2, t.getID());
			ResultSet result = statement.executeQuery();
			while(result.next())
			{
				CPost cp = new CPost();
				cp.postId = result.getInt("post_id");
				cp.postOwner = result.getString("post_owner_name");
				cp.postOwnerId = result.getInt("post_ownerid");
				cp.postDate = result.getLong("post_date");
				cp.postTopicId = result.getInt("post_topic_id");
				cp.postForumId = result.getInt("post_forum_id");
				cp.postTxt = result.getString("post_txt");
				_post.add(cp);
			}
			result.close();
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/"+t.getID()+" : " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC")) in method private load(t Topic) : void from class com.l2jserver.gameserver.communitybbs.BB.Post


	public final int getIdByName(String name)
	{
		if (name == null || name.isEmpty())
			return -1;

		Iterator<Entry<Integer, String>> it = _chars.entrySet().iterator();

		Map.Entry<Integer, String> pair;
		while (it.hasNext())
		{
			pair = it.next();
			if (pair.getValue().equalsIgnoreCase(name))
				return pair.getKey();
		}

		if (Config.CACHE_CHAR_NAMES)
			return -1;

		int id = -1;
		int accessLevel = 0;

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
			{
				ps.setString(1, name);
				try (ResultSet rs = ps.executeQuery())
				{
					while (rs.next())
					{
						id = rs.getInt(1);
						accessLevel = rs.getInt(2);
					}
				}
			}
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "Could not check existing char name: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		if (id > 0)
		{
			_chars.put(id, name);
			_accessLevels.put(id, accessLevel);
			return id;
		}

		return -1; // not found
	}

	public final int getIdByName(String name)
	{
		if (name == null || name.isEmpty())
			return -1;

		Iterator<Entry<Integer, String>> it = _chars.entrySet().iterator();

		Map.Entry<Integer, String> pair;
		while (it.hasNext())
		{
			pair = it.next();
			if (pair.getValue().equalsIgnoreCase(name))
				return pair.getKey();
		}

		if (Config.CACHE_CHAR_NAMES)
			return -1;

		int id = -1;
		int accessLevel = 0;

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?");
			statement.setString(1, name);
			ResultSet rset = statement.executeQuery();
			while (rset.next())
			{
				id = rset.getInt(1);
				accessLevel = rset.getInt(2);
			}
			rset.close();
			statement.close();
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "Could not check existing char name: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		if (id > 0)
		{
			_chars.put(id, name);
			_accessLevels.put(id, accessLevel);
			return id;
		}

		return -1; // not found
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?")) in method public getIdByName(name String) : int from class com.l2jserver.gameserver.datatables.CharNameTable


	public final String getNameById(int id)
	{
		if (id <= 0)
			return null;

		String name = _chars.get(id);
		if (name != null)
			return name;

		if (Config.CACHE_CHAR_NAMES)
			return null;

		int accessLevel = 0;
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
			{
				ps.setInt(1, id);
				try (ResultSet rset = ps.executeQuery())
				{
					while (rset.next())
					{
						name = rset.getString(1);
						accessLevel = rset.getInt(2);
					}
				}
			}
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "Could not check existing char id: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
		if (name != null && !name.isEmpty())
		{
			_chars.put(id, name);
			_accessLevels.put(id, accessLevel);
			return name;
		}

		return null; //not found
	}

	public final String getNameById(int id)
	{
		if (id <= 0)
			return null;

		String name = _chars.get(id);
		if (name != null)
			return name;

		if (Config.CACHE_CHAR_NAMES)
			return null;

		int accessLevel = 0;
		Connection con = null;
		PreparedStatement statement = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			statement = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?");
			statement.setInt(1, id);
			ResultSet rset = statement.executeQuery();
			while (rset.next())
			{
				name = rset.getString(1);
				accessLevel = rset.getInt(2);
			}
			rset.close();
			statement.close();
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "Could not check existing char id: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
		if (name != null && !name.isEmpty())
		{
			_chars.put(id, name);
			_accessLevels.put(id, accessLevel);
			return name;
		}

		return null; //not found
	}

Try With Resources try(ResultSet rset=ps.executeQuery()) in method public getNameById(id int) : String from class com.l2jserver.gameserver.datatables.CharNameTable


	public int accountCharNumber(String account)
	{
		Connection con = null;
		int number = 0;

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) FROM characters WHERE account_name=?"))
			{
				ps.setString(1, account);
				try (ResultSet rset = ps.executeQuery())
				{
					while (rset.next())
					{
						number = rset.getInt(1);
					}
				}
			}
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "Could not check existing char number: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
		return number;
	}

	public int accountCharNumber(String account)
	{
		Connection con = null;
		int number = 0;

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT COUNT(char_name) FROM characters WHERE account_name=?");
			statement.setString(1, account);
			ResultSet rset = statement.executeQuery();
			while (rset.next())
			{
				number = rset.getInt(1);
			}
			rset.close();
			statement.close();
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "Could not check existing char number: " + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
		return number;
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement("SELECT COUNT(char_name) FROM characters WHERE account_name=?")) in method public accountCharNumber(account String) : int from class com.l2jserver.gameserver.datatables.CharNameTable


	public void restoreServitor(L2PcInstance activeChar)
	{
		Connection con = null;
		try
		{
			int skillId = _servitors.get(activeChar.getObjectId());

			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
			{
				ps.setInt(1, activeChar.getObjectId());
				ps.setInt(2, skillId);
				try (ResultSet rs = ps.executeQuery())
				{

					L2NpcTemplate summonTemplate;
					L2ServitorInstance summon;
					L2SkillSummon skill;

					while (rs.next())
					{
						int curHp = rs.getInt("curHp");
						int curMp = rs.getInt("curMp");
						int time = rs.getInt("time");

						skill = (L2SkillSummon) SkillTable.getInstance().getInfo(skillId, activeChar.getSkillLevel(skillId));
						if (skill == null)
						{
							removeServitor(activeChar);
							return;
						}

						summonTemplate = NpcTable.getInstance().getTemplate(skill.getNpcId());
						if (summonTemplate == null)
						{
							_log.warning("[CharSummonTable] Summon attemp for nonexisting Skill ID:" + skillId);
							return;
						}

						final int id = IdFactory.getInstance().getNextId();
						if (summonTemplate.isType("L2SiegeSummon"))
						{
							summon = new L2SiegeSummonInstance(id, summonTemplate, activeChar, skill);
						}
						else if (summonTemplate.isType("L2MerchantSummon"))
						{
							// TODO: Confirm L2Merchant summon = new L2MerchantSummonInstance(id, summonTemplate, activeChar, skill);
							summon = new L2ServitorInstance(id, summonTemplate, activeChar, skill);
						}
						else
						{
							summon = new L2ServitorInstance(id, summonTemplate, activeChar, skill);
						}

						summon.setName(summonTemplate.getName());
						summon.setTitle(activeChar.getName());
						summon.setExpPenalty(skill.getExpPenalty());
						summon.setSharedElementals(skill.getInheritElementals());
						summon.setSharedElementalsValue(skill.getElementalSharePercent());

						if (summon.getLevel() >= ExperienceTable.getInstance().getMaxPetLevel())
						{
							summon.getStat().setExp(ExperienceTable.getInstance().getExpForLevel(ExperienceTable.getInstance().getMaxPetLevel()-1));
							_log.warning("Summon (" + summon.getName() + ") NpcID: " + summon.getNpcId() + " has a level above "+ExperienceTable.getInstance().getMaxPetLevel()+". Please rectify.");
						}
						else
						{
							summon.getStat().setExp(ExperienceTable.getInstance().getExpForLevel(summon.getLevel() % ExperienceTable.getInstance().getMaxPetLevel()));
						}
						summon.setCurrentHp(curHp);
						summon.setCurrentMp(curMp);
						summon.setHeading(activeChar.getHeading());
						summon.setRunning();
						if (!(summon instanceof L2MerchantSummonInstance))
							activeChar.setPet(summon);

						summon.setTimeRemaining(time);

						//L2World.getInstance().storeObject(summon);
						summon.spawnMe(activeChar.getX() + 20, activeChar.getY() + 20, activeChar.getZ());
					}
				}
			}
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "[CharSummonTable]: Summon cannot be restored: ", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	public void restoreServitor(L2PcInstance activeChar)
	{
		Connection con = null;
		try
		{
			int skillId = _servitors.get(activeChar.getObjectId());

			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement(LOAD_SUMMON);
			statement.setInt(1, activeChar.getObjectId());
			statement.setInt(2, skillId);
			ResultSet rset = statement.executeQuery();

			L2NpcTemplate summonTemplate;
			L2ServitorInstance summon;
			L2SkillSummon skill;

			while (rset.next())
			{
				int curHp = rset.getInt("curHp");
				int curMp = rset.getInt("curMp");
				int time = rset.getInt("time");

				skill = (L2SkillSummon) SkillTable.getInstance().getInfo(skillId, activeChar.getSkillLevel(skillId));
				if (skill == null)
				{
					removeServitor(activeChar);
					return;
				}

				summonTemplate = NpcTable.getInstance().getTemplate(skill.getNpcId());
				if (summonTemplate == null)
				{
					_log.warning("[CharSummonTable] Summon attemp for nonexisting Skill ID:" + skillId);
					return;
				}

				final int id = IdFactory.getInstance().getNextId();
				if (summonTemplate.isType("L2SiegeSummon"))
				{
					summon = new L2SiegeSummonInstance(id, summonTemplate, activeChar, skill);
				}
				else if (summonTemplate.isType("L2MerchantSummon"))
				{
					// TODO: Confirm L2Merchant summon = new L2MerchantSummonInstance(id, summonTemplate, activeChar, skill);
					summon = new L2ServitorInstance(id, summonTemplate, activeChar, skill);
				}
				else
				{
					summon = new L2ServitorInstance(id, summonTemplate, activeChar, skill);
				}

				summon.setName(summonTemplate.getName());
				summon.setTitle(activeChar.getName());
				summon.setExpPenalty(skill.getExpPenalty());
				summon.setSharedElementals(skill.getInheritElementals());
				summon.setSharedElementalsValue(skill.getElementalSharePercent());

				if (summon.getLevel() >= ExperienceTable.getInstance().getMaxPetLevel())
				{
					summon.getStat().setExp(ExperienceTable.getInstance().getExpForLevel(ExperienceTable.getInstance().getMaxPetLevel()-1));
					_log.warning("Summon (" + summon.getName() + ") NpcID: " + summon.getNpcId() + " has a level above "+ExperienceTable.getInstance().getMaxPetLevel()+". Please rectify.");
				}
				else
				{
					summon.getStat().setExp(ExperienceTable.getInstance().getExpForLevel(summon.getLevel() % ExperienceTable.getInstance().getMaxPetLevel()));
				}
				summon.setCurrentHp(curHp);
				summon.setCurrentMp(curMp);
				summon.setHeading(activeChar.getHeading());
				summon.setRunning();
				if (!(summon instanceof L2MerchantSummonInstance))
					activeChar.setPet(summon);

				summon.setTimeRemaining(time);

				//L2World.getInstance().storeObject(summon);
				summon.spawnMe(activeChar.getX() + 20, activeChar.getY() + 20, activeChar.getZ());
			}

			rset.close();
			statement.close();
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "[CharSummonTable]: Summon cannot be restored: ", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(ResultSet rs=ps.executeQuery()) in method public restoreServitor(activeChar L2PcInstance) : void from class com.l2jserver.gameserver.datatables.CharSummonTable


	private void restorewars()
	{
		Connection con = null;
		L2Clan clan1, clan2;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (Statement statement = con.createStatement();
				ResultSet rset = statement.executeQuery("SELECT clan1, clan2 FROM clan_wars"))
			{
				while (rset.next())
				{
					clan1 = getClan(rset.getInt("clan1"));
					clan2 = getClan(rset.getInt("clan2"));
					if (clan1 != null && clan2 != null)
					{
						clan1.setEnemyClan(rset.getInt("clan2"));
						clan2.setAttackerClan(rset.getInt("clan1"));
					}
					else
						_log.log(Level.WARNING, "[ClanTable]: restorewars one of clans is null clan1:" + clan1 + " clan2:" + clan2);
				}
			}
		}
		catch (Exception e)
		{
			_log.log(Level.SEVERE, "Error restoring clan wars data.", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	private void restorewars()
	{
		Connection con = null;
		L2Clan clan1, clan2;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT clan1, clan2 FROM clan_wars");
			ResultSet rset = statement.executeQuery();
			while (rset.next())
			{
				clan1 = getClan(rset.getInt("clan1"));
				clan2 = getClan(rset.getInt("clan2"));
				if (clan1 != null && clan2 != null)
				{
					clan1.setEnemyClan(rset.getInt("clan2"));
					clan2.setAttackerClan(rset.getInt("clan1"));
				}
				else
					_log.log(Level.WARNING, "[ClanTable]: restorewars one of clans is null clan1:" + clan1 + " clan2:" + clan2);
			}
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.SEVERE, "Error restoring clan wars data.", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Statement statement=con.createStatement(); ResultSet rset=statement.executeQuery("SELECT clan1, clan2 FROM clan_wars")) in method private restorewars() : void from class com.l2jserver.gameserver.datatables.ClanTable


	protected LevelUpData()
	{
		_lvlTable = new TIntObjectHashMap<>();
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (Statement s = con.createStatement();
				ResultSet rs = s.executeQuery(SELECT_ALL))
			{
				L2LvlupData lvlDat;
				while (rs.next())
				{
					lvlDat = new L2LvlupData();
					lvlDat.setClassid(rs.getInt(CLASS_ID));
					lvlDat.setClassLvl(rs.getInt(CLASS_LVL));
					lvlDat.setClassHpBase(rs.getFloat(HP_BASE));
					lvlDat.setClassHpAdd(rs.getFloat(HP_ADD));
					lvlDat.setClassHpModifier(rs.getFloat(HP_MOD));
					lvlDat.setClassCpBase(rs.getFloat(CP_BASE));
					lvlDat.setClassCpAdd(rs.getFloat(CP_ADD));
					lvlDat.setClassCpModifier(rs.getFloat(CP_MOD));
					lvlDat.setClassMpBase(rs.getFloat(MP_BASE));
					lvlDat.setClassMpAdd(rs.getFloat(MP_ADD));
					lvlDat.setClassMpModifier(rs.getFloat(MP_MOD));

					_lvlTable.put(lvlDat.getClassid(), lvlDat);
				}
			}
			_log.info("LevelUpData: Loaded " + _lvlTable.size() + " Character Level Up Templates.");
		}
		catch (Exception e)
		{
			_log.log(Level.SEVERE, "Error loading Level Up data.", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	protected LevelUpData()
	{
		_lvlTable = new TIntObjectHashMap<>();
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement(SELECT_ALL);
			ResultSet rset = statement.executeQuery();
			L2LvlupData lvlDat;

			while (rset.next())
			{
				lvlDat = new L2LvlupData();
				lvlDat.setClassid(rset.getInt(CLASS_ID));
				lvlDat.setClassLvl(rset.getInt(CLASS_LVL));
				lvlDat.setClassHpBase(rset.getFloat(HP_BASE));
				lvlDat.setClassHpAdd(rset.getFloat(HP_ADD));
				lvlDat.setClassHpModifier(rset.getFloat(HP_MOD));
				lvlDat.setClassCpBase(rset.getFloat(CP_BASE));
				lvlDat.setClassCpAdd(rset.getFloat(CP_ADD));
				lvlDat.setClassCpModifier(rset.getFloat(CP_MOD));
				lvlDat.setClassMpBase(rset.getFloat(MP_BASE));
				lvlDat.setClassMpAdd(rset.getFloat(MP_ADD));
				lvlDat.setClassMpModifier(rset.getFloat(MP_MOD));

				_lvlTable.put(lvlDat.getClassid(), lvlDat);
			}

			rset.close();
			statement.close();

			_log.info("LevelUpData: Loaded " + _lvlTable.size() + " Character Level Up Templates.");
		}
		catch (Exception e)
		{
			_log.log(Level.SEVERE, "Error loading Level Up data.", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Statement s=con.createStatement(); ResultSet rs=s.executeQuery(SELECT_ALL)) in method protected LevelUpData() from class com.l2jserver.gameserver.datatables.LevelUpData


	public boolean doesPetNameExist(String name, int petNpcId)
	{
		boolean result = true;
		Connection con = null;

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
			{
				ps.setString(1, name);
				StringBuilder cond = new StringBuilder();
				for (int it : PetDataTable.getPetItemsByNpc(petNpcId))
				{
					if (!cond.toString().isEmpty())
						cond.append(", ");
					cond.append(it);
				}
				ps.setString(2, cond.toString());
				try (ResultSet rs = ps.executeQuery())
				{
					result = rs.next();
				}
			}
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "Could not check existing petname:" + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
		return result;
	}

	public boolean doesPetNameExist(String name, int petNpcId)
	{
		boolean result = true;
		Connection con = null;

		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)");
			statement.setString(1, name);

			StringBuilder cond = new StringBuilder();
			for (int it : PetDataTable.getPetItemsByNpc(petNpcId))
			{
				if (!cond.toString().isEmpty())
					cond.append(", ");
				cond.append(it);
			}
			statement.setString(2, cond.toString());
			ResultSet rset = statement.executeQuery();
			result = rset.next();
			rset.close();
			statement.close();
		}
		catch (SQLException e)
		{
			_log.log(Level.WARNING, "Could not check existing petname:" + e.getMessage(), e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
		return result;
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)")) in method public doesPetNameExist(name String, petNpcId int) : boolean from class com.l2jserver.gameserver.datatables.PetNameTable


	/**
	 * Load registered game servers.
	 */
	private void loadRegisteredGameServers()
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (Statement ps = con.createStatement();
				ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
			{
				int id;
				while (rs.next())
				{
					id = rs.getInt("server_id");
					_gameServerTable.put(id, new GameServerInfo(id, stringToHex(rs.getString("hexid"))));
				}
			}
		}
		catch (Exception e)
		{
			_log.severe(getClass().getSimpleName() + ": Error loading registered game servers!");
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

	/**
	 * Load registered game servers.
	 */
	private void loadRegisteredGameServers()
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			final PreparedStatement statement = con.prepareStatement("SELECT * FROM gameservers");
			final ResultSet rset = statement.executeQuery();
			int id;
			while (rset.next())
			{
				id = rset.getInt("server_id");
				_gameServerTable.put(id, new GameServerInfo(id, stringToHex(rset.getString("hexid"))));
			}
			rset.close();
			statement.close();
		}
		catch (Exception e)
		{
			_log.severe(getClass().getSimpleName() + ": Error loading registered game servers!");
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
	}

Try With Resources try(Statement ps=con.createStatement(); ResultSet rs=ps.executeQuery("SELECT * FROM gameservers")) in method private loadRegisteredGameServers() : void from class com.l2jserver.loginserver.GameServerTable


	public void execSqlFile(File file, boolean skipErrors)
	{
		try
		{
			_frame.appendToProgressArea("Installing " + file.getName());
			String line = "";
			Connection con = _frame.getConnection();
			Statement stmt = con.createStatement();
			try (Scanner scn = new Scanner(file))
			{
				StringBuilder sb = new StringBuilder();
				while (scn.hasNextLine())
				{
					line = scn.nextLine();
					if (line.startsWith("--"))
					{
						continue;
					}
					else if (line.contains("--"))
					{
						line = line.split("--")[0];
					}

					line = line.trim();
					if (!line.isEmpty())
					{
						sb.append(line + "\n");
					}

					if (line.endsWith(";"))
					{
						stmt.execute(sb.toString());
						sb = new StringBuilder();
					}
				}
			}
		}
		catch (FileNotFoundException e)
		{
			JOptionPane.showMessageDialog(null, "File Not Found!: " + e.getMessage(), "Installer Error", JOptionPane.ERROR_MESSAGE);
		}
		catch (SQLException e)
		{
			if (!skipErrors)
			{
				Object[] options =
				{
					"Continue",
					"Abort"
				};
				int n = JOptionPane.showOptionDialog(null, "MySQL Error: " + e.getMessage(), "Script Error", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);

				if (n == 1)
				{
					System.exit(0);
				}
			}
		}
	}

	public void execSqlFile(File file, boolean skipErrors)
	{
		try
		{
			_frame.appendToProgressArea("Installing " + file.getName());
			String line = "";
			Connection con = _frame.getConnection();
			Statement stmt = con.createStatement();
			Scanner scn = new Scanner(file);
			StringBuilder sb = new StringBuilder();
			while (scn.hasNextLine())
			{
				line = scn.nextLine();
				if (line.startsWith("--"))
				{
					continue;
				}
				else if (line.contains("--"))
				{
					line = line.split("--")[0];
				}

				line = line.trim();
				if (!line.isEmpty())
				{
					sb.append(line + "\n");
				}

				if (line.endsWith(";"))
				{
					stmt.execute(sb.toString());
					sb = new StringBuilder();
				}
			}
			scn.close();
		}
		catch (FileNotFoundException e)
		{
			JOptionPane.showMessageDialog(null, "File Not Found!: " + e.getMessage(), "Installer Error", JOptionPane.ERROR_MESSAGE);
		}
		catch (SQLException e)
		{
			if (!skipErrors)
			{
				Object[] options =
				{
					"Continue",
					"Abort"
				};
				int n = JOptionPane.showOptionDialog(null, "MySQL Error: " + e.getMessage(), "Script Error", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);

				if (n == 1)
				{
					System.exit(0);
				}
			}
		}
	}

Try With Resources try(Scanner scn=new Scanner(file)) in method public execSqlFile(file File, skipErrors boolean) : void from class com.l2jserver.tools.dbinstaller.util.mysql.ScriptExecutor


	@Override
	public void load(InputStream inStream) throws IOException
	{
		try (InputStreamReader isr = new InputStreamReader(inStream, Charset.defaultCharset());)
		{
			super.load(isr);
		}
		finally
		{
			inStream.close();
		}
	}

	@Override
	public void load(InputStream inStream) throws IOException
	{
		InputStreamReader reader = null;
		try
		{
			reader = new InputStreamReader(inStream, Charset.defaultCharset());
			super.load(reader);
		}
		finally
		{
			inStream.close();
			if (reader != null)
			{
				reader.close();
			}
		}
	}

Try With Resources try(InputStreamReader isr=new InputStreamReader(inStream,Charset.defaultCharset())) in method public load(inStream InputStream) : void from class com.l2jserver.util.L2Properties


	public static Integer[] getIntArray(String resultField, String tableName, String whereClause)
	{
		String query = "";
		Integer[] res = null;

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			query = L2DatabaseFactory.getInstance().prepQuerySelect(new String[]
			{
				resultField
			}, tableName, whereClause, false);

			try (PreparedStatement ps = con.prepareStatement(query);
				ResultSet rs = ps.executeQuery())
			{
				int rows = 0;
				while (rs.next())
				{
					rows++;
				}

				if (rows == 0)
				{
					return new Integer[0];
				}

				res = new Integer[rows - 1];

				rs.first();

				int row = 0;
				while (rs.next())
				{
					res[row] = rs.getInt(1);
				}
			}
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "mSGI: Error in query '" + query + "':", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
		return res;
	}

	public static Integer[] getIntArray(String resultField, String tableName, String whereClause)
	{
		String query = "";
		Integer[] res = null;

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			query = L2DatabaseFactory.getInstance().prepQuerySelect(new String[]
			{
				resultField
			}, tableName, whereClause, false);
			PreparedStatement statement = con.prepareStatement(query);
			ResultSet rset = statement.executeQuery();

			int rows = 0;

			while (rset.next())
			{
				rows++;
			}

			if (rows == 0)
			{
				return new Integer[0];
			}

			res = new Integer[rows - 1];

			rset.first();

			int row = 0;
			while (rset.next())
			{
				res[row] = rset.getInt(1);
			}
			rset.close();
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "mSGI: Error in query '" + query + "':", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}
		return res;
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement(query); ResultSet rs=ps.executeQuery()) in method public getIntArray(resultField String, tableName String, whereClause String) : Integer[] from class com.l2jserver.util.lib.SqlUtils


	public static Integer[][] get2DIntArray(String[] resultFields, String usedTables, String whereClause)
	{
		long start = System.currentTimeMillis();
		String query = "";
		Integer res[][] = null;

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			query = L2DatabaseFactory.getInstance().prepQuerySelect(resultFields, usedTables, whereClause, false);
			try (PreparedStatement ps = con.prepareStatement(query);
				ResultSet rs = ps.executeQuery())
			{
				int rows = 0;
				while (rs.next())
				{
					rows++;
				}

				res = new Integer[rows - 1][resultFields.length];

				rs.first();

				int row = 0;
				while (rs.next())
				{
					for (int i = 0; i < resultFields.length; i++)
					{
						res[row][i] = rs.getInt(i + 1);
					}
					row++;
				}
			}
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Error in query '" + query + "':", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		_log.fine("Get all rows in query '" + query + "' in " + (System.currentTimeMillis() - start) + "ms");
		return res;
	}

	public static Integer[][] get2DIntArray(String[] resultFields, String usedTables, String whereClause)
	{
		long start = System.currentTimeMillis();
		String query = "";
		Integer res[][] = null;

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			query = L2DatabaseFactory.getInstance().prepQuerySelect(resultFields, usedTables, whereClause, false);
			PreparedStatement statement = con.prepareStatement(query);
			ResultSet rset = statement.executeQuery();

			int rows = 0;
			while (rset.next())
			{
				rows++;
			}

			res = new Integer[rows - 1][resultFields.length];

			rset.first();

			int row = 0;
			while (rset.next())
			{
				for (int i = 0; i < resultFields.length; i++)
				{
					res[row][i] = rset.getInt(i + 1);
				}
				row++;
			}
			rset.close();
			statement.close();
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Error in query '" + query + "':", e);
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		_log.fine("Get all rows in query '" + query + "' in " + (System.currentTimeMillis() - start) + "ms");
		return res;
	}

Try With Resources try(PreparedStatement ps=con.prepareStatement(query); ResultSet rs=ps.executeQuery()) in method public get2DIntArray(resultFields String[], usedTables String, whereClause String) : Integer[][] from class com.l2jserver.util.lib.SqlUtils


	public ItemAuctionInstance(final int instanceId, final AtomicInteger auctionIds, final Node node) throws Exception
	{
		_instanceId = instanceId;
		_auctionIds = auctionIds;
		_auctions = new TIntObjectHashMap<>();
		_items = new ArrayList<>();

		final NamedNodeMap nanode = node.getAttributes();
		final StatsSet generatorConfig = new StatsSet();
		for (int i = nanode.getLength(); i-- > 0;)
		{
			final Node n = nanode.item(i);
			if (n != null)
			{
				generatorConfig.set(n.getNodeName(), n.getNodeValue());
			}
		}

		_dateGenerator = new AuctionDateGenerator(generatorConfig);

		for (Node na = node.getFirstChild(); na != null; na = na.getNextSibling())
		{
			try
			{
				if ("item".equalsIgnoreCase(na.getNodeName()))
				{
					final NamedNodeMap naa = na.getAttributes();
					final int auctionItemId = Integer.parseInt(naa.getNamedItem("auctionItemId").getNodeValue());
					final int auctionLenght = Integer.parseInt(naa.getNamedItem("auctionLenght").getNodeValue());
					final long auctionInitBid = Integer.parseInt(naa.getNamedItem("auctionInitBid").getNodeValue());

					final int itemId = Integer.parseInt(naa.getNamedItem("itemId").getNodeValue());
					final int itemCount = Integer.parseInt(naa.getNamedItem("itemCount").getNodeValue());

					if (auctionLenght < 1)
					{
						throw new IllegalArgumentException("auctionLenght < 1 for instanceId: " + _instanceId + ", itemId " + itemId);
					}

					final StatsSet itemExtra = new StatsSet();
					final AuctionItem item = new AuctionItem(auctionItemId, auctionLenght, auctionInitBid, itemId, itemCount, itemExtra);

					if (!item.checkItemExists())
					{
						throw new IllegalArgumentException("Item with id " + itemId + " not found");
					}

					for (final AuctionItem tmp : _items)
					{
						if (tmp.getAuctionItemId() == auctionItemId)
						{
							throw new IllegalArgumentException("Dublicated auction item id " + auctionItemId);
						}
					}

					_items.add(item);

					for (Node nb = na.getFirstChild(); nb != null; nb = nb.getNextSibling())
					{
						if ("extra".equalsIgnoreCase(nb.getNodeName()))
						{
							final NamedNodeMap nab = nb.getAttributes();
							for (int i = nab.getLength(); i-- > 0;)
							{
								final Node n = nab.item(i);
								if (n != null)
								{
									itemExtra.set(n.getNodeName(), n.getNodeValue());
								}
							}
						}
					}
				}
			}
			catch (final IllegalArgumentException e)
			{
				_log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading auction item", e);
			}
		}

		if (_items.isEmpty())
		{
			throw new IllegalArgumentException("No items defined");
		}

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			try (PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
			{
				ps.setInt(1, _instanceId);
				try (ResultSet rset = ps.executeQuery())
				{
					while (rset.next())
					{
						final int auctionId = rset.getInt(1);
						try
						{
							final ItemAuction auction = loadAuction(auctionId);
							if (auction != null)
							{
								_auctions.put(auctionId, auction);
							}
							else
							{
								ItemAuctionManager.deleteAuction(auctionId);
							}
						}
						catch (final SQLException e)
						{
							_log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading auction: " + auctionId, e);
						}
					}
				}
			}
		}
		catch (final SQLException e)
		{
			_log.log(Level.SEVERE, getClass().getSimpleName() + ": Failed loading auctions.", e);
			return;
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded " + _items.size() + " item(s) and registered " + _auctions.size() + " auction(s) for instance " + _instanceId + ".");
		checkAndSetCurrentAndNextAuction();
	}

	public ItemAuctionInstance(final int instanceId, final AtomicInteger auctionIds, final Node node) throws Exception
	{
		_instanceId = instanceId;
		_auctionIds = auctionIds;
		_auctions = new TIntObjectHashMap<>();
		_items = new ArrayList<>();

		final NamedNodeMap nanode = node.getAttributes();
		final StatsSet generatorConfig = new StatsSet();
		for (int i = nanode.getLength(); i-- > 0;)
		{
			final Node n = nanode.item(i);
			if (n != null)
			{
				generatorConfig.set(n.getNodeName(), n.getNodeValue());
			}
		}

		_dateGenerator = new AuctionDateGenerator(generatorConfig);

		for (Node na = node.getFirstChild(); na != null; na = na.getNextSibling())
		{
			try
			{
				if ("item".equalsIgnoreCase(na.getNodeName()))
				{
					final NamedNodeMap naa = na.getAttributes();
					final int auctionItemId = Integer.parseInt(naa.getNamedItem("auctionItemId").getNodeValue());
					final int auctionLenght = Integer.parseInt(naa.getNamedItem("auctionLenght").getNodeValue());
					final long auctionInitBid = Integer.parseInt(naa.getNamedItem("auctionInitBid").getNodeValue());

					final int itemId = Integer.parseInt(naa.getNamedItem("itemId").getNodeValue());
					final int itemCount = Integer.parseInt(naa.getNamedItem("itemCount").getNodeValue());

					if (auctionLenght < 1)
					{
						throw new IllegalArgumentException("auctionLenght < 1 for instanceId: " + _instanceId + ", itemId " + itemId);
					}

					final StatsSet itemExtra = new StatsSet();
					final AuctionItem item = new AuctionItem(auctionItemId, auctionLenght, auctionInitBid, itemId, itemCount, itemExtra);

					if (!item.checkItemExists())
					{
						throw new IllegalArgumentException("Item with id " + itemId + " not found");
					}

					for (final AuctionItem tmp : _items)
					{
						if (tmp.getAuctionItemId() == auctionItemId)
						{
							throw new IllegalArgumentException("Dublicated auction item id " + auctionItemId);
						}
					}

					_items.add(item);

					for (Node nb = na.getFirstChild(); nb != null; nb = nb.getNextSibling())
					{
						if ("extra".equalsIgnoreCase(nb.getNodeName()))
						{
							final NamedNodeMap nab = nb.getAttributes();
							for (int i = nab.getLength(); i-- > 0;)
							{
								final Node n = nab.item(i);
								if (n != null)
								{
									itemExtra.set(n.getNodeName(), n.getNodeValue());
								}
							}
						}
					}
				}
			}
			catch (final IllegalArgumentException e)
			{
				_log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading auction item", e);
			}
		}

		if (_items.isEmpty())
		{
			throw new IllegalArgumentException("No items defined");
		}

		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			PreparedStatement statement = con.prepareStatement("SELECT auctionId FROM item_auction WHERE instanceId=?");
			statement.setInt(1, _instanceId);
			ResultSet rset = statement.executeQuery();

			while (rset.next())
			{
				final int auctionId = rset.getInt(1);
				try
				{
					final ItemAuction auction = loadAuction(auctionId);
					if (auction != null)
					{
						_auctions.put(auctionId, auction);
					}
					else
					{
						ItemAuctionManager.deleteAuction(auctionId);
					}
				}
				catch (final SQLException e)
				{
					_log.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading auction: " + auctionId, e);
				}
			}
			statement.close();
			rset.close();
		}
		catch (final SQLException e)
		{
			_log.log(Level.SEVERE, getClass().getSimpleName() + ": Failed loading auctions.", e);
			return;
		}
		finally
		{
			L2DatabaseFactory.close(con);
		}

		_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded " + _items.size() + " item(s) and registered " + _auctions.size() + " auction(s) for instance " + _instanceId + ".");
		checkAndSetCurrentAndNextAuction();
	}

Try With Resources try(ResultSet rset=ps.executeQuery()) in method public ItemAuctionInstance(instanceId int, auctionIds AtomicInteger, node Node) from class com.l2jserver.gameserver.model.itemauction.ItemAuctionInstance


	public void createDump()
	{
		try (Formatter form = new Formatter())
		{
			Connection con = _frame.getConnection();
			PreparedStatement stmt = con.prepareStatement("SHOW TABLES");
			ResultSet rset = stmt.executeQuery();
			File dump = new File("dumps", form.format("%1$s_dump_%2$tY%2$tm%2$td-%2$tH%2$tM%2$tS.sql", _db, new GregorianCalendar().getTime()).toString());
			new File("dumps").mkdir();
			dump.createNewFile();

			_frame.appendToProgressArea("Writing dump " + dump.getName());
			if (rset.last())
			{
				int rows = rset.getRow();
				rset.beforeFirst();
				if (rows > 0)
				{
					_frame.setProgressIndeterminate(false);
					_frame.setProgressMaximum(rows);
				}
			}

			FileWriterStdout ps = new FileWriterStdout(dump);
			while (rset.next())
			{
				_frame.setProgressValue(rset.getRow());
				_frame.appendToProgressArea("Dumping Table " + rset.getString(1));
				ps.println("CREATE TABLE `" + rset.getString(1) + "`");
				ps.println("(");
				PreparedStatement desc = con.prepareStatement("DESC " + rset.getString(1));
				ResultSet dset = desc.executeQuery();
				Map<String, List<String>> keys = new HashMap<>();
				boolean isFirst = true;
				while (dset.next())
				{
					if (!isFirst)
					{
						ps.println(",");
					}
					ps.print("\t`" + dset.getString(1) + "`");
					ps.print(" " + dset.getString(2));
					if (dset.getString(3).equals("NO"))
					{
						ps.print(" NOT NULL");
					}
					if (!dset.getString(4).isEmpty())
					{
						if (!keys.containsKey(dset.getString(4)))
						{
							keys.put(dset.getString(4), new ArrayList<String>());
						}
						keys.get(dset.getString(4)).add(dset.getString(1));
					}
					if (dset.getString(5) != null)
					{
						ps.print(" DEFAULT '" + dset.getString(5) + "'");
					}
					if (!dset.getString(6).isEmpty())
					{
						ps.print(" " + dset.getString(6));
					}
					isFirst = false;
				}
				if (keys.containsKey("PRI"))
				{
					ps.println(",");
					ps.print("\tPRIMARY KEY (");
					isFirst = true;
					for (String key : keys.get("PRI"))
					{
						if (!isFirst)
						{
							ps.print(", ");
						}
						ps.print("`" + key + "`");
						isFirst = false;
					}
					ps.print(")");
				}
				if (keys.containsKey("MUL"))
				{
					ps.println(",");
					isFirst = true;
					for (String key : keys.get("MUL"))
					{
						if (!isFirst)
						{
							ps.println(", ");
						}
						ps.print("\tKEY `key_" + key + "` (`" + key + "`)");
						isFirst = false;
					}
				}
				ps.println();
				ps.println(");");
				ps.flush();
				dset.close();
				desc.close();

				desc = con.prepareStatement("SELECT * FROM " + rset.getString(1));
				dset = desc.executeQuery();
				isFirst = true;
				int cnt = 0;
				while (dset.next())
				{
					if ((cnt % 100) == 0)
					{
						ps.println("INSERT INTO `" + rset.getString(1) + "` VALUES ");
					}
					else
					{
						ps.println(",");
					}

					ps.print("\t(");
					boolean isInFirst = true;
					for (int i = 1; i <= dset.getMetaData().getColumnCount(); i++)
					{
						if (!isInFirst)
						{
							ps.print(", ");
						}

						if (dset.getString(i) == null)
						{
							ps.print("NULL");
						}
						else
						{
							ps.print("'" + dset.getString(i).replace("\'", "\\\'") + "'");
						}
						isInFirst = false;
					}
					ps.print(")");
					isFirst = false;

					if ((cnt % 100) == 99)
					{
						ps.println(";");
					}
					cnt++;
				}
				if (!isFirst && ((cnt % 100) != 0))
				{
					ps.println(";");
				}
				ps.println();
				ps.flush();
				dset.close();
				desc.close();
			}
			rset.close();
			stmt.close();
			ps.flush();
			ps.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		_frame.appendToProgressArea("Dump Complete!");
	}

	public void createDump()
	{
		try
		{
			Connection con = _frame.getConnection();
			Formatter form = new Formatter();
			PreparedStatement stmt = con.prepareStatement("SHOW TABLES");
			ResultSet rset = stmt.executeQuery();
			File dump = new File("dumps", form.format("%1$s_dump_%2$tY%2$tm%2$td-%2$tH%2$tM%2$tS.sql", _db, new GregorianCalendar().getTime()).toString());
			new File("dumps").mkdir();
			dump.createNewFile();

			_frame.appendToProgressArea("Writing dump " + dump.getName());
			if (rset.last())
			{
				int rows = rset.getRow();
				rset.beforeFirst();
				if (rows > 0)
				{
					_frame.setProgressIndeterminate(false);
					_frame.setProgressMaximum(rows);
				}
			}

			FileWriterStdout ps = new FileWriterStdout(dump);
			while (rset.next())
			{
				_frame.setProgressValue(rset.getRow());
				_frame.appendToProgressArea("Dumping Table " + rset.getString(1));
				ps.println("CREATE TABLE `" + rset.getString(1) + "`");
				ps.println("(");
				PreparedStatement desc = con.prepareStatement("DESC " + rset.getString(1));
				ResultSet dset = desc.executeQuery();
				Map<String, List<String>> keys = new HashMap<>();
				boolean isFirst = true;
				while (dset.next())
				{
					if (!isFirst)
					{
						ps.println(",");
					}
					ps.print("\t`" + dset.getString(1) + "`");
					ps.print(" " + dset.getString(2));
					if (dset.getString(3).equals("NO"))
					{
						ps.print(" NOT NULL");
					}
					if (!dset.getString(4).isEmpty())
					{
						if (!keys.containsKey(dset.getString(4)))
						{
							keys.put(dset.getString(4), new ArrayList<String>());
						}
						keys.get(dset.getString(4)).add(dset.getString(1));
					}
					if (dset.getString(5) != null)
					{
						ps.print(" DEFAULT '" + dset.getString(5) + "'");
					}
					if (!dset.getString(6).isEmpty())
					{
						ps.print(" " + dset.getString(6));
					}
					isFirst = false;
				}
				if (keys.containsKey("PRI"))
				{
					ps.println(",");
					ps.print("\tPRIMARY KEY (");
					isFirst = true;
					for (String key : keys.get("PRI"))
					{
						if (!isFirst)
						{
							ps.print(", ");
						}
						ps.print("`" + key + "`");
						isFirst = false;
					}
					ps.print(")");
				}
				if (keys.containsKey("MUL"))
				{
					ps.println(",");
					isFirst = true;
					for (String key : keys.get("MUL"))
					{
						if (!isFirst)
						{
							ps.println(", ");
						}
						ps.print("\tKEY `key_" + key + "` (`" + key + "`)");
						isFirst = false;
					}
				}
				ps.println();
				ps.println(");");
				ps.flush();
				dset.close();
				desc.close();

				desc = con.prepareStatement("SELECT * FROM " + rset.getString(1));
				dset = desc.executeQuery();
				isFirst = true;
				int cnt = 0;
				while (dset.next())
				{
					if ((cnt % 100) == 0)
					{
						ps.println("INSERT INTO `" + rset.getString(1) + "` VALUES ");
					}
					else
					{
						ps.println(",");
					}

					ps.print("\t(");
					boolean isInFirst = true;
					for (int i = 1; i <= dset.getMetaData().getColumnCount(); i++)
					{
						if (!isInFirst)
						{
							ps.print(", ");
						}

						if (dset.getString(i) == null)
						{
							ps.print("NULL");
						}
						else
						{
							ps.print("'" + dset.getString(i).replace("\'", "\\\'") + "'");
						}
						isInFirst = false;
					}
					ps.print(")");
					isFirst = false;

					if ((cnt % 100) == 99)
					{
						ps.println(";");
					}
					cnt++;
				}
				if (!isFirst && ((cnt % 100) != 0))
				{
					ps.println(";");
				}
				ps.println();
				ps.flush();
				dset.close();
				desc.close();
			}
			rset.close();
			stmt.close();
			ps.flush();
			ps.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		_frame.appendToProgressArea("Dump Complete!");
	}

Try With Resources try(Formatter form=new Formatter()) in method public createDump() : void from class com.l2jserver.tools.dbinstaller.util.mysql.DBDumper


	public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
	{
		try (Formatter form = new Formatter())
		{
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
			con = DriverManager.getConnection(formattedText, user, password);

			Statement st = con.createStatement();
			st.execute("CREATE DATABASE IF NOT EXISTS `" + db + "`");
			st.execute("USE `" + db + "`");
			st.close();
		}
		catch (SQLException e)
		{
			if (console)
			{
				e.printStackTrace();
			}
			else
			{
				JOptionPane.showMessageDialog(null, "MySQL Error: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
			}
		}
		catch (InstantiationException e)
		{
			if (console)
			{
				e.printStackTrace();
			}
			else
			{
				JOptionPane.showMessageDialog(null, "Instantiation Exception: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
			}
		}
		catch (IllegalAccessException e)
		{
			if (console)
			{
				e.printStackTrace();
			}
			else
			{
				JOptionPane.showMessageDialog(null, "Illegal Access: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
			}
		}
		catch (ClassNotFoundException e)
		{
			if (console)
			{
				e.printStackTrace();
			}
			else
			{
				JOptionPane.showMessageDialog(null, "Cannot find MySQL Connector: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
			}
		}
	}

	public MySqlConnect(String host, String port, String user, String password, String db, boolean console)
	{
		try
		{
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			con = DriverManager.getConnection(new Formatter().format("jdbc:mysql://%1$s:%2$s", host, port).toString(), user, password);

			Statement st = con.createStatement();
			st.execute("CREATE DATABASE IF NOT EXISTS `" + db + "`");
			st.execute("USE `" + db + "`");
			st.close();
		}
		catch (SQLException e)
		{
			if (console)
			{
				e.printStackTrace();
			}
			else
			{
				JOptionPane.showMessageDialog(null, "MySQL Error: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
			}
		}
		catch (InstantiationException e)
		{
			if (console)
			{
				e.printStackTrace();
			}
			else
			{
				JOptionPane.showMessageDialog(null, "Instantiation Exception: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
			}
		}
		catch (IllegalAccessException e)
		{
			if (console)
			{
				e.printStackTrace();
			}
			else
			{
				JOptionPane.showMessageDialog(null, "Illegal Access: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
			}
		}
		catch (ClassNotFoundException e)
		{
			if (console)
			{
				e.printStackTrace();
			}
			else
			{
				JOptionPane.showMessageDialog(null, "Cannot find MySQL Connector: " + e.getMessage(), "Connection Error", JOptionPane.ERROR_MESSAGE);
			}
		}
	}

Try With Resources try(Formatter form=new Formatter()) in method public MySqlConnect(host String, port String, user String, password String, db String, console boolean) from class com.l2jserver.tools.dbinstaller.util.mysql.MySqlConnect


	public void addEventAnnouncement(DateRange validDateRange, String[] msg)
	{
		List<Object> entry = new FastList<>();
		entry.add(validDateRange);
		entry.add(msg);
		_eventAnnouncements.add(entry);
	}

	public void addEventAnnouncement(DateRange validDateRange, String[] msg)
	{
		List<Object> entry = new FastList<Object>();
		entry.add(validDateRange);
		entry.add(msg);
		_eventAnnouncements.add(entry);
	}

Replace Generic With Diamond FastList<Object> with FastList<> in method public addEventAnnouncement(validDateRange DateRange, msg String[]) : void from class com.l2jserver.gameserver.Announcements


	private void readFromDisk(String path, List<String> list)
	{
		final File file = new File(Config.DATAPACK_ROOT, path);
		try (FileReader fr = new FileReader(file);
			LineNumberReader lnr = new LineNumberReader(fr))
		{
			String line = null;
			while ((line = lnr.readLine()) != null)
			{
				StringTokenizer st = new StringTokenizer(line, "\n\r");
				if (st.hasMoreTokens())
				{
					list.add(st.nextToken());
				}
			}
		}
		catch (IOException e1)
		{
			_log.log(Level.SEVERE, "Error reading announcements: ", e1);
		}
	}

	private void readFromDisk(String path, List<String> list)
	{
		File file = new File(Config.DATAPACK_ROOT, path);

		if (file.exists())
		{
			LineNumberReader lnr = null;
			try
			{
				String line = null;
				lnr = new LineNumberReader(new FileReader(file));
				while ((line = lnr.readLine()) != null)
				{
					StringTokenizer st = new StringTokenizer(line, "\n\r");
					if (st.hasMoreTokens())
					{
						String announcement = st.nextToken();
						list.add(announcement);
					}
				}
			}
			catch (IOException e1)
			{
				_log.log(Level.SEVERE, "Error reading announcements: ", e1);
			}
			finally
			{
				try
				{
					lnr.close();
				}
				catch (Exception e2)
				{
					// nothing
				}
			}
		}
		else
			_log.warning(file.getAbsolutePath() + " doesn't exist");
	}

Try With Resources try(FileReader fr=new FileReader(file); LineNumberReader lnr=new LineNumberReader(fr)) in method private readFromDisk(path String, list List<String>) : void from class com.l2jserver.gameserver.Announcements


	private void saveToDisk(boolean isCritical)
	{
		String path;
		List<String> list;

		if (isCritical)
		{
			path = "data/critannouncements.txt";
			list = _critAnnouncements;
		}
		else
		{
			path = "data/announcements.txt";
			list = _announcements;
		}

		final File file = new File(path);
		try (FileWriter save = new FileWriter(file))
		{
			for (String announce : list)
			{
				save.write(announce);
				save.write("\r\n");
			}
		}
		catch (IOException e)
		{
			_log.log(Level.SEVERE, "Saving to the announcements file has failed: ", e);
		}
	}

	private void saveToDisk(boolean isCritical)
	{
		String path;
		List<String> list;

		if (isCritical)
		{
			path = "data/critannouncements.txt";
			list = _critAnnouncements;
		}
		else
		{
			path = "data/announcements.txt";
			list = _announcements;
		}

		File file = new File(path);
		FileWriter save = null;

		try
		{
			save = new FileWriter(file);
			for (String announce : list)
			{
				save.write(announce);
				save.write("\r\n");
			}
		}
		catch (IOException e)
		{
			_log.log(Level.SEVERE, "Saving to the announcements file has failed: ", e);
		}
		finally
		{
			try
			{
				save.close();
			}
			catch (Exception e)
			{
			}
		}
	}

Try With Resources try(FileWriter save=new FileWriter(file)) in method private saveToDisk(isCritical boolean) : void from class com.l2jserver.gameserver.Announcements


	private static void nInitGeodata()
	{
		final File file = new File("./data/geodata/geo_index.txt");
		try (FileReader fr = new FileReader(file);
			BufferedReader br = new BufferedReader(fr);
			LineNumberReader lnr = new LineNumberReader(br))
		{
			_log.info("Geo Engine: - Loading Geodata...");
			String line;
			while ((line = lnr.readLine()) != null)
			{
				if (line.trim().length() == 0)
					continue;
				StringTokenizer st = new StringTokenizer(line, "_");
				byte rx = Byte.parseByte(st.nextToken());
				byte ry = Byte.parseByte(st.nextToken());
				loadGeodataFile(rx, ry);
			}
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "", e);
			throw new Error("Failed to Read geo_index File.");
		}

		try
		{
			File geo_bugs = new File("./data/geodata/geo_bugs.txt");

			_geoBugsOut = new BufferedOutputStream(new FileOutputStream(geo_bugs, true));
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "", e);
			throw new Error("Failed to Load geo_bugs.txt File.");
		}
	}

	private static void nInitGeodata()
	{
		LineNumberReader lnr = null;
		try
		{
			_log.info("Geo Engine: - Loading Geodata...");
			File Data = new File("./data/geodata/geo_index.txt");
			if (!Data.exists())
				return;

			lnr = new LineNumberReader(new BufferedReader(new FileReader(Data)));
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "", e);
			throw new Error("Failed to Load geo_index File.");
		}
		String line;
		try
		{
			while ((line = lnr.readLine()) != null)
			{
				if (line.trim().length() == 0)
					continue;
				StringTokenizer st = new StringTokenizer(line, "_");
				byte rx = Byte.parseByte(st.nextToken());
				byte ry = Byte.parseByte(st.nextToken());
				loadGeodataFile(rx, ry);
			}
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "", e);
			throw new Error("Failed to Read geo_index File.");
		}
		finally
		{
			try
			{
				lnr.close();
			}
			catch (Exception e)
			{
			}
		}
		try
		{
			File geo_bugs = new File("./data/geodata/geo_bugs.txt");

			_geoBugsOut = new BufferedOutputStream(new FileOutputStream(geo_bugs, true));
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "", e);
			throw new Error("Failed to Load geo_bugs.txt File.");
		}
	}

Try With Resources try(FileReader fr=new FileReader(file); BufferedReader br=new BufferedReader(fr); LineNumberReader lnr=new LineNumberReader(br)) in method private nInitGeodata() : void from class com.l2jserver.gameserver.GeoEngine


	public static boolean loadGeodataFile(byte rx, byte ry)
	{
		if (rx < Config.WORLD_X_MIN || rx > Config.WORLD_X_MAX || ry < Config.WORLD_Y_MIN || ry > Config.WORLD_Y_MAX)
		{
			_log.warning("Failed to Load GeoFile: invalid region " + rx +","+ ry + "\n");
			return false;
		}
		String fname = "./data/geodata/" + rx + "_" + ry + ".l2j";
		short regionoffset = (short) ((rx << 5) + ry);
		_log.info("Geo Engine: - Loading: " + fname + " -> region offset: " + regionoffset + "X: " + rx + " Y: " + ry);

		int size, index = 0, block = 0, flor = 0;
		// Create a read-only memory-mapped file
		final File Geo = new File(fname);
		try (RandomAccessFile raf = new RandomAccessFile(Geo, "r");
			FileChannel roChannel = raf.getChannel())
		{
			size = (int) roChannel.size();
			MappedByteBuffer geo;
			if (Config.FORCE_GEODATA) //Force O/S to Loads this buffer's content into physical memory.
				//it is not guarantee, because the underlying operating system may have paged out some of the buffer's data
				geo = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, size).load();
			else
				geo = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, size);
			geo.order(ByteOrder.LITTLE_ENDIAN);

			if (size > 196608)
			{
				// Indexing geo files, so we will know where each block starts
				IntBuffer indexs = IntBuffer.allocate(65536);
				while (block < 65536)
				{
					byte type = geo.get(index);
					indexs.put(block, index);
					block++;
					index++;
					if (type == 0)
						index += 2; // 1x short
					else if (type == 1)
						index += 128; // 64 x short
					else
					{
						int b;
						for (b = 0; b < 64; b++)
						{
							byte layers = geo.get(index);
							index += (layers << 1) + 1;
							if (layers > flor)
								flor = layers;
						}
					}
				}
				_geodataIndex.put(regionoffset, indexs);
			}
			_geodata.put(regionoffset, geo);

			_log.info("Geo Engine: - Max Layers: " + flor + " Size: " + size + " Loaded: " + index);
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Failed to Load GeoFile at block: " + block, e);
			return false;
		}
		return true;
	}

	public static boolean loadGeodataFile(byte rx, byte ry)
	{
		if (rx < Config.WORLD_X_MIN || rx > Config.WORLD_X_MAX || ry < Config.WORLD_Y_MIN || ry > Config.WORLD_Y_MAX)
		{
			_log.warning("Failed to Load GeoFile: invalid region " + rx +","+ ry + "\n");
			return false;
		}
		String fname = "./data/geodata/" + rx + "_" + ry + ".l2j";
		short regionoffset = (short) ((rx << 5) + ry);
		_log.info("Geo Engine: - Loading: " + fname + " -> region offset: " + regionoffset + "X: " + rx + " Y: " + ry);
		File Geo = new File(fname);
		int size, index = 0, block = 0, flor = 0;
		FileChannel roChannel = null;
		try
		{
			// Create a read-only memory-mapped file
			roChannel = new RandomAccessFile(Geo, "r").getChannel();
			size = (int) roChannel.size();
			MappedByteBuffer geo;
			if (Config.FORCE_GEODATA) //Force O/S to Loads this buffer's content into physical memory.
				//it is not guarantee, because the underlying operating system may have paged out some of the buffer's data
				geo = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, size).load();
			else
				geo = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, size);
			geo.order(ByteOrder.LITTLE_ENDIAN);

			if (size > 196608)
			{
				// Indexing geo files, so we will know where each block starts
				IntBuffer indexs = IntBuffer.allocate(65536);
				while (block < 65536)
				{
					byte type = geo.get(index);
					indexs.put(block, index);
					block++;
					index++;
					if (type == 0)
						index += 2; // 1x short
					else if (type == 1)
						index += 128; // 64 x short
					else
					{
						int b;
						for (b = 0; b < 64; b++)
						{
							byte layers = geo.get(index);
							index += (layers << 1) + 1;
							if (layers > flor)
								flor = layers;
						}
					}
				}
				_geodataIndex.put(regionoffset, indexs);
			}
			_geodata.put(regionoffset, geo);

			_log.info("Geo Engine: - Max Layers: " + flor + " Size: " + size + " Loaded: " + index);
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "Failed to Load GeoFile at block: " + block, e);
			return false;
		}
		finally
		{
			try
			{
				roChannel.close();
			}
			catch (Exception e)
			{
			}
		}
		return true;
	}

Try With Resources try(RandomAccessFile raf=new RandomAccessFile(Geo,"r"); FileChannel roChannel=raf.getChannel()) in method public loadGeodataFile(rx byte, ry byte) : boolean from class com.l2jserver.gameserver.GeoEngine