auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void validateAndClose() { try { verifyEquivalencyWithStatic(staticClusterMap.hardwareLayout, staticClusterMap.partitionLayout); } finally { for (HelixAdmin admin : adminForDc.values()) { admin.close(); } } }

Target:
private void validateAndClose() { try { verifyEquivalencyWithStaticClusterMap(staticClusterMap.hardwareLayout, staticClusterMap.partitionLayout); } finally { for (HelixAdmin admin : adminForDc.values()) { admin.close(); } } }
Source:
public Object[][] parsingBadRepository() { return new Object[][] { {"<LINK_0>che .git", "che .git"}, {"<LINK_0>.git", ".git"}, {"<LINK_0>myB@dR&pository.git", "myB@dR&pository.git"}, {"<LINK_0>.", "."}, {"<LINK_0>івапівап.git", "івапівап.git"}, {"<LINK_0> ", " "}, {"<LINK_0>.", "."}, {"<LINK_0>repositorygit", "repositorygit"}, {"<LINK_0> .git", " .git"} }; }

Target:
public Object[][] parsingBadRepository() { return new Object[][] { {"<LINK_0>che .git", "che .git"}, {"<LINK_0>.git", ".git"}, {"<LINK_0>myB@dR&pository.git", "myB@dR&pository.git"}, {"<LINK_0>.", "."}, {"<LINK_0>івапівап.git", "івапівап.git"}, {"<LINK_0> ", " "}, {"<LINK_0>.", "."}, {"<LINK_0> .git", " .git"} }; }
Source:
public boolean isToBeImported() { if ( isToBeImported == null ) { String trimmedName = trimSimpleClassName( name ); if ( notToBeImportedTypes.containsKey( trimmedName ) ) { return false; } String trimmedQualifiedName = trimSimpleClassName( qualifiedName ); String importedType = toBeImportedTypes.get( trimmedName ); isToBeImported = false; if ( importedType != null ) { if ( importedType.equals( trimmedQualifiedName ) ) { isToBeImported = true; } } else { toBeImportedTypes.put( trimmedName, trimmedQualifiedName ); isToBeImported = true; } } return isToBeImported; }

Target:
public boolean isToBeImported() { if ( isToBeImported == null ) { String trimmedName = trimSimpleClassName( name ); if ( notToBeImportedTypes.containsKey( trimmedName ) ) { isToBeImported = false; return isToBeImported; } String trimmedQualifiedName = trimSimpleClassName( qualifiedName ); String importedType = toBeImportedTypes.get( trimmedName ); isToBeImported = false; if ( importedType != null ) { if ( importedType.equals( trimmedQualifiedName ) ) { isToBeImported = true; } } else { toBeImportedTypes.put( trimmedName, trimmedQualifiedName ); isToBeImported = true; } } return isToBeImported; }
Source:
protected int getMaxResults() { HashMap<String,String> matrixConstraints = QueryHelper.getMatrixConstraints(getUriInfo(), MAX); String maxString = matrixConstraints.get(MAX); int max = Integer.valueOf(maxString); return max; }

Target:
protected int getMaxResults() { if (getUriInfo()!=null && QueryHelper.hasMatrixParam(getUriInfo(), MAX)) { HashMap<String,String> matrixConstraints = QueryHelper.getMatrixConstraints(getUriInfo(), MAX); String maxString = matrixConstraints.get(MAX); try { return Integer.valueOf(maxString); } catch (NumberFormatException e) { LOG.error("Max number of results is not a valid number: '" + maxString + "'. Resorting to default behavior - no limit on number of query results."); return Integer.MAX_VALUE; } } else { return Integer.MAX_VALUE; } }
Source:
public static String formatShortMessage(long userId, Event event, Position position) { String templatePath = Context.getConfig().getString("message.short.templatesPath", "short"); return formatMessage(null, userId, event, position, templatePath); }

Target:
public static String formatShortMessage(long userId, Event event, Position position) { return formatMessage(null, userId, event, position, "short"); }
Source:
public static int readIntBE(byte[] buffer, int offset) { int value = 0; for (int i = 0; i < 4; ++i) { value <<= 8; value |= 0xFF & buffer[offset++]; } return value; }

Target:
public static int readIntBE(byte[] buffer, int offset) { int value = 0; for (int i = 0; i < 4; ++i) { value <<= 8; value |= 0xFF & buffer[offset + i]; } return value; }
Source:
public static void openClassLoader() throws IOException { ClassLoader myClassLoader = RetentionPolicyTest.class.getClassLoader(); assert myClassLoader != null; File jarFile = new File(temporaryFolder.getRoot(), "annotations-test.jar"); try (InputStream in = myClassLoader.getResourceAsStream("annotations-test.jar"); OutputStream out = new FileOutputStream(jarFile)) { Streams.copy(in, out); } classLoader = new PathClassLoader(jarFile.getAbsolutePath(), myClassLoader); }

Target:
public static void openClassLoader() throws IOException { ClassLoader myClassLoader = RetentionPolicyTest.class.getClassLoader(); assertNotNull(myClassLoader); File jarFile = new File(temporaryFolder.getRoot(), "annotations-test.jar"); try (InputStream in = myClassLoader.getResourceAsStream("annotations-test.jar"); OutputStream out = new FileOutputStream(jarFile)) { Streams.copy(in, out); } classLoader = new PathClassLoader(jarFile.getAbsolutePath(), myClassLoader); }
Source:
public LinkPreviewFunnel(WikipediaApp app, PageTitle title) { super(app, SCHEMA_NAME, REV_ID); previewSessionToken = UUID.randomUUID().toString(); appInstallID = app.getAppInstallID(); this.title = title; version = ((app.getAppInstallIDInt() % linkPreviewToggleWeight) > 2) ? 0 : (app.getAppInstallIDInt() % linkPreviewToggleWeight); }

Target:
public LinkPreviewFunnel(WikipediaApp app, PageTitle title) { super(app, SCHEMA_NAME, REV_ID); previewSessionToken = UUID.randomUUID().toString(); appInstallID = app.getAppInstallID(); this.title = title; version = LinkPreviewVersion.getVersion(app); }
Source:
public Device findActiveDevice(final String deviceIdentification) throws FunctionalException { Device device; try { device = this.deviceDomainService.searchActiveDevice(deviceIdentification); } catch (final UnregisteredDeviceException e) { throw new FunctionalException(FunctionalExceptionType.UNREGISTERED_DEVICE, COMPONENT_TYPE, e); } catch (final InactiveDeviceException e) { throw new FunctionalException(FunctionalExceptionType.INACTIVE_DEVICE, ComponentType.DOMAIN_CORE, e); } catch (final UnknownEntityException e) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICE, COMPONENT_TYPE, e); } return device; }

