auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Analyzer(@Nonnull JMethod method) { this.cfg = method.getMarker(ControlFlowGraph.class); <START> this.definitions = getAllDefinitions(method, this.cfg); <END> this.initialized = (method.getThis() != null ? 1 : 0) + method.getParams().size(); }</code><technical_language>add "assert cfg != null" getMarker returns a @CheckForNull getAllDefinitions want a @Nonnull</technical_language>

Target:
private Analyzer(@Nonnull JMethod method) { ControlFlowGraph cfg = method.getMarker(ControlFlowGraph.class); assert cfg != null; this.cfg = cfg; this.definitions = getAllDefinitions(method, this.cfg); this.initialized = (method.getThis() != null ? 1 : 0) + method.getParams().size(); }
Source:
<code>private KeyManager[] getKeyManagers() { <START> if (this.keyStoreSource == null && this.trustStoreType != KeyStoreType.PKCS11) { <END> return null; } final KeyManagerFactory keyManagerFactory = createKeyManagerFactory(); KeyStore keyStore = createKeyStore(); char[] password = toCharArray(this.keyStorePassword); if (this.keyAlias != null) { password = this.keyPassword != null ? this.keyPassword.toCharArray() : password; keyStore = createRepacementKeyStore(keyStore, password); } try { keyManagerFactory.init(keyStore, password); } catch (GeneralSecurityException ex) { throw new IllegalArgumentException("Failed to init KeyManagerFactory for " + this.keyStoreSource, ex); } return keyManagerFactory.getKeyManagers(); }</code><technical_language>condition is here, refer trustStoreType</technical_language>

Target:
private KeyManager[] getKeyManagers() { if (this.keyStoreSource == null && this.keyStoreType != KeyStoreType.PKCS11) { return null; } else if (this.keyStoreSource != null && this.keyStoreType == KeyStoreType.PKCS11) { throw new IllegalArgumentException("The keystore type is PKCS#11, the keystore should not be set."); } final KeyManagerFactory keyManagerFactory = createKeyManagerFactory(); KeyStore keyStore = this.createKeyStore(); char[] password = toCharArray(this.keyPassword != null ? this.keyPassword : this.keyStorePassword); if (this.keyAlias != null) { keyStore = this.createRepacementKeyStore(keyStore, password); } try { keyManagerFactory.init(keyStore, password); } catch (GeneralSecurityException ex) { throw new IllegalArgumentException("Failed to init KeyManagerFactory for " + this.keyStoreSource, ex); } return keyManagerFactory.getKeyManagers(); }
Source:
<code>public void testReverseFunction() throws InterruptedException { Assert.assertNull(reverseFnCache.get(namespace.getNamespace())); NamespaceExtractionCacheManagersTest.waitFor(manager.schedule(namespace)); Function<String, List<String>> reverseFn = reverseFnCache.get(namespace.getNamespace()); while (reverseFn == null) { <START> Thread.sleep(1); <END> reverseFn = reverseFnCache.get(namespace.getNamespace()); } Assert.assertEquals(Sets.newHashSet("boo", "foo"), Sets.newHashSet(reverseFn.apply("bar"))); Assert.assertEquals(Sets.newHashSet(""), Sets.newHashSet(reverseFn.apply("MissingValue"))); Assert.assertEquals(Sets.newHashSet("emptyString"), Sets.newHashSet(reverseFn.apply(""))); Assert.assertEquals(Sets.newHashSet("emptyString"), Sets.newHashSet(reverseFn.apply(null))); Assert.assertEquals(Collections.EMPTY_LIST, reverseFn.apply("baz")); }</code><technical_language>im scared sleep statements this. random tests fail in Travis. a latch test instead</technical_language>

Target:
public void testReverseFunction() throws InterruptedException { Assert.assertNull(reverseFnCache.get(namespace.getNamespace())); NamespaceExtractionCacheManagersTest.waitFor(manager.schedule(namespace)); Function<String, List<String>> reverseFn = reverseFnCache.get(namespace.getNamespace()); Assert.assertNotNull(reverseFn); Assert.assertEquals(Sets.newHashSet("boo", "foo"), Sets.newHashSet(reverseFn.apply("bar"))); Assert.assertEquals(Sets.newHashSet(""), Sets.newHashSet(reverseFn.apply("MissingValue"))); Assert.assertEquals(Sets.newHashSet("emptyString"), Sets.newHashSet(reverseFn.apply(""))); Assert.assertEquals(Sets.newHashSet("emptyString"), Sets.newHashSet(reverseFn.apply(null))); Assert.assertEquals(Collections.EMPTY_LIST, reverseFn.apply("baz")); }
Source:
<code>public static final SSLContext createAndInitSSLContext(final String jksFileName) throws Exception { final ClassLoader classloader = Thread.currentThread().getContextClassLoader(); final InputStream inputStream = classloader.getResourceAsStream(jksFileName); final KeyStore trustStore = KeyStore.getInstance("jks"); trustStore.load(inputStream, STOREPASS.toCharArray()); final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(trustStore, STOREPASS.toCharArray()); final TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(trustStore); <START> final SSLContext sslContext = SSLContext.getInstance("TLS"); <END> sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom()); return sslContext; }</code><technical_language>While setting server & client a part of this library PR, nice set integration test server client TLS 1.2</technical_language>

Target:
public static final SSLContext createAndInitSSLContext(final String jksFileName) throws Exception { final ClassLoader classloader = Thread.currentThread().getContextClassLoader(); final InputStream inputStream = classloader.getResourceAsStream(jksFileName); final KeyStore trustStore = KeyStore.getInstance("jks"); trustStore.load(inputStream, STOREPASS.toCharArray()); final KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(trustStore, STOREPASS.toCharArray()); final TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(trustStore); final SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom()); return sslContext; }
Source:
<code><START> private boolean isSelected() { <END> if (choice.get() == NONE) { return choice.compareAndSet(NONE, index); } return choice.get() == index; }</code><technical_language>I if this simplified a single get() call: java int ch = choice.get(); if (ch == NONE) { return choice.compareAndSet(NONE, index); } return ch == index; this method is called for onNext() for winner, this change reduce overhead 2; benchmarked it. In addition, switching a volatile int choice + double-check synchronization a bit faster even. Thoughts</technical_language>

Target:
private boolean isSelected() { int ch = choice.get(); if (ch == NONE) { return choice.compareAndSet(NONE, index); } return ch == index; }
Source:
<code><START> default boolean isPeerReview() { <END> return isOfType(AtsArtifactTypes.PeertopeerReview); }</code><technical_language>I camelcase here. words, easier read</technical_language>

