auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void createSheet(Workbook wb, String name, String topleft, boolean app, boolean rep, int questionColumns) { Sheet sheet = wb.createSheet(name); Row row0 = sheet.createRow(0); row0.createCell(0).setCellValue(topleft); Row row1 = sheet.createRow(1); int i = 0; row1.createCell(i++).setCellValue("Identifier"); if (app) {row1.createCell(i++).setCellValue("Data approval status");} row1.createCell(i++).setCellValue("Display Name"); if (rep) {row1.createCell(i++).setCellValue("Repeat no");} row1.createCell(i++).setCellValue("Device identifier"); row1.createCell(i++).setCellValue("Instance"); row1.createCell(i++).setCellValue("Submission Date"); row1.createCell(i++).setCellValue("Submitter"); row1.createCell(i++).setCellValue("Duration"); row1.createCell(i++).setCellValue("Form version"); sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, i - 1)); for (int j = 0; j < questionColumns; j++) { row1.createCell(i + j).setCellValue(j + "|Question" + j); } }

Target:
private void createSheet(Workbook wb, String name, String topleft, boolean app, boolean rep, int questionColumns) { Sheet sheet = wb.createSheet(name); Row row0 = sheet.createRow(0); row0.createCell(0).setCellValue(topleft); Row row1 = sheet.createRow(1); int i = 0; row1.createCell(i++).setCellValue("Identifier"); if (app) {row1.createCell(i++).setCellValue("Data approval status");} row1.createCell(i++).setCellValue("Display Name"); if (rep) {row1.createCell(i++).setCellValue("Repeat no");} row1.createCell(i++).setCellValue("Device identifier"); row1.createCell(i++).setCellValue("Instance"); row1.createCell(i++).setCellValue("Submission Date"); row1.createCell(i++).setCellValue("Submitter"); row1.createCell(i++).setCellValue("Duration"); row1.createCell(i++).setCellValue("Form version"); sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, i - 1)); for (int j = 0; j < questionColumns; j++) { row1.createCell(i + j).setCellValue((123000 + j) + "|Question" + j); } }
Source:
T unFocus() { if (unFocusDelay > 0) { unFocusDelayTimer.schedule(unFocusDelay); } else { unFocusDelayTimer.run(); } return cast(); }

Target:
T unFocus() { cancelUnFocusTimer(); if (unFocusDelay > 0) { unFocusDelayTimer.schedule(unFocusDelay); } else { unFocusDelayTimer.run(); } return cast(); }
Source:
public boolean shootLaser() { if (shark.getAmmo() > 0) { shark.decreaseAmmo(); addFish(fishSpawner.createLaser(this.shark)); return true; } return false; }

Target:
public boolean shootLaser() { if (shark.getAmmo() > 0) { shark.decreaseAmmo(); addFish(laserSpawner.createLaser(this.shark)); return true; } return false; }
Source:
public Poll withNumberOfOptions(int number){ this.options = new String[number]; for (int i = 0; i < number; i++) this.options[i] = TestStringUtils.randomString(10); return this; }

Target:
public Poll withNumberOfOptions(int number){ this.options = new String[number]; for (int i = 0; i < number; i++) { this.options[i] = randomAlphanumeric(10); } return this; }
Source:
public void runJobLocked(final Runnable action) { log.info("Trying to run job..."); if (!timeToRunAction()) { return; } if (!createJobLockNode()) { return; } if (!timeToRunAction()) { return; } try { log.info("Execution of job will be performed on this instance"); action.run(); updateJobTimestamp(); } catch (final JsonProcessingException e) { log.error("Json processing error when updating job timestamp in ZK", e); } catch (final Exception e) { log.error("Zookeeper error when performing job", e); } finally { deleteJobLockNode(); } }

Target:
public void runJobLocked(final Runnable action) { log.info("Trying to run job..."); if (!timeToRunAction()) { return; } if (!createJobLockNode()) { return; } try { if (!timeToRunAction()) { return; } log.info("Job will be executed on this instance"); action.run(); updateJobTimestamp(); } catch (final JsonProcessingException e) { log.error("Json processing error when updating job timestamp in ZK", e); } catch (final Exception e) { log.error("Zookeeper error when performing job", e); } finally { deleteJobLockNode(); } }
Source:
public void sendAuditLog(HttpServletRequest request, Object requestBody, int responseCode, Object responseObject, GenerateAuditLog auditLogAnnotation) { try { AuditLogContextBuilder auditLogContextBuilder = AuditLogContextBuilder.create() .withTimestamp(OffsetDateTime.now().toString()).withLogId(UUID.randomUUID()).withRequestId(UUID.randomUUID()) .withApplicationId(auditLogAnnotation.application()).withEventType(auditLogAnnotation.eventType()) .withEventCategory(auditLogAnnotation.eventCategory()).withEventOperation(auditLogAnnotation.eventOperation()) .withUserId(auditUserProvider.getUserId()).withUsername(auditUserProvider.getUsername()) .withEmail(auditUserProvider.getUserEmail()).withAccountId(auditUserProvider.getAccountId()) .withRequest(request, requestBody).withResponse(responseCode, (auditLogAnnotation.includeBodyResponse() && responseObject != null) ? objectMapper.writeValueAsString(responseObject) : null); AuditContextFilter filter = auditLogAnnotation.filter().getDeclaredConstructor().newInstance(); auditLogContextBuilder = filter.filter(auditLogContextBuilder, requestBody, responseObject); auditLogger.sendAuditLog(auditLogContextBuilder.build()); LOGGER.info("audit log generated with metadata {}", auditLogAnnotation); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | IOException | AuditLogException e) { LOGGER.error("audit log with metadata has not been generated", auditLogAnnotation, e); } }

