auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void moveContentToColdStorage(DocumentModel documentModel) throws OperationException, IOException { assertFalse(documentModel.hasFacet(COLD_STORAGE)); try (OperationContext context = new OperationContext(session)) { context.setInput(documentModel); <START> DocumentModel updatedDocModel = (DocumentModel) automationService.run(context, MoveToColdStorage.ID, <END> Map.of()); Blob fileContent = (Blob) updatedDocModel.getPropertyValue(FILE_CONTENT_PROPERTY); Blob coldStorageContent = (Blob) updatedDocModel.getPropertyValue(COLD_STORAGE_CONTENT_PROPERTY); assertEquals(documentModel.getRef(), updatedDocModel.getRef()); assertTrue(updatedDocModel.hasFacet(COLD_STORAGE)); assertEquals(DUMMY_THUMBNAIL_CONTENT, fileContent.getString()); assertEquals(FILE_CONTENT, coldStorageContent.getString()); } }</code><technical_language>I 2-parameter method instead of passing empty Map</technical_language>

Target:
protected void moveContentToColdStorage(DocumentModel documentModel) throws OperationException, IOException { try (OperationContext context = new OperationContext(session)) { context.setInput(documentModel); DocumentModel updatedDocModel = (DocumentModel) automationService.run(context, MoveToColdStorage.ID); Blob fileContent = (Blob) updatedDocModel.getPropertyValue(FILE_CONTENT_PROPERTY); Blob coldStorageContent = (Blob) updatedDocModel.getPropertyValue(COLD_STORAGE_CONTENT_PROPERTY); assertEquals(documentModel.getRef(), updatedDocModel.getRef()); assertTrue(updatedDocModel.hasFacet(COLD_STORAGE)); assertEquals(DUMMY_THUMBNAIL_CONTENT, fileContent.getString()); assertEquals(FILE_CONTENT, coldStorageContent.getString()); } }
Source:
<code>private void initializeScriptingMarkerSource() { if (TmfTraceManager.getInstance().getActiveTrace() != null) { <START> ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); <END> for (IMarkerEventSource source : TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class)) { if (source.getClass() == ScriptingMarkerSource.class) { fTraceMarkersList = new ArrayList<>(); fSource = (ScriptingMarkerSource) source; fSource.initializeAdapterMarkersLists(); fSourceStatus = 1; return; } } } else { System.out.println(INVALID_TRACE); return; } }</code><technical_language>Do this if</technical_language>

Target:
private void initializeScriptingMarkerSource() { ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { for (IMarkerEventSource source : TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class)) { if (source.getClass() == ScriptingMarkerSource.class) { fTraceMarkersList = new ArrayList<>(); fSource = (ScriptingMarkerSource) source; fSource.initializeAdapterMarkersLists(); return; } } } else { System.out.println(INVALID_TRACE); return; } }
Source:
<code>public long read() { long value = nanos.getAndAdd(0); <START> return value; <END> }</code><technical_language>Interesting: is a reason wrote this opposed nanos.get();? memory semantics (this a volatile *write* well), I understand need</technical_language>

Target:
public long read() { return nanos.get(); }
Source:
<code>protected Subject createSubject(final CallbackProperties properties, final X509Certificate certificate, final PublicKey publicKey) throws SAMLComponentBuilderException { String x509Name = properties.getUsername(); if ((NullChecker.isNullish(x509Name) || !checkDistinguishedName(x509Name)) && null != certificate && null != certificate.getSubjectDN()) { x509Name = certificate.getSubjectDN().getName(); <START> <END> } return createSubject(x509Name, publicKey); }</code><technical_language>Unneeded surrounding lines for line 206</technical_language>

Target:
protected Subject createSubject(final CallbackProperties properties, final X509Certificate certificate, final PublicKey publicKey) throws SAMLComponentBuilderException { String x509Name = properties.getUsername(); if ((NullChecker.isNullish(x509Name) || !checkDistinguishedName(x509Name)) && null != certificate && null != certificate.getSubjectDN()) { x509Name = certificate.getSubjectDN().getName(); } return OpenSAML2ComponentBuilder.getInstance().createSubject(x509Name, publicKey); }
Source:
<code>public boolean canParseResource(final HttpMessage message) { try { String baseURL = getURIfromMessage(message); String contentType = message.getResponseHeader().getHeader(HttpHeader.CONTENT_TYPE); if (baseURL.endsWith(".wsdl") || contentType.equals("text/xml") || contentType.equals("application/wsdl+xml")) { String content = message.getResponseBody().toString(); if (parser.canBeWSDLparsed(content)) return true; <START> LOG.debug("Content is not wsdl: " + content); <END> } } catch (Exception e) { return false; } return false; }</code><technical_language>Worth wrapping this call, response big</technical_language>

Target:
public boolean canParseResource(final HttpMessage message) { try { String baseURL = getURIfromMessage(message); String contentType = message.getResponseHeader().getHeader(HttpHeader.CONTENT_TYPE); if (baseURL.endsWith(".wsdl") || contentType.equals("text/xml") || contentType.equals("application/wsdl+xml")) { String content = message.getResponseBody().toString(); if (parser.canBeWSDLparsed(content)) return true; if (LOG.isDebugEnabled()) { LOG.debug("Content is not wsdl: " + content); } } } catch (Exception e) { return false; } return false; }
Source:
<code>public VertexQuery queryVertex(Graph graph, Vertex vertex, String queryString, Authorizations authorizations) { return new ElasticSearchParentChildVertexQuery( getClient(), getConfig().getIndicesToQuery(), graph, vertex, queryString, getAllPropertyDefinitions(), getConfig().getScoringStrategy(), <START> getConfig().getNameSubstitutionStrategy(), <END> authorizations); }</code><technical_language>this a field create time</technical_language>

