auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void inbound(final Object message) throws IOException { if (message instanceof SipServletRequest) { final SipServletRequest request = (SipServletRequest) message; SipURI uri = (SipURI) request.getFrom().getURI(); final String from = uri.getUser(); uri = (SipURI) request.getTo().getURI(); final String to = uri.getUser(); String body = null; if (request.getContentLength() > 0) { body = new String(request.getRawContent()); } Iterator<String> headerIt = request.getHeaderNames(); while (headerIt.hasNext()) { String headerName = headerIt.next(); if (headerName.startsWith("X-")) { customRequestHeaderMap.put(headerName, request.getHeader(headerName)); } } <START> last = new SmsSessionRequest(from, to, body, Encoding.GSM, customRequestHeaderMap, this.tlvSet); <END> if (initial == null) { initial = last; } final ActorRef self = self(); for (final ActorRef observer : observers) { observer.tell(last, self); } } else if (message instanceof SmppInboundMessageEntity) { final SmppInboundMessageEntity request = (SmppInboundMessageEntity) message; final SmsSessionRequest.Encoding encoding; if(request.getSmppEncoding().equals(CharsetUtil.CHARSET_UCS_2)) { encoding = SmsSessionRequest.Encoding.UCS_2; } else { encoding = SmsSessionRequest.Encoding.GSM; } last = new SmsSessionRequest (request.getSmppFrom(), request.getSmppTo(), request.getSmppContent(), encoding, null, request.getTlvSet()); if (initial == null) { initial = last; } for (final ActorRef observer : observers) { observer.tell(last, self()); } } }</code><technical_language>@abdulazizali77 please elaborate GSM encoding hardcoded here</technical_language>

Target:
private void inbound(final Object message) throws IOException { if (message instanceof SipServletRequest) { final SipServletRequest request = (SipServletRequest) message; SipURI uri = (SipURI) request.getFrom().getURI(); final String from = uri.getUser(); uri = (SipURI) request.getTo().getURI(); final String to = uri.getUser(); String body = null; if (request.getContentLength() > 0) { body = new String(request.getRawContent()); } Iterator<String> headerIt = request.getHeaderNames(); while (headerIt.hasNext()) { String headerName = headerIt.next(); if (headerName.startsWith("X-")) { customRequestHeaderMap.put(headerName, request.getHeader(headerName)); } } last = new SmsSessionRequest(from, to, body, this.tlvSet, customRequestHeaderMap); if (initial == null) { initial = last; } final ActorRef self = self(); for (final ActorRef observer : observers) { observer.tell(last, self); } } else if (message instanceof SmppInboundMessageEntity) { final SmppInboundMessageEntity request = (SmppInboundMessageEntity) message; final SmsSessionRequest.Encoding encoding; if(request.getSmppEncoding().equals(CharsetUtil.CHARSET_UCS_2)) { encoding = SmsSessionRequest.Encoding.UCS_2; } else { encoding = SmsSessionRequest.Encoding.GSM; } last = new SmsSessionRequest (request.getSmppFrom(), request.getSmppTo(), request.getSmppContent(), encoding, request.getTlvSet(), null); if (initial == null) { initial = last; } for (final ActorRef observer : observers) { observer.tell(last, self()); } } }
Source:
<code>public ProtocolType getProtocolType() { <START> if (version == GlowServer.PROTOCOL_VERSION) <END> return ProtocolType.PLAY; if (version == GlowServer.LEGACY_PROTOCOL_VERSION) return ProtocolType.PLAY_107; if (version == GlowServer.COMPATIBLE_PROTOCOL_VERSION) return ProtocolType.PLAY_109; return null; }</code><technical_language>this a switch statement</technical_language>

Target:
public ProtocolType getProtocolType() { switch (version) { case GlowServer.PROTOCOL_VERSION: return ProtocolType.PLAY; case GlowServer.LEGACY_PROTOCOL_1_9: return ProtocolType.PLAY_107; case GlowServer.LEGACY_PROTOCOL_1_9_2: return ProtocolType.PLAY_109; } return null; }
Source:
<code>public void updateContributionItems(Selector selector) { for (final AbstractContributionItem ci : itemsToCheck) { if (ci.getModel() != null && ci.getModel().getParent() != null) { if (selector.select(ci.getModel())) { itemsToUpdateLater.add(ci); count++; if (count > 100) { run(); <START> count = 0; <END> } else Display.getDefault().timerExec(DELAY, this); } } else { orphanedToolItems.add(ci); } } if (!orphanedToolItems.isEmpty()) { itemsToCheck.removeAll(orphanedToolItems); orphanedToolItems.clear(); } }</code><technical_language>set in run() zero, I get do need count-- in run()</technical_language>

Target:
public void updateContributionItems(Selector selector) { for (final AbstractContributionItem ci : itemsToCheck) { if (ci.getModel() != null && ci.getModel().getParent() != null) { if (selector.select(ci.getModel())) { itemsToUpdateLater.add(ci); count++; if (count > 100) { run(); } else { Display.getDefault().timerExec(DELAY, this); } } } else { orphanedToolItems.add(ci); } } if (!orphanedToolItems.isEmpty()) { itemsToCheck.removeAll(orphanedToolItems); orphanedToolItems.clear(); } }
Source:
<code><START> public static boolean isZippedContent(byte[] bin) { <END> return bin.length > 4 && bin[0] == 'P' && bin[1] == 'K' && bin[2] == 3 && bin[3] == 4; }</code><technical_language>Is null passed here</technical_language>

Target:
public static boolean isZippedContent(byte[] bin) { return bin != null && bin.length > 4 && bin[0] == 'P' && bin[1] == 'K' && bin[2] == 3 && bin[3] == 4; }
Source:
<code>protected void initVm() { if (!isInitVmRequired()) { return; } fetchVmDisksFromDb(); updateVmDevicesOnRun(); updateGraphicsAndDisplayInfos(); getVm().setRunAndPause(getParameters().getRunAndPause() == null ? getVm().isRunAndPause() : getParameters().getRunAndPause()); getVm().setConsoleUserId(null); updateVmInit(); if (!StringUtils.isEmpty(getParameters().getFloppyPath()) && isPayloadExists(VmDeviceType.FLOPPY)) { vmPayload = null; } updateVmGuestAgentVersion(); if <START> (!getVm().isUseHostCpuFlags() && !getVm().getCustomCpuName().equals("hostPassthrough") <END> && getVm().getCpuName() == null) { if (getVm().getCustomCpuName() != null) { getVm().setCpuName(getVm().getCustomCpuName()); } else { getVm().setCpuName(getCpuFlagsManagerHandler().getCpuId( getVm().getClusterCpuName(), getVm().getCompatibilityVersion())); } } if (getVm().getEmulatedMachine() == null) { getVm().setEmulatedMachine(getEffectiveEmulatedMachine()); } }</code><technical_language>please extract a separate method call #846 more clear checking</technical_language>

