Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2000 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis
5
 *    Purpose: To test the ReplicationServerList class by JUnit
6
 *    Authors: Jing Tao
7
 *
8
 *   '$Author: daigle $'
9
 *     '$Date: 2008-08-05 17:50:14 -0700 (Tue, 05 Aug 2008) $'
10
 * '$Revision: 4213 $'
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
 */
26

    
27
package edu.ucsb.nceas.metacattest;
28

    
29
import edu.ucsb.nceas.metacat.*;
30
import edu.ucsb.nceas.metacat.client.Metacat;
31
import edu.ucsb.nceas.metacat.client.MetacatFactory;
32
import edu.ucsb.nceas.metacat.service.PropertyService;
33
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
34
import edu.ucsb.nceas.utilities.IOUtil;
35
import edu.ucsb.nceas.utilities.XMLUtilities;
36
//import edu.ucsb.nceas.morpho.framework.*;
37
import junit.framework.Test;
38
import junit.framework.TestCase;
39
import junit.framework.TestResult;
40
import junit.framework.TestSuite;
41
import org.apache.commons.logging.Log;
42
import org.apache.commons.logging.LogFactory;
43
import org.w3c.dom.Document;
44
import org.w3c.dom.Node;
45
import org.w3c.dom.NodeList;
46

    
47
import java.io.*;
48
import java.net.*;
49
import java.text.SimpleDateFormat;
50
import java.util.*;
51

    
52

    
53
/**
54
 * This class is used to change the data file location for IPCC eml documents.
55
 * Currently IPCC eml documents point data file ti SRB server. However, the srb 
56
 * earthgrid is not very stable. We decided to change the online URL from srb to knb.
57
 * So this class will handle this case.
58
 * Before running this program, it needs:
59
 * 1. Downloaded data files from SRB
60
 * 2. A list of IPCC docid(with revision number) text file. If the text file is not available, it need
61
 * a metacat query file to search metacat to get the doicd list.
62
 * What the class will do:
63
 * 1. It will read the eml from Metacat.
64
 * 2. Get online URL information from eml document by DOM parser.
65
 * 3. Base on the URL information, this program will find the data file in
66
 *     the direcotry which contains the srb data file.
67
* 4. It will generate docid for the data file.
68
* 5. Upload the download srb data file to Metacat with assigned docid.
69
* 6. Modify the eml document with the new URL information (pointing to
70
 *     knb) and new version number in eml
71
 * 7. Update it to a new version in Metacat.
72
 * 8 . Go through above 7 steps for every eml document in the list.
73
 * 
74
 */ 
