!36 merge master into master

fix exception

Created-by: atreeof_wind
Commit-by: atreeof_wind
Merged-by: openharmony_ci
Description: ### 一、内容说明(相关的Issue)



### 二、建议测试周期和提测地址  
  建议测试完成时间:xxxx.xx.xx  
  投产上线时间:xxxx.xx.xx  
  提测地址:CI环境/压测环境  
  测试账号:  

### 三、变更内容
  * 3.1 关联PR列表

  * 3.2 数据库和部署说明  
    1. 常规更新 
    2. 重启unicorn
    3. 重启sidekiq
    4. 迁移任务:是否有迁移任务,没有写 "无"
    5. rake脚本:`bundle exec xxx RAILS_ENV = production`;没有写 "无"

  * 3.4 其他技术优化内容(做了什么,变更了什么)
    - 重构了 xxxx 代码
    - xxxx 算法优化


  * 3.5 废弃通知(什么字段、方法弃用?)



  * 3.6  后向不兼容变更(是否有无法向后兼容的变更?)


  
### 四、研发自测点(自测哪些?冒烟用例全部自测?)
  自测测试结论:


### 五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)
  检查点:

| 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 |
|------|------------|----------|---------------|
| xxx  | 否          | 需要       | 不需要           |
|      |            |          |               |

  接口测试:

  性能测试:

  并发测试:

  其他:



See merge request: openharmony/notification_notification_cangjie_wrapper!36
This commit is contained in:
openharmony_ci
2025-11-17 20:21:40 +08:00
4 changed files with 20 additions and 5 deletions
+1
View File
@@ -22,6 +22,7 @@ ohos_cangjie_shared_library("ohos.common_event_publish_data") {
]
cj_external_deps = [
"cangjie_ark_interop:ohos.business_exception",
"cangjie_ark_interop:ohos.ffi",
"cangjie_ark_interop:ohos.labels",
]
@@ -21,6 +21,7 @@ import std.collection.HashMap
import ohos.labels.APILevel
import ohos.value_type.{CommonEventValueType, CArrParameters, CParameters, createCpCString, createCArrParam}
import ohos.ffi.{CArrString, CTypeResource}
import ohos.business_exception.BusinessException
/**
* The CommonEventPublishData module provides APIs for defining common event content and attributes.
@@ -133,6 +134,10 @@ protected struct CCommonEventPublishData {
let isOrdered: Bool
let isSticky: Bool
var parameters: CArrParameters = CArrParameters(CPointer<CParameters>(), 0)
/**
* @throws { BusinessException } 1500009 - Error obtaining system parameters.
*/
protected init(c: CommonEventPublishData) {
unsafe {
try {
@@ -152,7 +157,7 @@ protected struct CCommonEventPublishData {
}
} catch (e: Exception) {
free()
throw e
throw BusinessException(1500009, "Error obtaining system parameters.")
}
}
}
@@ -30,6 +30,9 @@ protected struct CSubscribeInfo {
var publisherDeviceId: CString = CString(CPointer<UInt8>())
var publisherBundleName: CString = CString(CPointer<UInt8>())
/**
* @throws { BusinessException } 1500009 - Error obtaining system parameters.
*/
protected init(info: CommonEventSubscribeInfo) {
priority = info.priority
userId = info.userId
@@ -47,7 +50,7 @@ protected struct CSubscribeInfo {
LibC.free(publisherPermission)
LibC.free(publisherDeviceId)
LibC.free(publisherBundleName)
throw e
throw BusinessException(1500009, "Error obtaining system parameters.")
}
}
}
+9 -3
View File
@@ -66,13 +66,16 @@ protected struct CParameters {
let value: CPointer<Unit>
let size: Int64
/**
* @throws { BusinessException } 1500009 - Error obtaining system parameters.
*/
init(p: Parameters) {
this.key = unsafe { LibC.mallocCString(p.key) }
(valueType, this.value, this.size) = try {
getValue(p.value)
} catch (e: Exception) {
unsafe { LibC.free(this.key) }
throw e
throw BusinessException(1500009, "Error obtaining system parameters.")
}
}
@@ -136,7 +139,7 @@ unsafe protected func createCArrParam(parameters: HashMap<String, CommonEventVal
} catch (e: Exception) {
freeCArrParam(ptr.head, count)
LibC.free(cp)
throw e
throw BusinessException(1500009, "Error obtaining system parameters.")
}
ptr.head.write(count, value)
count++
@@ -164,6 +167,9 @@ unsafe func createArrPtr<T>(value: Array<T>): CPointer<Unit> where T <: CType {
return CPointer<Unit>(ptr)
}
/**
* @throws { BusinessException } 1500009 - Error obtaining system parameters.
*/
unsafe protected func createCpCString(value: Array<String>): CPointer<CString> {
let ptr = safeMalloc<CString>(count: value.size)
for (i in 0..value.size) {
@@ -172,7 +178,7 @@ unsafe protected func createCpCString(value: Array<String>): CPointer<CString> {
} catch (e: Exception) {
freeCpCString(ptr, i)
LibC.free(ptr)
throw e
throw BusinessException(1500009, "Error obtaining system parameters.")
}
}
return ptr