From 5f4df90f73ce65a0fed255ab6d152cca52431507 Mon Sep 17 00:00:00 2001 From: laoyuyu <511455842@qq.com> Date: Tue, 24 Jul 2018 21:46:14 +0800 Subject: [PATCH] fix bug https://github.com/AriaLyy/Aria/issues/275 --- .../main/java/com/arialyy/aria/orm/AbsDelegate.java | 13 +++++++------ .../java/com/arialyy/aria/orm/DelegateFind.java | 8 ++++++-- .../java/com/arialyy/aria/util/SSLContextUtil.java | 3 +++ DEV_LOG.md | 2 ++ README.md | 4 ++-- app/src/main/AndroidManifest.xml | 4 ++-- .../com/arialyy/simple/test/AnyRunActivity.java | 4 ++-- build.gradle | 2 +- 8 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/orm/AbsDelegate.java b/Aria/src/main/java/com/arialyy/aria/orm/AbsDelegate.java index 0fc7e88c..eafac17d 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/AbsDelegate.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/AbsDelegate.java @@ -18,7 +18,6 @@ package com.arialyy.aria.orm; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.support.v4.util.LruCache; -import android.text.TextUtils; import com.arialyy.aria.util.ALog; import com.arialyy.aria.util.CommonUtil; import java.lang.reflect.Field; @@ -134,11 +133,13 @@ abstract class AbsDelegate { } void closeCursor(Cursor cursor) { - if (cursor != null && !cursor.isClosed()) { - try { - cursor.close(); - } catch (android.database.SQLException e) { - e.printStackTrace(); + synchronized (AbsDelegate.class) { + if (cursor != null && !cursor.isClosed()) { + try { + cursor.close(); + } catch (android.database.SQLException e) { + e.printStackTrace(); + } } } } diff --git a/Aria/src/main/java/com/arialyy/aria/orm/DelegateFind.java b/Aria/src/main/java/com/arialyy/aria/orm/DelegateFind.java index 81c8a85d..e292a67f 100644 --- a/Aria/src/main/java/com/arialyy/aria/orm/DelegateFind.java +++ b/Aria/src/main/java/com/arialyy/aria/orm/DelegateFind.java @@ -201,7 +201,7 @@ class DelegateFind extends AbsDelegate { * @param pColumnAlias 关联查询父表别名 * @param cColumnAlias 关联查询子表别名 */ - private List newInstanceEntity( + private synchronized List newInstanceEntity( Class clazz, Class

