auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testExtendedModuleCreated() throws TmfAnalysisException { XmlAnalysisModuleSource source = new XmlAnalysisModuleSource(); <START> Iterable<IAnalysisModuleHelper> modules = source.getAnalysisModules(); <END> File testXmlFile = TmfXmlTestFiles.VALID_FILE_EXTENDED.getFile(); if ((testXmlFile == null) || !testXmlFile.exists()) { fail("XML test file does not exist"); } XmlUtils.addXmlFile(testXmlFile); XmlAnalysisModuleSource.notifyModuleChange(); modules = source.getAnalysisModules(); ITmfTrace trace = XmlUtilsTest.initializeTrace(TEST_TRACE); try { IAnalysisModuleHelper helper = findModule(modules, MY_MODULE); assertNotNull(helper); IAnalysisModule newModule = helper.newModule(trace); try { assertTrue(newModule instanceof ExternalAnalysisModuleStub); assertEquals(MY_MODULE, newModule.getId()); } finally { if (newModule != null) { newModule.dispose(); } } helper = findModule(modules, ABC_MODULE); assertNotNull(helper); newModule = helper.newModule(trace); try { assertTrue(newModule instanceof ExternalAnalysisModuleStub); assertEquals(ABC_MODULE, newModule.getId()); } finally { if (newModule != null) { newModule.dispose(); } } } finally { trace.dispose(); } }</code><technical_language>remove</technical_language>

Target:
public void testExtendedModuleCreated() throws TmfAnalysisException { XmlAnalysisModuleSource source = new XmlAnalysisModuleSource(); File testXmlFile = TmfXmlTestFiles.VALID_FILE_EXTENDED.getFile(); if ((testXmlFile == null) || !testXmlFile.exists()) { fail("XML test file does not exist"); } XmlUtils.addXmlFile(testXmlFile); XmlAnalysisModuleSource.notifyModuleChange(); Iterable<IAnalysisModuleHelper> modules = source.getAnalysisModules(); ITmfTrace trace = XmlUtilsTest.initializeTrace(TEST_TRACE); try { IAnalysisModuleHelper helper = findModule(modules, MY_MODULE); assertNotNull(helper); IAnalysisModule newModule = helper.newModule(trace); try { assertTrue("Extended module class", newModule instanceof ExternalAnalysisModuleStub); assertEquals("Extended module ID", MY_MODULE, newModule.getId()); } finally { if (newModule != null) { newModule.dispose(); } } helper = findModule(modules, ABC_MODULE); assertNotNull(helper); newModule = helper.newModule(trace); try { assertTrue("Extended module class", newModule instanceof ExternalAnalysisModuleStub); assertEquals("Extended module ID", ABC_MODULE, newModule.getId()); } finally { if (newModule != null) { newModule.dispose(); } } } finally { trace.dispose(); } }
Source:
<code>public static boolean isStringAssignable(TypeKind kind, boolean isPrimitive, String in) { NumberFormatValidator validator = VALIDATORS.get( kind ); <START> return validator != null ? validator.validate( isPrimitive, in ) : false; <END> }</code><technical_language>validator != null && validator.validate( isPrimitive, in )</technical_language>

Target:
public static boolean isStringAssignable(TypeKind kind, boolean isPrimitive, String in) { NumberFormatValidator validator = VALIDATORS.get( kind ); return validator != null && validator.validate( isPrimitive, in ); }
Source:
<code><START> protected IMemoryBlockRetrieval createMemoryBlockRetrieval(String model, ILaunchConfiguration config, DsfSession session) { <END> DsfMemoryBlockRetrieval memRetrieval = null; try { memRetrieval = new DsfMemoryBlockRetrieval(model, config, session); } catch (DebugException e) { DsfPlugin.getDefault().getLog().log(e.getStatus()); } return memRetrieval; }</code><technical_language>I this throw DebugException caller deal it. else want do else log error</technical_language>

Target:
protected IMemoryBlockRetrieval createMemoryBlockRetrieval(String model, ILaunchConfiguration config, DsfSession session) throws DebugException { return new DsfMemoryBlockRetrieval(model, config, session); }
Source:
<code>public void unparse( SqlWriter writer, int leftPrec, int rightPrec) { switch (typeName) { case BOOLEAN: writer.keyword( value == null ? "UNKNOWN" : (Boolean) value ? "TRUE" : "FALSE"); break; case NULL: writer.keyword("NULL"); break; case CHAR: case DECIMAL: case DOUBLE: case BINARY: throw Util.unexpected(typeName); case SYMBOL: if (value instanceof Enum) { Enum enumVal = (Enum) value; writer.keyword(enumVal.toString()); } else { writer.keyword(String.valueOf(value)); } break; default: <START> writer.literal(String.valueOf(value)); <END> } }</code><technical_language>over-cautious. is null</technical_language>

Target:
public void unparse( SqlWriter writer, int leftPrec, int rightPrec) { switch (typeName) { case BOOLEAN: writer.keyword( value == null ? "UNKNOWN" : (Boolean) value ? "TRUE" : "FALSE"); break; case NULL: writer.keyword("NULL"); break; case CHAR: case DECIMAL: case DOUBLE: case BINARY: throw Util.unexpected(typeName); case SYMBOL: if (value instanceof Enum) { Enum enumVal = (Enum) value; writer.keyword(enumVal.toString()); } else { writer.keyword(String.valueOf(value)); } break; default: writer.literal(value.toString()); } }
Source:
<code>public void verifyVisibilityUI (PerformTouchAction touchAction) { String LightboxHeaderDisplayValue = lightboxHeader.getCssValue("display"); String LightboxFooterDisplayValue = lightboxFooter.getCssValue("display"); int duration = 500; int waitAfter = 5000; boolean lastDisplayVisibility = true; if (LightboxHeaderDisplayValue.contains(LightboxFooterDisplayValue)) { <START> if (LightboxHeaderDisplayValue == "none") { <END> PageObjectLogging.log("verifyVisibilityUI", "Lightbox header and footer are not visible", true); lastDisplayVisibility = false; } else { PageObjectLogging.log("verifyVisibilityUI", "Lightbox header and footer are visible", true); lastDisplayVisibility = true; } } else { PageObjectLogging.log("verifyVisibilityUI", "Visibility of lightbox header is different than lightbox footer", false); } touchAction.tapOnPointXY(50, 50, duration, waitAfter); lastDisplayVisibility = verifyChangesInUI(lastDisplayVisibility); touchAction.tapOnPointXY(50, 50, duration, waitAfter); lastDisplayVisibility = verifyChangesInUI(lastDisplayVisibility); }</code><technical_language>if a String comparison, needs .equals() I suggest putting String left side avoid NullPointerException</technical_language>

