6 Commits
4.4.1 ... 4.4.2

Author SHA1 Message Date
Andrew Johnson
2715f585e0 Update version numbers to 4.4.2 for EPICS 7.0.2.2 release 2019-04-15 11:48:15 -05:00
mrkraimer
c2e3315f54 update RELEASE_NOTES 2019-04-11 13:59:57 -04:00
Marty Kraimer
d0ddcead24 Merge pull request #42 from mrkraimer/master
pvRequest - asking for subfield of non structure field crashes IOC; allow subfield of union
2019-04-04 05:27:41 -04:00
mrkraimer
5f42eec15a better exception messages 2019-03-31 15:38:13 -04:00
mrkraimer
20e55d5bca minor changes 2019-03-31 07:33:51 -04:00
mrkraimer
6d2d63621e address issue 41 2019-03-29 11:22:49 -04:00
3 changed files with 79 additions and 13 deletions

View File

@@ -2,6 +2,19 @@
This document summarizes the changes to the module between releases.
## Release 4.4.2 (EPICS 7.0.2.2, Apr 2019)
Formerly if a client makes a request for a subfield of a non structure field
it resulted in a crash.
Now if a request is made for a subfield of a non structure field
1) if the field is not a union an exception is thrown which is passed to the client.
2) if the field is a union
a) if more than one subfield is requested an exception is thrown
b) if the subfield is the type for the current union the request succeeds
c) if type is not the same an exception is thrown
## Release 4.4.1 (EPICS 7.0.2.1, Mar 2019)
* Cleaned up some build warnings.
@@ -35,5 +48,3 @@ The test is now a regression test which can be run using:
This is the first release of pvDatabaseCPP.
It provides functionality equivalent to pvDatabaseJava.

View File

@@ -8,7 +8,7 @@ PVDATABASE_SRC = $(TOP)/src
LIBRARY += pvDatabase
# shared library ABI version.
SHRLIB_VERSION ?= 4.4.1
SHRLIB_VERSION ?= 4.4.2
INC += pv/channelProviderLocal.h
INC += pv/pvDatabase.h

View File

@@ -168,7 +168,7 @@ PVFieldPtr PVCopy::getMasterPVField(size_t structureOffset)
node = getMasterNode(snode,structureOffset);
}
if(!node) {
throw std::invalid_argument(
throw std::logic_error(
"PVCopy::getMasterPVField: structureOffset not valid");
}
size_t diff = structureOffset - node->structureOffset;
@@ -248,7 +248,7 @@ PVStructurePtr PVCopy::getOptions(std::size_t fieldOffset)
}
}
if(okToContinue) continue;
throw std::invalid_argument("fieldOffset not valid");
throw std::logic_error("PVCopy logic error: fieldOffset not valid");
}
}
@@ -464,7 +464,13 @@ StructureConstPtr PVCopy::createStructure(
fields.push_back(field);
}
size_t numsubfields = fields.size();
if(numsubfields==0) return NULLStructure;
if(numsubfields==0) {
std::stringstream ss;
ss << pvFromRequest << "\n";
string val("no fields from the following request were found\n");
val += ss.str();
throw std::invalid_argument(val);
}
return getFieldCreate()->createStructure(fieldNames, fields);
}
@@ -487,16 +493,65 @@ CopyNodePtr PVCopy::createStructureNodes(
requestPVStructure->getSubField<PVStructure>("_options");
PVFieldPtr pvMasterField = pvMasterStructure->getSubField(fieldName);
if(!pvMasterField) {
throw std::logic_error("did not find field in master");
throw std::logic_error("PVCopy logic error: did not find field in master");
}
size_t numberRequest = requestPVStructure->getPVFields().size();
if(pvSubFieldOptions) numberRequest--;
bool haveOptions = false;
if(pvSubFieldOptions) {
numberRequest--;
haveOptions = true;
}
if(numberRequest>0) {
nodes->push_back(createStructureNodes(
static_pointer_cast<PVStructure>(pvMasterField),
requestPVStructure,
static_pointer_cast<PVStructure>(copyPVField)));
continue;
Type copyType = copyPVField->getField()->getType();
if(copyType==epics::pvData::structure) {
nodes->push_back(createStructureNodes(
static_pointer_cast<PVStructure>(pvMasterField),
requestPVStructure,
static_pointer_cast<PVStructure>(copyPVField)));
continue;
}
if(copyType==epics::pvData::union_) {
if(numberRequest!=1) {
std::stringstream ss;
ss << pvFromRequest << "\n";
string val("In the following request a union field has more than one subfield in\n");
val += ss.str();
throw std::invalid_argument(val);
}
PVUnionPtr pvUnion = static_pointer_cast<PVUnion>(pvMasterField);
std::string selectedName = pvUnion->getSelectedFieldName();
PVFieldPtrArray const & pvFields = requestPVStructure->getPVFields();
size_t len = pvFields.size();
if(len>2 || (haveOptions && len!=2)) {
std::stringstream ss;
ss << pvFromRequest << "\n";
string val("PVCopy logic error: pvRequest is\n");
val += ss.str();
throw std::logic_error(val);
}
size_t indRequestValue = 0;
if((pvFields[0]->getFieldName().compare("_options"))==0) indRequestValue = 1;
PVFieldPtr pvRequestValue = pvFields[indRequestValue];
if(pvRequestValue) {
string requestName = pvRequestValue->getFieldName();
if(requestName.compare(selectedName)!=0) {
std::stringstream ss;
ss << pvFromCopy << "\n";
string requestName = pvRequestValue->getFieldName();
string val("field ");
val += requestName + " does not match union type in\n";
val += ss.str();
throw std::invalid_argument(val);
}
}
} else {
std::stringstream ss;
ss << pvFromCopy << "\n";
string val("requested a subfield of field ");
val += fieldName + " which does not have type structure in\n";
val += ss.str();
throw std::invalid_argument(val);
}
}
CopyNodePtr node(new CopyNode());
node->options = pvSubFieldOptions;