From 3c74cde9ed71d436abdf62de05d1a94bfe14f89b Mon Sep 17 00:00:00 2001 From: Peter Darton Date: Wed, 7 Sep 2016 11:36:18 +0100 Subject: [PATCH 1/2] Change version of yavijava that we fetch from 6.0.03 to 6.0.04. This fixes https://github.com/yavijava/yavijava/issues/153 which fixes https://issues.jenkins-ci.org/browse/JENKINS-37888 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c7784b74..e70b826c 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ com.toastcoders yavijava - 6.0.03 + 6.0.04 org.jenkins-ci.plugins From c60418677eed1cd7a4eb537366a85f46bbbe590b Mon Sep 17 00:00:00 2001 From: Peter Darton Date: Wed, 7 Sep 2016 13:25:18 +0100 Subject: [PATCH 2/2] Fix Javadoc warnings and errors - no functional changes. Added missing javadoc fields to vSphereCloud.java's DescriptorImpl.doTestConnection. Removed unused imports from VSphereBuildStep.java. Escaped <> around email address in @author tag in VSphereConnectionConfig.java. Added missing tags, removed unused tags, and added description text in VSphere.java. Added missing javadoc fields to VSphereLogger.java. --- .../org/jenkinsci/plugins/vSphereCloud.java | 5 ++ .../plugins/vsphere/VSphereBuildStep.java | 3 - .../vsphere/VSphereConnectionConfig.java | 2 +- .../plugins/vsphere/tools/VSphere.java | 57 ++++++++++--------- .../plugins/vsphere/tools/VSphereLogger.java | 3 +- 5 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/vSphereCloud.java b/src/main/java/org/jenkinsci/plugins/vSphereCloud.java index 94c8dcf3..10f38228 100644 --- a/src/main/java/org/jenkinsci/plugins/vSphereCloud.java +++ b/src/main/java/org/jenkinsci/plugins/vSphereCloud.java @@ -389,6 +389,11 @@ public boolean configure(StaplerRequest req, JSONObject o) /** * For UI. + * @param vsHost From UI. + * @param vsDescription From UI. + * @param credentialsId From UI. + * @param maxOnlineSlaves From UI. + * @return Result of the validation. */ public FormValidation doTestConnection(@QueryParameter String vsHost, @QueryParameter String vsDescription, diff --git a/src/main/java/org/jenkinsci/plugins/vsphere/VSphereBuildStep.java b/src/main/java/org/jenkinsci/plugins/vsphere/VSphereBuildStep.java index 3dd30b92..5054fa01 100644 --- a/src/main/java/org/jenkinsci/plugins/vsphere/VSphereBuildStep.java +++ b/src/main/java/org/jenkinsci/plugins/vsphere/VSphereBuildStep.java @@ -20,13 +20,10 @@ import hudson.Launcher; import hudson.model.*; -import jenkins.tasks.SimpleBuildStep; import org.jenkinsci.plugins.vSphereCloud; import org.jenkinsci.plugins.vsphere.builders.Messages; import org.jenkinsci.plugins.vsphere.tools.VSphere; import org.jenkinsci.plugins.vsphere.tools.VSphereException; -import org.jenkinsci.plugins.workflow.steps.AbstractStepExecutionImpl; -import sun.reflect.generics.reflectiveObjects.NotImplementedException; import javax.annotation.Nonnull; import java.io.IOException; diff --git a/src/main/java/org/jenkinsci/plugins/vsphere/VSphereConnectionConfig.java b/src/main/java/org/jenkinsci/plugins/vsphere/VSphereConnectionConfig.java index 1f337514..9e47b4de 100644 --- a/src/main/java/org/jenkinsci/plugins/vsphere/VSphereConnectionConfig.java +++ b/src/main/java/org/jenkinsci/plugins/vsphere/VSphereConnectionConfig.java @@ -41,7 +41,7 @@ /** * - * @author Oleg Nenashev + * @author Oleg Nenashev <o.v.nenashev@gmail.com> */ public class VSphereConnectionConfig extends AbstractDescribableImpl { diff --git a/src/main/java/org/jenkinsci/plugins/vsphere/tools/VSphere.java b/src/main/java/org/jenkinsci/plugins/vsphere/tools/VSphere.java index b3620d88..7d06755a 100644 --- a/src/main/java/org/jenkinsci/plugins/vsphere/tools/VSphere.java +++ b/src/main/java/org/jenkinsci/plugins/vsphere/tools/VSphere.java @@ -74,7 +74,10 @@ private ServiceInstance getServiceInstance() throws RemoteException, MalformedUR /** * Initiates Connection to vSphere Server * @param server Server URL - * @throws VSphereException + * @param user Username. + * @param pw Password. + * @throws VSphereException If an error occurred. + * @return A connected instance. */ public static VSphere connect(@Nonnull String server, @Nonnull String user, @CheckForNull String pw) throws VSphereException { return new VSphere(server, user, pw); @@ -104,7 +107,9 @@ public static String vSphereOutput(String msg){ * @param resourcePoolName - resource pool to use * @param cluster - ComputeClusterResource to use * @param datastoreName - Datastore to use - * @throws VSphereException + * @param powerOn - If true the VM will be powered on. + * @param jLogger - Where to log to. + * @throws VSphereException If an error occurred. */ public void deployVm(String cloneName, String sourceName, boolean linkedClone, String resourcePoolName, String cluster, String datastoreName, boolean powerOn, PrintStream jLogger) throws VSphereException { boolean DO_NOT_USE_SNAPSHOTS = false; @@ -121,7 +126,9 @@ public void deployVm(String cloneName, String sourceName, boolean linkedClone, S * @param resourcePoolName - resource pool to use * @param cluster - ComputeClusterResource to use * @param datastoreName - Datastore to use - * @throws VSphereException + * @param powerOn - If true the VM will be powered on. + * @param jLogger - Where to log to. + * @throws VSphereException If an error occurred. */ public void cloneVm(String cloneName, String sourceName, boolean linkedClone, String resourcePoolName, String cluster, String datastoreName, boolean powerOn, PrintStream jLogger) throws VSphereException { boolean DO_USE_SNAPSHOTS = true; @@ -240,7 +247,8 @@ public void reconfigureVm(String name, VirtualMachineConfigSpec spec) throws VSp /** * @param name - Name of VM to start - * @throws VSphereException + * @param timeoutInSeconds How long to wait for the VM to be running. + * @throws VSphereException If an error occurred. */ public void startVm(String name, int timeoutInSeconds) throws VSphereException { @@ -436,11 +444,12 @@ public void markAsVm(String name, String resourcePool, String cluster) throws VS } /** - * Shortcut + * Asks vSphere for the IP address used by a VM. * - * @param vm - VirtualMachine name of which IP is returned - * @return - String containing IP address - * @throws VSphereException + * @param vm VirtualMachine name whose IP is to be returned. + * @param timeout How long to wait (in seconds) for the IP address to known to vSphere. + * @return String containing IP address. + * @throws VSphereException If an error occurred. */ public String getIp(VirtualMachine vm, int timeout) throws VSphereException { @@ -477,11 +486,7 @@ public String getIp(VirtualMachine vm, int timeout) throws VSphereException { /** * @param vmName - name of VM object to retrieve * @return - VirtualMachine object - * @throws InvalidProperty - * @throws RuntimeFault - * @throws RemoteException - * @throws MalformedURLException - * @throws VSphereException + * @throws VSphereException If an error occurred. */ public VirtualMachine getVmByName(String vmName) throws VSphereException { try { @@ -548,11 +553,7 @@ private Datastore getDatastoreByName(final String datastoreName, ManagedEntity r /** * @return - ManagedEntity array of Datastore - * @throws InvalidProperty - * @throws RuntimeFault - * @throws RemoteException - * @throws MalformedURLException - * @throws VSphereException + * @throws VSphereException If an error occurred. */ public ManagedEntity[] getDatastores() throws VSphereException { try { @@ -615,7 +616,8 @@ private ClusterComputeResource getClusterByName(final String clusterName) throws /** * Detroys the VM in vSphere * @param name - VM object to destroy - * @throws VSphereException + * @param failOnNoExist If true and the VM does not exist then a VSphereException will be thrown. + * @throws VSphereException If an error occurred. */ public void destroyVm(String name, boolean failOnNoExist) throws VSphereException{ try{ @@ -649,10 +651,11 @@ public void destroyVm(String name, boolean failOnNoExist) throws VSphereExceptio /** * Renames a VM Snapshot - * @param oldName the current name of the vm - * @param newName the new name of the vm - * @param newDescription the new description of the vm - * @throws VSphereException + * @param vmName the name of the VM whose snapshot is being renamed. + * @param oldName the current name of the VM's snapshot. + * @param newName the new name of the VM's snapshot. + * @param newDescription the new description of the VM's snapshot. + * @throws VSphereException If an error occurred. */ public void renameVmSnapshot(String vmName, String oldName, String newName, String newDescription) throws VSphereException{ try{ @@ -678,7 +681,7 @@ public void renameVmSnapshot(String vmName, String oldName, String newName, Stri * Renames the VM vSphere * @param oldName the current name of the vm * @param newName the new name of the vm - * @throws VSphereException + * @throws VSphereException If an error occurred. */ public void renameVm(String oldName, String newName) throws VSphereException{ try{ @@ -812,7 +815,7 @@ private Datacenter getDataCenter(ManagedEntity managedEntity) * @param virtualMachine - VM object * @param name - the name of the Port Group * @return returns DistributedVirtualPortgroup object for the provided vDS PortGroup - * @throws VSphereException + * @throws VSphereException If an error occurred. */ public Network getNetworkPortGroupByName(VirtualMachine virtualMachine, String name) throws VSphereException @@ -838,7 +841,7 @@ public Network getNetworkPortGroupByName(VirtualMachine virtualMachine, * @param virtualMachine - VM object * @param name - the name of the Port Group * @return returns DistributedVirtualPortgroup object for the provided vDS PortGroup - * @throws VSphereException + * @throws VSphereException If an error occurred. */ public DistributedVirtualPortgroup getDistributedVirtualPortGroupByName(VirtualMachine virtualMachine, String name) throws VSphereException @@ -863,7 +866,7 @@ public DistributedVirtualPortgroup getDistributedVirtualPortGroupByName(VirtualM * Find Distributed Virtual Switch from the provided Distributed Virtual Portgroup * @param distributedVirtualPortgroup - DistributedVirtualPortgroup object for the provided vDS PortGroup * @return returns DistributedVirtualSwitch object that represents the vDS Switch - * @throws VSphereException + * @throws VSphereException If an error occurred. */ public DistributedVirtualSwitch getDistributedVirtualSwitchByPortGroup( DistributedVirtualPortgroup distributedVirtualPortgroup) throws VSphereException diff --git a/src/main/java/org/jenkinsci/plugins/vsphere/tools/VSphereLogger.java b/src/main/java/org/jenkinsci/plugins/vsphere/tools/VSphereLogger.java index 64e20348..ffa00b32 100644 --- a/src/main/java/org/jenkinsci/plugins/vsphere/tools/VSphereLogger.java +++ b/src/main/java/org/jenkinsci/plugins/vsphere/tools/VSphereLogger.java @@ -22,7 +22,8 @@ public class VSphereLogger { * This is simply a wrapper method to clean up this class. This method * checks the verboseOutput flag and writes to the logger as appropriate. * - * @param logger - logger that should receive the information + * @param logger - logger that should receive the information + * @param str - The text to be logged. */ public static void vsLogger(PrintStream logger, String str){ if(logger!=null){