auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void remainingUpdated(long remaining) { long percentOccupied = (capacity - remaining) * 100 / capacity; int newT, curT = threshold.get(); if (percentOccupied >= 90) { newT = 90; } else if (percentOccupied >= 75) { newT = 75; } else { newT = 0; } if (threshold.compareAndSet(curT, newT)) { if (newT > curT) { LOGGER.info(MESSAGE_PROPERTIES.getProperty(newT == 90 ? OFFHEAP_WARN_KEY : OFFHEAP_INFO_KEY), identifier, percentOccupied); onReservationThresholdReached.accept(this, new ThresholdChange(curT, newT)); } else if (newT < curT) { if(newT == 75) { LOGGER.info(MESSAGE_PROPERTIES.getProperty(OFFHEAP_INFO_KEY), identifier, percentOccupied); } onReservationThresholdReached.accept(this, new ThresholdChange(curT, newT)); } } }

Target:
private void remainingUpdated(long remaining) { long percentOccupied = (capacity - remaining) * 100 / capacity; int newT, curT = threshold.get(); if (percentOccupied >= 90) { newT = 90; } else if (percentOccupied >= 75) { newT = 75; } else { newT = 0; } if (threshold.compareAndSet(curT, newT)) { if (newT > curT) { if (newT == 90) { LOGGER.warn(MESSAGE_PROPERTIES.getProperty(OFFHEAP_WARN_KEY), identifier, percentOccupied); } else { LOGGER.info(MESSAGE_PROPERTIES.getProperty(OFFHEAP_INFO_KEY), identifier, percentOccupied); } onReservationThresholdReached.accept(this, new ThresholdChange(curT, newT)); } else if (newT < curT) { if (newT == 75) { LOGGER.info(MESSAGE_PROPERTIES.getProperty(OFFHEAP_INFO_KEY), identifier, percentOccupied); } onReservationThresholdReached.accept(this, new ThresholdChange(curT, newT)); } } }
Source:
public void decorate(World world, Random random, Chunk source) { if (random.nextFloat() < density) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = world.getHighestBlockYAt(sourceX, sourceZ); sourceY = fixedHeightRange ? sourceY : random.nextInt(sourceY << 1); for (int i = 0; i < 64; i++) { int x = sourceX + random.nextInt(8) - random.nextInt(8); int z = sourceZ + random.nextInt(8) - random.nextInt(8); int y = sourceY + random.nextInt(4) - random.nextInt(4); Block block = world.getBlockAt(x, y, z); Block blockBelow = world.getBlockAt(x, y - 1, z); if (y < 255 && block.getType() == Material.AIR) { boolean canPlaceShroom; switch (blockBelow.getType()) { case MYCEL: canPlaceShroom = true; break; case GRASS: canPlaceShroom = (block.getLightLevel() < 13); break; default: MaterialData data = blockBelow.getState().getData(); if (data instanceof Dirt) { canPlaceShroom = (((Dirt) data).getType() == DirtType.PODZOL || block.getLightLevel() < 13); } else { canPlaceShroom = false; } } if (canPlaceShroom) { BlockState state = block.getState(); state.setType(type); state.setData(new MaterialData(type)); state.update(true); } } } } }

Target:
public void decorate(World world, Random random, Chunk source) { if (random.nextFloat() < density) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = world.getHighestBlockYAt(sourceX, sourceZ); sourceY = fixedHeightRange ? sourceY : random.nextInt(sourceY << 1); for (int i = 0; i < 64; i++) { int x = sourceX + random.nextInt(8) - random.nextInt(8); int z = sourceZ + random.nextInt(8) - random.nextInt(8); int y = sourceY + random.nextInt(4) - random.nextInt(4); Block block = world.getBlockAt(x, y, z); Block blockBelow = world.getBlockAt(x, y - 1, z); if (y < 255 && block.getType() == Material.AIR) { boolean canPlaceShroom; switch (blockBelow.getType()) { case MYCEL: canPlaceShroom = true; break; case GRASS: canPlaceShroom = (block.getLightLevel() < 13); break; case DIRT: MaterialData data = blockBelow.getState().getData(); if (data instanceof Dirt) { canPlaceShroom = (((Dirt) data).getType() == DirtType.PODZOL || block.getLightLevel() < 13); } else { canPlaceShroom = false; } break; default: canPlaceShroom = false; } if (canPlaceShroom) { BlockState state = block.getState(); state.setType(type); state.setData(new MaterialData(type)); state.update(true); } } } } }
Source:
protected void commenceLoginRedirect(HttpServletRequest request, HttpServletResponse response) throws IOException { if (request.getSession(false) == null && KeycloakCookieBasedRedirect.getRedirectUrlFromCookie(request) == null) { response.addCookie(KeycloakCookieBasedRedirect.createCookieFromRedirectUrl(request.getRequestURI())); } String contextAwareLoginUri = request.getContextPath() + loginUri; log.debug("Redirecting to login URI {}", contextAwareLoginUri); response.sendRedirect(contextAwareLoginUri); }

Target:
protected void commenceLoginRedirect(HttpServletRequest request, HttpServletResponse response) throws IOException { String contextAwareLoginUri = request.getContextPath() + loginUri; log.debug("Redirecting to login URI {}", contextAwareLoginUri); response.sendRedirect(contextAwareLoginUri); }
Source:
public LockResource lockExclusive(StateLockOptions lockOptions) throws TimeoutException, InterruptedException { boolean lockAcquired = false; if (lockOptions.waitGraceCycle()) { long deadlineMs = System.currentTimeMillis() + lockOptions.getGraceCycleTimeoutMs(); while (System.currentTimeMillis() < deadlineMs) { if (mStateLock.writeLock().tryLock(lockOptions.getGraceCycleTryMs(), TimeUnit.MILLISECONDS)) { lockAcquired = true; break; } else { long remainingWaitMs = deadlineMs - System.currentTimeMillis(); if (remainingWaitMs > 0) { Thread.sleep(Math.min(lockOptions.getGraceCycleSleepMs(), remainingWaitMs)); } } } } if (lockAcquired) { scheduleInterruptCycle(lockOptions.getInterruptWaitersInternalMs()); } else { if (!lockOptions.lockAfterGraceCycle()) { throw new TimeoutException( ExceptionMessage.STATE_LOCK_TIMED_OUT.getMessage(lockOptions.getGraceCycleTimeoutMs())); } if (lockOptions.interruptCycleAfterGraceCycle()) { scheduleInterruptCycle(lockOptions.getInterruptWaitersInternalMs()); } mStateLock.writeLock().lock(); } return new LockResource(mStateLock.writeLock(), false, false, () -> { if (mInterrupterFuture != null && !mInterrupterFuture.isDone()) { mInterrupterFuture.cancel(true); } }); }

