OrientDB has problems with Unicode, Turkish and enumerations

I use lib, which has an enum type with constants like these;

Type.SHORT Type.LONG Type.FLOAT Type.STRING 

While I am debugging Eclipse, I received an error message:

 No enum const class Type.STRİNG 

Since I use the Turkish system, there is a problem with i> İ working, but since it is enum const, although I put all the attributes as UTF-8, nothing could get STRING is what Eclipse should look for, But it still looking for STRİNG , and he cannot find, and I cannot use it. What should I do for this?

Project> Properties> Resouce> Text Encoding is now UTF-8. The problem persists.

EDIT: More information may give some clues that I cannot get; I am working on OrientDB. This is my first attempt, so I don’t know if the problem could be on OrientDB packages. But I use many other libraries, I have never seen such a problem. There is an OType enumeration in this package, and I'm only trying to connect to the database.

  String url = "local:database"; ODatabaseObjectTx db = new ODatabaseObjectTx(url). Person person = new Person("John"); db.save(person); db.close(); 

There is no code that I use. The database is created, but then I get 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 

Here 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 another class; 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());

+6
source share
4 answers

Do I assume that you are using this program using the Turkish locale? Then it seems that the error is on line 118 of OCommandExecutorSQLCreateProperty:

 linkedType = OType.valueOf(linked.toUpperCase()); 

You will need to specify the language for which the upper case rules should be used, possibly Locale.ENGLISH as the toUpperCase parameter.

+6
source

This problem is related to connecting to the database. Presumably, somewhere there is a line in OrientDB, and you read it, and then try to use it to select an enumeration member.

I am assuming in the code that you indicated that the word variable comes from the data in the database. If this happens from somewhere else, then the problem is "somewhere else." If OrientDB for some strange reason returns "STRİNG" as metadata to tell you about the type of something, then this is really a defect in OrientDB.

If this line really contains the value İ, then no Eclipse setting will have any effect on the results. You will need to write code to normalize İ to I.

If you unload the contents of the word “word” as a sequence of hexadecimal values ​​for the string char string, I think you will see that you are looking directly at you. You have to change what is in the DB to have a plain old I.

+1
source

Unfortunately, this is due to the regional settings, the languages ​​of your OS, which are Turkish.

Two work options:

 1. Change your regional settings to English-US 2. Give encoding to she jvm as command line param for setting locale to English -Duser.language=en -Duser.region=EN 

I created error reports for xmlbeans, and apache cxf exist for the same problem. The toUpper enumeration is an exception point.

Some related links:

https://issues.apache.org/jira/browse/XMLSCHEMA-22

http://mail-archives.apache.org/mod_mbox/xmlbeans-user/201001.mbox/% 3CSNT123-DS11993DD331D6CA7799C46CF6650@phx.gbl % 3E

http://mail-archives.apache.org/mod_mbox/cxf-users/201203.mbox/% 3CBLU0-SMTP115A668459D9A0DA11EA5FAF6460@phx.gbl % 3E

https://vaadin.com/forum/-/message_boards/view_message/793105

http://comments.gmane.org/gmane.comp.apache.cxf.user/18316

+1
source

One workflow is to enter Type.ST , and then press Ctrl-space. Eclipse should automatically fill in the variable name, without thinking about how to enter invaluable capital on the Turkish keyboard. :)

0
source

Source: https://habr.com/ru/post/897116/


All Articles