Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Add: check response obj before use it handling http commands
- Upgrade NodeJS version from 8.16.1 to 10.17.0 in Dockerfile due to Node 8 End-of-Life
- Hardening: software quality improvement based on ISO25010 recommendations
2 changes: 2 additions & 0 deletions lib/bindings/HTTPBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function handleError(error, req, res, next) {
name: error.name,
Copy link
Copy Markdown
Member

@fgalan fgalan Jan 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the PR is almost ready (good work! :). However, you should include an entry in the CHANGES_NEXT_RELEASE file in describing the changes. Maybe something like the following:

- Hardening: software quality improvement based on ISO25010 recommendations

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 484e833

message: error.message
});
next();
}

function parseData(req, res, next) {
Expand Down Expand Up @@ -203,6 +204,7 @@ function returnCommands(req, res, next) {
} else {
res.status(200).send('');
}
next();
}

function handleIncomingMeasure(req, res, next) {
Expand Down
2 changes: 1 addition & 1 deletion lib/bindings/MQTTBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ function start(callback) {
}
});
mqttClient.on('message', commonBindings.mqttMessageHandler);
mqttClient.on('connect', function(ack) {
mqttClient.on('connect', function() {
config.getLogger().info(context, 'MQTT Client connected');
recreateSubscriptions();
});
Expand Down
3 changes: 1 addition & 2 deletions lib/commonBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) {
* @param {String} apikey APIKey of the service the device belongs to.
* @param {Array} previous Array of prepared functions that send information to the Context Broker.
* @param {Object} current Information sent by the device.
* @param {Number} index Index of the group in the array.
* @return {Array} Updated array of functions.
*/
function processMeasureGroup(device, apikey, previous, current, index) {
function processMeasureGroup(device, apikey, previous, current) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaDoc entry for index (L115) should be removed also.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 662a458

var values = [];

if (current.command) {
Expand Down
4 changes: 4 additions & 0 deletions lib/iotaUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ function mergeDeviceWithConfiguration(deviceData, configuration, callback) {
deviceData[fields[i]] = configuration[confField];
} else if (!deviceData[fields[i]] && (!configuration || !configuration[confField])) {
deviceData[fields[i]] = defaults[i];
} else {
config
.getLogger()
.debug(context, 'at field "' + fields[i] + '" configuration merging logic did not merge anything');
}

if (deviceData[fields[i]] && ['active', 'lazy', 'commands'].indexOf(fields[i]) >= 0) {
Expand Down