Target:
public VertexQuery queryVertex(Graph graph, Vertex vertex, String queryString, Authorizations authorizations) { return new ElasticSearchParentChildVertexQuery( getClient(), getConfig().getIndicesToQuery(), graph, vertex, queryString, getAllPropertyDefinitions(), getConfig().getScoringStrategy(), this.nameSubstitutionStrategy, authorizations); }
Source:
<code>private static void setVlanSpeeds(VDS vds) { List<VdsNetworkInterface> interfaces = vds.getInterfaces(); List<VdsNetworkInterface> vlans = interfaces .stream() <START> .filter(iface -> iface.getVlanId() != null) <END> .collect(Collectors.toList()); for (VdsNetworkInterface vlanIface : vlans) { VdsNetworkInterface baseInterface = interfaces .stream() .filter(iface -> iface.getName().equals(vlanIface.getBaseInterface())) .findFirst() .get(); vlanIface.setSpeed(baseInterface.getSpeed()); } }</code><technical_language>Please use, NetworkCommonUtils.isVlan</technical_language>

Target:
private static void setVlanSpeeds(VDS vds) { List<VdsNetworkInterface> interfaces = vds.getInterfaces(); List<VdsNetworkInterface> vlans = interfaces .stream() .filter(iface -> NetworkCommonUtils.isVlan(iface)) .collect(Collectors.toList()); for (VdsNetworkInterface vlanIface : vlans) { VdsNetworkInterface baseInterface = interfaces .stream() .filter(iface -> iface.getName().equals(vlanIface.getBaseInterface())) .findFirst() .get(); vlanIface.setSpeed(baseInterface.getSpeed()); } }
Source:
<code>public void test_presentValue_onEnd() { SimpleRatesProvider prov = provider(END_DATE); CurrencyAmount computed = PRICER.presentValue(TERM_DEPOSIT, prov); <START> double expected = (1d + RATE * TERM_DEPOSIT.expand().getYearFraction()) * dfEnd * NOTIONAL; <END> assertEquals(computed.getCurrency(), EUR); assertEquals(computed.getAmount(), expected, TOLERANCE * NOTIONAL); }</code><technical_language>END_DATE, discount factor 1</technical_language>

Target:
public void test_presentValue_onEnd() { SimpleRatesProvider prov = provider(END_DATE, 1.2d, 1.0d); CurrencyAmount computed = PRICER.presentValue(TERM_DEPOSIT, prov); double expected = (1d + RATE * TERM_DEPOSIT.expand().getYearFraction()) * 1.0d * NOTIONAL; assertEquals(computed.getCurrency(), EUR); assertEquals(computed.getAmount(), expected, TOLERANCE * NOTIONAL); }
Source:
<code>public void addQueueNames(String... queueNames) { try { addQueues(Arrays.stream(queueNames)); } catch (AmqpIOException e) { <START> throw new AmqpIOException("Failed to add " + queueNames, e.getCause()); <END> } super.addQueueNames(queueNames); }</code><technical_language>queueNames wrapped Arrays.asList(): ![array_in_sout](<LINK_0></technical_language>

Target:
public void addQueueNames(String... queueNames) { try { addQueues(Arrays.stream(queueNames)); } catch (AmqpIOException e) { throw new AmqpIOException("Failed to add " + Arrays.asList(queueNames), e.getCause()); } super.addQueueNames(queueNames); }
Source:
<code>public String q(boolean reload, boolean browser) { <START> return _getQA(reload, browser).get("q"); <END> }</code><technical_language>Code congruity upstream libanki is important, prefer if do this. <LINK_0></technical_language>

Target:
public String q(boolean reload, boolean browser) { return css() + _getQA(reload, browser).get("q"); }
Source:
<code>void validatePatchRequest(JsonNode payload){ List<String> pathCheck = requestValidator.checkIfExistsOrEmpty(payload, FIELD_OPERATION, FIELD_OPERATION_PATH); if(!pathCheck.isEmpty()){ throw new ValidationException(pathCheck); } String operation = payload.findValue(FIELD_OPERATION_PATH).asText(); if(!VALID_PATHS.contains(operation)) { throw new ValidationException(Collections.singletonList(format("Operation [%s] not supported for path [%s]", FIELD_OPERATION, payload.findValue(FIELD_OPERATION_PATH).asText()))); } if (operation.equalsIgnoreCase(FIELD_NOTIFY_SETTINGS)) { validateNotifySettingsRequest(payload); } <START> } <END></code><technical_language>this means validation requests a "path:" "email_collection_mode"</technical_language>

Target:
void validatePatchRequest(JsonNode payload){ List<String> pathCheck = requestValidator.checkIfExistsOrEmpty(payload, FIELD_OPERATION, FIELD_OPERATION_PATH); if(!pathCheck.isEmpty()){ throw new ValidationException(pathCheck); } String path = payload.findValue(FIELD_OPERATION_PATH).asText(); if(!VALID_PATHS.contains(path)) { throw new ValidationException(Collections.singletonList(format("Operation [%s] not supported for path [%s]", FIELD_OPERATION, path))); } if (path.equalsIgnoreCase(FIELD_NOTIFY_SETTINGS)) { validateNotifySettingsRequest(payload); } if (path.equalsIgnoreCase(FIELD_EMAIL_COLLECTION_MODE)) { validateEmailCollectionMode(payload); } }
Source:
<code>public BinaryHttpUpload initiateHttpUpload(String path, long maxSize, int maxParts) throws RepositoryException { if (! hasPermission(path, Session.ACTION_SET_PROPERTY)) { throw new AccessDeniedException(String.format("No permission to add binary property at path %s", path)); } <START> return sd.safePerformNullable(new ReadOperation<BinaryHttpUpload>("initiateHttpUpload") { <END> @Nullable @Override public BinaryHttpUpload performNullable() throws RepositoryException { HttpBlobProvider httpBlobProvider = getHttpBlobProvider(); if (httpBlobProvider == null) { return null; } BlobHttpUpload upload = httpBlobProvider.initiateHttpUpload(maxSize, maxParts); if (upload != null) { return new BinaryHttpUpload() { @Override public String getUploadToken() { return upload.getUploadToken(); } @Override public long getMinPartSize() { return upload.getMinPartSize(); } @Override public long getMaxPartSize() { return upload.getMaxPartSize(); } @Nonnull @Override public Collection<URL> getUploadURLs() { return upload.getUploadURLs(); } }; } return null; } }); }</code><technical_language>@Oak experts: ReadOperation (and in 2 new methods below) is-session-alive check (which want). This is a write change repository (NodeStore) in way, technically a read repository, ReadOperation care. Please check if approach works</technical_language>

Target:
public HttpBinaryUpload initiateHttpUpload(String path, long maxSize, int maxParts) throws RepositoryException { if (! hasPermission(path, Session.ACTION_SET_PROPERTY)) { throw new AccessDeniedException(String.format("No permission to add binary property at path %s", path)); } return sd.safePerformNullable(new ReadOperation<HttpBinaryUpload>("initiateHttpUpload") { @Nullable @Override public HttpBinaryUpload performNullable() throws RepositoryException { HttpBlobProvider httpBlobProvider = getHttpBlobProvider(); if (httpBlobProvider == null) { return null; } HttpBlobUpload upload = httpBlobProvider.initiateHttpUpload(maxSize, maxParts); if (upload != null) { return new HttpBinaryUpload() { @Override public String getUploadToken() { return upload.getUploadToken(); } @Override public long getMinPartSize() { return upload.getMinPartSize(); } @Override public long getMaxPartSize() { return upload.getMaxPartSize(); } @Nonnull @Override public Collection<URL> getUploadURLs() { return upload.getUploadURLs(); } }; } return null; } }); }
Source:
<code>public void init() throws Exception { initMocks(this); <START> processor = new FulltextProcessor(fileName); <END> file = tmpDir.newFile(fileName + ".txt"); file.deleteOnExit(); when(exchange.getIn()).thenReturn(message); when(message.getHeader(eq(FCREPO_URI))).thenReturn(BINARY_URI); try (BufferedWriter writeFile = new BufferedWriter(new FileWriter(file))) { writeFile.write(testText); } String filePath = file.getAbsolutePath().toString(); when(message.getHeader(eq(CdrBinaryPath))) .thenReturn(filePath); when(message.getHeader(eq(CdrBinarySubPath))) .thenReturn(derivativeSubPath); }</code><technical_language>fileName derivative directory, I is currently created. create a subfolder in tmpDir for that</technical_language>

Target:
public void init() throws Exception { initMocks(this); TestHelper.setContentBase(FEDORA_BASE); derivPath = tmpDir.newFolder().getAbsolutePath(); processor = new FulltextProcessor(derivPath); when(exchange.getIn()).thenReturn(message); when(message.getHeader(eq(FCREPO_URI))).thenReturn(RESC_ID); finalDerivativeFile = new File(derivPath + "/" + derivativeFinalPath + ".txt"); finalDerivativeFile.delete(); }
Source:
<code>private void listenOnAddress(String address) throws IOException { mServerSocket = bindToSocket(address); LogUtil.i("Listening on @" + address); while (!Thread.interrupted()) { try { LocalSocket socket = mServerSocket.accept(); Thread t = new WorkerThread(socket, mSocketHandler); t.setName( WORKER_THREAD_NAME_PREFIX + "-" + mFriendlyName + "-" + mThreadId.incrementAndGet()); t.setDaemon(true); t.start(); } catch (SocketException se) { if (!Thread.interrupted()) { LogUtil.w(se, "I/O error"); <START> } <END> } catch (InterruptedIOException ex) { break; } catch (IOException e) { LogUtil.w(e, "I/O error initialising connection thread"); break; } } }</code><technical_language>Thread.interrupted resets state (<LINK_0>, this include 'else { break; }'</technical_language>

Target:
private void listenOnAddress(String address) throws IOException { mServerSocket = bindToSocket(address); LogUtil.i("Listening on @" + address); while (!Thread.interrupted()) { try { LocalSocket socket = mServerSocket.accept(); Thread t = new WorkerThread(socket, mSocketHandler); t.setName( WORKER_THREAD_NAME_PREFIX + "-" + mFriendlyName + "-" + mThreadId.incrementAndGet()); t.setDaemon(true); t.start(); } catch (SocketException se) { if (Thread.interrupted()) { break; } LogUtil.w(se, "I/O error"); } catch (InterruptedIOException ex) { break; } catch (IOException e) { LogUtil.w(e, "I/O error initialising connection thread"); break; } } LogUtil.i("Server shutdown on @" + address); }
Source:
<code>private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { runnable.run(); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } else { LOG.debug("Action: completed successfully.", actionName); } <START> } catch (Exception exception) { <END> LOG.error("Execution of action: failed.", actionName, exception); doCleanUpOnTaskException(exception); } }; }</code><technical_language>I changes in hot-fix branch. provide context changing this exception throwable</technical_language>

