浏览代码

BETA: Misc fixes:
* Potential NPEs fixed using ARM
* Announcements
* GeoEngine
* CrestCache, Unhardcoded Filters.
* DoorTable
* UITable
* FortSiegeManager
* SiegeManager
* GeoPathFinding
* L2ScriptEngineManager, FileOutputStream creates the file if not present, is not required to check and create.
* JarClassLoader
* L2LoginServer
* GameStatusThread
* LoginStatusThread
* Base64
* Log
* Potential NPEs fixed in other way:
* L2ControllableMobAI
* PostBBSManager
* L2EffectZone
* RequestGMCommand
* BlowFishKey
* DBInstallerConsole
* Avoiding FastList/FastMap where synchronization is not required:
* SkillTreesData
* UITable
* TerritoryWarManager
* L2CastleMagicianInstance
* L2FishermanInstance
* L2FortSupportCaptainInstance
* L2NpcInstance
* L2PcInstance
* L2TrainerHealersInstance
* L2TransformManagerInstance
* L2VillageMasterInstance
* Castle
* Fort
* Simplified code:
* ConditionPlayerCanSweep
* Castle
* DBInstallerConsole
* Base64
* Flagging code that need to be rewritten:
* L2Attackable

Zoey76 13 年之前
父节点
当前提交
3dc03dec3d
共有 41 个文件被更改,包括 534 次插入959 次删除
  1. 1 2
      L2J_Server_BETA/.settings/org.eclipse.jdt.core.prefs
  2. 6 33
      L2J_Server_BETA/java/com/l2jserver/gameserver/Announcements.java
  3. 5 15
      L2J_Server_BETA/java/com/l2jserver/gameserver/GeoEngine.java
  4. 17 70
      L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2ControllableMobAI.java
  5. 37 109
      L2J_Server_BETA/java/com/l2jserver/gameserver/cache/CrestCache.java
  6. 21 23
      L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/PostBBSManager.java
  7. 9 20
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/DoorTable.java
  8. 71 81
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SkillTreesData.java
  9. 15 42
      L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/UITable.java
  10. 2 14
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FortSiegeManager.java
  11. 2 14
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/SiegeManager.java
  12. 3 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/TerritoryWarManager.java
  13. 1 0
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Attackable.java
  14. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2CastleMagicianInstance.java
  15. 2 2
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2FishermanInstance.java
  16. 2 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2FortSupportCaptainInstance.java
  17. 4 6
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2NpcInstance.java
  18. 6 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  19. 2 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2TrainerHealersInstance.java
  20. 3 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2TransformManagerInstance.java
  21. 2 3
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2VillageMasterInstance.java
  22. 8 13
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCanSweep.java
  23. 22 29
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/Castle.java
  24. 1 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/Fort.java
  25. 1 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2EffectZone.java
  26. 1 1
      L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestGMCommand.java
  27. 6 8
      L2J_Server_BETA/java/com/l2jserver/gameserver/network/gameserverpackets/BlowFishKey.java
  28. 4 15
      L2J_Server_BETA/java/com/l2jserver/gameserver/pathfinding/geonodes/GeoPathFinding.java
  29. 2 19
      L2J_Server_BETA/java/com/l2jserver/gameserver/scripting/L2ScriptEngineManager.java
  30. 13 27
      L2J_Server_BETA/java/com/l2jserver/gameserver/util/JarClassLoader.java
  31. 5 36
      L2J_Server_BETA/java/com/l2jserver/loginserver/L2LoginServer.java
  32. 2 13
      L2J_Server_BETA/java/com/l2jserver/status/GameStatusThread.java
  33. 2 13
      L2J_Server_BETA/java/com/l2jserver/status/LoginStatusThread.java
  34. 9 4
      L2J_Server_BETA/java/com/l2jserver/tools/dbinstaller/console/DBInstallerConsole.java
  35. 155 290
      L2J_Server_BETA/java/com/l2jserver/util/Base64.java
  36. 36 0
      L2J_Server_BETA/java/com/l2jserver/util/file/filter/BMPFilter.java
  37. 8 8
      L2J_Server_BETA/java/com/l2jserver/util/file/filter/ExtFilter.java
  38. 1 1
      L2J_Server_BETA/java/com/l2jserver/util/file/filter/HTMLFilter.java
  39. 36 0
      L2J_Server_BETA/java/com/l2jserver/util/file/filter/OldPledgeFilter.java
  40. 6 2
      L2J_Server_BETA/java/com/l2jserver/util/file/filter/XMLFilter.java
  41. 3 22
      L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java

+ 1 - 2
L2J_Server_BETA/.settings/org.eclipse.jdt.core.prefs

@@ -1,4 +1,3 @@
-#Wed Mar 21 09:57:03 UYT 2012
 eclipse.preferences.version=1
 org.eclipse.jdt.core.codeComplete.argumentPrefixes=
 org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -59,7 +58,7 @@ org.eclipse.jdt.core.compiler.problem.nullReference=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
 org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
 org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
 org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
 org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore

+ 6 - 33
L2J_Server_BETA/java/com/l2jserver/gameserver/Announcements.java

@@ -172,22 +172,19 @@ public class Announcements
 	
 	private void readFromDisk(String path, List<String> list)
 	{
-		File file = new File(Config.DATAPACK_ROOT, path);
-		
+		final File file = new File(Config.DATAPACK_ROOT, path);
 		if (file.exists())
 		{
-			LineNumberReader lnr = null;
-			try
+			
+			try (LineNumberReader lnr = new LineNumberReader(new FileReader(file)))
 			{
 				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);
+						list.add(st.nextToken());
 					}
 				}
 			}
@@ -195,17 +192,6 @@ public class Announcements
 			{
 				_log.log(Level.SEVERE, "Error reading announcements: ", e1);
 			}
-			finally
-			{
-				try
-				{
-					lnr.close();
-				}
-				catch (Exception e2)
-				{
-					// nothing
-				}
-			}
 		}
 		else
 			_log.warning(file.getAbsolutePath() + " doesn't exist");
@@ -227,12 +213,9 @@ public class Announcements
 			list = _announcements;
 		}
 		