parent, Class child, Cursor cursor, @@ -373,7 +373,7 @@ class DelegateFind extends AbsDelegate { /** * 根据数据游标创建一个具体的对象 */ - private List newInstanceEntity(Class clazz, Cursor cursor) { + private synchronized List newInstanceEntity(Class clazz, Cursor cursor) { List fields = CommonUtil.getAllFields(clazz); List entitys = new ArrayList<>(); if (fields != null && fields.size() > 0) { @@ -419,6 +419,10 @@ class DelegateFind extends AbsDelegate { */ private void setFieldValue(Class type, Field field, int column, Cursor cursor, Object entity) throws IllegalAccessException { + if (cursor == null || cursor.isClosed()) { + ALog.e(TAG, "cursor没有初始化"); + return; + } if (type == String.class) { String temp = cursor.getString(column); if (!TextUtils.isEmpty(temp)) { diff --git a/Aria/src/main/java/com/arialyy/aria/util/SSLContextUtil.java b/Aria/src/main/java/com/arialyy/aria/util/SSLContextUtil.java index 0e5f7b48..b6a9427d 100644 --- a/Aria/src/main/java/com/arialyy/aria/util/SSLContextUtil.java +++ b/Aria/src/main/java/com/arialyy/aria/util/SSLContextUtil.java @@ -58,6 +58,9 @@ public class SSLContextUtil { */ public static SSLContext getSSLContextFromAssets(String caAlias, String caPath, @ProtocolType String protocol) { + if (TextUtils.isEmpty(caAlias) || TextUtils.isEmpty(caPath)){ + return null; + } try { String cacheKey = getCacheKey(caAlias, caPath); SSLContext sslContext = SSL_CACHE.get(cacheKey); diff --git a/DEV_LOG.md b/DEV_LOG.md index a4c11901..1760c145 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,4 +1,6 @@ ## 开发日志 + + v_3.4.9 + - fix bug https://github.com/AriaLyy/Aria/issues/276 + v_3.4.8 - 组合任务新增`updateUrls(List)`用于修改组合子任务的url,[see](https://aria.laoyuyu.me/aria_doc/api/update_url.html) - 出于安全考虑,FTP数据库去掉密码的保存 diff --git a/README.md b/README.md index e4e13d78..0c57ecc4 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ Aria有以下特点: [![Download](https://api.bintray.com/packages/arialyy/maven/AriaApi/images/download.svg)](https://bintray.com/arialyy/maven/AriaApi/_latestVersion) [![Download](https://api.bintray.com/packages/arialyy/maven/AriaCompiler/images/download.svg)](https://bintray.com/arialyy/maven/AriaCompiler/_latestVersion) ```java -compile 'com.arialyy.aria:aria-core:3.4.8' -annotationProcessor 'com.arialyy.aria:aria-compiler:3.4.8' +compile 'com.arialyy.aria:aria-core:3.4.9' +annotationProcessor 'com.arialyy.aria:aria-compiler:3.4.9' ``` 如果出现android support,请将 `compile 'com.arialyy.aria:aria-core:'`替换为 ``` diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c29c9966..87d31608 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,11 +15,11 @@ android:theme="@style/AppTheme.NoActionBar"> - + diff --git a/app/src/main/java/com/arialyy/simple/test/AnyRunActivity.java b/app/src/main/java/com/arialyy/simple/test/AnyRunActivity.java index 4dcc4cb8..4a903a86 100644 --- a/app/src/main/java/com/arialyy/simple/test/AnyRunActivity.java +++ b/app/src/main/java/com/arialyy/simple/test/AnyRunActivity.java @@ -21,12 +21,12 @@ public class AnyRunActivity extends BaseActivity { AnyRunnModule module; String[] urls; int index = 0; - String URL = "http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk"; + //String URL = "http://static.gaoshouyou.com/d/12/0d/7f120f50c80d2e7b8c4ba24ece4f9cdd.apk"; //String URL = "http://58.213.157.242:8081/sims_file/rest/v1/file/mshd_touchscreen_ms/guideFile/41c33556-dc4a-4d78-bb76-b9f627f94448.mp4/%E5%85%AB%E5%8D%A6%E6%B4%B2%E5%8D%97%E4%BA%AC%E5%86%9C%E4%B8%9A%E5%98%89%E5%B9%B4%E5%8D%8E0511.mp4"; //String URL = "http://d1.showself.com/download/showself_android-s236279_release.apk"; //String URL = "http://static.gaoshouyou.com/d/22/94/822260b849944492caadd2983f9bb624.apk"; //private final String URL = "ftp://192.168.29.140:21/download/AriaPrj.rar"; - //String URL = "https://dl.genymotion.com/releases/genymotion-2.12.1/genymotion-2.12.1-vbox.exe"; + String URL = "https://dl.genymotion.com/releases/genymotion-2.12.1/genymotion-2.12.1-vbox.exe"; //String URL = "ftp://192.168.29.140:21/download/SDK_Demo-release.apk"; //String URL = "ftps://192.168.29.140:990/download/SDK_Demo-release.apk"; //String URL = "http://d.quanscreen.com/k/down/resourceDownLoad?resourceId=1994&clientId=A000011106034058176"; diff --git a/build.gradle b/build.gradle index 5f5e6e62..f7206410 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ task clean(type: Delete) { ext { userOrg = 'arialyy' groupId = 'com.arialyy.aria' - publishVersion = '3.4.8' + publishVersion = '3.4.9' // publishVersion = '1.0.3' //FTP插件 repoName='maven' desc = 'android 下载框架'