joystick : add trim() to each joystick name input

cleanup_build_scripts
Dokthar 9 years ago
parent 039043daac
commit 5e594a87d2
  1. 8
      jme3-core/src/main/java/com/jme3/input/JoystickCompatibilityMappings.java

@ -68,10 +68,10 @@ public class JoystickCompatibilityMappings {
}
protected static Map<String,String> getMappings( String joystickName, boolean create ) {
Map<String,String> result = joystickMappings.get(joystickName);
Map<String,String> result = joystickMappings.get(joystickName.trim());
if( result == null && create ) {
result = new HashMap<String,String>();
joystickMappings.put(joystickName,result);
joystickMappings.put(joystickName.trim(),result);
}
return result;
}
@ -94,7 +94,7 @@ public class JoystickCompatibilityMappings {
* it returns an empty map.
*/
public static Map<String,String> getJoystickMappings( String joystickName ) {
Map<String,String> result = getMappings(joystickName, false);
Map<String,String> result = getMappings(joystickName.trim(), false);
if( result == null )
return Collections.emptyMap();
return Collections.unmodifiableMap(result);
@ -121,7 +121,7 @@ public class JoystickCompatibilityMappings {
for( Map.Entry<Object,Object> e : p.entrySet() ) {
String key = String.valueOf(e.getKey()).trim();
int split = key.indexOf( '.' );
int split = key.lastIndexOf( '.' );
if( split < 0 ) {
logger.log(Level.WARNING, "Skipping mapping:{0}", e);
continue;

Loading…
Cancel
Save