From: Albert A. <ap...@em...> - 2005-11-18 13:23:14
|
Method getDate(String arg) had the following bugs: - incorrect parsing of argument string - returned date was offset by 1 month ciao apa *** JournalCommand.java Fri Nov 18 14:03:59 2005 --- modules/core/src/com/babeldoc/core/journal/command/JournalCommand.java = Fri Nov 18 14:01:51 2005 *************** *** 59,63 **** * Babeldoc: The Universal Document Processor * ! * $Header: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core= /journal/command/JournalCommand.java,v 1.8 2004/07/30 01:33:00 triphop Exp $ * $DateTime$ * $Author: triphop $ --- 59,63 ---- * Babeldoc: The Universal Document Processor * ! * $Header: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core= /journal/command/JournalCommand.java,v 1.6 2003/09/16 05:19:00 triphop Exp $ * $DateTime$ * $Author: triphop $ *************** *** 66,70 **** package com.babeldoc.core.journal.command; =20=20 - import com.babeldoc.core.BabeldocCommand; import com.babeldoc.core.I18n; import com.babeldoc.core.LogService; --- 66,69 ---- *************** *** 76,80 **** import com.babeldoc.core.journal.query.QueryOption; import com.babeldoc.core.journal.query.QueryTicket; - import com.babeldoc.core.pipeline.PipelineDocument; import com.mindprod.csv.CSVWriter; =20=20 --- 75,78 ---- *************** *** 101,120 **** * @version 1.0 */ ! public class JournalCommand extends BabeldocCommand { ! /** constants: display xml. */ private static final int XML_DISP =3D 1; =20=20 ! /** constants: display csv. */ private static final int CSV_DISP =3D 2; =20=20 ! /** instance: display mode. */ private int dispMode =3D 0; -=20=20=20 - private LogService log =3D LogService.getInstance(this.getClass().getNa= me()); =20=20 /** ! * process the commandline arguments. * ! * @param args command line arguments. */ public JournalCommand(String[] args) { --- 99,116 ---- * @version 1.0 */ ! public class JournalCommand extends com.babeldoc.core.BabeldocCommand { ! /** constants: display xml */ private static final int XML_DISP =3D 1; =20=20 ! /** constants: display csv */ private static final int CSV_DISP =3D 2; =20=20 ! /** instance: display mode */ private int dispMode =3D 0; =20=20 /** ! * process the commandline arguments * ! * @param args */ public JournalCommand(String[] args) { *************** *** 123,127 **** =20=20 /** ! * handle displaying of a document. * * @param cmdLine the command line --- 119,123 ---- =20=20 /** ! * handle displaying of a document * * @param cmdLine the command line *************** *** 139,144 **** =20=20 try { ! PipelineDocument doc =3D JournalFactory. ! getJournal().getDocumentAtTicketStep(ticket, step); =20=20 if (doc !=3D null) { --- 135,141 ---- =20=20 try { ! com.babeldoc.core.pipeline.PipelineDocument doc =3D JournalFactory.= getJournal() ! .ge= tDocumentAtTicketStep(ticket, ! step); =20=20 if (doc !=3D null) { *************** *** 151,158 **** } } else { ! log.logWarn(I18n.get("012004")); } } catch (Exception e) { ! log.logWarn(I18n.get("000051", e)); } =20=20 --- 148,155 ---- } } else { ! System.out.println(com.babeldoc.core.I18n.get("012004")); } } catch (Exception e) { ! System.err.println(I18n.get("000051", e)); } =20=20 *************** *** 161,165 **** =20=20 /** ! * Listing ticket information. * * @param cmdLine the command line --- 158,162 ---- =20=20 /** ! * Listing ticket information * * @param cmdLine the command line *************** *** 189,193 **** max =3D Integer.parseInt(cmdLine.getOptionValue('n')); } catch (Exception e) { ! log.logError(I18n.get("012002"), e); } } --- 186,191 ---- max =3D Integer.parseInt(cmdLine.getOptionValue('n')); } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError(I18n.get("012= 002"), ! null); } } *************** *** 197,201 **** index =3D Integer.parseInt(cmdLine.getOptionValue('i')); } catch (Exception e) { ! LogService.getInstance().logError(I18n.get("012003"), null); } --- 195,199 ---- index =3D Integer.parseInt(cmdLine.getOptionValue('i')); } catch (Exception e) { ! com.babeldoc.core.LogService.getInstance().logError(I18n.get("012= 003"), null); } *************** *** 229,233 **** renderQueryTickets(qts); } catch (Exception e) { ! log.logWarn(I18n.get("000051", e)); } =20=20 --- 227,231 ---- renderQueryTickets(qts); } catch (Exception e) { ! System.err.println(com.babeldoc.core.I18n.get("000051", e)); } =20=20 *************** *** 236,240 **** =20=20 /** ! * handle replaying of a ticket. * * @param cmdLine the command line --- 234,238 ---- =20=20 /** ! * handle replaying of a ticket * * @param cmdLine the command line *************** *** 254,258 **** JournalFactory.getJournal().replayTicket(ticket, step); } catch (Exception e) { ! log.logWarn(I18n.get("000051", e)); } =20=20 --- 252,256 ---- JournalFactory.getJournal().replayTicket(ticket, step); } catch (Exception e) { ! System.err.println(I18n.get("000051", e)); } =20=20 *************** *** 261,265 **** =20=20 /** ! * handle listing the steps for a ticket. * * @param cmdLine the command line --- 259,263 ---- =20=20 /** ! * handle listing the steps for a ticket * * @param cmdLine the command line *************** *** 278,282 **** renderQueryTickets(qts); } catch (Exception e) { ! log.logWarn(I18n.get("000051", e)); } =20=20 --- 276,280 ---- renderQueryTickets(qts); } catch (Exception e) { ! System.err.println(I18n.get("000051", e)); } =20=20 *************** *** 285,291 **** =20=20 /** ! * Execute the command line. * ! * @param commandLine command line */ public void execute(CommandLine commandLine) { --- 283,289 ---- =20=20 /** ! * Execute the command line * ! * @param commandLine */ public void execute(CommandLine commandLine) { *************** *** 304,310 **** =20=20 /** ! * Main routine. * ! * @param args commandline. */ public static void main(String[] args) { --- 302,308 ---- =20=20 /** ! * Main routine * ! * @param args */ public static void main(String[] args) { *************** *** 358,362 **** =20=20 /** ! * Convert a string date into a java date. * * @param arg the date string --- 356,360 ---- =20=20 /** ! * Convert a string date into a java date * * @param arg the date string *************** *** 366,378 **** protected Date getDate(String arg) { if (arg.length() =3D=3D "CCYYMMDDhhmmss".length()) { ! int YY =3D Integer.parseInt(arg.substring(0, 3)); ! int MM =3D Integer.parseInt(arg.substring(4, 5)); ! int DD =3D Integer.parseInt(arg.substring(6, 7)); ! int hh =3D Integer.parseInt(arg.substring(8, 9)); ! int mm =3D Integer.parseInt(arg.substring(10, 11)); ! int ss =3D Integer.parseInt(arg.substring(12, 13)); !=20 Calendar cal =3D Calendar.getInstance(); ! cal.set(YY, MM, DD, hh, mm, ss); =20=20 return cal.getTime(); --- 364,376 ---- protected Date getDate(String arg) { if (arg.length() =3D=3D "CCYYMMDDhhmmss".length()) { ! int YY =3D Integer.parseInt(arg.substring(0, 4)); ! int MM =3D Integer.parseInt(arg.substring(4, 6)); ! int DD =3D Integer.parseInt(arg.substring(6, 8)); ! int hh =3D Integer.parseInt(arg.substring(8, 10)); ! int mm =3D Integer.parseInt(arg.substring(10, 12)); ! int ss =3D Integer.parseInt(arg.substring(12, 14)); Calendar cal =3D Calendar.getInstance(); ! //Month parameter of cal expects 0 based month value (Jan =3D 0) ! cal.set(YY, MM-1, DD, hh, mm, ss); =20=20 return cal.getTime(); *************** *** 383,387 **** =20=20 /** ! * Determine if the argument at the position is a valid display mode mo= difier. * * @param commandline the command line --- 381,385 ---- =20=20 /** ! * Determine if the argument at the position is a valid display mode mo= difier * * @param commandline the command line *************** *** 400,404 **** =20=20 /** ! * Query the journal and render the results. * * @param qts The tickets to query --- 398,402 ---- =20=20 /** ! * Query the journal and render the results * * @param qts The tickets to query *************** *** 457,459 **** } } -=20 --- 455,456 ---- --=20 ___________________________________________________ Play 100s of games for FREE! http://games.mail.com/ |