Program: 160485
Project: 160485
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.getName().equals("String_Node_Str")) {
    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 == EcorePackage.eINSTANCE.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 == EcorePackage.eINSTANCE.getEInt() || type == EcorePackage.eINSTANCE.getEIntegerObject()) {
    if (value == null) {
      buffer.putInt(0);
    }
 else {
      buffer.putInt((Integer)value);
    }
  }
 else   if (type == EcorePackage.eINSTANCE.getEDouble() || type == EcorePackage.eINSTANCE.getEDoubleObject()) {
    if (value == null) {
      buffer.putDouble(0D);
    }
 else {
      buffer.putDouble((Double)value);
    }
  }
 else   if (type == EcorePackage.eINSTANCE.getEFloat() || type == EcorePackage.eINSTANCE.getEFloatObject()) {
    if (value == null) {
      buffer.putFloat(0F);
    }
 else {
      buffer.putFloat((Float)value);
    }
  }
 else   if (type == EcorePackage.eINSTANCE.getELong() || type == EcorePackage.eINSTANCE.getELongObject()) {
    if (value == null) {
      buffer.putLong(0L);
    }
 else {
      buffer.putLong((Long)value);
    }
  }
 else   if (type == EcorePackage.eINSTANCE.getEBoolean() || type == EcorePackage.eINSTANCE.getEBooleanObject()) {
    if (value == null) {
      buffer.put((byte)0);
    }
 else {
      buffer.put(((Boolean)value) ? (byte)1 : (byte)0);
    }
  }
 else   if (type == EcorePackage.eINSTANCE.getEDate()) {
    if (value == null) {
      buffer.putLong(-1L);
    }
 else {
      buffer.putLong(((Date)value).getTime());
    }
  }
 else   if (type.getName().equals("String_Node_Str")) {
    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());
  }
}