auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Duration getFsTimestampResolution(Path file) { Path dir = Files.isDirectory(file) ? file : file.getParent(); if (!dir.toFile().canWrite()) { return FALLBACK_TIMESTAMP_RESOLUTION; <START> } <END> try { FileStore s = Files.getFileStore(dir); FileStoreAttributeCache c = attributeCache.get(s); if (c != null) { return c.getFsTimestampResolution(); } Lock lock = locks.computeIfAbsent(s, l -> new ReentrantLock()); CompletableFuture<Optional<Duration>> f = CompletableFuture .supplyAsync(() -> { if (!lock.tryLock()) { return Optional.empty(); } Optional<Duration> resolution; try { resolution = measureTimestampResolution(s, dir); if (resolution.isPresent()) { FileStoreAttributeCache cache = new FileStoreAttributeCache( resolution.get()); attributeCache.put(s, cache); if (LOG.isDebugEnabled()) { LOG.debug(cache.toString()); } } } finally { lock.unlock(); } return resolution; }); if (!background.get()) { Optional<Duration> d = f.get(); if (d.isPresent()) { return d.get(); } } } catch (IOException | InterruptedException | ExecutionException e) { LOG.error(e.getMessage(), e); } return FALLBACK_TIMESTAMP_RESOLUTION; }</code><technical_language>If a value, need determine anymore return previously computed for read-only directories</technical_language>

Target:
private static Duration getFsTimestampResolution(Path file) { Path dir = Files.isDirectory(file) ? file : file.getParent(); FileStore s; try { if (Files.exists(dir)) { s = Files.getFileStore(dir); FileStoreAttributeCache c = attributeCache.get(s); if (c != null) { return c.getFsTimestampResolution(); } if (!Files.isWritable(dir)) { return FALLBACK_TIMESTAMP_RESOLUTION; } } else { return FALLBACK_TIMESTAMP_RESOLUTION; } CompletableFuture<Optional<Duration>> f = CompletableFuture .supplyAsync(() -> { Lock lock = locks.computeIfAbsent(s, l -> new ReentrantLock()); if (!lock.tryLock()) { return Optional.empty(); } Optional<Duration> resolution; try { resolution = measureFsTimestampResolution(s, dir); if (resolution.isPresent()) { FileStoreAttributeCache cache = new FileStoreAttributeCache( resolution.get()); attributeCache.put(s, cache); if (LOG.isDebugEnabled()) { LOG.debug(cache.toString()); } } } finally { lock.unlock(); locks.remove(s); } return resolution; }); Optional<Duration> d = f.get(background.get() ? 50 : 5000, TimeUnit.MILLISECONDS); if (d.isPresent()) { return d.get(); } } catch (IOException | InterruptedException | ExecutionException e) { LOG.error(e.getMessage(), e); } catch (TimeoutException e) { } return FALLBACK_TIMESTAMP_RESOLUTION; }
Source:
<code><START> boolean handleUri(String uriScheme, String uri) throws CoreException; <END> default boolean handleUri(URI uri) throws CoreException { return handleUri(uri.getScheme(), uri.toString()); }</code><technical_language>This is a "command" method, of return "void". throws CoreException if wrong handling - "no handlers found" a code in Status of CoreException. needs some dedicated processing</technical_language>

Target:
void handleUri(String uriScheme, String uri) throws CoreException; default void handleUri(URI uri) throws CoreException { handleUri(uri.getScheme(), uri.toString()); }
Source:
<code>final private void loadSecretKeyForAPI() throws NoSuchAlgorithmException, InvalidKeySpecException { if (sKey != null && sMacKey != null) return; synchronized (lockObject) { if (Build.VERSION.SDK_INT >= 18) { try { sKey = getSecretKeyFromAndroidKeyStore(); sMacKey = getMacKey(sKey); sKeyVersion = VERSION_ANDROID_KEY_STORE; return; <START> } catch (Exception e) { <END> Logger.e(TAG, "Failed to get private key from AndroidKeyStore", "", ADALError.ANDROIDKEYSTORE_FAILED, e); } } sKey = AuthenticationSettings.INSTANCE.getSecretKey(); sMacKey = getMacKey(sKey); sKeyVersion = VERSION_USER_DEFINED; } }</code><technical_language>Is OK catch exceptions</technical_language>

Target:
final private void loadSecretKeyForAPI() throws NoSuchAlgorithmException, InvalidKeySpecException { if (sKey != null && sMacKey != null) return; synchronized (lockObject) { if (Build.VERSION.SDK_INT >= 18) { try { sKey = getSecretKeyFromAndroidKeyStore(); sMacKey = getMacKey(sKey); sBlobVersion = VERSION_ANDROID_KEY_STORE; return; } catch (Exception e) { Logger.e(TAG, "Failed to get private key from AndroidKeyStore", "", ADALError.ANDROIDKEYSTORE_FAILED, e); } } sKey = getSecretKey(AuthenticationSettings.INSTANCE.getSecretKeyData()); sMacKey = getMacKey(sKey); sBlobVersion = VERSION_USER_DEFINED; } }
Source:
<code>public void deleteUsers(List<String> userNames, HttpLocalizedOperationResult result) { if (userNames == null || userNames.isEmpty()) { result.notFound(LocalizedMessage.string("NO_USERS_SELECTED"), HealthStateType.notFound()); return; } Set<String> disabledUsers = allDisabledUserNames(); for (String username : userNames) { if(!disabledUsers.contains(username)){ result.notFound(LocalizedMessage.string("USER_DISABLED_OR_NOT_FOUND", "users", userNames), HealthStateType.notFound()); return; } } for (String username : userNames) { <START> deleteUser(username, result); <END> } if(result.isSuccessful()){ result.setMessage(LocalizedMessage.string("RESOURCE_DELETE_SUCCESSFUL", "users", userNames)); } }</code><technical_language>This guarantee atomicity. API calls check case</technical_language>

