changeset 612:f8b61c31bf20 Gaya-8.0.x

TW-30920 - never use path returned by CheckoutRules map() method + fix in exception handle1
author Pavel.Sher
date Wed, 24 Jul 2013 17:24:53 +0200
parents 86e187882960
children a30befaa4349
files mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java
diffstat 1 files changed, 4 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java	Fri Jun 28 12:06:09 2013 +0400
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java	Wed Jul 24 17:24:53 2013 +0200
@@ -263,8 +263,7 @@
                                        @NotNull CheckoutRules rules) {
     List<VcsChange> files = new ArrayList<VcsChange>(0);
     for (FileStatus mf: modifiedFiles) {
-      String path = rules.map(mf.getPath());
-      if (!shouldInclude(path))
+      if (rules.map(mf.getPath()) == null)
         continue;
       String normalizedPath = PathUtil.normalizeSeparator(mf.getPath());
       VcsChangeInfo.Type changeType = getChangeType(mf.getStatus());
@@ -272,7 +271,8 @@
         Loggers.VCS.warn("Unable to convert status: " + mf.getStatus() + " to VCS change type");
         changeType = VcsChangeInfo.Type.NOT_CHANGED;
       }
-      files.add(new VcsChange(changeType, mf.getStatus().getName(), ctx.getStringFromPool(normalizedPath), ctx.getStringFromPool(path), prevVer, curVer));
+      String path = ctx.getStringFromPool(normalizedPath);
+      files.add(new VcsChange(changeType, mf.getStatus().getName(), path, path, prevVer, curVer));
     }
     if (files.isEmpty())
       return emptyList();
@@ -280,11 +280,6 @@
   }
 
 
-  private boolean shouldInclude(String path) {
-    return path != null;
-  }
-
-
   private VcsChangeInfo.Type getChangeType(final Status status) {
     switch (status) {
       case ADDED:return VcsChangeInfo.Type.ADDED;
@@ -407,7 +402,7 @@
         attributes.putAll(attrBuilder.buildAttributes());
       } catch (Exception e) {
         Loggers.VCS.warn("Error while reporting subrepo config changes", e);
-        if (e instanceof VcsExtension)
+        if (e instanceof VcsException)
           throw (VcsException) e;
         throw new VcsException(e);
       }