auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int[] indexPage(Page page) { Work<GroupByIdBlock> work = hash.getGroupIds(page); <START> verify(work.process()); <END> GroupByIdBlock groupIds = work.getResult(); int[] indexes = new int[page.getPositionCount()]; for (int i = 0; i < indexes.length; i++) { indexes[i] = toIntExact(groupIds.getGroupId(i)); } return indexes; }</code><technical_language>clear is responsible for calling process. Is creates work it? add yielding i guess store work a field, call process here. creates work call process</technical_language>

Target:
public int[] indexPage(Page page) { Work<GroupByIdBlock> work = hash.getGroupIds(page); boolean done = work.process(); verify(done); GroupByIdBlock groupIds = work.getResult(); int[] indexes = new int[page.getPositionCount()]; for (int i = 0; i < indexes.length; i++) { indexes[i] = toIntExact(groupIds.getGroupId(i)); } return indexes; }
Source:
<code><START> public void instructionsToMoveWestAndNorth() { <END> Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH); robot.simulate("LAAARALA"); GridPosition expectedGridPosition = new GridPosition(-4, 1); Orientation expectedOrientation = Orientation.WEST; assertEquals(robot.getGridPosition(), expectedGridPosition); assertEquals(robot.getOrientation(), expectedOrientation); }</code><technical_language>I a test this "instructions move east north" in canonical data</technical_language>

Target:
public void instructionsToMoveWestAndNorth() { Robot robot = new Robot(new GridPosition(0, 0), Orientation.NORTH); robot.simulate("LAAARALA"); GridPosition expectedGridPosition = new GridPosition(-4, 1); Orientation expectedOrientation = Orientation.WEST; assertEquals(expectedGridPosition, robot.getGridPosition()); assertEquals(expectedOrientation, robot.getOrientation()); }
Source:
<code>public void getDuplicatePatientsByAttributes_shouldThrowAnAPIExceptionIfAttributesIsNull() { <START> List<String> attributes = null; <END> patientService.getDuplicatePatientsByAttributes(attributes); }</code><technical_language>if do need variable assertions inline patientService.getDuplicatePatientsByAttributes(null);</technical_language>

Target:
public void getDuplicatePatientsByAttributes_shouldThrowAnAPIExceptionIfAttributesIsNull() { expectedException.expect(APIException.class); expectedException.expectMessage(NULL_ERROR_MESSAGE_FOR_ATTRIBUTES_NULL); patientService.getDuplicatePatientsByAttributes(null); }
Source:
<code><START> private void verifyVariable(String variableKey, String variableValue) { <END> int i = 0; searchService.searchEntry(variableKey, results -> assertTrue("It seems like variable <" + variableKey + ", " + variableValue + "> is not present in results", results.stream() .filter(entry -> variableKey.equals(entry.getKey()) && variableValue.equals(entry.getValue())) .findFirst() .isPresent())); }</code><technical_language>Variable i is used</technical_language>

Target:
private void verifyVariable(String variableKey, String variableValue) { int i = 0; searchService.searchEntry(variableKey, results -> assertTrue("It seems like variable <" + variableKey + ", " + variableValue + "> is not present in results", results.stream() .anyMatch(entry -> variableKey.equals(entry.getKey()) && variableValue.equals(entry.getValue())))); }
Source:
<code>public static boolean isLightEmitting(final Material material) { switch (material) { case GLOWSTONE: case TORCH: case SEA_LANTERN: case BEACON: case REDSTONE_LAMP: case REDSTONE_TORCH: case MAGMA_BLOCK: case LAVA: case JACK_O_LANTERN: <START> case END_ROD: <END> return true; default: return false; } }</code><technical_language>need add new light-emitting blocks here. consists of Crying Obsidian, Respawn Anchor (when charged), Shroomlight, soul fire blocks</technical_language>

Target:
public static boolean isLightEmitting(final Material material) { switch (material) { case GLOWSTONE: case TORCH: case SEA_LANTERN: case BEACON: case REDSTONE_LAMP: case REDSTONE_TORCH: case MAGMA_BLOCK: case LAVA: case JACK_O_LANTERN: case CRYING_OBSIDIAN: case SHROOMLIGHT: case CAMPFIRE: case SOUL_CAMPFIRE: case SOUL_TORCH: case LANTERN: case CONDUIT: case RESPAWN_ANCHOR: case BROWN_MUSHROOM: case BREWING_STAND: case ENDER_CHEST: case END_PORTAL_FRAME: case END_ROD: return true; default: return false; } }
Source:
<code>private Command addEcorePathIfRequired( final VTViewTemplate template, final EditingDomain domain, Command command, EObject view) { if (view == null) { return command; } <START> for (final String ecorePaths : VView.class.cast(view).getEcorePaths()) { <END> if (template.getReferencedEcores().contains(ecorePaths)) { continue; } final Command ecorePathCommand = AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_ReferencedEcores(), ecorePaths); command = new CompoundCommand(Arrays.asList(command, ecorePathCommand)); } return command; }</code><technical_language>fix code produce compoundcommand</technical_language>

Target:
private Command addEcorePathIfRequired( final VTViewTemplate template, final EditingDomain domain, Command command, EObject view) { if (view == null) { return command; } final List<Command> ecorePathCommands = new ArrayList<Command>(); ecorePathCommands.add(command); for (final String ecorePaths : VView.class.cast(view).getEcorePaths()) { if (template.getReferencedEcores().contains(ecorePaths)) { continue; } ecorePathCommands.add( AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_ReferencedEcores(), ecorePaths)); } if (ecorePathCommands.size() > 1) { return new CompoundCommand(ecorePathCommands); } return command; }
Source:
<code>public void handleStateChanged(Watcher.Event.KeeperState state) { <START> } <END></code><technical_language>In situation, session reestablished, handleNewSession get invoked. So, handleStateChanged state EXPIRY needs handled</technical_language>

Target:
public void handleStateChanged(Watcher.Event.KeeperState state) { if (state == Watcher.Event.KeeperState.Expired) { LOG.info("ZkStateChangeListener::Session expired."); if (_assignmentList != null) { _assignmentList.close(); _assignmentList = null; } } }
Source:
<code>public int getUpdatedSwitchColor() { int color; switch (baseTheme) { case DARK_THEME: color = getColor(R.color.md_dark_background); break; case AMOLED_THEME: <START> color = getColor(R.color.md_brown_300); <END> break; case LIGHT_THEME: default: color = getColor(R.color.md_light_background); } return color; }</code><technical_language>check material color guide get a more interactive interesting color</technical_language>

