Program: 160543
Project: 160543
Buggy source:
private void writePrimitiveValue(EStructuralFeature feature,Object value,ByteBuffer buffer) throws BimserverDatabaseException {
  EClassifier type=feature.getEType();
  if (type == ECORE_PACKAGE.getEString()) {
    if (value == null) {
      buffer.putInt(-1);
    }
 else {
      String stringValue=(String)value;
      byte[] bytes=stringValue.getBytes(Charsets.UTF_8);
      if (bytes.length > Integer.MAX_VALUE) {
        throw new BimserverDatabaseException("String_Node_Str" + Integer.MAX_VALUE + "String_Node_Str");
      }
      buffer.putInt(bytes.length);
      buffer.put(bytes);
    }
  }
 else   if (type == ECORE_PACKAGE.getEInt() || type == ECORE_PACKAGE.getEIntegerObject()) {
    if (value == null) {
      buffer.putInt(0);
    }
 else {
      buffer.putInt((Integer)value);
    }
  }
 else   if (type == ECORE_PACKAGE.getEDouble() || type == ECORE_PACKAGE.getEDoubleObject()) {
    if (value == null) {
      buffer.putDouble(0D);
    }
 else {
      buffer.putDouble((Double)value);
    }
  }
 else   if (type == ECORE_PACKAGE.getEFloat() || type == ECORE_PACKAGE.getEFloatObject()) {
    if (value == null) {
      buffer.putFloat(0F);
    }
 else {
      buffer.putFloat((Float)value);
    }
  }
 else   if (type == ECORE_PACKAGE.getELong() || type == ECORE_PACKAGE.getELongObject()) {
    if (value == null) {
      buffer.putLong(0L);
    }
 else {
      buffer.putLong((Long)value);
    }
  }
 else   if (type == ECORE_PACKAGE.getEBoolean() || type == ECORE_PACKAGE.getEBooleanObject()) {
    if (value == null) {
      buffer.put((byte)0);
    }
 else {
      buffer.put(((Boolean)value) ? (byte)1 : (byte)0);
    }
  }
 else   if (type == ECORE_PACKAGE.getEDate()) {
    if (value == null) {
      buffer.putLong(-1L);
    }
 else {
      buffer.putLong(((Date)value).getTime());
    }
  }
 else   if (type == Ifc2x3tc1Package.eINSTANCE.getTristate()) {
    Enumerator eEnumLiteral=(Enumerator)value;
    buffer.putInt(eEnumLiteral.getValue());
  }
 else   if (value instanceof Enumerator) {
    Enumerator eEnumLiteral=(Enumerator)value;
    buffer.putInt(eEnumLiteral.getValue());
  }
 else   if (type == EcorePackage.eINSTANCE.getEByteArray()) {
    if (value == null) {
      buffer.putInt(0);
    }
 else {
      byte[] bytes=(byte[])value;
      buffer.putInt(bytes.length);
      buffer.put(bytes);
    }
  }
 else {
    throw new RuntimeException("String_Node_Str" + type.getName());
  }
}

Fixed version (ground truth):
private void writePrimitiveValue(EStructuralFeature feature,Object value,ByteBuffer buffer) throws BimserverDatabaseException {
  EClassifier type=feature.getEType();
  if (type == ECORE_PACKAGE.getEString()) {
    if (value == null) {
      buffer.putInt(-1);
    }
 else {
      String stringValue=(String)value;
      byte[] bytes=stringValue.getBytes(Charsets.UTF_8);
      if (bytes.length > Integer.MAX_VALUE) {
        throw new BimserverDatabaseException("String_Node_Str" + Integer.MAX_VALUE + "String_Node_Str");
      }
      buffer.putInt(bytes.length);
      buffer.put(bytes);
      buffer.position(buffer.position() + bytes.length);
    }
  }
 else   if (type == ECORE_PACKAGE.getEInt() || type == ECORE_PACKAGE.getEIntegerObject()) {
    if (value == null) {
      buffer.putInt(0);
    }
 else {
      buffer.putInt((Integer)value);
    }
  }
 else   if (type == ECORE_PACKAGE.getEDouble() || type == ECORE_PACKAGE.getEDoubleObject()) {
    if (value == null) {
      buffer.putDouble(0D);
    }
 else {
      buffer.putDouble((Double)value);
    }
  }
 else   if (type == ECORE_PACKAGE.getEFloat() || type == ECORE_PACKAGE.getEFloatObject()) {
    if (value == null) {
      buffer.putFloat(0F);
    }
 else {
      buffer.putFloat((Float)value);
    }
  }
 else   if (type == ECORE_PACKAGE.getELong() || type == ECORE_PACKAGE.getELongObject()) {
    if (value == null) {
      buffer.putLong(0L);
    }
 else {
      buffer.putLong((Long)value);
    }
  }
 else   if (type == ECORE_PACKAGE.getEBoolean() || type == ECORE_PACKAGE.getEBooleanObject()) {
    if (value == null) {
      buffer.put((byte)0);
    }
 else {
      buffer.put(((Boolean)value) ? (byte)1 : (byte)0);
    }
  }
 else   if (type == ECORE_PACKAGE.getEDate()) {
    if (value == null) {
      buffer.putLong(-1L);
    }
 else {
      buffer.putLong(((Date)value).getTime());
    }
  }
 else   if (type == Ifc2x3tc1Package.eINSTANCE.getTristate()) {
    Enumerator eEnumLiteral=(Enumerator)value;
    buffer.putInt(eEnumLiteral.getValue());
  }
 else   if (value instanceof Enumerator) {
    Enumerator eEnumLiteral=(Enumerator)value;
    buffer.putInt(eEnumLiteral.getValue());
  }
 else   if (type == EcorePackage.eINSTANCE.getEByteArray()) {
    if (value == null) {
      buffer.putInt(0);
    }
 else {
      byte[] bytes=(byte[])value;
      buffer.putInt(bytes.length);
      buffer.put(bytes);
      buffer.position(buffer.position() + bytes.length);
    }
  }
 else {
    throw new RuntimeException("String_Node_Str" + type.getName());
  }
}