Target:
public void sendAuditLog(HttpServletRequest request, Object requestBody, int responseCode, Object responseObject, GenerateAuditLog auditLogAnnotation) { try { AuditLogContextBuilder auditLogContextBuilder = AuditLogContextBuilder.create() .withTimestamp(OffsetDateTime.now().toString()) .withLogId(UUID.randomUUID()) .withRequestId(UUID.randomUUID()) .withApplicationId(auditLogAnnotation.application()) .withEventType(auditLogAnnotation.eventType()) .withEventCategory(auditLogAnnotation.eventCategory()) .withEventOperation(auditLogAnnotation.eventOperation()) .withUserId(auditUserProvider.getUserId()) .withUsername(auditUserProvider.getUsername()) .withEmail(auditUserProvider.getUserEmail()) .withAccountId(auditUserProvider.getAccountId()) .withRequest(request, requestBody) .withResponse(responseCode, auditLogAnnotation.includeBodyResponse() ? responseObject : null); AuditContextFilter filter = auditLogAnnotation.filter().getDeclaredConstructor().newInstance(); auditLogContextBuilder = filter.filter(auditLogContextBuilder, requestBody, responseObject); this.sendAuditLog(auditLogContextBuilder.build()); LOGGER.info("audit log generated with metadata {}", auditLogAnnotation); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | AuditLogException e) { LOGGER.error("audit log with metadata has not been generated", auditLogAnnotation, e); } }
Source:
public PicoNetwork(SocketChannel sc, boolean isSecondary) { m_sc = sc; InetSocketAddress remoteAddress = (InetSocketAddress)sc.socket().getRemoteSocketAddress(); m_remoteSocketAddress = remoteAddress; m_remoteSocketAddressString = remoteAddress.getAddress().getHostAddress(); m_remoteHostAndAddressAndPort = "/" + m_remoteSocketAddressString + ":" + m_remoteSocketAddress.getPort(); String remoteHost = ReverseDNSCache.hostnameOrAddress(m_remoteSocketAddress.getAddress()); if (!remoteHost.equals(m_remoteSocketAddress.getAddress().getHostAddress())) { m_remoteHostname = remoteHost; m_remoteHostAndAddressAndPort = remoteHost + m_remoteHostAndAddressAndPort; } if (isSecondary) { m_toString = super.toString() + ":" + m_remoteHostAndAddressAndPort + "(s)"; } else { m_toString = super.toString() + ":" + m_remoteHostAndAddressAndPort; } m_thread = new Thread(this, "Pico Network - " + m_toString); m_thread.setDaemon(true); try { sc.configureBlocking(false); sc.socket().setTcpNoDelay(true); m_selector = Selector.open(); m_interestOps = SelectionKey.OP_READ; m_key = m_sc.register(m_selector, m_interestOps); } catch (IOException ex) { m_logger.fatal(null, ex); throw new RuntimeException(ex); } }

Target:
public PicoNetwork(SocketChannel sc, boolean isSecondary) { m_sc = sc; InetSocketAddress remoteAddress = (InetSocketAddress)sc.socket().getRemoteSocketAddress(); m_remoteSocketAddress = remoteAddress; m_remoteSocketAddressString = remoteAddress.getAddress().getHostAddress(); m_remoteHostAndAddressAndPort = "/" + m_remoteSocketAddressString + ":" + m_remoteSocketAddress.getPort(); String remoteHost = ReverseDNSCache.hostnameOrAddress(m_remoteSocketAddress.getAddress()); if (!remoteHost.equals(m_remoteSocketAddress.getAddress().getHostAddress())) { m_remoteHostname = remoteHost; m_remoteHostAndAddressAndPort = remoteHost + m_remoteHostAndAddressAndPort; } if (isSecondary) { m_threadName = super.toString() + ":" + m_remoteHostAndAddressAndPort + "(s)"; } else { m_threadName = super.toString() + ":" + m_remoteHostAndAddressAndPort; } m_thread = new Thread(this, "Pico Network - " + m_threadName); m_thread.setDaemon(true); try { sc.configureBlocking(false); sc.socket().setTcpNoDelay(true); m_selector = Selector.open(); m_interestOps = SelectionKey.OP_READ; m_key = m_sc.register(m_selector, m_interestOps); } catch (IOException ex) { m_logger.fatal(null, ex); throw new RuntimeException(ex); } }
Source:
public void setup() { WrappedRoaringBitmap mutable = new WrappedRoaringBitmap(); for (int i = 0; i < numRows; i++) { if (ThreadLocalRandom.current().nextDouble(0.0, 1.0) > 0.7) { mutable.add(i); } } bitmap = mutable.toImmutableBitmap(); }

Target:
public void setup() { bitmaps = new ImmutableBitmap[numBitmaps]; for (int bitmap = 0; bitmap < numBitmaps; bitmap++) { WrappedRoaringBitmap mutable = new WrappedRoaringBitmap(); for (int i = 0; i < numRows; i++) { if (rando.nextDouble() > 0.2) { mutable.add(i); } } bitmaps[bitmap] = mutable.toImmutableBitmap(); } }
Source:
public void copyFolderRecursive(Folder destinationFolder, Folder toCopyFolder) { Map<String, Object> folderProperties = new HashMap<String, Object>(); folderProperties.put(PropertyIds.NAME, toCopyFolder.getName()); folderProperties.put(PropertyIds.OBJECT_TYPE_ID, toCopyFolder.getBaseTypeId().value()); Folder newFolder = destinationFolder.createFolder(folderProperties); copyChildren(newFolder, toCopyFolder); }

Target:
private Map<String, String> copyFolderRecursive(Folder destinationFolder, Folder toCopyFolder) { Map<String, Object> folderProperties = new HashMap<>(); folderProperties.put(PropertyIds.NAME, toCopyFolder.getName()); folderProperties.put(PropertyIds.OBJECT_TYPE_ID, toCopyFolder.getBaseTypeId().value()); Map<String, String> folders = new HashMap<>(); Folder newFolder = destinationFolder.createFolder(folderProperties); folders.put(toCopyFolder.getId(), newFolder.getId()); copyChildren(newFolder, toCopyFolder); return folders; }
Source:
public void testCallStackRequirements() { LttngUstCallStackAnalysisRequirement req = new LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout.DEFAULT_LAYOUT); for (TestData item: TestData.values()) { assertEquals(item.isValid(), req.test(item.getTrace())); } }

Target:
public void testCallStackRequirements() { LttngUstCallStackAnalysisRequirement req = new LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout.DEFAULT_LAYOUT); for (TestData item: TestData.values()) { assertEquals(item.name(), item.isValid(), req.test(item.getTrace())); } }
Source:
private AbstractDNode handleListAttributeChangeOnMapping(final AbstractDNode node, final ContainerMapping containerMapping, final DragAndDropTarget viewContainer, IProgressMonitor monitor) { final boolean isListContainer = new ContainerMappingQuery(containerMapping).isListContainer(); if ((node instanceof DNodeContainer && isListContainer) || (node instanceof DNodeList && !isListContainer)) { final AbstractDNodeCandidate newCandidate = new AbstractDNodeCandidate(containerMapping, node.getTarget(), viewContainer); final Set<AbstractDNodeCandidate> newCandidates = new HashSet<AbstractDNodeCandidate>(1); newCandidates.add(newCandidate); List<AbstractDNode> newContents = createNewContent(newCandidates, true, viewContainer, containerMapping, false, monitor); SiriusDiagramHelper.removeNodeFromContainer(viewContainer, false, node); if (!newContents.isEmpty()) { final AbstractDNode newNode = newContents.get(0); convertGmfModelTypes(node, newNode); return newNode; } } return node; }