Target:
protected void initVm() { if (!isInitVmRequired()) { return; } fetchVmDisksFromDb(); updateVmDevicesOnRun(); updateGraphicsAndDisplayInfos(); getVm().setRunAndPause(getParameters().getRunAndPause() == null ? getVm().isRunAndPause() : getParameters().getRunAndPause()); getVm().setConsoleUserId(null); updateVmInit(); if (!StringUtils.isEmpty(getParameters().getFloppyPath()) && isPayloadExists(VmDeviceType.FLOPPY)) { vmPayload = null; } updateVmGuestAgentVersion(); if (!getVm().isUsingCpuPassthrough() && getVm().getCpuName() == null) { if (getVm().getCustomCpuName() != null) { getVm().setCpuName(getVm().getCustomCpuName()); } else { getVm().setCpuName(getCpuFlagsManagerHandler().getCpuId( getVm().getClusterCpuName(), getVm().getCompatibilityVersion())); } } if (getVm().getEmulatedMachine() == null) { getVm().setEmulatedMachine(getEffectiveEmulatedMachine()); } }
Source:
<code>public Builder runCmds(List<String> theCmds) { <START> config.runCmds = theCmds; <END> return this; }</code><technical_language>I guard null here</technical_language>

Target:
public Builder runCmds(List<String> theCmds) { if (config.runCmds == null) { config.runCmds = new ArrayList<String>(); } else config.runCmds = theCmds; return this; }
Source:
<code>private Object[][] finderSupportedResourceTypeData() { return new Object[][] <START> { <END> { FinderSupportedAssociationDataResource.class }, { FinderSupportedComplexKeyDataResource.class }, { FinderWithActionResource.class } }; }</code><technical_language>expectedExceptions expectedExceptionsMessageRegExp attributes of @Test annotation</technical_language>

Target:
private Object[][] finderSupportedResourceTypeData() { return new Object[][] { { FinderSupportedAssociationDataResource.class }, { FinderSupportedComplexKeyDataResource.class } }; }
Source:
<code>public void close() throws IOException { boolean triedToClose = false, success = false; try { flush(); ((FileOutputStream)out).getChannel().force(true); triedToClose = true; super.close(); success = true; } finally { if (success) { boolean renamed = tmpFile.renameTo(origFile); if (!renamed) { if (origFile.exists()) { try { Files.delete(origFile.toPath()); } catch (IOException e) { <START> throw new IOException("Could not delete original file " + origFile <END> + " due to: " + e); } } try { NativeIO.renameTo(tmpFile, origFile); } catch (NativeIOException e) { throw new IOException("Could not rename temporary file " + tmpFile + " to " + origFile + " due to failure in native rename. " + e.toString()); } } } else { if (!triedToClose) { IOUtils.closeStream(out); } if (!tmpFile.delete()) { LOG.warn("Unable to delete tmp file " + tmpFile); } } } }</code><technical_language>Is simpler throw new IOException("Could delete original file " + origFile, e); Other that, +1</technical_language>

Target:
public void close() throws IOException { boolean triedToClose = false, success = false; try { flush(); ((FileOutputStream)out).getChannel().force(true); triedToClose = true; super.close(); success = true; } finally { if (success) { boolean renamed = tmpFile.renameTo(origFile); if (!renamed) { if (origFile.exists()) { try { Files.delete(origFile.toPath()); } catch (IOException e) { throw new IOException("Could not delete original file " + origFile, e); } } try { NativeIO.renameTo(tmpFile, origFile); } catch (NativeIOException e) { throw new IOException("Could not rename temporary file " + tmpFile + " to " + origFile + " due to failure in native rename. " + e.toString()); } } } else { if (!triedToClose) { IOUtils.closeStream(out); } if (!tmpFile.delete()) { LOG.warn("Unable to delete tmp file " + tmpFile); } } } }
Source:
<code>private java.security.Signature getSignature(X509Certificate certificate) throws SignatureException { String jceSigAlgo = certificate.getSigAlgName(); java.security.Signature signature; try { if ("DSA".equalsIgnoreCase(certificate.getPublicKey().getAlgorithm())) { signature = java.security.Signature.getInstance(jceSigAlgo, "BC"); } else { <START> signature = java.security.Signature.getInstance(jceSigAlgo); <END> } } catch (NoSuchAlgorithmException | NoSuchProviderException e) { throw new SignatureException(e); } return signature; }</code><technical_language>pass in BouncyCastle time</technical_language>

Target:
private java.security.Signature getSignature(X509Certificate certificate) throws SignatureException { java.security.Signature signature; try { if ("DSA".equalsIgnoreCase(certificate.getPublicKey().getAlgorithm())) { signature = java.security.Signature.getInstance(DSA_ALGO_JCE, "BC"); } else { signature = java.security.Signature.getInstance(RSA_ALGO_JCE); } } catch (NoSuchAlgorithmException | NoSuchProviderException e) { throw new SignatureException(e); } return signature; }
Source:
<code><START> private void closeConfirmationWindow() { <END> getConfirmWindow().stopProgress(); setConfirmWindow(null); }</code><technical_language>add a null check for getConfirmWindow()</technical_language>

Target:
private void closeConfirmationWindow() { if(getConfirmWindow() == null) { return; } getConfirmWindow().stopProgress(); setConfirmWindow(null); }
Source:
<code>protected void onResume() { super.onResume(); <START> if (!isSHREnable()){ <END> onBackPressed(); } }</code><technical_language>@rezita, I this isSHREnabled</technical_language>

