auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private I_C_Order createOrder() { final I_C_Order order = newInstance(I_C_Order.class); order.setIsSOTrx(true); order.setC_BPartner_ID(createPartner("Partner 3").getC_BPartner_ID()); order.setAD_User_ID(createUser("User 3").getAD_User_ID()); order.setDatePromised(de.metas.common.util.time.SystemTime.asDayTimestamp()); <START> order.setC_DocTypeTarget_ID(createDocType().getC_DocType_ID()); <END> save(order); return order; }</code><technical_language>.. u setC_DocType_ID</technical_language>

Target:
private I_C_Order createOrder() { final I_C_Order order = newInstance(I_C_Order.class); order.setIsSOTrx(true); order.setC_BPartner_ID(createPartner("Partner 3").getC_BPartner_ID()); order.setAD_User_ID(createUser("User 3").getAD_User_ID()); order.setDatePromised(de.metas.common.util.time.SystemTime.asDayTimestamp()); order.setC_DocType_ID(createDocType().getC_DocType_ID()); save(order); return order; }
Source:
<code>public boolean attach() { if (!attached) { attached = true; if (isLocalBeanStoreSyncNeeded() && !isAttributeLazyLoadingAllowed()) { <START> for (BeanIdentifier id : beanStore) { <END> ContextualInstance<?> instance = beanStore.get(id); String prefixedId = getNamingScheme().prefix(id); ContextLogger.LOG.updatingStoreWithContextualUnderId(instance, id); setAttribute(prefixedId, instance); } readAttributes(); } return true; } else { return false; } }</code><technical_language>I this logic, readAttributes() logic, executed lazy loading is allowed not. In other words, loading instances backing store local bean store lazily writing local entries backing store attach(). This impact performance local store empty of time. Also, reasoning correctness of this easier</technical_language>

Target:
public boolean attach() { if (!attached) { attached = true; if (isLocalBeanStoreSyncNeeded()) { if (!beanStore.delegate().isEmpty()) { for (BeanIdentifier id : beanStore) { ContextualInstance<?> instance = beanStore.get(id); String prefixedId = getNamingScheme().prefix(id); ContextLogger.LOG.updatingStoreWithContextualUnderId(instance, id); setAttribute(prefixedId, instance); } } if (!isAttributeLazyFetchingEnabled()) { fetchUninitializedAttributes(); } } return true; } else { return false; } }
Source:
<code>public Handler decorateHandler(Handler base, Class<?> sqlObjectType, Method method) { Handler handler = base; List<Class<? extends Annotation>> annotationTypes = Stream.of(method.getAnnotations()) .map(Annotation::annotationType) .filter(type -> type.isAnnotationPresent(SqlMethodDecoratingAnnotation.class)) .collect(toList()); Stream.of(method, sqlObjectType) .map(e -> e.getAnnotation(DecoratorOrder.class)) .filter(Objects::nonNull) .findFirst() <START> .ifPresent(order -> { <END> annotationTypes.sort(createDecoratorComparator(order).reversed()); }); List<HandlerDecorator> decorators = annotationTypes.stream() .map(type -> type.getAnnotation(SqlMethodDecoratingAnnotation.class)) .map(a -> buildDecorator(a.value())) .collect(toList()); for (HandlerDecorator decorator : decorators) { handler = decorator.decorateHandler(handler, sqlObjectType, method); } return handler; }</code><technical_language>I omit curly braces in lambda expression</technical_language>

Target:
public Handler decorateHandler(Handler base, Class<?> sqlObjectType, Method method) { Handler handler = base; List<Class<? extends Annotation>> annotationTypes = Stream.of(method.getAnnotations()) .map(Annotation::annotationType) .filter(type -> type.isAnnotationPresent(SqlMethodDecoratingAnnotation.class)) .collect(toList()); Stream.of(method, sqlObjectType) .map(e -> e.getAnnotation(DecoratorOrder.class)) .filter(Objects::nonNull) .findFirst() .ifPresent(order -> annotationTypes.sort(createDecoratorComparator(order).reversed())); List<HandlerDecorator> decorators = annotationTypes.stream() .map(type -> type.getAnnotation(SqlMethodDecoratingAnnotation.class)) .map(a -> buildDecorator(a.value())) .collect(toList()); for (HandlerDecorator decorator : decorators) { handler = decorator.decorateHandler(handler, sqlObjectType, method); } return handler; }
Source:
<code>private void callExecuteListener(Message message, long deliveryTag) throws Exception { boolean channelLocallyTransacted = isChannelLocallyTransacted(); try { executeListener(getChannel(), message); handleAck(deliveryTag, channelLocallyTransacted); } catch (ImmediateAcknowledgeAmqpException e) { if (this.logger.isDebugEnabled()) { <START> this.logger.debug("User requested ack for failed delivery"); <END> } handleAck(deliveryTag, channelLocallyTransacted); } catch (Exception e) { if (causeChainHasImmediateAcknowledgeAmqpException(e)) { if (this.logger.isDebugEnabled()) { this.logger.debug("User requested ack for failed delivery"); } } else { this.logger.error("Failed to invoke listener", e); if (this.transactionManager != null) { if (this.transactionAttribute.rollbackOn(e)) { rollback(deliveryTag, e); throw e; } else { if (this.logger.isDebugEnabled()) { this.logger.debug("No rollback for " + e); } } } else { rollback(deliveryTag, e); } } } }</code><technical_language>Minor: need extra isDebugEnabled() if static log message. in causeChainHasImmediateAcknowledgeAmqpException(e) block of code</technical_language>