Target:
public int getUpdatedSwitchColor() { int color; switch (baseTheme) { case DARK_THEME: color = getColor(R.color.md_dark_background); break; case AMOLED_THEME: color = getColor(R.color.md_blue_grey_900); break; case LIGHT_THEME: default: color = getColor(R.color.md_light_background); } return color; }
Source:
<code>private void serveFile(HttpExchange exchange, File file) throws IOException { Headers headers = exchange.getResponseHeaders(); headers.set("Content-Description", "File Transfer"); headers.set("Content-Type", "application/octet-stream"); headers.set("Content-Disposition", "attachment; filename=" + file.getName()); headers.set("Expires", "0"); headers.set("Cache-Control", "must-revalidate"); headers.set("Pragma", "public"); exchange.sendResponseHeaders(200, file.length()); OutputStream out = exchange.getResponseBody(); <START> byte[] buf = new byte[8192]; <END> InputStream in = new FileInputStream(file); int c = 0; while ((c = in.read(buf, 0, buf.length)) > 0) { out.write(buf, 0, c); } out.close(); in.close(); }</code><technical_language>file.length() dynamic</technical_language>

Target:
private void serveFile(HttpExchange exchange, File file) throws IOException { OutputStream out = exchange.getResponseBody(); if (file.exists()) { Debug.log(file.toString() + " exists, serving..."); Headers headers = exchange.getResponseHeaders(); headers.set("Content-Description", "File Transfer"); headers.set("Content-Type", "application/octet-stream"); headers.set("Content-Disposition", "attachment; filename=" + file.getName()); headers.set("Expires", "0"); headers.set("Cache-Control", "must-revalidate"); headers.set("Pragma", "public"); exchange.sendResponseHeaders(200, file.length()); byte[] buf = new byte[64*1024]; InputStream in = new FileInputStream(file); int c = 0; while ((c = in.read(buf, 0, buf.length)) > 0) { out.write(buf, 0, c); } in.close(); } else { Debug.log(file.toString() + " does not exist, failing..."); byte resp = ("404 Not Found").getBytes(); exchange.getResponseHeaders().set("Content-Type", "text/plain"); exchange.sendResponseHeaders(StatusCode.NOT_FOUND, resp.length); out.write(resp); } out.close(); }
Source:
<code>public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { MCScoreboard s; if (args.length == 0) { s = getBoard(MAIN, t); } else { s = getBoard(args[0].val(), t); } CArray ret = new CArray(t); for (MCTeam team : s.getTeams()) { CArray to = CArray.GetAssociativeArray(t); to.set("name", new CString(team.getName(), t), t); to.set("displayname", new CString(team.getDisplayName(), t), t); to.set("prefix", new CString(team.getPrefix(), t), t); to.set("suffix", new CString(team.getSuffix(), t), t); to.set("size", new CInt(team.getSize(), t), t); CArray ops = CArray.GetAssociativeArray(t); ops.set("friendlyfire", CBoolean.get(team.allowFriendlyFire()), t); ops.set("friendlyinvisibles", CBoolean.get(team.canSeeFriendlyInvisibles()), t); if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_8)) { ops.set("nametagvisibility", new CString(team.getNameTagVisibility().name(), t), t); } <START> if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_9_4)) { <END> ops.set("collisionrule", new CString(team.getOption(MCOption.COLLISION_RULE).name(), t), t); ops.set("deathmessagevisibility", new CString(team.getOption(MCOption.DEATH_MESSAGE_VISIBILITY).name(), t), t); } to.set("options", ops, t); CArray pl = new CArray(t); for (String entry : team.getEntries()) { pl.push(new CString(entry, t), t); } to.set("players", pl, t); ret.push(to, t); } return ret; }</code><technical_language>This MCVersion.MC1_9, in other function</technical_language>

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { MCScoreboard s; if (args.length == 0) { s = getBoard(MAIN, t); } else { s = getBoard(args[0].val(), t); } CArray ret = new CArray(t); for (MCTeam team : s.getTeams()) { CArray to = CArray.GetAssociativeArray(t); to.set("name", new CString(team.getName(), t), t); to.set("displayname", new CString(team.getDisplayName(), t), t); to.set("prefix", new CString(team.getPrefix(), t), t); to.set("suffix", new CString(team.getSuffix(), t), t); to.set("size", new CInt(team.getSize(), t), t); CArray ops = CArray.GetAssociativeArray(t); ops.set("friendlyfire", CBoolean.get(team.allowFriendlyFire()), t); ops.set("friendlyinvisibles", CBoolean.get(team.canSeeFriendlyInvisibles()), t); if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_8)) { ops.set("nametagvisibility", new CString(team.getNameTagVisibility().name(), t), t); } if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_9)) { ops.set("collisionrule", new CString(team.getOption(MCOption.COLLISION_RULE).name(), t), t); ops.set("deathmessagevisibility", new CString(team.getOption(MCOption.DEATH_MESSAGE_VISIBILITY).name(), t), t); } to.set("options", ops, t); CArray pl = new CArray(t); for (String entry : team.getEntries()) { pl.push(new CString(entry, t), t); } to.set("players", pl, t); ret.push(to, t); } return ret; }
Source:
<code>static Block2BlockwiseStatus forOutboundResponse(final Exchange exchange, final Response response, final int preferredBlockSize) { Block2BlockwiseStatus status = new Block2BlockwiseStatus(response.getOptions().getContentFormat()); status.response = response; <START> status.buf = ByteBuffer.allocate(response.getPayloadSize()); <END> status.buf.put(response.getPayload()); status.buf.flip(); if (response.isNotification()) { status.observe = response.getOptions().getObserve(); } status.setCurrentSzx(determineResponseBlock2Szx(exchange, preferredBlockSize)); return status; }</code><technical_language>othe constructor base class allocate</technical_language>

