From 4f316c08b4ca047ed777bf38ee0231ff3bab5b30 Mon Sep 17 00:00:00 2001 From: Major- Date: Thu, 13 Feb 2014 15:14:49 +0000 Subject: [PATCH] Make exception messages consistent. --- src/org/apollo/ServiceManager.java | 6 ++-- src/org/apollo/fs/IndexedFileSystem.java | 16 +++++----- src/org/apollo/fs/archive/Archive.java | 2 +- .../impl/PlayerDesignVerificationHandler.java | 2 +- .../game/event/impl/SetTileItemEvent.java | 22 ++++++------- src/org/apollo/game/event/impl/WalkEvent.java | 2 +- src/org/apollo/game/model/Appearance.java | 6 ++-- src/org/apollo/game/model/Inventory.java | 6 ++-- src/org/apollo/game/model/Item.java | 2 +- src/org/apollo/game/model/Npc.java | 2 +- src/org/apollo/game/model/Player.java | 2 +- src/org/apollo/game/model/SkillSet.java | 2 +- .../game/model/def/EquipmentDefinition.java | 2 +- .../apollo/game/model/def/ItemDefinition.java | 10 +++--- .../apollo/game/model/def/NpcDefinition.java | 8 ++--- .../game/model/def/ObjectDefinition.java | 3 +- .../game/model/sector/SectorRepository.java | 6 ++-- .../game/model/settings/PrivacyState.java | 4 +-- .../game/model/settings/PrivilegeLevel.java | 8 ++--- .../game/model/settings/ScreenBrightness.java | 4 +-- .../game/model/settings/ServerStatus.java | 15 +++++++++ .../apollo/game/scheduling/ScheduledTask.java | 2 +- .../apollo/game/sync/seg/MovementSegment.java | 4 +-- .../apollo/io/EventHandlerChainParser.java | 14 ++++---- src/org/apollo/io/PluginMetaDataParser.java | 12 +++---- src/org/apollo/io/RsaKeyParser.java | 6 ++-- .../io/player/PlayerLoaderResponse.java | 4 +-- src/org/apollo/login/LoginService.java | 6 ++-- src/org/apollo/net/ApolloHandler.java | 2 +- .../net/codec/game/GamePacketBuilder.java | 32 +++++++++---------- .../net/codec/game/GamePacketDecoder.java | 6 ++-- .../net/codec/game/GamePacketEncoder.java | 4 +-- .../net/codec/game/GamePacketReader.java | 26 +++++++-------- .../net/codec/handshake/HandshakeDecoder.java | 2 +- .../codec/jaggrab/JagGrabRequestDecoder.java | 2 +- .../apollo/net/codec/login/LoginDecoder.java | 14 ++++---- .../net/codec/update/OnDemandRequest.java | 2 +- src/org/apollo/net/meta/PacketMetaData.java | 4 +-- .../apollo/net/meta/PacketMetaDataGroup.java | 6 ++-- src/org/apollo/net/release/Release.java | 4 +-- src/org/apollo/net/session/UpdateSession.java | 2 +- src/org/apollo/tools/EquipmentUpdater.java | 2 +- src/org/apollo/tools/NoteUpdater.java | 2 +- src/org/apollo/util/EnumerationUtil.java | 2 +- src/org/apollo/util/MobRepository.java | 4 +-- src/org/apollo/util/NameUtil.java | 2 +- src/org/apollo/util/xml/XmlParser.java | 2 +- 47 files changed, 156 insertions(+), 142 deletions(-) diff --git a/src/org/apollo/ServiceManager.java b/src/org/apollo/ServiceManager.java index 83dbecc4..dfda54ea 100644 --- a/src/org/apollo/ServiceManager.java +++ b/src/org/apollo/ServiceManager.java @@ -74,16 +74,16 @@ public final class ServiceManager { } if (!rootNode.getName().equals("services")) { - throw new IOException("unexpected name of root node"); + throw new IOException("Unexpected name of root node."); } for (XmlNode childNode : rootNode) { if (!childNode.getName().equals("service")) { - throw new IOException("unexpected name of child node"); + throw new IOException("Unexpected name of child node."); } if (!childNode.hasValue()) { - throw new IOException("child node must have a value!"); + throw new IOException("Child node must have a value."); } Class clazz = (Class) Class.forName(childNode.getValue()); diff --git a/src/org/apollo/fs/IndexedFileSystem.java b/src/org/apollo/fs/IndexedFileSystem.java index f99ef588..002a1df8 100644 --- a/src/org/apollo/fs/IndexedFileSystem.java +++ b/src/org/apollo/fs/IndexedFileSystem.java @@ -81,7 +81,7 @@ public final class IndexedFileSystem implements Closeable { } } if (indexCount <= 0) { - throw new FileNotFoundException("No index file(s) present"); + throw new FileNotFoundException("No index file(s) present."); } File oldEngineData = new File(base.getAbsolutePath() + "/main_file_cache.dat"); @@ -91,7 +91,7 @@ public final class IndexedFileSystem implements Closeable { } else if (newEngineData.exists() && !oldEngineData.isDirectory()) { data = new RandomAccessFile(newEngineData, readOnly ? "r" : "rw"); } else { - throw new FileNotFoundException("no data file present"); + throw new FileNotFoundException("No data file present."); } } @@ -141,7 +141,7 @@ public final class IndexedFileSystem implements Closeable { return crcTable.duplicate(); } } - throw new IOException("cannot get CRC table from a writable file system"); + throw new IOException("Cannot get CRC table from a writable file system."); } /** @@ -207,11 +207,11 @@ public final class IndexedFileSystem implements Closeable { // if we still have more data to read, check the validity of the header if (size > read) { if (nextType != descriptor.getType() + 1) { - throw new IOException("file type mismatch."); + throw new IOException("File type mismatch."); } if (nextFile != descriptor.getFile()) { - throw new IOException("file id mismatch."); + throw new IOException("File id mismatch."); } } } @@ -241,7 +241,7 @@ public final class IndexedFileSystem implements Closeable { */ private int getFileCount(int type) throws IOException { if (type < 0 || type >= indices.length) { - throw new IndexOutOfBoundsException("file type out of bounds"); + throw new IndexOutOfBoundsException("File type out of bounds."); } RandomAccessFile indexFile = indices[type]; @@ -260,7 +260,7 @@ public final class IndexedFileSystem implements Closeable { private Index getIndex(FileDescriptor descriptor) throws IOException { int index = descriptor.getType(); if (index < 0 || index >= indices.length) { - throw new IndexOutOfBoundsException("file descriptor type out of bounds"); + throw new IndexOutOfBoundsException("File descriptor type out of bounds."); } byte[] buffer = new byte[FileSystemConstants.INDEX_SIZE]; @@ -271,7 +271,7 @@ public final class IndexedFileSystem implements Closeable { indexFile.seek(ptr); indexFile.readFully(buffer); } else { - throw new FileNotFoundException("could not find find index"); + throw new FileNotFoundException("Could not find find index."); } } diff --git a/src/org/apollo/fs/archive/Archive.java b/src/org/apollo/fs/archive/Archive.java index c99cc17f..5ed7ede8 100644 --- a/src/org/apollo/fs/archive/Archive.java +++ b/src/org/apollo/fs/archive/Archive.java @@ -99,7 +99,7 @@ public final class Archive { return entry; } } - throw new FileNotFoundException("could not find entry: " + name); + throw new FileNotFoundException("Could not find entry: " + name + "."); } } \ No newline at end of file diff --git a/src/org/apollo/game/event/handler/impl/PlayerDesignVerificationHandler.java b/src/org/apollo/game/event/handler/impl/PlayerDesignVerificationHandler.java index a2073949..a8707b3c 100644 --- a/src/org/apollo/game/event/handler/impl/PlayerDesignVerificationHandler.java +++ b/src/org/apollo/game/event/handler/impl/PlayerDesignVerificationHandler.java @@ -42,7 +42,7 @@ public final class PlayerDesignVerificationHandler extends EventHandler= capacity) { - throw new IndexOutOfBoundsException("slot out of bounds"); + throw new IndexOutOfBoundsException("Slot out of bounds."); } } diff --git a/src/org/apollo/game/model/Item.java b/src/org/apollo/game/model/Item.java index 639ff5db..1a17cbf4 100644 --- a/src/org/apollo/game/model/Item.java +++ b/src/org/apollo/game/model/Item.java @@ -37,7 +37,7 @@ public final class Item { */ public Item(int id, int amount) { if (amount < 0) { - throw new IllegalArgumentException("negative amount"); + throw new IllegalArgumentException("Negative amount."); } this.id = id; this.amount = amount; diff --git a/src/org/apollo/game/model/Npc.java b/src/org/apollo/game/model/Npc.java index cbff9323..69b656c8 100644 --- a/src/org/apollo/game/model/Npc.java +++ b/src/org/apollo/game/model/Npc.java @@ -48,7 +48,7 @@ public final class Npc extends Mob { */ public void transform(int id) { if (id < 0 || id >= NpcDefinition.count()) { - throw new IllegalArgumentException("id to transform to is out of bounds"); + throw new IllegalArgumentException("Id to transform to is out of bounds."); } definition = NpcDefinition.lookup(id); blockSet.add(SynchronizationBlock.createTransformBlock(id)); diff --git a/src/org/apollo/game/model/Player.java b/src/org/apollo/game/model/Player.java index 2184227f..a6e96f07 100644 --- a/src/org/apollo/game/model/Player.java +++ b/src/org/apollo/game/model/Player.java @@ -700,7 +700,7 @@ public final class Player extends Mob { public void sendQuestInterface(List text) { int size = text.size(), lines = InterfaceConstants.QUEST_TEXT.length; if (size > lines) { - throw new IllegalArgumentException("List contains too much text for this interface."); + throw new IllegalArgumentException("List contains too much text to display on this interface."); } for (int pos = 0; pos < lines; pos++) { diff --git a/src/org/apollo/game/model/SkillSet.java b/src/org/apollo/game/model/SkillSet.java index 625eb9a8..44eaf8dc 100644 --- a/src/org/apollo/game/model/SkillSet.java +++ b/src/org/apollo/game/model/SkillSet.java @@ -153,7 +153,7 @@ public final class SkillSet { */ private void checkBounds(int id) { if (id < 0 || id >= skills.length) { - throw new IndexOutOfBoundsException("skill id is out of bounds"); + throw new IndexOutOfBoundsException("Skill id is out of bounds."); } } diff --git a/src/org/apollo/game/model/def/EquipmentDefinition.java b/src/org/apollo/game/model/def/EquipmentDefinition.java index add38b49..8fedf9e0 100644 --- a/src/org/apollo/game/model/def/EquipmentDefinition.java +++ b/src/org/apollo/game/model/def/EquipmentDefinition.java @@ -29,7 +29,7 @@ public final class EquipmentDefinition { EquipmentDefinition def = definitions[id]; if (def != null) { if (def.getId() != id) { - throw new RuntimeException("Equipment definition id mismatch!"); + throw new RuntimeException("Equipment definition id mismatch."); } EquipmentDefinition.definitions.put(def.getId(), def); } diff --git a/src/org/apollo/game/model/def/ItemDefinition.java b/src/org/apollo/game/model/def/ItemDefinition.java index 3cd50ff5..9d219793 100644 --- a/src/org/apollo/game/model/def/ItemDefinition.java +++ b/src/org/apollo/game/model/def/ItemDefinition.java @@ -56,7 +56,7 @@ public final class ItemDefinition { for (int id = 0; id < definitions.length; id++) { ItemDefinition def = definitions[id]; if (def.getId() != id) { - throw new RuntimeException("Item definition id mismatch!"); + throw new RuntimeException("Item definition id mismatch."); } if (def.isNote()) { def.toNote(); @@ -190,7 +190,7 @@ public final class ItemDefinition { */ public String getGroundAction(int id) { if (id < 0 || id >= groundActions.length) { - throw new IndexOutOfBoundsException("ground action id is out of bounds"); + throw new IndexOutOfBoundsException("Ground action id is out of bounds."); } return groundActions[id]; } @@ -213,7 +213,7 @@ public final class ItemDefinition { */ public String getInventoryAction(int id) { if (id < 0 || id >= inventoryActions.length) { - throw new IndexOutOfBoundsException("inventory action id is out of bounds"); + throw new IndexOutOfBoundsException("Inventory action id is out of bounds."); } return inventoryActions[id]; } @@ -308,7 +308,7 @@ public final class ItemDefinition { */ public void setGroundAction(int id, String action) { if (id < 0 || id >= groundActions.length) { - throw new IndexOutOfBoundsException("ground action id is out of bounds"); + throw new IndexOutOfBoundsException("Ground action id is out of bounds."); } groundActions[id] = action; } @@ -322,7 +322,7 @@ public final class ItemDefinition { */ public void setInventoryAction(int id, String action) { if (id < 0 || id >= inventoryActions.length) { - throw new IndexOutOfBoundsException("inventory action id is out of bounds"); + throw new IndexOutOfBoundsException("Inventory action id is out of bounds."); } inventoryActions[id] = action; } diff --git a/src/org/apollo/game/model/def/NpcDefinition.java b/src/org/apollo/game/model/def/NpcDefinition.java index 3945d6f5..afbbfbfa 100644 --- a/src/org/apollo/game/model/def/NpcDefinition.java +++ b/src/org/apollo/game/model/def/NpcDefinition.java @@ -43,7 +43,7 @@ public final class NpcDefinition { for (int id = 0; id < definitions.length; id++) { NpcDefinition def = definitions[id]; if (def.getId() != id) { - throw new RuntimeException("Npc definition id mismatch!"); + throw new RuntimeException("Npc definition id mismatch."); } } } @@ -143,7 +143,7 @@ public final class NpcDefinition { */ public String getInteraction(int slot) { if (slot < 0 || slot >= interactions.length) { - throw new IndexOutOfBoundsException("npc interaction id is out of bounds"); + throw new IndexOutOfBoundsException("Npc interaction id is out of bounds."); } return interactions[slot]; } @@ -238,7 +238,7 @@ public final class NpcDefinition { */ public boolean hasInteraction(int slot) { if (slot < 0 || slot >= interactions.length) { - throw new IndexOutOfBoundsException("npc interaction id is out of bounds"); + throw new IndexOutOfBoundsException("Npc interaction id is out of bounds."); } return interactions[slot] != null; } @@ -315,7 +315,7 @@ public final class NpcDefinition { */ public void setInteraction(int slot, String interaction) { if (slot < 0 || slot >= interactions.length) { - throw new IndexOutOfBoundsException("npc interaction id is out of bounds"); + throw new IndexOutOfBoundsException("Npc interaction id is out of bounds."); } interactions[slot] = interaction; } diff --git a/src/org/apollo/game/model/def/ObjectDefinition.java b/src/org/apollo/game/model/def/ObjectDefinition.java index 82497e2f..8d11be98 100644 --- a/src/org/apollo/game/model/def/ObjectDefinition.java +++ b/src/org/apollo/game/model/def/ObjectDefinition.java @@ -41,10 +41,9 @@ public final class ObjectDefinition { public static void init(ObjectDefinition[] definitions) { ObjectDefinition.definitions = definitions; for (int id = 0; id < definitions.length; id++) { - // This also verifies that none of the definitions are null. ObjectDefinition def = definitions[id]; if (def.getId() != id) { - throw new RuntimeException("Item definition id mismatch!"); + throw new RuntimeException("Item definition id mismatch."); } } } diff --git a/src/org/apollo/game/model/sector/SectorRepository.java b/src/org/apollo/game/model/sector/SectorRepository.java index 23733200..70ee8652 100644 --- a/src/org/apollo/game/model/sector/SectorRepository.java +++ b/src/org/apollo/game/model/sector/SectorRepository.java @@ -41,10 +41,10 @@ public final class SectorRepository { */ public void add(Sector sector) { if (sector == null) { - throw new IllegalArgumentException("sector cannot be null"); + throw new IllegalArgumentException("Sector cannot be null."); } else if (sectors.containsKey(sector.getCoordinates()) && !permitRemoval) { throw new UnsupportedOperationException( - "cannot add a sector with the same coordinates as an existing sector"); + "Cannot add a sector with the same coordinates as an existing sector."); } sectors.put(sector.getCoordinates(), sector); } @@ -95,7 +95,7 @@ public final class SectorRepository { */ public void remove(Sector sector) { if (!permitRemoval) { - throw new UnsupportedOperationException("cannot remove sectors from this repository"); + throw new UnsupportedOperationException("Cannot remove sectors from this repository."); } sectors.remove(sector.getCoordinates()); } diff --git a/src/org/apollo/game/model/settings/PrivacyState.java b/src/org/apollo/game/model/settings/PrivacyState.java index 1608d9b9..73b10e7b 100644 --- a/src/org/apollo/game/model/settings/PrivacyState.java +++ b/src/org/apollo/game/model/settings/PrivacyState.java @@ -33,12 +33,12 @@ public enum PrivacyState { * * @param value The numerical value. * @return The privacy state. - * @throws IllegalArgumentException If the numerical value is invalid. + * @throws IllegalArgumentException If the specified value is out of bounds. */ public static PrivacyState valueOf(int value) { PrivacyState[] values = values(); if (value < 0 || value >= values.length) { - throw new IllegalArgumentException("Invalid privacy option integer value specified: " + value); + throw new IllegalArgumentException("Invalid privacy option integer value specified: " + value + "."); } return values[value]; } diff --git a/src/org/apollo/game/model/settings/PrivilegeLevel.java b/src/org/apollo/game/model/settings/PrivilegeLevel.java index 6ec06efd..b960723f 100644 --- a/src/org/apollo/game/model/settings/PrivilegeLevel.java +++ b/src/org/apollo/game/model/settings/PrivilegeLevel.java @@ -23,16 +23,16 @@ public enum PrivilegeLevel { ADMINISTRATOR(2); /** - * Gets the privilege level for the specified numerical level. + * Gets the privilege level for the specified numerical value. * - * @param value The numerical level. + * @param value The numerical value. * @return The privilege level. - * @throws IllegalArgumentException If the numerical level is invalid. + * @throws IllegalArgumentException If the specified value is out of bounds. */ public static PrivilegeLevel valueOf(int value) { PrivilegeLevel[] values = values(); if (value < 0 || value >= values.length) { - throw new IndexOutOfBoundsException("Invalid privilege level integer value supplied"); + throw new IndexOutOfBoundsException("Invalid privilege level integer value supplied " + value + "."); } return values[value]; } diff --git a/src/org/apollo/game/model/settings/ScreenBrightness.java b/src/org/apollo/game/model/settings/ScreenBrightness.java index 73919758..77d7ff44 100644 --- a/src/org/apollo/game/model/settings/ScreenBrightness.java +++ b/src/org/apollo/game/model/settings/ScreenBrightness.java @@ -32,12 +32,12 @@ public enum ScreenBrightness { * * @param value The numerical value. * @return The screen brightness. - * @throws IllegalArgumentException If the numerical value is invalid. + * @throws IllegalArgumentException If the specified value is out of bounds. */ public static ScreenBrightness valueOf(int value) { ScreenBrightness[] values = values(); if (value < 0 || value >= values.length) { - throw new IllegalArgumentException("Invalid screen brightness integer value specified"); + throw new IllegalArgumentException("Invalid screen brightness integer value specified " + value + "."); } return values[value]; } diff --git a/src/org/apollo/game/model/settings/ServerStatus.java b/src/org/apollo/game/model/settings/ServerStatus.java index 905d0a71..d3339968 100644 --- a/src/org/apollo/game/model/settings/ServerStatus.java +++ b/src/org/apollo/game/model/settings/ServerStatus.java @@ -45,4 +45,19 @@ public enum ServerStatus { return code; } + /** + * Gets the server status for the specified numerical value. + * + * @param value The value. + * @return The server status. + * @throws IndexOutOfBoundsException If the specified value is out of bounds. + */ + public static ServerStatus valueOf(int value) { + ServerStatus[] values = values(); + if (value < 0 || value >= values.length) { + throw new IndexOutOfBoundsException("Invalid server status integer value supplied " + value + "."); + } + return values[value]; + } + } \ No newline at end of file diff --git a/src/org/apollo/game/scheduling/ScheduledTask.java b/src/org/apollo/game/scheduling/ScheduledTask.java index 776f70af..d97ac584 100644 --- a/src/org/apollo/game/scheduling/ScheduledTask.java +++ b/src/org/apollo/game/scheduling/ScheduledTask.java @@ -67,7 +67,7 @@ public abstract class ScheduledTask { */ public void setDelay(int delay) { if (delay < 0) { - throw new IllegalArgumentException("delay cannot be less than 0"); + throw new IllegalArgumentException("Delay cannot be less than 0."); } this.delay = delay; } diff --git a/src/org/apollo/game/sync/seg/MovementSegment.java b/src/org/apollo/game/sync/seg/MovementSegment.java index 549845c3..c0e59f83 100644 --- a/src/org/apollo/game/sync/seg/MovementSegment.java +++ b/src/org/apollo/game/sync/seg/MovementSegment.java @@ -25,7 +25,7 @@ public final class MovementSegment extends SynchronizationSegment { public MovementSegment(SynchronizationBlockSet blockSet, Direction[] directions) { super(blockSet); if (directions.length < 0 || directions.length > 2) { - throw new IllegalArgumentException("directions length must be between 0 and 2 inclusive"); + throw new IllegalArgumentException("Directions length must be between 0 and 2 inclusive."); } this.directions = directions; } @@ -49,7 +49,7 @@ public final class MovementSegment extends SynchronizationSegment { case 2: return SegmentType.RUN; default: - throw new IllegalStateException("direction type unsupported"); + throw new IllegalStateException("Direction type unsupported."); } } diff --git a/src/org/apollo/io/EventHandlerChainParser.java b/src/org/apollo/io/EventHandlerChainParser.java index b4c246c1..19da3c7a 100644 --- a/src/org/apollo/io/EventHandlerChainParser.java +++ b/src/org/apollo/io/EventHandlerChainParser.java @@ -58,28 +58,28 @@ public final class EventHandlerChainParser { InstantiationException, IllegalAccessException { XmlNode rootNode = parser.parse(is); if (!rootNode.getName().equals("events")) { - throw new IOException("root node name is not 'events'"); + throw new IOException("Root node name is not 'events'."); } Map, EventHandlerChain> chains = new HashMap, EventHandlerChain>(); for (XmlNode eventNode : rootNode) { if (!eventNode.getName().equals("event")) { - throw new IOException("only expected nodes named 'event' beneath the root node"); + throw new IOException("Only expected nodes named 'event' beneath the root node."); } XmlNode typeNode = eventNode.getChild("type"); if (typeNode == null) { - throw new IOException("no node named 'type' beneath current event node"); + throw new IOException("No node named 'type' beneath current event node."); } XmlNode chainNode = eventNode.getChild("chain"); if (chainNode == null) { - throw new IOException("no node named 'chain' beneath current event node"); + throw new IOException("No node named 'chain' beneath current event node."); } String eventClassName = typeNode.getValue(); if (eventClassName == null) { - throw new IOException("type node must have a value"); + throw new IOException("Type node must have a value."); } Class eventClass = (Class) Class.forName(eventClassName); @@ -87,12 +87,12 @@ public final class EventHandlerChainParser { for (XmlNode handlerNode : chainNode) { if (!handlerNode.getName().equals("handler")) { - throw new IOException("only expected nodes named 'handler' beneath the root node"); + throw new IOException("Only expected nodes named 'handler' beneath the root node."); } String handlerClassName = handlerNode.getValue(); if (handlerClassName == null) { - throw new IOException("handler node must have a value"); + throw new IOException("Handler node must have a value."); } Class> handlerClass = (Class>) Class diff --git a/src/org/apollo/io/PluginMetaDataParser.java b/src/org/apollo/io/PluginMetaDataParser.java index be9089d3..85b75ef2 100644 --- a/src/org/apollo/io/PluginMetaDataParser.java +++ b/src/org/apollo/io/PluginMetaDataParser.java @@ -52,7 +52,7 @@ public final class PluginMetaDataParser { private XmlNode getElement(XmlNode node, String name) throws IOException { XmlNode child = node.getChild(name); if (child == null) { - throw new IOException("no " + name + " element found"); + throw new IOException("No " + name + " element found."); } return child; } @@ -67,7 +67,7 @@ public final class PluginMetaDataParser { public PluginMetaData parse() throws IOException, SAXException { XmlNode rootNode = parser.parse(is); if (!rootNode.getName().equals("plugin")) { - throw new IOException("root node must be named plugin"); + throw new IOException("Root node must be named plugin."); } XmlNode idNode = getElement(rootNode, "id"); @@ -84,7 +84,7 @@ public final class PluginMetaDataParser { int version = Integer.parseInt(versionNode.getValue()); if (id == null || name == null || description == null) { - throw new IOException("id, name and description must have values"); + throw new IOException("Id, name and description must have values."); } XmlNode[] authorNodes = authorsNode.getChildren().toArray(EMPTY_NODE_ARRAY); @@ -98,21 +98,21 @@ public final class PluginMetaDataParser { for (int i = 0; i < authorNodes.length; i++) { authors[i] = authorNodes[i].getValue(); if (authors[i] == null) { - throw new IOException("author elements must have values"); + throw new IOException("Author elements must have values."); } } for (int i = 0; i < scriptNodes.length; i++) { scripts[i] = scriptNodes[i].getValue(); if (scripts[i] == null) { - throw new IOException("script elements must have values"); + throw new IOException("Script elements must have values."); } } for (int i = 0; i < dependencyNodes.length; i++) { dependencies[i] = dependencyNodes[i].getValue(); if (dependencies[i] == null) { - throw new IOException("dependency elements must have values"); + throw new IOException("Dependency elements must have values."); } } diff --git a/src/org/apollo/io/RsaKeyParser.java b/src/org/apollo/io/RsaKeyParser.java index 450203e1..090ce913 100644 --- a/src/org/apollo/io/RsaKeyParser.java +++ b/src/org/apollo/io/RsaKeyParser.java @@ -46,17 +46,17 @@ public final class RsaKeyParser { public void parse() throws SAXException, IOException { XmlNode rootNode = parser.parse(is); if (!rootNode.getName().equals("rsa")) { - throw new IOException("root node name is not 'rsa'"); + throw new IOException("Root node name is not 'rsa'."); } XmlNode modulusNode = rootNode.getChild("modulus"); if (modulusNode == null) { - throw new IOException("no node named 'modulus' beneath root node"); + throw new IOException("No node named 'modulus' beneath root node."); } XmlNode exponentNode = rootNode.getChild("private-exponent"); if (exponentNode == null) { - throw new IOException("no node named 'private-exponent' beneath root node"); + throw new IOException("No node named 'private-exponent' beneath root node."); } NetworkConstants.RSA_MODULUS = new BigInteger(modulusNode.getValue()); diff --git a/src/org/apollo/io/player/PlayerLoaderResponse.java b/src/org/apollo/io/player/PlayerLoaderResponse.java index 3b4e66d8..50cbbb37 100644 --- a/src/org/apollo/io/player/PlayerLoaderResponse.java +++ b/src/org/apollo/io/player/PlayerLoaderResponse.java @@ -28,7 +28,7 @@ public final class PlayerLoaderResponse { */ public PlayerLoaderResponse(int status) { if (status == LoginConstants.STATUS_OK || status == LoginConstants.STATUS_RECONNECTION_OK) { - throw new IllegalArgumentException("player required for this status code"); + throw new IllegalArgumentException("Player required for this status code."); } this.status = status; player = null; @@ -43,7 +43,7 @@ public final class PlayerLoaderResponse { */ public PlayerLoaderResponse(int status, Player player) { if (status != LoginConstants.STATUS_OK && status != LoginConstants.STATUS_RECONNECTION_OK) { - throw new IllegalArgumentException("player required for this status code"); + throw new IllegalArgumentException("Player not required for this status code."); } this.status = status; this.player = player; diff --git a/src/org/apollo/login/LoginService.java b/src/org/apollo/login/LoginService.java index f0d1d684..b93bd75d 100644 --- a/src/org/apollo/login/LoginService.java +++ b/src/org/apollo/login/LoginService.java @@ -74,17 +74,17 @@ public final class LoginService extends Service { } if (!rootNode.getName().equals("login")) { - throw new IOException("unexpected root node name"); + throw new IOException("Unexpected root node name."); } XmlNode loaderNode = rootNode.getChild("loader"); if (loaderNode == null || !loaderNode.hasValue()) { - throw new IOException("no loader child node or value"); + throw new IOException("No loader child node or value."); } XmlNode saverNode = rootNode.getChild("saver"); if (saverNode == null || !saverNode.hasValue()) { - throw new IOException("no saver child node or value"); + throw new IOException("No saver child node or value."); } Class loaderClazz = Class.forName(loaderNode.getValue()); diff --git a/src/org/apollo/net/ApolloHandler.java b/src/org/apollo/net/ApolloHandler.java index 21a7cd0f..864e4e5b 100644 --- a/src/org/apollo/net/ApolloHandler.java +++ b/src/org/apollo/net/ApolloHandler.java @@ -76,7 +76,7 @@ public final class ApolloHandler extends ChannelInboundHandlerAdapter { ctx.attr(NetworkConstants.SESSION_KEY).set(new UpdateSession(ctx.channel(), serverContext)); break; default: - throw new IllegalStateException("Invalid service id"); + throw new IllegalStateException("Invalid service id."); } } } else { diff --git a/src/org/apollo/net/codec/game/GamePacketBuilder.java b/src/org/apollo/net/codec/game/GamePacketBuilder.java index fb7059a9..740dd10e 100644 --- a/src/org/apollo/net/codec/game/GamePacketBuilder.java +++ b/src/org/apollo/net/codec/game/GamePacketBuilder.java @@ -73,7 +73,7 @@ public final class GamePacketBuilder { */ private void checkBitAccess() { if (mode != AccessMode.BIT_ACCESS) { - throw new IllegalStateException("For bit-based calls to work, the mode must be bit access"); + throw new IllegalStateException("For bit-based calls to work, the mode must be bit access."); } } @@ -84,7 +84,7 @@ public final class GamePacketBuilder { */ private void checkByteAccess() { if (mode != AccessMode.BYTE_ACCESS) { - throw new IllegalStateException("For byte-based calls to work, the mode must be byte access"); + throw new IllegalStateException("For byte-based calls to work, the mode must be byte access."); } } @@ -121,7 +121,7 @@ public final class GamePacketBuilder { } else if (transformation == DataTransformation.SUBTRACT) { buffer.writeByte((byte) (128 - longValue)); } else { - throw new IllegalArgumentException("unknown transformation"); + throw new IllegalArgumentException("Unknown transformation."); } } else { buffer.writeByte((byte) (longValue >> i * 8)); @@ -137,7 +137,7 @@ public final class GamePacketBuilder { } else if (transformation == DataTransformation.SUBTRACT) { buffer.writeByte((byte) (128 - longValue)); } else { - throw new IllegalArgumentException("unknown transformation"); + throw new IllegalArgumentException("Unknown transformation."); } } else { buffer.writeByte((byte) (longValue >> i * 8)); @@ -145,10 +145,10 @@ public final class GamePacketBuilder { } } else if (order == DataOrder.MIDDLE) { if (transformation != DataTransformation.NONE) { - throw new IllegalArgumentException("middle endian cannot be transformed"); + throw new IllegalArgumentException("Middle endian cannot be transformed."); } if (type != DataType.INT) { - throw new IllegalArgumentException("middle endian can only be used with an integer"); + throw new IllegalArgumentException("Middle endian can only be used with an integer,"); } buffer.writeByte((byte) (longValue >> 8)); buffer.writeByte((byte) longValue); @@ -156,17 +156,17 @@ public final class GamePacketBuilder { buffer.writeByte((byte) (longValue >> 16)); } else if (order == DataOrder.INVERSED_MIDDLE) { if (transformation != DataTransformation.NONE) { - throw new IllegalArgumentException("inversed middle endian cannot be transformed"); + throw new IllegalArgumentException("Inversed middle endian cannot be transformed,"); } if (type != DataType.INT) { - throw new IllegalArgumentException("inversed middle endian can only be used with an integer"); + throw new IllegalArgumentException("Inversed middle endian can only be used with an integer,"); } buffer.writeByte((byte) (longValue >> 16)); buffer.writeByte((byte) (longValue >> 24)); buffer.writeByte((byte) longValue); buffer.writeByte((byte) (longValue >> 8)); } else { - throw new IllegalArgumentException("unknown order"); + throw new IllegalArgumentException("Unknown order."); } } @@ -230,7 +230,7 @@ public final class GamePacketBuilder { */ public void putBits(int numBits, int value) { if (numBits < 0 || numBits > 32) { - throw new IllegalArgumentException("Number of bits must be between 1 and 32 inclusive"); + throw new IllegalArgumentException("Number of bits must be between 1 and 32 inclusive."); } checkBitAccess(); @@ -357,7 +357,7 @@ public final class GamePacketBuilder { public void putRawBuilder(GamePacketBuilder builder) { checkByteAccess(); if (builder.type != PacketType.RAW) { - throw new IllegalArgumentException("Builder must be raw!"); + throw new IllegalArgumentException("Builder must be raw."); } builder.checkByteAccess(); putBytes(builder.buffer); @@ -372,7 +372,7 @@ public final class GamePacketBuilder { public void putRawBuilderReverse(GamePacketBuilder builder) { checkByteAccess(); if (builder.type != PacketType.RAW) { - throw new IllegalArgumentException("Builder must be raw!"); + throw new IllegalArgumentException("Builder must be raw."); } builder.checkByteAccess(); putBytesReverse(builder.buffer); @@ -413,7 +413,7 @@ public final class GamePacketBuilder { */ public void switchToBitAccess() { if (mode == AccessMode.BIT_ACCESS) { - throw new IllegalStateException("Already in bit access mode"); + throw new IllegalStateException("Already in bit access mode."); } mode = AccessMode.BIT_ACCESS; bitIndex = buffer.writerIndex() * 8; @@ -426,7 +426,7 @@ public final class GamePacketBuilder { */ public void switchToByteAccess() { if (mode == AccessMode.BYTE_ACCESS) { - throw new IllegalStateException("Already in byte access mode"); + throw new IllegalStateException("Already in byte access mode."); } mode = AccessMode.BYTE_ACCESS; buffer.writerIndex((bitIndex + 7) / 8); @@ -440,10 +440,10 @@ public final class GamePacketBuilder { */ public GamePacket toGamePacket() { if (type == PacketType.RAW) { - throw new IllegalStateException("Raw packets cannot be converted to a game packet"); + throw new IllegalStateException("Raw packets cannot be converted to a game packet."); } if (mode != AccessMode.BYTE_ACCESS) { - throw new IllegalStateException("Must be in byte access mode to convert to a packet"); + throw new IllegalStateException("Must be in byte access mode to convert to a packet."); } return new GamePacket(opcode, type, buffer); } diff --git a/src/org/apollo/net/codec/game/GamePacketDecoder.java b/src/org/apollo/net/codec/game/GamePacketDecoder.java index 48efa685..c6024b3f 100644 --- a/src/org/apollo/net/codec/game/GamePacketDecoder.java +++ b/src/org/apollo/net/codec/game/GamePacketDecoder.java @@ -72,7 +72,7 @@ public final class GamePacketDecoder extends StatefulFrameDecoder if (type == PacketType.VARIABLE_BYTE) { headerLength++; if (payloadLength >= 256) { - throw new Exception("Payload too long for variable byte packet"); + throw new Exception("Payload too long for variable byte packet."); } } else if (type == PacketType.VARIABLE_SHORT) { headerLength += 2; if (payloadLength >= 65536) { - throw new Exception("Payload too long for variable short packet"); + throw new Exception("Payload too long for variable short packet."); } } diff --git a/src/org/apollo/net/codec/game/GamePacketReader.java b/src/org/apollo/net/codec/game/GamePacketReader.java index 22d94d12..08aaa2b1 100644 --- a/src/org/apollo/net/codec/game/GamePacketReader.java +++ b/src/org/apollo/net/codec/game/GamePacketReader.java @@ -42,7 +42,7 @@ public final class GamePacketReader { */ private void checkBitAccess() { if (mode != AccessMode.BIT_ACCESS) { - throw new IllegalStateException("For bit-based calls to work, the mode must be bit access"); + throw new IllegalStateException("For bit-based calls to work, the mode must be bit access."); } } @@ -53,7 +53,7 @@ public final class GamePacketReader { */ private void checkByteAccess() { if (mode != AccessMode.BYTE_ACCESS) { - throw new IllegalStateException("For byte-based calls to work, the mode must be byte access"); + throw new IllegalStateException("For byte-based calls to work, the mode must be byte access."); } } @@ -81,7 +81,7 @@ public final class GamePacketReader { } else if (transformation == DataTransformation.SUBTRACT) { longValue |= 128 - buffer.readByte() & 0xFFL; } else { - throw new IllegalArgumentException("unknown transformation"); + throw new IllegalArgumentException("Unknown transformation."); } } else { longValue |= (buffer.readByte() & 0xFFL) << i * 8; @@ -97,7 +97,7 @@ public final class GamePacketReader { } else if (transformation == DataTransformation.SUBTRACT) { longValue |= 128 - buffer.readByte() & 0xFFL; } else { - throw new IllegalArgumentException("unknown transformation"); + throw new IllegalArgumentException("Unknown transformation."); } } else { longValue |= (buffer.readByte() & 0xFFL) << i * 8; @@ -105,10 +105,10 @@ public final class GamePacketReader { } } else if (order == DataOrder.MIDDLE) { if (transformation != DataTransformation.NONE) { - throw new IllegalArgumentException("middle endian cannot be transformed"); + throw new IllegalArgumentException("Middle endian cannot be transformed."); } if (type != DataType.INT) { - throw new IllegalArgumentException("middle endian can only be used with an integer"); + throw new IllegalArgumentException("Middle endian can only be used with an integer."); } longValue |= (buffer.readByte() & 0xFF) << 8; longValue |= buffer.readByte() & 0xFF; @@ -116,17 +116,17 @@ public final class GamePacketReader { longValue |= (buffer.readByte() & 0xFF) << 16; } else if (order == DataOrder.INVERSED_MIDDLE) { if (transformation != DataTransformation.NONE) { - throw new IllegalArgumentException("inversed middle endian cannot be transformed"); + throw new IllegalArgumentException("Inversed middle endian cannot be transformed."); } if (type != DataType.INT) { - throw new IllegalArgumentException("inversed middle endian can only be used with an integer"); + throw new IllegalArgumentException("Inversed middle endian can only be used with an integer."); } longValue |= (buffer.readByte() & 0xFF) << 16; longValue |= (buffer.readByte() & 0xFF) << 24; longValue |= buffer.readByte() & 0xFF; longValue |= (buffer.readByte() & 0xFF) << 8; } else { - throw new IllegalArgumentException("unknown order"); + throw new IllegalArgumentException("Unknown order."); } return longValue; } @@ -151,7 +151,7 @@ public final class GamePacketReader { */ public int getBits(int numBits) { if (numBits < 0 || numBits > 32) { - throw new IllegalArgumentException("Number of bits must be between 1 and 32 inclusive"); + throw new IllegalArgumentException("Number of bits must be between 1 and 32 inclusive."); } checkBitAccess(); @@ -365,7 +365,7 @@ public final class GamePacketReader { public long getUnsigned(DataType type, DataOrder order, DataTransformation transformation) { long longValue = get(type, order, transformation); if (type == DataType.LONG) { - throw new IllegalArgumentException("due to java restrictions, longs must be read as signed types"); + throw new IllegalArgumentException("Due to java restrictions, longs must be read as signed types."); } return longValue & 0xFFFFFFFFFFFFFFFFL; } @@ -406,7 +406,7 @@ public final class GamePacketReader { */ public void switchToBitAccess() { if (mode == AccessMode.BIT_ACCESS) { - throw new IllegalStateException("Already in bit access mode"); + throw new IllegalStateException("Already in bit access mode."); } mode = AccessMode.BIT_ACCESS; bitIndex = buffer.readerIndex() * 8; @@ -419,7 +419,7 @@ public final class GamePacketReader { */ public void switchToByteAccess() { if (mode == AccessMode.BYTE_ACCESS) { - throw new IllegalStateException("Already in byte access mode"); + throw new IllegalStateException("Already in byte access mode."); } mode = AccessMode.BYTE_ACCESS; buffer.readerIndex((bitIndex + 7) / 8); diff --git a/src/org/apollo/net/codec/handshake/HandshakeDecoder.java b/src/org/apollo/net/codec/handshake/HandshakeDecoder.java index f38efd0a..9025e7a0 100644 --- a/src/org/apollo/net/codec/handshake/HandshakeDecoder.java +++ b/src/org/apollo/net/codec/handshake/HandshakeDecoder.java @@ -37,7 +37,7 @@ public final class HandshakeDecoder extends ByteToMessageDecoder { ctx.channel().writeAndFlush(buf); break; default: - throw new IllegalArgumentException("Invalid service id"); + throw new IllegalArgumentException("Invalid service id."); } ctx.pipeline().remove(this); diff --git a/src/org/apollo/net/codec/jaggrab/JagGrabRequestDecoder.java b/src/org/apollo/net/codec/jaggrab/JagGrabRequestDecoder.java index 53ce3235..a18c0caf 100644 --- a/src/org/apollo/net/codec/jaggrab/JagGrabRequestDecoder.java +++ b/src/org/apollo/net/codec/jaggrab/JagGrabRequestDecoder.java @@ -18,7 +18,7 @@ public final class JagGrabRequestDecoder extends MessageToMessageDecoder String filePath = request.substring(8).trim(); out.add(new JagGrabRequest(filePath)); } else { - throw new IllegalArgumentException("corrupted request line"); + throw new IllegalArgumentException("Corrupted request line."); } } diff --git a/src/org/apollo/net/codec/login/LoginDecoder.java b/src/org/apollo/net/codec/login/LoginDecoder.java index 6b3193e3..7a7cb129 100644 --- a/src/org/apollo/net/codec/login/LoginDecoder.java +++ b/src/org/apollo/net/codec/login/LoginDecoder.java @@ -71,7 +71,7 @@ public final class LoginDecoder extends StatefulFrameDecoder decodePayload(ctx, in, out); break; default: - throw new IllegalStateException("Invalid login decoder state"); + throw new IllegalStateException("Invalid login decoder state."); } } @@ -113,7 +113,7 @@ public final class LoginDecoder extends StatefulFrameDecoder int loginType = buffer.readUnsignedByte(); if (loginType != LoginConstants.TYPE_STANDARD && loginType != LoginConstants.TYPE_RECONNECTION) { - throw new IOException("Invalid login type"); + throw new IOException("Invalid login type."); } reconnecting = loginType == LoginConstants.TYPE_RECONNECTION; @@ -136,14 +136,14 @@ public final class LoginDecoder extends StatefulFrameDecoder if (buffer.readableBytes() >= loginLength) { ByteBuf payload = buffer.readBytes(loginLength); if (payload.readUnsignedByte() != 0xFF) { - throw new Exception("Invalid magic id"); + throw new Exception("Invalid magic id."); } int releaseNumber = payload.readUnsignedShort(); int lowMemoryFlag = payload.readUnsignedByte(); if (lowMemoryFlag != 0 && lowMemoryFlag != 1) { - throw new Exception("Invalid value for low memory flag"); + throw new Exception("Invalid value for low memory flag."); } boolean lowMemory = lowMemoryFlag == 1; @@ -155,7 +155,7 @@ public final class LoginDecoder extends StatefulFrameDecoder int securePayloadLength = payload.readUnsignedByte(); if (securePayloadLength != loginLength - 41) { - throw new Exception("Secure payload length mismatch"); + throw new Exception("Secure payload length mismatch."); } ByteBuf securePayload = payload.readBytes(securePayloadLength); @@ -167,13 +167,13 @@ public final class LoginDecoder extends StatefulFrameDecoder int secureId = securePayload.readUnsignedByte(); if (secureId != 10) { - throw new Exception("Invalid secure payload id"); + throw new Exception("Invalid secure payload id."); } long clientSeed = securePayload.readLong(); long reportedServerSeed = securePayload.readLong(); if (reportedServerSeed != serverSeed) { - throw new Exception("Server seed mismatch"); + throw new Exception("Server seed mismatch."); } int uid = securePayload.readInt(); diff --git a/src/org/apollo/net/codec/update/OnDemandRequest.java b/src/org/apollo/net/codec/update/OnDemandRequest.java index c5e019e9..4be18399 100644 --- a/src/org/apollo/net/codec/update/OnDemandRequest.java +++ b/src/org/apollo/net/codec/update/OnDemandRequest.java @@ -48,7 +48,7 @@ public final class OnDemandRequest implements Comparable { case 2: return LOW; default: - throw new IllegalArgumentException("priority out of range"); + throw new IllegalArgumentException("Priority out of range."); } } diff --git a/src/org/apollo/net/meta/PacketMetaData.java b/src/org/apollo/net/meta/PacketMetaData.java index 279e9cef..0742ec46 100644 --- a/src/org/apollo/net/meta/PacketMetaData.java +++ b/src/org/apollo/net/meta/PacketMetaData.java @@ -16,7 +16,7 @@ public final class PacketMetaData { */ public static PacketMetaData createFixed(int length) { if (length < 0) { - throw new IllegalArgumentException("packet length cannot be less than 0"); + throw new IllegalArgumentException("Packet length cannot be less than 0."); } return new PacketMetaData(PacketType.FIXED, length); } @@ -69,7 +69,7 @@ public final class PacketMetaData { */ public int getLength() { if (type != PacketType.FIXED) { - throw new IllegalStateException("can only get the length of a fixed length packet"); + throw new IllegalStateException("Can only get the length of a fixed length packet."); } return length; } diff --git a/src/org/apollo/net/meta/PacketMetaDataGroup.java b/src/org/apollo/net/meta/PacketMetaDataGroup.java index e771256a..ab83ce64 100644 --- a/src/org/apollo/net/meta/PacketMetaDataGroup.java +++ b/src/org/apollo/net/meta/PacketMetaDataGroup.java @@ -17,14 +17,14 @@ public final class PacketMetaDataGroup { */ public static PacketMetaDataGroup createFromArray(int[] lengthArray) { if (lengthArray.length != 256) { - throw new IllegalArgumentException("length array must be 256"); + throw new IllegalArgumentException("Array length must be 256."); } PacketMetaDataGroup grp = new PacketMetaDataGroup(); for (int i = 0; i < lengthArray.length; i++) { int length = lengthArray[i]; PacketMetaData metaData = null; if (length < -3) { - throw new IllegalArgumentException("no packet length can have a value less than -3"); + throw new IllegalArgumentException("No packet length can have a value less than -3."); } else if (length == -2) { metaData = PacketMetaData.createVariableShort(); } else if (length == -1) { @@ -58,7 +58,7 @@ public final class PacketMetaDataGroup { */ public PacketMetaData getMetaData(int opcode) { if (opcode < 0 || opcode >= packets.length) { - throw new IllegalArgumentException("opcode is out of bounds"); + throw new IllegalArgumentException("Opcode is out of bounds."); } return packets[opcode]; } diff --git a/src/org/apollo/net/release/Release.java b/src/org/apollo/net/release/Release.java index eb7d8e3d..c4470b5f 100644 --- a/src/org/apollo/net/release/Release.java +++ b/src/org/apollo/net/release/Release.java @@ -53,7 +53,7 @@ public abstract class Release { */ public final EventDecoder getEventDecoder(int opcode) { if (opcode < 0 || opcode >= decoders.length) { - throw new IndexOutOfBoundsException("opcode is out of bounds"); + throw new IndexOutOfBoundsException("Opcode is out of bounds."); } return decoders[opcode]; } @@ -106,7 +106,7 @@ public abstract class Release { */ public final void register(int opcode, EventDecoder decoder) { if (opcode < 0 || opcode >= decoders.length) { - throw new IndexOutOfBoundsException("opcode is out of bounds"); + throw new IndexOutOfBoundsException("Opcode is out of bounds."); } decoders[opcode] = decoder; } diff --git a/src/org/apollo/net/session/UpdateSession.java b/src/org/apollo/net/session/UpdateSession.java index ea917eef..a4233607 100644 --- a/src/org/apollo/net/session/UpdateSession.java +++ b/src/org/apollo/net/session/UpdateSession.java @@ -47,7 +47,7 @@ public final class UpdateSession extends Session { } else if (message instanceof HttpRequest) { dispatcher.dispatch(getChannel(), (HttpRequest) message); } else { - throw new IllegalArgumentException("unknown message type"); + throw new IllegalArgumentException("Unknown message type."); } } diff --git a/src/org/apollo/tools/EquipmentUpdater.java b/src/org/apollo/tools/EquipmentUpdater.java index 013c6791..d7d1f668 100644 --- a/src/org/apollo/tools/EquipmentUpdater.java +++ b/src/org/apollo/tools/EquipmentUpdater.java @@ -1166,7 +1166,7 @@ public final class EquipmentUpdater { */ public static void main(String[] args) throws Exception { if (args.length != 1) { - throw new IllegalArgumentException("Usage:\njava -cp ... org.apollo.tools.EquipmentUpdater [release]"); + throw new IllegalArgumentException("Usage:\njava -cp ... org.apollo.tools.EquipmentUpdater [release]."); } String release = args[0]; diff --git a/src/org/apollo/tools/NoteUpdater.java b/src/org/apollo/tools/NoteUpdater.java index 95cd4468..6db9de8c 100644 --- a/src/org/apollo/tools/NoteUpdater.java +++ b/src/org/apollo/tools/NoteUpdater.java @@ -26,7 +26,7 @@ public final class NoteUpdater { */ public static void main(String[] args) throws Exception { if (args.length != 1) { - throw new IllegalArgumentException("Usage:\njava -cp ... org.apollo.tools.NoteUpdater [release]"); + throw new IllegalArgumentException("Usage:\njava -cp ... org.apollo.tools.NoteUpdater [release]."); } String release = args[0]; diff --git a/src/org/apollo/util/EnumerationUtil.java b/src/org/apollo/util/EnumerationUtil.java index d64d715f..9013e244 100644 --- a/src/org/apollo/util/EnumerationUtil.java +++ b/src/org/apollo/util/EnumerationUtil.java @@ -33,7 +33,7 @@ public final class EnumerationUtil { @Override public void remove() { - throw new UnsupportedOperationException("cannot remove an element using this wrapper"); + throw new UnsupportedOperationException("Cannot remove an element using this wrapper."); } }; diff --git a/src/org/apollo/util/MobRepository.java b/src/org/apollo/util/MobRepository.java index b693663b..d8448c66 100644 --- a/src/org/apollo/util/MobRepository.java +++ b/src/org/apollo/util/MobRepository.java @@ -53,7 +53,7 @@ public final class MobRepository implements Iterable { } } if (mob == null) { - throw new NoSuchElementException("mob does not exist"); + throw new NoSuchElementException("Mob does not exist."); } previousIndex = index; index++; @@ -64,7 +64,7 @@ public final class MobRepository implements Iterable { @Override public void remove() { if (previousIndex == -1) { - throw new IllegalStateException("cannot remove as the repository is empty"); + throw new IllegalStateException("Cannot remove as the repository is empty."); } MobRepository.this.remove((T) mobs[previousIndex]); previousIndex = -1; diff --git a/src/org/apollo/util/NameUtil.java b/src/org/apollo/util/NameUtil.java index 5d5d8741..40d0e7c0 100644 --- a/src/org/apollo/util/NameUtil.java +++ b/src/org/apollo/util/NameUtil.java @@ -40,7 +40,7 @@ public final class NameUtil { */ public static long encodeBase37(String name) { if (name.length() > 12) { - throw new IllegalArgumentException("name too long"); + throw new IllegalArgumentException("Name too long."); } long l = 0L; for (int i = 0; i < name.length(); i++) { diff --git a/src/org/apollo/util/xml/XmlParser.java b/src/org/apollo/util/xml/XmlParser.java index 21ac43ae..f8793e97 100644 --- a/src/org/apollo/util/xml/XmlParser.java +++ b/src/org/apollo/util/xml/XmlParser.java @@ -119,7 +119,7 @@ public final class XmlParser { rootNode = null; xmlReader.parse(source); if (rootNode == null) { - throw new SAXException("no root element!"); + throw new SAXException("No root element."); } return rootNode; }