Target:
public Device findActiveDevice(final String deviceIdentification) throws FunctionalException { Device device; try { device = this.deviceDomainService.searchActiveDevice(deviceIdentification); } catch (final UnregisteredDeviceException e) { throw new FunctionalException(FunctionalExceptionType.UNREGISTERED_DEVICE, COMPONENT_TYPE, e); } catch (final InactiveDeviceException e) { throw new FunctionalException(FunctionalExceptionType.INACTIVE_DEVICE, COMPONENT_TYPE, e); } catch (final UnknownEntityException e) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICE, COMPONENT_TYPE, e); } return device; }
Source:
private void initNetworkList(Guid dataCenterId) { startProgress(); IdQueryParameters queryParams = new IdQueryParameters(dataCenterId); Frontend.getInstance().runQuery(QueryType.GetAllNetworks, queryParams, new AsyncQuery<QueryReturnValue>(returnValue -> { if (getNetwork().getItems() == null || getNetwork().getSelectedItem() == null) { Collection<Network> networks = returnValue.getReturnValue(); getNetwork().setItems(networks); updateNetworks(networks); stopProgress(); } })); }

Target:
private void initNetworkList(Guid dataCenterId) { if (getNetwork().getItems() == null || getNetwork().getSelectedItem() == null) { startProgress(); IdQueryParameters queryParams = new IdQueryParameters(dataCenterId); Frontend.getInstance().runQuery(QueryType.GetAllNetworks, queryParams, new AsyncQuery<QueryReturnValue>(returnValue -> { Collection<Network> networks = returnValue.getReturnValue(); getNetwork().setItems(networks); updateNetworks(networks); stopProgress(); })); } }
Source:
public String toString() { return MoreObjects.toStringHelper("") .add("HostName", mHostName) .add("SocketAddress", mSocketAddress) .toString(); }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("HostName", mHostName) .add("SocketAddress", mSocketAddress) .toString(); }
Source:
public boolean handleEvent(ValidationEvent event) { if (event == null) { throw new IllegalArgumentException(); } String severity = null; boolean retVal = false; switch (event.getSeverity()) { case ValidationEvent.WARNING: severity = format(WARNING); retVal = true; break; case ValidationEvent.ERROR: severity = format(ERROR); retVal = false; break; case ValidationEvent.FATAL_ERROR: severity = format(FATAL_ERROR); retVal = false; break; default: assert false : format(UNRECOGNIZED_SEVERITY, event.getSeverity()); } String message = format(SEVERITY_MESSAGE, severity, event.getMessage(), getLoc(event)); LOGGER.debug(message); return retVal; }

Target:
public boolean handleEvent(ValidationEvent event) { if (event == null) { LOGGER.debug("XmlValidationEventHandler handleEvent was called with a null ValidationEvent."); throw new IllegalArgumentException(); } String severity = null; boolean retVal = false; switch (event.getSeverity()) { case ValidationEvent.WARNING: severity = format(WARNING); retVal = true; break; case ValidationEvent.ERROR: severity = format(ERROR); retVal = false; break; case ValidationEvent.FATAL_ERROR: severity = format(FATAL_ERROR); retVal = false; break; default: assert false : format(UNRECOGNIZED_SEVERITY, event.getSeverity()); } String message = format(SEVERITY_MESSAGE, severity, event.getMessage(), getLoc(event)); LOGGER.debug(message); return retVal; }
Source:
public void setMilestoneById(Integer milestone) { this.milestone = (milestone == null) ? Optional.empty() : Optional.of(milestone); this.milestoneLastModifiedAt = Optional.of(LocalDateTime.now()); }

Target:
public void setMilestoneById(Integer milestone) { this.milestone = Optional.of(milestone); this.milestoneLastModifiedAt = Optional.of(LocalDateTime.now()); }
Source:
protected boolean shouldAddVlanToNic(VdsNetworkInterface vlan) { return true; }

Target:
private boolean shouldAddVlanToNic(VdsNetworkInterface vlan) { return vlan.getId()==null; }
Source:
protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { PathAddress nativeAddress = context.getCurrentAddress().getParent().append(PathElement.pathElement(MANAGEMENT_INTERFACE, HTTP_INTERFACE)); ManagementRemotingServices.isManagementResourceRemoveable(context, nativeAddress); super.performRemove(context, operation, model); }

Target:
protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final PathAddress httpAddress = context.getCurrentAddress().getParent().append(PathElement.pathElement(MANAGEMENT_INTERFACE, HTTP_INTERFACE)); context.addStep((OperationContext opContext, ModelNode op) -> { ManagementRemotingServices.isManagementResourceRemoveable(opContext, httpAddress); }, OperationContext.Stage.MODEL, false); super.performRemove(context, operation, model); }
Source:
public void showLoanChargesCreatedSuccessfully(Charges charges) { Toast.makeText(getActivity(), R.string.charge_created, Toast .LENGTH_LONG) .show(); }

Target:
public void showLoanChargesCreatedSuccessfully(Charges charges) { Toast.makeText(getActivity(), R.string.charge_created_success, Toast .LENGTH_LONG) .show(); }
Source:
public void test_transitivity() throws Exception { JavaCheckVerifier.verify("src/test/files/se/TransitivityCPP.java", new ConditionAlwaysTrueOrFalseCheck()); }

