OrientDB在使用Unicode,土耳其语和枚举时遇到麻烦 [英] OrientDB having trouble with Unicode, Turkish, and enums

查看:132
本文介绍了OrientDB在使用Unicode,土耳其语和枚举时遇到麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用具有枚举类型且具有此类const的lib;

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

当我在Eclipse中调试时,出现错误:

No enum const class Type.STRİNG

当我使用土耳其语系统时,在使用i>İ时会出现问题,但是由于这是一个枚举常量,即使我将每个属性都设置为UTF-8,也无法得到 STRING 是Eclipse应该寻找的东西.但是它仍在寻找STRİNG,但找不到,我无法使用它.我该怎么办?

项目>属性>资源>文本文件编码现在为UTF-8.问题一直存在.

编辑:更多信息可能会提供一些我无法获得的线索; 我正在研究OrientDB.这是我的第一次尝试,因此我不知道问题是否可能出在OrientDB软件包上.但是我正在使用许多其他库,但从未见过这样的问题.该程序包中有一个OType枚举,我只是尝试连接到数据库.

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

我没有更多的代码了.创建数据库,但随后出现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

这是OType类:解决方案

我正确地假设您正在使用土耳其语区域设置运行该程序吗?然后,该错误似乎在OCommandExecutorSQLCreateProperty的第118行中:

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

您必须指定应使用其大写字母规则的语言环境,可能将Locale.ENGLISH用作toUpperCase的参数.

I am using a lib which has an enum type with consts like these;

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

While I am debugging in Eclipse, I got an error:

No enum const class Type.STRİNG

As I am using a Turkish system, there is a problem on working i>İ but as this is an enum const, even though I put every attributes as UTF-8, nothing could get that STRING is what Eclipse should look for. But it still looks for STRİNG and it can't find and I can't use that. What must I do for that?

Project > Properties > Resouce > Text file encoding is UTF-8 now. Problem keeps.

EDIT: More information may give some clues which I can't 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 am using many other libs, I have never seen such a problem. There is a OType enum in this package, and I am 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 more code I use yet. Database created but then I get the 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 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 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());

解决方案

Am I correct to assume you are running this program using a turkish locale? Then it seems the bug is in line 118 of OCommandExecutorSQLCreateProperty:

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

You would have to specify the Locale whose upper casing rules should be used, probably Locale.ENGLISH as the parameter to toUpperCase.

这篇关于OrientDB在使用Unicode,土耳其语和枚举时遇到麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