Target:
default boolean isPeerReview() { return isOfType(AtsArtifactTypes.PeerToPeerReview); }
Source:
<code><START> public ValidatingOutputFormat getOutputFormatForRun(BatchSinkContext context) throws InstantiationException { <END> FileFormat fileFormat = config.getFormat(); try { return context.newPluginInstance(fileFormat.name().toLowerCase()); } catch (InvalidPluginConfigException e) { Set<String> properties = new HashSet<>(e.getMissingProperties()); for (InvalidPluginProperty invalidProperty : e.getInvalidProperties()) { properties.add(invalidProperty.getName()); } String errorMessage = String.format("Format '%s' cannot be used because properties %s were not provided or " + "were invalid when the pipeline was deployed. Set the format to a " + "different value, or re-create the pipeline with all required properties.", fileFormat.name(), properties); throw new IllegalArgumentException(errorMessage, e); } }</code><technical_language>I assume this is pulled method subclasses it? If case, this protected instead of public</technical_language>

Target:
protected ValidatingOutputFormat getOutputFormatForRun(BatchSinkContext context) throws InstantiationException { FileFormat fileFormat = config.getFormat(); try { return context.newPluginInstance(fileFormat.name().toLowerCase()); } catch (InvalidPluginConfigException e) { Set<String> properties = new HashSet<>(e.getMissingProperties()); for (InvalidPluginProperty invalidProperty : e.getInvalidProperties()) { properties.add(invalidProperty.getName()); } String errorMessage = String.format("Format '%s' cannot be used because properties %s were not provided or " + "were invalid when the pipeline was deployed. Set the format to a " + "different value, or re-create the pipeline with all required properties.", fileFormat.name(), properties); throw new IllegalArgumentException(errorMessage, e); } }
Source:
<code>public void dispose() { <START> siriusCommonContentModelProvider.dispose(); <END> treeViewer.removeSelectionChangedListener(selectionChangeListener); SessionManager.INSTANCE.removeSessionsListener(this); if (session != null && session.getTransactionalEditingDomain() != null) { session.getTransactionalEditingDomain().getCommandStack().removeCommandStackListener(commandStackListener); session.removeListener(this); session.getTransactionalEditingDomain().removeResourceSetListener(resourceSetListenerChangeListener); } session = null; treeViewer = null; manageSessionActionProvider = null; siriusCommonContentModelProvider = null; if (menuManager != null) { menuManager.dispose(); } menuManager = null; toolkit = null; ecoreActionsHandler = null; }</code><technical_language>lines dealing provider moved together, usual pattern: if (x != null) { x.dispose(); } x = null;</technical_language>

Target:
public void dispose() { if (siriusCommonContentModelProvider != null) { siriusCommonContentModelProvider.dispose(); } siriusCommonContentModelProvider = null; treeViewer.removeSelectionChangedListener(selectionChangeListener); SessionManager.INSTANCE.removeSessionsListener(this); if (session != null && session.getTransactionalEditingDomain() != null) { session.getTransactionalEditingDomain().getCommandStack().removeCommandStackListener(commandStackListener); session.removeListener(this); session.getTransactionalEditingDomain().removeResourceSetListener(resourceSetListenerChangeListener); } session = null; treeViewer = null; manageSessionActionProvider = null; if (menuManager != null) { menuManager.dispose(); } menuManager = null; toolkit = null; ecoreActionsHandler = null; }
Source:
<code>private void warnIfNotAllDisksPermitSnapshots() { for (Disk disk : getVm().getDiskMap().values()) { <START> if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { } <END> if (!disk.isAllowSnapshot()) { auditLogDirector.log(this, AuditLogType.USER_RUN_VM_AS_STATELESS_WITH_DISKS_NOT_ALLOWING_SNAPSHOT); break; } } }</code><technical_language>huh</technical_language>

Target:
private void warnIfNotAllDisksPermitSnapshots() { for (Disk disk : getVm().getDiskMap().values()) { if (!disk.isAllowSnapshot()) { auditLogDirector.log(this, AuditLogType.USER_RUN_VM_AS_STATELESS_WITH_DISKS_NOT_ALLOWING_SNAPSHOT); break; } } }
Source:
<code>public GlusterBrickEntity mapRow(ResultSet rs, int rowNum) throws SQLException { GlusterBrickEntity brick = new GlusterBrickEntity(); brick.setId(Guid.createGuidFromString(rs.getString("id"))); brick.setVolumeId(Guid.createGuidFromString(rs.getString("volume_id"))); Guid serverId = Guid.createGuidFromString(rs.getString("server_id")); brick.setServerId(serverId); brick.setServerName(getHostNameOfServer(serverId)); brick.setBrickDirectory(rs.getString("brick_dir")); <START> brick.setBrickOrder(Integer.parseInt(rs.getString("brick_order"))); <END> brick.setStatus(GlusterBrickStatus.valueOf(rs.getString("status"))); return brick; }</code><technical_language>rs.getInt() here</technical_language>

Target:
public GlusterBrickEntity mapRow(ResultSet rs, int rowNum) throws SQLException { GlusterBrickEntity brick = new GlusterBrickEntity(); brick.setId(Guid.createGuidFromString(rs.getString("id"))); brick.setVolumeId(Guid.createGuidFromString(rs.getString("volume_id"))); Guid serverId = Guid.createGuidFromString(rs.getString("server_id")); brick.setServerId(serverId); brick.setServerName(getHostNameOfServer(serverId)); brick.setBrickDirectory(rs.getString("brick_dir")); brick.setBrickOrder(rs.getInt("brick_order")); brick.setStatus(GlusterBrickStatus.valueOf(rs.getString("status"))); return brick; }
Source:
<code>public void overrideInitMainSchedulerThrowsWhenSchedulerCallableReturnsNull() { Callable<Scheduler> nullResultCallable = new Callable<Scheduler>() { @Override public Scheduler call() throws Exception { return null; } }; try { RxAndroidPlugins.initMainThreadScheduler(nullResultCallable); <START> fail("Should have thrown NullPointerException"); <END> } catch (NullPointerException npe) { assertEquals("Scheduler Callable result can't be null", npe.getMessage()); } }</code><technical_language>remove message</technical_language>

Target:
public void overrideInitMainSchedulerThrowsWhenSchedulerCallableReturnsNull() { Callable<Scheduler> nullResultCallable = new Callable<Scheduler>() { @Override public Scheduler call() throws Exception { return null; } }; try { RxAndroidPlugins.initMainThreadScheduler(nullResultCallable); fail(); } catch (NullPointerException e) { assertEquals("Scheduler Callable returned null", e.getMessage()); } }
Source:
<code><START> private String pickRandomWeapon(Entity entity, boolean clusterOnly) { List<Mounted> weapons = entity.getIndividualWeaponList(); List<Mounted> eligibleWeapons = new ArrayList<>(); for(Mounted weapon : weapons) { if(SpecialAbility.isWeaponEligibleForSPA(weapon.getType(), Person.T_NONE, clusterOnly)) { eligibleWeapons.add(weapon); } } int weaponIndex = Compute.randomInt(entity.getIndividualWeaponList().size()); return entity.getIndividualWeaponList().get(weaponIndex).getName(); <END> }</code><technical_language>building a list of eligible weapons, picking randomly weapons</technical_language>

Target:
private String pickRandomWeapon(Entity entity, boolean clusterOnly) { List<Mounted> weapons = entity.getIndividualWeaponList(); List<Mounted> eligibleWeapons = new ArrayList<>(); for(Mounted weapon : weapons) { if(SpecialAbility.isWeaponEligibleForSPA(weapon.getType(), Person.T_NONE, clusterOnly)) { eligibleWeapons.add(weapon); } } if(eligibleWeapons.size() == 0) { return Crew.SPECIAL_NONE; } int weaponIndex = Compute.randomInt(eligibleWeapons.size()); return eligibleWeapons.get(weaponIndex).getName(); }
Source:
<code>public RegexFilter( String dimension, final String pattern, final ExtractionFn extractionFn ) { super( dimension, extractionFn == null ? new Predicate<String>() { Pattern compiled = Pattern.compile(pattern); @Override public boolean apply(String input) { return (input != null) && compiled.matcher(input).find(); } } : new Predicate<String>() { Pattern compiled = Pattern.compile(pattern); @Override public boolean apply(String input) { <START> return (input != null) && compiled.matcher(extractionFn.apply(input)).find(); <END> } } ); }</code><technical_language>Strings.nullToEmpty(extractionFn.apply(input))</technical_language>

Target:
public RegexFilter( String dimension, final String pattern, final ExtractionFn extractionFn ) { super( dimension, new Predicate<String>() { Pattern compiled = Pattern.compile(pattern); @Override public boolean apply(String input) { return (input != null) && compiled.matcher(input).find(); } }, extractionFn ); }
Source:
<code>public static ArrayList<Vector2> readV2List(JSONObject parentNode, String name) { ArrayList<Vector2> res = new ArrayList<>(); JSONArray listNode = parentNode.has(name) ? parentNode.getJSONArray(name) : null; if (listNode == null) { return res; } <START> for (int i = 0; i < listNode.length(); i++) { <END> Vector2 vec = readV2(listNode.getString(i)); res.add(vec); } return res; }</code><technical_language>foreach loop here? cleaner</technical_language>