Target:
public void verifyVisibilityUI (PerformTouchAction touchAction) { String LightboxHeaderDisplayValue = lightboxHeader.getCssValue("display"); String LightboxFooterDisplayValue = lightboxFooter.getCssValue("display"); int duration = 500; int waitAfter = 5000; boolean lastDisplayVisibility = true; if (LightboxHeaderDisplayValue.contains(LightboxFooterDisplayValue)) { if ("none".equals(LightboxHeaderDisplayValue)) { PageObjectLogging.log("verifyVisibilityUI", "Lightbox header and footer are not visible", true); lastDisplayVisibility = false; } else { PageObjectLogging.log("verifyVisibilityUI", "Lightbox header and footer are visible", true); lastDisplayVisibility = true; } } else { PageObjectLogging.log("verifyVisibilityUI", "Visibility of lightbox header is different than lightbox footer", false); } touchAction.tapOnPointXY(50, 50, duration, waitAfter); lastDisplayVisibility = verifyChangesInUI(lastDisplayVisibility); touchAction.tapOnPointXY(50, 50, duration, waitAfter); lastDisplayVisibility = verifyChangesInUI(lastDisplayVisibility); }
Source:
<code>public void onExecute(CommandSender sender, String[] args) { if (!(sender instanceof Player) || !(sender.hasPermission("slimefun.command.backpack"))) { SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true); return; } if (args.length != 3) { SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack <Player> <Number>")); return; } Player p = (Player) sender; String ownerName = args[1]; int id = Integer.parseInt(args[2]); <START> OfflinePlayer owner = Bukkit.getPlayer(ownerName); if (owner == null) { owner = Bukkit.getOfflinePlayer(ownerName); <END> if (!owner.hasPlayedBefore()) { SlimefunPlugin.getLocal().sendMessage(sender, "guide.backpack.player-never-joined"); return; } } PlayerProfile.get(owner, profile -> { if (!profile.getBackpack(id).isPresent()) { SlimefunPlugin.getLocal().sendMessage(sender, "guide.backpack.backpack-does-not-exist"); return; } PlayerBackpack bp = profile.getBackpack(id).get(); ItemStack item = SlimefunItems.BACKPACK_MEDIUM; ItemMeta meta = item.getItemMeta(); List lore = meta.getLore(); lore.set(2, ChatColor.GRAY + "ID: " + profile.getUUID().toString() + "#" + id); meta.setLore(lore); item.setItemMeta(meta); Slimefun.runSync(() -> p.getInventory().addItem(item)); }); }</code><technical_language>This is a redundant. Bukkit.getOfflinePlayer(...) return online player if anyway, potentially calling this sense, pretty call Bukkit.getOfflinePlayer(...) right</technical_language>

Target:
public void onExecute(CommandSender sender, String[] args) { if (!(sender instanceof Player) || !sender.hasPermission("slimefun.command.backpack")) { SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true); return; } if (args.length != 3) { SlimefunPlugin.getLocal().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack <Player> <ID>")); return; } final Player p = (Player) sender; if (!PatternUtils.NUMERIC.matcher(args[2]).matches()) { SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.invalid-id"); return; } final int id = Integer.parseInt(args[2]); final OfflinePlayer owner = Bukkit.getOfflinePlayer(args[1]); if (!owner.hasPlayedBefore()) { SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.player-never-joined"); return; } PlayerProfile.get(owner, profile -> { if (!profile.getBackpack(id).isPresent()) { SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.backpack-does-not-exist"); return; } Slimefun.runSync(() -> { ItemStack item = SlimefunItems.RESTORED_BACKPACK.clone(); SlimefunPlugin.getBackpackListener().setBackpackId(p, item, 2, id); p.getInventory().addItem(item); SlimefunPlugin.getLocal().sendMessage(sender, "commands.backpack.restored-backpack-given"); }); }); }
Source:
<code>public static int[] cellsToColumns(List<Cell> cells, int cellsPerColumn) { return cells.stream().mapToInt(c -> c.getColumn().getIndex()).distinct().toArray(); <START> } <END></code><technical_language>This good. Removing a temporary variable heap is a good Cells a reference Columns simplification is great. I remove cellsPerColumn parameter passed in used</technical_language>

Target:
public static int[] cellsToColumns(List<Cell> cells, int cellsPerColumn) { return SDR.asColumnList(cells); }
Source:
<code>public void addMatch(VolcanoRuleMatch match) { final String matchName = match.toString(); if (!matchList.names.add(matchName)) { return; } <START> LOGGER.trace("{} Rule-match queued: {}", matchList.toString(), matchName); <END> matchList.offer(match); matchList.matchMap.put(planner.getSubset(match.rels[0]), match); }</code><technical_language>want log matchlist. Remove argument</technical_language>

Target:
public void addMatch(VolcanoRuleMatch match) { final String matchName = match.toString(); if (!matchList.names.add(matchName)) { return; } LOGGER.trace("Rule-match queued: {}", matchName); matchList.offer(match); matchList.matchMap.put(planner.getSubset(match.rels[0]), match); }
Source:
<code><START> public static void checkArgument(boolean expression, @Nullable Object message) { <END> try { Preconditions.checkArgument(expression, message); } catch (IllegalArgumentException e) { throw new BadRequestException(e.getMessage(), e); } }</code><technical_language>this redundant signature below</technical_language>

