Index: /branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/resort_catalog.c
===================================================================
--- /branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/resort_catalog.c	(revision 38743)
+++ /branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/resort_catalog.c	(revision 38744)
@@ -40,6 +40,4 @@
   resort_catalog_lensing (catalog);
   resort_catalog_starpar (catalog);
-
-  // XXX somehow need to set the value of lensing->measure offset here 
 }
 
@@ -85,12 +83,12 @@
       // earlier formats did not carry the objID or catID, so they are not available (we could assign on load, but we don't)
       myAssert(average[averageSeq[i]].catID == measure[measureSeq[i]].catID, "object / detection mismatch");
-# if (1)
       // myAssert(average[averageSeq[i]].objID == measure[measureSeq[i]].objID, "object / detection mismatch");
-      // check if the objID is correct. if not, check if it is byte-swapped (this has happened) and repair if so.  
-      // otherwise, abort
+
+      // Check some possible causes for objID failures
       if (average[averageSeq[i]].objID != measure[measureSeq[i]].objID) {
 	fprintf (stderr, "object / detection mismatch average.objID = %d, measure.objID = %d, catID: %d, detID: %d", 
 		 average[averageSeq[i]].objID, measure[measureSeq[i]].objID, 
 		 measure[measureSeq[i]].catID, measure[measureSeq[i]].detID);
+	// is the byte-swapped value the correct objID?
 	int objIDalt = measure[measureSeq[i]].objID;
 	char *byte = (char *) &objIDalt;
@@ -99,14 +97,15 @@
 	tmp = byte[1]; byte[1] = byte[2]; byte[2] = tmp;
 	if (average[averageSeq[i]].objID == objIDalt) {
-	  fprintf (stderr, "objID is byte-swapped, repairing\n");
-	  measure[measureSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
-	} else if (measure[measureSeq[i]].objID == 0) {
-	  fprintf (stderr, "objID is 0, repairing\n");
-	  measure[measureSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
+	  myAbort ("measure.objID is byte-swapped, consider repairing\n");
+	  // measure[measureSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
+	} 
+	if (measure[measureSeq[i]].objID == 0) {
+	  myAbort ("measure.objID is 0, repairing\n");
+	  // measure[measureSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
 	} else {
-	  myAbort ("objID is NOT byte-swapped, aborting\n");
+	  myAbort ("objID is NOT byte-swapped and NOT 0, aborting\n");
 	}
       }
-# else
+# if (0)
       // for reasons I do not understand, the mini dvodbs generated on stsci1X had a handful of detections with an inconsistency between averef and objID.  
       // this happened for 28 detections in the dbs on /data/stsci1?.0/eugene/dvo3pi.20130616, but not at all (as far as I know) in the rest of LAP DVO
@@ -243,14 +242,5 @@
       // earlier formats did not carry the objID or catID, so they are not available (we could assign on load, but we don't)
       myAssert(average[averageSeq[i]].catID == lensing[lensingSeq[i]].catID, "object / detection mismatch");
-# if (1)
       myAssert(average[averageSeq[i]].objID == lensing[lensingSeq[i]].objID, "object / detection mismatch");
-# else
-      // for reasons I do not understand, the mini dvodbs generated on stsci1X had a handful of detections with an inconsistency between averef and objID.  
-      // this happened for 28 detections in the dbs on /data/stsci1?.0/eugene/dvo3pi.20130616, but not at all (as far as I know) in the rest of LAP DVO
-      if (average[averageSeq[i]].objID != lensing[lensingSeq[i]].objID) {
-	fprintf (stderr, "R");
-	lensing[lensingSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
-      }
-# endif
     }
   }
@@ -380,14 +370,5 @@
       // earlier formats did not carry the objID or catID, so they are not available (we could assign on load, but we don't)
       myAssert(average[averageSeq[i]].catID == starpar[starparSeq[i]].catID, "object / detection mismatch");
-# if (1)
       myAssert(average[averageSeq[i]].objID == starpar[starparSeq[i]].objID, "object / detection mismatch");
-# else
-      // for reasons I do not understand, the mini dvodbs generated on stsci1X had a handful of detections with an inconsistency between averef and objID.  
-      // this happened for 28 detections in the dbs on /data/stsci1?.0/eugene/dvo3pi.20130616, but not at all (as far as I know) in the rest of LAP DVO
-      if (average[averageSeq[i]].objID != starpar[starparSeq[i]].objID) {
-	fprintf (stderr, "R");
-	starpar[starparSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
-      }
-# endif
     }
   }