Target:
public BulkDeletionFailureResult deleteUsers(List<String> userNames, HttpLocalizedOperationResult result) { if (userNames == null || userNames.isEmpty()) { result.badRequest(LocalizedMessage.string("NO_USERS_SELECTED")); return null; } synchronized (enableUserMutex) { BulkDeletionFailureResult bulkDeletionFailureResult = deletionValidation(userNames); if (bulkDeletionFailureResult.isEmpty()) { userDao.deleteUsers(userNames); result.setMessage(LocalizedMessage.string("RESOURCES_DELETE_SUCCESSFUL", "users", userNames)); } else { result.unprocessableEntity(LocalizedMessage.string("USER_ENABLED_OR_NOT_FOUND")); } return bulkDeletionFailureResult; } }
Source:
<code><START> private ExtensionScript getScriptsExtension() { <END> if (extensionScript == null) extensionScript = Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); return extensionScript; }</code><technical_language>static</technical_language>

Target:
private static ExtensionScript getScriptsExtension() { if (extensionScript == null) extensionScript = Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); return extensionScript; }
Source:
<code>public void run() { try { log.info("Running reporting task: " + getClass().getSimpleName()); <START> currentSession = sessionFactory.getHibernateSessionFactory().getCurrentSession(); <END> executeTask(); log.info("Completed reporting task: " + getClass().getSimpleName()); } catch (Exception e) { log.error("An error occurred while running reporting task: " + getClass(), e); } }</code><technical_language>Revert sessionFactory.getCurrentSession()</technical_language>

Target:
public void run() { try { log.info("Running reporting task: " + getClass().getSimpleName()); currentSession = sessionFactory.getCurrentSession(); executeTask(); log.info("Completed reporting task: " + getClass().getSimpleName()); } catch (Exception e) { log.error("An error occurred while running reporting task: " + getClass(), e); } }
Source:
<code>public void init(Run src, AbstractBuild<?,?> dst, FilePath srcDir, FilePath baseTargetDir) throws IOException, InterruptedException { if (Util.isOverridden(Copier.class, getClass(), "init", Run.class, Run.class, FilePath.class, FilePath.class)) { init(src, (Run) dst, srcDir, baseTargetDir); <START> } <END> }</code><technical_language>else throw AbstractMethodError</technical_language>

Target:
public void init(Run src, AbstractBuild<?,?> dst, FilePath srcDir, FilePath baseTargetDir) throws IOException, InterruptedException { if (Util.isOverridden(Copier.class, getClass(), "initialize", Run.class, Run.class, FilePath.class, FilePath.class)) { initialize((Run<?, ?>)src, dst, srcDir, baseTargetDir); } else { throw new AbstractMethodError(String.format("Invalid call to Copier.init(Run src, AbstractBuild dst, FilePath, FilePath). " + "%s implements the newer version of 'initialize' that takes a Run instance for the 'dst' arg. Please call that implementation.", getClass().getName())); } }
Source:
<code>public ICPPASTAttributeSpecifier copy(CopyStyle style) { <START> ICPPASTAttributeSpecifier copy = copy(new CPPASTAttributeSpecifier(), style); <END> for (ICPPASTAttribute attribute : ArrayUtil.trim(attributes)){ copy.addAttribute(attribute.copy(style)); } return copy; }</code><technical_language>Slightly more efficient: CPPASTAttributeSpecifier copy = copy(new CPPASTAttributeSpecifier(), style); copy.attributes = ArrayUtil.trim(attributes); for (int i = 0; i < copy.attributes.length; i++) { copy.attributes[i] = copy.attributes[i].copy(style); } return copy;</technical_language>

Target:
public ICPPASTAttributeSpecifier copy(CopyStyle style) { CPPASTAttributeSpecifier copy = copy(new CPPASTAttributeSpecifier(), style); copy.attributes = ArrayUtil.trim(attributes, true); for (int i = 0; i < copy.attributes.length; i++) { copy.attributes[i] = copy.attributes[i].copy(style); } return copy; }
Source:
<code>public Notification createNotification(Intent inboundIntent) { final NotificationData data = readInboundIntent(inboundIntent); if (null == data) { return null; } MPLog.d(LOGTAG, "MP FCM notification received: " + data.message); final PendingIntent contentIntent = PendingIntent.getActivity( context, 0, data.intent, PendingIntent.FLAG_UPDATE_CURRENT ); builder. setDefaults(MPConfig.getInstance(context).getNotificationDefaults()). setWhen(now). setContentTitle(data.title). setContentText(data.message). setTicker(data.ticker == null ? data.message : data.ticker). setContentIntent(contentIntent); <START> maybeSetSubTitle(data); <END> maybeSetNotificationBarIcon(data); maybeSetLargeIcon(data); maybeSetExpandableNotification(data); maybeSetCustomIconColor(data); maybeAddActionButtons(data); maybeSetChannel(data); maybeSetNotificationBadge(data); maybeSetTag(data); maybeSetGroupKey(data, contentIntent); maybeSetTime(data); maybeSetVisibility(data); final Notification n = buildNotification(); if (!data.sticky) { n.flags |= Notification.FLAG_AUTO_CANCEL; } return n; }</code><technical_language>rename related SubTitle SubText</technical_language>

Target:
public Notification createNotification(Intent inboundIntent) { final NotificationData data = readInboundIntent(inboundIntent); if (null == data) { return null; } else { this.data = data; } MPLog.d(LOGTAG, "MP FCM notification received: " + data.message); final PendingIntent contentIntent = PendingIntent.getActivity( context, 0, data.intent, PendingIntent.FLAG_UPDATE_CURRENT ); builder. setDefaults(MPConfig.getInstance(context).getNotificationDefaults()). setWhen(now). setContentTitle(data.title). setContentText(data.message). setTicker(data.ticker == null ? data.message : data.ticker). setContentIntent(contentIntent); maybeSetSubTitle(); maybeSetNotificationBarIcon(); maybeSetLargeIcon(); maybeSetExpandableNotification(); maybeSetCustomIconColor(); maybeAddActionButtons(); maybeSetChannel(); maybeSetNotificationBadge(); maybeSetGroupKey(contentIntent); maybeSetTime(); maybeSetVisibility(); final Notification n = buildNotification(); if (!data.sticky) { n.flags |= Notification.FLAG_AUTO_CANCEL; } return n; }
Source:
<code>public void switchTab(TabListItem tabItem) { boolean found = false; for (int i = 0; i < navTabs.getWidgetCount(); i++) { TabListItem <START> tabListItem = <END> (TabListItem) navTabs.getWidget(i); if (tabItem.getText().equals(tabListItem.getText())) { tabListItem.showTab(); TabPane tabPane = (TabPane) tabContent.getWidget(i); tabContent.remove(tabPane); tabContent.insert(tabPane, i); ((FlowPanel) tabPane.getWidget(0)).insert(tabHeaderContainer, 0); tabPane.getWidget(0).setHeight(height); tabPane.setActive(true); activeTab = (TabListItem) navTabs.getWidget(i); found = true; } else { TabPane tabPane = (TabPane) tabContent.getWidget(i); ((FlowPanel) tabPane.getWidget(0)).remove(tabHeaderContainer); tabPane.setActive(false); } } if (!found && navTabs.getWidgetCount() > 0) { ((TabListItem) navTabs.getWidget(0)).showTab(); TabPane tabPane = (TabPane) tabContent.getWidget(0); ((FlowPanel) tabPane.getWidget(0)).insert(tabHeaderContainer, 0); tabPane.setActive(true); } }</code><technical_language>I find tabItem (method parameter) tabListItem (loop variable) naming a bit confusing, rename this currentTabItem similar</technical_language>

