yu66433 / jnlua

Automatically exported from code.google.com/p/jnlua
0 stars 0 forks source link

A simple code mistake in format method #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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

GoogleCodeExporter commented 8 years ago
Thanks! Fixed on the trunk and the 0.9 branch.

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