Target:
static Block2BlockwiseStatus forOutboundResponse(final Exchange exchange, final Response response, final int preferredBlockSize) { Block2BlockwiseStatus status = new Block2BlockwiseStatus(response.getPayloadSize(), response.getOptions().getContentFormat()); status.response = response; status.buf.put(response.getPayload()); status.buf.flip(); if (response.isNotification()) { status.observe = response.getOptions().getObserve(); } status.setCurrentSzx(determineResponseBlock2Szx(exchange, preferredBlockSize)); return status; }
Source:
<code>public UnorderedDistinctMap() { resultSet = new HashSet<>(); <START> mapper = new ObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); <END> }</code><technical_language>ditto, ObjectMapper instantiation is expensive. a static one. create UnorderedDistinctMap.OBJECT_MAMMER</technical_language>

Target:
public UnorderedDistinctMap() { resultSet = Collections.newSetFromMap(new ConcurrentHashMap<>()); }
Source:
<code>protected void add(Node n, Context ctx) { <START> if (n == null) return; <END> maybeAddNewline(n); String comment = nodeComments.getComment(n); if (comment != null) { add(comment); add("\n"); } if (maybeOverrideCodeGen(n)) { return; } super.add(n, ctx); switch (n.getToken()) { case MEMBER_VARIABLE_DEF: if (n.hasChildren()) { add(" = "); add(n.getLastChild()); } break; case NEW: if (n.hasOneChild()) { add("()"); } break; default: break; } }</code><technical_language>some standard dump a stack trace</technical_language>

Target:
protected void add(Node n, Context ctx) { maybeAddNewline(n); String comment = nodeComments.getComment(n); if (comment != null) { add(comment); add("\n"); } if (maybeOverrideCodeGen(n)) { return; } super.add(n, ctx); switch (n.getToken()) { case MEMBER_VARIABLE_DEF: if (n.hasChildren()) { add(" = "); add(n.getLastChild()); } break; case NEW: if (n.hasOneChild()) { add("()"); } break; default: break; } }
Source:
<code>private static Request consume(final Request req) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); new RqPrint(req).printBody(baos); <START> return new RqOf( <END> req::head, () -> new ByteArrayInputStream(baos.toByteArray()) ); }</code><technical_language>@fanifieiev above</technical_language>

Target:
private static Request consume(final Request req) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); new RqPrint(req).printBody(baos); return new RequestOf( req::head, () -> new ByteArrayInputStream(baos.toByteArray()) ); }
Source:
<code>public @Nullable Object resolve(ITmfEvent event) { ITmfEventField field; <START> if (fFieldArray.length == 1) { <END> field = event.getContent().getField(fFieldArray[0]); } else { field = event.getContent().getSubField(fFieldArray); } if (field == null) { return null; } return field.getValue(); }</code><technical_language>I this is needed. If pass array of size 1 getSubField, in for loop calls getField(string). "else" clause</technical_language>

Target:
public @Nullable Object resolve(ITmfEvent event) { ITmfEventField field = event.getContent().getField(fFieldArray); if (field == null) { return null; } return field.getValue(); }
Source:
<code>private void setup() { setPrefColumnCount(30); validationSupport.registerValidator(this, (c, newValue) -> { boolean wasError = false; try { Parser.parse(getText()); } catch (ParseException e) { wasError = true; } return ValidationResult.fromErrorIf(this, "Parse error", wasError); }); setOnKeyTyped(e -> { boolean isModifierKeyPress = e.isAltDown() || e.isMetaDown() || e.isControlDown(); String key = e.getCharacter(); if(key == null || key.isEmpty() || isModifierKeyPress){ return; } char typed = e.getCharacter().charAt(0); if (typed == ')') { if (getCharAfterCaret().equals(")")) { e.consume(); positionCaret(getCaretPosition()+1); } } else if (typed == '(') { e.consume(); insertMatchingBracket(); } else if (typed == '\t') { e.consume(); if (getSelectedText().isEmpty()) { movePastRemainingBrackets(); } else { confirmCompletion(); } } else if (typed == '\b') { } else if (Character.isAlphabetic(typed)) { performCompletion(e); } else if (typed == ' ' && getText().isEmpty()){ e.consume(); } }); setOnKeyPressed(e -> { if (e.getCode() == KeyCode.TAB) { e.consume(); } }); setOnKeyReleased(e -> { if (e.getCode() == KeyCode.ENTER) { confirmEdit(); } else if (e.getCode() == KeyCode.ESCAPE) { revertEdit(); <START> getParent().requestFocus(); <END> } }); }</code><technical_language>setOnCancel here. panel hook escape/cancel event focus triggers</technical_language>

Target:
private void setup() { setPrefColumnCount(30); validationSupport.registerValidator(this, (c, newValue) -> { boolean wasError = false; try { Parser.parse(getText()); } catch (ParseException e) { wasError = true; } return ValidationResult.fromErrorIf(this, "Parse error", wasError); }); setOnKeyTyped(e -> { boolean isModifierKeyPress = e.isAltDown() || e.isMetaDown() || e.isControlDown(); String key = e.getCharacter(); if(key == null || key.isEmpty() || isModifierKeyPress){ return; } char typed = e.getCharacter().charAt(0); if (typed == ')') { if (getCharAfterCaret().equals(")")) { e.consume(); positionCaret(getCaretPosition()+1); } } else if (typed == '(') { e.consume(); insertMatchingBracket(); } else if (typed == '\t') { e.consume(); if (getSelectedText().isEmpty()) { movePastRemainingBrackets(); } else { confirmCompletion(); } } else if (typed == '\b') { } else if (Character.isAlphabetic(typed)) { performCompletion(e); } else if (typed == ' ' && (getText().isEmpty() || getText().endsWith(" "))){ e.consume(); } }); setOnKeyPressed(e -> { if (e.getCode() == KeyCode.TAB) { e.consume(); } }); setOnKeyReleased(e -> { if (e.getCode() == KeyCode.ENTER) { confirmEdit(); } else if (e.getCode() == KeyCode.ESCAPE) { revertEdit(); getParent().requestFocus(); } }); }
Source:
<code>public Integer getPort() { if (server==null) return null; try { NetworkConnector networkConnector = (NetworkConnector) server.getConnectors()[0]; return networkConnector.getLocalPort(); } catch (ClassCastException ex) { <START> return null; <END> } }</code><technical_language>get this, explicitly catch this exception? Lots of other places cast is done, point really</technical_language>

Target:
public Integer getPort() { if (server==null) return null; NetworkConnector networkConnector = (NetworkConnector) server.getConnectors()[0]; return networkConnector.getLocalPort(); }
Source:
<code>public static String encode(final String s) { <START> return Base64.getEncoder().encodeToString(s.getBytes(Charset.defaultCharset())); <END> }</code><technical_language>UTF-8 instead of default character setting</technical_language>

Target:
public static String encode(final String s) { return Base64.getEncoder().encodeToString(s.getBytes(StandardCharsets.UTF_8)); }
Source:
<code>public void process() { sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); <START> scenePrePost = frameBuffersManager.getFBO("scenePrePost"); <END> if (renderingConfig.isEyeAdaptation()) { PerformanceMonitor.startActivity("rendering/downsamplesceneandupdateexposure"); downsampleSceneInto1x1pixelsBuffer(); frameBuffersManager.getCurrentReadbackPBO().copyFromFBO(downSampledScene[0].fboId, 1, 1, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE); frameBuffersManager.swapReadbackPBOs(); ByteBuffer pixels = frameBuffersManager.getCurrentReadbackPBO().readBackPixels(); if (pixels.limit() < 3) { logger.error("Failed to auto-update the exposure value."); return; } currentSceneLuminance = 0.2126f * (pixels.get(2) & 0xFF) / 255.f + 0.7152f * (pixels.get(1) & 0xFF) / 255.f + 0.0722f * (pixels.get(0) & 0xFF) / 255.f; float targetExposure = hdrMaxExposure; if (currentSceneLuminance > 0) { targetExposure = hdrTargetLuminance / currentSceneLuminance; } float maxExposure = hdrMaxExposure; if (backdropProvider.getDaylight() == 0.0) { maxExposure = hdrMaxExposureNight; } if (targetExposure > maxExposure) { targetExposure = maxExposure; } else if (targetExposure < hdrMinExposure) { targetExposure = hdrMinExposure; } postProcessor.setExposure(TeraMath.lerp(postProcessor.getExposure(), targetExposure, hdrExposureAdjustmentSpeed)); PerformanceMonitor.endActivity(); } else { if (backdropProvider.getDaylight() == 0.0) { postProcessor.setExposure(hdrMaxExposureNight); } else { postProcessor.setExposure(hdrExposureDefault); } } }</code><technical_language>IF block PerformanceMonitor statements, for consistency</technical_language>

Target:
public void process() { if (renderingConfig.isEyeAdaptation()) { PerformanceMonitor.startActivity("rendering/updateExposure"); downSampleSceneInto1x1pixelsBuffer(); frameBuffersManager.getCurrentReadbackPBO().copyFromFBO(downSampledScene[0].fboId, 1, 1, GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE); frameBuffersManager.swapReadbackPBOs(); pixels = frameBuffersManager.getCurrentReadbackPBO().readBackPixels(); if (pixels.limit() < 3) { logger.error("Failed to auto-update the exposure value."); return; } currentSceneLuminance = 0.2126f * (pixels.get(2) & 0xFF) / 255.f + 0.7152f * (pixels.get(1) & 0xFF) / 255.f + 0.0722f * (pixels.get(0) & 0xFF) / 255.f; targetExposure = hdrMaxExposure; if (currentSceneLuminance > 0) { targetExposure = hdrTargetLuminance / currentSceneLuminance; } maxExposure = hdrMaxExposure; if (backdropProvider.getDaylight() == 0.0) { maxExposure = hdrMaxExposureNight; } if (targetExposure > maxExposure) { targetExposure = maxExposure; } else if (targetExposure < hdrMinExposure) { targetExposure = hdrMinExposure; } postProcessor.setExposure(TeraMath.lerp(postProcessor.getExposure(), targetExposure, hdrExposureAdjustmentSpeed)); PerformanceMonitor.endActivity(); } else { if (backdropProvider.getDaylight() == 0.0) { postProcessor.setExposure(hdrMaxExposureNight); } else { postProcessor.setExposure(hdrExposureDefault); } } }
Source:
<code>private Stick setupStick(Dictionary<String, ?> config) { String port = (String) config.get("stick.port"); if (port == null) { return null; } Stick stick = new Stick(port, this); <START> logger.info("Plugwise added Stick connected to serial port {}", port); <END> String interval = (String) config.get("stick.interval"); if (interval != null) { stick.setInterval(Integer.valueOf(interval)); logger.info("Setting the interval to send ZigBee PDUs to ms", interval); } String retries = (String) config.get("stick.retries"); if (retries != null) { stick.setRetries(Integer.valueOf(retries)); logger.info("Setting the maximum number of attempts to send a message to ", retries); } return stick; }</code><technical_language>This a logger.debug, users need this message single time</technical_language>

Target:
private Stick setupStick(Dictionary<String, ?> config) { String port = (String) config.get("stick.port"); if (port == null) { return null; } Stick stick = new Stick(port, this); logger.debug("Plugwise added Stick connected to serial port {}", port); String interval = (String) config.get("stick.interval"); if (interval != null) { stick.setInterval(Integer.valueOf(interval)); logger.debug("Setting the interval to send ZigBee PDUs to ms", interval); } String retries = (String) config.get("stick.retries"); if (retries != null) { stick.setRetries(Integer.valueOf(retries)); logger.debug("Setting the maximum number of attempts to send a message to ", retries); } return stick; }
Source:
<code><START> public static @NonNull String getIpv4NetAddress(@NonNull String ipAddressString, short netMask) { <END> String subnetMaskString = networkPrefixLengthToNetmask(netMask); String[] netMaskOctets = subnetMaskString.split("\\."); String[] ipv4AddressOctets = ipAddressString.split("\\."); String netAddress = ""; for (int i = 0; i < 4; i++) { netAddress += Integer.parseInt(ipv4AddressOctets[i]) & Integer.parseInt(netMaskOctets[i]); if (i < 3) { netAddress += "."; } } return netAddress; }</code><technical_language>If want assure return valid non-null results, throw IllegalArgumentExceptions. return if I pass "ABC" ipAddressString</technical_language>