Target:
public void switchTab(TabListItem tabItem) { boolean found = false; for (int i = 0; i < navTabs.getWidgetCount(); i++) { TabListItem currentTabItem = (TabListItem) navTabs.getWidget(i); if (tabItem.getText().equals(currentTabItem.getText())) { currentTabItem.showTab(); TabPane tabPane = (TabPane) tabContent.getWidget(i); tabContent.remove(tabPane); tabContent.insert(tabPane, i); ((FlowPanel) tabPane.getWidget(0)).insert(tabHeaderContainer, 0); tabPane.getWidget(0).setHeight(height); tabPane.setActive(true); activeTab = (TabListItem) navTabs.getWidget(i); found = true; } else { TabPane tabPane = (TabPane) tabContent.getWidget(i); ((FlowPanel) tabPane.getWidget(0)).remove(tabHeaderContainer); tabPane.setActive(false); } } if (!found && navTabs.getWidgetCount() > 0) { ((TabListItem) navTabs.getWidget(0)).showTab(); TabPane tabPane = (TabPane) tabContent.getWidget(0); ((FlowPanel) tabPane.getWidget(0)).insert(tabHeaderContainer, 0); tabPane.setActive(true); } }
Source:
<code>public void testSaltedVarbinaryUpperBoundQuery() throws Exception { String tableName = generateUniqueName(); String ddl = "CREATE TABLE " + tableName + " ( k VARBINARY PRIMARY KEY, a INTEGER ) SALT_BUCKETS = 3"; String dml = "UPSERT INTO " + tableName + " values (?, ?)"; String sql2 = "SELECT * FROM " + tableName + " WHERE k = ?"; try (Connection conn = DriverManager.getConnection(getUrl())) { conn.createStatement().execute(ddl); PreparedStatement stmt = conn.prepareStatement(dml); stmt.setInt(2, 1); stmt.setBytes(1, new byte[] { 5 }); stmt.executeUpdate(); <START> stmt.setBytes(1, new byte[] { 5, 0 }); <END> stmt.executeUpdate(); stmt.setBytes(1, new byte[] { 5, 1 }); stmt.executeUpdate(); conn.commit(); stmt = conn.prepareStatement(sql2); stmt.setBytes(1, new byte[] { 5 }); ResultSet rs = stmt.executeQuery(); assertTrue(rs.next()); assertArrayEquals(new byte[] {5},rs.getBytes(1)); assertEquals(1,rs.getInt(2)); assertFalse(rs.next()); } }</code><technical_language>reason sequence is different? setting 1st parameter more readable</technical_language>

Target:
public void testSaltedVarbinaryUpperBoundQuery() throws Exception { String tableName = generateUniqueName(); String ddl = "CREATE TABLE " + tableName + " ( k VARBINARY PRIMARY KEY, a INTEGER ) SALT_BUCKETS = 3"; String dml = "UPSERT INTO " + tableName + " values (?, ?)"; String sql2 = "SELECT * FROM " + tableName + " WHERE k = ?"; try (Connection conn = DriverManager.getConnection(getUrl())) { conn.createStatement().execute(ddl); PreparedStatement stmt = conn.prepareStatement(dml); stmt.setInt(2, 1); stmt.setBytes(1, new byte[] { 5 }); stmt.executeUpdate(); stmt.setBytes(1, new byte[] { 5, 0 }); stmt.executeUpdate(); stmt.setBytes(1, new byte[] { 5, 1 }); stmt.executeUpdate(); stmt.close(); conn.commit(); stmt = conn.prepareStatement(sql2); stmt.setBytes(1, new byte[] { 5 }); ResultSet rs = stmt.executeQuery(); assertTrue(rs.next()); assertArrayEquals(new byte[] {5},rs.getBytes(1)); assertEquals(1,rs.getInt(2)); assertFalse(rs.next()); stmt.close(); } }
Source:
<code><START> public void append(String cacheKey, LoggingEvent event) { <END> try { isAppending.lock(); appenderCache.computeIfAbsent(cacheKey, this::createAppender); queue.put(new ApplicableEvent(cacheKey, event)); } catch (InterruptedException e) { LOGGER.warn("Queue put is interrupted."); } finally { isAppending.unlock(); } }</code><technical_language>add @SuppressWarnings("squid:S2142") purposely chose reiterate Interruption state and/or exception</technical_language>