Target:
private void callExecuteListener(Message message, long deliveryTag) throws Exception { boolean channelLocallyTransacted = isChannelLocallyTransacted(); try { executeListener(getChannel(), message); handleAck(deliveryTag, channelLocallyTransacted); } catch (ImmediateAcknowledgeAmqpException e) { if (this.logger.isDebugEnabled()) { this.logger.debug("User requested ack for failed delivery: " + deliveryTag); } handleAck(deliveryTag, channelLocallyTransacted); } catch (Exception e) { if (causeChainHasImmediateAcknowledgeAmqpException(e)) { if (this.logger.isDebugEnabled()) { this.logger.debug("User requested ack for failed delivery: " + deliveryTag); } handleAck(deliveryTag, channelLocallyTransacted); } else { this.logger.error("Failed to invoke listener", e); if (this.transactionManager != null) { if (this.transactionAttribute.rollbackOn(e)) { throw e; } else { if (this.logger.isDebugEnabled()) { this.logger.debug("No rollback for " + e); } } } else { rollback(deliveryTag, e); } } } }
Source:
<code>public static String createConsumer (final String topic, final String group, final int minConsumersInGroup) { String consumerUuid = generateConsumerId(); LOG.info(format("create message stream by consumerid [%s] with groupid [%s]", consumerUuid, group)); <START> final String consumerIdString = group + "_" + consumerUuid; <END> ConsumerConnector connector = ConsumerConnector.getInstance(); connector.registerConsumer(consumerIdString, topic, minConsumersInGroup); return consumerIdString; }</code><technical_language>separate field instead of compounded string a good idea</technical_language>

Target:
public static String createConsumer (final String topic, final String group, final int minConsumersInGroup) { String consumerUuid = generateConsumerId(); LOG.info("create message stream by consumerid " + consumerUuid + " with groupid " + group); final String consumerIdString = group + "_" + consumerUuid; ConsumerConnector connector = ConsumerConnector.getInstance(); connector.registerConsumer(consumerIdString, topic, minConsumersInGroup); return consumerIdString; }
Source:
<code>public StartIdentifiedAtlasDbTransactionResponse startIdentifiedAtlasDbTransaction( StartIdentifiedAtlasDbTransactionRequest request) { return timelockService(defaultClient, request.requestorId()) .startIdentifiedAtlasDbTransaction(ImmutableIdentifiedTimeLockRequest.of(request.requestId())); <START> } <END></code><technical_language>If this class expose RPC client, implementation a simpler: private TimelockRpcClient rpcClient(String client) { return proxies.failoverForClient(client, TimelockRpcClient.class); } public StartIdentifiedAtlasDbTransactionResponse startIdentifiedAtlasDbTransaction( StartIdentifiedAtlasDbTransactionRequest request) { return rpcClient(defaultClient).startIdentifiedAtlasDbTransaction(request); } (and need timelockService(String, UUID) method DefaultTimelockService factory takes a UUID)</technical_language>

Target:
public StartIdentifiedAtlasDbTransactionResponse startIdentifiedAtlasDbTransaction( StartIdentifiedAtlasDbTransactionRequest request) { return rpcClient(defaultClient).startIdentifiedAtlasDbTransaction(request); }
Source:
<code>void shutdown() throws InterruptedException, StoreException, IOException { if (running.get()) { running.set(false); boolean isPaused = isPaused(); <START> if (isPaused) { <END> reentrantLock.lock(); paused.set(false); pauseCondition.signal(); reentrantLock.unlock(); } else { synchronized (reentrantLock) { reentrantLock.notify(); } } throttler.close(); shutdownLatch.await(); if (isPaused) { paused.set(true); } pruneHardDeleteRecoveryRange(); persistCleanupToken(); } }</code><technical_language>isPaused.compareAndSet(true, false)</technical_language>

Target:
void shutdown() throws InterruptedException, StoreException, IOException { if (enabled.get()) { enabled.set(false); hardDeleteLock.lock(); try { pauseCondition.signal(); } finally { hardDeleteLock.unlock(); } throttler.close(); shutdownLatch.await(); pruneHardDeleteRecoveryRange(); persistCleanupToken(); } }
Source:
<code>public void startup() throws Exception { super.startup(); client.startup(); JsonObject properties = readTrackingFile(); if (properties != null && <START> properties.getString(NATSClient.SERVER_HOST_PROPERTY) == client.getServerHost() && <END> properties.getString(NATSClient.SERVER_PORT_PROPERTY) == client.getServerPort() && properties.getString(NATSClient.CLUSTER_ID_PROPERTY) == client.getClusterId() && properties.getString(NATSClient.CLIENT_ID_PROPERTY) == client.getClientId() && properties.getString(NATSClient.SUBJECT_PROPERTY) == client.getSubject()) { sequence = Long.parseLong(properties.getString(SEQUENCE_PROPERTY)); } subscription = client.getConnection().subscribe( client.getSubject(), this, new SubscriptionOptions.Builder().startAtSequence(sequence).build()); }</code><technical_language>== needs str1.equals(str2)</technical_language>

Target:
public void startup() throws Exception { super.startup(); client.startup(); JsonObject properties = readTrackingFile(); if (properties != null && properties.getString(NATSClient.SERVER_HOST_PROPERTY).equals(client.getServerHost()) && properties.getString(NATSClient.SERVER_PORT_PROPERTY).equals(client.getServerPort()) && properties.getString(NATSClient.CLUSTER_ID_PROPERTY).equals(client.getClusterId()) && properties.getString(NATSClient.CLIENT_ID_PROPERTY).equals(client.getClientId()) && properties.getString(NATSClient.SUBJECT_PROPERTY).equals(subject)) { sequence = Long.parseLong(properties.get(SEQUENCE_PROPERTY).toString()); } subscription = client.getConnection().subscribe( subject, this, new SubscriptionOptions.Builder().startAtSequence(sequence).build()); }
Source:
<code><START> public static Optional<WifiInfo> createWifiInfofromDynamoDBItem(final Map<String, AttributeValue> item, final String senseId) { <END> if (item == null) { LOGGER.warn("Sense does not have wifi info", senseId); return Optional.absent(); } final Set<String> requiredAttributes = Sets.newHashSet(SSID_ATTRIBUTE_NAME, RSSI_ATTRIBUTE_NAME); final Set<String> itemAttributes = item.keySet(); if (!itemAttributes.containsAll(requiredAttributes)) { return Optional.absent(); } final Long lastUpdated = item.containsKey(LAST_UPDATED_ATTRIBUTE_NAME) ? Long.valueOf(item.get(LAST_UPDATED_ATTRIBUTE_NAME).getN()) : 0L; return Optional.of(WifiInfo.create( item.get(SENSE_ATTRIBUTE_NAME).getS(), item.get(SSID_ATTRIBUTE_NAME).getS(), Integer.valueOf(item.get(RSSI_ATTRIBUTE_NAME).getN()), lastUpdated) ); }</code><technical_language>mind writing a short test for this method</technical_language>

