airminer / jnlua

JNLua - Java Native Lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A simple code mistake in format method

GoogleCodeExporter opened this issue · comments

In have found a mistake in the code of JNLua 1.0.3, thanks to FindBug.

Class: com.naef.jnlua.DefaultJavaReflector.java line: 441.

if (!luaState.isJavaObject(3, componentType)) {
    throw new LuaRuntimeException(
        String.format(
            "attempt to write array of %s at index %d with %s value",
            componentType.getCanonicalName(),
            luaState.typeName(3)));
}

The format string have two %s and one %d, but only two string are passed in 
parametter.
The missing parameter is the value of the index '3' as follow:


if (!luaState.isJavaObject(3, componentType)) {
    throw new LuaRuntimeException(
        String.format(
            "attempt to write array of %s at index %d with %s value",
            componentType.getCanonicalName(), 3,
            luaState.typeName(3)));
}

Marc

Original issue reported on code.google.com by marc.aub...@gmail.com on 11 Feb 2013 at 3:44

Thanks! Fixed on the trunk and the 0.9 branch.

Original comment by an...@naef.com on 28 Jul 2013 at 10:26

  • Changed state: Fixed