Program: 145538
Project: 145538
Buggy source:
public static void putValue(ProtoWriter writer,int nullValueTag,int undefinedValueTag,int functionValueTag,int typeTag,int nameTag,String aArgumentName,int valueTag,Object arg) throws IOException {
  if (arg == null) {
    writer.put(nullValueTag);
  }
 else   if (arg instanceof Undefined) {
    writer.put(undefinedValueTag);
  }
 else   if (arg instanceof Function) {
    writer.put(functionValueTag);
  }
 else {
    if (aArgumentName != null && !aArgumentName.isEmpty()) {
      writer.put(nameTag,aArgumentName);
    }
    ExecuteServerModuleMethodRequest.ArgumentType at=ExecuteServerModuleMethodRequest.ArgumentType.getArgumentType(arg);
    if (at == null) {
      throw new IllegalArgumentException(arg.toString());
    }
    writer.put(typeTag,at.getTypeID());
switch (at) {
case BIG_DECIMAL:
      writer.put(valueTag,(BigDecimal)arg);
    break;
case BIG_INTEGER:
  writer.put(valueTag,new BigDecimal((BigInteger)arg));
break;
case BOOLEAN:
writer.put(valueTag,((Boolean)arg).booleanValue() ? 1 : 0);
break;
case BYTE:
writer.put(valueTag,(Byte)arg);
break;
case CHARACTER:
writer.put(valueTag,((Character)arg).toString());
break;
case DATE:
writer.put(valueTag,(Date)arg);
break;
case DOUBLE:
writer.put(valueTag,(Double)arg);
break;
case FLOAT:
writer.put(valueTag,((Float)arg).doubleValue());
break;
case INTEGER:
writer.put(valueTag,(Integer)arg);
break;
case LONG:
writer.put(valueTag,(Long)arg);
break;
case SHORT:
writer.put(valueTag,((Short)arg).intValue());
break;
case STRING:
writer.put(valueTag,(String)arg);
break;
case OBJECT:
writer.put(valueTag,(String)ScriptUtils.toJson(arg));
break;
}
}
}

Fixed version (ground truth):
public static void putValue(ProtoWriter writer,int nullValueTag,int undefinedValueTag,int functionValueTag,int typeTag,int nameTag,String aArgumentName,int valueTag,Object arg) throws IOException, Exception {
  if (arg == null) {
    writer.put(nullValueTag);
  }
 else   if (arg instanceof Undefined) {
    writer.put(undefinedValueTag);
  }
 else   if (arg instanceof Function) {
    writer.put(functionValueTag);
  }
 else {
    if (aArgumentName != null && !aArgumentName.isEmpty()) {
      writer.put(nameTag,aArgumentName);
    }
    ExecuteServerModuleMethodRequest.ArgumentType at=ExecuteServerModuleMethodRequest.ArgumentType.getArgumentType(arg);
    if (at == null) {
      throw new IllegalArgumentException(arg.toString());
    }
    writer.put(typeTag,at.getTypeID());
switch (at) {
case BIG_DECIMAL:
      writer.put(valueTag,(BigDecimal)arg);
    break;
case BIG_INTEGER:
  writer.put(valueTag,new BigDecimal((BigInteger)arg));
break;
case BOOLEAN:
writer.put(valueTag,((Boolean)arg).booleanValue() ? 1 : 0);
break;
case BYTE:
writer.put(valueTag,(Byte)arg);
break;
case CHARACTER:
writer.put(valueTag,((Character)arg).toString());
break;
case DATE:
writer.put(valueTag,(Date)arg);
break;
case DOUBLE:
writer.put(valueTag,(Double)arg);
break;
case FLOAT:
writer.put(valueTag,((Float)arg).doubleValue());
break;
case INTEGER:
writer.put(valueTag,(Integer)arg);
break;
case LONG:
writer.put(valueTag,(Long)arg);
break;
case SHORT:
writer.put(valueTag,((Short)arg).intValue());
break;
case STRING:
writer.put(valueTag,(String)arg);
break;
case OBJECT:
if (arg instanceof Rowset) {
RowsetJsonWriter jsonWriter=new RowsetJsonWriter((Rowset)arg);
writer.put(valueTag,jsonWriter.write());
}
 else {
writer.put(valueTag,(String)ScriptUtils.toJson(arg));
}
break;
}
}
}