Target:
private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { runnable.run(); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } else { LOG.debug("Action: completed successfully.", actionName); } } catch (Throwable throwable) { LOG.error("Execution of action: failed.", actionName, throwable); doCleanUpOnTaskException(throwable); } }; }
Source:
<code>protected void initStreamImplementation(RuntimeHarness harness) throws IOException { log.info("Deploying stream work manager implementation"); defaultProperty(STREAM_WORK_MANAGER_STORESTATE_ENABLED_PROPERTY, STREAM_WORK_MANAGER_STORESTATE_ENABLED_DEFAULT); <START> deployComponent(harness, "OSGI-INF/test-stream-workmanager-config.xml"); <END> }</code><technical_language>harness#deployContrib</technical_language>

Target:
protected void initStreamImplementation(RuntimeHarness harness) throws Exception { defaultProperty(STREAM_WORK_MANAGER_STORESTATE_ENABLED_PROPERTY, STREAM_WORK_MANAGER_STORESTATE_ENABLED_DEFAULT); harness.deployContrib(BUNDLE_TEST_NAME, "OSGI-INF/test-stream-workmanager-config.xml"); }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.create: if (TextUtils.isEmpty(mFolder.id)) { Toast.makeText(this, R.string.folder_id_required, Toast.LENGTH_LONG) .show(); return true; } if (TextUtils.isEmpty(mFolder.path)) { Toast.makeText(this, R.string.folder_path_required, Toast.LENGTH_LONG) .show(); return true; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && <START> mFolderUri != null) { <END> DocumentFile dfFolder = DocumentFile.fromTreeUri(this, mFolderUri); if (dfFolder != null) { Log.v(TAG, "Creating new directory " + mFolder.path + File.separator + FOLDER_MARKER_NAME); dfFolder.createDirectory(FOLDER_MARKER_NAME); } } getApi().createFolder(mFolder); finish(); return true; case R.id.remove: showDeleteDialog(); return true; case android.R.id.home: onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } }</code><technical_language>do this for send folders</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.create: if (TextUtils.isEmpty(mFolder.id)) { Toast.makeText(this, R.string.folder_id_required, Toast.LENGTH_LONG) .show(); return true; } if (TextUtils.isEmpty(mFolder.path)) { Toast.makeText(this, R.string.folder_path_required, Toast.LENGTH_LONG) .show(); return true; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mFolderUri != null && mFolder.type.equals(Constants.FOLDER_TYPE_SEND_ONLY)) { DocumentFile dfFolder = DocumentFile.fromTreeUri(this, mFolderUri); if (dfFolder != null) { Log.v(TAG, "Creating new directory " + mFolder.path + File.separator + FOLDER_MARKER_NAME); dfFolder.createDirectory(FOLDER_MARKER_NAME); } } getApi().createFolder(mFolder); finish(); return true; case R.id.remove: showDeleteDialog(); return true; case android.R.id.home: onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } }
Source:
<code>private static Set<BingTile> latitudeLongitudeToSurroundingTiles(double latitude, double longitude, int zoomLevel, int radius) { int mapSize = mapSize(zoomLevel); checkCondition((radius >= 0 && radius < mapSize / TILE_PIXELS), "radius should be between 0 and map size"); int tileX = longitudeToTileX(longitude, mapSize); int tileY = longitudeToTileY(latitude, mapSize); Set<BingTile> bingTiles = new HashSet<>(); <START> IntStream.rangeClosed(-1 * radius, radius).forEach(i -> { <END> IntStream.rangeClosed(-1 * radius, radius).forEach(j -> { if (coordinateInsideBoundary(tileX + i, mapSize) && coordinateInsideBoundary(tileY + j, mapSize)) { bingTiles.add(BingTile.fromCoordinates(tileX + i, tileY + j, zoomLevel)); } }); }); return Collections.unmodifiableSet(bingTiles); }</code><technical_language>a regular for</technical_language>