Target:
public LockResource lockExclusive(StateLockOptions lockOptions) throws TimeoutException, InterruptedException { StateLockOptions.GraceMode graceMode = lockOptions.getGraceMode(); boolean lockAcquired = false; long deadlineMs = System.currentTimeMillis() + lockOptions.getGraceCycleTimeoutMs(); while (System.currentTimeMillis() < deadlineMs) { if (mStateLock.writeLock().tryLock(lockOptions.getGraceCycleTryMs(), TimeUnit.MILLISECONDS)) { lockAcquired = true; break; } else { long remainingWaitMs = deadlineMs - System.currentTimeMillis(); if (remainingWaitMs > 0) { Thread.sleep(Math.min(lockOptions.getGraceCycleSleepMs(), remainingWaitMs)); } } } if (lockAcquired) { activateInterruptCycle(); } else { if (graceMode == StateLockOptions.GraceMode.TIMEOUT) { throw new TimeoutException( ExceptionMessage.STATE_LOCK_TIMED_OUT.getMessage(lockOptions.getGraceCycleTimeoutMs())); } activateInterruptCycle(); try { if (!mStateLock.writeLock().tryLock(mForcedDurationMs, TimeUnit.MILLISECONDS)) { throw new TimeoutException(ExceptionMessage.STATE_LOCK_TIMED_OUT .getMessage(lockOptions.getGraceCycleTimeoutMs() + mForcedDurationMs)); } } catch (InterruptedException e) { deactivateInterruptCycle(); throw e; } } return new LockResource(mStateLock.writeLock(), false, false, () -> { deactivateInterruptCycle(); }); }
Source:
public void verifyCategoryError() { waitForElementByElement(categoryErrorMsg); Assertion.assertEquals("Please choose a category", categoryErrorMsg.getText()); }

Target:
public void verifyCategoryError() { waitForElementByElement(categoryErrorMsg); Assertion.assertEquals(CreateWikiMessages.categoryErrorMessage, categoryErrorMsg.getText()); }
Source:
private static void addPublicationTypes(Result.Builder resBuilder, String... types) { for (String type : types) { resBuilder.addInstanceBuilder().getInstancetypeBuilder() .setClassid(type); } }

Target:
private static void addPublicationTypes(Result.Builder resBuilder, String... types) { Arrays.stream(types).forEach(type -> resBuilder.addInstanceBuilder().getInstancetypeBuilder().setClassid(type)); }
Source:
public void update_warning_condition() throws Exception { logInAsQualityGateAdmin(); QualityGateDto qualityGate = db.qualityGates().insertQualityGate(); MetricDto metric = db.measures().insertMetric(m -> m.setValueType(INT.name()).setHidden(false)); QualityGateConditionDto condition = db.qualityGates().addCondition(qualityGate, metric, c -> c.setOperator("GT").setWarningThreshold(null).setErrorThreshold("80").setPeriod(null)); executeRequest(condition.getId(), metric.getKey(), "LT", "90", null, null); assertCondition(qualityGate, metric, "LT", "90", null, null); }

Target:
public void update_warning_condition() throws Exception { logInAsQualityGateAdmin(); QualityGateDto qualityGate = db.qualityGates().insertQualityGate(); MetricDto metric = insertMetric(); QualityGateConditionDto condition = db.qualityGates().addCondition(qualityGate, metric, c -> c.setOperator("GT").setWarningThreshold(null).setErrorThreshold("80").setPeriod(null)); executeRequest(condition.getId(), metric.getKey(), "LT", "90", null, null); assertCondition(qualityGate, metric, "LT", "90", null, null); }
Source:
public void testChangeDiskProfileForDisk() { image_storage_domain_map image_storage_domain_map = dao.getAllByImageId(EXISTING_IMAGE_ID).get(0); assertThat("Same source and dest disk profile id, cannot perform test", image_storage_domain_map.getDiskProfileId(), not(equalTo(Guid.newGuid()))); dao.updateDiskProfileByImageGroupId(EXISTING_DISK_ID, EXISTING_DOMAIN_ID, FixturesTool.DISK_PROFILE_2); image_storage_domain_map = dao.getAllByImageId(EXISTING_IMAGE_ID).get(0); assertEquals("disk profile wasn't changed", image_storage_domain_map.getDiskProfileId(), FixturesTool.DISK_PROFILE_2); }

Target:
public void testChangeDiskProfileForDisk() { image_storage_domain_map image_storage_domain_map = dao.getAllByImageId(EXISTING_IMAGE_ID).get(0); assertThat("Same source and dest disk profile id, cannot perform test", image_storage_domain_map.getDiskProfileId(), not(equalTo(FixturesTool.DISK_PROFILE_2))); dao.updateDiskProfileByImageGroupId(EXISTING_DISK_ID, EXISTING_DOMAIN_ID, FixturesTool.DISK_PROFILE_2); image_storage_domain_map = dao.getAllByImageId(EXISTING_IMAGE_ID).get(0); assertEquals("disk profile wasn't changed", image_storage_domain_map.getDiskProfileId(), FixturesTool.DISK_PROFILE_2); }
Source:
public synchronized ContentPersister getPersister(Class cls) { if (!persisters.containsKey(cls.getCanonicalName())) { ContentPersister persister; if (cls.equals(HistoryEntry.class)) { persister = new HistoryEntryPersister(this); } else if (cls.equals(PageImage.class)) { persister = new PageImagePersister(this); } else if (cls.equals(RecentSearch.class)) { persister = new RecentSearchPersister(this); } else if (cls.equals(SavedPage.class)) { persister = new SavedPagePersister(this); } else if (cls.equals(EditSummary.class)) { persister = new EditSummaryPersister(this); } else { throw new RuntimeException("No persister found for class " + cls.getCanonicalName()); } persisters.put(cls.getCanonicalName(), persister); } return persisters.get(cls.getCanonicalName()); }

Target:
public ContentPersister getPersister(Class cls) { if (!persisters.containsKey(cls.getCanonicalName())) { ContentPersister persister; if (cls.equals(HistoryEntry.class)) { persister = new HistoryEntryPersister(this); } else if (cls.equals(PageImage.class)) { persister = new PageImagePersister(this); } else if (cls.equals(RecentSearch.class)) { persister = new RecentSearchPersister(this); } else if (cls.equals(SavedPage.class)) { persister = new SavedPagePersister(this); } else if (cls.equals(EditSummary.class)) { persister = new EditSummaryPersister(this); } else { throw new RuntimeException("No persister found for class " + cls.getCanonicalName()); } persisters.put(cls.getCanonicalName(), persister); } return persisters.get(cls.getCanonicalName()); }
Source:
private org.eclipse.californium.core.observe.Observation add(Token token, org.eclipse.californium.core.observe.Observation obs, boolean ifAbsent) { String endpoint = ObserveUtil.validateCoapObservation(obs); org.eclipse.californium.core.observe.Observation previousObservation = null; try (Jedis j = pool.getResource()) { byte[] lockValue = null; byte[] lockKey = toKey(LOCK_EP, endpoint); try { lockValue = RedisLock.acquire(j, lockKey); String registrationId = ObserveUtil.extractRegistrationId(obs); if (!j.exists(toRegIdKey(registrationId))) throw new IllegalStateException("no registration for this Id"); byte[] key = toKey(OBS_TKN, obs.getRequest().getToken().getBytes()); byte[] serializeObs = serializeObs(obs); byte[] previousValue = null; if (ifAbsent) { previousValue = j.get(key); if (previousValue == null || previousValue.length > 0) { j.set(key, serializeObs); } else { return deserializeObs(previousValue); } } else { previousValue = j.getSet(key, serializeObs); } j.lpush(toKey(OBS_TKNS_REGID_IDX, registrationId), obs.getRequest().getToken().getBytes()); if (previousValue != null && previousValue.length != 0) { previousObservation = deserializeObs(previousValue); LOG.warn( "Token collision ? observation from request will be replaced by observation from request ", previousObservation.getRequest(), obs.getRequest()); } } finally { RedisLock.release(j, lockKey, lockValue); } } return previousObservation; }

Target:
private org.eclipse.californium.core.observe.Observation add(Token token, org.eclipse.californium.core.observe.Observation obs, boolean ifAbsent) { String endpoint = ObserveUtil.validateCoapObservation(obs); org.eclipse.californium.core.observe.Observation previousObservation = null; try (Jedis j = pool.getResource()) { byte[] lockValue = null; byte[] lockKey = toKey(LOCK_EP, endpoint); try { lockValue = RedisLock.acquire(j, lockKey); String registrationId = ObserveUtil.extractRegistrationId(obs); if (!j.exists(toRegIdKey(registrationId))) throw new IllegalStateException("no registration for this Id"); byte[] key = toKey(OBS_TKN, obs.getRequest().getToken().getBytes()); byte[] serializeObs = serializeObs(obs); byte[] previousValue = null; if (ifAbsent) { previousValue = j.get(key); if (previousValue == null || previousValue.length == 0) { j.set(key, serializeObs); } else { return deserializeObs(previousValue); } } else { previousValue = j.getSet(key, serializeObs); } j.lpush(toKey(OBS_TKNS_REGID_IDX, registrationId), obs.getRequest().getToken().getBytes()); if (previousValue != null && previousValue.length != 0) { previousObservation = deserializeObs(previousValue); LOG.warn( "Token collision ? observation from request will be replaced by observation from request ", previousObservation.getRequest(), obs.getRequest()); } } finally { RedisLock.release(j, lockKey, lockValue); } } return previousObservation; }
Source:
public void testCreateInternalTopicsWithDefaultSettings() throws InterruptedException { int numWorkers = 1; int numBrokers = 3; connect = new EmbeddedConnectCluster.Builder().name("connect-cluster-1") .workerProps(workerProps) .numWorkers(numWorkers) .numBrokers(numBrokers) .brokerProps(brokerProps) .build(); connect.start(); connect.assertions().assertExactlyNumBrokersAreUp(numBrokers, "Brokers did not start in time."); connect.assertions().assertExactlyNumWorkersAreUp(numWorkers, "Worker did not start in time."); log.info("Completed startup of Kafka brokers and Connect workers", numBrokers, numWorkers); log.info("Verifying the internal topics for Connect"); connect.assertions().assertTopicsExist(configTopic(), offsetTopic(), statusTopic()); assertInternalTopicSettings(); log.info("Stopping the Connect worker"); connect.removeWorker(); Thread.sleep(3000); log.info("Starting the Connect worker"); connect.startConnect(); log.info("Verifying the internal topics for Connect"); connect.assertions().assertTopicsExist(configTopic(), offsetTopic(), statusTopic()); assertInternalTopicSettings(); connect.stop(); }

Target:
public void testCreateInternalTopicsWithDefaultSettings() throws InterruptedException { int numWorkers = 1; int numBrokers = 3; connect = new EmbeddedConnectCluster.Builder().name("connect-cluster-1") .workerProps(workerProps) .numWorkers(numWorkers) .numBrokers(numBrokers) .brokerProps(brokerProps) .build(); connect.start(); connect.assertions().assertExactlyNumBrokersAreUp(numBrokers, "Brokers did not start in time."); connect.assertions().assertExactlyNumWorkersAreUp(numWorkers, "Worker did not start in time."); log.info("Completed startup of Kafka brokers and Connect workers", numBrokers, numWorkers); log.info("Verifying the internal topics for Connect"); connect.assertions().assertTopicsExist(configTopic(), offsetTopic(), statusTopic()); assertInternalTopicSettings(); log.info("Stopping the Connect worker"); connect.removeWorker(); log.info("Starting the Connect worker"); connect.startConnect(); log.info("Verifying the internal topics for Connect"); connect.assertions().assertTopicsExist(configTopic(), offsetTopic(), statusTopic()); assertInternalTopicSettings(); connect.stop(); }
Source:
protected boolean validate() { if (!super.validate()) { return false; } if (isClusterSwitchTypeOVS() && !isVnicAttachedToExternalNetwork()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_ONLY_EXTERNAL_NETWORK_IS_SUPPORTED_IN_OVS_SWITCH_TYPE); return false; } return true; }

Target:
protected boolean validate() { return super.validate() && validate(isNetworkSupportedInClusterWithOvsSwitch()); }
Source:
protected int getMaxResults() throws MalformedNumberException{ if (getUriInfo()!=null && QueryHelper.hasMatrixParam(getUriInfo(), MAX)) { HashMap<String,String> matrixConstraints = QueryHelper.getMatrixConstraints(getUriInfo(), MAX); String maxString = matrixConstraints.get(MAX); try { Integer max = Integer.valueOf(maxString); if (max.compareTo(-1) == -1){ return failMaxResults(maxString); } return max; } catch (NumberFormatException e) { return failMaxResults(maxString); } } else { return NO_LIMIT; } }

Target:
protected int getMaxResults() throws MalformedNumberException{ if (getUriInfo()!=null && QueryHelper.hasMatrixParam(getUriInfo(), MAX)) { HashMap<String,String> matrixConstraints = QueryHelper.getMatrixConstraints(getUriInfo(), MAX); String maxString = matrixConstraints.get(MAX); try { Integer max = Integer.valueOf(maxString); if (max < -1){ return failMaxResults(maxString); } return max; } catch (NumberFormatException e) { return failMaxResults(maxString); } } else { return NO_LIMIT; } }
Source:
public Apply(final Func func, final Expr ... args) throws HaskellException { super(((FuncT) func.getType()).getAppliedType(Apply.getArgTypes(args))); this.func = func; this.args = args.clone(); }

Target:
public Apply(final Func func, final Expr ... args) throws HaskellException { super(((FuncT) func.getType()).getAppliedType(Apply.getArgTypes(args))); this.func = func; this.args = args; }
Source:
public Object encode(Object value, MappedField optionalExtraInfo) { if(value == null) return null; CauseAction action = (CauseAction) value; List core = new BasicDBList(); for(Object obj : action.getCauses()) { core.add(getMapper().toDBObject(obj)); } return BasicDBObjectBuilder.start("causes",core).add("className",CauseAction.class.getName()).get(); }

Target:
public Object encode(Object value, MappedField optionalExtraInfo) { if (value == null) return null; CauseAction action = (CauseAction) value; List causes = new BasicDBList(); for (Object obj : action.getCauses()) { causes.add(getMapper().toDBObject(obj)); } return BasicDBObjectBuilder.start("causes", causes).add("className", CauseAction.class.getName()).get(); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dragTypeName == null) ? 0 : dragTypeName.hashCode()); result = prime * result + ((parts == null) ? 0 : parts.hashCode()); result = prime * result + ((properties == null) ? 0 : properties.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = ~~result; result = prime * result + ((dragTypeName == null) ? 0 : dragTypeName.hashCode()); result = ~~result; result = prime * result + ((parts == null) ? 0 : parts.hashCode()); result = ~~result; result = prime * result + ((properties == null) ? 0 : properties.hashCode()); result = ~~result; return result; }
Source:
public CloudFilesApi getCloudFilesApi(final CloudFilesAccountConfig config) { Iterable<com.google.inject.Module> modules = ImmutableSet.<com.google.inject .Module> of(new SLF4JLoggingModule()); ContextBuilder cb = ContextBuilder.newBuilder(config.getProvider()) .credentials(config.getUserName(), config.getApiKey()).modules(modules); CloudFilesApi cfa = cb.buildApi(CloudFilesApi.class); log.info("Cloud Files Api built."); return cfa; }

Target:
public CloudFilesApi getCloudFilesApi(final CloudFilesAccountConfig config) { log.info("Building Cloud Files Api..."); Iterable<com.google.inject.Module> modules = null; if (config.getUseServiceNet()) { log.info("Configuring Cloud Files Api to use the internal service network..."); modules = ImmutableSet.<com.google.inject.Module>of(new SLF4JLoggingModule(), new InternalUrlModule()); } else { log.info("Configuring Cloud Files Api to use the public network..."); modules = ImmutableSet.<com.google.inject.Module>of(new SLF4JLoggingModule()); } ProviderRegistry.registerProvider(CloudFilesUSProviderMetadata.builder().build()); ProviderRegistry.registerProvider(CloudFilesUKProviderMetadata.builder().build()); ContextBuilder cb = ContextBuilder.newBuilder(config.getProvider()) .credentials(config.getUserName(), config.getApiKey()).modules(modules); CloudFilesApi cfa = cb.buildApi(CloudFilesApi.class); log.info("Cloud Files Api built."); return cfa; }
Source:
protected boolean checkIfLunDiskCanBeAdded(DiskValidator diskValidator) { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (StorageServerConnections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } if (getVm() != null && !(isVmNotLocked() && isVmNotInPreviewSnapshot())) { return false; } if (!validate(diskValidator.isVirtIoScsiValid(getVm()))) { return false; } if (!validate(diskValidator.isDiskInterfaceSupported(getVm()))) { return false; } if (getVds() != null && !validate(diskValidator.isLunDiskVisible(lun, getVds()))) { return false; } LunDisk lunDisk = ((LunDisk) getParameters().getDiskInfo()); ValidationResult validationResult = diskValidator.isUsingScsiReservationValid(lunDisk); if (!validate(validationResult)) { return failCanDoAction(validationResult.getMessage()); } return true; }

Target:
protected boolean checkIfLunDiskCanBeAdded(DiskValidator diskValidator) { LunDisk lunDisk = ((LunDisk) getParameters().getDiskInfo()); LUNs lun = lunDisk.getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (StorageServerConnections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } if (getVm() != null && !(isVmNotLocked() && isVmNotInPreviewSnapshot())) { return false; } if (!validate(diskValidator.isVirtIoScsiValid(getVm()))) { return false; } if (!validate(diskValidator.isDiskInterfaceSupported(getVm()))) { return false; } if (getVds() != null && !validate(diskValidator.isLunDiskVisible(lun, getVds()))) { return false; } ValidationResult validationResult = diskValidator.isUsingScsiReservationValid(lunDisk); if (!validate(validationResult)) { return failCanDoAction(validationResult.getMessage()); } return true; }
Source:
public void test_getDetachedPlugins() { List<DetachedPlugin> list = DetachedPluginsManager.getDetachedPlugins(new VersionNumber("1.296")); Assert.assertTrue(list.size() >= 14); Assert.assertNotNull(findPlugin("maven-plugin", list)); Assert.assertNotNull(findPlugin("subversion", list)); list = DetachedPluginsManager.getDetachedPlugins(new VersionNumber("1.310")); Assert.assertNull(findPlugin("maven-plugin", list)); Assert.assertNotNull(findPlugin("subversion", list)); list = DetachedPluginsManager.getDetachedPlugins(new VersionNumber("1.311")); Assert.assertNull(findPlugin("maven-plugin", list)); Assert.assertNull(findPlugin("subversion", list)); }

Target:
public void test_getDetachedPlugins() { List<DetachedPlugin> list = DetachedPluginsUtil.getDetachedPlugins(new VersionNumber("1.296")); Assert.assertTrue(list.size() >= 14); Assert.assertNotNull(findPlugin("maven-plugin", list)); Assert.assertNotNull(findPlugin("subversion", list)); list = DetachedPluginsUtil.getDetachedPlugins(new VersionNumber("1.310")); Assert.assertNull(findPlugin("maven-plugin", list)); Assert.assertNotNull(findPlugin("subversion", list)); list = DetachedPluginsUtil.getDetachedPlugins(new VersionNumber("1.311")); Assert.assertNull(findPlugin("maven-plugin", list)); Assert.assertNull(findPlugin("subversion", list)); }
Source:
public Object execute(Object iThis, OIdentifiable iCurrentRecord, Object iCurrentResult, Object[] iParams, OCommandContext iContext) { Method method = pickMethod(iParams); try { return method.invoke(null, iParams); } catch (ReflectiveOperationException e) { throw new OQueryParsingException("Error on executing method " + method + " with parameters " + Arrays.toString(iParams)); } }

Target:
public Object execute(Object iThis, OIdentifiable iCurrentRecord, Object iCurrentResult, Object[] iParams, OCommandContext iContext) { final Supplier<String> paramsPrettyPrint = () -> Arrays.stream(iParams).map(p -> p + " [ " + p.getClass().getName() + " ]").collect(Collectors.joining(", ", "(", ")")); Method method = pickMethod(iParams); if (method == null) { throw new OQueryParsingException("Unable to find a function for " + name + paramsPrettyPrint.get()); } try { return method.invoke(null, iParams); } catch (ReflectiveOperationException | IllegalArgumentException e) { e.printStackTrace(); throw new OQueryParsingException("Error executing function " + name + paramsPrettyPrint.get()); } }
Source:
public void loggedInPageTest() { personalInfoPage.navigateTo(); loginToAccount(); assertTestUserLocale(null); personalInfoPage.selectLocale(CUSTOM_LOCALE); personalInfoPage.clickSave(false); WaitUtils.pause(1000); assertTestUserLocale(CUSTOM_LOCALE); assertCustomLocalePersonalInfo(); personalInfoPage.header().clickLogoutBtn(); welcomeScreen.assertCurrent(); assertCustomLocaleWelcomeScreen(); }

Target:
public void loggedInPageTest() { personalInfoPage.navigateTo(); loginToAccount(); assertTestUserLocale(null); personalInfoPage.selectLocale(CUSTOM_LOCALE); personalInfoPage.clickSave(false); WaitUtils.waitForPageToLoad(); assertTestUserLocale(CUSTOM_LOCALE); assertCustomLocalePersonalInfo(); personalInfoPage.header().clickLogoutBtn(); welcomeScreen.assertCurrent(); assertCustomLocaleWelcomeScreen(); }
Source:
private void writeResponse(OutputStream out, MockResponse response) throws IOException { out.write((response.getStatus() + "\r\n").getBytes(StandardCharsets.US_ASCII)); List<String> headers = response.getHeaders(); for (int i = 0, size = headers.size(); i < size; i++) { String header = headers.get(i); out.write((header + "\r\n").getBytes(StandardCharsets.US_ASCII)); } out.write(("\r\n").getBytes(StandardCharsets.US_ASCII)); out.flush(); long bodyDelayTimeMs = response.getBodyDelayTimeMs(); if (bodyDelayTimeMs > 0) { try { Thread.sleep(bodyDelayTimeMs); } catch (InterruptedException e) { throw new AssertionError(); } } InputStream in = response.getBodyStream(); if (in == null) return; throttledTransfer(response, in, out, Long.MAX_VALUE); }

