1 22 package org.netbeans.lib.cvsclient.response; 23 24 import java.text.*; 25 import java.util.*; 26 import org.netbeans.lib.cvsclient.admin.*; 27 28 import org.netbeans.lib.cvsclient.util.*; 29 30 34 class ModTimeResponse implements Response { 35 36 39 protected static final SimpleDateFormat dateFormatter; 40 41 44 protected static final String SERVER_DATE_FORMAT = "dd MMM yyyy HH:mm:ss"; 46 static { 47 dateFormatter = new SimpleDateFormat(SERVER_DATE_FORMAT, Locale.US); 48 dateFormatter.setTimeZone(Entry.getTimeZone()); 49 } 50 51 58 public void process(LoggedDataInputStream dis, ResponseServices services) 59 throws ResponseException { 60 try { 61 String dateString = dis.readLine(); 62 63 Date date = dateFormatter.parse( 68 dateString.substring(0, dateString.length() - 6)); 69 if (date.getTime() < 0) { 70 if (date.getYear() < 100 && date.getYear() >= 70) { 76 date.setYear(date.getYear() + 1900); 77 } 78 else if (date.getYear() >= 0 && date.getYear() < 70) { 79 date.setYear(date.getYear() + 2000); 80 } 81 else { 82 date.setYear(2000 + date.getYear()); 83 90 } 91 } 92 services.setNextFileDate(date); 93 } 94 catch (Exception e) { 95 throw new ResponseException(e); 96 } 97 } 98 99 104 public boolean isTerminalResponse() { 105 return false; 106 } 107 } 108 | Popular Tags |