Target:
public static ArrayList<Vector2> readV2List(JSONObject parentNode, String name) { ArrayList<Vector2> res = new ArrayList<>(); JSONArray listNode = parentNode.has(name) ? parentNode.getJSONArray(name) : null; if (listNode == null) { return res; } for (Object val : listNode) { if(val instanceof String) { Vector2 vec = readV2((String) val); res.add(vec); } } return res; }
Source:
<code>private static List<String> getCompileFilePathsDefault(@NotNull JpsModule module, @NotNull ElixirTarget target){ CommonProcessors.CollectProcessor<File> exFilesCollector = new CommonProcessors.CollectProcessor<File>(){ @Override protected boolean accept(File file) { <START> return !file.isDirectory() && FileUtilRt.extensionEquals(file.getName(), "ex"); <END> } }; List<JpsModuleSourceRoot> sourceRoots = new ArrayList<JpsModuleSourceRoot>(); ContainerUtil.addAll(sourceRoots, module.getSourceRoots(JavaSourceRootType.SOURCE)); if(target.isTests()){ ContainerUtil.addAll(sourceRoots, module.getSourceRoots(JavaSourceRootType.TEST_SOURCE)); } for (JpsModuleSourceRoot root : sourceRoots){ FileUtil.processFilesRecursively(root.getFile(), exFilesCollector); } return ContainerUtil.map(exFilesCollector.getResults(), new Function<File, String>() { @NotNull @Override public String fun(@NotNull File file) { return file.getAbsolutePath(); } }); }</code><technical_language>[ ] This ELIXIR_SOURCE_EXTENSION constant if [that change](<LINK_0></technical_language>

Target:
private static List<String> getCompileFilePathsDefault(@NotNull JpsModule module, @NotNull ElixirTarget target){ CommonProcessors.CollectProcessor<File> exFilesCollector = new CommonProcessors.CollectProcessor<File>(){ @Override protected boolean accept(File file) { return !file.isDirectory() && FileUtilRt.extensionEquals(file.getName(), ELIXIR_SOURCE_EXTENSION); } }; List<JpsModuleSourceRoot> sourceRoots = new ArrayList<JpsModuleSourceRoot>(); ContainerUtil.addAll(sourceRoots, module.getSourceRoots(JavaSourceRootType.SOURCE)); if(target.isTests()){ ContainerUtil.addAll(sourceRoots, module.getSourceRoots(JavaSourceRootType.TEST_SOURCE)); } for (JpsModuleSourceRoot root : sourceRoots){ FileUtil.processFilesRecursively(root.getFile(), exFilesCollector); } return ContainerUtil.map(exFilesCollector.getResults(), new Function<File, String>() { @NotNull @Override public String fun(@NotNull File file) { return file.getAbsolutePath(); } }); }
Source:
<code>private synchronized void newUpdateThread(@NonNull FlowScopeLog fScope) { cancelUpdate(); if (getSwtChart().isDisposed()) { return; } int numRequests = fOverrideNbPoints != 0 ? fOverrideNbPoints : <START> (int) Math.min(getWindowEndTime() - getWindowStartTime() + 1, (long) (getSwtChart().getPlotArea().getBounds().width <END> * fResolution)); fUpdateThread = new UpdateThread(numRequests, fScope); fUpdateThread.start(); }</code><technical_language>practically, theoretically handling 2b pixels wide, more issues</technical_language>

Target:
private synchronized void newUpdateThread(@NonNull FlowScopeLog fScope) { if (getSwtChart().isDisposed()) { return; } int numRequests = fOverrideNbPoints != 0 ? fOverrideNbPoints : (int) Math.min(getWindowEndTime() - getWindowStartTime() + 1, (long) (getSwtChart().getPlotArea().getBounds().width * fResolution)); fUpdateThread = new UpdateThread(numRequests, fScope); fUpdateThread.start(); }
Source:
<code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Query query = RemoteAccess.evaluate(request); if (query.isDoS_blackout()) {response.sendError(503, "your request frequency is too high"); return;} String callback = query.get("callback", ""); boolean jsonp = callback != null && callback.length() > 0; boolean minified = query.get("minified", false); String tweetQuery = query.get("tweet", ""); String userQuery = query.get("user", ""); response.setCharacterEncoding("UTF-8"); PrintWriter sos = response.getWriter(); JSONObject result = new JSONObject(true); <START> if(tweetQuery != null) { <END> String tweetId = parseTweetId(tweetQuery); boolean exists = DAO.existMessage(tweetId); if(exists) { JSONObject post = DAO.searchLocalTweetById(tweetId); result.put("tweet", post); } } query.setResponse(response, jsonp ? "application/javascript" : "application/json"); if (jsonp) sos.print(callback + "("); sos.print(result.toString(minified ? 0 : 2)); if (jsonp) sos.println(");"); sos.println(); sos.flush(); sos.close(); query.finalize(); }</code><technical_language>space consistency. if ( instead of if(</technical_language>

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Query query = RemoteAccess.evaluate(request); if (query.isDoS_blackout()) {response.sendError(503, "your request frequency is too high"); return;} String callback = query.get("callback", ""); boolean jsonp = callback != null && callback.length() > 0; boolean minified = query.get("minified", false); String tweetQuery = query.get("tweet", ""); response.setCharacterEncoding("UTF-8"); PrintWriter sos = response.getWriter(); JSONObject result = new JSONObject(true); if (tweetQuery != null) { String tweetId = parseTweetId(tweetQuery); boolean exists = DAO.existMessage(tweetId); if (exists) { JSONObject post = DAO.searchLocalTweetById(tweetId); result.put("tweet", post); } } query.setResponse(response, jsonp ? "application/javascript" : "application/json"); if (jsonp) sos.print(callback + "("); sos.print(result.toString(minified ? 0 : 2)); if (jsonp) sos.println(");"); sos.println(); sos.flush(); sos.close(); }
Source:
<code>String formatStepText(String keyword, String stepText, Format textFormat, Format argFormat, List<Argument> arguments) { int beginIndex = 0; StringBuilder result = new StringBuilder(textFormat.text(keyword)); for (Argument argument : arguments) { if (argument.getOffset() != null) { int argumentOffset = argument.getOffset(); if (argumentOffset < beginIndex ) { continue; } String text = stepText.substring(beginIndex, argumentOffset); result.append(textFormat.text(text)); } if (argument.getVal() != null) { result.append(argFormat.text(argument.getVal())); int argumentEnd = argument.getOffset() + argument.getVal().length(); beginIndex = argumentEnd; } } <START> if (beginIndex != stepText.length() && beginIndex >= 0) { <END> String text = stepText.substring(beginIndex, stepText.length()); result.append(textFormat.text(text)); } return result.toString(); }</code><technical_language>beginIndex >= 0 is required here. skip nested capture groups (and nested capture groups a positive index)</technical_language>

Target:
String formatStepText(String keyword, String stepText, Format textFormat, Format argFormat, List<Argument> arguments) { int beginIndex = 0; StringBuilder result = new StringBuilder(textFormat.text(keyword)); for (Argument argument : arguments) { if (argument.getOffset() != null) { int argumentOffset = argument.getOffset(); if (argumentOffset < beginIndex ) { continue; } String text = stepText.substring(beginIndex, argumentOffset); result.append(textFormat.text(text)); } if (argument.getVal() != null) { result.append(argFormat.text(argument.getVal())); beginIndex = argument.getOffset() + argument.getVal().length(); } } if (beginIndex != stepText.length()) { String text = stepText.substring(beginIndex, stepText.length()); result.append(textFormat.text(text)); } return result.toString(); }
Source:
<code>getMrrtReportTemplates_shouldReturnAllMrrtReportTemplatesThatMatchGivenPublisherAnywhereInDctermsPublisherInsensitiveToCase() throws Exception { MrrtReportTemplateSearchCriteria searchCriteria = <START> new MrrtReportTemplateSearchCriteria.Builder().withPublisher("IHE CAT publisher") <END> .build(); List<MrrtReportTemplate> templates = mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria); assertNotNull(templates); assertThat(templates.size(), is(2)); }</code><technical_language>changed name of test method annotation testing match case insensitive behavior. for ex. change "IHE CAT publisher" "cat"</technical_language>

Target:
getMrrtReportTemplates_shouldReturnAllMrrtReportTemplatesThatMatchGivenPublisherAnywhereInDctermsPublisherInsensitiveToCase() throws Exception { MrrtReportTemplateSearchCriteria searchCriteria = new MrrtReportTemplateSearchCriteria.Builder().withPublisher("cat") .build(); List<MrrtReportTemplate> templates = mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria); List<String> uuids = new ArrayList<>(); for (MrrtReportTemplate template : templates) { uuids.add(template.getUuid()); } assertNotNull(templates); assertThat(templates.size(), is(2)); assertThat(uuids.contains(UUID_FOR_TEMPLATE_ONE), is(true)); assertThat(uuids.contains(UUID_FOR_TEMPLATE_TWO), is(true)); searchCriteria = new MrrtReportTemplateSearchCriteria.Builder().withPublisher("IHE CAT Publisher") .build(); templates = mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria); uuids = new ArrayList<>(); for (MrrtReportTemplate template : templates) { uuids.add(template.getUuid()); } assertNotNull(templates); assertThat(templates.size(), is(1)); assertThat(uuids.contains(UUID_FOR_TEMPLATE_ONE), is(true)); }
Source:
<code>public void write(final InputStream input) throws IOException { this.decorated.write( new ThresholdInputStream( input, this.mlength, <START> new Runnable() { <END> @Override public void run() { throw new IllegalArgumentException( String.format( "Now you can't upload a file that is larger than %s bytes", SmallDoc.this.mlength ) ); } } ) ); }</code><technical_language>I understand need this ThresholdInputStream configurable. I understand, this class is this package. I package-only visible remove this "runnable" injection</technical_language>

