We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
昨天发现NumberFormatException这个异常,定位到判断时候过期的判断,但是缓存的数据并没有设置过期时间,但是刚好缓存的数据包含‘-’,查看那一段代码,是截取前13位字符,判断是不是时间的,然后转化为时间的,所以这里会有一个问题就是,极少数情况下,刚好string中包含,“-”,有同时满足后面有一个“ ”空格,就满足indexOf(data, mSeparator),这一个string就会被错认为一个包含过期时间的字段,然后转化时间就会报错,所以过期时间的判断有点不严谨,会有这种情况的出现,虽然很少很少,建议转化加一个try catch,可以解决
The text was updated successfully, but these errors were encountered:
/*** * 解析过期时间 * @param data * @return * 此处处理hasDateInfo() 当[13] = '-'并且刚好后面还有空格‘ ’,就满足了包含时间的判断,转为就会出错 */ private static boolean hasDateInfo(byte[] data) { if(data != null && data.length > 15 && data[13] == '-' && indexOf(data, mSeparator) > 14){ try{ String saveDate = new String(copyOfRange(data, 0, 13)); Long.valueOf(saveDate); return true; }catch (Exception e){ } } return false; }
Sorry, something went wrong.
No branches or pull requests
昨天发现NumberFormatException这个异常,定位到判断时候过期的判断,但是缓存的数据并没有设置过期时间,但是刚好缓存的数据包含‘-’,查看那一段代码,是截取前13位字符,判断是不是时间的,然后转化为时间的,所以这里会有一个问题就是,极少数情况下,刚好string中包含,“-”,有同时满足后面有一个“ ”空格,就满足indexOf(data, mSeparator),这一个string就会被错认为一个包含过期时间的字段,然后转化时间就会报错,所以过期时间的判断有点不严谨,会有这种情况的出现,虽然很少很少,建议转化加一个try catch,可以解决
The text was updated successfully, but these errors were encountered: