java.util.MissingFormatArgumentException: Format specifier 's'
at java.util.Formatter.format(Formatter.java:2487) ~[na:1.7.0_80]
at java.util.Formatter.format(Formatter.java:2423) ~[na:1.7.0_80]
at java.lang.String.format(String.java:2enter code here792) ~[na:1.7.0_80]
at com.aionemu.gameserver.utils.audit.GMService.onPlayerUnavailable(Unknown Source) ~[AL-Game.jar:na]
at admincommands.GMMode.execute(GMMode.java]:73) ~[na:na]
while I was sending a command inside game, I am getting this error.
is that problem related with my config files or, completely with java ?
the entire code is :
package admincommands;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.network.aion.serverpackets.SM_MOTION;
import com.aionemu.gameserver.network.aion.serverpackets.SM_PLAYER_INFO;
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.utils.audit.GMService;
import com.aionemu.gameserver.utils.chathandlers.AdminCommand;
*/
public class GMMode extends AdminCommand {
public GMMode() {
super("gm");
}
@Override
public void execute(Player admin, String... params) {
if (admin.getAccessLevel() < 1) {
PacketSendUtility.sendMessage(admin, "You cannot use this command.");
return;
}
if (params.length != 1) {
onFail(admin, null);
return;
}
if (params[0].toLowerCase().equals("on")) {
if (!admin.isGmMode()) {
admin.setGmMode(true);
admin.setWispable();
GMService.getInstance().onPlayerLogin(admin); // put gm into
// gmlist
GMService.getInstance().onPlayerAvailable(admin); // send
// available
// message
admin.clearKnownlist();
PacketSendUtility.sendPacket(admin, new SM_PLAYER_INFO(admin, false));
PacketSendUtility.sendPacket(admin, new SM_MOTION(admin.getObjectId(), admin.getMotions().getActiveMotions()));
admin.updateKnownlist();
PacketSendUtility.sendMessage(admin, "you are now Available and Wispable by players");
}
}
if (params[0].equals("off")) {
if (admin.isGmMode()) {
admin.setGmMode(false);
admin.setUnWispable();
GMService.getInstance().onPlayerLogedOut(admin); // remove gm
// into
// gmlist
GMService.getInstance().onPlayerUnavailable(admin); // send
// unavailable
// message
admin.clearKnownlist();
PacketSendUtility.sendPacket(admin, new SM_PLAYER_INFO(admin, false));
PacketSendUtility.sendPacket(admin, new SM_MOTION(admin.getObjectId(), admin.getMotions().getActiveMotions()));
admin.updateKnownlist();
PacketSendUtility.sendMessage(admin, "you are now Unavailable and Unwispable by players");
}
}
}
@Override
public void onFail(Player admin, String message) {
String syntax = "syntax //gm <on|off>";
PacketSendUtility.sendMessage(admin, syntax);
}
}
The exception tells you that there is a
String.format
taking place with more format specifiers than values for formatting. So somewhere there is a call likeAccording to the stacktrace this happens in class
com.aionemu.gameserver.utils.audit.GMService
somewhere in methodonPlayerUnavailable
which is missing in your question.A short Google-search brought up a Git-project where you can see the source of the culprit and there you can see a call of
String.format
:The variable
adminTag
is built in dependence of settings in the instance ofPlayer
you're passing, so to say more we'd need information about the state of that instance- Looking at the source in general only shows the following lines to be a possible reason for the exception you encounter:Looking at the corresponding classes that hold the values for e.g.
TAG_WEDDING
I guess that your configuration contains customized values for at least one of these constants that start with%s
, so thatadminTag
ends up as%s%s
.So to answer your question
I guess that it's an error in your config file (some string starting with
%s
) or a bug in the library you're using but it's definitely not a bug in Java.