Target:
public void append(String cacheKey, LoggingEvent event) { try { isAppending.lock(); appenderCache.computeIfAbsent(cacheKey, this::createAppender); queue.put(new ApplicableEvent(cacheKey, event)); } catch (InterruptedException e) { LOGGER.warn("Interrupted append on " + cacheKey); Thread.currentThread().interrupt(); } finally { isAppending.unlock(); } }
Source:
<code>protected void start(String name, File rootDir, File configurationFile) { if (configuration.isParallelStartup()) { throw new IllegalStateException("Forked mode doesn't support parallel startup"); } <START> String globalServerHome = System.getProperty(TestSystemPropertyNames.INFINISPAN_TEST_SERVER_DIR); <END> if (globalServerHome == null) { throw new IllegalArgumentException("You must specify a " + TestSystemPropertyNames.INFINISPAN_TEST_SERVER_DIR + " property."); } List<Path> serverHomes = new ArrayList<>(); Path src = Paths.get(globalServerHome).normalize(); for (int i = 0; i < configuration.numServers(); i++) { Path dest = Paths.get(CommonsTestingUtil.tmpDirectory(), UUID.randomUUID().toString()); try { Files.createDirectory(dest); Files.walkFileTree(src, new CommonsTestingUtil.CopyFileVisitor(dest, true)); } catch (IOException e) { throw new UncheckedIOException("Cannot copy the server to temp folder", e); } serverHomes.add(dest); } if (serverHomes.size() != configuration.numServers()) { throw new IllegalArgumentException("configuration.numServers should be the same " + "as the number of servers declared on org.infinispan.test.server"); } for (int i = 0; i < configuration.numServers(); i++) { String serverHome = serverHomes.get(i).toString(); ForkedServer server = new ForkedServer(serverHome) .setServerConfiguration(configurationFile.getPath()) .setPortsOffset(i); copyArtifactsToUserLibDir(server.getServerLib()); forkedServers.add(server.start()); forkedServers.get(0).printServerLog(s -> log.info(s)); } }</code><technical_language>This appears wrong, please fix in PR #8378</technical_language>

Target:
protected void start(String name, File rootDir, File configurationFile) { if (configuration.isParallelStartup()) { throw new IllegalStateException("Forked mode doesn't support parallel startup"); } String globalServerHome = configuration.properties().getProperty(TestSystemPropertyNames.INFINISPAN_TEST_SERVER_DIR); if (globalServerHome == null) { throw new IllegalArgumentException("You must specify a " + TestSystemPropertyNames.INFINISPAN_TEST_SERVER_DIR + " property."); } List<Path> serverHomes = new ArrayList<>(); Path src = Paths.get(globalServerHome).normalize(); for (int i = 0; i < configuration.numServers(); i++) { Path dest = Paths.get(CommonsTestingUtil.tmpDirectory(), UUID.randomUUID().toString()); try { Files.createDirectory(dest); Files.walkFileTree(src, new CommonsTestingUtil.CopyFileVisitor(dest, true)); } catch (IOException e) { throw new UncheckedIOException("Cannot copy the server to temp folder", e); } serverHomes.add(dest); } if (serverHomes.size() != configuration.numServers()) { throw new IllegalArgumentException("configuration.numServers should be the same " + "as the number of servers declared on org.infinispan.test.server"); } for (int i = 0; i < configuration.numServers(); i++) { String serverHome = serverHomes.get(i).toString(); ForkedServer server = new ForkedServer(serverHome) .setServerConfiguration(configurationFile.getPath()) .setPortsOffset(i); copyArtifactsToUserLibDir(server.getServerLib()); forkedServers.add(server.start()); forkedServers.get(0).printServerLog(log::info); } }
Source:
<code>private void setSourceMetadata(Model model, Resource primaryResource, File dataFile) { PID sourceMDPID = new PID(primaryResource.getURI() + "/" + MD_SOURCE.getName()); Resource sourceMDResource = model.createResource(sourceMDPID.getURI()); model.add(primaryResource, dprop(model, hasDatastream), sourceMDResource); model.add(primaryResource, cdrprop(model, sourceMetadata), sourceMDResource); model.add(sourceMDResource, dprop(model, stagingLocation), DepositConstants.DATA_DIR + "/" + dataFile.getName()); <START> model.add(primaryResource, cdrprop(model, hasSourceMetadataProfile), "proquest"); <END> model.add(sourceMDResource, dprop(model, mimetype), "text/xml"); }</code><technical_language>do want a constant for in metadata project in case. I object strings</technical_language>

Target:
private void setSourceMetadata(Model model, Resource primaryResource, File dataFile) { PID sourceMDPID = new PID(primaryResource.getURI() + "/" + MD_SOURCE.getName()); Resource sourceMDResource = model.createResource(sourceMDPID.getURI()); model.add(primaryResource, dprop(model, hasDatastream), sourceMDResource); model.add(primaryResource, cdrprop(model, sourceMetadata), sourceMDResource); model.add(sourceMDResource, dprop(model, stagingLocation), DepositConstants.DATA_DIR + "/" + dataFile.getName()); model.add(primaryResource, cdrprop(model, hasSourceMetadataProfile), PROQUEST_ETD); model.add(sourceMDResource, dprop(model, mimetype), "text/xml"); }
Source:
<code>public TaskDataDiff createDiff(TaskData newTaskData, TaskData oldTaskData, final IProgressMonitor monitor) { final TaskDataDiff diff = new TaskDataDiff(model, newTaskData, oldTaskData); for (final SynchronizationParticipant participant : getDefaultParticipants()) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { } public void run() throws Exception { participant.processUpdate(diff, monitor); } }); } for (final SynchronizationParticipant participant : getParticipants(newTaskData.getConnectorKind())) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { } public void run() throws Exception { participant.processUpdate(diff, monitor); } }); } <START> diff.setHasChanged(diff.getChangedAttributes().size() > 0 || diff.getNewComments().size() > 0 || diff.getNewAttachments().size() > 0); <END> return diff; }</code><technical_language>weird caller determines if changed not. I more sense introduce a method diff.updateHasChanged() recomputes flag, simply remove boolean diff.hasChanged() return true false based contents of list of changed things. ie. hasChanged() {return !changedAttributes().isEmpty()&& ... }</technical_language>

Target:
public TaskDataDiff createDiff(TaskData newTaskData, TaskData oldTaskData, final IProgressMonitor monitor) { final TaskDataDiff diff = new TaskDataDiff(model, newTaskData, oldTaskData); for (final SynchronizationParticipant participant : getDefaultParticipants()) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { } public void run() throws Exception { participant.processUpdate(diff, monitor); } }); } for (final SynchronizationParticipant participant : getParticipants(newTaskData.getConnectorKind())) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable exception) { } public void run() throws Exception { participant.processUpdate(diff, monitor); } }); } diff.updateHasChanged(); return diff; }
Source:
<code>public void close() { log.debug("Close consumer if exist: %d, partition %d", Thread.currentThread().getId(), split.getPartitionId()); <START> if (this.consumer != null) { <END> this.consumer.close(); } }</code><technical_language>this reference class members</technical_language>

