Changeset 29821

Show
Ignore:
Timestamp:
02.04.2015 13:22:05 (5 years ago)
Author:
kjdon
Message:

Detecting and handling the case where a 0 has been entered into hierarchy numbering in an hfile.

Location:
main/trunk/greenstone2/perllib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/classify.pm

    r29574 r29821  
    353353    { 
    354354    my $classifier_info = $classifier->get_classify_info($gli); 
    355     $classifier_info->{'classifyOID'} = "CL$next_classify_num" unless defined($classifier_info->{'classifyOID'}); 
    356         print STDERR "*** outputting information for classifier: $classifier_info->{'classifyOID'}\n"; 
    357  
    358     push(@{$classifyinfo->{'contains'}}, $classifier_info); 
     355    if (defined $classifier_info) { 
     356        $classifier_info->{'classifyOID'} = "CL$next_classify_num" unless defined($classifier_info->{'classifyOID'}); 
     357        print STDERR "*** outputting information for classifier: $classifier_info->{'classifyOID'}\n"; 
     358 
     359        push(@{$classifyinfo->{'contains'}}, $classifier_info); 
     360    } else { 
     361        print STDERR "*** error with classifier CL$next_classify_num, not outputing it\n"; 
     362    } 
    359363    $next_classify_num++; 
     364 
    360365    } 
    361366 
  • main/trunk/greenstone2/perllib/classify/HFileHierarchy.pm

    r28564 r29821  
    216216    foreach my $OID (sort keys (%$list)) { 
    217217    my $tempinfo = $self->get_OID_entry ($OID, $classifyinfo, "$classifier_num.$OID", $list->{$OID}->{'title'}, "VList"); 
    218      
     218    if (not defined ($tempinfo)) { 
     219        print STDERR "Error occurred for node $OID. Not creating the classifier \n"; 
     220        return undef; 
     221    } 
    219222    if (defined $self->{'sort'}) { 
    220223        if ($self->{'reverse_sort'}) { 
     
    262265    return $classifyinfo; 
    263266    } 
    264  
     267    if ($headOID eq "0") { 
     268    print STDERR "Error: Hierarchy numbering must not contain 0\n"; 
     269    return undef; 
     270    } 
    265271    $classifyinfo->{'contains'} = [] unless defined $classifyinfo->{'contains'}; 
    266272    if ($self->{'documents_last'}) {