class: MCMczReader
authorClaus Gittinger <cg@exept.de>
Wed, 12 Feb 2014 18:30:06 +0100
changeset 913 224fedf76aa7
parent 912 ac114b27e760
child 914 df88e9c0b76a
class: MCMczReader changed: #loadDefinitions gracefully handle corrupt instance layouts; let user know what happened and give him a chance to decide how to proceed.
MCMczReader.st
--- a/MCMczReader.st	Wed Feb 12 16:38:13 2014 +0100
+++ b/MCMczReader.st	Wed Feb 12 18:30:06 2014 +0100
@@ -84,11 +84,33 @@
 !
 
 loadDefinitions
+        |doNotShowAgainHolder|
+
+        doNotShowAgainHolder := false asValue.
+
         definitions := OrderedCollection new.
-        (self zip isValidPath: 'snapshot.bin') ifTrue:
-                [ [^ definitions := (DataStream on: (self zip contentsOf: 'snapshot.bin') asByteArray readStream) next definitions]
-                        on: Error do: [:fallThrough|self halt ]].
-        "otherwise"
+        (self zip isValidPath: 'snapshot.bin') ifTrue:[ 
+            [
+                ^ definitions := (DataStream on: (self zip contentsOf: 'snapshot.bin') 
+                                    asByteArray readStream) next definitions
+            ] on: Error do: [:fallThrough|
+                doNotShowAgainHolder value ifTrue:[fallThrough proceed].
+
+                "/ self halt:fallThrough description
+                Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
+                    ex box addCheckBoxAtBottom:'Do not show this dialog again.' on:doNotShowAgainHolder.
+                ] do:[
+                    |answer|
+
+                    answer := Dialog confirmWithCancel:(fallThrough description,'\\Try proceeding with binary? (if NO, source is loaded)') withCRs. 
+                    answer isNil ifTrue:[AbortOperationRequest raise].
+                    answer ifTrue:[
+                        fallThrough proceed
+                    ].
+                ].
+            ]
+        ].
+        "otherwise (binay broken), try source"
 
         self breakPoint:#jv.
         (self zip membersMatching: 'snapshot/*')
@@ -136,13 +158,14 @@
 !MCMczReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCMczReader.st,v 1.7 2012-09-11 21:22:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCMczReader.st,v 1.8 2014-02-12 17:30:06 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCMczReader.st,v 1.7 2012-09-11 21:22:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCMczReader.st,v 1.8 2014-02-12 17:30:06 cg Exp $'
 !
 
 version_SVN
-    ^ '§Id: MCMczReader.st 23 2010-10-29 14:41:24Z vranyj1 §'
+    ^ '$Id: MCMczReader.st,v 1.8 2014-02-12 17:30:06 cg Exp $'
 ! !
+