Target:
public void write(final InputStream input) throws IOException { try { this.decorated.write( new ThresholdInputStream(input, this.mlength) ); } catch (final ThresholdInputStream.LimitReachedException exc) { throw new IllegalArgumentException( String.format( "Now you can't upload a file that is larger than %s bytes", this.mlength ), exc ); } }
Source:
<code>public boolean isVmManaged() { VM vm = getVm(); <START> return vm != null && vm.isManagedVm(); <END> }</code><technical_language>this imply hostedEngineVm null. other flows consider</technical_language>

Target:
public boolean isVmManaged() { return hostedEngineVm != null && hostedEngineVm.isManagedVm(); }
Source:
<code>public String toString() { <START> String builder = "FSFPair [featureStructure=" + <END> featureStructure + ", affectedFeature=" + affectedFeature + "]"; return builder; }</code><technical_language>I changes improve situation. change this a String.format(...) call... format code remove line breaks</technical_language>

Target:
public String toString() { return "FSFPair [featureStructure=" + featureStructure + ", affectedFeature=" + affectedFeature + "]"; }
Source:
<code>private static byte[] sign(byte[] key, byte[] value) { try { String algorithm = "HmacSHA256"; Mac mac = Mac.getInstance(algorithm); mac.init(new SecretKeySpec(key, algorithm)); return mac.doFinal(value); } catch (NoSuchAlgorithmException | InvalidKeyException ex) { <START> throw new IllegalStateException("Failed to calculate the AWS V4 Signature.", ex); <END> } }</code><technical_language>Pretty this is right exception here. Also, is justification for converting this a runtime exception</technical_language>

Target:
private static byte[] sign(byte[] key, byte[] value) { try { String algorithm = "HmacSHA256"; Mac mac = Mac.getInstance(algorithm); mac.init(new SecretKeySpec(key, algorithm)); return mac.doFinal(value); } catch (NoSuchAlgorithmException e) { throw new RuntimeException( "Invalid algorithm used when calculating the AWS V4 Signature.", e); } catch (InvalidKeyException e) { throw new SigningException("Invalid key used when calculating the AWS V4 Signature", e); } }
Source:
<code>protected IDialogSettings getDialogBoundsSettings() { IDialogSettings settings = Activator.getDefault().getDialogSettings(); IDialogSettings section = settings .getSection(DIALOG_SETTINGS_SECTION_NAME); <START> if (section == null) { <END> section = settings.addNewSection(DIALOG_SETTINGS_SECTION_NAME); } return section; }</code><technical_language>style nit: do braces single line blocks</technical_language>

Target:
protected IDialogSettings getDialogBoundsSettings() { IDialogSettings settings = Activator.getDefault().getDialogSettings(); IDialogSettings section = settings .getSection(DIALOG_SETTINGS_SECTION_NAME); if (section == null) section = settings.addNewSection(DIALOG_SETTINGS_SECTION_NAME); return section; }
Source:
<code>private static Map<String, Object> buildDataModel(RunConfiguration runConfiguration) { Map<String, Object> data = new HashMap<String, Object>(); data.put("run", runConfiguration.getRunName()); data.put("dry_run", runConfiguration.getExecutionConfig().getDryRunFlag()); data.put("max_cpu", runConfiguration.getExecutionConfig().getMaxCPUs()); data.put("verbose", runConfiguration.getExecutionConfig().getVerboseFlag()); data.put("model_version", runConfiguration.getCodeConfig().getModelVersion()); <START> data.put("occurrence_file", "data/occurrence.csv"); <END> data.put("extent_file", "data/extent.asc"); data.put("admin1_file", escapeFilePathForR(runConfiguration.getAdminUnitConfig().getAdmin1RasterFile())); data.put("admin2_file", escapeFilePathForR(runConfiguration.getAdminUnitConfig().getAdmin2RasterFile())); final String covariatePathPrefix = runConfiguration.getCovariateConfig().getCovariateDirectory(); Collection<String> covariatePaths = convert(runConfiguration.getCovariateConfig().getCovariateFilePaths(), new Converter<String, String>() { public String convert(String subpath) { return escapeFilePathForR(Paths.get(covariatePathPrefix, subpath).toString()); } }); data.put("covariate_files", covariatePaths); return data; }</code><technical_language>difference consider renaming this "occurrences.csv"...</technical_language>

Target:
private static Map<String, Object> buildDataModel(RunConfiguration runConfiguration) { Map<String, Object> data = new HashMap<String, Object>(); data.put("run", runConfiguration.getRunName()); data.put("dry_run", runConfiguration.getExecutionConfig().getDryRunFlag()); data.put("max_cpu", runConfiguration.getExecutionConfig().getMaxCPUs()); data.put("verbose", runConfiguration.getExecutionConfig().getVerboseFlag()); data.put("model_version", runConfiguration.getCodeConfig().getModelVersion()); data.put("occurrence_file", "data/occurrences.csv"); data.put("extent_file", "data/extent.asc"); data.put("admin1_file", escapeFilePathForR(runConfiguration.getAdminUnitConfig().getAdmin1RasterFile())); data.put("admin2_file", escapeFilePathForR(runConfiguration.getAdminUnitConfig().getAdmin2RasterFile())); final String covariatePathPrefix = runConfiguration.getCovariateConfig().getCovariateDirectory(); Collection<String> covariatePaths = convert(runConfiguration.getCovariateConfig().getCovariateFilePaths(), new Converter<String, String>() { public String convert(String subpath) { return escapeFilePathForR(Paths.get(covariatePathPrefix, subpath).toString()); } }); data.put("covariate_files", covariatePaths); return data; }
Source:
<code>public ByteBuf getCommandLineBytes() { final StringBuilder sb = new StringBuilder(); sb.append(msgNumbers); sb.append(ImapClientConstants.SPACE); if (dataItems != null) { sb.append(ImapClientConstants.L_PAREN); sb.append(dataItems); sb.append(ImapClientConstants.R_PAREN); } else { sb.append(macro.name()); } if (changedSince != null) { sb.append(ImapClientConstants.SPACE); sb.append(ImapClientConstants.L_PAREN); sb.append(CHANGEDSINCE_SP); sb.append(changedSince); if (vanished) { sb.append(SP_VANISHED); } sb.append(ImapClientConstants.R_PAREN); } final String fetchCmdStr = sb.toString(); <START> final int len = ImapClientConstants.PAD_LEN + fetchCmdStr.length(); <END> final ByteBuf byteBuf = Unpooled.buffer(len); byteBuf.writeBytes(isUid ? UID_FETCH_SP_B : FETCH_SP_B); byteBuf.writeBytes(fetchCmdStr.getBytes(StandardCharsets.US_ASCII)); byteBuf.writeBytes(CRLF_B); return byteBuf; }</code><technical_language>PAD_LEN, compute exact size</technical_language>