Target:
protected void onResume() { super.onResume(); if (!isSHREnabled()){ onBackPressed(); } }
Source:
<code>public TmfXYChartViewer(Composite parent, String title, String xLabel, String yLabel) { super(parent, title); fSwtChart = new Chart(parent, SWT.NONE) { @Override public boolean setFocus() { return fSwtChart.getPlotArea().setFocus(); } }; fSwtChart.getPlotArea().addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { fSwtChart.getPlotArea().setFocus(); } }); IAxis xAxis = fSwtChart.getAxisSet().getXAxis(0); IAxis yAxis = fSwtChart.getAxisSet().getYAxis(0); if (title == null) { fSwtChart.getTitle().setVisible(false); } else { fSwtChart.getTitle().setText(title); } if (xLabel == null) { xAxis.getTitle().setVisible(false); } else { xAxis.getTitle().setText(xLabel); } if (yLabel == null) { yAxis.getTitle().setVisible(false); } else { yAxis.getTitle().setText(yLabel); } fMouseSelectionProvider = new TmfMouseSelectionProvider(this); fMouseDragZoomProvider = new TmfMouseDragZoomProvider(this); fMouseWheelZoomProvider = new TmfMouseWheelZoomProvider(this); fToolTipProvider = new TmfSimpleTooltipProvider(this); fMouseDragProvider = new TmfMouseDragProvider(this); fSwtChart.addDisposeListener(new DisposeListener() { @Override <START> public void widgetDisposed(DisposeEvent e) { <END> internalDispose(); } }); }</code><technical_language>lambda</technical_language>

Target:
public TmfXYChartViewer(Composite parent, String title, String xLabel, String yLabel) { super(parent, title); fSwtChart = new Chart(parent, SWT.NONE) { @Override public boolean setFocus() { return fSwtChart.getPlotArea().setFocus(); } }; fSwtChart.getPlotArea().addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { fSwtChart.getPlotArea().setFocus(); } }); IAxis xAxis = fSwtChart.getAxisSet().getXAxis(0); IAxis yAxis = fSwtChart.getAxisSet().getYAxis(0); if (title == null) { fSwtChart.getTitle().setVisible(false); } else { fSwtChart.getTitle().setText(title); } if (xLabel == null) { xAxis.getTitle().setVisible(false); } else { xAxis.getTitle().setText(xLabel); } if (yLabel == null) { yAxis.getTitle().setVisible(false); } else { yAxis.getTitle().setText(yLabel); } fMouseSelectionProvider = new TmfMouseSelectionProvider(this); fMouseDragZoomProvider = new TmfMouseDragZoomProvider(this); fMouseWheelZoomProvider = new TmfMouseWheelZoomProvider(this); fToolTipProvider = new TmfSimpleTooltipProvider(this); fMouseDragProvider = new TmfMouseDragProvider(this); fSwtChart.addDisposeListener((e) -> { internalDispose(); }); }
Source:
<code>private BlobId(DataInputStream stream, ClusterMap clusterMap, boolean ensureFullyRead) throws IOException { version = stream.readShort(); switch (version) { case BLOB_ID_V1: type = BlobIdType.NATIVE; datacenterId = UNKNOWN_DATACENTER_ID; accountId = UNKNOWN_ACCOUNT_ID; containerId = UNKNOWN_CONTAINER_ID; break; case BLOB_ID_V2: stream.readByte(); type = BlobIdType.NATIVE; datacenterId = stream.readByte(); accountId = stream.readShort(); containerId = stream.readShort(); break; case BLOB_ID_V3: <START> type = BlobIdType.values()[stream.readByte()]; <END> datacenterId = stream.readByte(); accountId = stream.readShort(); containerId = stream.readShort(); break; default: throw new IllegalArgumentException("blobId version " + version + " not supported."); } partitionId = clusterMap.getPartitionIdFromStream(stream); if (partitionId == null) { throw new IllegalArgumentException("Partition ID cannot be null"); } uuid = Utils.readIntString(stream); if (ensureFullyRead && stream.read() != -1) { throw new IllegalArgumentException("Stream should have no more available bytes to read"); } }</code><technical_language>this code incorrect if more fields added flag? Is do - read flag, correct bit set this field</technical_language>

Target:
private BlobId(DataInputStream stream, ClusterMap clusterMap, boolean ensureFullyRead) throws IOException { version = stream.readShort(); switch (version) { case BLOB_ID_V1: type = BlobIdType.NATIVE; datacenterId = UNKNOWN_DATACENTER_ID; accountId = UNKNOWN_ACCOUNT_ID; containerId = UNKNOWN_CONTAINER_ID; break; case BLOB_ID_V2: stream.readByte(); type = BlobIdType.NATIVE; datacenterId = stream.readByte(); accountId = stream.readShort(); containerId = stream.readShort(); break; case BLOB_ID_V3: type = BlobIdType.values()[stream.readByte() & 0x3]; datacenterId = stream.readByte(); accountId = stream.readShort(); containerId = stream.readShort(); break; default: throw new IllegalArgumentException("blobId version " + version + " not supported."); } partitionId = clusterMap.getPartitionIdFromStream(stream); if (partitionId == null) { throw new IllegalArgumentException("Partition ID cannot be null"); } uuid = Utils.readIntString(stream); if (ensureFullyRead && stream.read() != -1) { throw new IllegalArgumentException("Stream should have no more available bytes to read"); } }
Source:
<code><START> public AdvancedModelWrapper(OpenEngSBModel model) { <END> super(model); }</code><technical_language>I a static method for construction fit</technical_language>

Target:
protected AdvancedModelWrapper(OpenEngSBModel model) { super(model); }
Source:
<code>public void checkResponseShouldReturnExceptionWithNoResponseBody() throws Exception { thrown.expect(ConstructorException.class); thrown.expectMessage("io.constructor.client.ConstructorException: Server error (418)"); Response response = Utils.createResponse(418, ""); <START> assertTrue("response checks true ", ConstructorIO.checkResponse(response)); <END> }</code><technical_language>wait sorry. 400 false</technical_language>

Target:
public void checkResponseShouldReturnExceptionWithNoResponseBody() throws Exception { thrown.expect(ConstructorException.class); thrown.expectMessage("io.constructor.client.ConstructorException: [HTTP 418]"); String body = ""; Response response = Utils.createResponse(418, body); ConstructorIO.checkResponse(response); }
Source:
<code>public Integer getLength() { <START> return length > 0 ? length : null; <END> }</code><technical_language>this return 0 if length == 0</technical_language>

