后台工作线程设置ApplicationDomain#domainMemory时触发Error #1504错误
问题:Base64解码时赋值domainMemory触发Error #1504?
我在测试Base64数据解码,在后台工作线程中通过ApplicationDomain#domainMemory高效读取数据:
override public function decode(): Array { ... ApplicationDomain.currentDomain.domainMemory = task.input; ... }
当将从主线程接收的16字节task.input赋值给domainMemory时,恰好触发了「文件结束」错误:
Error #1504: End of file.
测试功能类似的encode()函数时,未出现此类错误。
最小复现示例(MCVE)
执行run/test脚本即可复现,需满足以下依赖:
- Node.js
asconfigc
核心测试代码如下:
package { import flash.display.Sprite; import org.agera.crypto.*; import org.agera.util.*; public class Main extends Sprite { public function Main() { encrypt("Some string", EncryptionFormat.BASE_64) .then(function(data: String): void { assertEquals(data, "U29tZSBzdHJpbmc="); trace("Base-64 encryption .. OK"); }) .otherwise(function(error: Error): void { trace("Base-64 encryption .. ERROR"); }); decrypt("U29tZSBzdHJpbmc=", EncryptionFormat.BASE_64) .then(function(data: String): void { assertEquals(data, "Some string"); trace("Base-64 decryption .. OK"); }) .otherwise(function(error: Error): void { trace(error.message); trace("Base-64 decryption .. ERROR"); }); } } }
内容的提问来源于stack exchange,提问作者Hydroper
相关产品推荐
相关产品推荐