Target:
private AbstractDNode handleListAttributeChangeOnMapping(final AbstractDNode node, final ContainerMapping containerMapping, final DragAndDropTarget viewContainer, IProgressMonitor monitor) { final boolean isListContainer = new ContainerMappingQuery(containerMapping).isListContainer(); if ((node instanceof DNodeContainer && isListContainer) || (node instanceof DNodeList && !isListContainer)) { final AbstractDNodeCandidate newCandidate = new AbstractDNodeCandidate(containerMapping, node.getTarget(), viewContainer); final Set<AbstractDNodeCandidate> newCandidates = new HashSet<AbstractDNodeCandidate>(1); newCandidates.add(newCandidate); List<AbstractDNode> newContents = createNewContent(newCandidates, true, viewContainer, containerMapping, false, monitor); if (!newContents.isEmpty()) { SiriusDiagramHelper.removeNodeFromContainer(viewContainer, false, node); final AbstractDNode newNode = newContents.get(0); convertGmfModelTypes(node, newNode); return newNode; } } return node; }
Source:
private <R> R getUpcallResultInner(long timestamp, Object[] conflictObject) { if (TransactionalContext.isInTransaction()) { try { return (R) TransactionalContext.getCurrentContext() .getUpcallResult(this, timestamp, conflictObject); } catch (Exception e) { log.warn("UpcallResult[{}] Exception: {}", this, e); this.abortTransaction(e); } } if (underlyingObject.getUpcallResults().containsKey(timestamp)) { log.trace("Upcall[{}] Direct", this, timestamp); R ret = (R) underlyingObject.getUpcallResults().get(timestamp); underlyingObject.getUpcallResults().remove(timestamp); return ret == VersionLockedObject.NullValue.NULL_VALUE ? null : ret; } return underlyingObject.update(o -> { for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { try { o.syncObjectUnsafe(timestamp); if (o.getUpcallResults().containsKey(timestamp)) { log.trace("Upcall[{}] Sync'd", this, timestamp); R ret = (R) o.getUpcallResults().get(timestamp); o.getUpcallResults().remove(timestamp); return ret == VersionLockedObject.NullValue.NULL_VALUE ? null : ret; } throw new RuntimeException("Attempted to get the result " + "of an upcall@" + timestamp + " but we are @" + underlyingObject.getVersionUnsafe() + " and we don't have a copy"); } catch (TrimmedException ex) { log.info("getUpcallResultInner: Encountered trimmed address space " + "while accessing version of stream on attempt {}", timestamp, getStreamID(), x); underlyingObject.update(obj -> { obj.resetUnsafe(); return null; }); } } throw new TrimmedUpcallException(timestamp); }); }

Target:
private <R> R getUpcallResultInner(long timestamp, Object[] conflictObject) { if (TransactionalContext.isInTransaction()) { try { return (R) TransactionalContext.getCurrentContext() .getUpcallResult(this, timestamp, conflictObject); } catch (Exception e) { log.warn("UpcallResult[{}] Exception: {}", this, e); this.abortTransaction(e); } } if (underlyingObject.getUpcallResults().containsKey(timestamp)) { log.trace("Upcall[{}] Direct", this, timestamp); R ret = (R) underlyingObject.getUpcallResults().get(timestamp); underlyingObject.getUpcallResults().remove(timestamp); return ret == VersionLockedObject.NullValue.NULL_VALUE ? null : ret; } return underlyingObject.update(o -> { for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { try { o.syncObjectUnsafe(timestamp); if (o.getUpcallResults().containsKey(timestamp)) { log.trace("Upcall[{}] Sync'd", this, timestamp); R ret = (R) o.getUpcallResults().get(timestamp); o.getUpcallResults().remove(timestamp); return ret == VersionLockedObject.NullValue.NULL_VALUE ? null : ret; } throw new RuntimeException("Attempted to get the result " + "of an upcall@" + timestamp + " but we are @" + underlyingObject.getVersionUnsafe() + " and we don't have a copy"); } catch (TrimmedException ex) { log.info("getUpcallResultInner: Encountered trimmed address space " + "while accessing version of stream on attempt {}", timestamp, getStreamID(), x); o.resetUnsafe(); } } throw new TrimmedUpcallException(timestamp); }); }
Source:
static ContentRange parse(String headerValue) { if (headerValue != null && headerValue.length() >= MINIMUM_LENGTH) { String[] values = headerValue.substring(6).split("/"); if (values.length != 2) return null; int offset = -1; int last = -1; int total = -1; String tail = values[1]; if (!"*".equals(tail)) total = Integer.parseInt(tail); String head = values[0]; if (!"*".equals(head)) { String[] range = head.split("-"); offset = Integer.parseInt(range[0]); last = Integer.parseInt(range[1]); } return new ContentRange(offset, last, total); } return null; }

Target:
static ContentRange parse(String headerValue) { if (headerValue != null) { Matcher matcher = HEADER_PATTERN.matcher(headerValue); if (matcher.find()) { int offset = -1; int last = -1; int total = -1; String head = matcher.group(1); if (!"*".equals(head)) { offset = Integer.parseInt(matcher.group(2)); last = Integer.parseInt(matcher.group(3)); } String tail = matcher.group(4); if (!"*".equals(tail)) total = Integer.parseInt(tail); return new ContentRange(offset, last, total); } } return null; }
Source:
public void onWebGuiAvailable() { mAvailableCount.set(0); new GetTask() { @Override protected void onPostExecute(String s) { if (s == null) { Log.w(TAG, "Empty JSON string when retrieving version information"); return; } try { JSONObject json = new JSONObject(s); mVersion = json.getString("version"); Log.i(TAG, "Syncthing version is " + mVersion); tryIsAvailable(); } catch (JSONException e) { Log.w(TAG, "Failed to parse config", e); } } }.execute(mUrl, GetTask.URI_VERSION, mApiKey); new GetTask() { @Override protected void onPostExecute(String config) { if (s == null) { Log.w(TAG, "Empty JSON string when retrieving config information"); return; } try { mConfig = new JSONObject(config); tryIsAvailable(); } catch (JSONException e) { Log.w(TAG, "Failed to parse config", e); } } }.execute(mUrl, GetTask.URI_CONFIG, mApiKey); getSystemInfo(new OnReceiveSystemInfoListener() { @Override public void onReceiveSystemInfo(SystemInfo info) { mLocalDeviceId = info.myID; tryIsAvailable(); } }); }

