Changeset 2494


Ignore:
Timestamp:
Aug 8, 2006, 1:20:26 PM (16 years ago)
Author:
Nicklas Nordborg
Message:
Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/parser/FlatFileParser.java

    r2481 r2494  
    797797    throws IOException
    798798  {
    799     if (nextData == null)
     799    if (nextData == null && nextSection == null)
    800800    {
    801801      boolean done = false;
  • trunk/src/test/TestFlatFileParser.java

    r2409 r2494  
    11import java.io.InputStream;
    2 import java.util.ArrayList;
    32import java.util.Arrays;
    4 import java.util.List;
     3import java.util.HashSet;
     4import java.util.Set;
    55import java.util.regex.Pattern;
    66
     
    115115      write("--Parse OK (" + file + ")");
    116116    }
    117     catch (Exception ex)
     117    catch (Throwable ex)
    118118    {
    119119      write("--Parse FAILED (" + file + ")");
     
    127127    try
    128128    {
    129       ArrayList<String> sections = new ArrayList<String>(Arrays.asList("[FileInformation]", "[Block1]", "[Block2]", "[Block3]", "[Block4]", "[mapping]"));
     129      Set<String> sections = new HashSet<String>(Arrays.asList("FileInformation", "Block1", "Block2", "Block3", "Block4", "mapping"));
    130130      InputStream in = FileUtil.getInputStream(new java.io.File(file));
    131131      ffp.setInputStream(in);
     
    134134      {
    135135        section = ffp.nextSection();
    136         sections.remove(section.line());
     136        sections.remove(section.name());
    137137        ffp.parseHeaders();
    138138        ffp.nextData();
     
    141141      if (!sections.isEmpty())
    142142      {
    143         write("--Parse sections FAILED didnt find all sections in (" + file + "), missed:" + sections);
     143        throw new Exception("Didn't find all sections in (" + file + "), missed: " + sections);
    144144      }
    145145      write("--Parse sections OK (" + file + ")");
    146146    }
    147     catch (Exception ex)
     147    catch (Throwable ex)
    148148    {
    149149      write("--Parse sections FAILED (" + file + ")");
Note: See TracChangeset for help on using the changeset viewer.