Java – orientdb encountered problems using Unicode, Turkish and enumeration
I'm using a lib with enumeration types, which are similar to consts;
Type.SHORT Type.LONG Type.FLOAT Type.STRING
When I debugged in Eclipse, I received a mistake:
No enum const class Type.STRİNG
When I use the Turkish system, I > has a problem, but because this is an enumeration const, even if I set each attribute to UTF-8, nothing can make string what eclipse should look for But it's still looking for str İ Ng, it can't be found, I can't use it What shall I do?
Project > Properties > Resources > text file encoding is now UTF-8 The problem remains
Editor: more information may provide some clues I can't get; I'm developing orientdb This is my first attempt, so I don't know that the problem may be in the orientdb package But I use a lot of other libraries, and I've never seen such a problem There is an OType enumeration in this package. I just want to connect to the database
String url = "local:database"; ODatabaSEObjectTx db = new ODatabaSEObjectTx(url). Person person = new Person("John"); db.save(person); db.close();
I don't have any more code yet Create a database, but then I got Java lang.IllegalArgumentException:
Caused by: java.lang.IllegalArgumentException: No enum const class com.orientechnologies.orient.core.Metadata.schema.OType.STRİNG at java.lang.Enum.valueOf(UnkNown Source) at com.orientechnologies.orient.core.Metadata.schema.OType.valueOf(OType.java:41) at com.orientechnologies.orient.core.sql.OCommandExecutorsqlCreateProperty.parse(OCommandExecutorsqlCreateProperty.java:81) at com.orientechnologies.orient.core.sql.OCommandExecutorsqlCreateProperty.parse(OCommandExecutorsqlCreateProperty.java:35) at com.orientechnologies.orient.core.sql.OCommandExecutorsqlDelegate.parse(OCommandExecutorsqlDelegate.java:43) at com.orientechnologies.orient.core.sql.OCommandExecutorsqlDelegate.parse(OCommandExecutorsqlDelegate.java:28) at com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:63) at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63) at com.orientechnologies.orient.core.Metadata.schema.OClassImpl.addProperty(OClassImpl.java:342) at com.orientechnologies.orient.core.Metadata.schema.OClassImpl.createProperty(OClassImpl.java:258) at com.orientechnologies.orient.core.Metadata.security.OSecurityShared.create(OSecurityShared.java:177) at com.orientechnologies.orient.core.Metadata.security.OSecurityProxy.create(OSecurityProxy.java:37) at com.orientechnologies.orient.core.Metadata.OMetadata.create(OMetadata.java:70) at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.create(ODatabaseRecordAbstract.java:142) ... 4 more
This is the OType class: http://code.google.com/p/orient/source/browse/trunk/core/src/main/java/com/orientechnologies/orient/core/metadata/schema/OType.java
And other classes; OCommandExecutorsqlCreateProperty: http://code.google.com/p/orient/source/browse/trunk/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateProperty.java
Line 81 says: type = OType valueOf(word.toString());
Solution
Do I correctly assume that you run this program using Turkish locale settings? Then it seems that the bug is in line 118 of ocommandexecutorsqlcreateproperty:
linkedType = OType.valueOf(linked.toUpperCase());
You must specify the locale whose upper level rules should be used, possibly locale English is used as the parameter of touppercase