Target:
public Integer getLength() { return end > -1 ? end - index : null; }
Source:
<code>private boolean isCounterUpdateRequired(NotificationCache nCache) { <START> if (new Date().getTime() - nCache.getLastCounterUpdate().getTime() > COUNTER_UPDATE_INTERVAL_IN_MS) { return true; } else { return false; } <END> }</code><technical_language>Yes, I change it</technical_language>

Target:
private boolean isCounterUpdateRequired(NotificationCache nCache) { return new Date().getTime() - nCache.getLastCounterUpdate().getTime() > COUNTER_UPDATE_INTERVAL_IN_MS; }
Source:
<code>protected SetValue<String> constructValue(Set<String> actualValue) { <START> return new SpongeSetValue<>(Keys.TAGS, Collections.<String>emptySet(), actualValue); <END> }</code><technical_language>Collections.emptySet() is required here, generic</technical_language>

Target:
protected SetValue<String> constructValue(Set<String> actualValue) { return new SpongeSetValue<>(Keys.TAGS, Collections.emptySet(), actualValue); }
Source:
<code>public void testNullPath() { System.clearProperty("ddf.home"); AbsolutePathResolver apr = new AbsolutePathResolver(null); assertThat(apr.getPath(), nullValue()); <START> assertThat(apr.getPath("root"), nullValue()); <END> }</code><technical_language>assertions tests, testNullPath testNullPathWithRoot respectively</technical_language>

Target:
public void testNullPath() { System.clearProperty("ddf.home"); AbsolutePathResolver apr = new AbsolutePathResolver(null); assertThat(apr.getPath(), nullValue()); }
Source:
<code><START> public void start() { <END> startTime = System.currentTimeMillis(); }</code><technical_language>need change Creation classes</technical_language>

Target:
public void start()
Source:
<code><START> public void memberShouldCorrectlyRedirectPingMessage() throws IOException, InterruptedException { <END> final String poolName = testName.getMethodName(); parametrizedSetUp(poolName, asList(server1Port, server2Port)); InternalDistributedMember distributedMember1 = (InternalDistributedMember) server1 .invoke(() -> cacheRule.getCache().getDistributedSystem().getDistributedMember()); InternalDistributedMember distributedMember2 = (InternalDistributedMember) server2 .invoke(() -> cacheRule.getCache().getDistributedSystem().getDistributedMember()); client.invoke(() -> executePing(poolName, server1Port, distributedMember1)); client.invoke(() -> executePing(poolName, server2Port, distributedMember2)); Long firstHeartbeatServer1 = server1.invoke(this::getSingleHeartBeat); Long firstHeartbeatServer2 = server2.invoke(this::getSingleHeartBeat); client.invoke(() -> executePing(poolName, server1Port, distributedMember2)); Long secondHeartbeatServer1 = server1.invoke(this::getSingleHeartBeat); Long secondHeartbeatServer2 = server2.invoke(this::getSingleHeartBeat); assertThat(secondHeartbeatServer1).isEqualTo(firstHeartbeatServer1); assertThat(secondHeartbeatServer2).isGreaterThan(firstHeartbeatServer2); }</code><technical_language>exceptions thrown in method, removed</technical_language>

Target:
public void memberShouldCorrectlyRedirectPingMessage() { final String poolName = testName.getMethodName(); parametrizedSetUp(poolName, asList(server1Port, server2Port)); InternalDistributedMember distributedMember1 = (InternalDistributedMember) server1 .invoke(() -> cacheRule.getCache().getDistributedSystem().getDistributedMember()); InternalDistributedMember distributedMember2 = (InternalDistributedMember) server2 .invoke(() -> cacheRule.getCache().getDistributedSystem().getDistributedMember()); client.invoke(() -> executePing(poolName, server1Port, distributedMember1)); client.invoke(() -> executePing(poolName, server2Port, distributedMember2)); Long firstHeartbeatServer1 = server1.invoke(this::getSingleHeartBeat); Long firstHeartbeatServer2 = server2.invoke(this::getSingleHeartBeat); client.invoke(() -> executePing(poolName, server1Port, distributedMember2)); Long secondHeartbeatServer1 = server1.invoke(this::getSingleHeartBeat); Long secondHeartbeatServer2 = server2.invoke(this::getSingleHeartBeat); assertThat(secondHeartbeatServer1).isEqualTo(firstHeartbeatServer1); assertThat(secondHeartbeatServer2).isGreaterThan(firstHeartbeatServer2); }
Source:
<code>private Bitmap decodeStream(InputStream stream, Request data) throws IOException { if (stream == null) { return null; } BitmapFactory.Options options = null; if (data.needInSampleSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; InputStream is = getInputStream(); try { BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } if (data.hasSize()) { calculateInSampleSize(data.targetWidth, data.targetHeight, options); } if (!data.overTextureSize) { calculateMaxTextureSizeInSampleSize(options); <START> } <END> } return BitmapFactory.decodeStream(stream, null, options); }</code><technical_language>6 lines repeat over. pull out a common method somewhere</technical_language>

Target:
private Bitmap decodeStream(InputStream stream, Request data) throws IOException { if (stream == null) { return null; } BitmapFactory.Options options = null; if (data.needInSampleSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; InputStream is = getInputStream(); try { BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } calculateInSampleSize(data, options); } return BitmapFactory.decodeStream(stream, null, options); }
Source:
<code>public Advice[] getAdviceChain() { <START> return adviceChain; <END> }</code><technical_language>this. addAdvices(Advice... advices)</technical_language>

Target:
public Advice[] getAdviceChain() { return this.adviceChain; }
Source:
<code>public static void setPortSide(final LPort port) { LNode portDummy = port.getProperty(InternalProperties.PORT_DUMMY); if (portDummy != null) { port.setSide(portDummy.getProperty(InternalProperties.EXT_PORT_SIDE)); } else if (port.getNetFlow() < 0) { port.setSide(PortSide.EAST); } else { port.setSide(PortSide.WEST); } if (!port.isExplicitlySuppliedPortAnchor()) { KVector portSize = port.getSize(); KVector portAnchor = port.getAnchor(); <START> <END> switch (port.getSide()) { case NORTH: portAnchor.x = portSize.x / 2; portAnchor.y = 0; break; case EAST: portAnchor.x = portSize.x; portAnchor.y = portSize.y / 2; break; case SOUTH: portAnchor.x = portSize.x / 2; portAnchor.y = portSize.y; break; case WEST: portAnchor.x = 0; portAnchor.y = portSize.y / 2; break; } } }</code><technical_language>want this code call LPort instead of computing sides ourselves? In fact, is this necessary</technical_language>