75
public class UploadIPCCDataTest extends TestCase
76
{
77
  
78
	 
79
	  /* Initialize properties*/
80
	  static
81
	  {
82
		  try
83
		  {
84
			  PropertyService.getInstance("build/tests");
85
			  MetaCatUtil.pathsForIndexing 
86
			         = MetaCatUtil.getOptionList(PropertyService.getProperty("xml.indexPaths"));
87
		  }
88
		  catch(Exception e)
89
		  {
90
			  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
91
		  }
92
	  }
93
	  
94
	  /**Constants*/
95
	  private static String SRBDATAFILEDIR = "/home/tao/data-file/IPCC"; // Dir for storing srb data file
96
	  private static String DOCLISTFILE       = "docidList"; // File name which stores IPCC document id
97
	  private static String METACATURL      = "http://chico.dyndns.org/knb/metacat";
98
	  private static String USERNAME          = "uid=dpennington,o=LTER,dc=ecoinformatics,dc=org";
99
	  private static String PASSWORD           = "password";
100
	  private static String TABLEONLINEURL= "/eml:eml/dataset/dataTable/physical/distribution/online/url";
101
	  private static String SPATIALONLINEURL = "/eml:eml/dataset/spatialRaster/physical/distribution/online/url";
102
	  private static String PACKAGEID               ="/eml:eml/@packageId";
103
	  private static String SRB                           = "srb://";
104
	  private static String KNB                           = "ecogrid://knb/";
105
	  private static String DATAIDPREFIX          = "IPCC";
106
	  private static String DOT                           = ".";
107
	  private static String SUCCESSLOG             = "update.log";
108
	  private static String ERRORLOG                = "error.log";
109
	  private static String CURRENT_CORRECTFILENAME = "correct_filename.csv";
110
	  private File log = new File(SUCCESSLOG);
111
	  private File error = new File (ERRORLOG);
112
	  
113
	  
114
	  /**
115
	   * Constructor to build the test
116
	   *
117
	   * @param name the name of the test method
118
	   */
119
	  public UploadIPCCDataTest(String name)
120
	  {
121
	    super(name);
122
	    
123
	  }
124

    
125

    
126
	  /**
127
	   * Create a suite of tests to be run together
128
	   */
129
	  public static Test suite()
130
	  {
131
		   TestSuite suite = new TestSuite();
132
		   //suite.addTest(new UploadIPCCDataTest("modifyEMLDocsWithCorrectDataFileName"));
133
		   //suite.addTest(new UploadIPCCDataTest("modifyEMLDocsWithIncorrectDataFileName"));
134
		    return suite;
135
	 }
136
	  
137
	  /**
138
	   * Modify EML Docs' data url online from SRB to ecogrid.
139
	   *Those eml docs pointe valide srb file names.
140
	   */
141
	  public void modifyEMLDocsWithCorrectDataFileName()
142
	  {
143
		  boolean originalDataFileIncorrect = false;
144
		  updateEML(originalDataFileIncorrect);
145
	  }
146
	  /**
147
	   * Modify EML Docs' data url online from SRB to ecogrid.
148
	   *Those eml docs pointe invalide srb file names.
149
	   */
150
	  public void modifyEMLDocsWithIncorrectDataFileName()
151
	  {
152
		  boolean originalDataFileIncorrect = true;
153
		  updateEML(originalDataFileIncorrect);
154
	  }
155
	  /*
156
	   * Upload the data file to Metacat and modify the eml documents
157
	   * @return
158
	   * @throws Exception
159
	   */
160
	  private void updateEML(boolean originalDataFileIncorrect)
161
	  {
162
		  
163
		      // Get eml document first
164
			  Vector list = getDocumentList();
165
			  //If list is not empty, goes through every document by handleSingleEML method -
166
			  //1. It will read the eml from Metacat.
167
			  // 2. Get online URL information from eml document by DOM parser.
168
			  // 3. Base on the URL information, this program will find the data file in
169
			  // the direcotry which contains the srb data file.
170
			  // 4. It will generate docid for the data file
171
              // 5. At last upload the download srb data file to Metacat with assigned docid.
172
			  // 6. Modify the eml document with the new URL information (pointing to
173
			  // knb) and new version number in eml.
174
			  // 7.Update it to a new version in Metacat.
175
			  
176
              if (list != null && !list.isEmpty())
177
              {
178
            	   int size = list.size();
179
            	   for (int i=0; i<size; i++)
180
            	   {
181
            		   String docid = null;
182
            		   try
183
            		   {
184
            			   docid = (String)list.elementAt(i);
185
            			   String dataId = handleSingleEML(docid, originalDataFileIncorrect);
186
            			   String message = "Successfully update eml "+docid + " with data id "+dataId;
187
            			   writeLog(log, message);
188
            		   }
189
            		   catch(Exception e)
190
            		   {
191
            			   System.err.println("Failed to handle eml document "+docid + " since "+
192
            					   e.getMessage());
193
            			   String message = "failed to update eml "+docid + "\n "+e.getMessage();
194
            			   writeLog(error, message);
195
            		   }
196
            	   }
197
              }
198
              else
199
              {
200
            	  System.err.println("There is no EML document to handle");
201
              }
202
		
203
	  }
204
	  
205
	  /*
206
	   * Does actually job to upload data file and modify eml document for a given id.
207
	   * Here are its tasks:
208
	   * 1. It will read the eml from Metacat.
209
	   * 2. Get online URL information from eml document by DOM parser.
210
	   * 3. Base on the URL information, this program will find the data file in
211
	   *     the direcotry which contains the srb data file.
212
	   * 4. It will generate docid for the data file.
213
	   * 5. Upload the download srb data file to Metacat with assigned docid.
214
	   * 6. Modify the eml document with the new URL information (pointing to
215
	   *     knb) and new version number in eml
216
	   * 7. Update it to a new version in Metacat.
217
	   * 
218
	   */	 
219
	  private String handleSingleEML(String docid,boolean originalDataFileIncorrect) throws Exception
220
	  {
221
		  Metacat metacat = MetacatFactory.createMetacatConnection(METACATURL);
222
		  // login metacat 
223
		  String response = metacat.login(USERNAME, PASSWORD);
224
		  if (response.indexOf("<login>") == -1)
225
		  {
226
			  throw new Exception("login failed "+response);
227
		  }
228
		  // 1. Reads eml document from metacat
229
		  Reader r = metacat.read(docid);
230
          Document DOMdoc = XMLUtilities.getXMLReaderAsDOMDocument(r);
231
          Node rootNode = (Node)DOMdoc.getDocumentElement();
232
          
233
          //2.  Gets online url information. If onlineUrl is not SRB, through an exception
234
          String onlineUrl = getOnLineURL(rootNode);
235
          //System.out.println("=================The url is "+onlineUrl);
236
          
237
          //3. Find the srb data file 
238
          String dataFileName = getDataFileNameFromURL(onlineUrl);
239
          //System.out.println("the data fileName in eml "+dataFileName);
240
          //If the dataFileName in original eml is wrong, we need to look up the
241
          // the correct name first
242
          if (originalDataFileIncorrect)
243
          {
244
        	  Hashtable correctName = getCurrent_CorrectFileNamesPair();
245
        	  dataFileName =(String) correctName.get(dataFileName);
246
          }
247
          //System.out.println("=================The data file is "+dataFileName);
248
          File dataFile = null;
249
          dataFile = new File(SRBDATAFILEDIR,dataFileName);
250
           if (!dataFile.exists())
251
           {
252
        	  throw new Exception("Couldn't find the data file in srb data directory "+dataFile);
253
          }
254
           
255
          //4. Generate docid for data file
256
          String dataId = generateId();
257
          //System.out.println("=======The docid for data file will be "+dataId);
258
          
259
          //5. upload data file to Metacat
260
          response = metacat.upload(dataId, dataFile);
261
          if (response.indexOf("<success>") == -1)
262
          {
263
        	  throw new Exception("Couldn't upload data file "+dataFileName +
264
        			  " with id "+dataId+ " into Metacat since "+response);
265
          }
266
          
267
          //6. Updates eml online url and package id in DOM
268
          String newId = updateEMLDoc(rootNode, docid, dataId);
269
          //System.out.println("The new docid is ========"+newId);
270
          
271
          //Put EML DOM with the new packagId and oneline url into a StringWriter and store it to String
272
          StringWriter stringWriter = new StringWriter();
273
          PrintWriter printWriter = new PrintWriter(stringWriter);
274
		  XMLUtilities.print(rootNode, printWriter);
275
		  String xml = stringWriter.toString();
276
		  //System.out.println("the xml is "+xml);		  
277
		  
278
		  //7.insert new (update) EML document into Metacat
279
          StringReader xmlReader = new StringReader(xml);
280
          response = metacat.update(newId, xmlReader, null);
281
          if (response.indexOf("<success>") == -1)
282
          {
283
        	  throw new Exception("Upload data file "+dataFileName +
284
        			  " with id "+dataId+ " successfully but update eml "+newId +" failed since "+ response);
285
          }
286
          metacat.logout();
287
          return dataId;
288
	  }
289
	  
290
	  /*
291
	   * Gets onlineUrl value from a given eml DOM document.
292
	   * The online url xpath can be "/eml/dataset/dataTable/physical/distribution/online/url"
293
	   * or "/eml/dataset/spatialRaster/physical/distribution/online/url"
294
	   */
295
	  private String getOnLineURL(Node root) throws Exception
296
	  {
297
		  String url = null;
298
		  if (root == null)
299
		  {
300
			  throw new Exception("root node for this EML is null and couldn't get online url from it");
301
		  }
302
		  Node urlNode = XMLUtilities.getTextNodeWithXPath(root, TABLEONLINEURL);
303
		  // in table online url does exist, we will try to use another xpath - SPATIALONLEURL
304
		  if (urlNode == null)
305
		  {
306
			  urlNode = XMLUtilities.getTextNodeWithXPath(root, SPATIALONLINEURL);
307
		  }
308
		  // Couldn't find any matche element, throw exception
309
		  if(urlNode == null)
310
		  {
311
			  throw new Exception("Couldn't find any onlie url information in eml document");
312
		  }
313
		  //Gets text node value and if the url doesn't contain "srb;//", it will throw a exception
314
		 url = urlNode.getNodeValue();
315
		 if (url == null || url.indexOf(SRB)== -1)
316
		 {
317
			 throw new Exception("The online url doesn't have srb protocol and we don't need to handle");
318
		 }
319
		  return url;
320
	  }
321
	  
322
	  /*
323
	   * Automatically to generate a unique id for ddata file. 
324
	   * This id will be looked like - DATAIDPREFIX.numberBaseonTime.1, e.g
325
	   * IPCC.20072321.1
326
	   */
327
	  private String generateId()
328
	  {
329
		  int version = 1;
330
		  StringBuffer docid = new StringBuffer(DATAIDPREFIX);
331
		  docid.append(DOT);
332
				     
333
		  // Create a calendar to get the date formatted properly
334
		  String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
335
		  SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
336
		  pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2*60*60*1000);
337
		  pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2*60*60*1000);