Target:
public void close() { if (consumer != null) { consumer.close(); } }
Source:
<code>public void workerBackpressure(String stormId, String node, Long port, long timestamp) { String path = ClusterUtils.backpressurePath(stormId, node, port); boolean existed = stateStorage.node_exists(path, false); <START> if (timestamp <= 0) { <END> return; } byte[] data = ByteBuffer.allocate(Long.BYTES).putLong(timestamp).array(); if (existed) { stateStorage.set_data(path, data, acls); } else { stateStorage.set_ephemeral_node(path, data, acls); } }</code><technical_language>This check moved top of function, if timestamp is negative reason check if znode exists</technical_language>

Target:
public void workerBackpressure(String stormId, String node, Long port, long timestamp) { if (timestamp <= 0) { return; } String path = ClusterUtils.backpressurePath(stormId, node, port); boolean existed = stateStorage.node_exists(path, false); byte[] data = ByteBuffer.allocate(Long.BYTES).putLong(timestamp).array(); if (existed) { stateStorage.set_data(path, data, acls); } else { stateStorage.set_ephemeral_node(path, data, acls); } }
Source:
<code>public long count() { AtomicInteger counter = new AtomicInteger(0); <START> forEachBatched(batch -> counter.addAndGet(batch.size()), 1000); <END> return counter.get(); }</code><technical_language>Store magic number in private static final</technical_language>

Target:
public long count() { AtomicInteger counter = new AtomicInteger(0); forEachBatched(batch -> counter.addAndGet(batch.size()), BATCH_SIZE); return counter.get(); }
Source:
<code>public void addEventHandler(EventHandler eventHandler) { if (eventHandler != null) { if (eventHandlers == null) { <START> eventHandlers = Collections.synchronizedList(new LinkedList<EventHandler>()); <END> } boolean handlerExist = false; for (EventHandler handler : eventHandlers) { if (handler.getUID().equals(eventHandler.getUID())) { handlerExist = true; } } if (!handlerExist) { eventHandlers.add(eventHandler); addSubscribeEvents(eventHandler.getSupportetEvents()); logger.debug("eventHandler: added", eventHandler.getUID()); if (isStarted) { internalStart(); } } } }</code><technical_language>initialize this define eventHandlers? This saves null check call this method</technical_language>

Target:
public void addEventHandler(EventHandler eventHandler) { if (eventHandler != null) { boolean handlerExist = false; for (EventHandler handler : eventHandlers) { if (handler.getUID().equals(eventHandler.getUID())) { handlerExist = true; } } if (!handlerExist) { eventHandlers.add(eventHandler); addSubscribeEvents(eventHandler.getSupportedEvents()); logger.debug("eventHandler: added", eventHandler.getUID()); if (isStarted) { internalStart(); } } } }
Source:
<code>public static BigInteger factorial(int base) { if (base > 100000) { return null; } BigInteger value = BigInteger.ONE; for (int i = 1; i <= base; i++) { <START> value = value.multiply(BigInteger.valueOf(base)); <END> } return value; }</code><technical_language>@ge0ffrey This is factorial, this is base ^ base</technical_language>

Target:
public static BigInteger factorial(int base) { if (base > 100000) { return null; } BigInteger value = BigInteger.ONE; for (int i = 1; i <= base; i++) { value = value.multiply(BigInteger.valueOf(i)); } return value; }
Source:
<code><START> void processForCompatibility() <END></code><technical_language>this method implemented for a merge request MergeRequestBuildAction extend BuildWebHookAction all? This class needs implement WebHookAction interface. This BuildWebHookAction obsolete move processForCompatibilty stuff PushBuildAction</technical_language>

Target:
void processForCompatibility() { final ObjectAttributes attributes = this.mergeRequestHook.getObjectAttributes(); if (attributes != null) { final Project source = attributes.getSource(); if (source != null && source.getHttpUrl() != null) { if (source.getUrl() == null) { source.setUrl(source.getHttpUrl()); } if (source.getHomepage() == null) { source.setHomepage(source.getHttpUrl().substring(0, source.getHttpUrl().lastIndexOf(".git"))); } } } }
Source:
<code>private void calcSha256ForItem(String repoName, String path) { ObjectMapper mapper = new ObjectMapper(); Map<String, Object> map = null; <START> try { <END> map = mapper.readValue( "{\"repoKey\":\""+ repoName +"\", \"path\":\""+path+"\"}", Map.class ); } catch (IOException e) { e.printStackTrace(); } ArtifactoryRequest request = new ArtifactoryRequestImpl() .apiUrl("api/checksum/sha256") .method(ArtifactoryRequest.Method.POST) .requestType(ArtifactoryRequest.ContentType.JSON) .requestBody(map); artifactory.restCall(request); }</code><technical_language>swallow this exception, in case is thrown, thrown this method</technical_language>

Target:
private void calcSha256ForItem(String repoName, String path) { ObjectMapper mapper = new ObjectMapper(); Map<String, Object> map; try { map = mapper.readValue( "{\"repoKey\":\""+ repoName +"\", \"path\":\""+path+"\"}", Map.class ); } catch (IOException e) { throw new RuntimeException(e); } ArtifactoryRequest request = new ArtifactoryRequestImpl() .apiUrl("api/checksum/sha256") .method(ArtifactoryRequest.Method.POST) .requestType(ArtifactoryRequest.ContentType.JSON) .requestBody(map); artifactory.restCall(request); }
Source:
<code>public boolean matches(String segment, int startIncl, int endExcl, boolean assumeDirectory) { String s = subPattern; int subLength = s.length() - 1; if (subLength == 0) return true; if (subLength > (endExcl - startIncl)) return false; <START> for (int i = subLength, j = 1; i > 0; i--, j++) { <END> char c1 = s.charAt(i); char c2 = segment.charAt(endExcl - j); if (c1 != c2) return false; } return true; }</code><technical_language>j start endExcl - 1 decrement it? a bit easier understand if indexes</technical_language>