Target:
public static void setPortSide(final LPort port) { LNode portDummy = port.getProperty(InternalProperties.PORT_DUMMY); if (portDummy != null) { port.setSide(portDummy.getProperty(InternalProperties.EXT_PORT_SIDE)); } else if (port.getNetFlow() < 0) { port.setSide(PortSide.EAST); } else { port.setSide(PortSide.WEST); } }
Source:
<code>public void testBroadcastCorrelatedSubqueryAvoidsRemoteExchangeBeforeAggregation() { Session broadcastJoin = Session.builder(this.getQueryRunner().getDefaultSession()) .setSystemProperty(DISTRIBUTED_JOIN, Boolean.toString(false)) .setSystemProperty(FORCE_SINGLE_NODE_OUTPUT, Boolean.toString(false)) .build(); assertEquals( countOfMatchingNodes( plan("SELECT (SELECT count(*) FROM region r2 WHERE r2.regionkey > r1.regionkey) FROM region r1", OPTIMIZED_AND_VALIDATED, broadcastJoin, false), node -> node instanceof ExchangeNode && ((ExchangeNode) node).getScope() == REMOTE), 1); assertEquals( countOfMatchingNodes( plan( <START> "SELECT count(count) " + <END> "FROM (SELECT o1.orderkey orderkey, (SELECT count(*) FROM orders o2 WHERE o2.orderkey > o1.orderkey) count FROM orders o1) " + "GROUP BY orderkey", OPTIMIZED_AND_VALIDATED, broadcastJoin, false), node -> node instanceof ExchangeNode && ((ExchangeNode) node).getScope() == REMOTE), 1); }</code><technical_language>Checking for total number of RemoteExchange nodes feel enough. check exchange node is "for LEFT JOIN build rows"</technical_language>

Target:
public void testBroadcastCorrelatedSubqueryAvoidsRemoteExchangeBeforeAggregation() { Session broadcastJoin = Session.builder(this.getQueryRunner().getDefaultSession()) .setSystemProperty(DISTRIBUTED_JOIN, Boolean.toString(false)) .setSystemProperty(FORCE_SINGLE_NODE_OUTPUT, Boolean.toString(false)) .build(); PlanMatchPattern joinBuildSideWithRemoteExchange = anyTree( node(JoinNode.class, anyTree( node(TableScanNode.class)), anyTree( exchange(REMOTE, ExchangeNode.Type.REPLICATE, anyTree( node(TableScanNode.class)))))); Consumer<Plan> validateSingleRemoteExchange = plan -> assertEquals( countOfMatchingNodes( plan, node -> node instanceof ExchangeNode && ((ExchangeNode) node).getScope() == REMOTE), 1); assertPlanWithSession( "SELECT (SELECT count(*) FROM region r2 WHERE r2.regionkey > r1.regionkey) FROM region r1", broadcastJoin, false, joinBuildSideWithRemoteExchange, validateSingleRemoteExchange); assertPlanWithSession( "SELECT count(count) " + "FROM (SELECT o1.orderkey orderkey, (SELECT count(*) FROM orders o2 WHERE o2.orderkey > o1.orderkey) count FROM orders o1) " + "GROUP BY orderkey", broadcastJoin, false, joinBuildSideWithRemoteExchange, validateSingleRemoteExchange); }
Source:
<code>public StreamEvent find(StateEvent matchingEvent, CompiledCondition compiledCondition, SiddhiQueryContext siddhiQueryContext) { try { SnapshotService.getSkipStateStorageThreadLocal().set(true); if (latencyTrackerFind != null && Level.BASIC.compareTo(siddhiQueryContext.getSiddhiAppContext().getRootMetricsLevel()) <= 0) { latencyTrackerFind.markIn(); throughputTrackerFind.eventIn(); } if (!isFirstEventArrived) { <START> this.recreateInMemoryData.recreateInMemoryData(); <END> } return ((IncrementalAggregateCompileCondition) compiledCondition).find(matchingEvent, aggregationDefinition, incrementalExecutorMap, aggregationTables, baseExecutorsForFind, outputExpressionExecutors, siddhiQueryContext, aggregateProcessExpressionExecutorsListForFind, groupByKeyGeneratorList, shouldUpdateTimestamp); } finally { SnapshotService.getSkipStateStorageThreadLocal().set(null); if (latencyTrackerFind != null && Level.BASIC.compareTo(siddhiQueryContext.getSiddhiAppContext().getRootMetricsLevel()) <= 0) { latencyTrackerFind.markOut(); } } }</code><technical_language>need synchronise this</technical_language>

Target:
public StreamEvent find(StateEvent matchingEvent, CompiledCondition compiledCondition, SiddhiQueryContext siddhiQueryContext) { try { SnapshotService.getSkipStateStorageThreadLocal().set(true); if (latencyTrackerFind != null && Level.BASIC.compareTo(siddhiQueryContext.getSiddhiAppContext().getRootMetricsLevel()) <= 0) { latencyTrackerFind.markIn(); throughputTrackerFind.eventIn(); } if (!isDistributed && !isFirstEventArrived) { recreateInMemoryData(false); } return ((IncrementalAggregateCompileCondition) compiledCondition).find(matchingEvent, aggregationDefinition, incrementalExecutorMap, aggregationTables, baseExecutorsForFind, outputExpressionExecutors, siddhiQueryContext, aggregateProcessExpressionExecutorsListForFind, groupByKeyGeneratorList, shouldUpdateTimestamp); } finally { SnapshotService.getSkipStateStorageThreadLocal().set(null); if (latencyTrackerFind != null && Level.BASIC.compareTo(siddhiQueryContext.getSiddhiAppContext().getRootMetricsLevel()) <= 0) { latencyTrackerFind.markOut(); } } }
Source:
<code>public void viewChainOfTrust() { chainOfTrust = new HashMap<>(); selectedCertsChain = new ArrayList<>(); if (null == selectedTSCertificate) { <START> HelperUtil.addMessageError(TRUST_STORE_MSG, "Please choose a certificate to view-chain."); <END> return; } try { chainOfTrust = buildChainOfTrustMap(service.listChainOfTrust(selectedTSCertificate.getAlias())); } catch (CertificateManagerException ex) { LOG.error("Error while calling server to get certificate-chain: {}", ex.getMessage(), ex); } HelperUtil.execPFShowDialog("wgvDlgChainOfTrust"); }</code><technical_language>remove - in "view-chain"</technical_language>