Target:
public static void checkArgument(boolean expression, @Nullable Object message) { if (!expression) { throw new BadRequestException(String.valueOf(message)); } }
Source:
<code>public void initialize(Config aConfig, Config aRuntime) { <START> LOG.log(Level.INFO, aRuntime.toString()); <END> this.config = aConfig; this.runtime = aRuntime; this.controller = getController(); this.updateTopologyManager = new UpdateTopologyManager(config, runtime, Optional.<IScalable>of(this)); }</code><technical_language>In issues credentials logged this. change this FINE remove it. If it, good add some sort of contextual logging message</technical_language>

Target:
public void initialize(Config aConfig, Config aRuntime) { this.config = aConfig; this.runtime = aRuntime; this.controller = getController(); this.updateTopologyManager = new UpdateTopologyManager(config, runtime, Optional.<IScalable>of(this)); }
Source:
<code>public void blueprintEvent(BlueprintEvent event) { if (LOG.isDebugEnabled()) { String eventTypeString; switch (event.getType()) { case BlueprintEvent.CREATING: eventTypeString = "CREATING"; break; case BlueprintEvent.CREATED: eventTypeString = "CREATED"; break; case BlueprintEvent.DESTROYING: eventTypeString = "DESTROYING"; break; case BlueprintEvent.DESTROYED: eventTypeString = "DESTROYED"; break; case BlueprintEvent.GRACE_PERIOD: eventTypeString = "GRACE_PERIOD"; break; case BlueprintEvent.WAITING: eventTypeString = "WAITING"; break; case BlueprintEvent.FAILURE: eventTypeString = "FAILURE"; break; default: eventTypeString = "UNKNOWN"; } LOG.debug(String.format("blueprintEvent{ replay=%b type=%s bundle=%s } : ", event.isReplay(), eventTypeString, event.getBundle().getSymbolicName())); } if (!event.isReplay() && this.getBundleContext().getBundle().getBundleId() == event.getBundle().getBundleId()) { if (event.getType() == BlueprintEvent.CREATED) { try { <START> this.start(); <END> } catch (Exception startEx) { LOG.error("Error occurred starting Camel: " + this, startEx); } } else if (event.getType() == BlueprintEvent.DESTROYING) { try { this.stop(); } catch (Exception stopEx) { LOG.warn("Error occurred stopping Camel: " + this, stopEx); } } } }</code><technical_language>code calling maybeStart some checks I using</technical_language>

Target:
public void blueprintEvent(BlueprintEvent event) { if (LOG.isDebugEnabled()) { String eventTypeString; switch (event.getType()) { case BlueprintEvent.CREATING: eventTypeString = "CREATING"; break; case BlueprintEvent.CREATED: eventTypeString = "CREATED"; break; case BlueprintEvent.DESTROYING: eventTypeString = "DESTROYING"; break; case BlueprintEvent.DESTROYED: eventTypeString = "DESTROYED"; break; case BlueprintEvent.GRACE_PERIOD: eventTypeString = "GRACE_PERIOD"; break; case BlueprintEvent.WAITING: eventTypeString = "WAITING"; break; case BlueprintEvent.FAILURE: eventTypeString = "FAILURE"; break; default: eventTypeString = "UNKNOWN"; } LOG.debug(String.format("blueprintEvent{ replay=%b type=%s bundle=%s } : ", event.isReplay(), eventTypeString, event.getBundle().getSymbolicName())); } if (!event.isReplay() && this.getBundleContext().getBundle().getBundleId() == event.getBundle().getBundleId()) { if (event.getType() == BlueprintEvent.CREATED) { try { this.maybeStart(); } catch (Exception startEx) { LOG.error("Error occurred starting Camel: " + this, startEx); } } else if (event.getType() == BlueprintEvent.DESTROYING) { try { this.stop(); } catch (Exception stopEx) { LOG.warn("Error occurred stopping Camel: " + this, stopEx); } } } }
Source:
<code><START> public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { <END> GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(intent); handleSignInResult(result, false); }</code><technical_language>need check requestCode is valid java if (requestCode == RNGoogleSigninModule.RC_SIGN_IN) { ... }</technical_language>

Target:
public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { if (requestCode == RNGoogleSigninModule.RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(intent); handleSignInResult(result, false); } }
Source:
<code>private Iterable<org.atlasapi.media.entity.Image> transformImages(Set<Image> images) { Set<org.atlasapi.media.entity.Image> resultImages = new HashSet<>(); if (images == null) { return resultImages; } <START> for (Image image : images) { <END> org.atlasapi.media.entity.Image transformedImage = new org.atlasapi.media.entity.Image( image.getUri() ); transformedImage.setHeight(image.getHeight()); transformedImage.setWidth(image.getWidth()); if (image.getType() != null) { transformedImage.setType(ImageType.valueOf(image.getImageType().toUpperCase())); } resultImages.add( transformedImage ); } return resultImages; }</code><technical_language>method below; Iterables.transform method</technical_language>

Target:
private Iterable<org.atlasapi.media.entity.Image> transformImages(Set<Image> images) { if (images == null) { return ImmutableList.of(); } return Collections2.transform(images, new Function<Image, org.atlasapi.media.entity.Image>() { @Override public org.atlasapi.media.entity.Image apply(Image input) { org.atlasapi.media.entity.Image transformedImage = new org.atlasapi.media.entity.Image( input.getUri() ); transformedImage.setHeight(input.getHeight()); transformedImage.setWidth(input.getWidth()); if (input.getType() != null) { transformedImage.setType(ImageType.valueOf(input.getImageType().toUpperCase())); } return transformedImage; } }); }
Source:
<code>public void testTopMenuForAnonymousUserShouldNotBeEmpty() { Collection<MenuEntry> menuEntries = gerritTopMenusWithModule(anonymousUserModule).getTopMenuBar(null); <START> assertTrue(!menuEntries.isEmpty()); <END> }</code><technical_language>This like: assertThat(menuEntries).isNotEmpty(); google truth</technical_language>

Target:
public void testTopMenuForAnonymousUserShouldNotBeEmpty() { Collection<MenuEntry> menuEntries = gerritTopMenusWithModule(anonymousUserModule).getTopMenuBar(null); assertThat(menuEntries).isNotEmpty(); }
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_kill_the_virus_tutorials); ButterKnife.bind(this); <START> imgVirus3 = findViewById(R.id.img_virus_3); <END> initializeViews(); }</code><technical_language>findViewById removed butterknife</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_kill_the_virus_tutorial); ButterKnife.bind(this); initializeViews(); }
Source:
<code>private Call createRawCall() { OkHttpClient client = api.client(); <START> if (readTimeout != -1 && connectTimeout != -1) { <END> client = client.newBuilder() .connectTimeout(connectTimeout, TimeUnit.SECONDS) .readTimeout(readTimeout, TimeUnit.SECONDS) .build(); } return client.newCall(builder.request()); }</code><technical_language>I this -1 checks here, please of a nicer comparing != -1. Also, of 2 values is -1 if want set readTimeout for example</technical_language>

Target:
private Call createRawCall() { OkHttpClient client = api.client(); if (readTimeout > 0 && connectTimeout > 0) { client = client.newBuilder() .connectTimeout(connectTimeout, TimeUnit.SECONDS) .readTimeout(readTimeout, TimeUnit.SECONDS) .build(); } return client.newCall(builder.request()); }
Source:
<code>public static String byteArrayToString(byte[] value) { <START> return new String(value); <END> }</code><technical_language>Check if is null</technical_language>

Target:
public static String byteArrayToString(byte[] value) { if (value == null) throw new NullPointerException("Byte array cannot be null."); return new String(value); }
Source:
<code><START> public <T> T fromJson(String json, TypeToken<T> typeOfT) throws JsonSyntaxException { <END> return fromJson(json, typeOfT.getType()); }</code><technical_language>sure, declaring typeOfT covariant TypeToken<? extends T> advantages here</technical_language>

Target:
public <T> T fromJson(String json, TypeToken<T> typeOfT) throws JsonSyntaxException { if (json == null) { return null; } StringReader reader = new StringReader(json); T target = fromJson(reader, typeOfT); return target; }
Source:
<code>public void testQueryElementNoFollowing() throws Exception { final String xpath = " final RootNode rootNode = getRootNode("InputXpathMapperAst.java"); final DetailAST[] actual = convertToArray(getXpathItems(xpath, rootNode)); <START> assertEquals("Invalid number of nodes", 0, actual.length); <END> }</code><technical_language>if code changes, please update assertThat matcher Hamcrest - <LINK_1> , code failure more human friendly - <LINK_0></technical_language>

Target:
public void testQueryElementNoFollowing() throws Exception { final String xpath = " final RootNode rootNode = getRootNode("InputXpathMapperAst.java"); final DetailAST[] actual = convertToArray(getXpathItems(xpath, rootNode)); assertThat("Invalid number of nodes", actual.length, equalTo(0)); }
Source:
<code>public void dispose() { <START> app.getChildren().remove(windowModel); <END> coolBarManager.dispose(); menuManager.dispose(); statusLineManager.dispose(); windowModel.getContext().deactivate(); windowModel.getContext().dispose(); ((Shell) windowModel.getWidget()).dispose(); }</code><technical_language>this move closer end of this method? app remove happen shell is disposed TBR is false</technical_language>

Target:
public void dispose() { coolBarManager.dispose(); menuManager.dispose(); statusLineManager.dispose(); windowModel.getContext().deactivate(); windowModel.getContext().dispose(); ((Shell) windowModel.getWidget()).dispose(); app.getChildren().remove(windowModel); }
Source:
<code>public AMQPClientConnectionFactory(ActiveMQServer server, String containerId, Map<Symbol, Object> connectionProperties, int ttl) { this.server = server; this.containerId = containerId; this.connectionProperties = connectionProperties; this.ttl = ttl; <START> this.useLegacyQueueName = false; <END> }</code><technical_language>I this class is for, other default</technical_language>

Target:
public AMQPClientConnectionFactory(ActiveMQServer server, String containerId, Map<Symbol, Object> connectionProperties, int ttl) { this.server = server; this.containerId = containerId; this.connectionProperties = connectionProperties; this.ttl = ttl; this.useCoreSubscriptionNaming = false; }
Source:
<code>public void handle(MotechEvent event) { LOGGER.info("Handling the motech event with subject: {}", event.getSubject()); Map<String, Object> eventParams = event.getParameters(); eventParams.putAll(event.getMetadata()); retryNumber = 0; TasksEventParser parser = null; if (eventParams != null) { parser = taskService.findCustomParser((String) eventParams.get(TasksEventParser.CUSTOM_PARSER_EVENT_KEY)); } String triggerSubject = parser == null ? event.getSubject() : parser.parseEventSubject(event.getSubject(), eventParams); Map<String, Object> parameters = parser == null ? eventParams : parser.parseEventParameters(event.getSubject(), eventParams); List<Task> tasks = taskService.findActiveTasksForTriggerSubject(triggerSubject); for (Task task : tasks) { <START> handleTask(task, parameters, false, retryNumber); <END> } }</code><technical_language>send retryNumber in event SCHEDULE_REPEATING_JOB metadata. Increment this while handling retry</technical_language>

Target:
public void handle(MotechEvent event) { LOGGER.info("Handling the motech event with subject: {}", event.getSubject()); Map<String, Object> eventParams = event.getParameters(); eventParams.putAll(event.getMetadata()); TasksEventParser parser = null; if (eventParams != null) { parser = taskService.findCustomParser((String) eventParams.get(TasksEventParser.CUSTOM_PARSER_EVENT_KEY)); } String triggerSubject = parser == null ? event.getSubject() : parser.parseEventSubject(event.getSubject(), eventParams); Map<String, Object> parameters = parser == null ? eventParams : parser.parseEventParameters(event.getSubject(), eventParams); List<Task> tasks = taskService.findActiveTasksForTriggerSubject(triggerSubject); for (Task task : tasks) { checkAndHandleTask(task, parameters, false); } }
Source:
<code>public Fails(VdcBllMessages expected, String... variableReplacements) { <START> matcher = CoreMatchers.allOf( <END> not(isValid()), new WithMessage(expected), hasVariableReplacements(variableReplacements)); }</code><technical_language>replace access CoreMatchers.allOf a static import of allOf consistent</technical_language>

Target:
public Fails(VdcBllMessages expected, String... variableReplacements) { matcher = allOf( not(isValid()), new WithMessage(expected), hasVariableReplacements(variableReplacements)); }
Source:
<code>public void rollback() { super.rollback(); if (macAddressChanged) { MacPoolManager.getInstance().addMac(oldIface.getMacAddress()); <START> MacPoolManager.getInstance().freeMac(getInterface().getMacAddress()); <END> } }</code><technical_language>getMacAddress() -> getInterface().getMacAddress() this change</technical_language>

Target:
public void rollback() { super.rollback(); if (macShouldBeChanged) { MacPoolManager.getInstance().addMac(oldIface.getMacAddress()); MacPoolManager.getInstance().freeMac(getMacAddress()); } }
Source:
<code>protected ICalBuilder begin() { cal.addProperty(ICalProperties.BEGIN_ICALENDAR); <START> cal.addProperty(new Property(ICalBean.PROP_VERSION, "2.1")); <END> return this; }</code><technical_language>add constant</technical_language>

Target:
protected ICalBuilder begin() { m_ical.addProperty(ICalProperties.PROP_BEGIN_ICALENDAR); m_ical.addProperty(ICalProperties.PROP_VERSION_2_1); return this; }
Source:
<code>public static RequestDTO jsonNodeToRequest(JsonNode jsonNode) { <START> ObjectMapper mapper = new ObjectMapper(); <END> final RequestDTO requestDTO = mapper.convertValue(jsonNode, RequestDTO.class); return requestDTO; }</code><technical_language>FWIW this is ideal ObjectMapper. change it, common creating new instances, a private static final ObjectMapper OBJECT_MAPPER constant</technical_language>

Target:
public static RequestDTO jsonNodeToRequest(JsonNode jsonNode) { return OBJECT_MAPPER.convertValue(jsonNode, RequestDTO.class); }
Source:
<code>CachedFileChannel loadFileChannel(long logId) throws IOException { lock.readLock().lock(); try { CachedFileChannel cachedFileChannel = fileChannels.get(logId); if (cachedFileChannel != null) { boolean retained = cachedFileChannel.tryRetain(); <START> assert(retained); <END> return cachedFileChannel; } } finally { lock.readLock().unlock(); } lock.writeLock().lock(); try { File file = fileLoader.load(logId); FileChannel newFc = new RandomAccessFile(file, "r").getChannel(); CachedFileChannel cachedFileChannel = new CachedFileChannel(logId, newFc); fileChannels.put(logId, cachedFileChannel); boolean retained = cachedFileChannel.tryRetain(); assert(retained); return cachedFileChannel; } finally { lock.writeLock().unlock(); } }</code><technical_language>assert. get rid of them. a Precondition.check of some sort</technical_language>

Target:
CachedFileChannel loadFileChannel(long logId) throws IOException { CachedFileChannel cachedFileChannel = null; do { fileChannels.computeIfAbsent(logId, logFileId -> { CachedFileChannel cfc = null; try { File file = fileLoader.load(logFileId); FileChannel newFc = new RandomAccessFile(file, "r").getChannel(); cfc = new CachedFileChannel(logFileId, newFc); } catch (IOException ioe){ throw new UncheckedIOException(ioe); } return cfc; }); cachedFileChannel = fileChannels.get(logId); if (cachedFileChannel != null) { boolean retained = cachedFileChannel.tryRetain(); if (!retained) { cachedFileChannel = null; } } } while(cachedFileChannel == null); return cachedFileChannel; }
Source:
<code>public boolean errorOccured(final int status, final String msg, final Object device) { switch (status) { case -1: case 803 : case 902 : warning(status, null); break; case 801 : case 805 : case 815 : case 903 : case 905 : case 1020 : <START> fatalError(status, "Exit the applciation; might have to reboot ISY"); <END> break; case 781 : case 802 : case 813 : case 904 : case 906 : case 907 : case 1021 : case 1022 : case 1023 : case 1024 : case 1025 : case 1026 : case 1050 : case 1051 : case 1100 : case 1200 : case 1301 : offLine(status, device); break; case 604 : case 701 : case 1000 : case 4000 : case 5000 : case 5001 : case 9000 : humanInterventionRequired(status, null); offLine(status, device); break; } return false; }</code><technical_language>"application" Also, of conditions sound references ISY device itself. binding code include retry logic? quick search for find any, I right terms</technical_language>

Target:
public boolean errorOccured(final int status, final String msg, final Object device) { switch (status) { case -1: case 803 : case 902 : warning(status, null); break; case 801 : case 805 : case 815 : case 903 : case 905 : case 1020 : fatalError(status, "Exit the application; might have to reboot ISY"); break; case 781 : case 802 : case 813 : case 904 : case 906 : case 907 : case 1021 : case 1022 : case 1023 : case 1024 : case 1025 : case 1026 : case 1050 : case 1051 : case 1100 : case 1200 : case 1301 : offLine(status, device); break; case 604 : case 701 : case 1000 : case 4000 : case 5000 : case 5001 : case 9000 : humanInterventionRequired(status, null); offLine(status, device); break; } return false; }
Source:
<code><START> public void onChunkPrePopulate(PopulateChunkEvent.Pre event) { <END> World world = (World) event.world; int chunkStartX = event.chunkX; int chunkStartZ = event.chunkZ; Chunk chunk = (Chunk) event.chunkProvider.provideChunk(event.chunkX, event.chunkZ); if (chunk == null) { throw new NullPointerException("Failed to populate chunk at (" + event.chunkX + "," + event.chunkZ + ")"); } for (Populator populator : ((SpongeWorldGenerator) world.getWorldGenerator()).accessPopulators()) { populator.populate(chunk, event.rand); } for (Populator populator : world.getBiome(chunkStartX + 15, chunkStartZ + 15).getPopulators()) { populator.populate(chunk, event.rand); } }</code><technical_language>run other mods do some tweaking based results in PRE event</technical_language>

Target:
public void onChunkPrePopulate(PopulateChunkEvent.Pre event) { World world = (World) event.world; int chunkStartX = event.chunkX; int chunkStartZ = event.chunkZ; Chunk chunk = (Chunk) event.chunkProvider.provideChunk(event.chunkX, event.chunkZ); if (chunk == null) { throw new NullPointerException("Failed to populate chunk at (" + event.chunkX + "," + event.chunkZ + ")"); } for (Populator populator : ((IMixinWorld) world).getPopulators()) { populator.populate(chunk, event.rand); } for (Populator populator : world.getBiome(chunkStartX + 15, chunkStartZ + 15).getPopulators()) { populator.populate(chunk, event.rand); } }
Source:
<code>private void handleOpenTabIntent(Intent intent) { String tabIdentifier = intent.getStringExtra(ARG_OPEN_TAB); <START> if (StringUtils.isNotBlank(tabIdentifier)) { <END> switch (tabIdentifier) { case ARG_NOTIFICATIONS: mViewPager.setCurrentItem(WPMainTabAdapter.TAB_NOTIFS); break; } } else { AppLog.e(T.MAIN, "WPMainActivity.handleOpenIntent called with an invalid argument."); } }</code><technical_language>minor nit, generally rely !TextUtils.isEmpty() for this</technical_language>

Target:
private void handleOpenTabIntent(Intent intent) { String tabIdentifier = intent.getStringExtra(ARG_OPEN_TAB); if (!TextUtils.isEmpty(tabIdentifier)) { switch (tabIdentifier) { case ARG_NOTIFICATIONS: mViewPager.setCurrentItem(WPMainTabAdapter.TAB_NOTIFS); break; } } else { AppLog.e(T.MAIN, "WPMainActivity.handleOpenIntent called with an invalid argument."); } }
Source:
<code>private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = <START> DbFacade.getInstance().getAsyncTaskDao().getAll(); <END> Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled() && x.getCommandStatus() == CommandStatus.ACTIVE && !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); }</code><technical_language>please injection instead of static access</technical_language>