Target:
public void onWebGuiAvailable() { mAvailableCount.set(0); new GetTask() { @Override protected void onPostExecute(String s) { try { JSONObject json = new JSONObject(s); mVersion = json.getString("version"); Log.i(TAG, "Syncthing version is " + mVersion); tryIsAvailable(); } catch (JSONException e) { Log.w(TAG, "Failed to parse config", e); } } }.execute(mUrl, GetTask.URI_VERSION, mApiKey); new GetTask() { @Override protected void onPostExecute(String config) { try { mConfig = new JSONObject(config); tryIsAvailable(); } catch (JSONException e) { Log.w(TAG, "Failed to parse config", e); } } }.execute(mUrl, GetTask.URI_CONFIG, mApiKey); getSystemInfo(new OnReceiveSystemInfoListener() { @Override public void onReceiveSystemInfo(SystemInfo info) { mLocalDeviceId = info.myID; tryIsAvailable(); } }); }
Source:
public void testValidateInvalidLocationId() { this.errors = new MapBindingResult(new HashMap<String, String>(), LotDto.class.getName()); final Integer locationId = 6000; this.lotGeneratorInputDto.setGid(1); this.lotGeneratorInputDto.setLocationId(locationId); this.lotGeneratorInputDto.setGenerateStock(false); this.lotGeneratorInputDto.setScaleId(8264); this.lotGeneratorInputDto.setStockId("ABCD"); this.lotGeneratorInputDto.setComments("Comments"); final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); Mockito.when(this.locationDataManager.getLocationByID(locationId)).thenReturn(null); this.locationValidator.validateSeedLocationId(this.errors, locationId); Assert.assertTrue(this.errors.getAllErrors().size() == 1); final ObjectError objectError = this.errors.getAllErrors().get(0); assertThat(Arrays.asList(objectError.getCodes()), CoreMatchers.hasItem("location.invalid")); }

Target:
public void testValidateInvalidLocationId() { this.errors = new MapBindingResult(new HashMap<String, String>(), LotDto.class.getName()); this.lotGeneratorInputDto.setGid(GID); this.lotGeneratorInputDto.setLocationId(LOCATION_ID); this.lotGeneratorInputDto.setGenerateStock(false); this.lotGeneratorInputDto.setScaleId(SCALE_ID); this.lotGeneratorInputDto.setStockId(STOCK_ID); this.lotGeneratorInputDto.setComments(COMMENTS); final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); Mockito.when(this.locationDataManager.getLocationByID(LOCATION_ID)).thenReturn(null); this.locationValidator.validateSeedLocationId(this.errors, LOCATION_ID); Assert.assertEquals(this.errors.getAllErrors().size(), 1); final ObjectError objectError = this.errors.getAllErrors().get(0); assertThat(Arrays.asList(objectError.getCodes()), CoreMatchers.hasItem("location.invalid")); }
Source:
protected abstract DfsPackDescription newPack(PackSource source) throws IOException; protected void commitPack(Collection<DfsPackDescription> desc, Collection<DfsPackDescription> replaces) throws IOException { commitPackImpl(desc, replaces); if (replaces != null) { DfsBlockCache cache = DfsBlockCache.getInstance(); for (DfsPackDescription replace : replaces) { DfsPackFile packFile = cache.getOrCreate(replace, null); packFile.close(); } } getRepository().fireEvent(new DfsPacksChangedEvent()); }

Target:
protected abstract DfsPackDescription newPack(PackSource source) throws IOException; protected void commitPack(Collection<DfsPackDescription> desc, Collection<DfsPackDescription> replaces) throws IOException { commitPackImpl(desc, replaces); if (replaces != null && !replaces.isEmpty()) { DfsBlockCache cache = DfsBlockCache.getInstance(); for (DfsPackDescription replace : replaces) { DfsPackFile packFile = cache.getOrCreate(replace, null); packFile.close(); } } getRepository().fireEvent(new DfsPacksChangedEvent()); }
Source:
public QueryResponse process(QueryResponse input) throws PluginExecutionException, StopProcessingException { for (Result result : input.getResults()) { Metacard metacard = result.getMetacard(); byte[] thumbnailBytes = metacard.getThumbnail(); if (thumbnailBytes == null) continue; try ( ByteArrayInputStream original = new ByteArrayInputStream(thumbnailBytes); ByteArrayOutputStream converted = new ByteArrayOutputStream() ) { IISRandomAccessIO in = new IISRandomAccessIO( ImageIO.createImageInputStream(original)); if (in.readInt() != OTHER_JP2_SIGNATURE || in.readInt() != JP2_SIGNATURE_BOX || in.readInt() != OFFICIAL_JP2_SIGNATURE) { in.seek(0); if (in.readShort() != START_OF_CODESTREAM_MARKER) continue; } original.reset(); BufferedImage thumbnail = ImageIO.read(original); ImageIO.write(thumbnail, "jpeg", converted); metacard.setAttribute( new AttributeImpl(Metacard.THUMBNAIL, converted.toByteArray())); } catch (IOException e) { throw new PluginExecutionException(e); } } return input; }

Target:
public QueryResponse process(QueryResponse input) throws PluginExecutionException, StopProcessingException { for (Result result : input.getResults()) { Metacard metacard = result.getMetacard(); byte[] thumbnailBytes = metacard.getThumbnail(); if (thumbnailBytes == null) continue; try ( ByteArrayInputStream original = new ByteArrayInputStream(thumbnailBytes); ByteArrayOutputStream converted = new ByteArrayOutputStream() ) { IISRandomAccessIO in = new IISRandomAccessIO( ImageIO.createImageInputStream(original)); if (in.readInt() != OTHER_JP2_SIGNATURE || in.readInt() != JP2_SIGNATURE_BOX || in.readInt() != OFFICIAL_JP2_SIGNATURE) { in.seek(0); if (in.readShort() != START_OF_CODESTREAM_MARKER) continue; } original.reset(); BufferedImage thumbnail = ImageIO.read(original); if (thumbnail == null) continue; ImageIO.write(thumbnail, "jpeg", converted); metacard.setAttribute( new AttributeImpl(Metacard.THUMBNAIL, converted.toByteArray())); } catch (IOException e) { throw new PluginExecutionException(e); } } return input; }
Source:
public void testGetTokenNames() { assertEquals("Unexpected token name", "HTML_COMMENT", JavadocUtils.getTokenName(20081)); }

