Skip to content

Commit ac21b54

Browse files
committed
Fix formatting issues
1 parent b4e8bb4 commit ac21b54

File tree

4 files changed

+11
-35
lines changed

4 files changed

+11
-35
lines changed

components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ public List<? extends Operation> getOperationsByDeviceAndStatus(
101101
while (rs.next()) {
102102
commandOperation = new CommandOperation();
103103
commandOperation.setId(rs.getInt("ID"));
104-
//commandOperation.setEnabled(rs.getInt("ENABLED") != 0);
105104
commandOperation.setEnabled(rs.getBoolean("ENABLED") != false);
106105
commandOperation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
107106
commandOperation.setType(Operation.Type.valueOf(rs.getString("TYPE")));

components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java

+4-20
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,17 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl {
3939
public int addOperation(Operation operation) throws OperationManagementDAOException {
4040
int operationId;
4141
PreparedStatement stmt = null;
42-
ByteArrayOutputStream bao = null;
43-
ObjectOutputStream oos = null;
44-
try {
42+
try (ByteArrayOutputStream bao = new ByteArrayOutputStream();
43+
ObjectOutputStream oos = new ObjectOutputStream(bao)) {
4544
operationId = super.addOperation(operation);
4645
operation.setCreatedTimeStamp(new Timestamp(new java.util.Date().getTime()).toString());
4746
operation.setId(operationId);
4847
operation.setEnabled(true);
4948
PolicyOperation policyOperation = (PolicyOperation) operation;
5049
Connection conn = OperationManagementDAOFactory.getConnection();
5150
stmt = conn.prepareStatement("INSERT INTO DM_POLICY_OPERATION(OPERATION_ID, OPERATION_DETAILS) " +
52-
"VALUES(?, ?)");
51+
"VALUES(?, ?)");
5352

54-
bao = new ByteArrayOutputStream();
55-
oos = new ObjectOutputStream(bao);
5653
oos.writeObject(operation);
5754

5855
stmt.setInt(1, operationId);
@@ -63,22 +60,9 @@ public int addOperation(Operation operation) throws OperationManagementDAOExcept
6360
} catch (IOException e) {
6461
throw new OperationManagementDAOException("Error occurred while serializing policy operation object", e);
6562
} finally {
66-
if (bao != null) {
67-
try {
68-
bao.close();
69-
} catch (IOException e) {
70-
log.warn("Error occurred while closing ByteArrayOutputStream", e);
71-
}
72-
}
73-
if (oos != null) {
74-
try {
75-
oos.close();
76-
} catch (IOException e) {
77-
log.warn("Error occurred while closing ObjectOutputStream", e);
78-
}
79-
}
8063
OperationManagementDAOUtil.cleanupResources(stmt);
8164
}
65+
8266
return operationId;
8367
}
8468

components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ deviceModule = function () {
267267
}
268268
return serviceInvokers.XMLHttp.get(
269269
url, function (responsePayload) {
270-
if(!responsePayload["responseText"]){
270+
if (!responsePayload["responseText"]) {
271271
log.error("Error while fetching device count. API `" + url + "` returns HTTP: " + responsePayload["status"]);
272272
userModule.logout(function () {
273273
response.sendRedirect(devicemgtProps["appContext"] + "login");
@@ -312,9 +312,9 @@ deviceModule = function () {
312312
);
313313
} else {
314314
log.error("User object was not found in the session");
315-
userModule.logout(function () {
316-
response.sendRedirect(devicemgtProps["appContext"] + "login");
317-
});
315+
userModule.logout(function () {
316+
response.sendRedirect(devicemgtProps["appContext"] + "login");
317+
});
318318
}
319319
};
320320

@@ -383,9 +383,9 @@ deviceModule = function () {
383383
var carbonUser = session.get(constants["USER_SESSION_KEY"]);
384384
if (!carbonUser) {
385385
log.error("User object was not found in the session");
386-
userModule.logout(function () {
387-
response.sendRedirect(devicemgtProps["appContext"] + "login");
388-
});
386+
userModule.logout(function () {
387+
response.sendRedirect(devicemgtProps["appContext"] + "login");
388+
});
389389
}
390390
var userName = carbonUser.username + "@" + carbonUser.domain;
391391
var config = {};

components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js

-7
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ function createPopup(layer,id) {
264264
} else if (id=="Traffic") {
265265
var popupTemplate = $('#setTrafficAlert');
266266
popupTemplate.find('#addTrafficAlert').attr('leaflet_id', layer._leaflet_id);
267-
//console.log(">>got here " + id + " " + popupTemplate.find('#addTrafficAlert') + " " + layer._leaflet_id);
268267
} else if (id=="Prediction") {
269268
getPrediction(layer._leaflet_id);
270269
return;
@@ -274,7 +273,6 @@ function createPopup(layer,id) {
274273
popupTemplate.find('.editGeoJson').attr('leaflet_id', layer._leaflet_id);
275274

276275
layer.bindPopup(popupTemplate.html(), {closeOnClick: false, closeButton: false}).openPopup();
277-
// transparent the layer .leaflet-popup-content-wrapper
278276
$(layer._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)");
279277
}
280278

@@ -362,9 +360,7 @@ function viewFence(geoFenceElement,id) {
362360
color: '#ff0043'
363361
};
364362
geometryShape= new L.circle([geoJson.coordinates[1],geoJson.coordinates[0]], geoJson.radius,circleOptions);
365-
// var marker=new L.marker([geoJson.coordinates[1],geoJson.coordinates[0]]);
366363
map.addLayer(geometryShape);
367-
// map.addLayer(marker);
368364
} else if (geoJson.type=="Polygon") {
369365
geoJson.coordinates[0].pop(); // popout the last coordinate set(lat,lng pair) due to circular chain
370366
var leafletLatLngs = [];
@@ -389,7 +385,6 @@ function viewFence(geoFenceElement,id) {
389385
popupTemplate.find('#stationaryAlertForm').attr('query-name', queryName);
390386
popupTemplate.find('#viewAreaTime').html(stationeryTime);
391387
geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup();
392-
// transparent the layer .leaflet-popup-content-wrapper
393388
$(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)");
394389

395390
});
@@ -437,9 +432,7 @@ function viewFenceByData(geoJson, queryName, areaName, stationeryTime, id) {
437432
color: '#ff0043'
438433
};
439434
geometryShape= new L.circle([geoJson.coordinates[1],geoJson.coordinates[0]], geoJson.radius,circleOptions);
440-
// var marker=new L.marker([geoJson.coordinates[1],geoJson.coordinates[0]]);
441435
map.addLayer(geometryShape);
442-
// map.addLayer(marker);
443436
} else if (geoJson.type=="Polygon") {
444437
geoJson.coordinates[0].pop(); // popout the last coordinate set(lat,lng pair) due to circular chain
445438
var leafletLatLngs = [];

0 commit comments

Comments
 (0)