Target:
public static @NonNull String getIpv4NetAddress(@NonNull String ipAddressString, short netMask) { String errorString = "IP '" + ipAddressString + "' not a valid IPv4 address or netmask '" + netMask + "' out of bounds (1-31)"; if (!isValidIPConfig(ipAddressString) || netMask < 1 || netMask > 31) { throw new IllegalArgumentException(errorString); } String subnetMaskString = networkPrefixLengthToNetmask(netMask); String[] netMaskOctets = subnetMaskString.split("\\."); String[] ipv4AddressOctets = ipAddressString.split("\\."); String netAddress = ""; try { for (int i = 0; i < 4; i++) { netAddress += Integer.parseInt(ipv4AddressOctets[i]) & Integer.parseInt(netMaskOctets[i]); if (i < 3) { netAddress += "."; } } } catch (NumberFormatException e) { throw new IllegalArgumentException(errorString); } return netAddress; }
Source:
<code>public void render(Context context, VDS host, SafeHtmlBuilder sb, String id) { if (host == null || !host.isUpdateAvailable()) { return; } ImageResource statusImage = resources.updateAvailableImage(); SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); <START> sb.append(statusImageHtml); <END> sb.appendHtmlConstant("<div id=\"" + id + "\" style=\"text-align: center;\">"); sb.appendHtmlConstant("</div>"); }</code><technical_language>Please ApplicationTemplates instead of constructing SafeHtml</technical_language>

Target:
public void render(Context context, VDS host, SafeHtmlBuilder sb, String id) { if (host == null || !host.isUpdateAvailable()) { return; } ImageResource statusImage = resources.updateAvailableImage(); SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(statusImageHtml); templates.hostAdditionalStatusIcon(id, statusImageHtml); }
Source:
<code>public void init() throws MessagingException { <START> plainTextFooter = getInitParameter("text", String.class); <END> }</code><technical_language>'stick' previous String version, is type want</technical_language>

Target:
public void init() throws MessagingException { plainTextFooter = getInitParameter("text"); }
Source:
<code>public @Nonnull List<RangeItem> _getUsages() { List<RangeItem> r = new ArrayList<>(); final Jenkins instance = Jenkins.get(); for (Entry<String, RangeSet> e : usages.entrySet()) { final String itemName = e.getKey(); <START> if (instance.hasPermission(Jenkins.CONFIGURE) || canDiscoverItem(itemName)) { <END> r.add(new RangeItem(itemName, e.getValue())); } } return r; }</code><technical_language>Jenkins.CONFIGURE imply full access Items</technical_language>

Target:
public @Nonnull List<RangeItem> _getUsages() { List<RangeItem> r = new ArrayList<>(); final Jenkins instance = Jenkins.get(); for (Entry<String, RangeSet> e : usages.entrySet()) { final String itemName = e.getKey(); if (instance.hasPermission(Jenkins.ADMINISTER) || canDiscoverItem(itemName)) { r.add(new RangeItem(itemName, e.getValue())); } } return r; }
Source:
<code>void onExecute(CommandSender sender, String[] args) { advancedAchievements.reloadConfig(); try { mainConfig.loadConfiguration(); langConfig.loadConfiguration(); guiConfig.loadConfiguration(); pluginLoader.get().loadAdvancedAchievements(false); <START> achievementCache.load(); <END> System.out.println("Reloaded CacheManager"); } catch (PluginLoadError | IOException | InvalidConfigurationException e) { if (sender instanceof Player) { sender.sendMessage(langConfigReloadFailed); } logger.log(Level.SEVERE, "A non recoverable error was encountered while reloading the plugin, disabling it:", e); Bukkit.getPluginManager().disablePlugin(advancedAchievements); return; } if (sender instanceof Player) { sender.sendMessage(langConfigSuccessfullyReloaded); } logger.info("Configuration successfully reloaded."); }</code><technical_language>AchievementCache is Reloadable, do need explicitly here. I revert changes this file</technical_language>

Target:
void onExecute(CommandSender sender, String[] args) { advancedAchievements.reloadConfig(); try { mainConfig.loadConfiguration(); langConfig.loadConfiguration(); guiConfig.loadConfiguration(); pluginLoader.get().loadAdvancedAchievements(false); System.out.println("Reloaded CacheManager"); } catch (PluginLoadError | IOException | InvalidConfigurationException e) { if (sender instanceof Player) { sender.sendMessage(langConfigReloadFailed); } logger.log(Level.SEVERE, "A non recoverable error was encountered while reloading the plugin, disabling it:", e); Bukkit.getPluginManager().disablePlugin(advancedAchievements); return; } if (sender instanceof Player) { sender.sendMessage(langConfigSuccessfullyReloaded); } logger.info("Configuration successfully reloaded."); }
Source:
<code>public boolean canExecute(@NonNull ITmfTrace trace) { return <START> StreamSupport.stream(trace.getEventAspects().spliterator(), false) .anyMatch(aspect -> aspect instanceof ITmfCounterAspect); <END> }</code><technical_language>Iterables.any(trace.getEventAspects(), aspect -> aspect instanceof ITmfCounterAspect);</technical_language>

Target:
public boolean canExecute(@NonNull ITmfTrace trace) { return Iterables.any(trace.getEventAspects(), aspect -> aspect instanceof ITmfCounterAspect); }
Source:
<code>public @Nonnull List<String> getLog(int maxLines) throws IOException { final List<String> lastLines = new ArrayList<>(maxLines); if(maxLines == 0) { return lastLines; } int lines = 0; <START> final List<Byte> bytes = new ArrayList<>(); <END> try (RandomAccessFile fileHandler = new RandomAccessFile(getLogFile(), "r")) { long fileLength = fileHandler.length() - 1; for (long filePointer = fileLength; filePointer != -1 && maxLines != lines; filePointer--) { fileHandler.seek(filePointer); byte readByte = fileHandler.readByte(); if (readByte == 0x0A) { if (filePointer < fileLength) { lines = lines + 1; lastLines.add(convertBytesToString(bytes)); bytes.clear(); } } else if (readByte != 0xD) { bytes.add(readByte); } } } if (lines != maxLines) { lastLines.add(convertBytesToString(bytes)); } Collections.reverse(lastLines); if (lines == maxLines) { lastLines.set(0, "[...truncated lines...]"); } return ConsoleNote.removeNotes(lastLines); }</code><technical_language>Initialize small? E.g. 256. a performance hack</technical_language>