Target:
public void test_transitivity() throws Exception { JavaCheckVerifier.verify("src/test/files/se/Transitivity.java", new ConditionAlwaysTrueOrFalseCheck()); }
Source:
public void initialise() { sceneFinalFbo = displayResolutionDependentFBOs.get(FINAL_BUFFER); renderingConfig = config.getRendering(); requiresCondition(() -> (renderingConfig.isVrSupport() && vrProvider.isInitialized())); leftEyeFbo = requiresFBO(new FBOConfig(LEFT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); rightEyeFbo = requiresFBO(new FBOConfig(RIGHT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); if (vrProvider != null) { vrProvider.texType[0].handle = leftEyeFbo.colorBufferTextureId; vrProvider.texType[0].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[0].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[0].write(); vrProvider.texType[1].handle = rightEyeFbo.colorBufferTextureId; vrProvider.texType[1].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[1].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[1].write(); } addDesiredStateChange(new EnableMaterial("engine:prog.defaultTextured")); displayResolutionDependentFBOs.subscribe(this); }

Target:
public void initialise() { renderingConfig = config.getRendering(); requiresCondition(() -> (renderingConfig.isVrSupport() && vrProvider.isInitialized())); requiresFBO(new FBOConfig(LEFT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(RIGHT_EYE_FBO, FULL_SCALE, FBO.Type.DEFAULT).useDepthBuffer(), displayResolutionDependentFBOs); if (vrProvider != null) { vrProvider.texType[0].handle = leftEyeFbo.colorBufferTextureId; vrProvider.texType[0].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[0].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[0].write(); vrProvider.texType[1].handle = rightEyeFbo.colorBufferTextureId; vrProvider.texType[1].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma; vrProvider.texType[1].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL; vrProvider.texType[1].write(); } update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial("engine:prog.defaultTextured")); }
Source:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof SimpleApnsPushNotification)) { return false; } final SimpleApnsPushNotification other = (SimpleApnsPushNotification) obj; if (this.invalidationTime == null) { if (other.invalidationTime != null) { return false; } } else if (!this.invalidationTime.equals(other.invalidationTime)) { return false; } if (this.payload == null) { if (other.payload != null) { return false; } } else if (!this.payload.equals(other.payload)) { return false; } if (this.priority != other.priority) { return false; } if (this.token == null) { if (other.token != null) { return false; } } else if (!this.token.equals(other.token)) { return false; } if (this.topic == null) { if (other.topic != null) { return false; } } else if (!this.topic.equals(other.topic)) { return false; } if (this.collapseId == null) { if (other.collapseId != null) { return false; } } else if (!this.collapseId.equals(other.collapseId)) { return false; } return true; }

Target:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof SimpleApnsPushNotification)) { return false; } final SimpleApnsPushNotification other = (SimpleApnsPushNotification) obj; if (this.invalidationTime == null) { if (other.invalidationTime != null) { return false; } } else if (!this.invalidationTime.equals(other.invalidationTime)) { return false; } if (this.payload == null) { if (other.payload != null) { return false; } } else if (!this.payload.equals(other.payload)) { return false; } if (this.priority != other.priority) { return false; } if (this.token == null) { if (other.token != null) { return false; } } else if (!this.token.equals(other.token)) { return false; } if (this.topic == null) { if (other.topic != null) { return false; } } else if (!this.topic.equals(other.topic)) { return false; } if (Objects.equals(this.collapseId, null)) { if (!Objects.equals(other.collapseId , null)) { return false; } } else if (!this.collapseId.equals(other.collapseId)) { return false; } return true; }
Source:
public ConversionService getObject() { ConversionService service = super.getObject(); if (service instanceof GenericConversionService) { ((GenericConversionService) service).removeConvertible(Object.class, Object.class); if (isMongodbIntegrationPresent) { try { Class<?> stringToBasicQueryConverterCls = Class.forName(MONGO_BASIC_QUERY_CONVERTER_CLASS_NAME); ((GenericConversionService) service).addConverter((GenericConverter) stringToBasicQueryConverterCls.newInstance()); } catch (Exception ignore) { } } } return service; }

Target:
public ConversionService getObject() { ConversionService service = super.getObject(); if (service instanceof GenericConversionService) { ((GenericConversionService) service).removeConvertible(Object.class, Object.class); } return service; }
Source:
private boolean isCountFunction(FunctionCallTree tree) { return FUNCTION_PREDICATE.test(TreeValues.of(tree, context().symbolTable())) && tree.arguments().size() == 1; }

Target:
private boolean isCountFunction(FunctionCallTree tree) { return FUNCTION_PREDICATE.test(TreeValues.of(tree, context().symbolTable())) && !tree.arguments().isEmpty(); }
Source:
public void applyTemplate(String template) { mTemplate = template; }

Target:
public void applyTemplate(String template) { mTemplate = template; final Map<String, Object> properties = getCommonProperties(); properties.put(KEY_TEMPLATE, template); AnalyticsTracker.track(Stat.EDITOR_SESSION_TEMPLATE_APPLY, properties); }
Source:
public void testFailureGeneratingMementoStillPersistsOtherEntities() throws Exception { MyEntity origE = origApp.createAndManageChild(EntitySpec.create(MyEntity.class)); MyEntity origFailingE = origApp.createAndManageChild(EntitySpec.create(MyEntity.class) .impl(MyEntityFailingImpl.class) .configure(MyEntityFailingImpl.FAIL_ON_GENERATE_MEMENTO, true)); newApp = rebind(false); MyEntity newE = (MyEntity) Iterables.find(newApp.getChildren(), EntityPredicates.idEqualTo(origE.getId())); MyEntity newFailingE = (MyEntity) Iterables.find(newApp.getChildren(), EntityPredicates.idEqualTo(origFailingE.getId()), null); assertNotNull(newE); assertNull(newFailingE); }

Target:
public void testFailureGeneratingMementoStillPersistsOtherEntities() throws Exception { MyEntity origE = origApp.createAndManageChild(EntitySpec.create(MyEntity.class)); MyEntity origFailingE = origApp.createAndManageChild(EntitySpec.create(MyEntity.class) .impl(MyEntityFailingImpl.class) .configure(MyEntityFailingImpl.FAIL_ON_GENERATE_MEMENTO, true)); newApp = rebind(false); MyEntity newE = (MyEntity) Iterables.find(newApp.getChildren(), EntityPredicates.idEqualTo(origE.getId())); Optional<Entity> newFailingE = Iterables.tryFind(newApp.getChildren(), EntityPredicates.idEqualTo(origFailingE.getId())); assertNotNull(newE); assertFalse(newFailingE.isPresent(), "newFailedE="+newFailingE); }
Source:
private void onCreateSnapshot() { GlusterVolumeSnapshotModel snapshotModel = (GlusterVolumeSnapshotModel) getWindow(); if (!snapshotModel.validate()) { return; } final GlusterVolumeSnapshotEntity snapshot = new GlusterVolumeSnapshotEntity(); GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getEntity(); snapshot.setClusterId(volumeEntity.getClusterId()); snapshot.setSnapshotName(snapshotModel.getSnapshotName().getEntity()); snapshot.setVolumeId(volumeEntity.getId()); snapshot.setDescription(snapshotModel.getDescription().getEntity()); boolean force = snapshotModel.getForceCreate().getEntity(); CreateGlusterVolumeSnapshotParameters parameter = new CreateGlusterVolumeSnapshotParameters(snapshot, force, true); Frontend.getInstance().runAction(VdcActionType.CreateGlusterVolumeSnapshot, parameter, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { GlusterVolumeSnapshotListModel localModel = (GlusterVolumeSnapshotListModel) result.getState(); localModel.postOnCreateSnapshot(result.getReturnValue(), snapshot); } }, this); }