Target:
public ByteBuf getCommandLineBytes() { final int dataItemsSize = dataItems == null ? macro.name().length() : dataItems.length(); final String changedSinceStr = changedSince == null ? "" : changedSince.toString(); final int vanishedSize = isVanished ? SP_VANISHED.length() : 0; final int len = ImapClientConstants.PAD_LEN + changedSinceStr.length() + dataItemsSize + msgNumbers.length() + vanishedSize; final ByteBuf sb = Unpooled.buffer(len); sb.writeBytes(isUid ? UID_FETCH_SP_B : FETCH_SP_B); sb.writeBytes(msgNumbers.getBytes(StandardCharsets.US_ASCII)); sb.writeByte(ImapClientConstants.SPACE); if (dataItems != null) { sb.writeByte(ImapClientConstants.L_PAREN); sb.writeBytes(dataItems.getBytes(StandardCharsets.US_ASCII)); sb.writeByte(ImapClientConstants.R_PAREN); } else { sb.writeBytes(macro.name().getBytes(StandardCharsets.US_ASCII)); } if (changedSince != null) { sb.writeByte(ImapClientConstants.SPACE); sb.writeByte(ImapClientConstants.L_PAREN); sb.writeBytes(CHANGEDSINCE_SP_B); sb.writeBytes(changedSinceStr.getBytes(StandardCharsets.US_ASCII)); if (isVanished) { sb.writeBytes(SP_VANISHED_B); } sb.writeByte(ImapClientConstants.R_PAREN); } sb.writeBytes(CRLF_B); return sb; }
Source:
<code>public void runBrowserStackLocal(String accessKey, String additionalArgs, String localBinary) { if (process != null) { <START> return; <END> } if (isEmpty(localBinary)) { if (!browserStackLocalFile.exists()) { prepareBrowserStackLocal(); } runTheBinary(browserStackLocalFile, accessKey, additionalArgs); } else { runTheBinary(new File(localBinary), accessKey, additionalArgs); } }</code><technical_language>log return</technical_language>

Target:
public void runBrowserStackLocal(String accessKey, String additionalArgs, String localBinary) throws BrowserStackLocalException { if (browserStackLocalBinary != null) { log.fine("One BrowserStackLocal binary has been already started."); return; } if (Utils.isNullOrEmpty(localBinary)) { if (!browserStackLocalFile.exists()) { prepareBrowserStackLocal(); } runBrowserStackLocal(browserStackLocalFile, accessKey, additionalArgs); } else { runBrowserStackLocal(new File(localBinary), accessKey, additionalArgs); } }
Source:
<code>protected Iterable<IAnalysisModule> getDependentAnalyses() { ITmfTrace trace = getTrace(); if (trace == null) { throw new IllegalStateException(); } <START> IAnalysisModule module = trace.getAnalysisModule(KernelAnalysisModule.ID); <END> if (module == null) { return Collections.EMPTY_SET; } return ImmutableSet.of(module); }</code><technical_language>Sorry, I reverted this accidentally. fix</technical_language>

Target:
protected Iterable<IAnalysisModule> getDependentAnalyses() { ITmfTrace trace = getTrace(); if (trace == null) { throw new IllegalStateException(); } IAnalysisModule module = trace.getAnalysisModule(TidAnalysisModule.ID); if (module == null) { return Collections.EMPTY_SET; } return ImmutableSet.of(module); }
Source:
<code>private Plan generatePlan(final List<OptimizedComputeTask> optimizedComputeTasks) { final PlanImpl.Builder builder = PlanImpl.newBuilder(); final PriorityQueue<OptimizedComputeTask> senderPriorityQueue = new PriorityQueue<>(optimizedComputeTasks.size(), ascendingComparator); final PriorityQueue<OptimizedComputeTask> receiverPriorityQueue = new PriorityQueue<>(optimizedComputeTasks.size(), descendingComparator); for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { final int dataUnitToMove = getDataUnitsToMove(cmpTask); if (dataUnitToMove < 0) { senderPriorityQueue.add(cmpTask); } else if (dataUnitToMove > 0) { receiverPriorityQueue.add(cmpTask); } else { continue; } if (cmpTask.getParticipateValue() && cmpTask.getId().startsWith(TEMP_COMPUTE_TASK_ID_PREFIX)) { <START> cmpTask.setId(getNewComputeTaskId()); END> builder.addEvaluatorToAdd(cmpTask.getId()); } else if (!cmpTask.getParticipateValue() && !cmpTask.getId().startsWith(TEMP_COMPUTE_TASK_ID_PREFIX)) { builder.addEvaluatorToDelete(cmpTask.getId()); } } while (senderPriorityQueue.size() > 0) { final OptimizedComputeTask sender = senderPriorityQueue.poll(); while (getDataUnitsToMove(sender) < 0) { final OptimizedComputeTask receiver = receiverPriorityQueue.poll(); builder.addTransferSteps(generateTransferStep(sender, receiver)); if (getDataUnitsToMove(receiver) > 0) { receiverPriorityQueue.add(receiver); } } } return builder.build(); }</code><technical_language>ids</technical_language>

Target:
private Plan generatePlan(final List<OptimizedComputeTask> optimizedComputeTasks) { final PlanImpl.Builder builder = PlanImpl.newBuilder(); final PriorityQueue<OptimizedComputeTask> senderPriorityQueue = new PriorityQueue<>(optimizedComputeTasks.size(), ascendingComparator); final PriorityQueue<OptimizedComputeTask> receiverPriorityQueue = new PriorityQueue<>(optimizedComputeTasks.size(), descendingComparator); for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { final int dataUnitToMove = getDataUnitsToMove(cmpTask); if (dataUnitToMove < 0) { senderPriorityQueue.add(cmpTask); } else if (dataUnitToMove > 0) { receiverPriorityQueue.add(cmpTask); } else { continue; } if (cmpTask.getParticipateValue() && cmpTask.isNewComputeTask()) { cmpTask.setId(getNewComputeTaskId()); builder.addEvaluatorToAdd(cmpTask.getId()); } else if (!cmpTask.getParticipateValue() && !cmpTask.isNewComputeTask()) { builder.addEvaluatorToDelete(cmpTask.getId()); } } while (senderPriorityQueue.size() > 0) { final OptimizedComputeTask sender = senderPriorityQueue.poll(); while (getDataUnitsToMove(sender) < 0) { final OptimizedComputeTask receiver = receiverPriorityQueue.poll(); builder.addTransferSteps(generateTransferStep(sender, receiver)); if (getDataUnitsToMove(receiver) > 0) { receiverPriorityQueue.add(receiver); break; } } } return builder.build(); }
Source:
<code>protected Screen createScreen() { switch (status) { case ABANDONED: return new ByProjectAbandonedChangesScreen(project, "n,z"); case MERGED: return new ByProjectMergedChangesScreen(project, "n,z"); <START> default: <END> return new ByProjectOpenChangesScreen(project, "n,z"); } }</code><technical_language>Again, please spell out cases: case NEW: case SUBMITTED: default:</technical_language>