Target:
public @Nonnull List<String> getLog(int maxLines) throws IOException { if (maxLines == 0) { return Collections.emptyList(); } int lines = 0; long filePointer; final List<String> lastLines = new ArrayList<>(Math.min(maxLines, 128)); final List<Byte> bytes = new ArrayList<>(); try (RandomAccessFile fileHandler = new RandomAccessFile(getLogFile(), "r")) { long fileLength = fileHandler.length() - 1; for (filePointer = fileLength; filePointer != -1 && maxLines != lines; filePointer--) { fileHandler.seek(filePointer); byte readByte = fileHandler.readByte(); if (readByte == 0x0A) { if (filePointer < fileLength) { lines = lines + 1; lastLines.add(convertBytesToString(bytes)); bytes.clear(); } } else if (readByte != 0xD) { bytes.add(readByte); } } } if (lines != maxLines) { lastLines.add(convertBytesToString(bytes)); } Collections.reverse(lastLines); if (lines == maxLines) { lastLines.set(0, "[...truncated " + Functions.humanReadableByteSize(filePointer)+ "...]"); } return ConsoleNote.removeNotes(lastLines); }
Source:
<code>public void testMnemonicCode() throws Exception { final List<String> mnemonicCode = mc.toMnemonic(HEX.decode(entropy)); final byte[] seed = MnemonicCode.toSeed(mnemonicCode, passphrase); <START> final byte[] entropy = mc.toEntropy(split(this.mnemonicCode)); <END> assertEquals(this.entropy, HEX.encode(entropy)); assertEquals(this.mnemonicCode, Utils.SPACE_JOINER.join(mnemonicCode)); assertEquals(this.seed, HEX.encode(seed)); }</code><technical_language>Hmm, Utils.SPACE_JOINER here</technical_language>

Target:
public void testMnemonicCode() throws Exception { final List<String> mnemonicCode = mc.toMnemonic(HEX.decode(vectorEntropy)); final byte[] seed = MnemonicCode.toSeed(mnemonicCode, vectorPassphrase); final byte[] entropy = mc.toEntropy(split(vectorMnemonicCode)); assertEquals(vectorEntropy, HEX.encode(entropy)); assertEquals(vectorMnemonicCode, SPACE_JOINER.join(mnemonicCode)); assertEquals(vectorSeed, HEX.encode(seed)); }
Source:
<code>String buildClientResponse() { <START> final String sbOauth2 = N_A + emailId + COMMA + ImapClientConstants.SOH <END> + "host=" + hostname + ImapClientConstants.SOH + "port=" + port + ImapClientConstants.SOH + AUTH_BEARER + token + ImapClientConstants.SOH + ImapClientConstants.SOH; return Base64.encodeBase64String(sbOauth2.getBytes(StandardCharsets.US_ASCII)); }</code><technical_language>change StringBuilder</technical_language>