Target:
public void viewChainOfTrust() { chainOfTrust = new HashMap<>(); selectedCertsChain = new ArrayList<>(); if (null == selectedTSCertificate) { HelperUtil.addMessageError(TRUST_STORE_MSG, "Please choose a certificate to view chain."); return; } try { chainOfTrust = buildChainOfTrustMap(service.listChainOfTrust(selectedTSCertificate.getAlias())); } catch (CertificateManagerException ex) { LOG.error("Error while calling server to get certificate chain: {}", ex.getMessage(), ex); } HelperUtil.execPFShowDialog("wgvDlgChainOfTrust"); }
Source:
<code>public WatchPageObject unfollowImage(String wikiURL, String imageName) { getUrl( wikiURL + URLsContent.wikiDir + URLsContent.fileNS + <START> imageName+ <END> "?action=unwatch" ); return new WatchPageObject(driver); }</code><technical_language>space</technical_language>

Target:
public WatchPageObject unfollowImage(String wikiURL, String imageName) { String url = URLsContent.buildUrl( wikiURL + URLsContent.wikiDir + URLsContent.fileNameSpace + imageName, URLsContent.unfollowParameter ); getUrl(url); return new WatchPageObject(driver); }
Source:
<code>private void notifyRoutingTableChange(String clusterName) { long startTime = System.currentTimeMillis(); for (Map.Entry<RoutingTableChangeListener, ListenerContext> entry : _routingTableChangeListenerMap.entrySet()) { entry.getKey() <START> .onRoutingTableChange(new RoutingTableSnapshot(_routingTableRef.get()), entry.getValue().getContext()); <END> } logger.info("RoutingTableProvider callback [aka not helix time] for cluster {}, take ms.", clusterName, (System.currentTimeMillis() - startTime)); }</code><technical_language>clearer _routingTableChangeListenerMap.entrySet().forEach((k, v) -> k.onRoutingTableChange(...));</technical_language>

Target:
private void notifyRoutingTableChange(String clusterName) { long startTime = System.currentTimeMillis(); for (Map.Entry<RoutingTableChangeListener, ListenerContext> entry : _routingTableChangeListenerMap.entrySet()) { entry.getKey() .onRoutingTableChange(new RoutingTableSnapshot(_routingTableRef.get()), entry.getValue().getContext()); } logger.info("RoutingTableProvider user callback time for cluster {}, took ms.", clusterName, (System.currentTimeMillis() - startTime)); }
Source:
<code>public void errorHandler_clientResetReported() { SyncUser user = createTestUser(); String url = "realm://objectserver.realm.io/default"; final SyncConfiguration config = configFactory.createSyncConfigurationBuilder(user , url) .errorHandler(new SyncSession.ErrorHandler() { @Override public void onError(SyncSession session, ObjectServerError error) { if (error.getErrorCode() != ErrorCode.CLIENT_RESET) { fail("Wrong error " + error.toString()); return; } final ClientResetRequiredError handler = (ClientResetRequiredError) error; String filePathFromError = handler.getOriginalFile().getAbsolutePath(); String filePathFromConfig = session.getConfiguration().getPath(); Log.e("H4XOR", ">>>>>>>>>>>>>>>>> filePathFromError : " + filePathFromError); Log.e("H4XOR", ">>>>>>>>>>>>>>>>> filePathFromConfig : " + filePathFromConfig); Log.e("H4XOR", ">>>>>>>>>>>>>>>>> handler.getBackupFile().exists() : " + handler.getBackupFile().exists()); <START> Log.e("H4XOR", ">>>>>>>>>>>>>>>>> handler.getOriginalFile().exists() : " + handler.getOriginalFile().exists()); <END> fail(">>>>>>>>>>>>>>> NEW COMMIT"); assertEquals(filePathFromError, filePathFromConfig); assertFalse(handler.getBackupFile().exists()); assertTrue(handler.getOriginalFile().exists()); looperThread.testComplete(); } }) .build(); Realm realm = Realm.getInstance(config); looperThread.addTestRealm(realm); SyncManager.simulateClientReset(SyncManager.getSession(config)); }</code><technical_language>Um... This is trickier day, up</technical_language>

Target:
public void errorHandler_clientResetReported() { SyncUser user = createTestUser(); String url = "realm://objectserver.realm.io/default"; final SyncConfiguration config = configFactory.createSyncConfigurationBuilder(user, url) .errorHandler(new SyncSession.ErrorHandler() { @Override public void onError(SyncSession session, ObjectServerError error) { if (error.getErrorCode() != ErrorCode.CLIENT_RESET) { fail("Wrong error " + error.toString()); return; } final ClientResetRequiredError handler = (ClientResetRequiredError) error; String filePathFromError = handler.getOriginalFile().getAbsolutePath(); String filePathFromConfig = session.getConfiguration().getPath(); assertEquals(filePathFromError, filePathFromConfig); assertFalse(handler.getBackupFile().exists()); assertTrue(handler.getOriginalFile().exists()); looperThread.testComplete(); } }) .build(); Realm realm = Realm.getInstance(config); looperThread.addTestRealm(realm); SyncManager.simulateClientReset(SyncManager.getSession(config)); }
Source:
<code>private static ArrayList<Integer> computeTargetWidths(double begin, double end, double tol) { if (notCustom(begin, end, tol)) { <START> return targetWidths(); <END> } if (begin == end) { return new ArrayList<Integer>((int) begin); } ArrayList<Integer> resolutions = new ArrayList<Integer>(); while (begin < end && begin < MAX_WIDTH) { resolutions.add((int) Math.round(begin)); begin *= 1 + (tol / 100) * 2; } int lastIndex = resolutions.size() - 1; if (resolutions.get(lastIndex) < end) { resolutions.add((int) end); } return resolutions; }</code><technical_language>this replaced SRCSET_TARGET_WIDTHS</technical_language>