338
		  Calendar calendar = new GregorianCalendar(pdt);
339
		  Date trialTime = new Date();
340
		  calendar.setTime(trialTime);
341

    
342
			int time = 0; 
343
			
344
			docid.append(calendar.get(Calendar.YEAR));
345
			
346
			time = calendar.get(Calendar.DAY_OF_YEAR);
347
			if(time < 10){
348
				docid.append("0");
349
				docid.append("0");
350
				docid.append(time);
351
			} else if(time < 100) {
352
				docid.append("0");
353
				docid.append(time);
354
			} else {
355
				docid.append(time);
356
			}
357
			
358
			time = calendar.get(Calendar.HOUR_OF_DAY);
359
			if(time < 10){
360
				docid.append("0");
361
				docid.append(time);
362
			} else {
363
				docid.append(time);
364
			}
365
			
366
			time = calendar.get(Calendar.MINUTE);
367
			if(time < 10){
368
				docid.append("0");
369
				docid.append(time);
370
			} else {
371
				docid.append(time);
372
			}
373
			
374
			time = calendar.get(Calendar.SECOND);
375
			if(time < 10){
376
				docid.append("0");
377
				docid.append(time);
378
			} else {
379
				docid.append(time);
380
			}		    
381
			 //sometimes this number is not unique, so we append a random number