Target:
private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Stream<AsyncTask> taskStream = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null); Set<Guid> asyncTaskManagerManagedCommands = taskStream .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(taskStream .map(x -> x.getCommandId()).collect(Collectors.toSet())); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); }
Source:
<code>public void testLogToFile() throws IOException { <START> final File logFile = File.createTempFile(getClass().getSimpleName(), ".tmp"); <END> logFile.deleteOnExit(); Log.setGlobalPrintStream(new PrintStream(new FileOutputStream(logFile.getPath(), true))); final String words = "Hello World"; log.info(words); final List<String> list = Files.readAllLines(logFile.toPath()); Assert.assertEquals(list.size(), 1); Assert.assertTrue(list.get(0).contains(words)); }</code><technical_language>Wrap this in a try-with-resources finally{} 1. print stream is closed 2. Capture original global logger reset in finally</technical_language>

Target:
public void testLogToFile() throws IOException { final File logFile = File.createTempFile(getClass().getSimpleName(), ".tmp"); logFile.deleteOnExit(); final Log.LogLevel originalLogLevel = Log.getGlobalLogLevel(); final PrintStream originalStream = Log.getGlobalPrintStream(); try (final PrintStream stream = new PrintStream(new FileOutputStream(logFile.getPath(), true))) { Log.setGlobalPrintStream(stream); Log.setGlobalLogLevel(Log.LogLevel.DEBUG); final String words = "Hello World"; log.info(words); final List<String> list = Files.readAllLines(logFile.toPath()); Assert.assertEquals(Log.getGlobalLogLevel(), Log.LogLevel.DEBUG); Assert.assertEquals(list.size(), 1); Assert.assertTrue(list.get(0).contains(words)); } finally { Log.setGlobalLogLevel(originalLogLevel); Log.setGlobalPrintStream(originalStream); } }
Source:
<code>protected @NonNull List<IMarkerEvent> getViewMarkerList(long startTime, long endTime, long resolution, @NonNull IProgressMonitor monitor) { ITimeGraphEntry[] expandedElements = getTimeGraphViewer().getExpandedElements(); List<IMarkerEvent> markers = new ArrayList<>(); for (ITimeGraphEntry element : expandedElements) { if (((TimeGraphEntry) element).getModel() instanceof SpanLifeEntryModel) { SpanLifeEntryModel model = (SpanLifeEntryModel) ((TimeGraphEntry) element).getModel(); for (LogEvent log : model.getLogs()) { markers.add(new SpanMarkerEvent(element, log.fTime, MARKER_COLOR, log.fType)); <START> END> } } } return markers; }</code><technical_language>please remove</technical_language>

Target:
protected @NonNull List<IMarkerEvent> getViewMarkerList(long startTime, long endTime, long resolution, @NonNull IProgressMonitor monitor) { ITimeGraphEntry[] expandedElements = getTimeGraphViewer().getExpandedElements(); List<IMarkerEvent> markers = new ArrayList<>(); for (ITimeGraphEntry element : expandedElements) { if (((TimeGraphEntry) element).getModel() instanceof SpanLifeEntryModel) { SpanLifeEntryModel model = (SpanLifeEntryModel) ((TimeGraphEntry) element).getModel(); for (LogEvent log : model.getLogs()) { markers.add(new SpanMarkerEvent(element, log.getTime(), MARKER_COLOR, log.getType())); } } } return markers; }
Source:
<code>public static Iterable<Diff> getAssociatedDiffs(final Diff diffRoot, Iterable<Diff> subDiffs, boolean leftToRight) { <START> return null; <END> }</code><technical_language>return Collections.emptyList()</technical_language>

Target:
public static Iterable<Diff> getAssociatedDiffs(final Diff diffRoot, Iterable<Diff> subDiffs, boolean leftToRight) { return Collections.emptyList(); }
Source:
<code><START> private void preCheckPermission() throws IOException, AccessControlException { <END> if (shouldIgnorePreCheckPermission()) { return; } Path hbaseDir = FSUtils.getRootDir(getConf()); FileSystem fs = hbaseDir.getFileSystem(getConf()); UserProvider userProvider = UserProvider.instantiate(getConf()); UserGroupInformation ugi = userProvider.getCurrent().getUGI(); FileStatus[] files = fs.listStatus(hbaseDir); for (FileStatus file : files) { try { fs.access(file.getPath(), FsAction.WRITE); } catch (AccessControlException ace) { LOG.warn("Got AccessDeniedException when preCheckPermission ", ace); errors.reportError(ERROR_CODE.WRONG_USAGE, "Current user " + ugi.getUserName() + " does not have write perms to " + file.getPath() + ". Please rerun hbck as hdfs user " + file.getOwner()); throw ace; } } }</code><technical_language>AccessControlException is a subclass of IOE. I guess need declare in thrown list</technical_language>