Target:
String buildClientResponse() { final int len = N_A.length() + emailId.length() + hostname.length() + token.length() + EXTRA_LEN; final StringBuilder sbOauth2 = new StringBuilder(len).append(N_A).append(emailId).append(COMMA).append(ImapClientConstants.SOH); sbOauth2.append("host=").append(hostname).append(ImapClientConstants.SOH).append("port=").append(port).append(ImapClientConstants.SOH); sbOauth2.append(AUTH_BEARER).append(token).append(ImapClientConstants.SOH).append(ImapClientConstants.SOH); return Base64.encodeBase64String(sbOauth2.toString().getBytes(StandardCharsets.US_ASCII)); }
Source:
<code>public ResponseEntity<String> startRun(@RequestBody GeoJsonDiseaseOccurrenceFeatureCollection occurrenceData) { if (occurrenceData == null) { <START> return new ResponseEntity<String>("Must be provided", HttpStatus.BAD_REQUEST); <END> } try { RunConfiguration runConfiguration = runConfigurationFactory.createDefaultConfiguration(); modelRunner.runModel(runConfiguration, occurrenceData); } catch (Exception e) { return new ResponseEntity<String>("Could not start model run.", HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<String>(HttpStatus.NO_CONTENT); }</code><technical_language>"Occurrence data provided."</technical_language>

Target:
public ResponseEntity<String> startRun(@RequestBody GeoJsonDiseaseOccurrenceFeatureCollection occurrenceData) { if (occurrenceData == null) { return new ResponseEntity<String>("Occurrence data must be provided", HttpStatus.BAD_REQUEST); } try { RunConfiguration runConfiguration = runConfigurationFactory.createDefaultConfiguration(); modelRunner.runModel(runConfiguration, occurrenceData); } catch (Exception e) { return new ResponseEntity<String>("Could not start model run.", HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<String>(HttpStatus.NO_CONTENT); }
Source:
<code>public ModelAndView updateAttributes(HttpServletRequest request, HttpServletResponse response, @RequestParam("targetId") String targetId, @RequestBody Map<String, Map<String, String>> attributes) { IUserLayoutManager ulm = userInstanceManager.getUserInstance(request).getPreferencesManager().getUserLayoutManager(); if (!ulm.getNode(targetId).isAddChildAllowed()) { response.setStatus(403); return null; <START> } <END> IUserLayoutNodeDescription node = ulm.getNode(targetId); setObjectAttributes(node, request, attributes); final Locale locale = RequestContextUtils.getLocale(request); try { ulm.saveUserLayout(); } catch (Exception e) { log.warn("Error saving layout", e); return new ModelAndView("jsonView", Collections.singletonMap("error", getMessage("error.persisting.attribute.change", "Unable to save attribute changes", locale))); } Map<String, String> model = Collections.singletonMap("success", getMessage("success.element.update", "Updated element attributes", locale)); return new ModelAndView("jsonView", model); }</code><technical_language>Is addChildAllowed relevant updateAttributes? I checking permission dlm:editAllowed more sense</technical_language>

Target:
public ModelAndView updateAttributes(HttpServletRequest request, HttpServletResponse response, @RequestParam("targetId") String targetId, @RequestBody Map<String, Map<String, String>> attributes) { IUserLayoutManager ulm = userInstanceManager.getUserInstance(request).getPreferencesManager().getUserLayoutManager(); if (!ulm.getNode(targetId).isEditAllowed()) { response.setStatus(403); return null; } IUserLayoutNodeDescription node = ulm.getNode(targetId); if (node == null) { log.warn("[updateAttributes()] Unable to locate node with id: " + targetId); return new ModelAndView("jsonView", Collections.singletonMap("error", getMessage("error.element.update", "Unable to find layout element", RequestContextUtils.getLocale(request)))); } else { setObjectAttributes(node, request, attributes); final Locale locale = RequestContextUtils.getLocale(request); try { ulm.saveUserLayout(); } catch (Exception e) { log.warn("Error saving layout", e); return new ModelAndView("jsonView", Collections.singletonMap("error", getMessage("error.persisting.attribute.change", "Unable to save attribute changes", locale))); } Map<String, String> model = Collections.singletonMap("success", getMessage("success.element.update", "Updated element attributes", locale)); return new ModelAndView("jsonView", model); } }
Source:
<code>private RequestDescriptor createAmazonRequestDescriptor() { <START> final RequestDescriptor requestDescriptor = new RequestDescriptor(); <END> requestDescriptor.setName(AMAZON_NAME_BEFORE); requestDescriptor.setClassification(Classification.amazons3); requestDescriptor.setDescription(AMAZON_DESCRIPTOR); return requestDescriptor; }</code><technical_language>This static</technical_language>

Target:
private static RequestDescriptor createAmazonRequestDescriptor() { final RequestDescriptor requestDescriptor = new RequestDescriptor(); requestDescriptor.setName(AMAZON_NAME_BEFORE); requestDescriptor.setClassification(Classification.amazons3); requestDescriptor.setDescription(AMAZON_DESCRIPTOR); return requestDescriptor; }
Source:
<code>public void providesDefaultHeader() throws IOException { <START> final String expected = <END> String.format("%s: %s", DEF_HEADER, DEF_HEADER_VAL); MatcherAssert.assertThat( new RqPrint( new RqWithDefaultHeader( new RqFake(), DEF_HEADER, DEF_HEADER_VAL ) ).print(), Matchers.startsWith( Joiner.on("\r\n").join( "GET /", "Host: www.example.com", expected ) ) ); }</code><technical_language>@exper0 inline</technical_language>

Target:
public void providesDefaultHeader() throws IOException { final String req = "GET /"; MatcherAssert.assertThat( new RqPrint( new RqWithDefaultHeader( new RqFake(Collections.singletonList(req), "body"), "X-Default-Header1", "X-Default-Value1" ) ).print(), Matchers.startsWith( Joiner.on(RqWithDefaultHeaderTest.CRLF).join( req, "X-Default-Header1: X-Default-Value" ) ) ); }
Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); discussionTopicsSearchView.setQuery(searchQuery, false); discussionTopicsSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { <START> if (query == null || query.trim().length() == 0) <END> return false; SoftKeyboardUtil.hide(getActivity()); searchQuery = query; nextPage = 1; controller.reset(); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); }</code><technical_language>This check replaced StringUtils.isBlank() Apache Commons library, use. Note checks for null well</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); discussionTopicsSearchView.setQuery(searchQuery, false); discussionTopicsSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { if (query == null || query.trim().isEmpty()) return false; SoftKeyboardUtil.hide(getActivity()); searchQuery = query; nextPage = 1; controller.reset(); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); }
Source:
<code>public void deleteMedia(final ArrayList<Integer> ids) { final ArrayList<MediaModel> mediaToDelete = new ArrayList<>(); int processedItemCount = 0; for (int currentId : ids) { MediaModel mediaModel = mMediaStore.getMediaWithLocalId(currentId); if (mediaModel == null) { continue; } if (!UploadService.isMediaBeingUploadedForAPost(mediaModel)) { if (UploadService.isPendingOrInProgressMediaUpload(mediaModel)) { MediaStore.CancelMediaPayload payload = new MediaStore.CancelMediaPayload(mSite, mediaModel, false); mDispatcher.dispatch(MediaActionBuilder.newCancelMediaUploadAction(payload)); } if (mediaModel.getUploadState() != null && <START> MediaUtils.isLocalFile(mediaModel.getUploadState().toLowerCase())) { <END> mDispatcher.dispatch(MediaActionBuilder.newRemoveMediaAction(mediaModel)); } else { mediaToDelete.add(mediaModel); mediaModel.setUploadState(MediaUploadState.DELETING); mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(mediaModel)); } processedItemCount++; } } if (processedItemCount != ids.size()) { ToastUtils.showToast(this, R.string.cannot_delete_some_multi_media_items, ToastUtils.Duration.LONG); } if (!mediaToDelete.isEmpty()) { startMediaDeleteService(mediaToDelete); } if (mMediaGridFragment != null) { mMediaGridFragment.clearSelection(); } }</code><technical_language>I this part of this PR, drop toLowerCase() (and null check)</technical_language>