382
			int random = (new Double(Math.random()*100)).intValue();
383
			docid.append(random);
384
			docid.append(DOT);
385
			docid.append(version);
386
			
387
			return docid.toString();
388
		 
389
	  }
390
	  /*
391
	   * Get data file name from online url. SRB oneline url will looks like -
392
	   * srb://seek:/home/beam.seek/IPCC_climate/Present/ccld6190.dat.
393
	   * The last part - ccld6190.dat is the file name. This method will get
394
	   * the file name from the give url
395
	   */
396
	  private String getDataFileNameFromURL(String onlineUrl) throws Exception
397
	  {
398
		  String dataFile = null;
399
		  String slash = "/";
400
		  if (onlineUrl != null)
401
		  {
402
			  int index = onlineUrl.lastIndexOf(slash);
403
			  try
404
			  {
405
			     dataFile = onlineUrl.substring(index+1);
406
			  }
407
			  catch(Exception e)
408
			  {
409
				  throw new Exception("Couldn't get data file name from the given url "+onlineUrl+
410
						  " since "+e.getMessage());
411
			  }
412
		  }
413
		  return dataFile;
414
	  }
415
	  
416
	  
417
     
418
      /*
419
       * Gets eml document list from text file. The text file format should be:
420
       * tao.1.1
421
       * tao.2.1
422
       */