Target:
public static Optional<WifiInfo> createWifiInfofromDynamoDBItem(final Map<String, AttributeValue> item, final String senseId) { if (item == null) { LOGGER.warn("Sense does not have wifi info", senseId); return Optional.absent(); } final Set<String> requiredAttributes = Sets.newHashSet(SSID_ATTRIBUTE_NAME, RSSI_ATTRIBUTE_NAME); final Set<String> itemAttributes = item.keySet(); if (!itemAttributes.containsAll(requiredAttributes)) { return Optional.absent(); } final DateTime lastUpdated = item.containsKey(LAST_UPDATED_ATTRIBUTE_NAME) ? DateTime.parse(item.get(LAST_UPDATED_ATTRIBUTE_NAME).getS(), DateTimeFormat.forPattern(DateTimeUtil.DYNAMO_DB_DATETIME_FORMAT)) : DateTime.now(DateTimeZone.UTC); return Optional.of(WifiInfo.create( item.get(SENSE_ATTRIBUTE_NAME).getS(), item.get(SSID_ATTRIBUTE_NAME).getS(), Integer.valueOf(item.get(RSSI_ATTRIBUTE_NAME).getN()), lastUpdated) ); }
Source:
<code>public QueryBuilder fromBranch(long branchUuid) throws OseeCoreException { <START> return fromBranch(TokenFactory.createBranch(branchUuid, <END> String.format("uuid:[%s] name:[N/A] - %s:%s", branchUuid, getClass().getSimpleName(), "fromBranch"))); }</code><technical_language>put "fromBranch" string in main format string</technical_language>

Target:
public QueryBuilder fromBranch(long branchUuid) throws OseeCoreException { String name = String.format("uuid:[%s] name:[N/A] - %s.fromBranch(long)", branchUuid, getClass().getSimpleName()); IOseeBranch branch = TokenFactory.createBranch(branchUuid, name); return fromBranch(branch); }
Source:
<code>public void onExit() { uncommittedOffsets = offsets.entrySet().stream() .filter(e -> !e.getValue().isCommitted()) .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getSentOffset())); if (null != topologyChangeSubscription) { try { topologyChangeSubscription.cancel(); } catch (final RuntimeException ex) { getLog().warn("Failed to cancel topology subscription", ex); } finally { topologyChangeSubscription = null; new HashSet<>(offsets.keySet()).forEach(this::removeFromStreaming); } } if (null != kafkaConsumer) { try { kafkaConsumer.close(); } finally { kafkaConsumer = null; } } <START> getLog().debug("Unregister cursor reset listener"); <END> if (cursorResetSubscription != null) { cursorResetSubscription.cancel(); cursorResetSubscription = null; } }</code><technical_language>I is log this line (and if is log, do if)</technical_language>

Target:
public void onExit() { uncommittedOffsets = offsets.entrySet().stream() .filter(e -> !e.getValue().isCommitted()) .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getSentOffset())); if (null != topologyChangeSubscription) { try { topologyChangeSubscription.cancel(); } catch (final RuntimeException ex) { getLog().warn("Failed to cancel topology subscription", ex); } finally { topologyChangeSubscription = null; new HashSet<>(offsets.keySet()).forEach(this::removeFromStreaming); } } if (null != kafkaConsumer) { try { kafkaConsumer.close(); } finally { kafkaConsumer = null; } } if (cursorResetSubscription != null) { cursorResetSubscription.cancel(); cursorResetSubscription = null; } }
Source:
<code>private static FacesMessage msgForSelectDelete(String ofType) { <START> return HelperUtil.getMsgWarn(MessageFormat.format("Select a {0} for delete.", ofType.toLowerCase())); <END> }</code><technical_language>I decide put "a" "an" in constant removed for message-text</technical_language>

Target:
private static FacesMessage msgForSelectDelete(String ofType) { return HelperUtil.getMsgWarn(MessageFormat.format("Select {0} for delete.", ofType.toLowerCase())); }
Source:
<code>private void remove( final Collection<Unit> killedUnits, final IDelegateBridge bridge, final Territory battleSite) { if (killedUnits.isEmpty()) { return; } final Collection<Unit> killed = getUnitsWithDependents(killedUnits); <START> final KillUnits killUnits = new KillUnits(battleSite, killed); <END> killUnits.perform(bridge); final Collection<IBattle> dependentBattles = battleTracker.getBlocked(AirBattle.this); removeFromDependents(killed, bridge, dependentBattles, false); }</code><technical_language>nit, unnecessary intermediate variable. a single line new KillUnits(battleSite, killed).perform(bridge); Side-note: I reveal a code smell bridge in control of change happens. EG: bridge.addChange(new KillUnits(battleSite, killed);</technical_language>

Target:
private void remove( final Collection<Unit> killedUnits, final IDelegateBridge bridge, final Territory battleSite) { if (killedUnits.isEmpty()) { return; } final Collection<Unit> killed = getUnitsWithDependents(killedUnits); final RemoveUnitsHistoryChange removeUnitsHistoryChange = HistoryChangeFactory.removeUnitsFromTerritory(battleSite, killed); removeUnitsHistoryChange.perform(bridge); final Collection<IBattle> dependentBattles = battleTracker.getBlocked(AirBattle.this); removeFromDependents(killed, bridge, dependentBattles, false); }
Source:
<code><START> public static String getLastKnownCczLocation() { <END> return CommCareApplication.instance().getCurrentApp().getAppPreferences() .getString(LAST_KNOWN_CCZ_LOCATION, null); }</code><technical_language>Aha, this is clever</technical_language>

Target:
public static String getLastKnownCczLocation() { return PreferenceManager.getDefaultSharedPreferences(CommCareApplication.instance()) .getString(LAST_KNOWN_CCZ_LOCATION, null); }
Source:
<code>public SQLDatabaseQueue(final File file, KeyProvider provider) throws IOException, SQLException { queue = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { <START> return new Thread(r, "SQLDatabaseQueue - "+ file); <END> } }); this.db = SQLDatabaseFactory.openOrCreateSQLDatabase(file, provider); queue.submit(new Runnable() { @Override public void run() { db.open(); } }); }</code><technical_language>do want full path printed for thread name here</technical_language>