Target:
public void testGetTokenNames() { assertEquals("Unexpected token name", "OPTGROUP", JavadocUtils.getTokenName(10082)); }
Source:
public boolean restartTopology() { boolean result = true; for (HeronWorker worker : multiKeyWorkerMap.getHeronWorkers()) { result &= restartWorker(worker.workerId); } return result; }

Target:
public void restartTopology() throws ContainerAllocationException { for (HeronWorker worker : multiKeyWorkerMap.getHeronWorkers()) { restartWorker(worker.workerId); } }
Source:
protected void fullBackupDatabase(final String dbURL, final String iPath, final ODatabaseDocumentInternal db) throws IOException { OLogManager.instance().info(this, "AutomaticBackup: executing full backup of database '%s' to %s", dbURL, iPath); final String tempPath = iPath + ".tmp"; final FileOutputStream fileOutputStream = new FileOutputStream(tempPath); try { db.backup(fileOutputStream, null, null, new OCommandOutputListener() { @Override public void onMessage(String iText) { OLogManager.instance().info(this, iText); } }, compressionLevel, bufferSize); } finally { fileOutputStream.close(); } Files.move(Paths.get(tempPath), Paths.get(iPath)); }

Target:
protected void fullBackupDatabase(final String dbURL, final String iPath, final ODatabaseDocumentInternal db) throws IOException { OLogManager.instance().info(this, "AutomaticBackup: executing full backup of database '%s' to %s", dbURL, iPath); final Path filePath = Paths.get(iPath); OFileUtils.prepareForFileCreationOrReplacement(filePath, this, "backing up"); final String tempFileName = iPath + ".tmp"; final Path tempFilePath = Paths.get(tempFileName); OFileUtils.prepareForFileCreationOrReplacement(tempFilePath, this, "backing up"); try (FileOutputStream fileOutputStream = new FileOutputStream(tempFileName)) { db.backup(fileOutputStream, null, null, new OCommandOutputListener() { @Override public void onMessage(String iText) { OLogManager.instance().info(this, iText); } }, compressionLevel, bufferSize); } Files.move(tempFilePath, filePath); }
Source:
private static CommandParameters getCommandParameters(Object cmd) { CommandParameters cmdParams = new CommandParameters(); Class clz = cmd.getClass(); while (clz != null) { for (Field field : clz.getDeclaredFields()) { Parameters fieldAnnotation = field.getAnnotation(Parameters.class); if (fieldAnnotation != null) { try { cmdParams.addParameters(fieldAnnotation, (Parameter[]) field.get(cmd)); } catch (IllegalAccessException e) { log.warn("Unable to retrieve parameters for " + clz.getName() + "." + field.getName()); } } } clz = clz.getSuperclass(); } return cmdParams; }

Target:
private static Map<Boolean, List<Parameter>> getCommandParameters(Object cmd) { Map<Boolean, List<Parameter>> cmdParams = new HashMap<Boolean, List<Parameter>>(); cmdParams.put(false, new ArrayList<Parameter>()); cmdParams.put(true, new ArrayList<Parameter>()); Class clz = cmd.getClass(); while (clz != null) { for (Field field : clz.getDeclaredFields()) { Parameters fieldAnnotation = field.getAnnotation(Parameters.class); if (fieldAnnotation != null) { try { cmdParams.get(fieldAnnotation.optional()).addAll(Arrays.asList((Parameter[]) field.get(cmd))); } catch (IllegalAccessException e) { log.warn("Unable to retrieve parameters for " + clz.getName() + "." + field.getName()); } } } clz = clz.getSuperclass(); } return cmdParams; }
Source:
public ValueType typeCheck(TypeContext ctx) { ValueType valTypeExpr = exprToAssign.typeCheck(ctx); StructuralType structTypeObj = objectExpr.typeCheck(ctx).getStructuralType(ctx); DeclType declTypeField = structTypeObj.findDecl(fieldName, ctx); if (!(declTypeField instanceof VarDeclType)) throw new RuntimeException("Type error: trying to set the field " + fieldName + ", but this isn't" + "a var declaration."); ValueType valTypeField = ((VarDeclType) declTypeField).getRawResultType(); if (!valTypeExpr.isSubtypeOf(valTypeField, ctx)) throw new RuntimeException("Type error: trying to set the field " + fieldName + ", but the type " + valTypeExpr + " cannot be assigned to " + valTypeField); return valTypeExpr; }

Target:
public ValueType typeCheck(TypeContext ctx) { ValueType valTypeExpr = exprToAssign.typeCheck(ctx); StructuralType structTypeObj = objectExpr.typeCheck(ctx).getStructuralType(ctx); DeclType declTypeField = structTypeObj.findDecl(fieldName, ctx); if (!(declTypeField instanceof VarDeclType)) ToolError.reportError(ErrorMessage.TYPE_CANNOT_BE_ASSIGNED, HasLocation.UNKNOWN, declTypeField.toString()); ValueType valTypeField = ((VarDeclType) declTypeField).getResultType(View.from(objectExpr, ctx)); if (!valTypeExpr.isSubtypeOf(valTypeField, ctx)) ToolError.reportError(ErrorMessage.NOT_SUBTYPE, HasLocation.UNKNOWN, valTypeExpr.toString(), structTypeObj.toString()); return valTypeExpr; }
Source:
public void isGitRepository() throws IOException { assertTrue(new File(db.getDirectory(), "HEAD").delete()); assertTrue(RepositoryCache.FileKey.isGitRepository(db.getDirectory(), db.getFS())); }

