<div dir="ltr"><div><div>Here is a list of cases which misuse injection. Please assign yourself and update the status (assigned/published/merged)<br><br><a href="https://docs.google.com/spreadsheets/d/1leEk0EYZgQPsG_Xddlk7FctBYYm4WOU8BsoETGR2xtQ/edit?usp=sharing">https://docs.google.com/spreadsheets/d/1leEk0EYZgQPsG_Xddlk7FctBYYm4WOU8BsoETGR2xtQ/edit?usp=sharing</a><br><br></div>Thanks,<br></div>Moti<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 5, 2017 at 9:05 PM, Moti Asayag <span dir="ltr">&lt;<a href="mailto:masayag@redhat.com" target="_blank">masayag@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi All,<br><br></div>ATM, there are 78 occurrences of &quot;Injector.injectMembers(new AuditLogableBase())&quot; in ovirt-engine project, which their main purpose is to ease the resolve of the placeholders of the audit log message while logging an event.<br><br></div>For instance AuditLogType.MAC_ADDRESS_IS_<wbr>EXTERNAL is being used from ImportVmCommandBase.java in the following way:<br><br>private AuditLogableBase createExternalMacsAuditLog(VM vm, Set&lt;String&gt; externalMacs) {<br>        AuditLogableBase logable = <b>Injector.injectMembers</b>(new AuditLogableBase());<br>        logable.setVmId(vm.getId());<br>        logable.<wbr>setCustomCommaSeparatedValues(<wbr>&quot;MACAddr&quot;, externalMacs);<br>        return logable;<br>    }<br clear="all"><div><div><div><br>The entry in the properties file is:<br>MAC_ADDRESS_IS_EXTERNAL=VM ${<b>VmName</b>} has MAC address(es) ${MACAddr}, which is/are out of its MAC pool definitions.<br><br></div><div>Therefore the only purpose of the injection is to allow the AuditLogDirector to resolve the ${<b>VmName</b>} which is already known at the time of creating the AuditLogableBase entry.<br></div><div><br></div><div>The result is injecting the DAOs for the AuditLogableBase instance and using the VM dao to retrieve the VM entry from the DB.<br></div><div>This is just a wastef of injection and DB access while both can be spared.<br><br></div><div>This could have been easily replaced by one of the following:<br><ul><li>auditLogableBase.setVmName(vm.<wbr>getName());</li><li>auditLogableBase.<wbr>addCustomValue(&quot;VmName&quot;, vm.getName());</li></ul><p>Please pick up any occurrence from your domain and send a patch to replace it where possible.<br></p></div><div>Thanks in advance,<br><div class="m_-4917155129571916963gmail_signature"><div dir="ltr">Moti<br></div></div>
</div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,<br></div>Moti<br></div></div>
</div>