Target:
public SQLDatabaseQueue(final File file, KeyProvider provider) throws IOException, SQLException { queue = Executors.newSingleThreadExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r, "SQLDatabaseQueue - "+ file); } }); this.db = SQLDatabaseFactory.openSQLDatabase(file, provider); queue.submit(new Runnable() { @Override public void run() { db.open(); } }); }
Source:
<code>public void addListener(Runnable listener, Executor executor) { <START> if (!isDone() && hasListeners.compareAndSet(false, true)) { <END> refreshListeners.put(this, true); } super.addListener(listener, executor); }</code><technical_language>longer of hasListeners in cancel, I necessary this AtomicBoolean all. Calling refreshListeners.put(this, true) is a no-op call. (Still need !isDone() check.)</technical_language>

Target:
public void addListener(Runnable listener, Executor executor) { if (!isDone()) { notDoneNrtFutures.add(this); } super.addListener(listener, executor); }
Source:
<code>public Link assertHasLinkWithRel(String rel, MockHttpServletResponse response) throws Exception { String content = response.getContentAsString(); Link link = getDiscoverer(response).findLinkWithRel(rel, content); <START> assertThat("Expected to find link with rel " + rel + " but found none in " + content + "!", link, <END> is(notNullValue())); return link; }</code><technical_language>Please, AssertJ</technical_language>