Target:
public void isGitRepository() { assertTrue(new File(db.getDirectory(), "HEAD").delete()); assertTrue(RepositoryCache.FileKey.isGitRepository(db.getDirectory(), db.getFS())); }
Source:
public ClusterClientProvider<String> deployApplicationCluster( final ClusterSpecification clusterSpecification, final ApplicationConfiguration applicationConfiguration) throws ClusterDeploymentException { if (client.getRestService(clusterId).isPresent()) { throw new ClusterDeploymentException("The Flink cluster " + clusterId + " already exists."); } checkNotNull(clusterSpecification); checkNotNull(applicationConfiguration); final String deploymentTarget = flinkConfig.get(DeploymentOptions.TARGET); if (!KubernetesConfigOptions.DeploymentTargetNames.APPLICATION.getName().equalsIgnoreCase(deploymentTarget)) { throw new ClusterDeploymentException( "Couldn't deploy Kubernetes Application Cluster." + " Expected deployment.target=" + KubernetesConfigOptions.DeploymentTargetNames.APPLICATION.getName() + " but actual one was \"" + deploymentTarget + "\""); } applicationConfiguration.applyToConfiguration(flinkConfig); KubernetesUtils.checkJarFileForApplicationMode(flinkConfig); final ClusterClientProvider<String> clusterClientProvider = deployClusterInternal( KubernetesApplicationClusterEntrypoint.class.getName(), clusterSpecification, false); try (ClusterClient<String> clusterClient = clusterClientProvider.getClusterClient()) { LOG.info( "Create flink application cluster successfully, JobManager Web Interface: {}", clusterId, clusterClient.getWebInterfaceURL()); } return clusterClientProvider; }

Target:
public ClusterClientProvider<String> deployApplicationCluster( final ClusterSpecification clusterSpecification, final ApplicationConfiguration applicationConfiguration) throws ClusterDeploymentException { if (client.getRestService(clusterId).isPresent()) { throw new ClusterDeploymentException("The Flink cluster " + clusterId + " already exists."); } checkNotNull(clusterSpecification); checkNotNull(applicationConfiguration); final KubernetesDeploymentTarget deploymentTarget = KubernetesDeploymentTarget.fromConfig(flinkConfig); if (KubernetesDeploymentTarget.APPLICATION != deploymentTarget) { throw new ClusterDeploymentException( "Couldn't deploy Kubernetes Application Cluster." + " Expected deployment.target=" + KubernetesDeploymentTarget.APPLICATION.getName() + " but actual one was \"" + deploymentTarget + "\""); } applicationConfiguration.applyToConfiguration(flinkConfig); final List<File> pipelineJars = KubernetesUtils.checkJarFileForApplicationMode(flinkConfig); Preconditions.checkArgument(pipelineJars.size() == 1, "Should only have one jar"); final ClusterClientProvider<String> clusterClientProvider = deployClusterInternal( KubernetesApplicationClusterEntrypoint.class.getName(), clusterSpecification, false); try (ClusterClient<String> clusterClient = clusterClientProvider.getClusterClient()) { LOG.info( "Create flink application cluster successfully, JobManager Web Interface: {}", clusterId, clusterClient.getWebInterfaceURL()); } return clusterClientProvider; }
Source:
public void addRow(T props) { subProperties.add(props); props.init(); getForm(Form.MAIN).addRow(props.getForm(Form.MAIN)); }

Target:
public void addRow(T props) { subProperties.add(props); getForm(Form.MAIN).addRow(props.getForm(Form.MAIN)); }
Source:
public Resource copyResource(PerunSession sess, Resource templateResource, Resource destinationResource, boolean withGroups) throws InternalErrorException, ResourceNotExistsException, FacilityNotExistsException, PrivilegeException, VoNotExistsException, ResourceExistsException { Utils.checkPerunSession(sess); Vo destinationVo = getPerunBl().getVosManagerBl().getVoById(sess, destinationResource.getVoId()); Facility destinationFacility = getPerunBl().getFacilitiesManagerBl().getFacilityById(sess, destinationResource.getFacilityId()); getPerunBl().getVosManagerBl().checkVoExists(sess, destinationVo); getPerunBl().getFacilitiesManagerBl().checkFacilityExists(sess, destinationFacility); Facility templateResourceFacility = getPerunBl().getFacilitiesManagerBl().getFacilityById(sess, templateResource.getFacilityId()); if(!AuthzResolver.isAuthorized(sess, Role.VOADMIN, templateResource) && !AuthzResolver.isAuthorized(sess,Role.FACILITYADMIN, templateResourceFacility)){ throw new PrivilegeException(sess, "Problem with template Resource's facility in copyResource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, destinationVo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, destinationFacility)) { throw new PrivilegeException(sess, "Problem with new Resource's facility in copyResource."); } getResourcesManagerBl().checkResourceExists(sess, templateResource); return getResourcesManagerBl().copyResource(sess, templateResource, destinationResource, withGroups); }

Target:
public Resource copyResource(PerunSession sess, Resource templateResource, Resource destinationResource, boolean withGroups) throws InternalErrorException, ResourceNotExistsException, FacilityNotExistsException, PrivilegeException, VoNotExistsException, ResourceExistsException { Utils.checkPerunSession(sess); Utils.notNull(templateResource, "Template Resource"); Utils.notNull(destinationResource, "Destination Resource"); getResourcesManagerBl().checkResourceExists(sess, templateResource); if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, templateResource)) { throw new PrivilegeException(sess, "User is not facility admin of template Resource's facility."); } if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, destinationResource)) { throw new PrivilegeException(sess, "User is not facility admin of destination Resource's facility."); } if(withGroups) { if(destinationResource.getVoId() != templateResource.getVoId()) { throw new InternalErrorException("Resources are not from the same VO."); } if(!AuthzResolver.isAuthorized(sess, Role.VOADMIN, templateResource)) { throw new PrivilegeException(sess, "User needs vo admin rights for copying the groups and group related attributes."); } } return getResourcesManagerBl().copyResource(sess, templateResource, destinationResource, withGroups); }
Source:
public void switchPerspective(String perspectiveId) { throw new UnsupportedOperationException("Not yet supported by this implementation"); }

