flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [2/2] git commit: [flex-utilities] [refs/heads/develop] - FLEX-34425 check if MD5 is actually valid and continue if possible
Date Mon, 27 Oct 2014 01:30:46 GMT
FLEX-34425 check if MD5 is actually valid and continue if possible


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/e1a8f26d
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/e1a8f26d
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/e1a8f26d

Branch: refs/heads/develop
Commit: e1a8f26dd72067b9ce2afcf1dd369af8defe86e7
Parents: 4ae0925
Author: Justin Mclean <jmclean@apache.org>
Authored: Mon Oct 27 12:29:53 2014 +1100
Committer: Justin Mclean <jmclean@apache.org>
Committed: Mon Oct 27 12:29:53 2014 +1100

----------------------------------------------------------------------
 installer/src/InstallApacheFlex.mxml            | 24 ++++++++++++--------
 .../flex/packageflexsdk/util/MD5CompareUtil.as  | 10 ++++++++
 2 files changed, 24 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e1a8f26d/installer/src/InstallApacheFlex.mxml
----------------------------------------------------------------------
diff --git a/installer/src/InstallApacheFlex.mxml b/installer/src/InstallApacheFlex.mxml
index 815384c..0b309c0 100644
--- a/installer/src/InstallApacheFlex.mxml
+++ b/installer/src/InstallApacheFlex.mxml
@@ -1576,17 +1576,21 @@ variables are not required because the locations of these pieces are
known.
         
         protected function uncompressApacheFlexSDK():void
         {
-            if (!_md5CompareUtil.fileIsVerified) {
-                updateActivityStep(_viewResourceConstants.STEP_VERIFY_FLEX_SDK, StepItem.ERROR);
-                
-                log(_viewResourceConstants.ERROR_VERIFY_FLEX_SDK);
-                
-                abortInstallation(_viewResourceConstants.ERROR_VERIFY_FLEX_SDK);
-                return;
+            if (_md5CompareUtil.validMD5) {
+				if (!_md5CompareUtil.fileIsVerified) {
+	                updateActivityStep(_viewResourceConstants.STEP_VERIFY_FLEX_SDK, StepItem.ERROR);
+	                
+	                log(_viewResourceConstants.ERROR_VERIFY_FLEX_SDK);
+	                
+	                abortInstallation(_viewResourceConstants.ERROR_VERIFY_FLEX_SDK);
+	                return;
+				} else {
+	                updateActivityStep(_viewResourceConstants.STEP_VERIFY_FLEX_SDK, StepItem.COMPLETE);
     
+	                log(_viewResourceConstants.INFO_VERIFY_FLEX_SDK_DONE);
+				}
             } else {
-                updateActivityStep(_viewResourceConstants.STEP_VERIFY_FLEX_SDK, StepItem.COMPLETE);
-                
-                log(_viewResourceConstants.INFO_VERIFY_FLEX_SDK_DONE);
+				updateActivityStep(_viewResourceConstants.STEP_VERIFY_FLEX_SDK, StepItem.COMPLETE);
+				log("Unable to verify MD5 as MD5 is not valid. Trying to continue.");
             }
             
             updateActivityStep(_viewResourceConstants.STEP_UNZIP_FLEX_SDK, StepItem.ACTIVE);

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/e1a8f26d/installer/src/org/apache/flex/packageflexsdk/util/MD5CompareUtil.as
----------------------------------------------------------------------
diff --git a/installer/src/org/apache/flex/packageflexsdk/util/MD5CompareUtil.as b/installer/src/org/apache/flex/packageflexsdk/util/MD5CompareUtil.as
index c422c9e..2dc601b 100644
--- a/installer/src/org/apache/flex/packageflexsdk/util/MD5CompareUtil.as
+++ b/installer/src/org/apache/flex/packageflexsdk/util/MD5CompareUtil.as
@@ -137,6 +137,13 @@ public class MD5CompareUtil extends EventDispatcher
 	{
 		return _fileIsVerified;
 	}
+	
+	private var _validMD5:Boolean;
+
+	public function get validMD5():Boolean
+	{
+		return _validMD5;
+	}
 
 	//--------------------------------------------------------------------------
 	//
@@ -204,6 +211,9 @@ public class MD5CompareUtil extends EventDispatcher
 			_remoteMD5Value = _remoteMD5Value.split("\n")[0];
 			_remoteMD5Value = _remoteMD5Value.split("\r")[0];
 			
+			// Valid MD5 hashes are 32 hexidecimal characters
+			_validMD5 = (_remoteMD5Value.search(new RegExp("[a-fA-F0-9]{32}")) == 0);
+
 			compareSignatures();
 		}
 		else


Mime
View raw message