423
	  private Vector getDocumentListFromFile() throws Exception
424
	  {
425
		  Vector docList = new Vector();
426
		  File docListFile = new File(SRBDATAFILEDIR,DOCLISTFILE);
427
		  FileReader docListFileReader= new FileReader(docListFile);
428
		  BufferedReader readDocList = new BufferedReader(docListFileReader);
429
		  // Read every line from the text file and put it into a vector
430
		  String docid = readDocList.readLine();
431
		  while (docid != null)
432
		  {
433
			  // If the docid string is not empty, put it into vector
434
			  if (!docid.trim().equals(""))
435
			  {
436
			     docList.add(docid.trim());
437
			  }
438
			  docid = readDocList.readLine();
439
		  }
440
		  return docList;
441
	  }
442
	  
443
	  /*
444
	   * Update the given eml document (in DOM). There are two places to be updated 
445
	   * The package id will be increased 1, i.e.,  from 1 to 2. The distribution online url will
446
	   * point to the new ecogrid id, i.e. , ecogrid://knb/IPCC.2007.1 
447
	   */
448
	  private String updateEMLDoc(Node root, String docid, String dataId) throws Exception 
449
	  {
450
		  // update package id
451
		  docid = getIncreasedNewDocid(docid);
452
		  XMLUtilities.addAttributeNodeToDOMTree( root, PACKAGEID, docid);
453
	      // update online url.  oneline url should either in spatialRaster or dataTable.
454
		  // First try to see if spatialRaster exist or not. If not try data table
455
		  String newUrl = KNB+dataId; //new url looks like ecogrid://knb/IPCC.2007.1
456
		  boolean isSpatialRaster = true;
457
		  boolean isDataTable = false;
458
		  Node urlNode = XMLUtilities.getTextNodeWithXPath(root, SPATIALONLINEURL);
459
		  if (urlNode == null)
460
		  {
461
			  // has no spatialRaster 
462
			 isSpatialRaster = false;		
463
		  }
464
		  else
465
		  {
466
			  // has spatialRaster
467
			  isSpatialRaster = true;		  
468
		  }
469
		  // determin if has datable or not
470
		  urlNode = XMLUtilities.getTextNodeWithXPath(root,TABLEONLINEURL);
471
		  if (urlNode != null)
472
		  {
473
				 isDataTable = true;
474
		  }
475
		  
476
		  if (isSpatialRaster && !isDataTable)
477
		  {
478
			 //only has spatialRaster and no dataTable, update spatialRaster online url
479
			  XMLUtilities.addTextNodeToDOMTree(root, SPATIALONLINEURL, newUrl);
480
		  }
481
		  else if (!isSpatialRaster && isDataTable)
482
		  {
483
              //only has dataTable and no spatialRaster, update dataTable online url
484
			  XMLUtilities.addTextNodeToDOMTree(root, TABLEONLINEURL, newUrl);
485
		  }
486
		  else
487
		  {
488
			  //some strange things happen
489
			  throw new Exception("The eml either has both dataTable or spatialRaster OR doesn't has any entity");
490
		  }
491
		  return docid;
492
	  }
493
	  
494
	  /*
495
	   * Gets new docid with increased version. Docid looks like tao.1.1. The new docid will be
496
	   * tao.1.2.
497
	   */
498
	  private String getIncreasedNewDocid(String docid) throws Exception
499
	  {
500
		  int rev = 1;
501
		  String revision = null;
502
		  String prefix = null;
503
		  String newId = null;
504
		  if (docid != null)
505
		  {
506
			  int index = docid.lastIndexOf(DOT);
507
			  try
508
			  {
509
				 // Get revsion part(1)
510
			     revision = docid.substring(index+1);
511
			     // Get prefix part (tao.1.)
512
			     prefix    = docid.substring(0, index+1);
513
			     // increase version from 1 to 2
514
			     rev = (new Integer(revision)).intValue();
515
			     rev++;
516
			     // combines the prefix tao.1. and new revision2 to get tao.1.2
517
			     newId= prefix+rev;
518
			     
519
			  }
520
			  catch(Exception e)
521
			  {
522
				  throw new Exception("Couldn't increase revsion number from the given docid "+docid+
523
						  " since "+e.getMessage());
524
				
525
			  }
526
		  }
527
		  return newId;
528
	  }