Target:
private static ArrayList<Integer> computeTargetWidths(double begin, double end, double tol) { if (notCustom(begin, end, tol)) { return new ArrayList<Integer>(Arrays.asList(SRCSET_TARGET_WIDTHS)); } ArrayList<Integer> resolutions = new ArrayList<Integer>(); if (begin == end) { resolutions.add((int) begin); return resolutions; } while (begin < end && begin < MAX_WIDTH) { resolutions.add((int) Math.round(begin)); begin *= 1 + (tol / 100) * 2; } int lastIndex = resolutions.size() - 1; if (resolutions.get(lastIndex) < end) { resolutions.add((int) end); } return resolutions; }
Source:
<code>public void testBasicScenario() throws Exception { <START> new MockServerClient(mockServer.getContainerIpAddress(), mockServer.getMappedPort(MockServerContainer.PORT)) <END> .when(request("/hello")) .respond(response("Hello World!")); URLConnection urlConnection = new URL(mockServer.getEndpoint() + "/hello").openConnection(); @Cleanup BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line = reader.readLine(); System.out.println(line); assertTrue("MockServer returns correct result", line.contains("Hello World!")); }</code><technical_language>nice add mockServer.getServerPort() hide constant</technical_language>

Target:
public void testBasicScenario() throws Exception { new MockServerClient(mockServer.getContainerIpAddress(), mockServer.getServerPort()) .when(request("/hello")) .respond(response("Hello World!")); URLConnection urlConnection = new URL(mockServer.getEndpoint() + "/hello").openConnection(); @Cleanup BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line = reader.readLine(); System.out.println(line); assertTrue("MockServer returns correct result", line.contains("Hello World!")); }
Source:
<code>public void startService() { super.startService(); if (controller == null) { controller = (ServoController) startPeer("arduino"); } <START> if (jaw == null) { <END> jaw = (ServoControl) startPeer("jaw"); jaw.setMinMax(10.0, 25.0); jaw.setRest(10.0); } if (eyeX == null) { eyeX = (ServoControl) startPeer("eyeX"); eyeX.setMinMax(60.0, 100.0); eyeX.setRest(80.0); } if (eyeY == null) { eyeY = (ServoControl) startPeer("eyeY"); eyeY.setMinMax(50.0, 100.0); eyeY.setRest(90.0); } if (rollNeck == null) { rollNeck = (ServoControl) startPeer("rollNeck"); rollNeck.setMinMax(20.0, 160.0); rollNeck.setRest(90.0); } if (neck == null) { neck = (ServoControl) startPeer("neck"); neck.setMinMax(20.0, 160.0); neck.setRest(90.0); } if (rothead == null) { rothead = (ServoControl) startPeer("rothead"); rothead.setMinMax(20.0, 160.0); rothead.setRest(90.0); } setVelocity(45.0, 45.0, null, null, null, 45.0); }</code><technical_language>this hard coded configuration stuff moved form startService. a lifecycle perspective i 3 separate phases. 1. create service . 2. configure service .. 3. start service. this code forces 3 2 occur matter what</technical_language>

Target:
public void startService() { super.startService(); if (controller == null) { controller = (ServoController) startPeer("arduino"); } startPeer("jaw"); startPeer("eyeX"); startPeer("eyeY"); startPeer("rothead"); startPeer("neck"); startPeer("rollNeck"); if (jaw == null) { jaw = (ServoControl) startPeer("jaw"); jaw.setMinMax(10.0, 25.0); jaw.setRest(10.0); } if (eyeX == null) { eyeX = (ServoControl) startPeer("eyeX"); eyeX.setMinMax(60.0, 100.0); eyeX.setRest(80.0); } if (eyeY == null) { eyeY = (ServoControl) startPeer("eyeY"); eyeY.setMinMax(50.0, 100.0); eyeY.setRest(90.0); } if (rollNeck == null) { rollNeck = (ServoControl) startPeer("rollNeck"); rollNeck.setMinMax(20.0, 160.0); rollNeck.setRest(90.0); } if (neck == null) { neck = (ServoControl) startPeer("neck"); neck.setMinMax(20.0, 160.0); neck.setRest(90.0); } if (rothead == null) { rothead = (ServoControl) startPeer("rothead"); rothead.setMinMax(20.0, 160.0); rothead.setRest(90.0); } setVelocity(45.0, 45.0, null, null, null, 45.0); }
Source:
<code>public CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache, IgniteBiPredicate<K, V> filter) { this.ignite = ignite; this.upstreamCache = upstreamCache; this.filter = filter; <START> this.transformers = new LinkedList<>(); <END> this.transformerDataSuppliers = new LinkedList<>(); }</code><technical_language>linked lists</technical_language>

Target:
public CacheBasedDatasetBuilder(Ignite ignite, IgniteCache<K, V> upstreamCache, IgniteBiPredicate<K, V> filter) { this.ignite = ignite; this.upstreamCache = upstreamCache; this.filter = filter; transformersChain = UpstreamTransformerChain.empty(); }
Source:
<code>private void scrollToElement_feedbackEditPage_scrolledCorrectly() { JavascriptExecutor javascriptExecutor = (JavascriptExecutor) browser.driver; <START> assertFalse(feedbackEditPage.isElementInViewport("empty_message")); <END> javascriptExecutor.executeScript("scrollToElement(document.getElementById('empty_message'), {duration: 800});"); ThreadHelper.waitFor(800); assertTrue(feedbackEditPage.isElementInViewport("empty_message")); }</code><technical_language>pretty weird isElementInViewport function takes in a string instead of a WebElement. if changing function break other code, for this function define String elementId = "empty_message" clearer (for script, %s format in)</technical_language>