Target:
protected Screen createScreen() { switch (status) { case ABANDONED: return new ByProjectAbandonedChangesScreen(project, "n,z"); case MERGED: return new ByProjectMergedChangesScreen(project, "n,z"); case NEW: case SUBMITTED: default: return new ByProjectOpenChangesScreen(project, "n,z"); } }
Source:
<code>public void onMessage(ClientMessage msg) { String body = ""; try { msg.acknowledge(); log.debug("ActiveMQ message acknowledged for listener: {}", msg.getMessageID(), listener); body = msg.getBodyBuffer().readString(); log.debug("Got event: {}", body); Event event = mapper.readValue(body, Event.class); listener.onEvent(event); session.commit(); } catch (Exception e) { <START> String messageId = msg == null ? "" : Long.toString(msg.getMessageID()); <END> String reason = e.getCause() == null ? e.getMessage() : e.getCause().getMessage(); log.error("Unable to process message {}: {}", messageId, reason); log.debug("Unable to process message. Rolling back client session.\n" + body, e); try { session.rollback(); } catch (ActiveMQException amqe) { log.error("Unable to roll back client session.", amqe); } } }</code><technical_language>put ternary predicates in parenthesis? String messageId = (msg == null) ? "" : Long.toString(msg.getMessageID());</technical_language>

Target:
public void onMessage(ClientMessage msg) { String body = ""; try { msg.acknowledge(); log.debug("ActiveMQ message acknowledged for listener: {}", msg.getMessageID(), listener); body = msg.getBodyBuffer().readString(); log.debug("Got event: {}", body); Event event = mapper.readValue(body, Event.class); listener.onEvent(event); session.commit(); } catch (Exception e) { String messageId = (msg == null) ? "" : Long.toString(msg.getMessageID()); String reason = (e.getCause() == null) ? e.getMessage() : e.getCause().getMessage(); log.error("Unable to process message {}: {}", messageId, reason); log.debug("Unable to process message. Rolling back client session.\n{}", body, e); try { session.rollback(); } catch (ActiveMQException amqe) { log.error("Unable to roll back client session.", amqe); } } }
Source:
<code>public void testFetchFromBundle() { <START> try { <END> File remoteWorkDir = tempFolder.newFolder("TempDir2"); JGitFacade.cloneFromRepo(localWorkDir, remoteWorkDir); writeCommitToRepo(localWorkDir, 3); File bundle = JGitFacade.createBundle(localWorkDir, "refs/heads/master", "CheckoutAtCommit2"); assertNotEquals( getObjectIdByRevisionString(localWorkDir, "HEAD"), getObjectIdByRevisionString(remoteWorkDir, "FETCH_HEAD")); JGitFacade.fetchFromBundle(bundle, remoteWorkDir); assertEquals( getObjectIdByRevisionString(localWorkDir, "HEAD"), getObjectIdByRevisionString(remoteWorkDir, "FETCH_HEAD")); } catch (IOException e) { fail("IO"); } catch (GitAPIException e) { fail("Git"); } }</code><technical_language>Add throws Exception method signature remove try/catch. is more readable</technical_language>

Target:
public void testFetchFromBundle() throws IllegalArgumentException, Exception { File remoteWorkDir = tempFolder.newFolder("TempDir2"); JGitFacade.cloneFromRepo(localWorkDir, remoteWorkDir); writeCommitToRepo(localWorkDir, 3); String basis = JGitFacade.getSHA1HashByRevisionString(remoteWorkDir, "HEAD"); File bundle = JGitFacade.createBundle(localWorkDir, "HEAD", basis); assertNotEquals( getObjectIdByRevisionString(localWorkDir, "HEAD"), getObjectIdByRevisionString(remoteWorkDir, "FETCH_HEAD")); JGitFacade.fetchFromBundle(remoteWorkDir, bundle); assertEquals( getObjectIdByRevisionString(localWorkDir, "HEAD"), getObjectIdByRevisionString(remoteWorkDir, "FETCH_HEAD")); }
Source:
<code>public RocksBlockStore(String baseDir) { RocksDB.loadLibrary(); mDisableWAL = new WriteOptions().setDisableWAL(true); mIteratorOption = new ReadOptions().setReadaheadSize( <START> ServerConfiguration.getInt(PropertyKey.MASTER_METASTORE_BLOCK_ITERATOR_READAHEAD_SIZE)); <END> ColumnFamilyOptions cfOpts = new ColumnFamilyOptions() .setMemTableConfig(new HashLinkedListMemTableConfig()) .setCompressionType(CompressionType.NO_COMPRESSION); List<ColumnFamilyDescriptor> columns = Arrays.asList(new ColumnFamilyDescriptor(BLOCK_META_COLUMN.getBytes(), cfOpts), new ColumnFamilyDescriptor(BLOCK_LOCATIONS_COLUMN.getBytes(), cfOpts)); DBOptions dbOpts = new DBOptions() .setAllowConcurrentMemtableWrite(false) .setMaxOpenFiles(-1) .setCreateIfMissing(true) .setCreateMissingColumnFamilies(true); String dbPath = PathUtils.concatPath(baseDir, BLOCKS_DB_NAME); String backupPath = PathUtils.concatPath(baseDir, BLOCKS_DB_NAME + "-backups"); if (!FileUtils.exists(dbPath)) { try { FileUtils.createDir(dbPath); } catch (IOException e) { LOG.warn("Failed to create nonexistent db path at: {}. Error:{}", dbPath, e); } } mRocksStore = new RocksStore(dbPath, backupPath, columns, dbOpts, Arrays.asList(mBlockMetaColumn, mBlockLocationsColumn)); }</code><technical_language>below, setPrefixSameAsStart(). need anymore</technical_language>

