This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 4ba958cc896c244467fad3d213ecbe4893d0e0a9
Author: Alex Harui <aha...@apache.org>
AuthorDate: Wed Dec 26 17:50:57 2018 -0800

    fix warnings and errors in these files
---
 .../apache/royale/storage/file/DataInputStream.as  |  2 +-
 .../apache/royale/storage/file/DataOutputStream.as | 21 +++++-
 .../providers/AndroidExternalStorageProvider.as    | 78 +++++++++++++++------
 .../royale/storage/providers/WebStorageProvider.as | 80 ++++++++++++++++------
 4 files changed, 136 insertions(+), 45 deletions(-)

diff --git 
a/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/file/DataInputStream.as
 
b/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/file/DataInputStream.as
index 695a34e..ef0ce54 100644
--- 
a/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/file/DataInputStream.as
+++ 
b/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/file/DataInputStream.as
@@ -67,7 +67,7 @@ public class DataInputStream extends EventDispatcher 
implements IDataInput
                        
                        var self:DataInputStream = this;
                        
-                       _fileReader.onloadend = function (e):void {
+                       _fileReader.onloadend = function (e:Event):void {
                                var streamEvent:FileEvent = new 
FileEvent("READ");
                                streamEvent.stream = self;
                                streamEvent.data = this.result;
diff --git 
a/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/file/DataOutputStream.as
 
b/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/file/DataOutputStream.as
index 55eab71..f475ade 100644
--- 
a/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/file/DataOutputStream.as
+++ 
b/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/file/DataOutputStream.as
@@ -67,13 +67,13 @@ public class DataOutputStream extends EventDispatcher 
implements IDataOutput
                        
                        var self:DataOutputStream = this;
                        
-                       _fileWriter.onwriteend = function (e):void {
+                       _fileWriter.onwriteend = function (e:Event):void {
                                var newEvent:FileEvent = new FileEvent("WRITE");
                                newEvent.stream = self;
                                _target.dispatchEvent(newEvent);
                        };
                        
-                       _fileWriter.onerror = function (e):void {
+                       _fileWriter.onerror = function (e:Event):void {
                                var newEvent:FileErrorEvent = new 
FileErrorEvent("ERROR");
                                newEvent.stream = self;
                                newEvent.errorMessage = "Failed to write the 
file.";
@@ -117,7 +117,7 @@ public class DataOutputStream extends EventDispatcher 
implements IDataOutput
        public function writeText(text:String):void
        {
                COMPILE::JS {
-                       var blob:Blob = new Blob([text], { type: 'text/plain' } 
as BlobPropertyBag);
+                       var blob:Blob = new Blob([text], new 
BlobPlainTextOptions());
                        _fileWriter.write(blob);
                }
                COMPILE::SWF {
@@ -163,3 +163,18 @@ public class DataOutputStream extends EventDispatcher 
implements IDataOutput
 }
 
 }
+
+COMPILE::JS
+class BlobPlainTextOptions implements BlobPropertyBag
+{
+    public function get type():String
+    {
+        return "text/plain";
+    }
+    
+    public function set type(value:String):void
+    {
+        
+    }
+}
+
diff --git 
a/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/providers/AndroidExternalStorageProvider.as
 
b/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/providers/AndroidExternalStorageProvider.as
index cf05a73..22f9be9 100644
--- 
a/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/providers/AndroidExternalStorageProvider.as
+++ 
b/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/providers/AndroidExternalStorageProvider.as
@@ -98,10 +98,10 @@ package org.apache.royale.storage.providers
                        COMPILE::JS {
                                var fullPath:String = 
String(cordova["file"]["dataDirectory"]) + fileName;
                                
-                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry):void {
-                                       fileEntry.file(function (file):void {
+                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry:FileEntry):void {
+                                       fileEntry.file(function 
(file:File):void {
                                                var reader:FileReader = new 
FileReader();
-                                               reader.onloadend = function 
(e):void {
+                                               reader.onloadend = function 
(e:Event):void {
                                                        var newEvent:FileEvent 
= new FileEvent("READ");
                                                        newEvent.data = 
this.result;
                                                        
_target.dispatchEvent(newEvent);
@@ -110,13 +110,13 @@ package org.apache.royale.storage.providers
                                                        
_target.dispatchEvent(finEvent);
                                                };
                                                reader.readAsText(file);
-                                       }, function (e):void {
+                                       }, function (e:Event):void {
                                                var err1Event:FileErrorEvent = 
new FileErrorEvent("ERROR");
                                                err1Event.errorMessage = 
"Cannot open file for reading";
                                                err1Event.errorCode = 2;
                                                
_target.dispatchEvent(err1Event);
                                        });
-                               }, function (e):void {
+                               }, function (e:Event):void {
                                        var err2Event:FileErrorEvent = new 
FileErrorEvent("ERROR");
                                        err2Event.errorMessage = "File does not 
exist";
                                        err2Event.errorCode = 1;
@@ -142,19 +142,19 @@ package org.apache.royale.storage.providers
                        COMPILE::JS {
                                var fullPath:String = 
String(cordova["file"]["dataDirectory"]) + fileName;
                                
-                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry):void {
-                                       fileEntry.file(function (file):void {
+                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry:FileEntry):void {
+                                       fileEntry.file(function 
(file:File):void {
                                                var inputStream:DataInputStream 
= new DataInputStream(_target, file, new FileReader());
                                                var newEvent:FileEvent = new 
FileEvent("READY");
                                                newEvent.stream = inputStream;
                                                _target.dispatchEvent(newEvent);
-                                       }, function (e):void {
+                                       }, function (e:Event):void {
                                                var err1Event:FileErrorEvent = 
new FileErrorEvent("ERROR");
                                                err1Event.errorMessage = 
"Cannot open file for reading";
                                                err1Event.errorCode = 2;
                                                
_target.dispatchEvent(err1Event);
                                        });
-                               }, function (e):void {
+                               }, function (e:Event):void {
                                        var err2Event:FileErrorEvent = new 
FileErrorEvent("ERROR");
                                        err2Event.errorMessage = "File does not 
exist";
                                        err2Event.errorCode = 1;
@@ -182,9 +182,9 @@ package org.apache.royale.storage.providers
                        COMPILE::JS {
                                var fullPath:String = 
String(cordova["file"]["dataDirectory"]) + fileName;
                
-                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry):void {
-                                               fileEntry.createWriter(function 
(fileWriter):void {
-                                                       fileWriter.onwriteend = 
function (e):void {
+                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry:FileEntry):void {
+                                               fileEntry.createWriter(function 
(fileWriter:FileWriter):void {
+                                                       fileWriter.onwriteend = 
function (e:Event):void {
                                                                var 
newEvent:FileEvent = new FileEvent("WRITE");
                                                                
_target.dispatchEvent(newEvent);
                                                                
@@ -192,22 +192,22 @@ package org.apache.royale.storage.providers
                                                                
_target.dispatchEvent(finEvent);
                                                        };
                                                        
-                                                       fileWriter.onerror = 
function (e):void {
+                                                       fileWriter.onerror = 
function (e:Event):void {
                                                                var 
newEvent:FileErrorEvent = new FileErrorEvent("ERROR");
                                                                
newEvent.errorMessage = "Failed to write the file.";
                                                                
newEvent.errorCode = 3;
                                                                
_target.dispatchEvent(newEvent);
                                                        };
                                                        
-                                                       var blob:Blob = new 
Blob([text], { type: 'text/plain' } as BlobPropertyBag);
+                                                       var blob:Blob = new 
Blob([text], new BlobPlainTextOptions());
                                                        fileWriter.write(blob);
-                                               }, function(e):void {
+                                               }, function(e:Event):void {
                                                        var 
errEvent:FileErrorEvent = new FileErrorEvent("ERROR");
                                                        errEvent.errorMessage = 
"Cannot open file for writing.";
                                                        errEvent.errorCode = 1;
                                                        
_target.dispatchEvent(errEvent);
                                                });
-                                       }, function(e):void {
+                                       }, function(e:Event):void {
                                                var errEvent:FileErrorEvent = 
new FileErrorEvent("ERROR");
                                                errEvent.errorMessage = "Cannot 
create file.";
                                                errEvent.errorCode = 4;
@@ -233,9 +233,9 @@ package org.apache.royale.storage.providers
                        COMPILE::JS {
                                var fullPath:String = 
String(cordova["file"]["dataDirectory"]) + fileName;
                                
-                               window.resolveLocalFileSystemURL(fullPath, 
function (directoryEntry):void {
-                                       directoryEntry.getFile(fileName, { 
'create': true }, function (fileEntry):void {
-                                               fileEntry.createWriter(function 
(fileWriter):void {
+                               window.resolveLocalFileSystemURL(fullPath, 
function (directoryEntry:DirectoryEntry):void {
+                                       directoryEntry.getFile(fileName, new 
FileSystemCreateFlags, function (fileEntry:FileEntry):void {
+                                               fileEntry.createWriter(function 
(fileWriter:FileWriter):void {
                                                        var 
outputStream:DataOutputStream = new DataOutputStream(_target, fileEntry, 
fileWriter);
                                                        var newEvent:FileEvent 
= new FileEvent("READY");
                                                        newEvent.stream = 
outputStream;
@@ -245,5 +245,43 @@ package org.apache.royale.storage.providers
                                });
                        }
                }
-       }
+       }    
+}
+
+COMPILE::JS
+class BlobPlainTextOptions implements BlobPropertyBag
+{
+    public function get type():String
+    {
+        return "text/plain";
+    }
+    
+    public function set type(value:String):void
+    {
+        
+    }
+}
+
+COMPILE::JS
+class FileSystemCreateFlags implements FileSystemFlags
+{
+    public function get create():Boolean
+    {
+        return true;
+    }
+    
+    public function set create(value:Boolean):void
+    {
+        
+    }
+    
+    public function get exclusive():Boolean
+    {
+        return false;
+    }
+    
+    public function set exclusive(value:Boolean):void
+    {
+        
+    }
 }
diff --git 
a/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/providers/WebStorageProvider.as
 
b/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/providers/WebStorageProvider.as
index dd9c84c..cf0d2ec 100644
--- 
a/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/providers/WebStorageProvider.as
+++ 
b/frameworks/projects/Storage/src/main/royale/org/apache/royale/storage/providers/WebStorageProvider.as
@@ -97,10 +97,10 @@ package org.apache.royale.storage.providers
                        COMPILE::JS {
                                var fullPath:String = 
String(cordova["file"]["dataDirectory"]) + fileName;
                                
-                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry):void {
-                                       fileEntry.file(function (file):void {
+                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry:FileEntry):void {
+                                       fileEntry.file(function 
(file:File):void {
                                                var reader:FileReader = new 
FileReader();
-                                               reader.onloadend = function 
(e):void {
+                                               reader.onloadend = function 
(e:Event):void {
                                                        var newEvent:FileEvent 
= new FileEvent("READ");
                                                        newEvent.data = 
this.result;
                                                        
_target.dispatchEvent(newEvent);
@@ -109,13 +109,13 @@ package org.apache.royale.storage.providers
                                                        
_target.dispatchEvent(finEvent);
                                                };
                                                reader.readAsText(file);
-                                       }, function (e):void {
+                                       }, function (e:Event):void {
                                                var err1Event:FileErrorEvent = 
new FileErrorEvent("ERROR");
                                                err1Event.errorMessage = 
"Cannot open file for reading";
                                                err1Event.errorCode = 2;
                                                
_target.dispatchEvent(err1Event);
                                        });
-                               }, function (e):void {
+                               }, function (e:Event):void {
                                        var err2Event:FileErrorEvent = new 
FileErrorEvent("ERROR");
                                        err2Event.errorMessage = "File does not 
exist";
                                        err2Event.errorCode = 1;
@@ -141,19 +141,19 @@ package org.apache.royale.storage.providers
                        COMPILE::JS {
                                var fullPath:String = 
String(cordova["file"]["dataDirectory"]) + fileName;
                                
-                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry):void {
-                                       fileEntry.file(function (file):void {
+                               window.resolveLocalFileSystemURL(fullPath, 
function (fileEntry:FileEntry):void {
+                                       fileEntry.file(function 
(file:FileEntry):void {
                                                var inputStream:DataInputStream 
= new DataInputStream(_target, file, new FileReader());
                                                var newEvent:FileEvent = new 
FileEvent("READY");
                                                newEvent.stream = inputStream;
                                                _target.dispatchEvent(newEvent);
-                                       }, function (e):void {
+                                       }, function (e:Event):void {
                                                var err1Event:FileErrorEvent = 
new FileErrorEvent("ERROR");
                                                err1Event.errorMessage = 
"Cannot open file for reading";
                                                err1Event.errorCode = 2;
                                                
_target.dispatchEvent(err1Event);
                                        });
-                               }, function (e):void {
+                               }, function (e:Event):void {
                                        var err2Event:FileErrorEvent = new 
FileErrorEvent("ERROR");
                                        err2Event.errorMessage = "File does not 
exist";
                                        err2Event.errorCode = 1;
@@ -181,10 +181,10 @@ package org.apache.royale.storage.providers
                        COMPILE::JS {
                                var fullPath:String = 
String(cordova["file"]["dataDirectory"]) + fileName;
                
-                               
window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function 
(directoryEntry):void {
-                                       directoryEntry.getFile(fileName, { 
'create': true }, function (fileEntry):void {
-                                               fileEntry.createWriter(function 
(fileWriter):void {
-                                                       fileWriter.onwriteend = 
function (e):void {
+                               
window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function 
(directoryEntry:DirectoryEntry):void {
+                                       directoryEntry.getFile(fileName, new 
FileSystemCreateFlags(), function (fileEntry:FileEntry):void {
+                                               fileEntry.createWriter(function 
(fileWriter:FileWriter):void {
+                                                       fileWriter.onwriteend = 
function (e:Event):void {
                                                                var 
newEvent:FileEvent = new FileEvent("WRITE");
                                                                
_target.dispatchEvent(newEvent);
                                                                
@@ -192,28 +192,28 @@ package org.apache.royale.storage.providers
                                                                
_target.dispatchEvent(finEvent);
                                                        };
                                                        
-                                                       fileWriter.onerror = 
function (e):void {
+                                                       fileWriter.onerror = 
function (e:Event):void {
                                                                var 
newEvent:FileErrorEvent = new FileErrorEvent("ERROR");
                                                                
newEvent.errorMessage = "Failed to write the file.";
                                                                
newEvent.errorCode = 3;
                                                                
_target.dispatchEvent(newEvent);
                                                        };
                                                        
-                                                       var blob:Blob = new 
Blob([text], { type: 'text/plain' } as BlobPropertyBag);
+                                                       var blob:Blob = new 
Blob([text], new BlobPlainTextOptions());
                                                        fileWriter.write(blob);
-                                               }, function(e):void {
+                                               }, function(e:Event):void {
                                                        var 
errEvent:FileErrorEvent = new FileErrorEvent("ERROR");
                                                        errEvent.errorMessage = 
"Cannot open file for writing.";
                                                        errEvent.errorCode = 1;
                                                        
_target.dispatchEvent(errEvent);
                                                });
-                                       }, function(e):void {
+                                       }, function(e:Event):void {
                                                var errEvent:FileErrorEvent = 
new FileErrorEvent("ERROR");
                                                errEvent.errorMessage = "Cannot 
create file.";
                                                errEvent.errorCode = 4;
                                                _target.dispatchEvent(errEvent);
                                        });
-                               }, function(e):void {
+                               }, function(e:Event):void {
                                        var errEvent:FileErrorEvent = new 
FileErrorEvent("ERROR");
                                        errEvent.errorMessage = "Cannot create 
file.";
                                        errEvent.errorCode = 4;
@@ -239,9 +239,9 @@ package org.apache.royale.storage.providers
                        COMPILE::JS {
                                var fullPath:String = 
String(cordova["file"]["dataDirectory"]) + fileName;
                                
-                               
window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function 
(directoryEntry):void {
-                                       directoryEntry.getFile(fileName, { 
'create': true }, function (fileEntry):void {
-                                               fileEntry.createWriter(function 
(fileWriter):void {
+                               
window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function 
(directoryEntry:DirectoryEntry):void {
+                                       directoryEntry.getFile(fileName, new 
FileSystemCreateFlags, function (fileEntry:FileEntry):void {
+                                               fileEntry.createWriter(function 
(fileWriter:FileWriter):void {
                                                        var 
outputStream:DataOutputStream = new DataOutputStream(_target, fileEntry, 
fileWriter);
                                                        var newEvent:FileEvent 
= new FileEvent("READY");
                                                        newEvent.stream = 
outputStream;
@@ -253,3 +253,41 @@ package org.apache.royale.storage.providers
                }
        }
 }
+
+COMPILE::JS
+class BlobPlainTextOptions implements BlobPropertyBag
+{
+    public function get type():String
+    {
+        return "text/plain";
+    }
+    
+    public function set type(value:String):void
+    {
+        
+    }
+}
+
+COMPILE::JS
+class FileSystemCreateFlags implements FileSystemFlags
+{
+    public function get create():Boolean
+    {
+        return true;
+    }
+    
+    public function set create(value:Boolean):void
+    {
+        
+    }
+    
+    public function get exclusive():Boolean
+    {
+        return false;
+    }
+    
+    public function set exclusive(value:Boolean):void
+    {
+        
+    }
+}

Reply via email to