Target:
public void switchPerspective(String perspectiveId) { getActiveWindowService().switchPerspective(perspectiveId); }
Source:
public static void runOnServer(String name, String path) { IWorkspaceRoot wRoot = ResourcesPlugin.getWorkspace().getRoot(); String projectName = CheatSheetUtil.replaceProjectName(name); IProject project = wRoot.getProject(projectName); if (project == null || !project.isOpen()) { return; } if (path != null) { IFile file = wRoot.getFile(new Path(CheatSheetUtil.replaceProjectName(path))); if (file != null && file.exists()) { try { SingleDeployableFactory.makeDeployable(file.getFullPath()); IServer[] deployableServersAsIServers = ServerConverter .getDeployableServersAsIServers(); if (deployableServersAsIServers.length == 1) { IServer server = deployableServersAsIServers[0]; IServerWorkingCopy copy = server.createWorkingCopy(); IModule[] modules = new IModule[1]; modules[0] = SingleDeployableFactory.findModule(file .getFullPath()); copy.modifyModules(modules, new IModule[0], new NullProgressMonitor()); IServer saved = copy.save(false, new NullProgressMonitor()); saved.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor()); } } catch (CoreException e) { IStatus status = new Status(IStatus.INFO,Activator.PLUGIN_ID,e.getMessage(),e); Activator.getDefault().getLog().log(status); } } } IAction action = new RunOnServerAction(project); action.run(); }

Target:
public static void runOnServer(String name, String path) { IWorkspaceRoot wRoot = ResourcesPlugin.getWorkspace().getRoot(); String projectName = name; IProject project = wRoot.getProject(projectName); if (project == null || !project.isOpen()) { return; } if (path != null) { IFile file = wRoot.getFile(new Path(path)); if (file != null && file.exists()) { try { SingleDeployableFactory.makeDeployable(file.getFullPath()); IServer[] deployableServersAsIServers = ServerConverter .getDeployableServersAsIServers(); if (deployableServersAsIServers.length == 1) { IServer server = deployableServersAsIServers[0]; IServerWorkingCopy copy = server.createWorkingCopy(); IModule[] modules = new IModule[1]; modules[0] = SingleDeployableFactory.findModule(file .getFullPath()); copy.modifyModules(modules, new IModule[0], new NullProgressMonitor()); IServer saved = copy.save(false, new NullProgressMonitor()); saved.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor()); } } catch (CoreException e) { IStatus status = new Status(IStatus.INFO,Activator.PLUGIN_ID,e.getMessage(),e); Activator.getDefault().getLog().log(status); } } } IAction action = new RunOnServerAction(project); action.run(); }
Source:
private ThingUID getThingUID(FullLight light) { ThingUID bridgeUID = hueBridgeHandler.getThing().getUID(); ThingTypeUID thingTypeUID = getThingTypeUID(light); if (thingTypeUID != null && getSupportedThingTypes().contains(thingTypeUID)) { String thingLightId = light.getId(); ThingTypeUID modelUID = new ThingTypeUID(BINDING_ID, light.getModelID().replaceAll(HueLightHandler.NORMALIZE_ID_REGEX, "_")); ThingUID thingUID = new ThingUID(modelUID, bridgeUID, thingLightId); return thingUID; } else { return null; } }

Target:
private ThingUID getThingUID(FullLight light) { ThingUID bridgeUID = hueBridgeHandler.getThing().getUID(); ThingTypeUID thingTypeUID = getThingTypeUID(light); if (thingTypeUID != null && getSupportedThingTypes().contains(thingTypeUID)) { return new ThingUID(BINDING_ID, bridgeUID, light.getId()); } else { return null; } }
Source:
public synchronized void removeMonitorListener( Object monitorListener ) { List<Class<?>> listenerInterfaces = getAllInterfaces( monitorListener ); methodsStream( listenerInterfaces ).forEach( method -> { Set<MonitorListenerInvocationHandler> handlers = methodMonitorListeners.get( method ); handlers.removeIf( handler -> monitorListener.equals( handler.getMonitorListener() ) ); if ( handlers.isEmpty() ) { methodMonitorListeners.remove( method ); } } ); listenerInterfaces.forEach( monitoredInterfaces::remove ); }

Target:
public void removeMonitorListener( Object monitorListener ) { List<Class<?>> listenerInterfaces = getAllInterfaces( monitorListener ); methodsStream( listenerInterfaces ).forEach( key -> methodMonitorListeners.computeIfPresent( key, ( method1, handlers ) -> { handlers.removeIf( handler -> monitorListener.equals( handler.getMonitorListener() ) ); return handlers.isEmpty() ? null : handlers; } ) ); listenerInterfaces.forEach( monitoredInterfaces::remove ); }
Source:
public static JpaSettings get() { if (INSTANCE == null) { INSTANCE = new JpaSettings(); } return INSTANCE; }

Target:
public static JpaSettings get() { return INSTANCE; }
Source:
public void deserialize(ByteBuf buffer) { stack = ByteBufUtils.readItemStack(buffer); hand = buffer.readInt() == 0 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND; }

Target:
public IGuiProvider deserialize(ByteBuf buffer) { owner = ByteBufUtils.readItemStack(buffer); hand = buffer.readBoolean() ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND; return this; }
Source:
public final Object clone() { try { FieldArray clone = (FieldArray) super.clone(); clone.mFieldNumbers = new int[mFieldNumbers.length]; clone.mData = new FieldData[mData.length]; System.arraycopy(mFieldNumbers, 0, clone.mFieldNumbers, 0, mFieldNumbers.length); for (int i = 0; i < mData.length; i++) { if (mData[i] != null) { clone.mData[i] = (FieldData) mData[i].clone(); } } return clone; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } }

Target:
public final FieldArray clone() { int size = size(); FieldArray clone = new FieldArray(size); System.arraycopy(mFieldNumbers, 0, clone.mFieldNumbers, 0, size); for (int i = 0; i < mData.length; i++) { if (mData[i] != null) { clone.mData[i] = mData[i].clone(); } } clone.mSize = mSize; return clone; }
Source:
public void updatePermission(String queueName, QueueRolePermission[] queueRolePermissionsDTO) throws BrokerManagerAdminException { QueueManagerService queueManagerService = AndesBrokerManagerAdminServiceDSHolder.getInstance() .getQueueManagerService(); org.wso2.carbon.andes.core.types.QueueRolePermission[] rolePermissions; try { if (queueRolePermissionsDTO != null && queueRolePermissionsDTO.length > 0) { rolePermissions = new org.wso2.carbon.andes.core.types.QueueRolePermission[queueRolePermissionsDTO.length]; for (int i=0; i < queueRolePermissionsDTO.length; i++) { rolePermissions[i] = queueRolePermissionsDTO[i].convertToAndesCoreRole(); } queueManagerService.updatePermission(queueName, rolePermissions); } } catch (QueueManagerException e) { log.error("Unable to update permission of the queue.", e); throw new BrokerManagerAdminException("Unable to update permission of the queue.", e); } }