Target:
public boolean matches(String segment, int startIncl, int endExcl, boolean assumeDirectory) { String s = subPattern; int subLength = s.length() - 1; if (subLength == 0) return true; if (subLength > (endExcl - startIncl)) return false; for (int i = subLength, j = endExcl - 1; i > 0; i--, j--) { char c1 = s.charAt(i); char c2 = segment.charAt(j); if (c1 != c2) return false; } return true; }
Source:
<code><START> public boolean isLeapDay() { <END> return isLeapYear() && dayOfYear == 169; }</code><technical_language>I dislike needing methods. do them, in preference for month/day-of-month flag values</technical_language>

Target:
boolean isLeapDay() { return this.isLeapDay; }
Source:
<code>private void initPreApplicationState() { logger.info(Utility.version(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = TestController.loadApplicationPreferences(); if(TestController.isBypassLogin()){ prefs.setLastLoginCredentials("test", "test"); <START> } <END> KeyboardShortcuts.loadKeyboardShortcuts(prefs); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); }</code><technical_language>This belongs here. put this loadApplicationPreferences instead</technical_language>

Target:
private void initPreApplicationState() { logger.info(Version.getCurrentVersion().toString()); UI.events = this; Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> logger.error(throwable.getMessage(), throwable)); TestController.setUI(this, getParameters()); prefs = TestController.loadApplicationPreferences(); eventBus = new EventBus(); if (TestController.isTestMode()) { registerTestEvents(); } registerEvent((UnusedStoredReposChangedEventHandler) e -> onRepoOpened()); registerEvent((UsedReposChangedEventHandler) e -> removeUnusedModelsAndUpdate()); uiManager = new UIManager(this); status = new HTStatusBar(this); updateManager = TestController.createUpdateManager(); updateManager.run(); }
Source:
<code><START> public int cleanupCompliances(int minutes) { <END> Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, -1 * minutes); int batchSize = 256; int count = 0; Session session = this.currentSession(); EntityManager em = this.getEntityManager(); CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery<Compliance> cquery = builder.createQuery(Compliance.class); Root<Compliance> croot = cquery.from(Compliance.class); ParameterExpression<Date> param = builder.parameter(Date.class); cquery.select(croot).where(builder.lessThanOrEqualTo(croot.<Date>get("date"), param)); TypedQuery<Compliance> query = em.createQuery(cquery); query.setParameter(param, cal.getTime()); query.setMaxResults(batchSize); List<Compliance> compliances; do { compliances = (List<Compliance>) query.getResultList(); for (Compliance compliance : compliances) { session.delete(compliance); } em.flush(); count += compliances.size(); } while (compliances.size() == batchSize); return count; }</code><technical_language>making this transactional if a thousand compliances delete, will</technical_language>

Target:
public int cleanupCompliances(int minutes) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, -1 * minutes); int batchSize = 256; int count = 0; EntityManager em = this.getEntityManager(); CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery<Compliance> cquery = builder.createQuery(Compliance.class); Root<Compliance> croot = cquery.from(Compliance.class); ParameterExpression<Date> param = builder.parameter(Date.class); cquery.select(croot).where(builder.lessThanOrEqualTo(croot.<Date>get("date"), param)); TypedQuery<Compliance> query = em.createQuery(cquery); query.setHint("javax.persistence.cache.retrieveMode", CacheRetrieveMode.BYPASS); query.setHint("javax.persistence.cache.storeMode", CacheStoreMode.BYPASS); query.setParameter(param, cal.getTime()); query.setMaxResults(batchSize); List<Compliance> compliances; do { compliances = (List<Compliance>) query.getResultList(); for (Compliance compliance : compliances) { em.remove(compliance); } em.flush(); count += compliances.size(); } while (compliances.size() == batchSize); return count; }
Source:
<code>public DimFilter optimize() { if (values.size() == 1) { return new SelectorDimFilter(dimension, values.first(), extractionFn).optimize(); } if (extractionFn instanceof LookupExtractionFn && ((LookupExtractionFn) extractionFn).isOptimize()) { LookupExtractionFn exFn = (LookupExtractionFn) extractionFn; LookupExtractor lookup = exFn.getLookup(); final List<String> keys = new ArrayList<>(); for (String value : values) { final String convertedValue = Strings.emptyToNull(value); if (!exFn.isRetainMissingValue() && Objects.equals(convertedValue, exFn.getReplaceMissingValueWith())) { return this; } keys.addAll(lookup.unapply(convertedValue)); if (exFn.isRetainMissingValue() && lookup.apply(convertedValue) == null) { keys.add(convertedValue); } } if (keys.isEmpty()) { return this; } else { return new InDimFilter(dimension, keys, null).optimize(); } <START> } <END> return this; }</code><technical_language>avoid code duplication</technical_language>

Target:
public DimFilter optimize() { InDimFilter inFilter = optimizeLookup(); if (inFilter.values.size() == 1) { return new SelectorDimFilter(inFilter.dimension, inFilter.values.first(), inFilter.getExtractionFn()); } return inFilter; }
Source:
<code>public DecodedJWT verify(String token) throws JWTVerificationException { DecodedJWT jwt = JWT.decode(token); verifyAlgorithm(jwt, algorithm); algorithm.verify(jwt); verifyClaims(jwt, claims); <START> return jwt; <END> }</code><technical_language>DRY: existing method delegate new method decoded token</technical_language>

Target:
public DecodedJWT verify(String token) throws JWTVerificationException { DecodedJWT jwt = JWT.decode(token); return verify(jwt); }
Source:
<code>public void setup(OperatorContext context) { <START> Preconditions.checkNotNull(managedState); <END> ((FileAccessFSImpl)managedState.getFileAccess()).setBasePath(context.getValue(DAG.APPLICATION_PATH) + Path.SEPARATOR + BUCKET_DIR); managedState.setup(context); if (preserveTupleOrder) { decisions = Maps.newLinkedHashMap(); } }</code><technical_language>need of this. marked @NotNull</technical_language>

