Kenny Ayers commented on Bug JENKINS-14551

This bug may be in SVNKit, which is the Java library that subversion-plugin uses. I determined this by modifying hudson.scm.subversion.UpdateUpdater by adding a loop to print the contents of each file after the SVN checkout is completed. Immediately after the doUpdate() function which is responsible for updating a checkout is called, I inspect the file contents to find they are corrupted.

Here's the git patch to hudson.scm.subversion.UpdateUpdater with the debug output. Please note I'm not a Java developer by trade, and this code has cruft from a lot of debugging iterations. I've also modified the parameters being used by doUpdate() as part of the debugging process:

diff --git a/src/main/java/hudson/scm/subversion/UpdateUpdater.java b/src/main/java/hudson/scm/subversion/UpdateUpdater.java
index f00ebdb..021e18c 100755
--- a/src/main/java/hudson/scm/subversion/UpdateUpdater.java
+++ b/src/main/java/hudson/scm/subversion/UpdateUpdater.java
@@ -40,11 +40,21 @@ import org.tmatesoft.svn.core.wc.SVNInfo;
 import org.tmatesoft.svn.core.wc.SVNRevision;
 import org.tmatesoft.svn.core.wc.SVNUpdateClient;
 import org.tmatesoft.svn.core.wc.SVNWCClient;
+import org.tmatesoft.svn.core.wc.SVNClientManager;
+import org.tmatesoft.svn.core.SVNDepth;
+import org.tmatesoft.svn.core.wc.SVNRevision;
 
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.io.InputStream;
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.DataInputStream;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
 
 /**
  * {@link WorkspaceUpdater} that uses "svn update" as much as possible.
@@ -154,7 +164,38 @@ public class UpdateUpdater extends WorkspaceUpdater {
                 switch (svnCommand) {
                     case UPDATE:
                         listener.getLogger().println("Updating " + location.remote + " at revision " + revisionName);
-                        svnuc.doUpdate(local.getCanonicalFile(), r, svnDepth, true, true);
+                        //svnuc.doUpdate(local.getCanonicalFile(), r, svnDepth, true, true);
+                        SVNClientManager cM = SVNClientManager.newInstance();
+                        SVNUpdateClient updateClient = cM.getUpdateClient();
+                        updateClient.doUpdate(local.getCanonicalFile(), SVNRevision.HEAD, SVNDepth.INFINITY, true, true);
+
+                        ArrayList<File> files = new ArrayList<File>(Arrays.asList(local.listFiles()));
+                        for (int i = 0; i < files.size(); i++)
+                        {
+                            if (files.get(i).isFile())
+                            {
+                                String fname = files.get(i).getName();
+                                listener.getLogger().println("File: " + fname);
+                                try{
+                                  // Open the file that is the first 
+                                  // command line parameter
+                                  FileInputStream fstream = new FileInputStream(files.get(i));
+                                  // Get the object of DataInputStream
+                                  DataInputStream in = new DataInputStream(fstream);
+                                  BufferedReader br = new BufferedReader(new InputStreamReader(in));
+                                  String strLine;
+                                  //Read File Line By Line
+                                  while ((strLine = br.readLine()) != null)   {
+                                  // Print the content on the console
+                                  listener.getLogger().println(strLine);
+                                  }
+                                  //Close the input stream
+                                  in.close();
+                                    }catch (Exception e){//Catch exception if any
+                                  listener.getLogger().println("Error: " + e.getMessage());
+                                  }
+                            }
+                        }
                         break;
                     case SWITCH:
                         listener.getLogger().println("Switching to " + location.remote + " at revision " + revisionName);
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to