From e97c68736e7cb243284a8e7bd3e703aa5edc5653 Mon Sep 17 00:00:00 2001 From: kwilk Date: Thu, 2 Feb 2012 17:39:23 -0700 Subject: refactor[ats_22T7P]: Log cast exceptions in BranchCacheUpdateUtil --- .../framework/core/message/BranchCacheUpdateUtil.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org') diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java index d55314a3a77..715ce1691cc 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java @@ -17,8 +17,10 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.logging.Level; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.message.internal.Activator; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.BranchFactory; import org.eclipse.osee.framework.core.model.MergeBranch; @@ -28,6 +30,7 @@ import org.eclipse.osee.framework.core.model.cache.TransactionCache; import org.eclipse.osee.framework.jdk.core.type.PropertyStore; import org.eclipse.osee.framework.jdk.core.type.Triplet; import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.logging.OseeLog; /** * @author Megumi Telles @@ -89,9 +92,18 @@ public final class BranchCacheUpdateUtil { for (Triplet entry : cacheMessage.getMergeBranches()) { IOseeBranch sourceBranch = Strings.isValid(entry.getFirst()) ? cache.getByGuid(entry.getFirst()) : null; IOseeBranch destinationBranch = Strings.isValid(entry.getSecond()) ? cache.getByGuid(entry.getSecond()) : null; - MergeBranch mergeBranch = (MergeBranch) cache.getByGuid(entry.getThird()); - mergeBranch.setSourceBranch(sourceBranch); - mergeBranch.setDestinationBranch(destinationBranch); + + Branch branch = cache.getByGuid(entry.getThird()); + MergeBranch mergeBranch = null; + try { + mergeBranch = (MergeBranch) branch; + mergeBranch.setSourceBranch(sourceBranch); + mergeBranch.setDestinationBranch(destinationBranch); + } catch (ClassCastException ex) { + OseeLog.logf(Activator.class, Level.SEVERE, + "Problem casting branch [%s] to MergeBranch, source: [%s], dest: [%s]\r\nException: %s", branch, + sourceBranch, destinationBranch, ex); + } } return updatedItems; } -- cgit v1.2.3