Target:
private void preCheckPermission() throws IOException { if (shouldIgnorePreCheckPermission()) { return; } Path hbaseDir = FSUtils.getRootDir(getConf()); FileSystem fs = hbaseDir.getFileSystem(getConf()); UserProvider userProvider = UserProvider.instantiate(getConf()); UserGroupInformation ugi = userProvider.getCurrent().getUGI(); FileStatus[] files = fs.listStatus(hbaseDir); for (FileStatus file : files) { try { fs.access(file.getPath(), FsAction.WRITE); } catch (AccessControlException ace) { LOG.warn("Got AccessDeniedException when preCheckPermission ", ace); errors.reportError(ERROR_CODE.WRONG_USAGE, "Current user " + ugi.getUserName() + " does not have write perms to " + file.getPath() + ". Please rerun hbck as hdfs user " + file.getOwner()); throw ace; } } }
Source:
<code>public ElementData render() { ElementData result = new ElementData("Differential privacy"); result.addProperty("Epsilon", epsilon); result.addProperty("Delta", delta); <START> result.addProperty("Uniqueness threshold (k)", getK()); <END> result.addProperty("Sampling probability (beta)", getBeta()); return result; }</code><technical_language>Catch exception</technical_language>

Target:
public ElementData render() { ElementData result = new ElementData("Differential privacy"); result.addProperty("Epsilon", epsilon); result.addProperty("Delta", delta); try { result.addProperty("Uniqueness threshold (k)", getK()); result.addProperty("Sampling probability (beta)", getBeta()); } catch (Exception e) { } return result; }
Source:
<code>public FatekColorItem(Item item, List<String> confItems) throws BindingConfigParseException { super(item, confItems); step = getParamsFromConfAsInt(confItems, "step", 5); if (confItems.size() < 3 || confItems.size() > 5) { throw new BindingConfigParseException( <START> "Incorect binding for color item- should be: plcName:R1:R2:R3[:R4][:RGB|HSB]"); <END> } try { reg1 = Reg.parse(confItems.get(0)); reg2 = Reg.parse(confItems.get(1)); reg3 = Reg.parse(confItems.get(2)); } catch (UnknownRegNameException e) { throw new BindingConfigParseException(e.getMessage()); } if (confItems.size() == 4) { try { reg4 = Reg.parse(confItems.get(3)); } catch (UnknownRegNameException e) { initColorMode(confItems.get(3)); } } if (confItems.size() == 5) { try { reg4 = Reg.parse(confItems.get(3)); } catch (UnknownRegNameException e) { throw new BindingConfigParseException(e.getMessage()); } initColorMode(confItems.get(4)); } if (reg1.isDiscrete() || reg2.isDiscrete() || reg3.isDiscrete()) { throw new BindingConfigParseException( "Please use data reg for color item"); } }</code><technical_language>"Incorrect"</technical_language>

Target:
public FatekColorItem(Item item, List<String> confItems) throws BindingConfigParseException { super(item, confItems); step = getParamsFromConfAsInt(confItems, "step", 5); if (confItems.size() < 3 || confItems.size() > 5) { throw new BindingConfigParseException( "Incorrect binding for color item - should be: plcName:R1:R2:R3[:R4][:RGB|HSB]"); } try { reg1 = Reg.parse(confItems.get(0)); reg2 = Reg.parse(confItems.get(1)); reg3 = Reg.parse(confItems.get(2)); } catch (UnknownRegNameException e) { throw new BindingConfigParseException(e.getMessage()); } if (confItems.size() == 4) { try { reg4 = Reg.parse(confItems.get(3)); } catch (UnknownRegNameException e) { initColorMode(confItems.get(3)); } } if (confItems.size() == 5) { try { reg4 = Reg.parse(confItems.get(3)); } catch (UnknownRegNameException e) { throw new BindingConfigParseException(e.getMessage()); } initColorMode(confItems.get(4)); } if (reg1.isDiscrete() || reg2.isDiscrete() || reg3.isDiscrete()) { throw new BindingConfigParseException( "Please use data reg for color item"); } }
Source:
<code>ListenableFuture<HeaderCacheElement> asyncRefresh() { if (isAppEngine) { SettableFuture<HeaderCacheElement> f = SettableFuture.create(); try { f.set(syncRefresh()); <START> } catch (Exception e) { <END> f.setException(e); } return f; } synchronized (this.isRefreshing) { if (!this.isRefreshing.compareAndSet(false, true)) { this.futureToken = executor.submit(new Callable<HeaderCacheElement>() { @Override public HeaderCacheElement call() throws Exception { HeaderCacheElement newToken = refreshCredentialsWithRetry(); synchronized (RefreshingOAuth2CredentialsInterceptor.this) { headerCache.set(newToken); futureToken = null; isRefreshing.set(false); } return newToken; } }); } return this.futureToken; } }</code><technical_language>Throwable instead of Exception</technical_language>

Target:
ListenableFuture<HeaderCacheElement> asyncRefresh() { if (isAppEngine) { SettableFuture<HeaderCacheElement> f = SettableFuture.create(); try { f.set(syncRefresh()); } catch (Exception e) { f.setException(e); } return f; } synchronized (this.isRefreshing) { if (!this.isRefreshing.compareAndSet(false, true)) { this.futureToken = executor.submit(new Callable<HeaderCacheElement>() { @Override public HeaderCacheElement call() throws Exception { try { HeaderCacheElement newToken = refreshCredentialsWithRetry(); headerCache.set(newToken); return newToken; } finally { synchronized (isRefreshing) { futureToken = null; isRefreshing.set(false); } } } }); } return this.futureToken; } }
Source:
<code>public AssignmentHandler(TabletServer server, KeyExtent extent, int retryAttempt) { this.server = server; <START> this.onlineTablets = server.getOnlineTabletsRaw(); this.unopenedTablets = server.getUnopenedTablets(); this.openingTablets = server.getOpeningTablets(); <END> this.extent = extent; this.retryAttempt = retryAttempt; }</code><technical_language>create new variables, methods, assignments for these, simpler original's package-private, AssignmentHandler access TabletServer. reference objects TabletServer more obvious evaluating synchronization, referring objects, a new object returned new methods. (Which prevent breakage preventing ability change implementation of new methods.)</technical_language>