Target:
public void updatePermission(String queueName, QueueRolePermission[] queueRolePermissionsDTO) throws BrokerManagerAdminException { QueueManagerService queueManagerService = AndesBrokerManagerAdminServiceDSHolder.getInstance() .getQueueManagerService(); org.wso2.carbon.andes.core.types.QueueRolePermission[] rolePermissions; try { if (queueRolePermissionsDTO != null && queueRolePermissionsDTO.length > 0) { rolePermissions = new org.wso2.carbon.andes.core.types.QueueRolePermission[queueRolePermissionsDTO.length]; for (int i = 0; i < queueRolePermissionsDTO.length; i++) { rolePermissions[i] = queueRolePermissionsDTO[i].convert(); } queueManagerService.updatePermission(queueName, rolePermissions); } } catch (QueueManagerException e) { log.error("Unable to update permission of the queue.", e); throw new BrokerManagerAdminException("Unable to update permission of the queue.", e); } }
Source:
private boolean clusterHasPpcArchitecture() { Cluster cluster = getModel().getSelectedCluster(); return cluster != null && cluster.getArchitecture() != null && ArchitectureType.ppc.getFamily() == cluster.getArchitecture().getFamily(); }

Target:
private boolean clusterHasPpcArchitecture() { Cluster cluster = getModel().getSelectedCluster(); return cluster != null && cluster.getArchitecture() != null && ArchitectureType.ppc == cluster.getArchitecture().getFamily(); }
Source:
public String viewTagWizard(@RequestParam(required = false, value = "selectedTarget") String target, Model model) { List<String> entityTypeIds = dataService.findAll(ENTITY_TYPE_META_DATA, EntityType.class) .map(EntityType::getId) .collect(toList()); if (StringUtils.isEmpty(target)) { Optional<String> findFirst = entityTypeIds.stream().findFirst(); if (findFirst.isPresent()) { target = findFirst.get(); } } if (StringUtils.isEmpty(target)) { throw new MolgenisRuntimeException("There are no entities available!"); } List<Ontology> ontologies = ontologyService.getOntologies(); EntityType emd = dataService.getEntityType(target); List<Attribute> attributes = newArrayList(emd.getAttributes()); Map<String, Multimap<Relation, OntologyTerm>> taggedAttributes = attributes.stream() .collect(toMap((Attribute::getName), (x -> ontologyTagService.getTagsForAttribute( emd, x)))); model.addAttribute("entity", emd); model.addAttribute("entityTypeIds", entityTypeIds); model.addAttribute("attributes", attributes); model.addAttribute("ontologies", ontologies); model.addAttribute("taggedAttributes", taggedAttributes); model.addAttribute("relations", Relation.values()); return VIEW_TAG_WIZARD; }

Target:
public String viewTagWizard(@RequestParam(required = false, value = "selectedTarget") String target, Model model) { List<String> entityTypeIds = dataService.findAll(ENTITY_TYPE_META_DATA, EntityType.class) .map(EntityType::getId) .collect(toList()); if (StringUtils.isEmpty(target)) { Optional<String> findFirst = entityTypeIds.stream().findFirst(); if (findFirst.isPresent()) { target = findFirst.get(); } } if (StringUtils.isEmpty(target)) { throw new IllegalStateException("There are no entities available!"); } List<Ontology> ontologies = ontologyService.getOntologies(); EntityType emd = dataService.getEntityType(target); List<Attribute> attributes = newArrayList(emd.getAttributes()); Map<String, Multimap<Relation, OntologyTerm>> taggedAttributes = attributes.stream() .collect(toMap((Attribute::getName), (x -> ontologyTagService.getTagsForAttribute( emd, x)))); model.addAttribute("entity", emd); model.addAttribute("entityTypeIds", entityTypeIds); model.addAttribute("attributes", attributes); model.addAttribute("ontologies", ontologies); model.addAttribute("taggedAttributes", taggedAttributes); model.addAttribute("relations", Relation.values()); return VIEW_TAG_WIZARD; }
Source:
void handleResponse(ResponseInfo responseInfo) { long startTime = time.milliseconds(); UndeleteResponse undeleteResponse = RouterUtils.extractResponseAndNotifyResponseHandler(responseHandler, routerMetrics, responseInfo, UndeleteResponse::readFrom, UndeleteResponse::getError); RequestInfo routerRequestInfo = responseInfo.getRequestInfo(); int correlationId = ((UndeleteRequest) routerRequestInfo.getRequest()).getCorrelationId(); UndeleteOperation undeleteOperation = correlationIdToUndeleteOperation.remove(correlationId); if (undeleteOperations.contains(undeleteOperation)) { boolean exceptionEncountered = false; try { undeleteOperation.handleResponse(responseInfo, undeleteResponse); } catch (Exception e) { exceptionEncountered = true; undeleteOperation.setOperationException( new RouterException("Undelete handleResponse encountered unexpected error", e, RouterErrorCode.UnexpectedInternalError)); } if (exceptionEncountered || undeleteOperation.isOperationComplete()) { if (undeleteOperations.remove(undeleteOperation)) { onComplete(undeleteOperation); } } routerMetrics.undeleteManagerHandleResponseTimeMs.update(time.milliseconds() - startTime); } else { routerMetrics.ignoredResponseCount.inc(); } }

Target:
void handleResponse(ResponseInfo responseInfo) { long startTime = time.milliseconds(); UndeleteResponse undeleteResponse = RouterUtils.extractResponseAndNotifyResponseHandler(responseHandler, routerMetrics, responseInfo, UndeleteResponse::readFrom, UndeleteResponse::getError); RequestInfo routerRequestInfo = responseInfo.getRequestInfo(); int correlationId = routerRequestInfo.getRequest().getCorrelationId(); UndeleteOperation undeleteOperation = correlationIdToUndeleteOperation.remove(correlationId); if (undeleteOperations.contains(undeleteOperation)) { boolean exceptionEncountered = false; try { undeleteOperation.handleResponse(responseInfo, undeleteResponse); } catch (Exception e) { exceptionEncountered = true; undeleteOperation.setOperationException( new RouterException("Undelete handleResponse encountered unexpected error", e, RouterErrorCode.UnexpectedInternalError)); } if (exceptionEncountered || undeleteOperation.isOperationComplete()) { if (undeleteOperations.remove(undeleteOperation)) { onComplete(undeleteOperation); } } routerMetrics.undeleteManagerHandleResponseTimeMs.update(time.milliseconds() - startTime); } else { routerMetrics.ignoredResponseCount.inc(); } }