Target:
public void setup(OperatorContext context) { ((FileAccessFSImpl)managedState.getFileAccess()).setBasePath(context.getValue(DAG.APPLICATION_PATH) + Path.SEPARATOR + BUCKET_DIR); managedState.setup(context); if (preserveTupleOrder) { decisions = Maps.newLinkedHashMap(); } }
Source:
<code>private QueryData checkAndCloneQueryData() throws OseeCoreException { QueryData queryData = getQueryData().clone(); <START> Collection<Criteria> criterias = queryData.getAllCriteria(); <END> if (criterias.isEmpty() || (criterias.size() == 1 && criterias.iterator().next() instanceof CriteriaBranch)) { addAndCheck(queryData, criteriaFactory.createAllArtifactsCriteria()); } return queryData; }</code><technical_language>add parens more clear order checked in</technical_language>

Target:
private QueryData checkAndCloneQueryData() throws OseeCoreException { QueryData queryData = getQueryData().clone(); Collection<Criteria> criterias = queryData.getAllCriteria(); if (criterias.isEmpty() || hasOneBranchCriteria(criterias)) { addAndCheck(queryData, criteriaFactory.createAllArtifactsCriteria()); } return queryData; }
Source:
<code>private boolean isChildNode(Node current, Node prevNode) { boolean isChild = false; if (prevNode.hasChildNodes()) { NodeList childNodes = prevNode.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { if (childNodes.item(i).getAttributes() != null && current.getAttributes() .getNamedItem(SOAPToRESTConstants.NAME_ATTRIBUTE).getNodeValue().equals(childNodes.item(i) .getAttributes().getNamedItem(SOAPToRESTConstants.NAME_ATTRIBUTE).getNodeValue())) { <START> isChild = true; <END> } } } return isChild; }</code><technical_language>return true? If is true, need loop remaining objects right</technical_language>