Target:
private void writeResponse(OutputStream out, MockResponse response) throws IOException { out.write((response.getStatus() + "\r\n").getBytes(StandardCharsets.US_ASCII)); List<String> headers = response.getHeaders(); for (int i = 0, size = headers.size(); i < size; i++) { String header = headers.get(i); out.write((header + "\r\n").getBytes(StandardCharsets.US_ASCII)); } out.write(("\r\n").getBytes(StandardCharsets.US_ASCII)); out.flush(); InputStream in = response.getBodyStream(); if (in == null) return; long bodyDelayTimeMs = response.getBodyDelayTimeMs(); if (bodyDelayTimeMs > 0) { try { Thread.sleep(bodyDelayTimeMs); } catch (InterruptedException e) { throw new AssertionError(); } } throttledTransfer(response, in, out, Long.MAX_VALUE); }
Source:
public void testAssociationLnListTypeDtoMappingWithEmptyLists() { final List<AssociationLnListElementDto> associationLnListElementDto = new ArrayList<>(); final AssociationLnListTypeDto associationLnListTypeDto = new AssociationLnListTypeDto( associationLnListElementDto); final AssociationLnListType associationLnListType = this.mapperFactory.getMapperFacade() .map(associationLnListTypeDto, AssociationLnListType.class); this.checkAssociationLnListElementMapping(associationLnListType.getAssociationLnListElement(), associationLnListTypeDto.getAssociationLnListElement()); assertNotNull(associationLnListType); }

Target:
public void testAssociationLnListTypeDtoMappingWithEmptyLists() { final AssociationLnListTypeDto associationLnListTypeDto = new AssociationLnListTypeDtoBuilder().withEmptyLists() .build(); final AssociationLnListType associationLnListType = this.configurationMapper.map(associationLnListTypeDto, AssociationLnListType.class); assertNotNull(associationLnListType); this.checkAssociationLnListElementMapping(associationLnListType.getAssociationLnListElement(), associationLnListTypeDto.getAssociationLnListElement()); }
Source:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.acquireControllerLock(); context.readResource(PathAddress.EMPTY_ADDRESS, false); final ModelNode model = Resource.Tools.readModel(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true)); final String group = getServerGroupName(operation); final boolean blocking = operation.get(BLOCKING).asBoolean(false); final int timeout = operation.get(TIMEOUT).asInt(0); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.getServiceRegistry(true); Map<String, ProcessInfo> processes = serverInventory.determineRunningProcesses(true); final Set<String> serversInGroup = getServersForGroup(model, group); final Set<String> waitForServers = new HashSet<String>(); for (String serverName : processes.keySet()) { final String serverModelName = serverInventory.getProcessServerName(serverName); if (group == null || serversInGroup.contains(serverModelName)) { serverInventory.restartServer(serverModelName, timeout > 0 ? timeout * 1000 : timeout, model); waitForServers.add(serverModelName); } } if (blocking) { serverInventory.awaitServersState(waitForServers, true); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, Stage.RUNTIME); context.stepCompleted(); }

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.acquireControllerLock(); context.readResource(PathAddress.EMPTY_ADDRESS, false); final ModelNode model = Resource.Tools.readModel(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true)); final String group = getServerGroupName(operation); final boolean blocking = BLOCKING.resolveModelAttribute(context, operation).asBoolean(); final int timeout = TIMEOUT.resolveModelAttribute(context, operation).asInt(); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.getServiceRegistry(true); Map<String, ProcessInfo> processes = serverInventory.determineRunningProcesses(true); final Set<String> serversInGroup = getServersForGroup(model, group); final Set<String> waitForServers = new HashSet<String>(); for (String serverName : processes.keySet()) { final String serverModelName = serverInventory.getProcessServerName(serverName); if (group == null || serversInGroup.contains(serverModelName)) { serverInventory.restartServer(serverModelName, timeout > 0 ? timeout * 1000 : timeout, model); waitForServers.add(serverModelName); } } if (blocking) { serverInventory.awaitServersState(waitForServers, true); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, Stage.RUNTIME); context.stepCompleted(); }
Source:
public PortalAccessPermission(String portals) { super("portal access"); portals = portals.trim(); if (portals.equals("*")) { allPortals = true; } else if (portals.isEmpty()) { portalsAccess = new HashSet<>(); } else { portalsAccess = Sets.newHashSet(portals.split("[\\s,]+")); } }

Target:
public PortalAccessPermission(String portals) { super("portal access"); portals = portals.trim(); if (portals == null || portals.isEmpty()) { portalsAccess = new HashSet<>(); } else if (portals.equals("*")) { allPortals = true; } else { portalsAccess = Sets.newHashSet(portals.split("[\\s,]+")); } }
Source:
private RevCommit doSquashFixup(boolean isSquash, RevCommit commitToPick, RebaseTodoLine nextStep, File messageFixup, File messageSquash) throws IOException, GitAPIException { if (!messageSquash.exists()) { ObjectId headId = repo.resolve(Constants.HEAD); RevCommit previousCommit = walk.parseCommit(headId); initializeSquashFixupFile(MESSAGE_SQUASH, previousCommit.getFullMessage()); if (!isSquash) initializeSquashFixupFile(MESSAGE_FIXUP, previousCommit.getFullMessage()); } String currSquashMessage = rebaseState .readFile(MESSAGE_SQUASH); int count = parseSquashFixupSequenceCount(currSquashMessage) + 1; String contend = composeSquashMessage(isSquash, commitToPick, currSquashMessage, count); rebaseState.createFile(MESSAGE_SQUASH, contend); if (messageFixup.exists()) { rebaseState.createFile(MESSAGE_FIXUP, contend); } return squashIntoPrevious( !messageFixup.exists(), nextStep); }

