avoid class cast when Z server return a Close instead of a SearchResponse (timeout)
This commit is contained in:
parent
1a0ff7d6c8
commit
7bcc85b223
3 changed files with 41 additions and 34 deletions
|
@ -1,6 +1,6 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = z3950
|
name = z3950
|
||||||
version = 2.3.1
|
version = 2.3.2
|
||||||
|
|
||||||
gradle.wrapper.version = 6.6.1
|
gradle.wrapper.version = 6.6.1
|
||||||
netty.version = 4.1.65.Final
|
netty.version = 4.1.65.Final
|
||||||
|
|
|
@ -120,39 +120,44 @@ public class AbstractOperation<IN extends ASN1Any, OUT extends ASN1Any> {
|
||||||
if (ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
if (ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1Exception("bad BER encoding: choice not matched");
|
throw new ASN1Exception("bad BER encoding: choice not matched");
|
||||||
}
|
}
|
||||||
switch (ber.getTag()) {
|
try {
|
||||||
case 20:
|
switch (ber.getTag()) {
|
||||||
return (IN)new InitializeRequest(ber, false);
|
case 20:
|
||||||
case 21:
|
return (IN) new InitializeRequest(ber, false);
|
||||||
return (IN)new InitializeResponse(ber, false);
|
case 21:
|
||||||
case 22:
|
return (IN) new InitializeResponse(ber, false);
|
||||||
return (IN)new SearchRequest(ber, false);
|
case 22:
|
||||||
case 23:
|
return (IN) new SearchRequest(ber, false);
|
||||||
return (IN)new SearchResponse(ber, false);
|
case 23:
|
||||||
case 24:
|
return (IN) new SearchResponse(ber, false);
|
||||||
return (IN)new PresentRequest(ber, false);
|
case 24:
|
||||||
case 25:
|
return (IN) new PresentRequest(ber, false);
|
||||||
return (IN)new PresentResponse(ber, false);
|
case 25:
|
||||||
// 26 new DeleteResultSetRequest(ber, false);
|
return (IN) new PresentResponse(ber, false);
|
||||||
// 27 new DeleteResultSetResponse(ber, false);
|
// 26 new DeleteResultSetRequest(ber, false);
|
||||||
// 28 new AccessControlRequest(ber, false);
|
// 27 new DeleteResultSetResponse(ber, false);
|
||||||
// 29 new AccessControlResponse(ber, false);
|
// 28 new AccessControlRequest(ber, false);
|
||||||
// 30 new ResourceControlRequest(ber, false);
|
// 29 new AccessControlResponse(ber, false);
|
||||||
// 31 new ResourceControlResponse(ber, false);
|
// 30 new ResourceControlRequest(ber, false);
|
||||||
// 32 new TriggerResourceControlRequest(ber, false);
|
// 31 new ResourceControlResponse(ber, false);
|
||||||
// 33 new ResourceReportRequest(ber, false);
|
// 32 new TriggerResourceControlRequest(ber, false);
|
||||||
// 34 new ResourceReportResponse(ber, false);
|
// 33 new ResourceReportRequest(ber, false);
|
||||||
case 35:
|
// 34 new ResourceReportResponse(ber, false);
|
||||||
return (IN) new ScanRequest(ber, false);
|
case 35:
|
||||||
case 36:
|
return (IN) new ScanRequest(ber, false);
|
||||||
return (IN) new ScanResponse(ber, false);
|
case 36:
|
||||||
// 43 new SortRequest(ber, false);
|
return (IN) new ScanResponse(ber, false);
|
||||||
// 44 new SortResponse(ber, false);
|
// 43 new SortRequest(ber, false);
|
||||||
// 45 new Segment(ber, false);
|
// 44 new SortResponse(ber, false);
|
||||||
// 46 new ExtendedServicesRequest(ber, false);
|
// 45 new Segment(ber, false);
|
||||||
// 47 new ExtendedServicesResponse(ber, false);
|
// 46 new ExtendedServicesRequest(ber, false);
|
||||||
case 48:
|
// 47 new ExtendedServicesResponse(ber, false);
|
||||||
return (IN) new Close(ber, false);
|
case 48:
|
||||||
|
return (IN) new Close(ber, false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// class cast exception if Close is returned, ignore
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
throw new ASN1Exception("bad BER encoding: choice not matched");
|
throw new ASN1Exception("bad BER encoding: choice not matched");
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,8 @@ public class SearchOperation extends AbstractOperation<SearchResponse, SearchReq
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger.log(Level.WARNING, "no search response returned for host " + host + " " + databases);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// add host in IOException message
|
// add host in IOException message
|
||||||
|
|
Loading…
Reference in a new issue