Target:
public void deleteMedia(final ArrayList<Integer> ids) { final ArrayList<MediaModel> mediaToDelete = new ArrayList<>(); int processedItemCount = 0; for (int currentId : ids) { MediaModel mediaModel = mMediaStore.getMediaWithLocalId(currentId); if (mediaModel == null) { continue; } if (UploadService.isPendingOrInProgressMediaUpload(mediaModel)) { MediaStore.CancelMediaPayload payload = new MediaStore.CancelMediaPayload(mSite, mediaModel, false); mDispatcher.dispatch(MediaActionBuilder.newCancelMediaUploadAction(payload)); PostModel post = UploadService.isMediaBeingUploadedForAPost(mediaModel); if (post != null) { UploadService.markPostAsError(post); } } if (mediaModel.getUploadState() != null && MediaUtils.isLocalFile(mediaModel.getUploadState().toLowerCase())) { mDispatcher.dispatch(MediaActionBuilder.newRemoveMediaAction(mediaModel)); } else { mediaToDelete.add(mediaModel); } processedItemCount++; } if (processedItemCount != ids.size()) { ToastUtils.showToast(this, R.string.cannot_delete_multi_media_items, ToastUtils.Duration.LONG); } if (!mediaToDelete.isEmpty()) { startMediaDeleteService(mediaToDelete); } if (mMediaGridFragment != null) { mMediaGridFragment.clearSelection(); } }
Source:
<code>public void testWritingDocumentsWithDynamicIndex() throws Exception { TableSchema schema = TableSchema.builder() .field("a", DataTypes.BIGINT().notNull()) .field("b", DataTypes.TIMESTAMP().notNull()) .primaryKey("a") .build(); GenericRowData rowData = GenericRowData.of( 1L, TimestampData.fromLocalDateTime(LocalDateTime.parse("2012-12-12T12:12:12"))); String index = "dynamic-index-{b|yyyy-MM-dd}"; String myType = "MyType"; Elasticsearch6DynamicSinkFactory sinkFactory = new Elasticsearch6DynamicSinkFactory(); SinkFunctionProvider sinkRuntimeProvider = (SinkFunctionProvider) sinkFactory.createDynamicTableSink( context() .withSchema(schema) .withOption(ElasticsearchOptions.INDEX_OPTION.key(), index) .withOption(ElasticsearchOptions.DOCUMENT_TYPE_OPTION.key(), myType) .withOption(ElasticsearchOptions.HOSTS_OPTION.key(), "<LINK_0>") .withOption(ElasticsearchOptions.FLUSH_ON_CHECKPOINT_OPTION.key(), "false") .build() ).getSinkRuntimeProvider(new MockContext()); <START> SinkFunction<RowData> sinkFunction = sinkRuntimeProvider.createSinkFunction(); <END> StreamExecutionEnvironment environment = StreamExecutionEnvironment.getExecutionEnvironment(); rowData.setRowKind(RowKind.UPDATE_AFTER); environment.<RowData>fromElements(rowData).addSink(sinkFunction); environment.execute(); Client client = elasticsearchResource.getClient(); Map<String, Object> response = client.get(new GetRequest("dynamic-index-2012-12-12", myType, "1")).actionGet().getSource(); Map<Object, Object> expectedMap = new HashMap<>(); expectedMap.put("a", 1); expectedMap.put("b", "2012-12-12 12:12:12"); assertThat(response, equalTo(expectedMap)); }</code><technical_language>DDL for case</technical_language>

Target:
public void testWritingDocumentsWithDynamicIndex() throws Exception { TableEnvironment tableEnvironment = TableEnvironment.create(EnvironmentSettings.newInstance() .useBlinkPlanner() .inStreamingMode() .build()); String index = "dynamic-index-{b|yyyy-MM-dd}"; String myType = "MyType"; tableEnvironment.executeSql("CREATE TABLE esTable (" + "a BIGINT NOT NULL,\n" + "b TIMESTAMP NOT NULL,\n" + "PRIMARY KEY (a) NOT ENFORCED\n" + ")\n" + "WITH (\n" + String.format("'%s'='%s',\n", "connector", "elasticsearch-6") + String.format("'%s'='%s',\n", ElasticsearchOptions.INDEX_OPTION.key(), index) + String.format("'%s'='%s',\n", ElasticsearchOptions.DOCUMENT_TYPE_OPTION.key(), myType) + String.format("'%s'='%s',\n", ElasticsearchOptions.HOSTS_OPTION.key(), "<LINK_0>") + String.format("'%s'='%s'\n", ElasticsearchOptions.FLUSH_ON_CHECKPOINT_OPTION.key(), "false") + ")"); tableEnvironment.fromValues(row(1L, LocalDateTime.parse("2012-12-12T12:12:12"))) .executeInsert("esTable") .getJobClient() .get() .getJobExecutionResult(this.getClass().getClassLoader()) .get(); Client client = elasticsearchResource.getClient(); Map<String, Object> response = client.get(new GetRequest("dynamic-index-2012-12-12", myType, "1")).actionGet().getSource(); Map<Object, Object> expectedMap = new HashMap<>(); expectedMap.put("a", 1); expectedMap.put("b", "2012-12-12 12:12:12"); assertThat(response, equalTo(expectedMap)); }
Source:
<code>protected void assertOwnershipAndNonOwnership(Object key, boolean allowL1) { <START> for (MultimapCache<String, String> mc : multimapCacheCluster.values()) { <END> Cache cache = ((EmbeddedMultimapCache) mc).getCache(); DataContainer dc = ((EmbeddedMultimapCache) mc).getCache().getAdvancedCache().getDataContainer(); InternalCacheEntry ice = dc.get(key); if (isOwner(cache, key)) { assertNotNull(ice); assertTrue(ice instanceof ImmortalCacheEntry); } else { if (allowL1) { assertTrue("ice is null or L1Entry", ice == null || ice.isL1Entry()); } else { eventuallyEquals("Fail on non-owner cache " + addressOf(cache) + ": dc.get(" + key + ")", null, () -> dc.get(key)); } } } }</code><technical_language>iterate caches() directly</technical_language>

Target:
protected void assertOwnershipAndNonOwnership(Object key, boolean allowL1) { for (Cache cache : caches) { Wrapper keyWrapper = cache.getAdvancedCache().getKeyWrapper(); Encoder keyEncoder = cache.getAdvancedCache().getKeyEncoder(); Object keyToBeChecked = keyEncoder != null && keyWrapper != null ? EncodingUtils.toStorage(key, keyEncoder, keyWrapper) : key; DataContainer dc = cache.getAdvancedCache().getDataContainer(); InternalCacheEntry ice = dc.get(keyToBeChecked); if (isOwner(cache, keyToBeChecked)) { assertNotNull(ice); assertTrue(ice instanceof ImmortalCacheEntry); } else { if (allowL1) { assertTrue("ice is null or L1Entry", ice == null || ice.isL1Entry()); } else { eventuallyEquals("Fail on non-owner cache " + addressOf(cache) + ": dc.get(" + key + ")", null, () -> dc.get(keyToBeChecked)); } } } }
Source:
<code>public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[" + "extSource=<").append(getExtSource() == null ? "\\0" : getExtSource().serializeToString()).append(">" + ", parentGroupName=<").append(getParentGroupName()).append(">" + ", group=<").append(asGroup() == null ? "\\0" : asGroup().serializeToString()).append(">" + <START> ']').toString(); <END> }</code><technical_language>reason for "appending" is prevent ineffective work concatenation of Strings "+". prevent concatenation in middle of appending</technical_language>

Target:
public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()) .append(":[extSource=<") .append(getExtSource() == null ? "\\0" : getExtSource().serializeToString()) .append(">, parentGroupName=<") .append(getParentGroupName()) .append(">, group=<") .append(asGroup() == null ? "\\0" : asGroup().serializeToString()) .append(">]").toString(); }