Target:
private RevCommit doSquashFixup(boolean isSquash, RevCommit commitToPick, RebaseTodoLine nextStep, File messageFixup, File messageSquash) throws IOException, GitAPIException { if (!messageSquash.exists()) { ObjectId headId = repo.resolve(Constants.HEAD); RevCommit previousCommit = walk.parseCommit(headId); initializeSquashFixupFile(MESSAGE_SQUASH, previousCommit.getFullMessage()); if (!isSquash) initializeSquashFixupFile(MESSAGE_FIXUP, previousCommit.getFullMessage()); } String currSquashMessage = rebaseState .readFile(MESSAGE_SQUASH); int count = parseSquashFixupSequenceCount(currSquashMessage) + 1; String content = composeSquashMessage(isSquash, commitToPick, currSquashMessage, count); rebaseState.createFile(MESSAGE_SQUASH, content); if (messageFixup.exists()) { rebaseState.createFile(MESSAGE_FIXUP, content); } return squashIntoPrevious( !messageFixup.exists(), nextStep); }
Source:
private boolean eraseSimulator() { assert instrumentsVersion.getMajor() >= 6; List<String> simctlArgs; simctlArgs = Arrays.asList("xcrun", "simctl", "erase", deviceUUID); Command simctlCmd = new Command(simctlArgs, false); int exitCode = simctlCmd.executeAndWait(true); if (exitCode == 146) { return false; } else if (exitCode != 0) { throw new WebDriverException("Failed to erase contents and settings of this device: " + deviceUUID + ". Exit code =" + exitCode + " , command was: " + simctlCmd.commandString()); } String deviceLogDir = System.getProperty("user.home") + "/Library/Logs/CoreSimulator/" + deviceUUID; File deviceLog = new File(deviceLogDir, "system.log"); if (deviceLog.exists()) { deviceLog.delete(); } return true; }

Target:
private boolean eraseSimulator() { assert instrumentsVersion.getMajor() >= 6; List<String> simctlArgs = Arrays.asList("xcrun", "simctl", "erase", deviceUUID); Command simctlCmd = new Command(simctlArgs, false); int exitCode = simctlCmd.executeAndWait(true); if (exitCode == 146) { return false; } else if (exitCode != 0) { throw new WebDriverException("Failed to erase contents and settings of this device: " + deviceUUID + ". Exit code =" + exitCode + " , command was: " + simctlCmd.commandString()); } String deviceLogDir = System.getProperty("user.home") + "/Library/Logs/CoreSimulator/" + deviceUUID; File deviceLog = new File(deviceLogDir, "system.log"); if (deviceLog.exists()) { deviceLog.delete(); } return true; }
Source:
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if(value instanceof String){ CanvasSE cse = new CanvasSE(symbolizer.getSymbolizer()); Map<String,Object> map = new HashMap<String,Object>(); map.put(symbolizer.getLookupFieldName(), value); cse.setSampleDatasource(map); return cse; } else { return lookAndFeelRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); } }

Target:
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel lab = (JLabel)lookAndFeelRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if(value instanceof String){ lab.setText(""); CanvasSE cse = new CanvasSE(symbolizer.getSymbolizer()); Map<String,Object> map = new HashMap<String,Object>(); map.put(symbolizer.getLookupFieldName(), value); cse.setSampleDatasource(map); ImageIcon ii = new ImageIcon(cse.getImage()); lab.setIcon(ii); lab.setOpaque(true); } return lab; }
Source:
public Map<String, String> getDivisions(List<LanguageRange> priorityList, boolean all, boolean subdivisionsByDate) { Collection<UniversalDivision> universalDivisions = new LinkedList<>(); for (Division division : declaration.getDivisions()) { UniversalDivision universalDivision = new UniversalDivision(this, division); if (all || universalDivision.getProcessTitle().isPresent()) { universalDivisions.add(universalDivision); } if (subdivisionsByDate) { for (UniversalDivision subdivision : universalDivision.getUniversalDivisions()) { if (all || subdivision.getProcessTitle().isPresent()) { universalDivisions.add(subdivision); } } } } return all || !universalDivisions.isEmpty() ? Labeled.listByTranslatedLabel(this, universalDivisions, UniversalDivision::getId, UniversalDivision::getLabels, priorityList) : getDivisions(priorityList, true, subdivisionsByDate); }

Target:
public Map<String, String> getDivisions(List<LanguageRange> priorityList, boolean all, boolean subdivisionsByDate) { Collection<UniversalDivision> universalDivisions = new LinkedList<>(); for (Division division : declaration.getDivisions()) { UniversalDivision universalDivision = new UniversalDivision(this, division); if (all || universalDivision.getProcessTitle().isPresent()) { universalDivisions.add(universalDivision); } if (subdivisionsByDate) { for (UniversalDivision subdivision : universalDivision.getUniversalDivisions()) { if (all || subdivision.getProcessTitle().isPresent()) { universalDivisions.add(subdivision); } } } } Map<String, String> map = all || !universalDivisions.isEmpty() ? Labeled.listByTranslatedLabel(this, universalDivisions, UniversalDivision::getId, UniversalDivision::getLabels, priorityList) : getDivisions(priorityList, true, subdivisionsByDate); return map; }
Source:
public void prettyPrint(Node node, SourcePrinter printer) { LineEnding lineEnding = node.getLineEndingStyleOrDefault(LineEnding.SYSTEM); printer.print("\"\"\"" + lineEnding.toString()); printer.print(property.getValueAsStringAttribute(node)); printer.print("\"\"\""); }

Target:
public void prettyPrint(Node node, SourcePrinter printer) { printer.print("\"\"\"\n"); printer.print(property.getValueAsStringAttribute(node)); printer.print("\"\"\""); }
Source:
private int populateElementPositions(int elementPositionCount) { elementPositions = ensureCapacity(elementPositions, elementPositionCount); int index = 0; for (int i = 0; i < outputPositionCount; i++) { int length = elementLengths[i]; if (maxElementLength != -1 && length > maxElementLength) { length = maxElementLength; elementLengths[i] = length; } for (int j = 0; j < length; j++) { elementPositions[index] = elementOffsets[i] + j; index++; } } return index; }

Target:
private int populateElementPositions(int elementPositionCount) { elementPositions = ensureCapacity(elementPositions, elementPositionCount); int index = 0; for (int i = 0; i < outputPositionCount; i++) { int length = elementLengths[i]; if (maxElementLength != ELEMENT_LENGTH_UNBOUNDED && length > maxElementLength) { length = maxElementLength; elementLengths[i] = length; } for (int j = 0; j < length; j++) { elementPositions[index] = elementOffsets[i] + j; index++; } } return index; }
Source:
public void archiveHeadAllFilesTarTimestamps() throws Exception { try (Git git = new Git(db)) { createTestContent(git); String fmt = "tar"; File archive = new File(getTemporaryDirectory(), "archive." + format); archive(git, archive, fmt); ObjectId hash1 = ObjectId.fromRaw(IO.readFully(archive)); try (InputStream fi = Files.newInputStream(archive.toPath()); InputStream bi = new BufferedInputStream(fi); ArchiveInputStream o = new TarArchiveInputStream(bi)) { assertEntries(o); } Thread.sleep(2000); archive(git, archive, fmt); assertEquals(UNEXPECTED_DIFFERENT_HASH, hash1, ObjectId.fromRaw(IO.readFully(archive))); } }