-		File file = new File(path);
-		FileWriter save = null;
-		
-		try
+		final File file = new File(path);
+		try (FileWriter save = new FileWriter(file))
 		{
-			save = new FileWriter(file);
 			for (String announce : list)
 			{
 				save.write(announce);
@@ -243,16 +226,6 @@ public class Announcements
 		{
 			_log.log(Level.SEVERE, "Saving to the announcements file has failed: ", e);
 		}
-		finally
-		{
-			try
-			{
-				save.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 	}
 	
 	public void announceToAll(String text)

+ 5 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/GeoEngine.java

@@ -701,13 +701,13 @@ public class GeoEngine extends GeoData
 		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
+		final File Geo = new File(fname);
+		try (RandomAccessFile raf = new RandomAccessFile(Geo, "r");
+			FileChannel roChannel = raf.getChannel())
 		{
-			// 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.
@@ -754,16 +754,6 @@ public class GeoEngine extends GeoData
 			_log.log(Level.WARNING, "Failed to Load GeoFile at block: " + block, e);
 			return false;
 		}
-		finally
-		{
-			try
-			{
-				roChannel.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 		return true;
 	}
 	

+ 17 - 70
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2ControllableMobAI.java

@@ -127,7 +127,6 @@ public class L2ControllableMobAI extends L2AttackableAI
 	protected void thinkCast()
 	{
 		L2Attackable npc = (L2Attackable) _actor;
-		
 		if ((getAttackTarget() == null) || getAttackTarget().isAlikeDead())
 		{
 			setAttackTarget(findNextRndTarget());
@@ -141,25 +140,12 @@ public class L2ControllableMobAI extends L2AttackableAI
 		
 		npc.setTarget(getAttackTarget());
 		
-		L2Skill[] skills = null;
-		// double dist2 = 0;
-		
-		try
-		{
-			skills = _actor.getAllSkills();
-			// dist2 = _actor.getPlanDistanceSq(getAttackTarget().getX(), getAttackTarget().getY());
-		}
-		catch (NullPointerException e)
-		{
-			_log.warning(getClass().getSimpleName() + ": Encountered Null Value: " + e.getMessage());
-		}
-		
 		if (!_actor.isMuted())
 		{
 			int max_range = 0;
 			// check distant skills
 			
-			for (L2Skill sk : skills)
+			for (L2Skill sk : _actor.getAllSkills())
 			{
 				if (Util.checkIfInRange(sk.getCastRange(), _actor, getAttackTarget(), true) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
 				{
@@ -194,33 +180,20 @@ public class L2ControllableMobAI extends L2AttackableAI
 			return;
 		}
 		
-		L2Skill[] skills = null;
-		double dist2 = 0;
-		int range = 0;
-		int max_range = 0;
-		
 		_actor.setTarget(target);
 		// as a response, we put the target in a forcedattack mode
 		L2ControllableMobInstance theTarget = (L2ControllableMobInstance) target;
 		L2ControllableMobAI ctrlAi = (L2ControllableMobAI) theTarget.getAI();
 		ctrlAi.forceAttack(_actor);
 		
-		try
-		{
-			skills = _actor.getAllSkills();
-			dist2 = _actor.getPlanDistanceSq(target.getX(), target.getY());
-			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
-			max_range = range;
-		}
-		catch (NullPointerException e)
-		{
-			_log.warning(getClass().getSimpleName() + ": Encountered Null Value: " + e.getMessage());
-		}
+		double dist2 = _actor.getPlanDistanceSq(target.getX(), target.getY());
+		int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
+		int max_range = range;
 		
 		if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
 		{
 			// check distant skills
-			for (L2Skill sk : skills)
+			for (L2Skill sk : _actor.getAllSkills())
 			{
 				int castRange = sk.getCastRange();
 				
@@ -252,28 +225,15 @@ public class L2ControllableMobAI extends L2AttackableAI
 			setAlternateAI(AI_IDLE);
 		}
 		
-		L2Skill[] skills = null;
-		double dist2 = 0;
-		int range = 0;
-		int max_range = 0;
-		
-		try
-		{
-			_actor.setTarget(getForcedTarget());
-			skills = _actor.getAllSkills();
-			dist2 = _actor.getPlanDistanceSq(getForcedTarget().getX(), getForcedTarget().getY());
-			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
-			max_range = range;
-		}
-		catch (NullPointerException e)
-		{
-			_log.warning(getClass().getSimpleName() + ": Encountered Null Value: " + e.getMessage());
-		}
+		_actor.setTarget(getForcedTarget());
+		double dist2 = _actor.getPlanDistanceSq(getForcedTarget().getX(), getForcedTarget().getY());
+		int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
+		int max_range = range;
 		
 		if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
 		{
 			// check distant skills
-			for (L2Skill sk : skills)
+			for (L2Skill sk : _actor.getAllSkills())
 			{
 				int castRange = sk.getCastRange();
 				
@@ -340,28 +300,15 @@ public class L2ControllableMobAI extends L2AttackableAI
 				}
 			}
 			
-			L2Skill[] skills = null;
-			double dist2 = 0;
-			int range = 0;
-			int max_range = 0;
-			
-			try
-			{
-				_actor.setTarget(getAttackTarget());
-				skills = _actor.getAllSkills();
-				dist2 = _actor.getPlanDistanceSq(getAttackTarget().getX(), getAttackTarget().getY());
-				range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
-				max_range = range;
-			}
-			catch (NullPointerException e)
-			{
-				_log.warning(getClass().getSimpleName() + ": Encountered Null Value: " + e.getMessage());
-			}
+			_actor.setTarget(getAttackTarget());
+			double dist2 = _actor.getPlanDistanceSq(getAttackTarget().getX(), getAttackTarget().getY());
+			int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
+			int max_range = range;
 			
 			if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
 			{
 				// check distant skills
-				for (L2Skill sk : skills)
+				for (L2Skill sk : _actor.getAllSkills())
 				{
 					int castRange = sk.getCastRange();
 					
@@ -401,9 +348,9 @@ public class L2ControllableMobAI extends L2AttackableAI
 				setAttackTarget(hated);
 			}
 			
-			if (!_actor.isMuted() && (skills.length > 0) && (Rnd.nextInt(5) == 3))
+			if (!_actor.isMuted() && (Rnd.nextInt(5) == 3))
 			{
-				for (L2Skill sk : skills)
+				for (L2Skill sk : _actor.getAllSkills())
 				{
 					int castRange = sk.getCastRange();
 					

+ 37 - 109
L2J_Server_BETA/java/com/l2jserver/gameserver/cache/CrestCache.java

@@ -32,10 +32,11 @@ import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.datatables.ClanTable;
 import com.l2jserver.gameserver.idfactory.IdFactory;
 import com.l2jserver.gameserver.model.L2Clan;
+import com.l2jserver.util.file.filter.BMPFilter;
+import com.l2jserver.util.file.filter.OldPledgeFilter;
 
 /**
  * @author Layane
- *
  */
 public class CrestCache
 {
@@ -64,11 +65,9 @@ public class CrestCache
 	
 	public void reload()
 	{
-		FileFilter filter = new BmpFilter();
-		
-		File dir = new File(Config.DATAPACK_ROOT, "data/crests/");
-		
-		File[] files = dir.listFiles(filter);
+		final FileFilter filter = new BMPFilter();
+		final File dir = new File(Config.DATAPACK_ROOT, "data/crests/");
+		final File[] files = dir.listFiles(filter);
 		byte[] content;
 		synchronized (this)
 		{
@@ -85,17 +84,14 @@ public class CrestCache
 		FastMap<Integer, byte[]> _mapAlly = _cacheAlly.getContentMap();
 		
 		final L2Clan[] clans = ClanTable.getInstance().getClans();
-		
 		for (File file : files)
 		{
-			RandomAccessFile f = null;
 			synchronized (this)
 			{
-				try
+				try (RandomAccessFile rfa = new RandomAccessFile(file, "r"))
 				{
-					f = new RandomAccessFile(file, "r");
-					content = new byte[(int) f.length()];
-					f.readFully(content);
+					content = new byte[(int) rfa.length()];
+					rfa.readFully(content);
 					
 					boolean erase = true;
 					int crestId = 0;
@@ -103,15 +99,17 @@ public class CrestCache
 					if (file.getName().startsWith("Crest_Large_"))
 					{
 						crestId = Integer.parseInt(file.getName().substring(12, file.getName().length() - 4));
-						if(Config.CLEAR_CREST_CACHE)
+						if (Config.CLEAR_CREST_CACHE)
 						{
-							for(final L2Clan clan : clans)
-								if(clan.getCrestLargeId() == crestId)
+							for (final L2Clan clan : clans)
+							{
+								if (clan.getCrestLargeId() == crestId)
 								{
 									erase = false;
 									break;
 								}
-							if(erase)
+							}
+							if (erase)
 							{
 								file.delete();
 								continue;
@@ -122,15 +120,17 @@ public class CrestCache
 					else if (file.getName().startsWith("Crest_"))
 					{
 						crestId = Integer.parseInt(file.getName().substring(6, file.getName().length() - 4));
-						if(Config.CLEAR_CREST_CACHE)
+						if (Config.CLEAR_CREST_CACHE)
 						{
-							for(final L2Clan clan : clans)
-								if(clan.getCrestId() == crestId)
+							for (final L2Clan clan : clans)
+							{
+								if (clan.getCrestId() == crestId)
 								{
 									erase = false;
 									break;
 								}
-							if(erase)
+							}
+							if (erase)
 							{
 								file.delete();
 								continue;
@@ -141,15 +141,17 @@ public class CrestCache
 					else if (file.getName().startsWith("AllyCrest_"))
 					{
 						crestId = Integer.parseInt(file.getName().substring(10, file.getName().length() - 4));
-						if(Config.CLEAR_CREST_CACHE)
+						if (Config.CLEAR_CREST_CACHE)
 						{
-							for(final L2Clan clan : clans)
-								if(clan.getAllyCrestId() == crestId)
+							for (final L2Clan clan : clans)
+							{
+								if (clan.getAllyCrestId() == crestId)
 								{
 									erase = false;
 									break;
 								}
-							if(erase)
+							}
+							if (erase)
 							{
 								file.delete();
 								continue;
@@ -164,16 +166,6 @@ public class CrestCache
 				{
 					_log.log(Level.WARNING, "Problem with crest bmp file " + e.getMessage(), e);
 				}
-				finally
-				{
-					try
-					{
-						f.close();
-					}
-					catch (Exception e1)
-					{
-					}
-				}
 			}
 		}
 		
@@ -208,36 +200,26 @@ public class CrestCache
 			}
 		}
 		
-		_log.info("Cache[Crest]: " + String.format("%.3f", getMemoryUsage()) + "MB on " + getLoadedFiles()
-				+ " files loaded. (Forget Time: " + (_cachePledge.getForgetTime() / 1000) + "s , Capacity: " + _cachePledge.capacity()
-				+ ")");
+		_log.info("Cache[Crest]: " + String.format("%.3f", getMemoryUsage()) + "MB on " + getLoadedFiles() + " files loaded. (Forget Time: " + (_cachePledge.getForgetTime() / 1000) + "s , Capacity: " + _cachePledge.capacity() + ")");
 	}
 	
 	public void convertOldPedgeFiles()
 	{
-		File dir = new File(Config.DATAPACK_ROOT, "data/crests/");
-		
-		File[] files = dir.listFiles(new OldPledgeFilter());
-		
+		final File dir = new File(Config.DATAPACK_ROOT, "data/crests/");
+		final File[] files = dir.listFiles(new OldPledgeFilter());
 		for (File file : files)
 		{
 			int clanId = Integer.parseInt(file.getName().substring(7, file.getName().length() - 4));
-			
 			_log.info("Found old crest file \"" + file.getName() + "\" for clanId " + clanId);
-			
-			int newId = IdFactory.getInstance().getNextId();
-			
-			L2Clan clan = ClanTable.getInstance().getClan(clanId);
-			
+			final L2Clan clan = ClanTable.getInstance().getClan(clanId);
 			if (clan != null)
 			{
 				removeOldPledgeCrest(clan.getCrestId());
-				
+				int newId = IdFactory.getInstance().getNextId();
 				file.renameTo(new File(Config.DATAPACK_ROOT, "data/crests/Crest_" + newId + ".bmp"));
 				_log.info("Renamed Clan crest to new format: Crest_" + newId + ".bmp");
 				
 				Connection con = null;
-				
 				try
 				{
 					con = L2DatabaseFactory.getInstance().getConnection();
@@ -343,11 +325,9 @@ public class CrestCache
 	
 	public boolean savePledgeCrest(int newId, byte[] data)
 	{
-		File crestFile = new File(Config.DATAPACK_ROOT, "data/crests/Crest_" + newId + ".bmp");
-		FileOutputStream out = null;
-		try
+		final File crestFile = new File(Config.DATAPACK_ROOT, "data/crests/Crest_" + newId + ".bmp");
+		try (FileOutputStream out = new FileOutputStream(crestFile))
 		{
-			out = new FileOutputStream(crestFile);
 			out.write(data);
 			_cachePledge.getContentMap().put(newId, data);
 			return true;
@@ -357,25 +337,13 @@ public class CrestCache
 			_log.log(Level.INFO, "Error saving pledge crest" + crestFile + ":", e);
 			return false;
 		}
-		finally
-		{
-			try
-			{
-				out.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 	}
 	
 	public boolean savePledgeCrestLarge(int newId, byte[] data)
 	{
-		File crestFile = new File(Config.DATAPACK_ROOT, "data/crests/Crest_Large_" + newId + ".bmp");
-		FileOutputStream out = null;
-		try
+		final File crestFile = new File(Config.DATAPACK_ROOT, "data/crests/Crest_Large_" + newId + ".bmp");
+		try (FileOutputStream out = new FileOutputStream(crestFile))
 		{
-			out = new FileOutputStream(crestFile);
 			out.write(data);
 			_cachePledgeLarge.getContentMap().put(newId, data);
 			return true;
@@ -385,25 +353,13 @@ public class CrestCache
 			_log.log(Level.INFO, "Error saving Large pledge crest" + crestFile + ":", e);
 			return false;
 		}
-		finally
-		{
-			try
-			{
-				out.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 	}
 	
 	public boolean saveAllyCrest(int newId, byte[] data)
 	{
-		File crestFile = new File(Config.DATAPACK_ROOT, "data/crests/AllyCrest_" + newId + ".bmp");
-		FileOutputStream out = null;
-		try
+		final File crestFile = new File(Config.DATAPACK_ROOT, "data/crests/AllyCrest_" + newId + ".bmp");
+		try (FileOutputStream out = new FileOutputStream(crestFile))
 		{
-			out = new FileOutputStream(crestFile);
 			out.write(data);
 			_cacheAlly.getContentMap().put(newId, data);
 			return true;
@@ -413,34 +369,6 @@ public class CrestCache
 			_log.log(Level.INFO, "Error saving ally crest" + crestFile + ":", e);
 			return false;
 		}
-		finally
-		{
-			try
-			{
-				out.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
-	}
-	
-	private static class BmpFilter implements FileFilter
-	{
-		@Override
-		public boolean accept(File file)
-		{
-			return (file.getName().endsWith(".bmp"));
-		}
-	}
-	
-	private static class OldPledgeFilter implements FileFilter
-	{
-		@Override
-		public boolean accept(File file)
-		{
-			return (file.getName().startsWith("Pledge_"));
-		}
 	}
 	
 	@SuppressWarnings("synthetic-access")

+ 21 - 23
L2J_Server_BETA/java/com/l2jserver/gameserver/communitybbs/Manager/PostBBSManager.java

@@ -32,14 +32,8 @@ import com.l2jserver.util.StringUtil;
 
 public class PostBBSManager extends BaseBBSManager
 {
-	
 	private Map<Topic, Post> _postByTopic;
 	
-	public static PostBBSManager getInstance()
-	{
-		return SingletonHolder._instance;
-	}
-	
 	private PostBBSManager()
 	{
 		_postByTopic = new FastMap<Topic, Post>();
@@ -305,30 +299,34 @@ public class PostBBSManager extends BaseBBSManager
 			}
 			else
 			{
-				CPost cp = null;
-				Post p = getGPosttByTopic(t);
+				final Post p = getGPosttByTopic(t);
 				if (p != null)
 				{
-					cp = p.getCPost(idp);
-				}
-				if (cp == null)
-				{
-					ShowBoard sb = new ShowBoard("<html><body><br><br><center>the post: " + idp
-							+ " does not exist !</center><br><br></body></html>", "101");
-					activeChar.sendPacket(sb);
-					activeChar.sendPacket(new ShowBoard(null, "102"));
-					activeChar.sendPacket(new ShowBoard(null, "103"));
-				}
-				else
-				{
-					p.getCPost(idp).postTxt = ar4;
-					p.updatetxt(idp);
-					parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), activeChar);
+					final CPost cp = p.getCPost(idp);
+					if (cp == null)
+					{
+						ShowBoard sb = new ShowBoard("<html><body><br><br><center>the post: " + idp
+								+ " does not exist !</center><br><br></body></html>", "101");
+						activeChar.sendPacket(sb);
+						activeChar.sendPacket(new ShowBoard(null, "102"));
+						activeChar.sendPacket(new ShowBoard(null, "103"));
+					}
+					else
+					{
+						p.getCPost(idp).postTxt = ar4;
+						p.updatetxt(idp);
+						parsecmd("_bbsposts;read;" + f.getID() + ";" + t.getID(), activeChar);
+					}
 				}
 			}
 		}
 	}
 	
+	public static PostBBSManager getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	@SuppressWarnings("synthetic-access")
 	private static class SingletonHolder
 	{

+ 9 - 20
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/DoorTable.java

@@ -46,11 +46,6 @@ public class DoorTable
 	private final TIntObjectHashMap<L2DoorInstance> _staticItems;
 	private final TIntObjectHashMap<ArrayList<L2DoorInstance>> _regions;
 	
-	public static DoorTable getInstance()
-	{
-		return SingletonHolder._instance;
-	}
-	
 	private DoorTable()
 	{
 		_staticItems = new TIntObjectHashMap<L2DoorInstance>();
@@ -73,12 +68,11 @@ public class DoorTable
 	
 	public void parseData()
 	{
-		LineNumberReader lnr = null;
-		try
+		final File doorData = new File(Config.DATAPACK_ROOT, "data/door.csv");
+		try (FileReader fr = new FileReader(doorData);
+			BufferedReader br = new BufferedReader (fr);
+			LineNumberReader lnr = new LineNumberReader(br))
 		{
-			File doorData = new File(Config.DATAPACK_ROOT, "data/door.csv");
-			lnr = new LineNumberReader(new BufferedReader(new FileReader(doorData)));
-			
 			String line = null;
 			_log.info("Searching clan halls doors:");
 			
@@ -102,16 +96,6 @@ public class DoorTable
 		{
 			_log.log(Level.WARNING, "Error while creating door table " + e.getMessage(), e);
 		}
-		finally
-		{
-			try
-			{
-				lnr.close();
-			}
-			catch (Exception e1)
-			{ /* ignore problems */
-			}
-		}
 	}
 	
 	/**
@@ -382,6 +366,11 @@ public class DoorTable
 		}
 	}
 	
+	public static DoorTable getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+	
 	@SuppressWarnings("synthetic-access")
 	private static class SingletonHolder
 	{

+ 71 - 81
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/SkillTreesData.java

@@ -17,15 +17,15 @@ package com.l2jserver.gameserver.datatables;
 import gnu.trove.map.hash.TIntObjectHashMap;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
@@ -70,21 +70,21 @@ import com.l2jserver.gameserver.model.skills.L2Skill;
 public final class SkillTreesData extends DocumentParser
 {
 	// ClassId, FastMap of Skill Hash Code, L2SkillLearn
-	private static final FastMap<ClassId, FastMap<Integer, L2SkillLearn>> _classSkillTrees = new FastMap<>();
-	private static final FastMap<ClassId, FastMap<Integer, L2SkillLearn>> _transferSkillTrees = new FastMap<>();
+	private static final Map<ClassId, Map<Integer, L2SkillLearn>> _classSkillTrees = new HashMap<>();
+	private static final Map<ClassId, Map<Integer, L2SkillLearn>> _transferSkillTrees = new HashMap<>();
 	// Skill Hash Code, L2SkillLearn
-	private static final FastMap<Integer, L2SkillLearn> _collectSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _fishingSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _pledgeSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _subClassSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _subPledgeSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _transformSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _commonSkillTree = new FastMap<>();
+	private static final Map<Integer, L2SkillLearn> _collectSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _fishingSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _pledgeSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _subClassSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _subPledgeSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _transformSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _commonSkillTree = new HashMap<>();
 	// Other skill trees
-	private static final FastMap<Integer, L2SkillLearn> _nobleSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _heroSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _gameMasterSkillTree = new FastMap<>();
-	private static final FastMap<Integer, L2SkillLearn> _gameMasterAuraSkillTree = new FastMap<>();
+	private static final Map<Integer, L2SkillLearn> _nobleSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _heroSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _gameMasterSkillTree = new HashMap<>();
+	private static final Map<Integer, L2SkillLearn> _gameMasterAuraSkillTree = new HashMap<>();
 	
 	// Checker, sorted arrays of hash codes
 	private TIntObjectHashMap<int[]> _skillsByClassIdHashCodes; // Occupation skills
@@ -96,7 +96,7 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * Parent class IDs are read from XML and stored in this map, to allow easy customization.
 	 */
-	private static final FastMap<ClassId, ClassId> _parentClassMap = new FastMap<ClassId, ClassId>();
+	private static final Map<ClassId, ClassId> _parentClassMap = new HashMap<>();
 	
 	private SkillTreesData()
 	{
@@ -153,8 +153,8 @@ public final class SkillTreesData extends DocumentParser
 				{
 					if ("skillTree".equalsIgnoreCase(d.getNodeName()))
 					{
-						final FastMap<Integer, L2SkillLearn> classSkillTree = new FastMap<Integer, L2SkillLearn>();
-						final FastMap<Integer, L2SkillLearn> trasferSkillTree = new FastMap<Integer, L2SkillLearn>();
+						final Map<Integer, L2SkillLearn> classSkillTree = new HashMap<>();
+						final Map<Integer, L2SkillLearn> trasferSkillTree = new HashMap<>();
 						
 						type = d.getAttributes().getNamedItem("type").getNodeValue();
 						attr = d.getAttributes().getNamedItem("classId");
@@ -172,9 +172,9 @@ public final class SkillTreesData extends DocumentParser
 						if (attr != null)
 						{
 							parentClassId = Integer.parseInt(attr.getNodeValue());
-							if ((cId > -1) && (cId != parentClassId) && (parentClassId > -1))
+							if ((cId > -1) && (cId != parentClassId) && (parentClassId > -1) && !_parentClassMap.containsKey(classId))
 							{
-								_parentClassMap.putIfAbsent(classId, ClassId.values()[parentClassId]);
+								_parentClassMap.put(classId, ClassId.values()[parentClassId]);
 							}
 						}
 						
@@ -316,15 +316,6 @@ public final class SkillTreesData extends DocumentParser
 		}
 	}
 	
-	/**
-	 * Wrapper for class skill trees.
-	 * @return the {@code _classSkillTrees}, if it's null allocate a new map and returns it.
-	 */
-	private FastMap<ClassId, FastMap<Integer, L2SkillLearn>> getClassSkillTrees()
-	{
-		return _classSkillTrees;
-	}
-	
 	/**
 	 * Method to get the complete skill tree for a given class id.<br>
 	 * Include all skills common to all classes.<br>
@@ -332,14 +323,14 @@ public final class SkillTreesData extends DocumentParser
 	 * @param classId the class skill tree ID.
 	 * @return the complete Class Skill Tree including skill trees from parent class for a given {@code classId}.
 	 */
-	public FastMap<Integer, L2SkillLearn> getCompleteClassSkillTree(ClassId classId)
+	public Map<Integer, L2SkillLearn> getCompleteClassSkillTree(ClassId classId)
 	{
-		final FastMap<Integer, L2SkillLearn> skillTree = new FastMap<Integer, L2SkillLearn>();
+		final Map<Integer, L2SkillLearn> skillTree = new HashMap<>();
 		// Add all skills that belong to all classes.
 		skillTree.putAll(_commonSkillTree);
-		while ((classId != null) && (getClassSkillTrees().get(classId) != null))
+		while ((classId != null) && (_classSkillTrees.get(classId) != null))
 		{
-			skillTree.putAll(getClassSkillTrees().get(classId));
+			skillTree.putAll(_classSkillTrees.get(classId));
 			classId = _parentClassMap.get(classId);
 		}
 		return skillTree;
@@ -349,7 +340,7 @@ public final class SkillTreesData extends DocumentParser
 	 * @param classId the transfer skill tree ID.
 	 * @return the complete Transfer Skill Tree for a given {@code classId}.
 	 */
-	public FastMap<Integer, L2SkillLearn> getTransferSkillTree(ClassId classId)
+	public Map<Integer, L2SkillLearn> getTransferSkillTree(ClassId classId)
 	{
 		// If new classes are implemented over 3rd class, we use a recursive call.
 		if (classId.level() >= 3)
@@ -362,7 +353,7 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Common Skill Tree.
 	 */
-	public FastMap<Integer, L2SkillLearn> getCommonSkillTree()
+	public Map<Integer, L2SkillLearn> getCommonSkillTree()
 	{
 		return _commonSkillTree;
 	}
@@ -370,7 +361,7 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Collect Skill Tree.
 	 */
-	public FastMap<Integer, L2SkillLearn> getCollectSkillTree()
+	public Map<Integer, L2SkillLearn> getCollectSkillTree()
 	{
 		return _collectSkillTree;
 	}
@@ -378,7 +369,7 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Fishing Skill Tree.
 	 */
-	public FastMap<Integer, L2SkillLearn> getFishingSkillTree()
+	public Map<Integer, L2SkillLearn> getFishingSkillTree()
 	{
 		return _fishingSkillTree;
 	}
@@ -386,7 +377,7 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Pledge Skill Tree.
 	 */
-	public FastMap<Integer, L2SkillLearn> getPledgeSkillTree()
+	public Map<Integer, L2SkillLearn> getPledgeSkillTree()
 	{
 		return _pledgeSkillTree;
 	}
@@ -394,7 +385,7 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Sub-Class Skill Tree.
 	 */
-	public FastMap<Integer, L2SkillLearn> getSubClassSkillTree()
+	public Map<Integer, L2SkillLearn> getSubClassSkillTree()
 	{
 		return _subClassSkillTree;
 	}
@@ -402,7 +393,7 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Sub-Pledge Skill Tree.
 	 */
-	public FastMap<Integer, L2SkillLearn> getSubPledgeSkillTree()
+	public Map<Integer, L2SkillLearn> getSubPledgeSkillTree()
 	{
 		return _subPledgeSkillTree;
 	}
@@ -410,7 +401,7 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Transform Skill Tree.
 	 */
-	public FastMap<Integer, L2SkillLearn> getTransformSkillTree()
+	public Map<Integer, L2SkillLearn> getTransformSkillTree()
 	{
 		return _transformSkillTree;
 	}
@@ -418,9 +409,9 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Noble Skill Tree.
 	 */
-	public FastMap<Integer, L2Skill> getNobleSkillTree()
+	public Map<Integer, L2Skill> getNobleSkillTree()
 	{
-		final FastMap<Integer, L2Skill> tree = new FastMap<>();
+		final Map<Integer, L2Skill> tree = new HashMap<>();
 		final SkillTable st = SkillTable.getInstance();
 		for (Entry<Integer, L2SkillLearn> e : _nobleSkillTree.entrySet())
 		{
@@ -432,9 +423,9 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Hero Skill Tree.
 	 */
-	public FastMap<Integer, L2Skill> getHeroSkillTree()
+	public Map<Integer, L2Skill> getHeroSkillTree()
 	{
-		final FastMap<Integer, L2Skill> tree = new FastMap<>();
+		final Map<Integer, L2Skill> tree = new HashMap<>();
 		final SkillTable st = SkillTable.getInstance();
 		for (Entry<Integer, L2SkillLearn> e : _heroSkillTree.entrySet())
 		{
@@ -446,9 +437,9 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Game Master Skill Tree.
 	 */
-	public FastMap<Integer, L2Skill> getGMSkillTree()
+	public Map<Integer, L2Skill> getGMSkillTree()
 	{
-		final FastMap<Integer, L2Skill> tree = new FastMap<>();
+		final Map<Integer, L2Skill> tree = new HashMap<>();
 		final SkillTable st = SkillTable.getInstance();
 		for (Entry<Integer, L2SkillLearn> e : _gameMasterSkillTree.entrySet())
 		{
@@ -460,9 +451,9 @@ public final class SkillTreesData extends DocumentParser
 	/**
 	 * @return the complete Game Master Aura Skill Tree.
 	 */
-	public FastMap<Integer, L2Skill> getGMAuraSkillTree()
+	public Map<Integer, L2Skill> getGMAuraSkillTree()
 	{
-		final FastMap<Integer, L2Skill> tree = new FastMap<>();
+		final Map<Integer, L2Skill> tree = new HashMap<>();
 		final SkillTable st = SkillTable.getInstance();
 		for (Entry<Integer, L2SkillLearn> e : _gameMasterAuraSkillTree.entrySet())
 		{
@@ -478,10 +469,10 @@ public final class SkillTreesData extends DocumentParser
 	 * @param includeAutoGet if {@code true} Auto-Get skills will be included.
 	 * @return all available skills for a given {@code player}, {@code classId}, {@code includeByFs} and {@code includeAutoGet}.
 	 */
-	public FastList<L2SkillLearn> getAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
+	public List<L2SkillLearn> getAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
-		final FastMap<Integer, L2SkillLearn> skills = getCompleteClassSkillTree(classId);
+		final List<L2SkillLearn> result = new ArrayList<>();
+		final Map<Integer, L2SkillLearn> skills = getCompleteClassSkillTree(classId);
 		if (skills.isEmpty())
 		{
 			// The Skill Tree for this class is undefined.
@@ -514,10 +505,10 @@ public final class SkillTreesData extends DocumentParser
 	 * @param player the player requesting the Auto-Get skills.
 	 * @return all the available Auto-Get skills for a given {@code player}.
 	 */
-	public FastList<L2SkillLearn> getAvailableAutoGetSkills(L2PcInstance player)
+	public List<L2SkillLearn> getAvailableAutoGetSkills(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
-		final FastMap<Integer, L2SkillLearn> skills = getCompleteClassSkillTree(player.getClassId());
+		final List<L2SkillLearn> result = new ArrayList<>();
+		final Map<Integer, L2SkillLearn> skills = getCompleteClassSkillTree(player.getClassId());
 		if (skills.isEmpty())
 		{
 			// The Skill Tree for this class is undefined, so we return an empty list.
@@ -557,9 +548,9 @@ public final class SkillTreesData extends DocumentParser
 	 * @param player
 	 * @return all the available Fishing skills for a given {@code player}.
 	 */
-	public FastList<L2SkillLearn> getAvailableFishingSkills(L2PcInstance player)
+	public List<L2SkillLearn> getAvailableFishingSkills(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
+		final List<L2SkillLearn> result = new ArrayList<>();
 		final Race playerRace = player.getRace();
 		for (L2SkillLearn skill : _fishingSkillTree.values())
 		{
@@ -593,9 +584,9 @@ public final class SkillTreesData extends DocumentParser
 	 * @param player the collecting skill learning player.
 	 * @return all the available Collecting skills for a given {@code player}.
 	 */
-	public FastList<L2SkillLearn> getAvailableCollectSkills(L2PcInstance player)
+	public List<L2SkillLearn> getAvailableCollectSkills(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
+		final List<L2SkillLearn> result = new ArrayList<>();
 		for (L2SkillLearn skill : _collectSkillTree.values())
 		{
 			final L2Skill oldSkill = player.getSkills().get(skill.getSkillId());
@@ -618,9 +609,9 @@ public final class SkillTreesData extends DocumentParser
 	 * @param player the transfer skill learning player.
 	 * @return all the available Transfer skills for a given {@code player}.
 	 */
-	public FastList<L2SkillLearn> getAvailableTransferSkills(L2PcInstance player)
+	public List<L2SkillLearn> getAvailableTransferSkills(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
+		final List<L2SkillLearn> result = new ArrayList<>();
 		ClassId classId = player.getClassId();
 		// If new classes are implemented over 3rd class, a different way should be implemented.
 		if (classId.level() == 3)
@@ -649,9 +640,9 @@ public final class SkillTreesData extends DocumentParser
 	 * @param player the transformation skill learning player.
 	 * @return all the available Transformation skills for a given {@code player}.
 	 */
-	public FastList<L2SkillLearn> getAvailableTransformSkills(L2PcInstance player)
+	public List<L2SkillLearn> getAvailableTransformSkills(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
+		final List<L2SkillLearn> result = new ArrayList<>();
 		final Race race = player.getRace();
 		for (L2SkillLearn skill : _transformSkillTree.values())
 		{
@@ -678,9 +669,9 @@ public final class SkillTreesData extends DocumentParser
 	 * @param clan the pledge skill learning clan.
 	 * @return all the available Pledge skills for a given {@code clan}.
 	 */
-	public FastList<L2SkillLearn> getAvailablePledgeSkills(L2Clan clan)
+	public List<L2SkillLearn> getAvailablePledgeSkills(L2Clan clan)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
+		final List<L2SkillLearn> result = new ArrayList<>();
 		for (L2SkillLearn skill : _pledgeSkillTree.values())
 		{
 			if (!skill.isResidencialSkill() && (clan.getLevel() >= skill.getGetLevel()))
@@ -706,9 +697,9 @@ public final class SkillTreesData extends DocumentParser
 	 * @param clan the sub-pledge skill learning clan.
 	 * @return all the available Sub-Pledge skills for a given {@code clan}.
 	 */
-	public FastList<L2SkillLearn> getAvailableSubPledgeSkills(L2Clan clan)
+	public List<L2SkillLearn> getAvailableSubPledgeSkills(L2Clan clan)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
+		final List<L2SkillLearn> result = new ArrayList<>();
 		for (L2SkillLearn skill : _subPledgeSkillTree.values())
 		{
 			if ((clan.getLevel() >= skill.getGetLevel()) && clan.isLearnableSubSkill(skill.getSkillId(), skill.getSkillLevel()))
@@ -723,9 +714,9 @@ public final class SkillTreesData extends DocumentParser
 	 * @param player the sub-class skill learning player.
 	 * @return all the available Sub-Class skills for a given {@code player}.
 	 */
-	public FastList<L2SkillLearn> getAvailableSubClassSkills(L2PcInstance player)
+	public List<L2SkillLearn> getAvailableSubClassSkills(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
+		final List<L2SkillLearn> result = new ArrayList<>();
 		for (L2SkillLearn skill : _subClassSkillTree.values())
 		{
 			if (player.getLevel() >= skill.getGetLevel())
@@ -759,9 +750,9 @@ public final class SkillTreesData extends DocumentParser
 	 * @param residenceId the id of the Castle, Fort, Territory.
 	 * @return all the available Residential skills for a given {@code residenceId}.
 	 */
-	public FastList<L2SkillLearn> getAvailableResidentialSkills(int residenceId)
+	public List<L2SkillLearn> getAvailableResidentialSkills(int residenceId)
 	{
-		final FastList<L2SkillLearn> result = new FastList<L2SkillLearn>();
+		final List<L2SkillLearn> result = new ArrayList<>();
 		for (L2SkillLearn skill : _pledgeSkillTree.values())
 		{
 			if (skill.isResidencialSkill() && skill.getResidenceIds().contains(residenceId))
@@ -831,8 +822,7 @@ public final class SkillTreesData extends DocumentParser
 	 */
 	public L2SkillLearn getClassSkill(int id, int lvl, ClassId classId)
 	{
-		final FastMap<Integer, L2SkillLearn> skills = getCompleteClassSkillTree(classId);
-		return skills.get(SkillTable.getSkillHashCode(id, lvl));
+		return getCompleteClassSkillTree(classId).get(SkillTable.getSkillHashCode(id, lvl));
 	}
 	
 	/**
@@ -919,7 +909,7 @@ public final class SkillTreesData extends DocumentParser
 	 * @param skillTree the skill tree to search the minimum get level.
 	 * @return the minimum level for a new skill for a given {@code player} and {@code skillTree}.
 	 */
-	public int getMinLevelForNewSkill(L2PcInstance player, FastMap<Integer, L2SkillLearn> skillTree)
+	public int getMinLevelForNewSkill(L2PcInstance player, Map<Integer, L2SkillLearn> skillTree)
 	{
 		int minLevel = 0;
 		if (skillTree.isEmpty())
@@ -971,7 +961,7 @@ public final class SkillTreesData extends DocumentParser
 	 */
 	public boolean isGMSkill(int skillId, int skillLevel)
 	{
-		final FastMap<Integer, L2SkillLearn> gmSkills = new FastMap<>();
+		final Map<Integer, L2SkillLearn> gmSkills = new HashMap<>();
 		gmSkills.putAll(_gameMasterSkillTree);
 		gmSkills.putAll(_gameMasterAuraSkillTree);
 		if (gmSkills.containsKey(SkillTable.getSkillHashCode(skillId, skillLevel)))
@@ -1012,8 +1002,8 @@ public final class SkillTreesData extends DocumentParser
 		int[] array;
 		
 		// Class specific skills:
-		FastMap<Integer, L2SkillLearn> tempMap;
-		final Set<ClassId> keySet = getClassSkillTrees().keySet();
+		Map<Integer, L2SkillLearn> tempMap;
+		final Set<ClassId> keySet = _classSkillTrees.keySet();
 		_skillsByClassIdHashCodes = new TIntObjectHashMap<int[]>(keySet.size());
 		for (ClassId cls : keySet)
 		{
@@ -1030,7 +1020,7 @@ public final class SkillTreesData extends DocumentParser
 		}
 		
 		// Race specific skills from Fishing and Transformation skill trees.
-		final FastList<Integer> list = new FastList<Integer>();
+		final List<Integer> list = new ArrayList<>();
 		_skillsByRaceHashCodes = new TIntObjectHashMap<int[]>(Race.values().length);
 		for (Race r : Race.values())
 		{
@@ -1157,13 +1147,13 @@ public final class SkillTreesData extends DocumentParser
 	private void report()
 	{
 		int classSkillTreeCount = 0;
-		for (FastMap<Integer, L2SkillLearn> classSkillTree : _classSkillTrees.values())
+		for (Map<Integer, L2SkillLearn> classSkillTree : _classSkillTrees.values())
 		{
 			classSkillTreeCount += classSkillTree.size();
 		}
 		
 		int trasferSkillTreeCount = 0;
-		for (FastMap<Integer, L2SkillLearn> trasferSkillTree : _transferSkillTrees.values())
+		for (Map<Integer, L2SkillLearn> trasferSkillTree : _transferSkillTrees.values())
 		{
 			trasferSkillTreeCount += trasferSkillTree.size();
 		}

+ 15 - 42
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/UITable.java

@@ -19,28 +19,26 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.LineNumberReader;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.model.entity.ActionKey;
 
 /**
- *
  * @author  mrTJO
  */
 public class UITable
 {
-	private static Logger _log = Logger.getLogger(UITable.class.getName());
+	private static final Logger _log = Logger.getLogger(UITable.class.getName());
 	
-	private Map<Integer, List<ActionKey>> _storedKeys;
-	private Map<Integer, List<Integer>> _storedCategories;
+	private Map<Integer, List<ActionKey>> _storedKeys = new HashMap<>();
+	private Map<Integer, List<Integer>> _storedCategories = new HashMap<>();
 	
 	public static UITable getInstance()
 	{
@@ -49,9 +47,6 @@ public class UITable
 	
 	private UITable()
 	{
-		_storedKeys = new FastMap<Integer, List<ActionKey>>();
-		_storedCategories = new FastMap<Integer, List<Integer>>();
-		
 		parseCatData();
 		parseKeyData();
 		_log.info("UITable: Loaded " + _storedCategories.size() + " Categories.");
@@ -60,12 +55,11 @@ public class UITable
 	
 	private void parseCatData()
 	{
-		LineNumberReader lnr = null;
-		try
+		final File uiData = new File(Config.DATAPACK_ROOT, "data/uicats_en.csv");
+		try (FileReader fr = new FileReader(uiData);
+			BufferedReader br = new BufferedReader(fr);
+			LineNumberReader lnr = new LineNumberReader(br))
 		{
-			File uiData = new File(Config.DATAPACK_ROOT, "data/uicats_en.csv");
-			lnr = new LineNumberReader(new BufferedReader(new FileReader(uiData)));
-			
 			String line = null;
 			while ((line = lnr.readLine()) != null)
 			{
@@ -88,26 +82,15 @@ public class UITable
 		{
 			_log.log(Level.WARNING, "Error while creating UI Default Categories table " + e.getMessage(), e);
 		}
-		finally
-		{
-			try
-			{
-				lnr.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 	}
 	
 	private void parseKeyData()
 	{
-		LineNumberReader lnr = null;
-		try
+		final File uiData = new File(Config.DATAPACK_ROOT, "data/uikeys_en.csv");
+		try (FileReader fr = new FileReader(uiData);
+			BufferedReader br = new BufferedReader(fr);
+			LineNumberReader lnr = new LineNumberReader(br))
 		{
-			File uiData = new File(Config.DATAPACK_ROOT, "data/uikeys_en.csv");
-			lnr = new LineNumberReader(new BufferedReader(new FileReader(uiData)));
-			
 			String line = null;
 			while ((line = lnr.readLine()) != null)
 			{
@@ -134,16 +117,6 @@ public class UITable
 		{
 			_log.log(Level.WARNING, "Error while creating UI Default Keys table " + e.getMessage(), e);
 		}
-		finally
-		{
-			try
-			{
-				lnr.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 	}
 	
 	private void insertCategory(int cat, int cmd)
@@ -152,7 +125,7 @@ public class UITable
 			_storedCategories.get(cat).add(cmd);
 		else
 		{
-			List<Integer> tmp = new FastList<Integer>();
+			List<Integer> tmp = new ArrayList<>();
 			tmp.add(cmd);
 			_storedCategories.put(cat, tmp);
 		}
@@ -165,7 +138,7 @@ public class UITable
 			_storedKeys.get(cat).add(tmk);
 		else
 		{
-			List<ActionKey> tmp = new FastList<ActionKey>();
+			List<ActionKey> tmp = new ArrayList<>();
 			tmp.add(tmk);
 			_storedKeys.put(cat, tmp);
 		}

+ 2 - 14
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/FortSiegeManager.java

@@ -153,10 +153,9 @@ public class FortSiegeManager
 	
 	private final void load()
 	{
-		InputStream is = null;
-		try
+		final File file = new File(Config.FORTSIEGE_CONFIGURATION_FILE);
+		try (InputStream is = new FileInputStream(file))
 		{
-			is = new FileInputStream(new File(Config.FORTSIEGE_CONFIGURATION_FILE));
 			Properties siegeSettings = new Properties();
 			siegeSettings.load(is);
 			
@@ -228,19 +227,8 @@ public class FortSiegeManager
 		}
 		catch (Exception e)
 		{
-			//_initialized = false;
 			_log.log(Level.WARNING, "Error while loading fortsiege data." + e.getMessage(), e);
 		}
-		finally
-		{
-			try
-			{
-				is.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 	}
 	
 	public final FastList<SiegeSpawn> getCommanderSpawnList(int _fortId)

+ 2 - 14
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/SiegeManager.java

@@ -159,10 +159,9 @@ public class SiegeManager
 	
 	private final void load()
 	{
-		InputStream is = null;
-		try
+		final File file = new File(Config.SIEGE_CONFIGURATION_FILE);
+		try (InputStream is = new FileInputStream(file))
 		{
-			is = new FileInputStream(new File(Config.SIEGE_CONFIGURATION_FILE));
 			Properties siegeSettings = new Properties();
 			siegeSettings.load(is);
 			
@@ -274,19 +273,8 @@ public class SiegeManager
 		}
 		catch (Exception e)
 		{
-			//_initialized = false;
 			_log.log(Level.WARNING, "Error while loading siege data: " + e.getMessage(), e);
 		}
-		finally
-		{
-			try
-			{
-				is.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 	}
 	
 	public final FastList<SiegeSpawn> getArtefactSpawnList(int _castleId)

+ 3 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/TerritoryWarManager.java

@@ -346,7 +346,7 @@ public class TerritoryWarManager implements Siegable
 				{
 					for(int wardId : terNew.getOwnedWardIds())
 					{
-						final FastList<L2SkillLearn> residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(wardId);
+						final List<L2SkillLearn> residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(wardId);
 						for (L2SkillLearn s : residentialSkills)
 						{
 							final L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel());
@@ -379,7 +379,7 @@ public class TerritoryWarManager implements Siegable
 				}
 				if (terOld.getOwnerClan() != null)
 				{
-					final FastList<L2SkillLearn> territorySkills = SkillTreesData.getInstance().getAvailableResidentialSkills(territoryId);
+					final List<L2SkillLearn> territorySkills = SkillTreesData.getInstance().getAvailableResidentialSkills(territoryId);
 					for (L2SkillLearn s : territorySkills)
 					{
 						final L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel());
@@ -396,7 +396,7 @@ public class TerritoryWarManager implements Siegable
 					{
 						for(int wardId : terOld.getOwnedWardIds())
 						{
-							final FastList<L2SkillLearn> wardSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(wardId);
+							final List<L2SkillLearn> wardSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(wardId);
 							for (L2SkillLearn s : wardSkills)
 							{
 								final L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel());

+ 1 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Attackable.java

@@ -667,6 +667,7 @@ public class L2Attackable extends L2Npc
 				RewardInfo reward2;
 				int[] tmp;
 				
+				// TODO: Zoey76: Rewrite, bad iteration, NPE vulnerability, possible concurrent modification.
 				for (FastMap.Entry<L2Character, RewardInfo> entry = rewards.head(), end = rewards.tail(); (entry = entry.getNext()) != end;)
 				{
 					if (entry == null)

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2CastleMagicianInstance.java

@@ -14,7 +14,7 @@
  */
 package com.l2jserver.gameserver.model.actor.instance;
 
-import javolution.util.FastList;
+import java.util.List;
 
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.SevenSigns;
@@ -366,7 +366,7 @@ public class L2CastleMagicianInstance extends L2NpcInstance implements L2SquadTr
 		{
 			if (player.isClanLeader())
 			{
-				final FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSubPledgeSkills(player.getClan());
+				final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSubPledgeSkills(player.getClan());
 				final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.SubPledge);
 				int count = 0;
 				

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2FishermanInstance.java

@@ -14,7 +14,7 @@
  */
 package com.l2jserver.gameserver.model.actor.instance;
 
-import javolution.util.FastList;
+import java.util.List;
 
 import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.datatables.SkillTreesData;
@@ -66,7 +66,7 @@ public final class L2FishermanInstance extends L2MerchantInstance
 	
 	public static void showFishSkillList(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableFishingSkills(player);
+		final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableFishingSkills(player);
 		final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.Fishing);
 		
 		int count = 0;

+ 2 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2FortSupportCaptainInstance.java

@@ -14,10 +14,9 @@
  */
 package com.l2jserver.gameserver.model.actor.instance;
 
+import java.util.List;
 import java.util.StringTokenizer;
 
-import javolution.util.FastList;
-
 import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.datatables.SkillTreesData;
 import com.l2jserver.gameserver.model.L2SkillLearn;
@@ -100,7 +99,7 @@ public class L2FortSupportCaptainInstance extends L2MerchantInstance implements
 		{
 			if (player.isClanLeader())
 			{
-				final FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSubPledgeSkills(player.getClan());
+				final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSubPledgeSkills(player.getClan());
 				final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.SubPledge);
 				int count = 0;
 				

+ 4 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2NpcInstance.java

@@ -15,9 +15,7 @@
 package com.l2jserver.gameserver.model.actor.instance;
 
 import java.util.List;
-
-import javolution.util.FastList;
-import javolution.util.FastMap;
+import java.util.Map;
 
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.datatables.SkillTable;
@@ -90,7 +88,7 @@ public class L2NpcInstance extends L2Npc
 		final int npcId = npc.getTemplate().getNpcId();
 		if (npcId == 32611) //Tolonis (Officer)
 		{
-			final FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableCollectSkills(player);
+			final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableCollectSkills(player);
 			final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.Collect);
 			
 			int counts = 0;
@@ -150,7 +148,7 @@ public class L2NpcInstance extends L2Npc
 		}
 		
 		// Normal skills, No LearnedByFS, no AutoGet skills.
-		final FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(player, classId, false, false);
+		final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(player, classId, false, false);
 		final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.Class);
 		int count = 0;
 		player.setLearningClass(classId);
@@ -165,7 +163,7 @@ public class L2NpcInstance extends L2Npc
 		
 		if (count == 0)
 		{
-			final FastMap<Integer, L2SkillLearn> skillTree = SkillTreesData.getInstance().getCompleteClassSkillTree(classId);
+			final Map<Integer, L2SkillLearn> skillTree = SkillTreesData.getInstance().getCompleteClassSkillTree(classId);
 			final int minLevel = SkillTreesData.getInstance().getMinLevelForNewSkill(player, skillTree);
 			if (minLevel > 0)
 			{

+ 6 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -24,6 +24,7 @@ import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -2930,8 +2931,7 @@ public final class L2PcInstance extends L2Playable
 		int skillCounter = 0;
 		
 		// Get available skills
-		FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(this, getClassId(), includedByFs, includeAutoGet);
-		
+		List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSkills(this, getClassId(), includedByFs, includeAutoGet);
 		while (skills.size() > unLearnable)
 		{
 			for (L2SkillLearn s: skills)
@@ -2976,7 +2976,7 @@ public final class L2PcInstance extends L2Playable
 	public void giveAvailableAutoGetSkills()
 	{
 		// Get available skills
-		final FastList<L2SkillLearn> autoGetSkills = SkillTreesData.getInstance().getAvailableAutoGetSkills(this);
+		final List<L2SkillLearn> autoGetSkills = SkillTreesData.getInstance().getAvailableAutoGetSkills(this);
 		final SkillTable st = SkillTable.getInstance();
 		L2Skill skill;
 		for (L2SkillLearn s : autoGetSkills)
@@ -10869,9 +10869,8 @@ public final class L2PcInstance extends L2Playable
 			}
 			
 			final ClassId subTemplate = ClassId.getClassId(classId);
-			final FastMap<Integer, L2SkillLearn> skillTree = SkillTreesData.getInstance().getCompleteClassSkillTree(subTemplate);
-			final FastMap<Integer, L2Skill> prevSkillList = new FastMap<Integer, L2Skill>();
-			
+			final Map<Integer, L2SkillLearn> skillTree = SkillTreesData.getInstance().getCompleteClassSkillTree(subTemplate);
+			final Map<Integer, L2Skill> prevSkillList = new HashMap<>();
 			for (L2SkillLearn skillInfo : skillTree.values())
 			{
 				if (skillInfo.getGetLevel() <= 40)
@@ -15146,8 +15145,7 @@ public final class L2PcInstance extends L2Playable
 	private void deacreaseSkillLevel(int id)
 	{
 		int nextLevel = -1;
-		final FastMap<Integer, L2SkillLearn> skillTree = SkillTreesData.getInstance().getCompleteClassSkillTree(getClassId());
-		
+		final Map<Integer, L2SkillLearn> skillTree = SkillTreesData.getInstance().getCompleteClassSkillTree(getClassId());
 		for (L2SkillLearn sl : skillTree.values())
 		{
 			if (sl.getSkillId() == id && nextLevel < sl.getSkillLevel() && getLevel() >= (sl.getGetLevel() - 9))

+ 2 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2TrainerHealersInstance.java

@@ -15,8 +15,7 @@
 package com.l2jserver.gameserver.model.actor.instance;
 
 import java.util.Collection;
-
-import javolution.util.FastList;
+import java.util.List;
 
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.datatables.SkillTable;
@@ -139,7 +138,7 @@ public final class L2TrainerHealersInstance extends L2TrainerInstance
 	 */
 	public static void showTransferSkillList(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableTransferSkills(player);
+		final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableTransferSkills(player);
 		final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.Transfer);
 		int count = 0;
 		

+ 3 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2TransformManagerInstance.java

@@ -14,7 +14,7 @@
  */
 package com.l2jserver.gameserver.model.actor.instance;
 
-import javolution.util.FastList;
+import java.util.List;
 
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.datatables.MultiSell;
@@ -274,7 +274,7 @@ public final class L2TransformManagerInstance extends L2MerchantInstance
 	 */
 	public static void showTransformSkillList(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableTransformSkills(player);
+		final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableTransformSkills(player);
 		final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.Transform);
 		int counts = 0;
 		
@@ -315,7 +315,7 @@ public final class L2TransformManagerInstance extends L2MerchantInstance
 	 */
 	public static void showSubClassSkillList(L2PcInstance player)
 	{
-		final FastList<L2SkillLearn> subClassSkills = SkillTreesData.getInstance().getAvailableSubClassSkills(player);
+		final List<L2SkillLearn> subClassSkills = SkillTreesData.getInstance().getAvailableSubClassSkills(player);
 		final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.SubClass);
 		int count = 0;
 		

+ 2 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2VillageMasterInstance.java

@@ -15,13 +15,12 @@
 package com.l2jserver.gameserver.model.actor.instance;
 
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 import java.util.logging.Logger;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 
-import javolution.util.FastList;
-
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.datatables.ClanTable;
 import com.l2jserver.gameserver.datatables.ClassListData;
@@ -1109,7 +1108,7 @@ public class L2VillageMasterInstance extends L2NpcInstance
 			return;
 		}
 		
-		final FastList<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailablePledgeSkills(player.getClan());
+		final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailablePledgeSkills(player.getClan());
 		final AcquireSkillList asl = new AcquireSkillList(AcquireSkillType.Pledge);
 		int counts = 0;
 		

+ 8 - 13
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPlayerCanSweep.java

@@ -46,32 +46,27 @@ public class ConditionPlayerCanSweep extends Condition
 	@Override
 	public boolean testImpl(Env env)
 	{
-		boolean canSweep = env.getPlayer() != null;
-		if (canSweep)
+		boolean canSweep = false;
+		if (env.getPlayer() != null)
 		{
 			final L2PcInstance sweeper = env.getPlayer();
 			final L2Skill sweep = env.getSkill();
-			canSweep &= (sweep != null);
-			if (canSweep)
+			if (sweep != null)
 			{
 				final L2Object[] targets = sweep.getTargetList(sweeper);
-				canSweep &= (targets != null);
-				if (canSweep)
+				if (targets != null)
 				{
 					L2Attackable target;
 					for (L2Object objTarget : targets)
 					{
-						canSweep &= (objTarget != null) && (objTarget instanceof L2Attackable);
-						if (canSweep)
+						if (objTarget instanceof L2Attackable)
 						{
 							target = (L2Attackable) objTarget;
-							canSweep &= target.isDead();
-							if (canSweep)
+							if (target.isDead())
 							{
-								canSweep &= target.isSpoil();
-								if (canSweep)
+								if (target.isSpoil())
 								{
-									canSweep &= target.checkSpoilOwner(sweeper, true);
+									canSweep = target.checkSpoilOwner(sweeper, true);
 									canSweep &= target.checkCorpseTime(sweeper, maxSweepTime, true);
 									canSweep &= sweeper.getInventory().checkInventorySlotsAndWeight(target.getSpoilLootItems(), true, true);
 								}

+ 22 - 29
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/Castle.java

@@ -26,7 +26,6 @@ import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javolution.util.FastList;
 import javolution.util.FastMap;
 
 import com.l2jserver.Config;
@@ -65,10 +64,10 @@ public class Castle
 {
 	protected static final Logger _log = Logger.getLogger(Castle.class.getName());
 	
-	private List<CropProcure> _procure = new ArrayList<CropProcure>();
-	private List<SeedProduction> _production = new ArrayList<SeedProduction>();
-	private List<CropProcure> _procureNext = new ArrayList<CropProcure>();
-	private List<SeedProduction> _productionNext = new ArrayList<SeedProduction>();
+	private List<CropProcure> _procure = new ArrayList<>();
+	private List<SeedProduction> _production = new ArrayList<>();
+	private List<CropProcure> _procureNext = new ArrayList<>();
+	private List<SeedProduction> _productionNext = new ArrayList<>();
 	private boolean _isNextPeriodApproved = false;
 	
 	private static final String CASTLE_MANOR_DELETE_PRODUCTION = "DELETE FROM castle_manor_production WHERE castle_id=?;";
@@ -79,8 +78,8 @@ public class Castle
 	private static final String CASTLE_UPDATE_SEED = "UPDATE castle_manor_production SET can_produce=? WHERE seed_id=? AND castle_id=? AND period=?";
 	
 	private int _castleId = 0;
-	private List<L2DoorInstance> _doors = new FastList<L2DoorInstance>();
-	private List<String> _doorDefault = new FastList<String>();
+	private List<L2DoorInstance> _doors = new ArrayList<>();
+	private List<String> _doorDefault = new ArrayList<>();
 	private String _name = "";
 	private int _ownerId = 0;
 	private Siege _siege = null;
@@ -95,10 +94,10 @@ public class Castle
 	private L2CastleZone _castleZone = null;
 	private L2ResidenceTeleportZone _teleZone;
 	private L2Clan _formerOwner = null;
-	private List<L2ArtefactInstance> _artefacts = new ArrayList<L2ArtefactInstance>(1);
+	private List<L2ArtefactInstance> _artefacts = new ArrayList<>(1);
 	private TIntIntHashMap _engrave = new TIntIntHashMap(1);
 	private Map<Integer, CastleFunction> _function;
-	private FastList<L2Skill> _residentialSkills = new FastList<L2Skill>();
+	private List<L2Skill> _residentialSkills = new ArrayList<>();
 	private int _bloodAlliance = 0;
 	
 	/** Castle Functions */
@@ -259,7 +258,7 @@ public class Castle
 		load();
 		loadDoor();
 		_function = new FastMap<Integer, CastleFunction>();
-		final FastList<L2SkillLearn> residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(castleId);
+		final List<L2SkillLearn> residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(castleId);
 		for (L2SkillLearn s : residentialSkills)
 		{
 			final L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel());
@@ -1328,7 +1327,7 @@ public class Castle
 			statement.setInt(1, getCastleId());
 			statement.execute();
 			statement.close();
-			if (_procure != null && _procure.size() > 0)
+			if (!_procure.isEmpty())
 			{
 				int count = 0;
 				StringBuilder query = new StringBuilder();
@@ -1351,7 +1350,7 @@ public class Castle
 					statement.close();
 				}
 			}
-			if (_procureNext != null && _procureNext.size() > 0)
+			if (!_procureNext.isEmpty())
 			{
 				int count = 0;
 				String query = "INSERT INTO castle_manor_procure VALUES ";
@@ -1543,26 +1542,23 @@ public class Castle
 		}
 	}
 	
-	public FastList<L2Skill> getResidentialSkills()
+	public List<L2Skill> getResidentialSkills()
 	{
 		return _residentialSkills;
 	}
 	
 	public void giveResidentialSkills(L2PcInstance player)
 	{
-		if ((_residentialSkills != null) && !_residentialSkills.isEmpty())
+		for (L2Skill sk : _residentialSkills)
 		{
-			for (L2Skill sk : _residentialSkills)
-			{
-				player.addSkill(sk, false);
-			}
+			player.addSkill(sk, false);
 		}
 		Territory territory = TerritoryWarManager.getInstance().getTerritory(getCastleId());
 		if (territory != null && territory.getOwnedWardIds().contains(getCastleId() + 80))
 		{
 			for (int wardId : territory.getOwnedWardIds())
 			{
-				final FastList<L2SkillLearn> territorySkills = SkillTreesData.getInstance().getAvailableResidentialSkills(wardId);
+				final List<L2SkillLearn> territorySkills = SkillTreesData.getInstance().getAvailableResidentialSkills(wardId);
 				for (L2SkillLearn s : territorySkills)
 				{
 					final L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel());
@@ -1581,18 +1577,15 @@ public class Castle
 	
 	public void removeResidentialSkills(L2PcInstance player)
 	{
-		if (_residentialSkills != null && !_residentialSkills.isEmpty())
+		for (L2Skill sk : _residentialSkills)
 		{
-			for (L2Skill sk : _residentialSkills)
-			{
-				player.removeSkill(sk, false, true);
-			}
+			player.removeSkill(sk, false, true);
 		}
 		if (TerritoryWarManager.getInstance().getTerritory(getCastleId()) != null)
 		{
 			for (int wardId : TerritoryWarManager.getInstance().getTerritory(getCastleId()).getOwnedWardIds())
 			{
-				final FastList<L2SkillLearn> territorySkills = SkillTreesData.getInstance().getAvailableResidentialSkills(wardId);
+				final List<L2SkillLearn> territorySkills = SkillTreesData.getInstance().getAvailableResidentialSkills(wardId);
 				for (L2SkillLearn s : territorySkills)
 				{
 					final L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel());
@@ -1627,10 +1620,10 @@ public class Castle
 	
 	public void resetManor()
 	{
-		setCropProcure(new FastList<CropProcure>(), CastleManorManager.PERIOD_CURRENT);
-		setCropProcure(new FastList<CropProcure>(), CastleManorManager.PERIOD_NEXT);
-		setSeedProduction(new FastList<SeedProduction>(), CastleManorManager.PERIOD_CURRENT);
-		setSeedProduction(new FastList<SeedProduction>(), CastleManorManager.PERIOD_NEXT);
+		setCropProcure(new ArrayList<CropProcure>(), CastleManorManager.PERIOD_CURRENT);
+		setCropProcure(new ArrayList<CropProcure>(), CastleManorManager.PERIOD_NEXT);
+		setSeedProduction(new ArrayList<SeedProduction>(), CastleManorManager.PERIOD_CURRENT);
+		setSeedProduction(new ArrayList<SeedProduction>(), CastleManorManager.PERIOD_NEXT);
 		if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
 		{
 			saveCropData();

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/Fort.java

@@ -249,7 +249,7 @@ public class Fort
 		loadDoor();
 		loadFlagPoles();
 		_function = new FastMap<Integer, FortFunction>();
-		FastList<L2SkillLearn> residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(fortId);
+		final List<L2SkillLearn> residentialSkills = SkillTreesData.getInstance().getAvailableResidentialSkills(fortId);
 		for (L2SkillLearn s : residentialSkills)
 		{
 			L2Skill sk = SkillTable.getInstance().getInfo(s.getSkillId(), s.getSkillLevel());

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/zone/type/L2EffectZone.java

@@ -240,7 +240,7 @@ public class L2EffectZone extends L2ZoneType
 							for (Entry<Integer, Integer> e : _skills.entrySet())
 							{
 								L2Skill skill = getSkill(e.getKey(), e.getValue());
-								if (_bypassConditions || skill != null && skill.checkCondition(temp, temp, false))
+								if ((skill != null) && (_bypassConditions || skill.checkCondition(temp, temp, false)))
 								{
 									if (temp.getFirstEffect(e.getKey()) == null)
 									{

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/network/clientpackets/RequestGMCommand.java

@@ -74,7 +74,7 @@ public final class RequestGMCommand extends L2GameClientPacket
 			}
 			case 2: // player clan
 			{
-				if (player.getClan() != null)
+				if ((player != null) && (player.getClan() != null))
 					sendPacket(new GMViewPledgeInfo(player.getClan(),player));
 				break;
 			}

+ 6 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/network/gameserverpackets/BlowFishKey.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.network.gameserverpackets;
 
-import java.security.GeneralSecurityException;
 import java.security.interfaces.RSAPublicKey;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -25,11 +24,11 @@ import com.l2jserver.util.network.BaseSendablePacket;
 
 /**
  * @author -Wooden-
- *
  */
 public class BlowFishKey extends BaseSendablePacket
 {
 	private static Logger _log = Logger.getLogger(BlowFishKey.class.getName());
+	
 	/**
 	 * @param blowfishKey
 	 * @param publicKey
@@ -37,19 +36,18 @@ public class BlowFishKey extends BaseSendablePacket
 	public BlowFishKey(byte[] blowfishKey, RSAPublicKey publicKey)
 	{
 		writeC(0x00);
-		byte[] encrypted =null;
 		try
 		{
-			Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
+			final Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
 			rsaCipher.init(Cipher.ENCRYPT_MODE, publicKey);
-			encrypted = rsaCipher.doFinal(blowfishKey);
+			byte[] encrypted = rsaCipher.doFinal(blowfishKey);
+			writeD(encrypted.length);
+			writeB(encrypted);
 		}
-		catch(GeneralSecurityException e)
+		catch(Exception e)
 		{
 			_log.log(Level.SEVERE, "Error While encrypting blowfish key for transmision (Crypt error): " + e.getMessage(), e);
 		}
-		writeD(encrypted.length);
-		writeB(encrypted);
 	}
 	
 	@Override

+ 4 - 15
L2J_Server_BETA/java/com/l2jserver/gameserver/pathfinding/geonodes/GeoPathFinding.java

@@ -403,11 +403,11 @@ public class GeoPathFinding extends PathFinding
 		_log.info("PathFinding Engine: - Loading: " + fname + " -> region offset: " + regionoffset + "X: " + rx + " Y: " + ry);
 		File Pn = new File(fname);
 		int node = 0, size, index = 0;
-		FileChannel roChannel = null;
-		try
+		
+		// Create a read-only memory-mapped file
+		try (RandomAccessFile raf = new RandomAccessFile(Pn, "r");
+			FileChannel roChannel = raf.getChannel())
 		{
-			// Create a read-only memory-mapped file
-			roChannel = new RandomAccessFile(Pn, "r").getChannel();
 			size = (int) roChannel.size();
 			MappedByteBuffer nodes;
 			if (Config.FORCE_GEODATA) //Force O/S to Loads this buffer's content into physical memory.
@@ -432,17 +432,6 @@ public class GeoPathFinding extends PathFinding
 		{
 			_log.log(Level.WARNING, "Failed to Load PathNode File: " + fname + " : " + e.getMessage(), e);
 		}
-		finally
-		{
-			try
-			{
-				roChannel.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
-		
 	}
 	
 	@SuppressWarnings("synthetic-access")

+ 2 - 19
L2J_Server_BETA/java/com/l2jserver/gameserver/scripting/L2ScriptEngineManager.java

@@ -468,16 +468,9 @@ public final class L2ScriptEngineManager
 		String name = script.getName() + ".error.log";
 		if (dir != null)
 		{
-			File file = new File(dir + "/" + name);
-			FileOutputStream fos = null;
-			try
+			final File file = new File(dir + "/" + name);
+			try (FileOutputStream fos = new FileOutputStream(file))
 			{
-				if (!file.exists())
-				{
-					file.createNewFile();
-				}
-				
-				fos = new FileOutputStream(file);
 				String errorHeader = "Error on: " + file.getCanonicalPath() + "\r\nLine: " + e.getLineNumber() + " - Column: "
 				+ e.getColumnNumber() + "\r\n\r\n";
 				fos.write(errorHeader.getBytes());
@@ -489,16 +482,6 @@ public final class L2ScriptEngineManager
 				_log.log(Level.WARNING, "Failed executing script: " + script.getAbsolutePath() + "\r\n" + e.getMessage()
 						+ "Additionally failed when trying to write an error report on script directory. Reason: " + ioe.getMessage(), ioe);
 			}
-			finally
-			{
-				try
-				{
-					fos.close();
-				}
-				catch (Exception e1)
-				{
-				}
-			}
 		}
 		else
 		{

+ 13 - 27
L2J_Server_BETA/java/com/l2jserver/gameserver/util/JarClassLoader.java

@@ -56,21 +56,23 @@ public class JarClassLoader extends ClassLoader
 	private byte[] loadClassData(String name) throws IOException
 	{
 		byte[] classData = null;
+		final String fileName = name.replace('.', '/') + ".class";
 		for (String jarFile : _jars)
 		{
-			ZipFile zipFile = null;
-			DataInputStream zipStream = null;
-			try
+			
+			final File file = new File(jarFile);
+			try (ZipFile zipFile = new ZipFile(file);)
 			{
-				File file = new File(jarFile);
-				zipFile = new ZipFile(file);
-				String fileName = name.replace('.', '/') + ".class";
-				ZipEntry entry = zipFile.getEntry(fileName);
+				final ZipEntry entry = zipFile.getEntry(fileName);
 				if (entry == null)
+				{
 					continue;
+				}
 				classData = new byte[(int) entry.getSize()];
-				zipStream = new DataInputStream(zipFile.getInputStream(entry));
-				zipStream.readFully(classData, 0, (int) entry.getSize());
+				try (DataInputStream zipStream = new DataInputStream(zipFile.getInputStream(entry)))
+				{
+					zipStream.readFully(classData, 0, (int) entry.getSize());
+				}
 				break;
 			}
 			catch (IOException e)
@@ -78,27 +80,11 @@ public class JarClassLoader extends ClassLoader
 				_log.log(Level.WARNING, jarFile + ": " + e.getMessage(), e);
 				continue;
 			}
-			finally
-			{
-				try
-				{
-					zipFile.close();
-				}
-				catch (Exception e)
-				{
-				}
-				
-				try
-				{
-					zipStream.close();
-				}
-				catch (Exception e)
-				{
-				}
-			}
 		}
 		if (classData == null)
+		{
 			throw new IOException("class not found in " + _jars);
+		}
 		return classData;
 	}
 }

+ 5 - 36
L2J_Server_BETA/java/com/l2jserver/loginserver/L2LoginServer.java

@@ -16,7 +16,6 @@ package com.l2jserver.loginserver;
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -206,31 +205,19 @@ public final class L2LoginServer
 	
 	private void loadBanFile()
 	{
-		File bannedFile = new File("./banned_ip.cfg");
+		final File bannedFile = new File("./banned_ip.cfg");
 		if (bannedFile.exists() && bannedFile.isFile())
 		{
-			FileInputStream fis = null;
-			try
-			{
-				fis = new FileInputStream(bannedFile);
-			}
-			catch (FileNotFoundException e)
-			{
-				_log.log(Level.WARNING, "Failed to load banned IPs file (" + bannedFile.getName() + ") for reading. Reason: " + e.getMessage(), e);
-				return;
-			}
-			
-			LineNumberReader reader = null;
 			String line;
 			String[] parts;
-			try
+			try (FileInputStream fis = new FileInputStream(bannedFile);
+				InputStreamReader is = new InputStreamReader(fis);
+				LineNumberReader reader = new LineNumberReader(is))
 			{
-				reader = new LineNumberReader(new InputStreamReader(fis));
-				
 				while ((line = reader.readLine()) != null)
 				{
 					line = line.trim();
-					// check if this line isnt a comment line
+					// check if this line isn't a comment line
 					if (line.length() > 0 && line.charAt(0) != '#')
 					{
 						// split comments if any
@@ -273,24 +260,6 @@ public final class L2LoginServer
 			{
 				_log.log(Level.WARNING, "Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage(), e);
 			}
-			finally
-			{
-				try
-				{
-					reader.close();
-				}
-				catch (Exception e)
-				{
-				}
-				
-				try
-				{
-					fis.close();
-				}
-				catch (Exception e)
-				{
-				}
-			}
 			_log.info("Loaded " + LoginController.getInstance().getBannedIps().size() + " IP Bans.");
 		}
 		else

+ 2 - 13
L2J_Server_BETA/java/com/l2jserver/status/GameStatusThread.java

@@ -78,11 +78,10 @@ public class GameStatusThread extends Thread
 		if (Config.DEVELOPER)
 			telnetOutput(2, "");
 		
-		InputStream telnetIS = null;
-		try
+		final File file = new File(Config.TELNET_FILE);
+		try (InputStream telnetIS = new FileInputStream(file);)
 		{
 			Properties telnetSettings = new Properties();
-			telnetIS = new FileInputStream(new File(Config.TELNET_FILE));
 			telnetSettings.load(telnetIS);
 			
 			String HostList = telnetSettings.getProperty("ListOfHosts", "127.0.0.1,localhost,::1");
@@ -110,16 +109,6 @@ public class GameStatusThread extends Thread
 				telnetOutput(4, "");
 			telnetOutput(1, "Error: " + e);
 		}
-		finally
-		{
-			try
-			{
-				telnetIS.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 		
 		if (Config.DEVELOPER)
 			telnetOutput(4, "Allow IP: " + result);

+ 2 - 13
L2J_Server_BETA/java/com/l2jserver/status/LoginStatusThread.java

@@ -70,11 +70,10 @@ public class LoginStatusThread extends Thread
 		if (Config.DEVELOPER)
 			telnetOutput(2, "");
 		
-		InputStream telnetIS = null;
-		try
+		final File file = new File(Config.TELNET_FILE);
+		try (InputStream telnetIS = new FileInputStream(file))
 		{
 			Properties telnetSettings = new Properties();
-			telnetIS = new FileInputStream(new File(Config.TELNET_FILE));
 			telnetSettings.load(telnetIS);
 			
 			String HostList = telnetSettings.getProperty("ListOfHosts", "127.0.0.1,localhost,::1");
@@ -102,16 +101,6 @@ public class LoginStatusThread extends Thread
 				telnetOutput(4, "");
 			telnetOutput(1, "Error: " + e);
 		}
-		finally
-		{
-			try
-			{
-				telnetIS.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 		
 		if (Config.DEVELOPER)
 			telnetOutput(4, "Allow IP: " + result);

+ 9 - 4
L2J_Server_BETA/java/com/l2jserver/tools/dbinstaller/console/DBInstallerConsole.java

@@ -68,15 +68,20 @@ public class DBInstallerConsole implements DBOutputInterface
 			{
 				rt = new RunTasks(this, db, dir, cleanUp, true);
 			}
-			else
-				System.exit(0);
 		}
 		else if (resp.equalsIgnoreCase("u"))
+		{
 			rt = new RunTasks(this, db, dir, cleanUp, false);
+		}
+		
+		if (rt != null)
+		{
+			rt.run();
+		}
 		else
+		{
 			System.exit(0);
-		
-		rt.run();
+		}
 	}
 	
 	@Override

+ 155 - 290
L2J_Server_BETA/java/com/l2jserver/util/Base64.java

@@ -15,9 +15,19 @@
 package com.l2jserver.util;
 
 import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FilterInputStream;
+import java.io.FilterOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
 import java.util.logging.Logger;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
 
 /**
  * Encodes and decodes to and from Base64 notation.
@@ -103,13 +113,13 @@ public class Base64
 		try
 		{
 			__bytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes(PREFERRED_ENCODING);
-		} // end try
-		catch (java.io.UnsupportedEncodingException use)
+		}
+		catch (UnsupportedEncodingException use)
 		{
 			__bytes = _NATIVE_ALPHABET; // Fall back to native encoding
-		} // end catch
+		}
 		ALPHABET = __bytes;
-	} // end static
+	}
 	
 	/**
 	 * Translates a Base64 value to either its 6-bit reconstruction value or a
@@ -213,7 +223,7 @@ public class Base64
 	{
 		encode3to4(threeBytes, 0, numSigBytes, b4, 0);
 		return b4;
-	} // end encode3to4
+	}
 	
 	/**
 	 * Encodes up to three bytes of the array <var>source</var> and writes the
@@ -283,8 +293,8 @@ public class Base64
 				
 			default:
 				return destination;
-		} // end switch
-	} // end encode3to4
+		}
+	}
 	
 	/**
 	 * Serializes an object and returns the Base64-encoded version of that
@@ -297,10 +307,10 @@ public class Base64
 	 * @return The Base64-encoded object
 	 * @since 1.4
 	 */
-	public static String encodeObject(java.io.Serializable serializableObject)
+	public static String encodeObject(Serializable serializableObject)
 	{
 		return encodeObject(serializableObject, NO_OPTIONS);
-	} // end encodeObject
+	}
 	
 	/**
 	 * Serializes an object and returns the Base64-encoded version of that
@@ -329,83 +339,40 @@ public class Base64
 	 * @see Base64#DONT_BREAK_LINES
 	 * @since 2.0
 	 */
-	public static String encodeObject(java.io.Serializable serializableObject, int options)
+	public static String encodeObject(Serializable serializableObject, int options)
 	{
-		// Streams
-		java.io.ByteArrayOutputStream baos = null;
-		java.io.OutputStream b64os = null;
-		java.io.ObjectOutputStream oos = null;
-		java.util.zip.GZIPOutputStream gzos = null;
-		
 		// Isolate options
 		int gzip = (options & GZIP);
 		int dontBreakLines = (options & DONT_BREAK_LINES);
-		
-		try
+		// ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
+		byte[] value = null;
+		try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
+			Base64.OutputStream b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines);
+			ObjectOutputStream oos = new ObjectOutputStream((gzip == GZIP) ? new GZIPOutputStream(b64os) : b64os))
 		{
-			// ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
-			baos = new java.io.ByteArrayOutputStream();
-			b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines);
-			
-			// GZip?
-			if (gzip == GZIP)
-			{
-				gzos = new java.util.zip.GZIPOutputStream(b64os);
-				oos = new java.io.ObjectOutputStream(gzos);
-			} // end if: gzip
-			else
-				oos = new java.io.ObjectOutputStream(b64os);
-			
 			oos.writeObject(serializableObject);
-		} // end try
-		catch (java.io.IOException e)
+			value = baos.toByteArray();
+		}
+		catch (IOException e)
 		{
 			e.printStackTrace();
 			return null;
-		} // end catch
-		finally
+		}
+		
+		// Return value according to relevant encoding.
+		if (value != null)
 		{
 			try
 			{
-				oos.close();
+				return new String(value, PREFERRED_ENCODING);
 			}
-			catch (Exception e)
+			catch (UnsupportedEncodingException uue)
 			{
+				return new String(value);
 			}
-			try
-			{
-				gzos.close();
-			}
-			catch (Exception e)
-			{
-			}
-			try
-			{
-				b64os.close();
-			}
-			catch (Exception e)
-			{
-			}
-			try
-			{
-				baos.close();
-			}
-			catch (Exception e)
-			{
-			}
-		} // end finally
-		
-		// Return value according to relevant encoding.
-		try
-		{
-			return new String(baos.toByteArray(), PREFERRED_ENCODING);
-		} // end try
-		catch (java.io.UnsupportedEncodingException uue)
-		{
-			return new String(baos.toByteArray());
-		} // end catch
-		
-	} // end encode
+		}
+		return null;
+	}
 	
 	/**
 	 * Encodes a byte array into Base64 notation. Does not GZip-compress data.
@@ -418,7 +385,7 @@ public class Base64
 	public static String encodeBytes(byte[] source)
 	{
 		return encodeBytes(source, 0, source.length, NO_OPTIONS);
-	} // end encodeBytes
+	}
 	
 	/**
 	 * Encodes a byte array into Base64 notation.
@@ -449,7 +416,7 @@ public class Base64
 	public static String encodeBytes(byte[] source, int options)
 	{
 		return encodeBytes(source, 0, source.length, options);
-	} // end encodeBytes
+	}
 	
 	/**
 	 * Encodes a byte array into Base64 notation. Does not GZip-compress data.
@@ -466,7 +433,7 @@ public class Base64
 	public static String encodeBytes(byte[] source, int off, int len)
 	{
 		return encodeBytes(source, off, len, NO_OPTIONS);
-	} // end encodeBytes
+	}
 	
 	/**
 	 * Encodes a byte array into Base64 notation.
@@ -507,60 +474,34 @@ public class Base64
 		// Compress?
 		if (gzip == GZIP)
 		{
-			java.io.ByteArrayOutputStream baos = null;
-			java.util.zip.GZIPOutputStream gzos = null;
-			Base64.OutputStream b64os = null;
-			
-			try
+			// GZip -> Base64 -> ByteArray
+			byte[] value = null;
+			try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
+				Base64.OutputStream b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines);
+				GZIPOutputStream gzos = new GZIPOutputStream(b64os))
 			{
-				// GZip -> Base64 -> ByteArray
-				baos = new java.io.ByteArrayOutputStream();
-				b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines);
-				gzos = new java.util.zip.GZIPOutputStream(b64os);
-				
 				gzos.write(source, off, len);
-				gzos.close();
-			} // end try
-			catch (java.io.IOException e)
+				value = baos.toByteArray();
+			}
+			catch (IOException e)
 			{
 				_log.warning("Base64: " + e.getMessage());
 				return null;
-			} // end catch
-			finally
+			}
+			
+			// Return value according to relevant encoding.
+			if (value != null)
 			{
 				try
 				{
-					gzos.close();
-				}
-				catch (Exception e)
-				{
-				}
-				try
-				{
-					b64os.close();
+					return new String(value, PREFERRED_ENCODING);
 				}
-				catch (Exception e)
+				catch (UnsupportedEncodingException uue)
 				{
+					return new String(value);
 				}
-				try
-				{
-					baos.close();
-				}
-				catch (Exception e)
-				{
-				}
-			} // end finally
-			
-			// Return value according to relevant encoding.
-			try
-			{
-				return new String(baos.toByteArray(), PREFERRED_ENCODING);
-			} // end try
-			catch (java.io.UnsupportedEncodingException uue)
-			{
-				return new String(baos.toByteArray());
-			} // end catch
-		} // end if: compress
+			}
+		}
 		
 		// Convert option to boolean in way that code likes it.
 		boolean breakLines = dontBreakLines == 0;
@@ -583,27 +524,25 @@ public class Base64
 				outBuff[e + 4] = NEW_LINE;
 				e++;
 				lineLength = 0;
-			} // end if: end of line
+			}
 		} // en dfor: each piece of array
 		
 		if (d < len)
 		{
 			encode3to4(source, d + off, len - d, outBuff, e);
 			e += 4;
-		} // end if: some padding needed
+		}
 		
 		// Return value according to relevant encoding.
 		try
 		{
 			return new String(outBuff, 0, e, PREFERRED_ENCODING);
-		} // end try
-		catch (java.io.UnsupportedEncodingException uue)
+		}
+		catch (UnsupportedEncodingException uue)
 		{
 			return new String(outBuff, 0, e);
-		} // end catch
-		// end else: don't compress
-		
-	} // end encodeBytes
+		}
+	}
 	
 	/*  D E C O D I N G M E T H O D S */
 	
@@ -713,9 +652,9 @@ public class Base64
 				System.out.println(StringUtil.concat(String.valueOf(source[srcOffset + 2]), ": ", String.valueOf(DECODABET[source[srcOffset + 2]])));
 				System.out.println(StringUtil.concat(String.valueOf(source[srcOffset + 3]), ": ", String.valueOf(DECODABET[source[srcOffset + 3]])));
 				return -1;
-			} // end catch
+			}
 		}
-	} // end decodeToBytes
+	}
 	
 	/**
 	 * Very low-level access to decoding ASCII characters in the form of a byte
@@ -747,8 +686,7 @@ public class Base64
 			sbiCrop = (byte) (source[i] & 0x7f); // Only the low seven bits
 			sbiDecode = DECODABET[sbiCrop];
 			
-			if (sbiDecode >= WHITE_SPACE_ENC) // White space, Equals sign or
-				// better
+			if (sbiDecode >= WHITE_SPACE_ENC) // White space, Equals sign or better
 			{
 				if (sbiDecode >= EQUALS_SIGN_ENC)
 				{
@@ -770,13 +708,13 @@ public class Base64
 			{
 				System.err.println(StringUtil.concat("Bad Base64 input character at ", String.valueOf(i), ": ", String.valueOf(source[i]), "(decimal)"));
 				return null;
-			} // end else:
-		} // each input character
+			}
+		}
 		
 		byte[] out = new byte[outBuffPosn];
 		System.arraycopy(outBuff, 0, out, 0, outBuffPosn);
 		return out;
-	} // end decode
+	}
 	
 	/**
 	 * Decodes data from Base64 notation, automatically detecting
@@ -793,82 +731,47 @@ public class Base64
 		try
 		{
 			bytes = s.getBytes(PREFERRED_ENCODING);
-		} // end try
-		catch (java.io.UnsupportedEncodingException uee)
+		}
+		catch (UnsupportedEncodingException uee)
 		{
 			bytes = s.getBytes();
-		} // end catch
-		// </change>
+		}
 		
 		// Decode
 		bytes = decode(bytes, 0, bytes.length);
 		
 		// Check to see if it's gzip-compressed
 		// GZIP Magic Two-Byte Number: 0x8b1f (35615)
-		if (bytes != null && // In case decoding returned null
-				bytes.length >= 2)
+		// In case decoding returned null
+		if ((bytes != null) && (bytes.length >= 2))
 		{
-			
-			int head = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
-			if (bytes.length >= 4 && // Don't want to get ArrayIndexOutOfBounds
-					// exception
-					java.util.zip.GZIPInputStream.GZIP_MAGIC == head)
+			final int head = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
+			// Don't want to get ArrayIndexOutOfBounds exception
+			if (bytes.length >= 4 && GZIPInputStream.GZIP_MAGIC == head)
 			{
-				java.io.ByteArrayInputStream bais = null;
-				java.util.zip.GZIPInputStream gzis = null;
-				java.io.ByteArrayOutputStream baos = null;
 				byte[] buffer = new byte[2048];
 				int length = 0;
-				
-				try
+				try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+					GZIPInputStream gzis = new GZIPInputStream(bais);
+					ByteArrayOutputStream baos = new ByteArrayOutputStream())
 				{
-					baos = new java.io.ByteArrayOutputStream();
-					bais = new java.io.ByteArrayInputStream(bytes);
-					gzis = new java.util.zip.GZIPInputStream(bais);
-					
 					while ((length = gzis.read(buffer)) >= 0)
 					{
 						baos.write(buffer, 0, length);
-					} // end while: reading input
+					}
 					
 					// No error? Get new bytes.
 					bytes = baos.toByteArray();
 					
-				} // end try
-				catch (java.io.IOException e)
+				}
+				catch (IOException e)
 				{
 					// Just return originally-decoded bytes
-				} // end catch
-				finally
-				{
-					try
-					{
-						baos.close();
-					}
-					catch (Exception e)
-					{
-					}
-					try
-					{
-						gzis.close();
-					}
-					catch (Exception e)
-					{
-					}
-					try
-					{
-						bais.close();
-					}
-					catch (Exception e)
-					{
-					}
-				} // end finally
-				
-			} // end if: gzipped
-		} // end if: bytes.length >= 2
-		
+				}
+			}
+		}
 		return bytes;
-	} // end decode
+	}
 	
 	/**
 	 * Attempts to decode Base64 data and deserialize a Java Object within.
@@ -883,46 +786,22 @@ public class Base64
 	{
 		// Decode and gunzip if necessary
 		byte[] objBytes = decode(encodedObject);
-		
-		java.io.ByteArrayInputStream bais = null;
-		java.io.ObjectInputStream ois = null;
 		Object obj = null;
-		
-		try
+		try (ByteArrayInputStream bais = new ByteArrayInputStream(objBytes);
+			ObjectInputStream ois = new ObjectInputStream(bais))
 		{
-			bais = new java.io.ByteArrayInputStream(objBytes);
-			ois = new java.io.ObjectInputStream(bais);
-			
 			obj = ois.readObject();
 		}
-		catch (java.io.IOException e)
+		catch (IOException e)
 		{
 			_log.warning("Base64: " + e.getMessage());
 		}
-		catch (java.lang.ClassNotFoundException e)
+		catch (ClassNotFoundException e)
 		{
 			_log.warning("Base64: " + e.getMessage());
 		}
-		finally
-		{
-			try
-			{
-				bais.close();
-			}
-			catch (Exception e)
-			{
-			}
-			try
-			{
-				ois.close();
-			}
-			catch (Exception e)
-			{
-			}
-		} // end finally
-		
 		return obj;
-	} // end decodeObject
+	}
 	
 	/*  I N N E R C L A S S I N P U T S T R E A M */
 	
@@ -935,7 +814,7 @@ public class Base64
 	 * @see java.io.FilterInputStream
 	 * @since 1.3
 	 */
-	public static class InputStream extends java.io.FilterInputStream
+	public static class InputStream extends FilterInputStream
 	{
 		// private int options; // Options specified
 		private boolean encode; // Encoding or decoding
@@ -956,7 +835,7 @@ public class Base64
 		public InputStream(java.io.InputStream pIn)
 		{
 			this(pIn, DECODE);
-		} // end constructor
+		}
 		
 		/**
 		 * Constructs a {@link #InputStream} in either ENCODE or DECODE
@@ -993,7 +872,7 @@ public class Base64
 			buffer = new byte[bufferLength];
 			position = -1;
 			lineLength = 0;
-		} // end constructor
+		}
 		
 		/**
 		 * Reads enough of the input stream to convert to/from Base64 and
@@ -1003,7 +882,7 @@ public class Base64
 		 * @since 1.3
 		 */
 		@Override
-		public int read() throws java.io.IOException
+		public int read() throws IOException
 		{
 			// Do we need to get data?
 			if (position < 0)
@@ -1023,31 +902,29 @@ public class Base64
 							{
 								b3[i] = (byte) b;
 								numBinaryBytes++;
-							} // end if: not end of stream
+							}
 							
-						} // end try: read
-						catch (java.io.IOException e)
+						}
+						catch (IOException e)
 						{
 							// Only a problem if we got no data at all.
 							if (i == 0)
 								throw e;
 							
-						} // end catch
-					} // end for: each needed input byte
+						}
+					}
 					
 					if (numBinaryBytes > 0)
 					{
 						encode3to4(b3, 0, numBinaryBytes, buffer, 0);
 						position = 0;
 						numSigBytes = 4;
-					} // end if: got data
+					}
 					else
 					{
 						return -1;
-					} // end else
-				} // end if: encoding
-				
-				// Else decoding
+					}
+				}
 				else
 				{
 					byte[] b4 = new byte[4];
@@ -1080,11 +957,10 @@ public class Base64
 					else
 					{
 						// Must have broken out from above.
-						throw new java.io.IOException("Improperly padded Base64 input.");
-					} // end
-					
-				} // end else: decode
-			} // end else: get data
+						throw new IOException("Improperly padded Base64 input.");
+					}
+				}
+			}
 			
 			// Got data?
 			if (position >= 0)
@@ -1097,25 +973,21 @@ public class Base64
 				{
 					lineLength = 0;
 					return '\n';
-				} // end if
-				lineLength++; // This isn't important when decoding
-				// but throwing an extra "if" seems
-				// just as wasteful.
+				}
+				// This isn't important when decoding but throwing an extra "if" seems just as wasteful.
+				lineLength++;
 				
 				int b = buffer[position++];
 				
 				if (position >= bufferLength)
 					position = -1;
-				
-				return b & 0xFF; // This is how you "cast" a byte that's
-				// intended to be unsigned.
-				// end else
-			} // end if: position >= 0
+				// This is how you "cast" a byte that's intended to be unsigned.
+				return b & 0xFF;
+			}
 			
 			// When JDK1.4 is more accepted, use an assertion here.
-			throw new java.io.IOException("Error in Base64 code reading stream.");
-			// end else
-		} // end read
+			throw new IOException("Error in Base64 code reading stream.");
+		}
 		
 		/**
 		 * Calls {@link #read} repeatedly until the end of stream is reached or
@@ -1132,7 +1004,7 @@ public class Base64
 		 * @since 1.3
 		 */
 		@Override
-		public int read(byte[] dest, int off, int len) throws java.io.IOException
+		public int read(byte[] dest, int off, int len) throws IOException
 		{
 			int i;
 			int b;
@@ -1148,12 +1020,12 @@ public class Base64
 				else if (i == 0)
 					return -1;
 				else
-					break; // Out of 'for' loop
-			} // end for: each byte read
+					break;
+			}
 			return i;
-		} // end read
+		}
 		
-	} // end inner class InputStream
+	}
 	
 	/*  I N N E R C L A S S O U T P U T S T R E A M */
 	
@@ -1166,7 +1038,7 @@ public class Base64
 	 * @see java.io.FilterOutputStream
 	 * @since 1.3
 	 */
-	public static class OutputStream extends java.io.FilterOutputStream
+	public static class OutputStream extends FilterOutputStream
 	{
 		// private int options;
 		private boolean encode;
@@ -1189,7 +1061,7 @@ public class Base64
 		public OutputStream(java.io.OutputStream pOut)
 		{
 			this(pOut, ENCODE);
-		} // end constructor
+		}
 		
 		/**
 		 * Constructs a {@link #OutputStream} in either ENCODE or DECODE
@@ -1228,7 +1100,7 @@ public class Base64
 			lineLength = 0;
 			suspendEncoding = false;
 			b4 = new byte[4];
-		} // end constructor
+		}
 		
 		/**
 		 * Writes the byte to the output stream after converting to/from Base64
@@ -1241,14 +1113,14 @@ public class Base64
 		 * @since 1.3
 		 */
 		@Override
-		public void write(int theByte) throws java.io.IOException
+		public void write(int theByte) throws IOException
 		{
 			// Encoding suspended?
 			if (suspendEncoding)
 			{
 				super.out.write(theByte);
 				return;
-			} // end if: supsended
+			}
 			
 			// Encode?
 			if (encode)
@@ -1263,13 +1135,10 @@ public class Base64
 					{
 						out.write(NEW_LINE);
 						lineLength = 0;
-					} // end if: end of line
-					
+					}
 					position = 0;
-				} // end if: enough to output
-			} // end if: encoding
-			
-			// Else, Decoding
+				}
+			}
 			else
 			{
 				// Meaningful Base64 character?
@@ -1282,14 +1151,14 @@ public class Base64
 						out.write(b4, 0, len);
 						// out.write( Base64.decode4to3( buffer ) );
 						position = 0;
-					} // end if: enough to output
-				} // end if: meaningful base64 character
+					}
+				}
 				else if (DECODABET[theByte & 0x7f] != WHITE_SPACE_ENC)
 				{
-					throw new java.io.IOException("Invalid character in Base64 data.");
-				} // end else: not white space either
-			} // end else: decoding
-		} // end write
+					throw new IOException("Invalid character in Base64 data.");
+				}
+			}
+		}
 		
 		/**
 		 * Calls {@link #write} repeatedly until <var>len</var> bytes are
@@ -1304,28 +1173,27 @@ public class Base64
 		 * @since 1.3
 		 */
 		@Override
-		public void write(byte[] theBytes, int off, int len) throws java.io.IOException
+		public void write(byte[] theBytes, int off, int len) throws IOException
 		{
 			// Encoding suspended?
 			if (suspendEncoding)
 			{
 				super.out.write(theBytes, off, len);
 				return;
-			} // end if: supsended
+			}
 			
 			for (int i = 0; i < len; i++)
 			{
 				write(theBytes[off + i]);
-			} // end for: each byte written
-			
-		} // end write
+			}
+		}
 		
 		/**
 		 * Method added by PHIL. [Thanks, PHIL. -Rob] This pads the buffer
 		 * without closing the stream.
-		 * @throws java.io.IOException 
+		 * @throws IOException 
 		 */
-		public void flushBase64() throws java.io.IOException
+		public void flushBase64() throws IOException
 		{
 			if (position > 0)
 			{
@@ -1333,14 +1201,13 @@ public class Base64
 				{
 					out.write(encode3to4(b4, buffer, position));
 					position = 0;
-				} // end if: encoding
+				}
 				else
 				{
-					throw new java.io.IOException("Base64 input not properly padded.");
-				} // end else: decoding
-			} // end if: buffer partially full
-			
-		} // end flush
+					throw new IOException("Base64 input not properly padded.");
+				}
+			}
+		}
 		
 		/**
 		 * Flushes and closes (I think, in the superclass) the stream.
@@ -1348,7 +1215,7 @@ public class Base64
 		 * @since 1.3
 		 */
 		@Override
-		public void close() throws java.io.IOException
+		public void close() throws IOException
 		{
 			// 1. Ensure that pending characters are written
 			flushBase64();
@@ -1359,20 +1226,20 @@ public class Base64
 			
 			buffer = null;
 			out = null;
-		} // end close
+		}
 		
 		/**
 		 * Suspends encoding of the stream. May be helpful if you need to embed
 		 * a piece of base640-encoded data in a stream.
-		 * @throws java.io.IOException 
+		 * @throws IOException 
 		 * 
 		 * @since 1.5.1
 		 */
-		public void suspendEncoding() throws java.io.IOException
+		public void suspendEncoding() throws IOException
 		{
 			flushBase64();
 			suspendEncoding = true;
-		} // end suspendEncoding
+		}
 		
 		/**
 		 * Resumes encoding of the stream. May be helpful if you need to embed a
@@ -1383,8 +1250,6 @@ public class Base64
 		public void resumeEncoding()
 		{
 			suspendEncoding = false;
-		} // end resumeEncoding
-		
-	} // end inner class OutputStream
-	
-} // end class Base64
+		}
+	}
+}

+ 36 - 0
L2J_Server_BETA/java/com/l2jserver/util/file/filter/BMPFilter.java

@@ -0,0 +1,36 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.util.file.filter;
+
+import java.io.File;
+import java.io.FileFilter;
+
+/**
+ * Specialized {@link FileFilter} class.<br>
+ * Accepts <b>files</b> ending with ".bmp" only.
+ * @author Zoey76
+ */
+public class BMPFilter implements FileFilter
+{
+	@Override
+	public boolean accept(File f)
+	{
+		if ((f == null) || !f.isFile())
+		{
+			return false;
+		}
+		return f.getName().toLowerCase().endsWith(".bmp");
+	}
+}

+ 8 - 8
L2J_Server_BETA/java/com/l2jserver/util/file/filter/ExtFilter.java

@@ -20,18 +20,18 @@ import java.io.FileFilter;
 /**
  * @author lasarus
  */
-public class ExtFilter implements FileFilter 
+public class ExtFilter implements FileFilter
 {
-	String _ext;
-
-	public ExtFilter(String extention) 
+	private final String _ext;
+	
+	public ExtFilter(String ext)
 	{
-		_ext = extention;
+		_ext = ext;
 	}
-
+	
 	@Override
-	public boolean accept(File pathname)
+	public boolean accept(File f)
 	{
-		return pathname.getName().endsWith(_ext);
+		return f.getName().toLowerCase().endsWith(_ext);
 	}
 }

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/util/file/filter/HTMLFilter.java

@@ -27,7 +27,7 @@ public class HTMLFilter implements FileFilter
 	@Override
 	public boolean accept(File f)
 	{
-		if ((f == null) || !f.exists() || f.isDirectory())
+		if ((f == null) || !f.isFile())
 		{
 			return false;
 		}

+ 36 - 0
L2J_Server_BETA/java/com/l2jserver/util/file/filter/OldPledgeFilter.java

@@ -0,0 +1,36 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.util.file.filter;
+
+import java.io.File;
+import java.io.FileFilter;
+
+/**
+ * Specialized {@link FileFilter} class.<br>
+ * Accepts <b>files</b> starting with "Pledge_" only.
+ * @author Zoey76
+ */
+public class OldPledgeFilter implements FileFilter
+{
+	@Override
+	public boolean accept(File f)
+	{
+		if ((f == null) || !f.isFile())
+		{
+			return false;
+		}
+		return f.getName().toLowerCase().startsWith("Pledge_");
+	}
+}

+ 6 - 2
L2J_Server_BETA/java/com/l2jserver/util/file/filter/XMLFilter.java

@@ -25,8 +25,12 @@ import java.io.FileFilter;
 public class XMLFilter implements FileFilter
 {
 	@Override
-	public boolean accept(File pathname)
+	public boolean accept(File f)
 	{
-		return pathname.getName().endsWith(".xml");
+		if ((f == null) || !f.isFile())
+		{
+			return false;
+		}
+		return f.getName().toLowerCase().endsWith(".xml");
 	}
 }

+ 3 - 22
L2J_Server_BETA/java/com/l2jserver/util/lib/Log.java

@@ -32,37 +32,18 @@ public class Log
 	
 	public static final void add(String text, String cat)
 	{
-		
-		/*
-		 * Logger _log = logs.get(cat); if(_log == null) { _log =
-		 * Logger.getLogger(cat); logs.put(cat, _log); }
-		 */
-		
 		String date = (new SimpleDateFormat("yy.MM.dd H:mm:ss")).format(new Date());
 		String curr = (new SimpleDateFormat("yyyy-MM-dd-")).format(new Date());
 		new File("log/game").mkdirs();
-		FileWriter save = null;
 		
-		try
+		final File file = new File("log/game/" + (curr != null ? curr : "" )+(cat != null ? cat : "unk") + ".txt");
+		try (FileWriter save = new FileWriter(file, true))
 		{
-			File file = new File("log/game/" + (curr != null ? curr : "" )+(cat != null ? cat : "unk") + ".txt");
-			save = new FileWriter(file, true);
-			String out = "[" + date + "] " + text + "\n";
-			save.write(out);
+			save.write("[" + date + "] " + text + "\n");
 		}
 		catch (IOException e)
 		{
 			_log.log(Level.WARNING, "Error saving logfile: ", e);
 		}
-		finally
-		{
-			try
-			{
-				save.close();
-			}
-			catch (Exception e)
-			{
-			}
-		}
 	}
 }