Target:
private void onCreateSnapshot() { GlusterVolumeSnapshotModel snapshotModel = (GlusterVolumeSnapshotModel) getWindow(); if (!snapshotModel.validate()) { return; } final GlusterVolumeSnapshotEntity snapshot = new GlusterVolumeSnapshotEntity(); GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getEntity(); snapshot.setClusterId(volumeEntity.getClusterId()); snapshot.setSnapshotName(snapshotModel.getSnapshotName().getEntity()); snapshot.setVolumeId(volumeEntity.getId()); snapshot.setDescription(snapshotModel.getDescription().getEntity()); boolean force = snapshotModel.getForceCreate().getEntity(); CreateGlusterVolumeSnapshotParameters parameter = new CreateGlusterVolumeSnapshotParameters(snapshot, force); snapshotModel.startProgress(null); Frontend.getInstance().runAction(VdcActionType.CreateGlusterVolumeSnapshot, parameter, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { GlusterVolumeSnapshotListModel localModel = (GlusterVolumeSnapshotListModel) result.getState(); localModel.stopProgress(); localModel.postOnCreateSnapshot(result.getReturnValue(), snapshot); } }, this); }
Source:
private Pattern getIsoPattern(OVirtNodeInfo info) { String expectedPattern = "^(" + info.prefix.replace(info.delimiter, "|") + ")" + ".*.iso"; if (isoPattern == null || !expectedPattern.equals(isoPattern.toString())) { isoPattern = Pattern.compile(expectedPattern); } return isoPattern; }

Target:
private Pattern getIsoPattern(OVirtNodeInfo info) { log.infoFormat("getIsoPatter - pattern [{0}]", info.pattern); String expectedPattern = info.pattern; if (isoPattern == null || !expectedPattern.equals(isoPattern.toString())) { isoPattern = Pattern.compile(expectedPattern); } return isoPattern; }
Source:
public void onDropItemEvent(DropItemEvent event, EntityRef itemEntity, ItemComponent itemComponent, BlockItemComponent blockItemComponent) { String blockFamilyURI = blockItemComponent.blockFamily.getURI().toString(); if (blockFamilyURI.equals(LASUtils.BLACK_FLAG_URI) || blockFamilyURI.equals(LASUtils.RED_FLAG_URI)) { delayManager.addDelayedAction(itemEntity, LASUtils.DROPPED_FLAG, LASUtils.FLAG_TELEPORT_DELAY); } }

Target:
public void onDropItemEvent(DropItemEvent event, EntityRef itemEntity, ItemComponent itemComponent, BlockItemComponent blockItemComponent) { String blockFamilyURI = blockItemComponent.blockFamily.getURI().toString(); if (blockFamilyURI.equals(LASUtils.BLACK_FLAG_URI) || blockFamilyURI.equals(LASUtils.RED_FLAG_URI)) { itemEntity.removeComponent(LifespanComponent.class); delayManager.addDelayedAction(itemEntity, LASUtils.DROPPED_FLAG, LASUtils.FLAG_TELEPORT_DELAY); } }
Source:
public void testGetTokenForRun() throws IOException { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); MockAuthorizationStrategy auth = new MockAuthorizationStrategy() .grant(Jenkins.READ).everywhere().to("alice") .grant(Computer.BUILD).everywhere().to("alice") .grant(Item.CONFIGURE).everywhere().to("alice"); j.jenkins.setAuthorizationStrategy(auth); String globalCredentialsId = "global-creds"; IdCredentials credentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, globalCredentialsId, "test-global-creds", "user", "password"); CredentialsProvider.lookupStores(j.jenkins).iterator().next().addCredentials(Domain.global(), credentials); FreeStyleProject item = j.createFreeStyleProject("testGetToken"); SecurityContextHolder.getContext().setAuthentication(User.get("alice").impersonate()); DockerRegistryToken token = new DockerRegistryEndpoint("<LINK_0>", globalCredentialsId).getToken(new FreeStyleBuild(item)); Assert.assertNotNull(token); Assert.assertEquals("user", token.getEmail()); Assert.assertEquals(Base64.encodeBase64String("user:password".getBytes(Charsets.UTF_8)), token.getToken()); }

Target:
public void testGetTokenForRun() throws IOException { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); MockAuthorizationStrategy auth = new MockAuthorizationStrategy() .grant(Jenkins.READ).everywhere().to("alice") .grant(Computer.BUILD).everywhere().to("alice") .grant(Item.CONFIGURE).everywhere().to("alice"); j.jenkins.setAuthorizationStrategy(auth); String globalCredentialsId = "global-creds"; IdCredentials credentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, globalCredentialsId, "test-global-creds", "user", "password"); CredentialsProvider.lookupStores(j.jenkins).iterator().next().addCredentials(Domain.global(), credentials); FreeStyleProject item = j.createFreeStyleProject(); try (ACLContext as = ACL.as(User.getById("alice", false))) { DockerRegistryToken token = new DockerRegistryEndpoint("<LINK_0>", globalCredentialsId).getToken(new FreeStyleBuild(item)); Assert.assertNotNull(token); Assert.assertEquals("user", token.getEmail()); Assert.assertEquals(Base64.getEncoder().encodeToString("user:password".getBytes(Charsets.UTF_8)), token.getToken()); } }
Source:
protected CompletableFuture<Void> startServices() { return messagingService.start() .thenComposeAsync(v -> broadcastService.start(), threadContext) .thenComposeAsync(v -> membershipService.start(), threadContext) .thenComposeAsync(v -> locationProvider.join(membershipService.getLocalMember().address()), threadContext) .thenComposeAsync(v -> communicationService.start(), threadContext) .thenComposeAsync(v -> eventService.start(), threadContext) .thenApply(v -> null); }