Target:
private void scrollToElement_feedbackEditPage_scrolledCorrectly() { JavascriptExecutor javascriptExecutor = (JavascriptExecutor) browser.driver; String elementId = "empty_message"; assertFalse(feedbackEditPage.isElementInViewport(elementId)); String scrollToElementScript = "scrollToElement(document.getElementById(%s), {duration: 800});"; javascriptExecutor.executeScript(String.format(scrollToElementScript, "\'" + elementId + "\'")); ThreadHelper.waitFor(800); assertTrue(feedbackEditPage.isElementInViewport(elementId)); }
Source:
<code><START> private void removeDataCenter() { <END> getCompensationContext().snapshotEntity(getStoragePool()); getStoragePoolDAO().remove(getStoragePool().getId()); getCompensationContext().stateChanged(); }</code><technical_language>issues - 1. if engine crash line 96 - in case storage pool data recorded in database recovered (becasue .stateChanged() executed) 2. if execution fails line 88 (free macs later), bug - reason for is compensation context insertion order for saved entities, attempt re-insert records FK storage pool table inserting storage pool. solution is removal of storage pool done transaction resetting compensation context database operation here. private void removeDataCenter() { TransactionSupport.executeInNewTransaction....{ getStoragePoolDAO().remove(getStoragePool().getId()); getCompensationContext().reset); } }</technical_language>

Target:
private void removeDataCenter() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntity(getStoragePool()); getStoragePoolDAO().remove(getStoragePool().getId()); getCompensationContext().stateChanged(); return null; } }); }
Source:
<code><START> public List<Integer> getCurrentPositionOfSounds() { <END> List<Integer> positionList = new ArrayList<>(); for (MediaPlayer mediaPlayer : mediaPlayers) { int position = mediaPlayer.isPlaying() ? mediaPlayer.getCurrentPosition() : mediaPlayer.getDuration(); positionList.add(position); } return positionList; }</code><technical_language>Please rename this function. is useful map sounds positions</technical_language>

Target:
private List<Integer> getCurrentPositionOfSounds() { List<Integer> positionList = new ArrayList<>(); for (MediaPlayer mediaPlayer : mediaPlayers) { positionList.add(mediaPlayer.getCurrentPosition()); } return positionList; }
Source:
<code>private void listProfileFiles() { try (Stream<Path> files = Files.list(profilePath)) { files .filter(Files::isRegularFile) .filter(file -> file.toAbsolutePath().toString().endsWith(PROFILE_EXTENSION)) <START> .forEach(profile -> console.println(FilenameUtils.removeExtension(profile.toString()))); <END> } catch (IOException e) { printError("Error occurred when locating profiles"); LOGGER.error("An error occured when locating profiles", e); } }</code><technical_language>I do start printing out path console now? put name part (minus extension). FilenameUtils.removeExtension()</technical_language>

Target:
private void listProfileFiles() { try (Stream<Path> files = Files.list(profilePath)) { files .filter(Files::isRegularFile) .filter(file -> file.toAbsolutePath().toString().endsWith(PROFILE_EXTENSION)) .forEach( profile -> console.println(FilenameUtils.removeExtension(profile.toFile().getName()))); } catch (IOException e) { printError("Error occurred when locating profiles"); LOGGER.error("An error occured when locating profiles", e); } }
Source:
<code>public Issue editIssueState(IRepositoryIdProvider repository, int issueId, boolean isOpen) throws IOException { HttpURLConnection connection = createIssuePostConnection(repository, issueId); HashMap<Object, Object> data = new HashMap<>(); String state; <START> if (isOpen) { <END> state = STATE_OPEN; } else { state = STATE_CLOSED; } data.put(FILTER_STATE, state); return ghClient.sendJson(connection, data, Issue.class); }</code><technical_language>While it, state = isOpen ? ... : ...</technical_language>

Target:
public Issue editIssueState(IRepositoryIdProvider repository, int issueId, boolean isOpen) throws IOException { HttpURLConnection connection = createIssuePostConnection(repository, issueId); HashMap<Object, Object> data = new HashMap<>(); String state = isOpen ? STATE_OPEN : STATE_CLOSED; data.put(FILTER_STATE, state); return ghClient.sendJson(connection, data, Issue.class); }
Source:
<code>public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { logger.info("Performing complete notifications"); <START> listener.getLogger().println("[INFO] Slack notifications will be sent to the following channels: " + String.join(", ", this.getRoom()) + " on " + this.getTeamDomain()); <END> new ActiveNotifier((SlackNotifier) this, listener).completed(build); if (notifyRegression) { logger.info("Performing finalize notifications"); new ActiveNotifier((SlackNotifier) this, listener).finalized(build); } return true; }</code><technical_language>better, do need string.join? a string? teamDomain set, baseUrl instead. Needs figure out is in checking is prioritised in code add text if set</technical_language>

Target:
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { logger.info("Performing complete notifications"); String teamDomain = this.getTeamDomain(); if (StringUtils.isEmpty(teamDomain)) { teamDomain = getDescriptor().getTeamDomain(); } if (StringUtils.isEmpty(teamDomain)) { teamDomain = ""; } else { teamDomain = " on Team Subdomain: " + teamDomain; } String room = this.getRoom(); if (StringUtils.isEmpty(room)) { room = getDescriptor().getRoom(); } if (StringUtils.isEmpty(room)) { listener.getLogger().println("[INFO] Slack notifications enabled in post-build but no Channel was found in the job or global config"); } else { listener.getLogger().println("[INFO] Slack notifications will be sent to the following channels: " + room + teamDomain); } new ActiveNotifier((SlackNotifier) this, listener).completed(build); if (notifyRegression) { logger.info("Performing finalize notifications"); new ActiveNotifier((SlackNotifier) this, listener).finalized(build); } return true; }
Source:
<code>public void prepareTestData() { <START> Configuration.browser = WebDriverRunner.CHROME; <END> position = "30x60"; String[] coordinates = position.split("x"); int x = Integer.parseInt(coordinates[0]); int y = Integer.parseInt(coordinates[1]); point = new Point(x, y); }</code><technical_language>chrome? if I run test firefox</technical_language>

Target:
public void prepareTestData() { position = "30x60"; String[] coordinates = position.split("x"); int x = Integer.parseInt(coordinates[0]); int y = Integer.parseInt(coordinates[1]); point = new Point(x, y); }
Source:
<code>protected void patternImageChanged() { for (IPatternImageChangedListener listener : _listeners) { <START> listener.patternImageChanged(getPatternImage()); <END> } }</code><technical_language>relevant a unique call getPatternImage() loop store in a local variable, calls synchronized methods costly</technical_language>

Target:
protected void patternImageChanged() { Image changedImage = getPatternImage(); for (IPatternImageChangedListener listener : _listeners) { listener.patternImageChanged(changedImage); } }