Target:
private boolean isChildNode(Node current, Node prevNode) { if (prevNode.hasChildNodes()) { NodeList childNodes = prevNode.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { if (childNodes.item(i).getAttributes() != null && current.getAttributes() .getNamedItem(SOAPToRESTConstants.NAME_ATTRIBUTE).getNodeValue().equals(childNodes.item(i) .getAttributes().getNamedItem(SOAPToRESTConstants.NAME_ATTRIBUTE).getNodeValue())) { return true; } } } return false; }
Source:
<code>public ViewDistance getViewDistance() { <START> return (viewDistance == null) ? ViewDistance.FAR : viewDistance; <END> }</code><technical_language>default rendering distance [is currently **MODERATE**](<LINK_0> - I this is a default **FAR** noticeable performance issues low-end machines</technical_language>

Target:
public ViewDistance getViewDistance() { return (viewDistance == null) ? ViewDistance.MODERATE : viewDistance; }
Source:
<code>public StartsDockerDaemon(final Profile prof) { this.profile = prof; this.client = DockerClientBuilder.getInstance().build(); this.containers = Collections.newSetFromMap( <START> new ConcurrentHashMap<CreateContainerResponse, Boolean>(1) <END> ); }</code><technical_language>@original-brownbear point of creating set of size 1 concurrency level of 16</technical_language>

Target:
public StartsDockerDaemon(final Profile prof) { this.profile = prof; this.client = DockerClientBuilder.getInstance().build(); this.containers = Collections.newSetFromMap( new ConcurrentHashMap<CreateContainerResponse, Boolean>(1, 0.9f, 1) ); }
Source:
<code>protected void onInit() { super.onInit(); this.webSocketContainer.setMessageListener(this); if (!CollectionUtils.isEmpty(this.messageConverters)) { List<MessageConverter> converters = this.messageConverter.getConverters(); if (this.mergeWithDefaultConverters) { ListIterator<MessageConverter> iterator = this.messageConverters.listIterator(this.messageConverters.size()); while (iterator.hasPrevious()) { MessageConverter converter = iterator.previous(); converters.add(0, converter); } } else { converters.clear(); converters.addAll(this.messageConverters); } } if (this.server && this.useBroker) { Map<String, AbstractBrokerMessageHandler> brokers = getApplicationContext() .getBeansOfType(AbstractBrokerMessageHandler.class); for (AbstractBrokerMessageHandler broker : brokers.values()) { if (broker instanceof SimpleBrokerMessageHandler || broker instanceof StompBrokerRelayMessageHandler) { this.brokerHandler = broker; <START> break; <END> } } if (this.brokerHandler == null) { logger.warn("'AbstractBrokerMessageHandler' isn't present in the application context. The non-MESSAGE" + "WebSocketMessages will be ignored."); } } }</code><technical_language>This arbitrary - inject</technical_language>

Target:
protected void onInit() { super.onInit(); this.webSocketContainer.setMessageListener(this); if (!CollectionUtils.isEmpty(this.messageConverters)) { List<MessageConverter> converters = this.messageConverter.getConverters(); if (this.mergeWithDefaultConverters) { ListIterator<MessageConverter> iterator = this.messageConverters.listIterator(this.messageConverters.size()); while (iterator.hasPrevious()) { MessageConverter converter = iterator.previous(); converters.add(0, converter); } } else { converters.clear(); converters.addAll(this.messageConverters); } } if (this.server && this.useBroker) { Map<String, AbstractBrokerMessageHandler> brokers = getApplicationContext() .getBeansOfType(AbstractBrokerMessageHandler.class); for (AbstractBrokerMessageHandler broker : brokers.values()) { if (broker instanceof SimpleBrokerMessageHandler || broker instanceof StompBrokerRelayMessageHandler) { this.brokerHandler = broker; break; } } if (this.brokerHandler == null) { logger.warn("'AbstractBrokerMessageHandler' isn't present in the application context. " + "The non-MESSAGE WebSocketMessages will be ignored."); } } }
Source:
<code><START> public String method() { <END> return method.name(); }</code><technical_language>I thin create a new method httpMethod() return enum deprecate this removed feign 12!</technical_language>

Target:
public String method() { return httpMethod.name(); }
Source:
<code>public String getPartitionIdStringOrNullString() { <START> return defaultIfNull(getPartitionId(), "null").toString(); <END> }</code><technical_language>nitpick: I write this way, I obvious doing. more code, I clearer write: if (myPartitionId == null) { return "null" } return myPartitionId.toString();</technical_language>

Target:
public String getPartitionIdStringOrNullString() { if (myPartitionId == null) { return "null"; } return myPartitionId.toString(); }
Source:
<code><START> protected NIC populate(NIC model, VmNetworkInterface entity) { <END> network network = getClusterNetwork(getClusterId(), null, model.getNetwork().getName()); String networkId = network == null ? null : network.getId().toString(); model.getNetwork().setId(networkId); model.getNetwork().setName(null); if (entity.isPortMirroring()) { PortMirroring portMirroring = new PortMirroring(); Networks networks = new Networks(); Network net = new Network(); net.setId(networkId); portMirroring.setNetworks(networks); portMirroring.getNetworks().getNetworks().add(net); model.setPortMirroring(portMirroring); } return addStatistics(model, entity, uriInfo, httpHeaders); }</code><technical_language>this is efficient, listing networks preform extra query getAllNetworks for network, in previous patch-set i intentionally gave file line number, reuse code getAllNetworks list networks, please BackendNicsResource.java:53 please remove this populate override, add P.M code [1], of BackendNicsResource.java:56 @Override public Nics list() { Nics nics = new Nics(); List<VmNetworkInterface> entities = getBackendCollection(queryType, queryParams); Guid clusterId = getClusterId(); List<network> networks = getBackendCollection(network.class, VdcQueryType.GetAllNetworksByClusterId, new VdsGroupQueryParamenters(clusterId)); for (VmNetworkInterface entity : entities) { network network = lookupClusterNetwork(clusterId, null, entity.getNetworkName(), networks); NIC nic = populate(map(entity), entity); if (network!=null && network.getId()!=null) { ==>> [1] inject P.M herer nic.getNetwork().setId(network.getId().toString()); nic.getNetwork().setName(null); } if (validate(nic)) { nics.getNics().add(addLinks(nic)); } } return nics; } thanks</technical_language>

Target:
protected NIC populate(NIC model, VmNetworkInterface entity) { return addStatistics(model, entity, uriInfo, httpHeaders); }
Source:
<code>private void addPrincipals( ParsedPolicyEntry parsedPolicyEntry, List<ConditionInfo> conditionInfos) { List<ParsedPrincipal> parsedPrincipals = parsedPolicyEntry.getPrincipals(); List<String> principals = new ArrayList<>(); for (ParsedPrincipal parsedPrincipal : parsedPrincipals) { if (parsedPrincipal.hasAlias()) { principals.add(parsedPrincipal.getAlias()); } else { principals.add( parsedPrincipal.getPrincipalClass() + "/" + parsedPrincipal.getPrincipalName()); } } if (!principals.isEmpty()) { <START> conditionInfos.add(new ConditionInfo(PRINCIPAL_CONDITION, principals.toArray(new String[0]))); <END> } }</code><technical_language>More optimal do new String[principals.size()] avoid creating array for</technical_language>

Target:
private void addPrincipals( ParsedPolicyEntry parsedPolicyEntry, List<ConditionInfo> conditionInfos) { List<ParsedPrincipal> parsedPrincipals = parsedPolicyEntry.getPrincipals(); List<String> principals = new ArrayList<>(); for (ParsedPrincipal parsedPrincipal : parsedPrincipals) { if (parsedPrincipal.hasAlias()) { principals.add(parsedPrincipal.getAlias()); } else { principals.add( parsedPrincipal.getPrincipalClass() + "/" + parsedPrincipal.getPrincipalName()); } } if (!principals.isEmpty()) { conditionInfos.add( new ConditionInfo( PRINCIPAL_CONDITION, principals.toArray(new String[principals.size()]))); } }
Source:
<code>public void incrementAllReachable(int seconds) { for (int i = 0; i < travelTimes.length; i++) { <START> if (travelTimes[i] != Integer.MAX_VALUE) { <END> travelTimes[i] += seconds; } } }</code><technical_language>FastRaptorWorker.UNREACHED</technical_language>

Target:
public void incrementAllReachable(int seconds) { for (int i = 0; i < travelTimes.length; i++) { if (travelTimes[i] != UNREACHED) { travelTimes[i] += seconds; } } }
Source:
<code>protected void initButton(final Button button) { button.setToolTipText("Update Working Branch From Parent"); button.setImage(ImageManager.getImage(FrameworkImage.BRANCH_SYNCH)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { try { Branch branchToUpdate = getWorkingBranch(); if (branchToUpdate != null) { <START> if (!BranchManager.hasMergeBranches(branchToUpdate) || branchToUpdate.getBranchState().isRebaselineInProgress()) { <END> if (branchToUpdate.getBranchState().isRebaselineInProgress()) { RebaselineInProgressHandler.handleRebaselineInProgress(branchToUpdate); } else { boolean isUserSure = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Update Branch", String.format("Are you sure you want to update [%s] branch", branchToUpdate.getName())); if (isUserSure) { BranchManager.updateBranch(branchToUpdate, new UserConflictResolver()); } } } else { MessageDialog.openWarning( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Can't Update Branch", String.format( "Couldn't update [%s] because it currently has merge branches from commits. To perform an update please delete all the merge branches for this branch.", branchToUpdate.getName())); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } }); }</code><technical_language>Consider removing this extra check, is, move BranchManager test else case</technical_language>

Target:
protected void initButton(final Button button) { button.setToolTipText("Update Working Branch From Parent"); button.setImage(ImageManager.getImage(FrameworkImage.BRANCH_SYNCH)); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { try { Branch branchToUpdate = getWorkingBranch(); if (branchToUpdate != null) { if (BranchManager.isUpdatable(branchToUpdate)) { if (branchToUpdate.getBranchState().isRebaselineInProgress()) { RebaselineInProgressHandler.handleRebaselineInProgress(branchToUpdate); } else { boolean isUserSure = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Update Branch", String.format("Are you sure you want to update [%s] branch", branchToUpdate.getName())); if (isUserSure) { BranchManager.updateBranch(branchToUpdate, new UserConflictResolver()); } } } else { MessageDialog.openWarning( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Can't Update Branch", String.format( "Couldn't update [%s] because it currently has merge branches from commits. To perform an update please delete all the merge branches for this branch.", branchToUpdate.getName())); } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } }); }