Target:
protected CompletableFuture<Void> startServices() { return messagingService.start() .thenComposeAsync(v -> broadcastService.start(), threadContext) .thenComposeAsync(v -> membershipService.start(), threadContext) .thenComposeAsync(v -> communicationService.start(), threadContext) .thenComposeAsync(v -> eventService.start(), threadContext) .thenApply(v -> null); }
Source:
private boolean serverExists(GlusterServerInfo glusterServer) { VDSGroup vdsGroup = getVdsGroupDao().get(getParameters().getClusterId()); if (vdsGroup.getcompatibility_version().compareTo(Version.v3_3) >= 0) { return getDbUtils().serverExists(glusterServer.getUuid()); } else { return getDbUtils().serverExists(getParameters().getClusterId(), glusterServer.getHostnameOrIp()); } }

Target:
private boolean serverExists(GlusterServerInfo glusterServer) { if (GlusterFeatureSupported.glusterHostUuidSupported(Version.v3_3)) { return getDbUtils().serverExists(glusterServer.getUuid()); } else { return getDbUtils().serverExists(getParameters().getClusterId(), glusterServer.getHostnameOrIp()); } }
Source:
public void prepareRun(BatchAggregatorContext context) throws Exception { super.prepareRun(context); List<String> inputFields = new ArrayList<>(); List<String> outputFields = new ArrayList<>(); Schema inputSchema = context.getInputSchema(); if (SchemaValidator.validateSchemaIsNotNull(inputSchema, "input")) { inputFields = inputSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); } Schema outputSchema = context.getOutputSchema(); if (SchemaValidator.validateSchemaIsNotNull(outputSchema, "output")) { outputFields = outputSchema.getFields().stream().map(Schema.Field::getName).collect(Collectors.toList()); } String groupByFields = Joiner.on(",").join(conf.getGroupByFields()); String aggregates = Joiner.on(",").join(conf.getAggregates()); FieldOperation dataPrepOperation = new FieldTransformOperation("JavaScript", "Grouped by: " + groupByFields + " Aggregates: " + aggregates, inputFields, outputFields); context.record(Collections.singletonList(dataPrepOperation)); }

Target:
public void prepareRun(BatchAggregatorContext context) throws Exception { super.prepareRun(context); LinkedList<FieldOperation> fllOperations = new LinkedList<>(); if (SchemaValidator.canRecordLineage(context.getOutputSchema(), "output")) { Schema inputSchema = context.getInputSchema(); for (GroupByConfig.FunctionInfo functionInfo : conf.getAggregates()) { Schema.Field outputSchemaField = getOutputSchemaField(functionInfo, inputSchema); String operationName = String.format("Group %s", functionInfo.getField()); String description = String.format("Aggregate function applied: '%s'.", functionInfo.getFunction()); FieldOperation operation = new FieldTransformOperation(operationName, description, Collections.singletonList(functionInfo.getField()), outputSchemaField.getName()); fllOperations.add(operation); } } context.record(fllOperations); }
Source:
private void setUpEventHandler() { this.setOnMouseClicked(e-> { ui.triggerEvent(new PanelClickedEvent(this.panelIndex)); requestFocus(); }); ui.registerEvent((RepoOpeningEventHandler) e -> { logger.info("Received RepoOpeningEvent"); HashSet<String> allReposInFilterExpr = Qualifier.getMetaQualifierContent(getCurrentFilterExpression(), QualifierType.REPO); if (e.isPrimaryRepo && allReposInFilterExpr.isEmpty()) { addPanelLoadingIndication(); } else if (allReposInFilterExpr.contains(e.repoId)) { addPanelLoadingIndication(); } }); ui.registerEvent((RepoOpenedEventHandler) e -> { logger.info("Received RepoOpenedEvent"); HashSet<String> allReposInFilterExpr = Qualifier.getMetaQualifierContent(getCurrentFilterExpression(), QualifierType.REPO); if (e.isPrimaryRepo && allReposInFilterExpr.isEmpty()) { removePanelLoadingIndication(); } else if (allReposInFilterExpr.contains(e.repoId)) { removePanelLoadingIndication(); } }); }

Target:
private void setUpEventHandler() { this.setOnMouseClicked(e-> { ui.triggerEvent(new PanelClickedEvent(this.panelIndex)); requestFocus(); }); ui.registerEvent((RepoOpeningEventHandler) this::indicatePanelLoading); ui.registerEvent((RepoOpenedEventHandler) this::unindicatePanelLoading); }
Source:
public void testLocalStreamGroupedCorrectlyForYarn() { HashSet<SystemStreamPartition> allSSPs = new HashSet<>(); HashMap<String, String> configMap = new HashMap<>(); configMap.put("yarn.container.count", "2"); Config config = new MapConfig(configMap); SystemStreamPartitionGrouper grouper = grouperFactory.getSystemStreamPartitionGrouper(config); Collections.addAll(allSSPs, aa0, aa1, aa2, ab0); Map<TaskName, Set<SystemStreamPartition>> result = grouper.group(allSSPs); Map<TaskName, Set<SystemStreamPartition>> expectedResult = new HashMap<>(); HashSet<SystemStreamPartition> partitions = new HashSet<>(); partitions.add(aa0); partitions.add(aa1); partitions.add(aa2); partitions.add(ab0); expectedResult.put(new TaskName("Task-0"), partitions); expectedResult.put(new TaskName("Task-1"), partitions); assertEquals(expectedResult, result); }

