Changeset 471 in tmcsimulator for trunk/src/tmcsim


Ignore:
Timestamp:
07/29/2019 01:36:40 PM (7 years ago)
Author:
jdalbey
Message:

Coordinator.java: Fix defect 181 in sorting CADcomments. logging_service error messages improved.

Location:
trunk/src/tmcsim
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/application.properties

    r469 r471  
    1 #Sat, 27 Jul 2019 22:04:01 -0700 
     1#Mon, 29 Jul 2019 14:47:09 -0700 
    22 
    3 Application.revision=467 
     3Application.revision=470 
    44 
    5 Application.buildnumber=176 
     5Application.buildnumber=177 
  • trunk/src/tmcsim/cadsimulator/Coordinator.java

    r466 r471  
    837837            public int compare(String o1, String o2)  
    838838            { 
    839                 return extractInt(o1) - extractInt(o2); 
     839                // extract just the timestamp from the strings and convert them to int 
     840                // fixes #181 
     841                return extractInt(o1.substring(0,8)) - extractInt(o2.substring(0,8)); 
    840842            } 
    841843            // extract an integer from a String     
     
    843845            {   // remove all non-digits 
    844846                String num = s.replaceAll("\\D", ""); 
    845                 // return 0 if no digits found, else return the number 
    846                 return num.isEmpty() ? 0 : Integer.parseInt(num); 
     847                try 
     848                { 
     849                    // return 0 if no digits found, else return the number 
     850                    return num.isEmpty() ? 0 : Integer.parseInt(num); 
     851                } catch (NumberFormatException ex) 
     852                { 
     853                    System.out.println("Can't convert "+s+" to integer in writeToCAD. " +  
     854                    ex.getMessage()); 
     855                    return 0; 
     856                } 
    847857            } 
    848858        }); 
Note: See TracChangeset for help on using the changeset viewer.