Target:
public AssignmentHandler(TabletServer server, KeyExtent extent, int retryAttempt) { this.server = server; this.extent = extent; this.retryAttempt = retryAttempt; }
Source:
<code>public File move(File source, File target) throws IOException { if (target.isDirectory()) { <START> Path path = Files.move(source.toPath(), Paths.get(target.getAbsolutePath(), source.getName()), <END> ATOMIC_MOVE); return path.toFile(); } this.renameFile(source, target); return target; }</code><technical_language>this method of target type</technical_language>

Target:
public File move(File source, File target) throws IOException { if (target.isDirectory()) { Path path = Files.move(source.toPath(), Paths.get(target.getAbsolutePath(), source.getName()), ATOMIC_MOVE); return path.toFile(); } Path path = Files.move(source.toPath(), target.toPath(), ATOMIC_MOVE); return path.toFile(); }
Source:
<code>public ActivityCenterResponseDto getAppActivityCenterResponseData(String loginName, Source source, Integer index, Integer pageSize) { List<ActivityModel> activityModels = activityMapper.findOperatingActivities(source); List<ActivityCenterDataDto> activityCenterDataDtos = new ArrayList<>(); for (ActivityModel activityModel : activityModels) { activityCenterDataDtos.add(new ActivityCenterDataDto(activityModel)); } ActivityCenterResponseDto activityCenterResponseDto = new ActivityCenterResponseDto(); activityCenterResponseDto.setIndex(index); activityCenterResponseDto.setPageSize(pageSize); activityCenterResponseDto.setTotalCount(activityCenterDataDtos.size()); if (null == index || null == pageSize) { activityCenterResponseDto.setActivities(activityCenterDataDtos); } else { <START> List<ActivityCenterDataDto> results = new ArrayList<>(); <END> for (int startIndex = (index - 1) * pageSize, endIndex = index * pageSize <= activityCenterDataDtos.size() ? index * pageSize : activityCenterDataDtos.size(); startIndex < endIndex; ++startIndex) { results.add(activityCenterDataDtos.get(startIndex)); } activityCenterResponseDto.setActivities(results); } return activityCenterResponseDto; }</code><technical_language>db pagination</technical_language>

Target:
public ActivityCenterResponseDto getAppActivityCenterResponseData(String loginName, Source source, Integer index, Integer pageSize) { if (null == index) { index = 1; } if (null == pageSize) { pageSize = 10; } List<ActivityModel> activityModels = activityMapper.findActiveActivities(source, (index - 1) * pageSize, pageSize); List<ActivityCenterDataDto> activityCenterDataDtos = new ArrayList<>(); for (ActivityModel activityModel : activityModels) { activityCenterDataDtos.add(new ActivityCenterDataDto(activityModel)); } ActivityCenterResponseDto activityCenterResponseDto = new ActivityCenterResponseDto(); activityCenterResponseDto.setIndex(index); activityCenterResponseDto.setPageSize(pageSize); activityCenterResponseDto.setTotalCount(activityMapper.countActiveActivities(source)); activityCenterResponseDto.setActivities(activityCenterDataDtos); return activityCenterResponseDto; }
Source:
<code>Optional<ResponseConstructor> get(Class<? extends Response<?>> responseClass) { if (!this.cache.containsKey(responseClass)) { <START> this.cache.put(responseClass, Arrays.stream(responseClass.getDeclaredConstructors()) <END> .filter(constructor -> { int paramCount = constructor.getParameterCount(); return paramCount >= 3 && paramCount <= 5; }) .sorted(Comparator.comparingInt(Constructor::getParameterCount)) .findFirst() .flatMap(constructor -> { try { MethodHandles.Lookup lookup = MethodHandles.lookup(); MethodHandle ctrMethodHandle = lookup.unreflectConstructor(constructor); switch (constructor.getParameterCount()) { case 3: Object f3 = LambdaMetafactory.metafactory(lookup, "apply", MethodType.methodType(Response3.class), MethodType.methodType(Object.class, Object.class, int.class, Object.class), ctrMethodHandle, ctrMethodHandle.type()).getTarget().invoke(); return Optional.of(new ResponseConstructor(3, f3)); case 4: Object f4 = LambdaMetafactory.metafactory(lookup, "apply", MethodType.methodType(Response4.class), MethodType.methodType(Object.class, Object.class, int.class, Object.class, Object.class), ctrMethodHandle, ctrMethodHandle.type()).getTarget().invoke(); return Optional.of(new ResponseConstructor(4, f4)); case 5: Object f5 = LambdaMetafactory.metafactory(lookup, "apply", MethodType.methodType(Response5.class), MethodType.methodType(Object.class, Object.class, int.class, Object.class, Object.class, Object.class), ctrMethodHandle, ctrMethodHandle.type()) .getTarget().invoke(); return Optional.of(new ResponseConstructor(5, f5)); default: return Optional.empty(); } } catch (Throwable t) { throw logger.logExceptionAsError(new RuntimeException(t)); } })); } return this.cache.get(responseClass); }</code><technical_language>Thoughts making cache key a tuple of Class-ParamCount more granular caching</technical_language>

Target:
ResponseConstructor get(Class<? extends Response<?>> responseClass) { return this.cache.computeIfAbsent(responseClass, this::locateResponseConstructor); }
Source:
<code>public abstract void run() throws Exception; @Override public String toString() { <START> return "ZkEvent[description: " + _description + "; session: " + _sessionId + "]"; <END> }</code><technical_language>Nit: String.format</technical_language>

Target:
public abstract void run() throws Exception; @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ZkEvent[description: ").append(_description); if (_sessionId != null) { sb.append("; session: ").append(_sessionId); } sb.append("]"); return sb.toString(); }