529
	  
530
	  /*
531
	   * Gets eml document list from searching Metacat
532
	   * TO-DO: This method need to be implemented
533
	   */
534
	  private Vector getDocumentListFromMetacat()
535
	  {
536
		  Vector docList = new Vector();
537
		  return docList;
538
	  }
539
	  
540
	  /*
541
	   * Get eml document list. First this method will try
542
	   * to get the eml document list form text file. If the result is empty or
543
	   * it caught an exception it will try to get eml document list from metacat.
544
	   */
545
	  private Vector getDocumentList()
546
	  {
547
		  Vector list = null;
548
		  try
549
		  {
550
			  //First, try to get eml doc list from text file
551
			  list = getDocumentListFromFile();
552
			  if (list == null || list.isEmpty())
553
			  {
554
				  throw new Exception("The eml doclist is empty in text file");
555
			  }
556
		  }
557
		  catch(Exception e)
558
		  {
559
			  System.err.println("Couldn't get eml document list from text file: "+e.getMessage());
560
			  // If an exception happened, try to get eml doc list from metacat
561
			  list = getDocumentListFromMetacat();
562
		  }
563
		  if (list != null)
564
		  {
565
			  System.out.println("the list is "+list);
566
		  }
567
		  return list;
568
	  }
569
	  
570
	  /*
571
	   * Writes error message into log file.
572
	   */
573
	  private void writeLog(File file, String message)
574
	  {
575
	    try
576
	    {
577
	      FileOutputStream fos = new FileOutputStream(file, true);
578
	      PrintWriter pw = new PrintWriter(fos);
579
	      SimpleDateFormat formatter = new SimpleDateFormat ("yy-MM-dd HH:mm:ss");
580
	      java.util.Date localtime = new java.util.Date();
581
	      String dateString = formatter.format(localtime);
582
	      dateString += " :: " + message;
583
	      //time stamp each entry
584
	      pw.println(dateString);
585
	      pw.flush();
586
	      pw.close();
587
	      fos.close();
588
	    }
589
	    catch(Exception e)
590
	    {
591
	      System.out.println("error writing to replication log from " +
592
	                         "MetacatReplication.replLog: " + e.getMessage());
593
	      //e.printStackTrace(System.out);
594
	    }
595
	 }
596
	  
597
	  /*
598
	   * Read a csv file which contains current data file name and correct data file name. 
599
	   * The format of csv file is:
600
	   * currentname1,correctname1
601
	   * currentname2,correctname2
602
	   * ........
603
	   * The return value is hash table, the current data file name is key and correct file name is
604
	   * value.
605
	   */
606
	   private Hashtable getCurrent_CorrectFileNamesPair() throws Exception
607
	   {
608
		   Hashtable fileNamesHash = new Hashtable();
609
		   File current_correctFileNames = new File(CURRENT_CORRECTFILENAME);
610
		   FileReader fileReader= new FileReader(current_correctFileNames);
611
		   BufferedReader readDocList = new BufferedReader(fileReader);
612
		   // Read every line from the text file, this line will look like:
613
		   // currentname1,correctname1
614
		   String lineString = readDocList.readLine();
615
		   while (lineString != null)
616
		   {
617
			   //Get the comma index number
618
			   int commaIndex = lineString.indexOf(",");
619
			   if (commaIndex != -1)
620
			   {
621
			      //Get the current file name part
622
			      String currentName = lineString.substring(0, commaIndex);
623
			      //Get the correct file name part
624
			      String correctName = lineString.substring(commaIndex+1, lineString.length());
625
				  if (currentName != null && correctName != null)
626
				  {
627
					  fileNamesHash.put(currentName.trim(), correctName.trim());
628
				  }
629
			  }
630
			   lineString = readDocList.readLine();
631
		   }
632
		   return fileNamesHash;
633
	   }
634
}
(19-19/20)