Target:
public void testLocalStreamGroupedCorrectlyForYarn() { HashSet<SystemStreamPartition> allSSPs = new HashSet<>(); HashMap<String, String> configMap = new HashMap<>(); configMap.put("job.container.count", "2"); Config config = new MapConfig(configMap); SystemStreamPartitionGrouper grouper = grouperFactory.getSystemStreamPartitionGrouper(config); Collections.addAll(allSSPs, aa0, aa1, aa2, ab0); Map<TaskName, Set<SystemStreamPartition>> result = grouper.group(allSSPs); Map<TaskName, Set<SystemStreamPartition>> expectedResult = new HashMap<>(); HashSet<SystemStreamPartition> partitions = new HashSet<>(); partitions.add(aa0); partitions.add(aa1); partitions.add(aa2); partitions.add(ab0); expectedResult.put(new TaskName("Task-0"), partitions); expectedResult.put(new TaskName("Task-1"), partitions); assertEquals(expectedResult, result); }
Source:
private void doCheck(JCloudsComputer c) { if (c.isPendingDelete()) return; if (c.isConnecting()) return; if (!c.isIdle() || c.getOfflineCause() instanceof OfflineCause.UserCause) return; final JCloudsSlave node = c.getNode(); if (node == null) return; final int retentionTime = node.getSlaveOptions().getRetentionTime(); if (retentionTime <= 0) return; long idleSince = c.getIdleStartMilliseconds(); final long connectionTime = c.getConnectionTime(); if(connectionTime == 0 ) { return; } if(connectionTime > idleSince) { idleSince = connectionTime; } final long idleMilliseconds = System.currentTimeMillis() - idleSince; if (idleMilliseconds > TimeUnit.MINUTES.toMillis(retentionTime)) { if (JCloudsPreCreationThread.isNeededReadyComputer(node.getComputer())) { LOGGER.info("Keeping " + c .getName() + " to meet minimum requirements"); return; } LOGGER.info("Scheduling " + c .getName() + " for termination after " + retentionTime+ " minutes as it was idle since " + new Date(idleSince)); if (LOGGER.isLoggable(Level.FINE)) { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); Jenkins.XSTREAM2.toXMLUTF8(node, out); LOGGER.fine(out.toString("UTF-8")); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to dump node config", e); } } c.setPendingDelete(true); } }

Target:
private void doCheck(JCloudsComputer c) { if (c.isPendingDelete()) return; if (c.isConnecting()) return; if (!c.isIdle() || c.getOfflineCause() instanceof OfflineCause.UserCause) return; final JCloudsSlave node = c.getNode(); if (node == null) return; final int retentionTime = node.getSlaveOptions().getRetentionTime(); if (retentionTime <= 0) return; if(c.getConnectedTime() == 0) return; final long idleSince = c.getIdleSince(); final long idleMilliseconds = System.currentTimeMillis() - idleSince; if (idleMilliseconds > TimeUnit.MINUTES.toMillis(retentionTime)) { if (JCloudsPreCreationThread.isNeededReadyComputer(node.getComputer())) { LOGGER.info("Keeping " + c .getName() + " to meet minimum requirements"); return; } LOGGER.info("Scheduling " + c .getName() + " for termination after " + retentionTime+ " minutes as it was idle since " + new Date(idleSince)); if (LOGGER.isLoggable(Level.FINE)) { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); Jenkins.XSTREAM2.toXMLUTF8(node, out); LOGGER.fine(out.toString("UTF-8")); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to dump node config", e); } } c.setPendingDelete(true); } }
Source:
@Override public void onJobFinished(GridJobWorker worker) { if (log.isDebugEnabled()) log.debug("Received onJobFinished() callback: " + worker); GridJobSessionImpl ses = worker.getSession(); if (ses.isFullSupport() && ctx.session().removeSession(ses.getId())) { ses.onClosed(); ctx.checkpoint().onSessionEnd(ses, true); } if (worker.endTime() < Long.MAX_VALUE) ctx.timeout().removeTimeoutObject(worker); release(worker.getDeployment()); finishedJobs.add(worker.getJobId()); if (!worker.isInternal()) { finishedJobsCnt.increment(); finishedJobsMetric.increment(); long execTime = worker.getExecuteTime(); finishedJobsTime.add(execTime); totalExecutionTimeMetric.add(execTime); maxFinishedJobsTime.setIfGreater(execTime); if (jobAlwaysActivate) { if (metricsUpdateFreq > -1L) updateJobMetrics(); if (!removeFromActive(worker)) cancelledJobs.remove(worker.getJobId(), worker); heldJobs.remove(worker.getJobId()); } else { if (!rwLock.tryReadLock()) { if (log.isDebugEnabled()) log.debug("Skipping collision handling on job finish (node is stopping)."); return; } if (!removeFromActive(worker)) cancelledJobs.remove(worker.getJobId(), worker); heldJobs.remove(worker.getJobId()); try { handleCollisions(); } finally { rwLock.readUnlock(); } } if (ctx.performanceStatistics().enabled()) { ctx.performanceStatistics().job(ses.getId(), worker.getQueuedTime(), worker.getStartTime(), worker.getExecuteTime(), worker.isTimedOut()); } } }

Target:
@Override public void onJobFinished(GridJobWorker worker) { if (log.isDebugEnabled()) log.debug("Received onJobFinished() callback: " + worker); GridJobSessionImpl ses = worker.getSession(); if (ses.isFullSupport() && ctx.session().removeSession(ses.getId())) { ses.onClosed(); ctx.checkpoint().onSessionEnd(ses, true); } if (worker.endTime() < Long.MAX_VALUE) ctx.timeout().removeTimeoutObject(worker); release(worker.getDeployment()); finishedJobs.add(worker.getJobId()); if (!worker.isInternal()) { finishedJobsCnt.increment(); finishedJobsMetric.increment(); long execTime = worker.getExecuteTime(); finishedJobsTime.add(execTime); totalExecutionTimeMetric.add(execTime); maxFinishedJobsTime.setIfGreater(execTime); if (jobAlwaysActivate) { if (metricsUpdateFreq > -1L) updateJobMetrics(); if (!removeFromActive(worker)) cancelledJobs.remove(worker.getJobId(), worker); heldJobs.remove(worker.getJobId()); } else { if (!rwLock.tryReadLock()) { if (log.isDebugEnabled()) log.debug("Skipping collision handling on job finish (node is stopping)."); return; } if (!removeFromActive(worker)) cancelledJobs.remove(worker.getJobId(), worker); heldJobs.remove(worker.getJobId()); try { handleCollisions(); } finally { rwLock.readUnlock(); } } } if (ctx.performanceStatistics().enabled()) { ctx.performanceStatistics().job(ses.getId(), worker.getQueuedTime(), worker.getStartTime(), worker.getExecuteTime(), worker.isTimedOut()); } }
Source:
public void testCompareToLargeScale3() { final ITmfTimestamp ts0a = TmfTimestamp.create(1, Integer.MAX_VALUE); final ITmfTimestamp ts0b = TmfTimestamp.create(2, Integer.MAX_VALUE); assertEquals("CompareTo", 1, ts0b.compareTo(ts0a)); assertEquals("CompareTo", -1, ts0a.compareTo(ts0b)); }

Target:
public void testCompareToLargeScale3() { final ITmfTimestamp ts0a = TmfTimestamp.create(1, Integer.MAX_VALUE); final ITmfTimestamp ts0b = TmfTimestamp.create(2, Integer.MAX_VALUE); assertTrue("CompareTo", ts0b.compareTo(ts0a) > 0); assertTrue("CompareTo", ts0a.compareTo(ts0b) < 0); }
Source:
public Notifier notifier() { String notifier = (String) optionSet.valueOf(NOTIFIER); if ("ConsoleNotifier".equals(notifier)) { return new ConsoleNotifier(verboseLoggingEnabled()); } if ("Slf4jNotifier".equals(notifier)) { return new Slf4jNotifier(verboseLoggingEnabled()); } else { try { ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class<?> cls = loader.loadClass(notifier); return (Notifier)cls.newInstance(); } catch (Exception e) { return throwUnchecked(e, null); } } }

Target:
public Notifier notifier() { String notifier = (String) optionSet.valueOf(NOTIFIER); if (ConsoleNotifier.class.getSimpleName().equals(notifier)) { return new ConsoleNotifier(verboseLoggingEnabled()); } if (Slf4jNotifier.class.getSimpleName().equals(notifier)) { return new Slf4jNotifier(verboseLoggingEnabled()); } else { try { @SuppressWarnings("unchecked") Class<Notifier> notifierClass = (Class<Notifier>)ClassUtils.getClass(notifier); return ConstructorUtils.invokeConstructor(notifierClass); } catch (Exception e) { throw new IllegalArgumentException("Cannot load notifier by its name: " + notifier, e); } } }
Source:
public void grant(String roleName, String principalName) { Set<String> roleSet = getClusterRoleMap().computeIfAbsent(principalName, n -> { return new HashSet<>(); }); roleSet.add(roleName); clusterRoleMap.put(principalName, roleSet); }

Target:
public void grant(String roleName, String principalName) { Set<String> roleSet = getClusterRoleMap().computeIfAbsent(principalName, n -> new HashSet<>() ); roleSet.add(roleName); clusterRoleMap.put(principalName, roleSet); }
Source:
public ChannelHandlerContext lastContext() { synchronized (handlers) { if (handlers.isEmpty()) { return null; } return handlers.get(handlers.size() - 1); } }

Target:
public ChannelHandlerContext lastContext() { synchronized (handlers) { return handlers.isEmpty() ? null : handlers.get(handlers.size() - 1); } }
Source:
protected boolean matchesSafely(View target) { if (!(target instanceof ImageView)) { return false; } ImageView imageView = (ImageView) target; if (expectedId < 0) { return imageView.getDrawable() == null; } Resources resources = target.getContext().getResources(); Drawable expectedDrawable = resources.getDrawable(expectedId); resourceName = resources.getResourceEntryName(expectedId); if (expectedDrawable == null) { return false; } Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap(); Bitmap otherBitmap = ((BitmapDrawable) expectedDrawable).getBitmap(); return bitmap.sameAs(otherBitmap); }

Target:
protected boolean matchesSafely(View target) { if (!(target instanceof ImageView)) { return false; } ImageView imageView = (ImageView) target; if (expectedId < 0) { return imageView.getDrawable() == null; } Resources resources = target.getContext().getResources(); Drawable expectedDrawable = getDrawable(resources, expectedId, target.getContext().getTheme()); resourceName = resources.getResourceEntryName(expectedId); if (expectedDrawable == null) { return false; } Bitmap bitmap = ((BitmapDrawable) imageView.getDrawable()).getBitmap(); Bitmap expectedBitmap = ((BitmapDrawable) expectedDrawable).getBitmap(); return bitmap.sameAs(expectedBitmap); }
Source:
private void checkResponseStatus(HttpResponse response) { StatusLine statusLine = response.getStatusLine(); int status = statusLine.getStatusCode(); if (statusLine.getStatusCode() >= 400) { String error; try { BufferedInputStream bis = new BufferedInputStream( response.getEntity().getContent()); ByteArrayOutputStream buf = new ByteArrayOutputStream(); int result = bis.read(); while (result != -1) { buf.write((byte) result); result = bis.read(); } error = buf.toString(); } catch (IOException e) { error = statusLine.getReasonPhrase(); } throw new RuntimeException("Status: " + status + " " + error); } assertEquals(200, status); }

Target:
private void checkResponseStatus(HttpResponse response) { StatusLine statusLine = response.getStatusLine(); int status = statusLine.getStatusCode(); if (statusLine.getStatusCode() >= 400) { String error; try { ByteBuffer buf = IO.readWholeStream(new BufferedInputStream( response.getEntity().getContent()), 1024); error = new String(buf.array(), UTF_8); } catch (IOException e) { error = statusLine.getReasonPhrase(); } throw new RuntimeException("Status: " + status + " " + error); } assertEquals(200, status); }
Source:
private static PlanNode buildProjectedIndexSource(PlanBuilder p, Predicate<Symbol> projectionFilter) { Symbol orderkey = p.symbol("orderkey", INTEGER); Symbol custkey = p.symbol("custkey", INTEGER); Symbol totalprice = p.symbol("totalprice", DOUBLE); ColumnHandle orderkeyHandle = new TpchColumnHandle(orderkey.getName(), INTEGER); ColumnHandle custkeyHandle = new TpchColumnHandle(custkey.getName(), INTEGER); ColumnHandle totalpriceHandle = new TpchColumnHandle(totalprice.getName(), DOUBLE); return p.project( Assignments.identity( ImmutableList.of(orderkey, custkey, totalprice).stream() .filter(projectionFilter) .collect(toImmutableList())), p.indexSource( new TableHandle( new ConnectorId("local"), new TpchTableHandle("orders", TINY_SCALE_FACTOR), TestingTransactionHandle.create(), Optional.of(TestingHandle.INSTANCE)), ImmutableSet.of(orderkey, custkey), ImmutableList.of(orderkey, custkey, totalprice), ImmutableMap.of( orderkey, orderkeyHandle, custkey, custkeyHandle, totalprice, totalpriceHandle), TupleDomain.fromFixedValues(ImmutableMap.of(totalpriceHandle, asNull(DOUBLE))))); }

Target:
private static PlanNode buildProjectedIndexSource(PlanBuilder p, Predicate<Symbol> projectionFilter) { Symbol orderkey = p.symbol("orderkey", INTEGER); Symbol custkey = p.symbol("custkey", INTEGER); Symbol totalprice = p.symbol("totalprice", DOUBLE); ColumnHandle orderkeyHandle = new TpchColumnHandle(orderkey.getName(), INTEGER); ColumnHandle custkeyHandle = new TpchColumnHandle(custkey.getName(), INTEGER); ColumnHandle totalpriceHandle = new TpchColumnHandle(totalprice.getName(), DOUBLE); return p.project( Assignments.identity( ImmutableList.of(orderkey, custkey, totalprice).stream() .filter(projectionFilter) .collect(toImmutableList())), p.indexSource( new TableHandle( new ConnectorId("local"), new TpchTableHandle("orders", TINY_SCALE_FACTOR), TestingTransactionHandle.create(), Optional.empty()), ImmutableSet.of(orderkey, custkey), ImmutableList.of(orderkey, custkey, totalprice), ImmutableMap.of( orderkey, orderkeyHandle, custkey, custkeyHandle, totalprice, totalpriceHandle), TupleDomain.fromFixedValues(ImmutableMap.of(totalpriceHandle, asNull(DOUBLE))))); }
Source:
public void expectNone(long withinMillis) throws InterruptedException { received.expectNone(withinMillis, "Did not expect an element but got "); }

Target:
public void expectNone(long withinMillis) throws InterruptedException { expectNone(withinMillis, "Did not expect an element but got "); }
Source:
public boolean hasVolumeOnServer(Guid vdsId) { if (getGlusterBrickDao().getGlusterVolumeBricksByServerId(vdsId).size() > 0) { return true; } else { return false; } }

Target:
public boolean hasVolumeOnServer(Guid vdsId) { return (getGlusterBrickDao().getGlusterVolumeBricksByServerId(vdsId).size() > 0); }
Source:
private void listenForMessages() { this.queueId = ensureQueueExists( amazonSQS, queueARN, topicARN, subscription.getSqsMessageRetentionPeriodSeconds() ); subscribeToTopic(amazonSNS, topicARN, queueARN); while (true) { ReceiveMessageResult receiveMessageResult = amazonSQS.receiveMessage( new ReceiveMessageRequest(queueId) .withMaxNumberOfMessages(AWS_MAX_NUMBER_OF_MESSAGES) .withVisibilityTimeout(subscription.getVisibilityTimeout()) .withWaitTimeSeconds(subscription.getWaitTimeSeconds()) ); if (receiveMessageResult.getMessages().isEmpty()) { log.debug("Received no messages"); continue; } receiveMessageResult.getMessages().forEach(message -> { handleMessage(message); registry.counter(getProcessedMetricId(subscriptionName())).increment(); }); } }

Target:
private void listenForMessages() { while (isEnabled.get()) { ReceiveMessageResult receiveMessageResult = amazonSQS.receiveMessage( new ReceiveMessageRequest(queueId) .withMaxNumberOfMessages(AWS_MAX_NUMBER_OF_MESSAGES) .withVisibilityTimeout(subscription.getVisibilityTimeout()) .withWaitTimeSeconds(subscription.getWaitTimeSeconds()) ); if (receiveMessageResult.getMessages().isEmpty()) { log.debug("Received no messages for queue: {}", queueARN); continue; } receiveMessageResult.getMessages().forEach(message -> { handleMessage(message); }); } }
Source:
private static String findSqlOnClasspath(ClassLoader classLoader, String path) { try { return CACHE.get(path, () -> readResource(classLoader, path)); } catch (ExecutionException e) { throw Throwables.propagate(e); } }

Target:
private static String findSqlOnClasspath(ClassLoader classLoader, String path) { try { return CACHE.get(new AbstractMap.SimpleEntry<>(classLoader, path), () -> readResource(classLoader, path)); } catch (UncheckedExecutionException | ExecutionException e) { throw Throwables.propagate(e.getCause()); } }
Source:
void peekBatchMessagesFromSequence(MessagingEntityType entityType) { setSenderAndReceiver(entityType, false); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); final int maxMessages = 2; final int fromSequenceNumber = 1; sendMessage(message); sendMessage(message); IterableStream<ServiceBusReceivedMessage> iterableMessages = receiver.peekBatchAt(maxMessages, fromSequenceNumber); Assertions.assertEquals(maxMessages, iterableMessages.stream().collect(Collectors.toList()).size()); }

Target:
void peekBatchMessagesFromSequence(MessagingEntityType entityType) { setSenderAndReceiver(entityType, false); final String messageId = UUID.randomUUID().toString(); final ServiceBusMessage message = getMessage(messageId, false); final int maxMessages = 2; final int fromSequenceNumber = 1; sendMessage(message); sendMessage(message); IterableStream<ServiceBusReceivedMessage> iterableMessages = receiver.peekBatchAt(maxMessages, fromSequenceNumber); final List<ServiceBusReceivedMessage> asList = iterableMessages.stream().collect(Collectors.toList()); assertEquals(maxMessages, asList.size()); final ServiceBusReceivedMessage receivedMessage = asList.get(0); assertNotNull(receivedMessage); assertTrue(receivedMessage.getSequenceNumber() >= fromSequenceNumber); }
Source:
public String createBuildInfoJSonFileAndGetItsPath() throws IOException { if (serverConfig == null) { return null; } try { File buildInfoJsonTempFile = File.createTempFile(BuildInfoFields.GENERATED_BUILD_INFO, ".json"); clientConf.info.setGeneratedBuildInfoFilePath(buildInfoJsonTempFile.getAbsolutePath()); return buildInfoJsonTempFile.getCanonicalPath(); } catch (IOException e) { log.error("Error occurred while writing build info properties to a temp file. Build info " + "collection is disabled.", e); throw e; } }

Target:
public String createBuildInfoJSonFileAndGetItsPath() throws IOException { if (serverConfig == null) { return null; } try { File buildInfoJsonTempFile = File.createTempFile(BuildInfoFields.GENERATED_BUILD_INFO, ".json"); clientConf.info.setGeneratedBuildInfoFilePath(buildInfoJsonTempFile.getAbsolutePath()); return buildInfoJsonTempFile.getCanonicalPath(); } catch (IOException e) { log.error("Error occurred while creating temp build info JSON file.", e); throw e; } }