[英]Caused by: java.lang.ClassCastException: com.google.appengine.api.datastore.Text cannot be cast to java.lang.String
I am trying to download a Excel on my local computer from my web application deployed on Google App Engine.我正在尝试从部署在 Google App Engine 上的 Web 应用程序下载本地计算机上的 Excel。 The Entity from I get the data, have not Text fields.
从我获取数据的实体,没有文本字段。
All the fields are String.所有字段都是字符串。 However, when I reach the line
(String) catalogo.getProperty("des_definidor")
in a object which des_definidor
field is 538 characters length (and 538 bytes, I calculated), I get this error.但是,当我到达
des_definidor
字段长度为 538 个字符(我计算为 538 个字节(String) catalogo.getProperty("des_definidor")
的对象中的行(String) catalogo.getProperty("des_definidor")
时,我收到此错误。 I thought the characters limit for a String was 1500 bytes in an Entity field.我认为字符串的字符限制是实体字段中的 1500 字节。
Someone knows what is the problem?有人知道是什么问题吗? Thanks you so much
非常感谢
to convert com.google.appengine.api.datastore.Text to a String use getValue method on Text:将 com.google.appengine.api.datastore.Text 转换为 String 使用 Text 上的 getValue 方法:
String value = someText.getValue();
Ordinary Java strings indeed stored as properties in Entity objects are limited to 1500 bytes.确实作为属性存储在 Entity 对象中的普通 Java 字符串限制为 1500 字节。
for more info, check Java documentation for App Engine API .有关更多信息,请查看App Engine API 的 Java 文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.