Target:
private static Set<BingTile> latitudeLongitudeToSurroundingTiles(double latitude, double longitude, int zoomLevel, int radius) { long mapSize = mapSize(zoomLevel); long maxTileIndex = (mapSize / TILE_PIXELS) - 1; checkCondition(radius >= 0 && radius <= maxTileIndex, "radius should be between 0 and map size"); int tileX = longitudeToTileX(longitude, mapSize); int tileY = longitudeToTileY(latitude, mapSize); Set<BingTile> bingTiles = new HashSet<>(); for (int i = -1 * radius; i <= radius; i++) { for (int j = -1 * radius; j <= radius; j++) { if (coordinateInsideBoundary(tileX + i, maxTileIndex) && coordinateInsideBoundary(tileY + j, maxTileIndex)) { bingTiles.add(BingTile.fromCoordinates(tileX + i, tileY + j, zoomLevel)); } } } return unmodifiableSet(bingTiles); }
Source:
<code>void onHideEmptyPane(ValueChangeEvent<Boolean> e) { prefs.hideEmptyPane(!e.getValue()); <START> view.diffTable.setHideEmptyPane(!e.getValue()); <END> if (!e.getValue()) { if (view.diffTable.getChangeType() == ChangeType.ADDED) { leftSide.setValue(false); leftSide.setEnabled(false); } } else { leftSide.setValue(view.diffTable.isVisibleA()); leftSide.setEnabled(true); } }</code><technical_language>prefs.hideEmptyPane() If in this code e.g. onLineNumbers line 292 "wash" prefs object get prefs object used. This is in case prefs object is normalization of values crazy</technical_language>

Target:
void onHideEmptyPane(ValueChangeEvent<Boolean> e) { prefs.hideEmptyPane(!e.getValue()); view.diffTable.setHideEmptyPane(prefs.hideEmptyPane()); if (prefs.hideEmptyPane()) { if (view.diffTable.getChangeType() == ChangeType.ADDED) { leftSide.setValue(false); leftSide.setEnabled(false); } } else { leftSide.setValue(view.diffTable.isVisibleA()); leftSide.setEnabled(true); } }
Source:
<code>Single<Integer> validateImage(UploadModel.UploadItem uploadItem, boolean checkTitle) { int currentImageQuality = uploadItem.getImageQuality(); Timber.d("Current image quality is %d", currentImageQuality); if (currentImageQuality == ImageUtils.IMAGE_KEEP) { return Single.just(ImageUtils.IMAGE_OK); } Timber.d("Checking the validity of image"); String filePath = uploadItem.getMediaUri().getPath(); Single<Integer> duplicateImage = checkDuplicateImage(filePath); Single<Integer> wrongGeoLocation = checkImageGeoLocation(uploadItem.getPlace(), filePath); Single<Integer> darkImage = checkDarkImage(filePath); Single<Integer> itemTitle = checkTitle ? validateItemTitle(uploadItem) : Single.just(ImageUtils.IMAGE_OK); Single<Integer> checkFBMD = checkFBMD(filePath); Single<Integer> zipResult = Single.zip(duplicateImage, wrongGeoLocation, darkImage, itemTitle, (duplicate, wrongGeo, dark, title) -> { Timber.d("Result for duplicate: %d, geo: %d, dark: %d, title: %d", duplicate, wrongGeo, dark, title); return duplicate | wrongGeo | dark | title; }); return Single.zip(zipResult, checkFBMD, (zip, fbmd) -> { <START> return zip | fbmd; <END> }); }</code><technical_language>add a Timber log line here</technical_language>

Target:
Single<Integer> validateImage(UploadModel.UploadItem uploadItem, boolean checkTitle) { int currentImageQuality = uploadItem.getImageQuality(); Timber.d("Current image quality is %d", currentImageQuality); if (currentImageQuality == ImageUtils.IMAGE_KEEP) { return Single.just(ImageUtils.IMAGE_OK); } Timber.d("Checking the validity of image"); String filePath = uploadItem.getMediaUri().getPath(); Single<Integer> duplicateImage = checkDuplicateImage(filePath); Single<Integer> wrongGeoLocation = checkImageGeoLocation(uploadItem.getPlace(), filePath); Single<Integer> darkImage = checkDarkImage(filePath); Single<Integer> itemTitle = checkTitle ? validateItemTitle(uploadItem) : Single.just(ImageUtils.IMAGE_OK); Single<Integer> checkFBMD = checkFBMD(filePath); Single<Integer> zipResult = Single.zip(duplicateImage, wrongGeoLocation, darkImage, itemTitle, (duplicate, wrongGeo, dark, title) -> { Timber.d("Result for duplicate: %d, geo: %d, dark: %d, title: %d", duplicate, wrongGeo, dark, title); return duplicate | wrongGeo | dark | title; }); return Single.zip(zipResult, checkFBMD, (zip, fbmd) -> { Timber.d("zip:" + zip + "fbmd:" + fbmd); return zip | fbmd; }); }
Source:
<code>public void afterSession(TestSession session) { LOGGER.entering(); totalSessionsCompleted++; <START> if (totalSessionsCompleted <= maxSessionsAllowed) { <END> proxyLogger.fine("Completed session #" + totalSessionsCompleted + " (" + session.toString() + ")"); } proxyLogger.fine("Total number of slots used: " + getTotalUsed() + " on node: " + getId()); LOGGER.exiting(); }</code><technical_language>This if necessary. totalSessionsCompleted is prevent new sessions maxSessionsAllowed is reached in getNewSession</technical_language>

Target:
public void afterSession(TestSession session) { LOGGER.entering(); totalSessionsCompleted++; proxyLogger.fine("Completed session #" + totalSessionsCompleted + " (" + session.toString() + ")"); proxyLogger.fine("Total number of slots used: " + getTotalUsed() + " on node: " + getId()); LOGGER.exiting(); }
Source:
<code>public void should_run_two_concurrent_builds() { String jobName = "MyJob"; String jobDslScript = String.format("job('%s') { concurrentBuild(); steps { shell('sleep 10') } }", jobName); Job seed = createSeedJobWithJobDsl(jobDslScript); seed.startBuild().waitUntilFinished(); Job job = jenkins.jobs.get(Job.class, jobName); Build firstBuild = job.scheduleBuild().waitUntilStarted(); Build secondBuild = job.scheduleBuild().waitUntilStarted(); <START> assertTrue(firstBuild.isInProgress()); <END> assertTrue(secondBuild.isInProgress()); }</code><technical_language>This test implicitly relies timing, flaky. OTOH 10-second timeout enough</technical_language>

Target:
public void should_run_two_concurrent_builds() { String jobName = "MyJob"; String jobDslScript = String.format("job('%s') { concurrentBuild(); steps { shell('sleep 10') } }", jobName); Job seed = createSeedJobWithJobDsl(jobDslScript); seed.startBuild().waitUntilFinished(); Job job = jenkins.jobs.get(Job.class, jobName); Build firstBuild = job.scheduleBuild().waitUntilStarted(); Build secondBuild = job.scheduleBuild().waitUntilStarted(); assertTrue(firstBuild.isInProgress()); assertTrue(secondBuild.isInProgress()); firstBuild.stop(); secondBuild.stop(); }
Source:
<code>protected void doExecute() { diagramdesc = DescriptionFactory.eINSTANCE.createDiagramDescription(); <START> diagramdesc.setName("pattern.class.diagram.default.layer"); <END> viewpoint.getOwnedRepresentations().add(diagramdesc); layer = DescriptionFactory.eINSTANCE.createLayer(); diagramdesc.setDefaultLayer(layer); createPackageMapping(); createClassListMapping(); createClassListMapping(); createEdgeMappingInheritance(); createEdgeMappingReference(); createToolSection(); createContainerClassMapping(); createContainerPackageMapping(); createDeleteTool(); createEditTool(); createNodeCreation(); }</code><technical_language>DEFAULTID+".default.layer"</technical_language>

Target:
protected void doExecute() { DiagramDescription diagramdesc = DescriptionFactory.eINSTANCE.createDiagramDescription(); diagramdesc.setName(BASE_ID + ".default.layer"); viewpoint.getOwnedRepresentations().add(diagramdesc); Layer layer = DescriptionFactory.eINSTANCE.createLayer(); diagramdesc.setDefaultLayer(layer); ContainerMapping packageMapping = createPackageMapping(layer); ContainerMapping classMapping = createClassListMapping(layer); createClassListMapping(layer); EdgeMapping edgeMappingInheritance = createEdgeMappingInheritance(layer, classMapping); EdgeMapping edgeMappingReference = createEdgeMappingReference(layer, classMapping); ToolSection toolSection = createToolSection(layer); createContainerClassMapping(toolSection, classMapping); createContainerPackageMapping(toolSection, packageMapping); createDeleteTool(toolSection, classMapping, classMapping, edgeMappingInheritance, edgeMappingReference); createEditTool(toolSection, classMapping, classMapping, edgeMappingInheritance, edgeMappingReference); createNodeCreation(toolSection, classMapping); }
Source:
<code>public void testExistCustomAndGraphClient() { this.contextRunner .withUserConfiguration(AADResourceServerOboConfiguration.class) .withPropertyValues(AAD_PROPERTY_PREFIX + "authorization.graph.scopes=User.read") .withPropertyValues(AAD_PROPERTY_PREFIX + "authorization.custom.scopes=User.read") .run(context -> { final InMemoryClientRegistrationRepository oboRepo = context.getBean( InMemoryClientRegistrationRepository.class); final OAuth2AuthorizedClientRepository aadOboRepo = context.getBean( AADOAuth2OboAuthorizedClientRepository.class); ClientRegistration graph = oboRepo.findByRegistrationId("graph"); ClientRegistration custom = oboRepo.findByRegistrationId("custom"); Set<String> graphScopes = graph.getScopes(); Set<String> customScopes = custom.getScopes(); assertThat(aadOboRepo).isNotNull(); assertThat(oboRepo).isExactlyInstanceOf(InMemoryClientRegistrationRepository.class); assertThat(graph).isNotNull(); assertThat(customScopes).isNotNull(); assertThat(graphScopes).hasSize(1); <START> assertThat(customScopes).hasSize(1); <END> }); }</code><technical_language>assert instead of assert size</technical_language>

Target:
public void testExistCustomAndGraphClient() { this.contextRunner .withUserConfiguration(AADResourceServerOboConfiguration.class) .withPropertyValues("azure.activedirectory.authorization.graph.scopes=<LINK_1>" + ".Read") .withPropertyValues("azure.activedirectory.authorization.custom" + ".scopes=api://52261059-e515-488e-84fd-a09a3f372814/File.Read") .run(context -> { final InMemoryClientRegistrationRepository oboRepo = context.getBean( InMemoryClientRegistrationRepository.class); final OAuth2AuthorizedClientRepository aadOboRepo = context.getBean( AADOAuth2OboAuthorizedClientRepository.class); ClientRegistration graph = oboRepo.findByRegistrationId("graph"); ClientRegistration custom = oboRepo.findByRegistrationId("custom"); Set<String> graphScopes = graph.getScopes(); Set<String> customScopes = custom.getScopes(); assertThat(aadOboRepo).isNotNull(); assertThat(oboRepo).isExactlyInstanceOf(InMemoryClientRegistrationRepository.class); assertThat(graph).isNotNull(); assertThat(customScopes).isNotNull(); assertThat(graphScopes).containsOnly("<LINK_0>"); assertThat(customScopes).containsOnly("api://52261059-e515-488e-84fd-a09a3f372814/File.Read"); }); }
Source:
<code>public void userIsTakenToDiscussionsPostViewAfterClickOnPostSzl() { new MixedContentFooter().openWikiMainPage() .scrollToMCFooter() .getDiscussionsCard() .scrollToDiscussions() .clickDiscussionsPost(); String url = driver.getCurrentUrl(); <START> Assertion.assertTrue(url.contains(".wikia.com/szl/d/")); <END> }</code><technical_language>url is once, I guess inline i.e. driver.getCurrentUrl().contains()</technical_language>

Target:
public void userIsTakenToDiscussionsPostViewAfterClickOnPostSzl() { new MixedContentFooter().openWikiMainPage() .scrollToMCFooter() .getDiscussionsCard() .scrollToDiscussions() .clickDiscussionsPost(); Assertion.assertTrue(driver.getCurrentUrl().contains(".wikia.com/szl/d/")); }
Source:
<code>public String getUsage(ICommandSender commandSender) { <START> return new TextComponentTranslation("commands.bloodmagic.orb.usage").getFormattedText(); <END> }</code><technical_language>getUsage(...) expects a localization key</technical_language>

Target:
public String getUsage(ICommandSender commandSender) { return "commands.bloodmagic.orb.usage"; }
Source:
<code>protected void executeCommand() { Time originalExecutionTime = getSchedule().getExecutionTime(); try { String jobId = scheduleJob(); if (jobId != null) { setSucceeded(true); getSchedule().setJobId(jobId); getSchedule().setExecutionTime(originalExecutionTime); getGlusterVolumeSnapshotScheduleDao().save(getSchedule()); } else { <START> setSucceeded(false); <END> } } catch (Exception ex) { setSucceeded(false); handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED, ex.getMessage()); } }</code><technical_language>this else case. scheduling fails showing error?</technical_language>

Target:
protected void executeCommand() { Time originalExecutionTime = getSchedule().getExecutionTime(); try { String jobId = scheduleJob(); setSucceeded(true); getSchedule().setJobId(jobId); getSchedule().setExecutionTime(originalExecutionTime); getGlusterVolumeSnapshotScheduleDao().save(getSchedule()); } catch (Exception ex) { setSucceeded(false); handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED, ex.getMessage()); } }
Source:
<code><START> public void setup(OperatorContext context) <END> { }</code><technical_language>required if is happening</technical_language>

Target:
public void setup(OperatorContext context) { logger.debug("bufferTime tumblingWindowTime laggardsWindowTime {}, timestampKeyName {}", bufferTime, tumblingWindowTime, laggardsWindowTime, timestampKeyName); }
Source:
<code>private PreparedStatement readSessionStatement(SessionId sessionId) throws SQLException { <START> PreparedStatement getSessionsStatement = connection.prepareStatement("select * from " + tableName + " where " + sessionIdCol + " like ?"); <END> getSessionsStatement.setString(1, sessionUri(sessionId).concat("%")); return getSessionsStatement; }</code><technical_language>sessionIdCol</technical_language>

Target:
private PreparedStatement readSessionStatement(SessionId sessionId) throws SQLException { PreparedStatement getSessionsStatement = connection.prepareStatement(String.format("select * from %1$s where %2$s = ?", TABLE_NAME, SESSION_ID_COL)); getSessionsStatement.setMaxRows(1); getSessionsStatement.setString(1, sessionId.toString()); return getSessionsStatement; }
Source:
<code>public SeparatedList(List<T> list, List<InternalSyntaxToken> separators) { <START> Preconditions.checkArgument(list.size() == separators.size() + 1 || list.size() == separators.size()); <END> this.list = list; this.separators = separators; }</code><technical_language>@pynicolas failing message added a parameter give more info this condition ? WDYT ? "Instanciating a SeparatedList inconsistent number of elements (x) separators (x)"</technical_language>

Target:
public SeparatedList(List<T> list, List<InternalSyntaxToken> separators) { Preconditions.checkArgument( list.size() == separators.size() + 1 || list.size() == separators.size(), "Instanciating a SeparatedList with inconsistent number of elements (%s) and separators (%s)", list.size(), separators.size()); this.list = list; this.separators = separators; }
Source:
<code>public static void removeCartridge(String cartridgeType) throws RestAPIException { try { if (log.isDebugEnabled()) { log.debug(String.format("Removing cartridge: [cartridge-type] %s ", cartridgeType)); } CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient(); if (cloudControllerServiceClient.getCartridge(cartridgeType) == null) { throw new RuntimeException("Cartridge not found: [cartridge-type] " + cartridgeType); } StratosManagerServiceClient smServiceClient = getStratosManagerServiceClient(); if (!smServiceClient.canCartridgeBeRemoved(cartridgeType)) { String message = "Cannot remove cartridge : [cartridge-type] " + cartridgeType + " since it is used in another cartridge group or an application"; log.error(message); throw new RestAPIException(message); } cloudControllerServiceClient.removeCartridge(cartridgeType); if (log.isInfoEnabled()) { log.info(String.format("Successfully removed cartridge: [cartridge-type] %s ", cartridgeType)); } } catch (RemoteException e) { throw new RestAPIException(e.getMessage()); <START> } catch (CloudControllerServiceInvalidCartridgeTypeExceptionException e) { <END> throw new RestAPIException(e.getFaultMessage().getInvalidCartridgeTypeException().getMessage()); } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) { throw new RestAPIException(e.getFaultMessage().getCartridgeNotFoundException().getMessage()); } }</code><technical_language>catch specific exception Util class. Catch in API class send response code accordingly</technical_language>