Target:
public Link assertHasLinkWithRel(String rel, MockHttpServletResponse response) throws Exception { String content = response.getContentAsString(); Link link = getDiscoverer(response).findLinkWithRel(rel, content); assertThat(link) .describedAs("Expected to find link with rel " + rel + " but found none in " + content + "!") .isNotNull(); return link; }
Source:
<code>public void uniqueValues(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String workspace = request.getParameter("workspace"); String layer = request.getParameter("layer"); String propertyName = request.getParameter("propertyName"); <START> if(workspace==null) { <END> workspace = splitLayerName(layer)[0]; layer = splitLayerName(layer)[1]; } if (! uniqueValuesAllowed(workspace, layer, propertyName)) { throw new RuntimeException(String.format("uniqueValues not allowed for '%s:%s/%s'", workspace, layer, propertyName)); } try { respondWithDocument(response, getUniqueValuesDocument(workspace, layer, propertyName)); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>Is worth a slight change avoid running split method twice? e.g. java if(workspace==null) { String[] splitLayerArray = splitLayerName(layer) workspace = splitLayerArray[0]; layer = splitLayerArray[1]; }</technical_language>

Target:
public void uniqueValues(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String workspace = request.getParameter("workspace"); String layer = request.getParameter("layer"); String propertyName = request.getParameter("propertyName"); if(workspace==null) { String[] splitLayerArray = splitLayerName(layer); workspace = splitLayerArray[0]; layer = splitLayerArray[1]; } if (! uniqueValuesAllowed(workspace, layer, propertyName)) { throw new RuntimeException(String.format("uniqueValues not allowed for '%s:%s/%s'", workspace, layer, propertyName)); } try { respondWithDocument(response, getUniqueValuesDocument(workspace, layer, propertyName)); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public static void rateApp(Context context) { <START> final String appPackageName = BuildConfig.class.getPackage().getName(); <END> try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Urls.PLAY_STORE_PREFIX + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { handleWebUrl(context, Uri.parse(Urls.PLAY_STORE_URL_PREFIX + appPackageName)); } }</code><technical_language>oh, this changed, is a bad example led astray. context.getPackageName()</technical_language>

Target:
public static void rateApp(Context context) { final String appPackageName = context.getPackageName(); try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Urls.PLAY_STORE_PREFIX + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { handleWebUrl(context, Uri.parse(Urls.PLAY_STORE_URL_PREFIX + appPackageName)); } }
Source:
<code>public Iterator<Bucket> iterator() { final int bucketCount = getBucketCount(); final double min = getMin(); final double max = getMax(); return new Iterator<Bucket>() { private int currentIndex; @Override public boolean hasNext() { return currentIndex < bucketCount; } @Override public Bucket next() { if (!hasNext()) { throw new NoSuchElementException(); } final Bucket value = new Bucket( getLeftValueForIndex(bucketCount, min, max, currentIndex), getRightValueForIndex(bucketCount, min, max, currentIndex), weights[currentIndex]); <START> ++currentIndex; <END> return value; } @Override public void remove() { throw new UnsupportedOperationException(); } }; }</code><technical_language>currentIndex++;</technical_language>

Target:
public Iterator<Bucket> iterator() { int bucketCount = getBucketCount(); double min = getMin(); double max = getMax(); return new Iterator<Bucket>() { private int currentIndex; @Override public boolean hasNext() { return currentIndex < bucketCount; } @Override public Bucket next() { if (!hasNext()) { throw new NoSuchElementException(); } Bucket value = new Bucket( getLeftValueForIndex(bucketCount, min, max, currentIndex), getRightValueForIndex(bucketCount, min, max, currentIndex), weights[currentIndex]); currentIndex++; return value; } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
Source:
<code>public boolean shouldUseBitmapIndex(BitmapIndexSelector selector) { <START> return Filters.shouldUseBitmapIndex(this, selector, filterTuning); <END> }</code><technical_language>confusing this method return false while supportsBitmapIndex() does</technical_language>

Target:
public boolean shouldUseBitmapIndex(BitmapIndexSelector selector) { return false; }
Source:
<code>private boolean maybeWriteResponseMetadata(HttpResponse responseMetadata, GenericFutureListener<ChannelFuture> listener) { long writeProcessingStartTime = System.currentTimeMillis(); boolean writtenThisTime = false; if (responseMetadataWriteInitiated.compareAndSet(false, true) && ctx.channel().isActive()) { if (!HttpUtil.isContentLengthSet(responseMetadata) && (responseMetadata.status().equals(HttpResponseStatus.OK) || responseMetadata.status().equals(HttpResponseStatus.PARTIAL_CONTENT))) { HttpUtil.setTransferEncodingChunked(responseMetadata, true); } else if (HttpUtil.isContentLengthSet(responseMetadata) && HttpUtil.getContentLength(responseMetadata) == 0 && !(responseMetadata instanceof FullHttpResponse)) { FullHttpResponse fullHttpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, responseMetadata.status()); fullHttpResponse.headers().set(responseMetadata.headers()); responseMetadata = fullHttpResponse; } <START> logger.info("Sending response with status on channel {}", responseMetadata.status(), ctx.channel()); <END> finalResponseMetadata = responseMetadata; ChannelPromise writePromise = ctx.newPromise().addListener(listener); ctx.writeAndFlush(responseMetadata, writePromise); writtenThisTime = true; long writeProcessingTime = System.currentTimeMillis() - writeProcessingStartTime; nettyMetrics.responseMetadataProcessingTimeInMs.update(writeProcessingTime); if (request != null) { request.getMetricsTracker().nioMetricsTracker.markFirstByteSent(); } } return writtenThisTime; }</code><technical_language>This a bad idea, for testing</technical_language>

Target:
private boolean maybeWriteResponseMetadata(HttpResponse responseMetadata, GenericFutureListener<ChannelFuture> listener) { long writeProcessingStartTime = System.currentTimeMillis(); boolean writtenThisTime = false; if (responseMetadataWriteInitiated.compareAndSet(false, true) && ctx.channel().isActive()) { if (!HttpUtil.isContentLengthSet(responseMetadata) && (responseMetadata.status().equals(HttpResponseStatus.OK) || responseMetadata.status().equals(HttpResponseStatus.PARTIAL_CONTENT))) { HttpUtil.setTransferEncodingChunked(responseMetadata, true); } else if (HttpUtil.isContentLengthSet(responseMetadata) && HttpUtil.getContentLength(responseMetadata) == 0 && !(responseMetadata instanceof FullHttpResponse)) { FullHttpResponse fullHttpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, responseMetadata.status()); fullHttpResponse.headers().set(responseMetadata.headers()); responseMetadata = fullHttpResponse; } logger.trace("Sending response with status on channel {}", responseMetadata.status(), ctx.channel()); finalResponseMetadata = responseMetadata; ChannelPromise writePromise = ctx.newPromise().addListener(listener); ctx.writeAndFlush(responseMetadata, writePromise); writtenThisTime = true; long writeProcessingTime = System.currentTimeMillis() - writeProcessingStartTime; nettyMetrics.responseMetadataProcessingTimeInMs.update(writeProcessingTime); if (request != null) { request.getMetricsTracker().nioMetricsTracker.markFirstByteSent(); } } return writtenThisTime; }
Source:
<code>public void testScaleDownInvalidScaleFactor() throws Exception { topologyConfig.setComponentRam(BOLT_NAME, instanceDefaultResources.getRam()); topologyConfig.setComponentRam(SPOUT_NAME, instanceDefaultResources.getRam()); PackingPlan packingPlan = getFirstFitDecreasingPackingPlan(topology); Assert.assertEquals(packingPlan.getContainers().size(), 2); Assert.assertEquals(totalInstances, packingPlan.getInstanceCount()); AssertPacking.assertNumInstances(packingPlan.getContainers(), BOLT_NAME, 3); <START> AssertPacking.assertNumInstances(packingPlan.getContainers(), SPOUT_NAME, 4); <END> int spoutScalingDown = -5; Map<String, Integer> componentChanges = new HashMap<>(); componentChanges.put(SPOUT_NAME, spoutScalingDown); getFirstFitDecreasingPackingPlanRepack(topology, packingPlan, componentChanges); }</code><technical_language>7 lines duplicated in 5 tests. pull out initScalingTests() method this, assertions returned plan: PackingPlan doScalingTest(Map<String, Integer> componentChanges) {}</technical_language>

Target:
public void testScaleDownInvalidScaleFactor() throws Exception { int spoutScalingDown = -5; Map<String, Integer> componentChanges = new HashMap<>(); componentChanges.put(SPOUT_NAME, spoutScalingDown); int numContainersBeforeRepack = 2; doDefaultScalingTest(componentChanges, numContainersBeforeRepack); }
Source:
<code>public void subscribeTo(final InternalChannel channel, final ChannelEventListener listener, final String... eventNames) { synchronized (channelNameToChannelMap){ <START> validateArgumentsAndBindEvents(channel, listener, eventNames); <END> channelNameToChannelMap.put(channel.getName(), channel); sendOrQueueSubscribeMessage(channel); } }</code><technical_language>Do need non-map accesses critical section? Some of locks..</technical_language>

Target:
public void subscribeTo(final InternalChannel channel, final ChannelEventListener listener, final String... eventNames) { validateArgumentsAndBindEvents(channel, listener, eventNames); channelNameToChannelMap.put(channel.getName(), channel); sendOrQueueSubscribeMessage(channel); }
Source:
<code>private static void setBondingOptions(VDS vds, List<VdsNetworkInterface> oldInterfaces) { oldInterfaces.stream(). filter(iface -> iface.getBondOptions() != null). forEach(iface -> vds.getInterfaces() .stream() <START> .filter(newIface -> iface.getName().equals(newIface.getName()) && newIface.getBondOptions() == null) <END> .findFirst() .ifPresent(newIface -> newIface.setBondOptions(iface.getBondOptions()))); }</code><technical_language>I Java 8 stream "way" is split filters: .filter(ifc -> ifc.getName()equals(...)) .filter(ifc -> ifc.getBondOption() == null)</technical_language>

Target:
private static void setBondingOptions(VDS vds, List<VdsNetworkInterface> oldInterfaces) { oldInterfaces.stream(). filter(iface -> iface.getBondOptions() != null). forEach(iface -> vds.getInterfaces() .stream() .filter(newIface -> iface.getName().equals(newIface.getName())) .filter(newIface -> newIface.getBondOptions() == null) .findFirst() .ifPresent(newIface -> newIface.setBondOptions(iface.getBondOptions()))); }
Source:
<code>public boolean onPreferenceChange(Preference preference, Object objValue) { if (preference == mButtonPreferredNetworkMode) { mButtonPreferredNetworkMode.setValue((String) objValue); int buttonNetworkMode; buttonNetworkMode = Integer.valueOf((String) objValue).intValue(); int settingsNetworkMode = android.provider.Settings.System.getInt( mPhone.getContext().getContentResolver(), android.provider.Settings.System.PREFERRED_NETWORK_MODE, preferredNetworkMode); if (buttonNetworkMode != settingsNetworkMode) { int modemNetworkMode; switch(buttonNetworkMode) { <START> case RILConstants.NETWORK_MODE_GSM_UMTS: <END> modemNetworkMode = RILConstants.NETWORK_MODE_GSM_UMTS; break; case RILConstants.NETWORK_MODE_CDMA: modemNetworkMode = RILConstants.NETWORK_MODE_CDMA; break; case RILConstants.NETWORK_MODE_GLOBAL: modemNetworkMode = RILConstants.NETWORK_MODE_GLOBAL; break; default: modemNetworkMode = RILConstants.PREFERRED_NETWORK_MODE; } UpdatePreferredNetworkModeSummary(buttonNetworkMode); android.provider.Settings.System.putInt(mPhone.getContext().getContentResolver(), android.provider.Settings.System.PREFERRED_NETWORK_MODE, buttonNetworkMode ); mPhone.setPreferredNetworkType(modemNetworkMode, mHandler .obtainMessage(MyHandler.MESSAGE_SET_PREFERRED_NETWORK_TYPE)); } } return true; }</code><technical_language>constants in TelephonyManager.java instead of RIL Constants ? want concept of RIL Phone app distinct</technical_language>

Target:
public boolean onPreferenceChange(Preference preference, Object objValue) { if (preference == mButtonPreferredNetworkMode) { mButtonPreferredNetworkMode.setValue((String) objValue); int buttonNetworkMode; buttonNetworkMode = Integer.valueOf((String) objValue).intValue(); int settingsNetworkMode = android.provider.Settings.System.getInt( mPhone.getContext().getContentResolver(), android.provider.Settings.System.PREFERRED_NETWORK_MODE, preferredNetworkMode); if (buttonNetworkMode != settingsNetworkMode) { int modemNetworkMode; switch(buttonNetworkMode) { case Phone.NT_MODE_GSM_UMTS: modemNetworkMode = Phone.NT_MODE_GSM_UMTS; break; case Phone.NT_MODE_CDMA: modemNetworkMode = Phone.NT_MODE_CDMA; break; case Phone.NT_MODE_GLOBAL: modemNetworkMode = Phone.NT_MODE_GLOBAL; break; default: modemNetworkMode = Phone.PREFERRED_NT_MODE; } UpdatePreferredNetworkModeSummary(buttonNetworkMode); android.provider.Settings.System.putInt(mPhone.getContext().getContentResolver(), android.provider.Settings.System.PREFERRED_NETWORK_MODE, buttonNetworkMode ); mPhone.setPreferredNetworkType(modemNetworkMode, mHandler .obtainMessage(MyHandler.MESSAGE_SET_PREFERRED_NETWORK_TYPE)); } } return true; }
Source:
<code>private String createJsonStringEntity(Object data) { String entity; if (data instanceof String && isJson(data.toString())) { entity = data.toString(); } else { entity = gson.toJson(data); } JsonElement el = new JsonParser().parse(entity); <START> log.debug("request body to json - " + System.getProperty("line.separator") + new GsonBuilder().setPrettyPrinting().create().toJson(el)); <END> return entity; }</code><technical_language>create a new Gson instance set class instead (getGson()). print entity; _pretty printed_ is actual entity a json parse for time is kinda wasteful</technical_language>

Target:
protected String createJsonStringEntity(Object data) { String entity; if (data instanceof String && isJson(data.toString())) { entity = data.toString(); } else { entity = gson.toJson(data); } log.debug("request body - "+ entity); return entity; }
Source:
<code>public TestRunner addInputStream(CollectionStream stream) { Preconditions.checkNotNull(stream); Preconditions.checkNotNull(stream.getCollectionStreamSystem()); CollectionStreamSystem system = stream.getCollectionStreamSystem(); registerSystem(system); system.addInput(stream.getStreamName(), stream.getInitPartitions()); if (configs.containsKey(TaskConfig.INPUT_STREAMS())) { <START> configs.put(TaskConfig.INPUT_STREAMS(), <END> configs.get(TaskConfig.INPUT_STREAMS()).concat("," + system.getSystemName() + "." + stream.getStreamName())); } else { configs.put(TaskConfig.INPUT_STREAMS(), system.getSystemName() + "." + stream.getStreamName()); } stream.getStreamConfig().forEach((key, val) -> { configs.putIfAbsent((String) key, (String) val); }); return this; }</code><technical_language>do need check existing task.inputs system.stream appending</technical_language>

Target:
public TestRunner addInputStream(CollectionStream stream) { Preconditions.checkNotNull(stream); registerSystem(stream.getSystemName()); initializeInput(stream); stream.setTestId(testId); if (configs.containsKey(TaskConfig.INPUT_STREAMS())) { configs.put(TaskConfig.INPUT_STREAMS(), configs.get(TaskConfig.INPUT_STREAMS()).concat("," + stream.getSystemName() + "." + stream.getPhysicalName())); } else { configs.put(TaskConfig.INPUT_STREAMS(), stream.getSystemName() + "." + stream.getPhysicalName()); } stream.getStreamConfig().forEach((key, val) -> { configs.putIfAbsent((String) key, (String) val); }); return this; }
Source:
<code>public EAccessLevel getEAccessLevel(String xwikiRight) { <START> return EAccessLevel.getAccessLevel(xwikiRight).get(); <END> }</code><technical_language>This a NPE, instead resolve Optionals checking present()</technical_language>

Target:
public EAccessLevel getEAccessLevel(String xwikiRight) { return EAccessLevel.getAccessLevel(xwikiRight).orNull(); }
Source:
<code>private void assertStudentRowDisplayed(StudentAttributes student, InstructorAttributes instructorToMasquaradeAs, CourseAttributes course) { By by = By.xpath(" <START> WebElement studentRow = browser.driver.findElement(by); <END> assertStudentContentCorrect(studentRow, student, course); assertTrue(isStudentLinkCorrect(studentRow, student, instructorToMasquaradeAs)); }</code><technical_language>Is push this kind of code relevant *Page class itself? i.e. *Page object provide methods query contents. a separate PR though</technical_language>

Target:
private void assertStudentRowDisplayed(StudentAttributes student, InstructorAttributes instructorToMasquaradeAs, CourseAttributes course) { WebElement studentRow = searchPage.getStudentRow(student); assertStudentContentCorrect(studentRow, student, course); assertTrue(isStudentLinkCorrect(studentRow, student, instructorToMasquaradeAs)); }
Source:
<code>public static double volatility(double forward, double strike, double timeToExpiry, double volatilityAtm, double rho, double eta) { ArgumentChecker.isTrue(strike > 0, "strike must be strctly positive"); ArgumentChecker.isTrue(forward > 0, "strike must be strctly positive"); ArgumentChecker.isTrue(timeToExpiry > 0, "time to expiration must be strctly positive"); double theta = volatilityAtm * volatilityAtm * timeToExpiry; <START> double phi = eta * Math.sqrt(theta); <END> double k = Math.log(strike / forward); double w = 0.5 * theta * (1.0d + rho * phi * k + Math.sqrt(1.0d + 2 * rho * phi * k + phi * k * phi * k)); return Math.sqrt(w / timeToExpiry); }</code><technical_language>Review formula for phi</technical_language>

Target:
public static double volatility(double forward, double strike, double timeToExpiry, double volatilityAtm, double rho, double eta) { ArgumentChecker.isTrue(strike > 0, "strike must be strctly positive"); ArgumentChecker.isTrue(forward > 0, "strike must be strctly positive"); ArgumentChecker.isTrue(timeToExpiry > 0, "time to expiration must be strctly positive"); double theta = volatilityAtm * volatilityAtm * timeToExpiry; double phi = eta / Math.sqrt(theta); double k = Math.log(strike / forward); double w = 0.5 * theta * (1.0d + rho * phi * k + Math.sqrt(1.0d + 2 * rho * phi * k + phi * k * phi * k)); return Math.sqrt(w / timeToExpiry); }
Source:
<code>public Object deepCopy(Object val) throws HibernateException { if (val == null) return null; if (val instanceof byte[]) { return new Guid((byte[]) val, true); } if (val instanceof UUID) return new Guid((UUID) val); if (val instanceof Guid) return new Guid(((Guid) val).getUuid()); <START> throw new UnsupportedOperationException("Can't convert " + val.getClass() + " to GUID"); <END> }</code><technical_language>this HibernateException</technical_language>

Target:
public Object deepCopy(Object val) throws HibernateException { if (val == null) return null; if (val instanceof byte[]) { return new Guid((byte[]) val, true); } if (val instanceof UUID) return new Guid((UUID) val); if (val instanceof Guid) return new Guid(((Guid) val).getUuid()); throw new HibernateException("Can't convert " + val.getClass() + " to GUID"); }
Source:
<code>public void constructMergeTree( ArrayList<Stream> streamsToAddToDag, ArrayList<NamedMerger> operatorsToAdd) { if (streamsToMerge.size() < 2) { throw new IllegalArgumentException("Not enough streams to merge. Ensure `.merge` was called for each stream " + "to be added."); } <START> Queue<SourcedOutputPort> unconnectedPorts = new ArrayQueue<>(); <END> for (DefaultOutputPort<K> streamToAdd : streamsToMerge) { unconnectedPorts.add(new SourcedOutputPort(true, streamToAdd)); } long mergerCount = 0; while (!unconnectedPorts.isEmpty()) { if (unconnectedPorts.size() >= 2) { StreamMerger<K> merger = new StreamMerger<>(); SourcedOutputPort firstPort = unconnectedPorts.poll(); SourcedOutputPort secondPort = unconnectedPorts.poll(); streamsToAddToDag.add(new Stream("Merger_" + mergerCount + "_P1", firstPort, merger.data1)); streamsToAddToDag.add(new Stream("Merger_" + mergerCount + "_P2", secondPort, merger.data2)); operatorsToAdd.add(new NamedMerger("Merger_" + mergerCount++, merger)); unconnectedPorts.add(new SourcedOutputPort(merger.out)); } else { streamOutput = (operatorsToAdd.get(operatorsToAdd.size() - 1).merger.out); break; } } }</code><technical_language>this implementation of queue</technical_language>

Target:
public void constructMergeTree( ArrayList<Stream> streamsToAddToDag, ArrayList<NamedMerger> operatorsToAdd) { if (streamsToMerge.size() < 2) { throw new IllegalArgumentException("Not enough streams to merge. Ensure `.merge` was called for each stream " + "to be added."); } Queue<SourcedOutputPort> unconnectedPorts = new LinkedList<>(); for (DefaultOutputPort<K> streamToAdd : streamsToMerge) { unconnectedPorts.add(new SourcedOutputPort(true, streamToAdd)); } long mergerCount = 0; while (!unconnectedPorts.isEmpty()) { if (unconnectedPorts.size() >= 2) { StreamMerger<K> merger = new StreamMerger<>(); SourcedOutputPort firstPort = unconnectedPorts.poll(); SourcedOutputPort secondPort = unconnectedPorts.poll(); streamsToAddToDag.add(new Stream("Merger_" + mergerCount + "_P1", firstPort, merger.data1)); streamsToAddToDag.add(new Stream("Merger_" + mergerCount + "_P2", secondPort, merger.data2)); operatorsToAdd.add(new NamedMerger("Merger_" + mergerCount++, merger)); unconnectedPorts.add(new SourcedOutputPort(merger.out)); } else { streamOutput = (operatorsToAdd.get(operatorsToAdd.size() - 1).merger.out); break; } } }
Source:
<code>Mono<Response<String>> copyFromURLWithResponse(String copySource, Map<String, String> metadata, AccessTier tier, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Context context) { sourceModifiedAccessConditions = sourceModifiedAccessConditions == null ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; destAccessConditions = destAccessConditions == null ? new BlobAccessConditions() : destAccessConditions; SourceModifiedAccessConditions sourceConditions = new SourceModifiedAccessConditions() .setSourceIfModifiedSince(sourceModifiedAccessConditions.getIfModifiedSince()) .setSourceIfUnmodifiedSince(sourceModifiedAccessConditions.getIfUnmodifiedSince()) .setSourceIfMatch(sourceModifiedAccessConditions.getIfMatch()) .setSourceIfNoneMatch(sourceModifiedAccessConditions.getIfNoneMatch()); URL url; try { url = new URL(copySource); } catch (MalformedURLException ex) { <START> throw logger.logExceptionAsError(new IllegalArgumentException(ex)); <END> } return this.azureBlobStorage.blobs().copyFromURLWithRestResponseAsync( null, null, url, null, metadata, tier, null, sourceConditions, destAccessConditions.getModifiedAccessConditions(), destAccessConditions.getLeaseAccessConditions(), context).map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getCopyId())); }</code><technical_language>add a message malformed url exception. ("'copysource' is a valid url.", ex)</technical_language>

Target:
Mono<Response<String>> copyFromURLWithResponse(String copySource, Map<String, String> metadata, AccessTier tier, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Context context) { sourceModifiedAccessConditions = sourceModifiedAccessConditions == null ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; destAccessConditions = destAccessConditions == null ? new BlobAccessConditions() : destAccessConditions; SourceModifiedAccessConditions sourceConditions = new SourceModifiedAccessConditions() .setSourceIfModifiedSince(sourceModifiedAccessConditions.getIfModifiedSince()) .setSourceIfUnmodifiedSince(sourceModifiedAccessConditions.getIfUnmodifiedSince()) .setSourceIfMatch(sourceModifiedAccessConditions.getIfMatch()) .setSourceIfNoneMatch(sourceModifiedAccessConditions.getIfNoneMatch()); URL url; try { url = new URL(copySource); } catch (MalformedURLException ex) { throw logger.logExceptionAsError(new IllegalArgumentException("'copySource' is not a valid url.")); } return this.azureBlobStorage.blobs().copyFromURLWithRestResponseAsync( null, null, url, null, metadata, tier, null, sourceConditions, destAccessConditions.getModifiedAccessConditions(), destAccessConditions.getLeaseAccessConditions(), context).map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getCopyId())); }
Source:
<code>public Firmware(final DeviceModel deviceModel, final int firmwareVersion, final String description) { <START> super(); <END> this.deviceModel = deviceModel; this.firmwareVersion = firmwareVersion; this.description = description; }</code><technical_language>call super() is unnecessary</technical_language>

Target:
public Firmware(final DeviceModel deviceModel, final int firmwareVersion, final String description) { this.deviceModel = deviceModel; this.firmwareVersion = firmwareVersion; this.description = description; }
Source:
<code>private int findPointer (UITouch touch) { long ptr = touch.getHandle(); for (int i = 0; i < touchDown.length; i++) { if (touchDown[i] == ptr) return i; } <START> StringBuffer buf = new StringBuffer(); <END> for (int i = 0; i < touchDown.length; i++) { buf.append(i + ":" + touchDown[i] + " "); } Gdx.app.error("IOSInput", "Pointer ID lookup failed: " + ptr + ", " + buf.toString()); return POINTER_NOT_FOUND; }</code><technical_language>This a StringBuilder</technical_language>

Target:
private int findPointer (UITouch touch) { long ptr = touch.getHandle(); for (int i = 0; i < touchDown.length; i++) { if (touchDown[i] == ptr) return i; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < touchDown.length; i++) { sb.append(i + ":" + touchDown[i] + " "); } Gdx.app.error("IOSInput", "Pointer ID lookup failed: " + ptr + ", " + sb.toString()); return POINTER_NOT_FOUND; }
Source:
<code>private static void printStartupMsg(ServerConfiguration conf) { printLogo(); println("Welcome to CORFU SERVER"); println("Version (" + GitRepositoryState.getRepositoryState().commitIdAbbrev + ")"); <START> println("Serving on port " + conf.getHostAddress()); <END> println("Data location: " + (conf.getInMemoryMode() ? "MEMORY mode" : conf.getServerDir())); }</code><technical_language>conf.getServerPort()</technical_language>

Target:
private static void printStartupMsg(ServerConfiguration conf) { printLogo(); println("Welcome to CORFU SERVER"); println("Version (" + GitRepositoryState.getRepositoryState().commitIdAbbrev + ")"); println("Serving on " + conf.getLocalServerEndpoint()); println("Data location: " + (conf.isInMemoryMode() ? "MEMORY mode" : conf.getServerDir())); }
Source:
<code>public static AudioFormat getBestMatch(Set<AudioFormat> inputs, Set<AudioFormat> outputs) { <START> AudioFormat preferredFormat = getPreferredFormat(inputs); <END> for (AudioFormat output : outputs) { if (output.isCompatible(preferredFormat)) { return preferredFormat; } else { for (AudioFormat input : inputs) { if (output.isCompatible(input)) { return input; } } } } return null; }</code><technical_language>getPrefferedFormat return null. sense outputs (what is intention of output.isCompatible(null))</technical_language>

Target:
public static AudioFormat getBestMatch(Set<AudioFormat> inputs, Set<AudioFormat> outputs) { AudioFormat preferredFormat = getPreferredFormat(inputs); if (preferredFormat != null) { for (AudioFormat output : outputs) { if (output.isCompatible(preferredFormat)) { return preferredFormat; } else { for (AudioFormat input : inputs) { if (output.isCompatible(input)) { return input; } } } } } return null; }
Source:
<code>protected long generateActorId() { <START> long result = (threadId << 56) | nextActorId; <END> nextActorId++; return result; }</code><technical_language>put magic 56 a private static final field a explanatory name</technical_language>

Target:
protected long generateActorId() { long result = (threadId << THREAD_ID_SHIFT) | nextActorId; nextActorId++; return result; }
Source:
<code>private Set<Account.Id> getSubscribers() throws EmailException { watchers = new HashSet<Account.Id>(); Set<Account.Id> subscribers = new HashSet<Account.Id>(); try { for (AccountProjectWatch p : args.db.get().accountProjectWatches() .byProject(project.getNameKey())) { <START> watchers.add(p.getAccountId()); <END> switch (type) { case CREATE: case DELETE: String filter = p.getFilter(); if (filter.equals("*")) { subscribers.add(p.getAccountId()); } else if (branchMatchWithFilter(branchName, filter)) { subscribers.add(p.getAccountId()); } break; default: break; } } } catch (OrmException e) { log.error("Invalid watcher is set", e); } return subscribers; }</code><technical_language>distinction watchers subscribers? watchers, stick watchers call subscribers (I is watchers changes)</technical_language>

Target:
private Set<Account.Id> getSubscribers() throws EmailException { Set<Account.Id> subscribers = new HashSet<Account.Id>(); try { for (AccountProjectWatch p : args.db.get().accountProjectWatches() .byProject(project.getNameKey())) { switch (type) { case CREATE: case DELETE: String filter = p.getFilter(); if (branchMatchWithFilter(branchName, filter)) { subscribers.add(p.getAccountId()); } } } } catch (OrmException e) { log.error("Invalid watcher is set", e); } return subscribers; }