Target:
public RocksBlockStore(String baseDir) { RocksDB.loadLibrary(); mDisableWAL = new WriteOptions().setDisableWAL(true); mIteratorOption = new ReadOptions().setReadaheadSize( ServerConfiguration.getBytes(PropertyKey.MASTER_METASTORE_ITERATOR_READAHEAD_SIZE)); ColumnFamilyOptions cfOpts = new ColumnFamilyOptions() .setMemTableConfig(new HashLinkedListMemTableConfig()) .setCompressionType(CompressionType.NO_COMPRESSION); List<ColumnFamilyDescriptor> columns = Arrays.asList(new ColumnFamilyDescriptor(BLOCK_META_COLUMN.getBytes(), cfOpts), new ColumnFamilyDescriptor(BLOCK_LOCATIONS_COLUMN.getBytes(), cfOpts)); DBOptions dbOpts = new DBOptions() .setAllowConcurrentMemtableWrite(false) .setMaxOpenFiles(-1) .setCreateIfMissing(true) .setCreateMissingColumnFamilies(true); String dbPath = PathUtils.concatPath(baseDir, BLOCKS_DB_NAME); String backupPath = PathUtils.concatPath(baseDir, BLOCKS_DB_NAME + "-backups"); if (!FileUtils.exists(dbPath)) { try { FileUtils.createDir(dbPath); } catch (IOException e) { LOG.warn("Failed to create nonexistent db path at: {}. Error:{}", dbPath, e); } } mRocksStore = new RocksStore(dbPath, backupPath, columns, dbOpts, Arrays.asList(mBlockMetaColumn, mBlockLocationsColumn)); }
Source:
<code>public static boolean isAllowedTime(byte[] signedTime, int durationSeconds, ContentAddressedStorage ipfs, PublicKeyHash owner) { try { Optional<PublicSigningKey> ownerOpt = ipfs.getSigningKey(owner).get(); if (! ownerOpt.isPresent()) throw new IllegalStateException("Couldn't retrieve owner key during getFollowRequests() call!"); byte[] raw = ownerOpt.get().unsignMessage(signedTime); CborObject cbor = CborObject.fromByteArray(raw); if (! (cbor instanceof CborObject.CborLong)) throw new IllegalStateException("Invalid cbor for getFollowRequests authorisation!"); long utcMillis = ((CborObject.CborLong) cbor).value; long now = System.currentTimeMillis(); if (Math.abs(now - utcMillis) > durationSeconds * 1_000) <START> throw new IllegalStateException("Stale auth time, is your clock accurate?"); <END> } catch (Exception e) { throw new RuntimeException(e); } return true; }</code><technical_language>aid debugging: add utcMillis (formatted a date-time) duration exception message</technical_language>

Target:
public static boolean isAllowedTime(byte[] signedTime, int durationSeconds, ContentAddressedStorage ipfs, PublicKeyHash owner) { try { Optional<PublicSigningKey> ownerOpt = ipfs.getSigningKey(owner).get(); if (! ownerOpt.isPresent()) throw new IllegalStateException("Couldn't retrieve owner key!"); byte[] raw = ownerOpt.get().unsignMessage(signedTime); CborObject cbor = CborObject.fromByteArray(raw); if (! (cbor instanceof CborObject.CborLong)) throw new IllegalStateException("Invalid cbor for time in authorisation!"); long utcMillis = ((CborObject.CborLong) cbor).value; long now = System.currentTimeMillis(); if (Math.abs(now - utcMillis) > durationSeconds * 1_000) throw new IllegalStateException("Stale auth time, is your clock accurate?"); } catch (Exception e) { throw new RuntimeException(e); } return true; }
Source:
<code><START> public Declarables(Collection<Declarable> declarables) { <END> this.declarables.addAll(declarables); }</code><technical_language>vararg? a variant..</technical_language>

Target:
public Declarables(Collection<Declarable> declarables) { Assert.notNull(declarables, "declarables cannot be null"); this.declarables.addAll(declarables); }
Source:
<code>public BatchDataSegmentAnnouncer( DruidServerMetadata server, final BatchDataSegmentAnnouncerConfig config, ZkPathsConfig zkPaths, Announcer announcer, ObjectMapper jsonMapper ) { super(server, zkPaths, announcer, jsonMapper); this.config = config; this.announcer = announcer; this.jsonMapper = jsonMapper; this.server = server; this.liveSegmentLocation = ZKPaths.makePath(zkPaths.getLiveSegmentsPath(), server.getName()); segmentTransformer = new Function<DataSegment, DataSegment>() { @Override public DataSegment apply(DataSegment input) { DataSegment rv = input; if (config.isSkipDimensionsAndMetrics()) { rv = rv.withDimensions(null).withMetrics(null); } if (config.isSkipLoadSpec()) { rv = rv.withLoadSpec(null); } return rv; } }; <START> <END> if (this.config.isSkipSegmentAnnouncementOnZk()) { dummyZnode = new SegmentZNode("PLACE_HOLDER_ONLY"); } else { dummyZnode = null; } }</code><technical_language>Instead of changes in thsi class, nice a DataSegmentAnnouncer essentially adds lookups getSegmentChangesSince concrete type interface. create a CompositeDataSegmentAnnouncer of call both. endpoint concrete lookup type injected (marked @Nullable intelligent returning a 404 if object is null)</technical_language>

Target:
public BatchDataSegmentAnnouncer( DruidServerMetadata server, final BatchDataSegmentAnnouncerConfig config, ZkPathsConfig zkPaths, Announcer announcer, ObjectMapper jsonMapper ) { this.config = config; this.announcer = announcer; this.jsonMapper = jsonMapper; this.server = server; this.liveSegmentLocation = ZKPaths.makePath(zkPaths.getLiveSegmentsPath(), server.getName()); segmentTransformer = new Function<DataSegment, DataSegment>() { @Override public DataSegment apply(DataSegment input) { DataSegment rv = input; if (config.isSkipDimensionsAndMetrics()) { rv = rv.withDimensions(null).withMetrics(null); } if (config.isSkipLoadSpec()) { rv = rv.withLoadSpec(null); } return rv; } }; if (this.config.isSkipSegmentAnnouncementOnZk()) { dummyZnode = new SegmentZNode("PLACE_HOLDER_ONLY"); } else { dummyZnode = null; } }