六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 183|回复: 0

对unicode资源文件进行反native2ascii化

[复制链接]

升级  50%

3

主题

3

主题

3

主题

童生

Rank: 1

积分
25
 楼主| 发表于 2013-1-14 23:08:19 | 显示全部楼层 |阅读模式
在使用derby时,出现了

  • Caused by: org.apache.derby.client.am.SqlException: 请求的时间内无法获取锁异常
google了一下没有结果,改为google

  • Caused by: org.apache.derby.client.am.SqlException: lock

出来了一大堆信息,其中有很多是


  • Caused by: org.apache.derby.client.am.SqlException: A lock could not be obtained within the time requested

为了确认“请求的时间内无法获取锁”即对应于“A lock could not be obtained within the time requested”,需要把locale为zh_CN的一大堆properties文件里的中文字符的unicode信息反native2ascii出来,进行查找,将查找到的key到locale为en_US中进行比对。写了个小程序如下:

public static void native2asciiReverse() {File srcFolder = new File("d:/loc");File[] srcFiles = srcFolder.listFiles();for (File file : srcFiles) {if (file.isFile()) {try {String command = "C:/Program Files/Java/jdk1.5.0_06/bin/native2ascii.exe -reverse "+ file.getAbsolutePath()+ " d:/loc_new/"+ file.getName().replaceAll(".properties", ".txt");Runtime.getRuntime().exec(command);} catch (IOException e) {e.printStackTrace();}}}}
这样就能在文件系统中查找“请求的时间内无法获取锁”了。
PS:目标文件后缀改为txt是因为windows文件系统查找不到properties里的字符串。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表