Target:
public static void removeCartridge(String cartridgeType) throws RestAPIException, RemoteException, CloudControllerServiceCartridgeNotFoundExceptionException, CloudControllerServiceInvalidCartridgeTypeExceptionException { if (log.isDebugEnabled()) { log.debug(String.format("Removing cartridge: [cartridge-type] %s ", cartridgeType)); } CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient(); if (cloudControllerServiceClient.getCartridge(cartridgeType) == null) { throw new RuntimeException("Cartridge not found: [cartridge-type] " + cartridgeType); } StratosManagerServiceClient smServiceClient = getStratosManagerServiceClient(); if (!smServiceClient.canCartridgeBeRemoved(cartridgeType)) { String message = "Cannot remove cartridge : [cartridge-type] " + cartridgeType + " since it is used in another cartridge group or an application"; log.error(message); throw new RestAPIException(message); } cloudControllerServiceClient.removeCartridge(cartridgeType); if (log.isInfoEnabled()) { log.info(String.format("Successfully removed cartridge: [cartridge-type] %s ", cartridgeType)); } }
Source:
<code><START> List<String> getURLBackupAddress(URL url) { <END> List<String> addressList = new ArrayList<String>(); addressList.add(url.getAddress()); String[] backups = url.getParameter(Constants.BACKUP_KEY, new String[0]); addressList.addAll(Arrays.asList(backups)); return addressList; }</code><technical_language>method access specifier plz</technical_language>

Target:
List<String> getURLBackupAddress(URL url) { List<String> addressList = new ArrayList<String>(); addressList.add(url.getAddress()); addressList.addAll(url.getParameter(Constants.BACKUP_KEY, Collections.EMPTY_LIST)); return addressList; }
Source:
<code><START> public static Visibility getVisibility(Class<? extends Message> stateClass) { <END> final Descriptors.Descriptor descriptor = TypeName.of(stateClass).getDescriptor(); final EntityOption entityOption = descriptor.getOptions() .getExtension(OptionsProto.entity); final Visibility definedVisibility = entityOption.getVisibility(); final Visibility result = (definedVisibility == Visibility.VISIBILITY_UNKNOWN) ? Visibility.FULL : definedVisibility; return result; }</code><technical_language>check parameter for null test this case NullPointerTester</technical_language>

Target:
public static Visibility getVisibility(Class<? extends Message> stateClass) { checkNotNull(stateClass); final Descriptors.Descriptor descriptor = TypeName.of(stateClass).getDescriptor(); final EntityOption entityOption = descriptor.getOptions() .getExtension(OptionsProto.entity); final Visibility definedVisibility = entityOption.getVisibility(); final Visibility result = (definedVisibility == Visibility.VISIBILITY_UNKNOWN) ? Visibility.FULL : definedVisibility; return result; }
Source:
<code>private DateTime lease() { <START> DateTime lease = new DateTime(); <END> setLease(lease); latestOwnedLease = lease; return lease; }</code><technical_language>withMillisOfSecond(0) done here</technical_language>

Target:
private DateTime lease() { DateTime lease = new DateTime().withMillisOfSecond(0); setLease(lease); latestOwnedLease = lease; return lease; }
Source:
<code>public boolean matches(Object item) { if(item instanceof Resource) { <START> try { <END> InputStream in = ((Resource) item).in(); try { byte[] result = new byte[contents.length]; int len = in.read(result); if(len != contents.length) return false; if(in.read()!=-1) return false; return Arrays.equals(contents, result); } finally { in.close(); } } catch (IOException ex) { throw new IllegalStateException("Exception while reading resource contents", ex); } } return false; }</code><technical_language>try-with-resources</technical_language>

Target:
public boolean matches(Object item) { if(item instanceof Resource) { try (InputStream in = ((Resource) item).in()) { byte[] result = new byte[contents.length]; int len = in.read(result); if (len != contents.length) { return false; } if (in.read() != -1) { return false; } return Arrays.equals(contents, result); } catch (IOException ex) { throw new IllegalStateException("Exception while reading resource contents", ex); } } return false; }
Source:
<code><START> public void enableBarometer() { <END> byte[] value = { 0x01 }; BluetoothLeGattCharacteristic preEnableChar; try { preEnableChar = this.gattServices.get(PRESSURE).findCharacteristic(TiSensorTagGatt.UUID_PRE_SENSOR_ENABLE); preEnableChar.writeValue(value); } catch (KuraException e) { logger.error("Barometer enable failed", e); } }</code><technical_language>enableX disableX in this class return boolean for understanding of API respective invocations</technical_language>

