【发布时间】:2011-09-11 22:27:45
【问题描述】:
我正在使用一个具有枚举类型的库,其中包含类似这样的常量;
Type.SHORT
Type.LONG
Type.FLOAT
Type.STRING
当我在 Eclipse 中调试时,出现错误:
No enum const class Type.STRİNG
由于我使用的是土耳其语系统,所以在工作 i>İ 时会出现问题,但由于这是一个枚举常量,即使我将每个属性都设置为 UTF-8,也没有什么可以得到 STRING 是 Eclipse 应该寻找的。但它仍然在寻找 STRİNG 并且它找不到并且我不能使用它。我必须为此做些什么?
Project > Properties > Resouce > 文本文件编码现在是 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
和其他类; OCommandExecutorSQLCreateProperty: http://code.google.com/p/orient/source/browse/trunk/core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLCreateProperty.java
第 81 行说:type = OType.valueOf(word.toString());
【问题讨论】:
-
当您在输入
Type.STR后立即按CTRL+Space时,Eclipse 是否自动完成正确? -
其实我不是直接打字用的。必须有类似反射或使用它的东西。但是作为你问题的答案,通过打字,没有问题。 Ctrl+Space 给了我 Type.STRING(正确,没有问题)
-
也许反射调用枚举的代码存在问题——该值从何而来?用户输入来自仅限土耳其语的键盘,或发送
İ而不是I的其他系统? -
感谢您的努力。我添加了一些我使用的代码,我希望能提供一些关于我想要做什么的线索。我在 Eclipse 上工作,直到现在,我从未见过这样的问题。我知道这种土耳其语编码可能有一些内容,但这个只是不同,我什至无法获得资源/第一点。这很奇怪,我认为它一定是某种“偏好”部分,但我所知道的所有偏好都显示 UTF-8,没有任何帮助。
-
今晚的最后一件事,我刚刚检查了整个 OrientDB 主干并搜索了
STRİNG-- 什么也没找到。它必须在您的代码或配置文件中。
标签: java utf-8 character-encoding turkish orientdb