Target:
public void archiveHeadAllFilesTarTimestamps() throws Exception { try (Git git = new Git(db)) { createTestContent(git); String fmt = "tar"; File archive = new File(getTemporaryDirectory(), "archive." + format); archive(git, archive, fmt); ObjectId hash1 = ObjectId.fromRaw(IO.readFully(archive)); try (InputStream fi = Files.newInputStream(archive.toPath()); InputStream bi = new BufferedInputStream(fi); ArchiveInputStream o = new TarArchiveInputStream(bi)) { assertEntries(o); } Thread.sleep(WAIT); archive(git, archive, fmt); assertEquals(UNEXPECTED_DIFFERENT_HASH, hash1, ObjectId.fromRaw(IO.readFully(archive))); } }
Source:
private void handleHttpError(WebContext ctx, String objectId, @Nullable String fileExtension, @Nullable String filename, int status) { PhysicalStorageSpace replicationSpace = replicationManager.getReplicationSpace(name).orElse(null); if (replicationSpace == null) { ctx.respondWith().error(HttpResponseStatus.valueOf(status)); return; } ValueHolder<Integer> effectiveStatus = new ValueHolder<>(HttpResponseStatus.OK.code()); try { if (Strings.isFilled(filename)) { replicationSpace.engine.deliverAsDownload(ctx, name, objectId, filename, nextStatus -> { effectiveStatus.accept(nextStatus); ctx.respondWith().error(HttpResponseStatus.valueOf(nextStatus)); }); } else { replicationSpace.engine.deliver(ctx, name, objectId, fileExtension, nextStatus -> { effectiveStatus.accept(nextStatus); ctx.respondWith().error(HttpResponseStatus.valueOf(nextStatus)); }); } } catch (IOException e) { try { ctx.respondWith().error(HttpResponseStatus.INTERNAL_SERVER_ERROR); } catch (Exception ex) { Exceptions.ignore(ex); } effectiveStatus.accept(HttpResponseStatus.INTERNAL_SERVER_ERROR.code()); throw Exceptions.handle() .error(e) .to(StorageUtils.LOG) .withSystemErrorMessage( "Storage Layer 1: An error occurred when delivering %s (%s) via replication %s for %s: %s (%s)", objectId, name, replicationSpace.name, ctx.getRequestedURI()) .handle(); } }

Target:
private void handleHttpError(WebContext ctx, String objectId, @Nullable String fileExtension, @Nullable String filename, int status) { PhysicalStorageSpace replicationSpace = replicationManager.getReplicationSpace(name).orElse(null); if (replicationSpace == null) { ctx.respondWith().error(HttpResponseStatus.valueOf(status)); return; } try { if (Strings.isFilled(filename)) { replicationSpace.engine.deliverAsDownload(ctx, name, objectId, filename, nextStatus -> { ctx.respondWith().error(HttpResponseStatus.valueOf(nextStatus)); }); } else { replicationSpace.engine.deliver(ctx, name, objectId, fileExtension, nextStatus -> { ctx.respondWith().error(HttpResponseStatus.valueOf(nextStatus)); }); } } catch (IOException e) { try { ctx.respondWith().error(HttpResponseStatus.INTERNAL_SERVER_ERROR); } catch (Exception ex) { Exceptions.ignore(ex); } throw Exceptions.handle() .error(e) .to(StorageUtils.LOG) .withSystemErrorMessage( "Layer 1: An error occurred when delivering %s (%s) via replication %s for %s: %s (%s)", objectId, name, replicationSpace.name, ctx.getRequestedURI()) .handle(); } }
Source:
public Note call() throws GitAPIException { checkCallable(); try (RevWalk walk = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter()) { NoteMap map = NoteMap.newEmptyMap(); RevCommit notesCommit = null; Ref ref = repo.findRef(notesRef); if (ref != null) { notesCommit = walk.parseCommit(ref.getObjectId()); map = NoteMap.read(walk.getObjectReader(), notesCommit); } map.set(id, null, inserter); commitNoteMap(walk, map, notesCommit, inserter, "Notes removed by 'git notes remove'"); return map.getNote(id); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }

Target:
public Note call() throws GitAPIException { checkCallable(); try (RevWalk walk = new RevWalk(repo); ObjectInserter inserter = repo.newObjectInserter()) { NoteMap map = NoteMap.newEmptyMap(); RevCommit notesCommit = null; Ref ref = repo.exactRef(notesRef); if (ref != null) { notesCommit = walk.parseCommit(ref.getObjectId()); map = NoteMap.read(walk.getObjectReader(), notesCommit); } map.set(id, null, inserter); commitNoteMap(walk, map, notesCommit, inserter, "Notes removed by 'git notes remove'"); return map.getNote(id); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }
Source:
protected void processResponse(Map<String, Object> response) { Map<String, Object> result = getMap(response, "result"); if (result.containsKey("volume")) { Object o = result.get("volume"); if (o instanceof Double) { volume = ((Double)o).intValue(); } else { if (o instanceof Integer) { volume = (Integer)o; } } } if (result.containsKey("name")) name = (String)result.get("name"); }

Target:
protected void processResponse(Map<String, Object> response) { Map<String, Object> result = getMap(response, "result"); if (result.containsKey("volume")) { Object o = result.get("volume"); if (o instanceof Double) { volume = ((Double)o).intValue(); } else { if (o instanceof Integer) { volume = (Integer)o; } } } if (result.containsKey("name")) { name = (String)result.get("name"); } }