Target:
public boolean enableBarometer() { boolean result = false; byte[] value = { 0x01 }; BluetoothLeGattCharacteristic preEnableChar; try { preEnableChar = this.gattServices.get(PRESSURE).findCharacteristic(TiSensorTagGatt.UUID_PRE_SENSOR_ENABLE); preEnableChar.writeValue(value); result = true; } catch (KuraException e) { logger.error("Barometer enable failed", e); } return result; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: <START> startActivity(MainActivity.newIntent(this)); <END> finish(); return true; default: return super.onOptionsItemSelected(item); } }</code><technical_language>This work if MainActivity singleTask. I API great considered parentActivityName updating onOptionsItemSelected()? <LINK_0> <LINK_1></technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if (shouldRecreateMainActivity()) { startActivity(getSupportParentActivityIntent()); } finish(); return true; default: return super.onOptionsItemSelected(item); } }
Source:
<code>public void testSnapshotAfterEndOfPartition() throws Exception { int numInputChannels = 1; <START> int channelId = 0; <END> int checkpointId = 0; VerifyRecordsDataOutput<Long> output = new VerifyRecordsDataOutput<>(); LongSerializer inSerializer = LongSerializer.INSTANCE; StreamTestSingleInputGate<Long> inputGate = new StreamTestSingleInputGate<>(numInputChannels, 0, inSerializer, 1024); TestRecordDeserializer[] deserializers = createDeserializers(numInputChannels); StreamTaskNetworkInput<Long> input = new StreamTaskNetworkInput<>( new CheckpointedInputGate( inputGate.getInputGate(), new CheckpointBarrierUnaligner( TestSubtaskCheckpointCoordinator.INSTANCE, "test", new DummyCheckpointInvokable(), inputGate.getInputGate())), inSerializer, new StatusWatermarkValve(numInputChannels, output), 0, deserializers); inputGate.sendEvent( new CheckpointBarrier(checkpointId, 0L, CheckpointOptions.forCheckpointWithDefaultLocation()), channelId); inputGate.sendElement(new StreamRecord<>(42L), channelId); assertHasNextElement(input, output); assertHasNextElement(input, output); assertEquals(1, output.getNumberOfEmittedRecords()); inputGate.sendEvent(EndOfPartitionEvent.INSTANCE, channelId); input.emitNext(output); assertNull(deserializers[channelId]); CompletableFuture<Void> completableFuture = input.prepareSnapshot(ChannelStateWriter.NO_OP, checkpointId); completableFuture.join(); }</code><technical_language>this test removed</technical_language>

Target:
public void testSnapshotAfterEndOfPartition() throws Exception { int numInputChannels = 1; int channelId = 0; int checkpointId = 0; VerifyRecordsDataOutput<Long> output = new VerifyRecordsDataOutput<>(); LongSerializer inSerializer = LongSerializer.INSTANCE; StreamTestSingleInputGate<Long> inputGate = new StreamTestSingleInputGate<>(numInputChannels, 0, inSerializer, 1024); TestRecordDeserializer[] deserializers = createDeserializers(numInputChannels); StreamTaskNetworkInput<Long> input = new StreamTaskNetworkInput<>( new CheckpointedInputGate( inputGate.getInputGate(), new CheckpointBarrierUnaligner( TestSubtaskCheckpointCoordinator.INSTANCE, "test", new DummyCheckpointInvokable(), inputGate.getInputGate()), new SyncMailboxExecutor()), inSerializer, new StatusWatermarkValve(numInputChannels, output), 0, deserializers); inputGate.sendEvent( new CheckpointBarrier(checkpointId, 0L, CheckpointOptions.forCheckpointWithDefaultLocation()), channelId); inputGate.sendElement(new StreamRecord<>(42L), channelId); assertHasNextElement(input, output); assertHasNextElement(input, output); assertEquals(1, output.getNumberOfEmittedRecords()); inputGate.sendEvent(EndOfPartitionEvent.INSTANCE, channelId); input.emitNext(output); assertNull(deserializers[channelId]); CompletableFuture<Void> completableFuture = input.prepareSnapshot(ChannelStateWriter.NO_OP, checkpointId); completableFuture.join(); }
Source:
<code>public Lz4Decompressor(int directBufferSize) { this.directBufferSize = directBufferSize; try { LZ4Factory lz4Factory = LZ4Factory.fastestInstance(); lz4Decompressor = lz4Factory.safeDecompressor(); } catch (Throwable t) { <START> throw new RuntimeException("lz4-java library is not available: " + <END> "Lz4Decompressor has not been loaded. You need to add " + "lz4-java.jar to your CLASSPATH", t); } compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf.position(directBufferSize); }</code><technical_language>Shame constructor throw exceptions direct. Catch exception's raised, convert RTEs or, especially, Errors</technical_language>

Target:
public Lz4Decompressor(int directBufferSize) { this.directBufferSize = directBufferSize; try { LZ4Factory lz4Factory = LZ4Factory.fastestInstance(); lz4Decompressor = lz4Factory.safeDecompressor(); } catch (AssertionError t) { throw new RuntimeException("lz4-java library is not available: " + "Lz4Decompressor has not been loaded. You need to add " + "lz4-java.jar to your CLASSPATH. " + t, t); } compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf.position(directBufferSize); }
Source:
<code>public ArrayList<Event> processTurn(GlobalGameData globalGameData) { GlobalGameData.setTurn(globalGameData.getTurn() + 1); ArrayList<Event> events = new ArrayList<Event>(); ArrayList<PendingMove> pendingMoves = new ArrayList<PendingMove>(); for (int x = 0; x < GlobalGameData.galaxySizeX; x++) { for (int y = 0; y < GlobalGameData.galaxySizeY; y++) { processUnitActions(globalGameData.getSectors()[x][y], pendingMoves, x, y); } } for (PendingMove p : pendingMoves) { Unit unit = p.getUnit(); unit.setSector(globalGameData.getSectors()[p.getX()][p.getY()]); <START> Log.wtf("Next: ", "" + p.getX() + "," + p.getY()); <END> globalGameData.getSectors()[p.getX()][p.getY()].addShip(unit); for (Unit u : globalGameData.getSectors()[p.getX()][p.getY()].getUnits()) { if (u.getFaction() != unit.getFaction()) { events.add(processBattle(globalGameData.getSectors()[p.getX()][p.getY()])); } } Iterator<Unit> iterator = globalGameData.getSectors()[p.getX()][p.getY()].getUnits().iterator(); while(iterator.hasNext()) { Unit aUnit = iterator.next(); if (aUnit.getCurrentHP() <= 0) { Log.wtf("Battle", aUnit.getShipName()+" destroyed"); iterator.remove(); } } } return events; }</code><technical_language>p pendingMove</technical_language>

Target:
public ArrayList<Event> processTurn(GlobalGameData globalGameData) { GlobalGameData.setTurn(globalGameData.getTurn() + 1); ArrayList<Event> events = new ArrayList<Event>(); ArrayList<PendingMove> pendingMoves = new ArrayList<PendingMove>(); processUnitActions(globalGameData, pendingMoves); processPendingMoves(globalGameData, events, pendingMoves); return events; }