auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Boolean serializeZxidDigest(OutputArchive oa) throws IOException { if (!DigestCalculator.digestEnabled()) { return false; } ZxidDigest zxidDigest = lastProcessedZxidDigest; if (zxidDigest == null) { zxidDigest = new ZxidDigest(); } zxidDigest.serialize(oa); return true; }

Target:
public boolean serializeZxidDigest(OutputArchive oa) throws IOException { if (!DigestCalculator.digestEnabled()) { return false; } ZxidDigest zxidDigest = lastProcessedZxidDigest; if (zxidDigest == null) { zxidDigest = new ZxidDigest(); } zxidDigest.serialize(oa); return true; }
Source:
private String getDataServiceClassName(int transportType) { String className; int resourceId; String carrierConfig; switch (transportType) { case AccessNetworkConstants.TRANSPORT_TYPE_WWAN: resourceId = com.android.internal.R.string.config_wwan_data_service_class; carrierConfig = CarrierConfigManager .KEY_CARRIER_DATA_SERVICE_WWAN_CLASS_OVERRIDE_STRING; break; case AccessNetworkConstants.TRANSPORT_TYPE_WLAN: resourceId = com.android.internal.R.string.config_wlan_data_service_class; carrierConfig = CarrierConfigManager .KEY_CARRIER_DATA_SERVICE_WLAN_CLASS_OVERRIDE_STRING; break; default: throw new IllegalStateException("Transport type not WWAN or WLAN. type=" + transportType); } className = mPhone.getContext().getResources().getString(resourceId); PersistableBundle b = mCarrierConfigManager.getConfigForSubId(mPhone.getSubId()); if (b != null && !TextUtils.isEmpty(b.getString(carrierConfig))) { className = b.getString(carrierConfig, className); } List<ResolveInfo> resolveInfo = mPhone.getContext().getPackageManager().queryIntentServices( new Intent(DataService.SERVICE_INTERFACE), PackageManager.MATCH_SYSTEM_ONLY); if (resolveInfo != null) { for (ResolveInfo info : resolveInfo) { if (info.serviceInfo == null) continue; if ((info.serviceInfo.name).contains(className)) { className = info.serviceInfo.name; break; } } } return className; }

Target:
private String getDataServiceClassName(int transportType) { String className; int resourceId; String carrierConfig; switch (transportType) { case AccessNetworkConstants.TRANSPORT_TYPE_WWAN: resourceId = com.android.internal.R.string.config_wwan_data_service_class; carrierConfig = CarrierConfigManager .KEY_CARRIER_DATA_SERVICE_WWAN_CLASS_OVERRIDE_STRING; break; case AccessNetworkConstants.TRANSPORT_TYPE_WLAN: resourceId = com.android.internal.R.string.config_wlan_data_service_class; carrierConfig = CarrierConfigManager .KEY_CARRIER_DATA_SERVICE_WLAN_CLASS_OVERRIDE_STRING; break; default: throw new IllegalStateException("Transport type not WWAN or WLAN. type=" + transportType); } className = mPhone.getContext().getResources().getString(resourceId); PersistableBundle b = mCarrierConfigManager.getConfigForSubId(mPhone.getSubId()); if (b != null && !TextUtils.isEmpty(b.getString(carrierConfig))) { className = b.getString(carrierConfig, className); } return className; }
Source:
EclipseResourceImpl(org.eclipse.core.resources.IResource delegate) { if (delegate == null) throw new NullPointerException("delegate is null"); this.delegate = delegate; if (delegate.getProject() != null) referencePoint = new EclipseReferencePointImpl(new EclipsePathImpl(delegate.getProject().getLocation())); }

Target:
EclipseResourceImpl(org.eclipse.core.resources.IResource delegate) { if (delegate == null) throw new NullPointerException("delegate is null"); this.delegate = delegate; if (delegate.getProject() != null) this.referencePoint = new ReferencePointImpl(new EclipsePathImpl(delegate.getProject().getFullPath())); }
Source:
void resolvePluginDependencies() throws IOException { List<String> missingDependencies = new ArrayList<String>(); for (Dependency d : dependencies) { if (parent.getPlugin(d.shortName) == null || !(parent.getPlugin(d.shortName).active)) missingDependencies.add(d.toString()); } if (!missingDependencies.isEmpty()) throw new IOException("Dependency "+Util.join(missingDependencies, ", ")+" doesn't exist"); for (Dependency d : optionalDependencies) { if (parent.getPlugin(d.shortName) != null || !(parent.getPlugin(d.shortName).active)) dependencies.add(d); } }

Target:
void resolvePluginDependencies() throws IOException { List<String> missingDependencies = new ArrayList<String>(); for (Dependency d : dependencies) { if (parent.getPlugin(d.shortName) == null || !(parent.getPlugin(d.shortName).active)) missingDependencies.add(d.toString()); } if (!missingDependencies.isEmpty()) throw new IOException("Dependency "+Util.join(missingDependencies, ", ")+" doesn't exist"); for (Dependency d : optionalDependencies) { if (parent.getPlugin(d.shortName) != null && parent.getPlugin(d.shortName).active) dependencies.add(d); } }
Source:
public static void skipContent(@Nonnull JayceInternalReaderImpl in) throws IOException { NodeLevel nodeLevel = in.getNodeLevel(); in.skipInt(); in.skipId(); if (nodeLevel != NodeLevel.TYPES) { in.skipId(); in.skipIds(); in.skipId(); in.skipId(); in.skipId(); in.skipIds(); in.skipNodes(NField.class); in.skipNodes(NMethod.class); in.skipNodes(NAnnotation.class); in.skipNodes(NMarker.class); } }

Target:
public static void skipContent(@Nonnull JayceInternalReaderImpl in) throws IOException { NodeLevel nodeLevel = in.getNodeLevel(); in.skipInt(); in.skipId(); if (nodeLevel != NodeLevel.TYPES) { in.skipIds(); in.skipId(); in.skipIds(); in.skipNodes(NField.class); in.skipNodes(NMethod.class); in.skipNodes(NAnnotation.class); in.skipNodes(NMarker.class); } }
Source:
private String compactPrefix() { if (sharedPrefix.length() > contextLength) { return ELLIPSIS + sharedPrefix.substring(sharedPrefix.length() - contextLength); } return sharedPrefix; }

Target:
public String compactPrefix() { if (sharedPrefix.length() <= contextLength) { return sharedPrefix; } return ELLIPSIS + sharedPrefix.substring(sharedPrefix.length() - contextLength); }
Source:
public void deleteError(final ProgramError error) { synchronized (errors) { errors.remove(error); eventBus.publish(new ProgramErrorDeletedEvent(error)); } }

Target:
public void deleteError(final ProgramError error) { errors.remove(error); eventBus.publish(new ProgramErrorDeletedEvent(error)); }
Source:
public boolean isSitePublished(String siteId) { boolean siteIsPublished = false; try { Site site = SiteService.getSite(siteId); if (site != null) { siteIsPublished = site.isPublished(); } } catch (IdUnusedException e) { } return siteIsPublished; }

Target:
public boolean isSitePublished(String siteId) { boolean siteIsPublished = false; try { Site site = SiteService.getSite(siteId); siteIsPublished = site.isPublished(); } catch (IdUnusedException e) { } return siteIsPublished; }
Source:
public Collection<Citation> getCitationsByKey(BibEntry entry) { return getCitationsByKey(Objects.requireNonNull(entry.getCiteKeyOptional().orElse(null))); }

Target:
public Collection<Citation> getCitationsByKey(BibEntry entry) { return entry.getCiteKeyOptional().map(this::getCitationsByKey).orElse(Collections.emptyList()); }
Source:
public void downloadExistingExport( @Context HttpServletResponse response, @PathParam("consumer_uuid") @Verify(Consumer.class) String consumerUuid, @PathParam("export_id") String exportId) { Consumer consumer = consumerCurator.verifyAndLookupConsumer(consumerUuid); if (consumer.getType() == null || !consumer.getType().isManifest()) { log.error("Invalid consumer type specified for the manifest download"); throw new NotFoundException( i18n.tr("The specified file does not exist, or can not be accessed.")); } manifestManager.writeStoredExportToResponse(exportId, consumer, response); manifestManager.deleteStoredManifest(exportId); }

Target:
public void downloadExistingExport( @Context HttpServletResponse response, @PathParam("consumer_uuid") @Verify(Consumer.class) String consumerUuid, @PathParam("export_id") String exportId) { manifestManager.writeStoredExportToResponse(exportId, consumerUuid, response); manifestManager.deleteStoredManifest(exportId); }
Source:
public SetPushSetupSmsRequestDataDto mkeSetPushSetupSmsRequestDataDto() { final CosemObisCodeDto cosemCode = new CosemObisCodeDto(1, 1, 1, 1, 1, 1); final List<CosemObjectDefinitionDto> objectDefinitions = new ArrayList<>(); final SendDestinationAndMethodDto destinationAndMethod = new SendDestinationAndMethodDto( TransportServiceTypeDto.TCP, "todo", MessageTypeDto.XML_ENCODED_X_DLMS_APDU); final List<WindowElementDto> windowElemenents = new ArrayList<>(); final PushSetupSmsDto setupSms = new PushSetupSmsDto(cosemCode, objectDefinitions, destinationAndMethod, windowElemenents, 1, 1, 1); final SetPushSetupSmsRequestDataDto result = new SetPushSetupSmsRequestDataDto(setupSms); return result; }

Target:
public SetPushSetupSmsRequestDataDto mkeSetPushSetupSmsRequestDataDto() { final CosemObisCodeDto cosemCode = new CosemObisCodeDto(1, 1, 1, 1, 1, 1); final List<CosemObjectDefinitionDto> objectDefinitions = new ArrayList<>(); final SendDestinationAndMethodDto destinationAndMethod = new SendDestinationAndMethodDto( TransportServiceTypeDto.TCP, "destination", MessageTypeDto.XML_ENCODED_X_DLMS_APDU); final List<WindowElementDto> windowElemenents = new ArrayList<>(); final PushSetupSmsDto setupSms = new PushSetupSmsDto(cosemCode, objectDefinitions, destinationAndMethod, windowElemenents, 1, 1, 1); final SetPushSetupSmsRequestDataDto result = new SetPushSetupSmsRequestDataDto(setupSms); return result; }
Source:
public void setUp() throws Exception { initMocks(this); mockBundleContext = mock(BundleContext.class); mockEndpointUtil = mock(EndpointUtil.class); mockRequest = mock(Request.class); mockResponse = mock(Response.class); mockCqlQueryResponse = mock(CqlQueryResponse.class); mockQueryResponse = mock(QueryResponse.class); mockServiceReference = mock(QueryResponseTransformer.class); mockQueryResponseTransformer = mock(ServiceReference.class); mockServletOutputStream = mock(ServletOutputStream.class); mockHttpServiceResponse = mock(HttpServletResponse.class); queryResponseTransformers = new ArrayList<>(); when(mockQueryResponseTransformer.getProperty(Core.ID)).thenReturn(RETURN_ID); MimeType mimeType = new MimeType(MIME_TYPE); mockBinaryContent = new BinaryContentImpl(new ByteArrayInputStream(CONTENT.getBytes()), mimeType); queryResponseTransformers.add(mockQueryResponseTransformer); cqlTransformHandler = new CqlTransformHandler(queryResponseTransformers, mockBundleContext); cqlTransformHandler.setEndpointUtil(mockEndpointUtil); when(mockEndpointUtil.safeGetBody(mockRequest)).thenReturn(SAFE_BODY); when(mockEndpointUtil.executeCqlQuery(any(CqlRequest.class))).thenReturn(mockCqlQueryResponse); when(mockCqlQueryResponse.getQueryResponse()).thenReturn(mockQueryResponse); when(mockBundleContext.getService(mockQueryResponseTransformer)) .thenReturn(mockServiceReference); when(mockServiceReference.transform(mockQueryResponse, Collections.emptyMap())) .thenReturn(mockBinaryContent); when(mockResponse.raw()).thenReturn(mockHttpServiceResponse); when(mockHttpServiceResponse.getOutputStream()).thenReturn(mockServletOutputStream); }

Target:
public void setUp() throws Exception { initMocks(this); when(mockHttpServletResponse.getOutputStream()).thenReturn(mockServletOutputStream); mockResponse = new MockResponse(mockHttpServletResponse); queryResponseTransformers = new ArrayList<>(); when(mockServiceReference.getProperty(Core.ID)).thenReturn(RETURN_ID); MimeType mimeType = new MimeType(MIME_TYPE); binaryContent = new BinaryContentImpl(new ByteArrayInputStream(CONTENT.getBytes()), mimeType); queryResponseTransformers.add(mockServiceReference); cqlTransformHandler = new CqlTransformHandler(queryResponseTransformers, mockBundleContext, mockEndpointUtil); when(mockEndpointUtil.safeGetBody(mockRequest)).thenReturn(SAFE_BODY); when(mockEndpointUtil.executeCqlQuery(any(CqlRequest.class))).thenReturn(mockCqlQueryResponse); when(mockCqlQueryResponse.getQueryResponse()).thenReturn(mockQueryResponse); when(mockBundleContext.getService(mockServiceReference)) .thenReturn(mockQueryResponseTransformer); when(mockQueryResponseTransformer.transform(any(QueryResponse.class), anyMap())) .thenReturn(binaryContent); }
Source:
public HostNetworkProviderModel() { getNetworkProviders().setIsChangeable(!getUseClusterDefaultNetworkProvider().getEntity()); getUseClusterDefaultNetworkProvider().getEntityChangedEvent().addListener((ev, sender, args) -> getNetworkProviders().setIsChangeable(!getUseClusterDefaultNetworkProvider().getEntity())); getNetworkProviders().getSelectedItemChangedEvent().addListener((ev, sender, args) -> { Provider<OpenstackNetworkProviderProperties> provider = getNetworkProviders().getSelectedItem(); getNetworkProviderType().setIsAvailable(provider != null); getNetworkProviderType().setSelectedItem(provider == null ? null : provider.getType()); boolean isNeutron = getNetworkProviderType().getSelectedItem() == ProviderType.OPENSTACK_NETWORK; getNeutronAgentModel().init(isNeutron && provider != null ? provider : new Provider<>()); getNeutronAgentModel().setIsAvailable(isNeutron); }); getUseClusterDefaultNetworkProvider().getEntityChangedEvent().addListener( (ev, sender, args) -> selectDefaultProvider()); getNetworkProviderType().setIsChangeable(false); getNetworkProviderType().setIsAvailable(false); getNeutronAgentModel().setIsAvailable(false); initNetworkProvidersList(); }

Target:
public HostNetworkProviderModel() { getNetworkProviders().setIsChangeable(!getUseClusterDefaultNetworkProvider().getEntity()); getUseClusterDefaultNetworkProvider().getEntityChangedEvent().addListener((ev, sender, args) -> getNetworkProviders().setIsChangeable(!getUseClusterDefaultNetworkProvider().getEntity())); getUseClusterDefaultNetworkProvider().getEntityChangedEvent().addListener( (ev, sender, args) -> selectDefaultProvider()); getNetworkProviders().getSelectedItemChangedEvent().addListener((ev, sender, args) -> { Provider<OpenstackNetworkProviderProperties> provider = getNetworkProviders().getSelectedItem(); getNetworkProviderType().setIsAvailable(provider != null); getNetworkProviderType().setSelectedItem(provider == null ? null : provider.getType()); boolean isNeutron = getNetworkProviderType().getSelectedItem() == ProviderType.OPENSTACK_NETWORK; getNeutronAgentModel().init(isNeutron && provider != null ? provider : new Provider<>()); getNeutronAgentModel().setIsAvailable(isNeutron); }); getNetworkProviderType().setIsChangeable(false); getNetworkProviderType().setIsAvailable(false); getNeutronAgentModel().setIsAvailable(false); initNetworkProvidersList(); }
Source:
void insert(MemberInfo info) { Comparator<MemberInfo> c = new Comparator<MemberInfo>() { @Override public int compare(MemberInfo a, MemberInfo b) { int cmp = nullToEmpty(a.fullName()).compareTo(nullToEmpty(b.fullName())); if (cmp != 0) { return cmp; } cmp = nullToEmpty(a.preferredEmail()).compareTo( nullToEmpty(b.preferredEmail())); if (cmp != 0) { return cmp; } return a.getAccountId().get() - b.getAccountId().get(); } public String nullToEmpty(String str) { return str == null ? "" : str; } }; for (int row = 1; row < table.getRowCount(); row++) { final MemberInfo i = getRowItem(row); if (i != null) { if (c.compare(info, i) < 0) { table.insertRow(row); applyDataRowStyle(row); populate(row, info); return; } } } final int row = table.getRowCount(); table.insertRow(row); applyDataRowStyle(row); populate(row, info); }

Target:
void insert(MemberInfo info) { Comparator<MemberInfo> c = new Comparator<MemberInfo>() { @Override public int compare(MemberInfo a, MemberInfo b) { int cmp = nullToEmpty(a.fullName()).compareTo(nullToEmpty(b.fullName())); if (cmp != 0) { return cmp; } cmp = nullToEmpty(a.preferredEmail()).compareTo( nullToEmpty(b.preferredEmail())); if (cmp != 0) { return cmp; } return a.getAccountId().get() - b.getAccountId().get(); } public String nullToEmpty(String str) { return str == null ? "" : str; } }; int insertPosition = table.getRowCount(); int left = 1; int right = table.getRowCount() - 1; while (left <= right) { int middle = (left + right) >>> 1; MemberInfo i = getRowItem(middle); int cmp = c.compare(i, info); if (cmp < 0) { left = middle + 1; } else if (cmp > 0) { right = middle - 1; } else { return; } } insertPosition = left; table.insertRow(insertPosition); applyDataRowStyle(insertPosition); populate(insertPosition, info); }
Source:
public void setUp() throws Exception { super.setUp(); home = new File(trash, "home"); assertTrue(home.mkdir()); configFile = new File(new File(home, ".ssh"), "config"); assertTrue(configFile.getParentFile().mkdir()); System.setProperty("user.name", "jex_junit"); osc = new OpenSshConfig(home, configFile); }

Target:
public void setUp() throws Exception { super.setUp(); home = new File(trash, "home"); FileUtils.mkdir(home); configFile = new File(new File(home, ".ssh"), "config"); FileUtils.mkdir(configFile.getParentFile()); System.setProperty("user.name", "jex_junit"); osc = new OpenSshConfig(home, configFile); }
Source:
public void testPrometheusCaseMetrics() { String caseId = startUserTaskCase(USER_YODA, USER_JOHN); assertThat(caseId).isNotEmpty(); assertThat(getMetrics()).contains( "kie_server_case_started_total{case_definition_id=\"" + CASE_DEF_ID + "\",", "kie_server_case_running_total{case_definition_id=\"" + CASE_DEF_ID + "\",} 1.0" ); caseClient.cancelCaseInstance(CONTAINER_ID_CASE, caseId); assertThat(getMetrics()).contains( "kie_server_case_started_total{case_definition_id=\"" + CASE_DEF_ID + "\",", "kie_server_case_running_total{case_definition_id=\"" + CASE_DEF_ID + "\",} 0.0", "kie_server_case_duration_seconds_count{case_definition_id=\"" + CASE_DEF_ID + "\",", "kie_server_case_duration_seconds_sum{case_definition_id=\"" + CASE_DEF_ID + "\"," ); }

Target:
public void testPrometheusCaseMetrics() { String caseId = startUserTaskCase(USER_YODA, USER_JOHN); assertThat(caseId).isNotEmpty(); assertThat(getMetrics()).contains( "kie_server_case_started_total{case_definition_id=\"" + CASE_DEF_ID + "\",", "kie_server_case_running_total{case_definition_id=\"" + CASE_DEF_ID + "\"," ); caseClient.cancelCaseInstance(CONTAINER_ID_CASE, caseId); assertThat(getMetrics()).contains( "kie_server_case_started_total{case_definition_id=\"" + CASE_DEF_ID + "\",", "kie_server_case_running_total{case_definition_id=\"" + CASE_DEF_ID + "\",", "kie_server_case_duration_seconds_count{case_definition_id=\"" + CASE_DEF_ID + "\",", "kie_server_case_duration_seconds_sum{case_definition_id=\"" + CASE_DEF_ID + "\"," ); }
Source:
public void onCollide(ICollidable other) { if (other instanceof EnemyFish) { EnemyFish fish = (EnemyFish) other; if (fish.isDead()) { return; } double tsize = this.getBoundingArea().getSize(); double osize = fish.getBoundingArea().getSize(); if (tsize > osize * FISH_EAT_THRESHOLD) { State old = getState(); fish.setDead(); notifyObservers(old, getState()); this.addPoints((int) (osize / 200)); double dSize = GROWTH_SPEED * osize / tsize; getBoundingArea().increaseSize(dSize); } else if (osize > tsize * FISH_EAT_THRESHOLD) { State old = getState(); this.removeLife(); notifyObservers(old, getState(), "lives"); } } }

Target:
public void onCollide(ICollidable other) { if (other instanceof EnemyFish) { EnemyFish fish = (EnemyFish) other; if (fish.isDead()) { return; } double tsize = this.getBoundingArea().getSize(); double osize = fish.getBoundingArea().getSize(); if (tsize > osize * FISH_EAT_THRESHOLD) { State old = getState(); fish.setDead(); notifyObservers(old, getState(), "EnemyKill"); this.addPoints((int) (osize / 200)); double dSize = GROWTH_SPEED * osize / tsize; getBoundingArea().increaseSize(dSize); } else if (osize > tsize * FISH_EAT_THRESHOLD) { if (isInvincible()) { return; } State old = getState(); this.removeLife(); notifyObservers(old, getState(), "lives"); } } }
Source:
public void changePasswordUsingSecretAnswer(String secretAnswer, String pw) throws APIException { User user = Context.getAuthenticatedUser(); if(!isSecretAnswer(user, secretAnswer)) { throw new APIException("secret.answer.not.correct", (Object[]) null); } dao.changePassword(user, pw); }

Target:
public void changePasswordUsingSecretAnswer(String secretAnswer, String pw) throws APIException { User user = Context.getAuthenticatedUser(); if(!isSecretAnswer(user, secretAnswer)) { throw new APIException("secret.answer.not.correct", (Object[]) null); } updatePassword(user, pw); }
Source:
public SqliteIndexedStorageUtility(Class<T> prototype, String sandboxId, String tableName, String databasePath) { this.tableName = tableName; this.sandboxId = sandboxId; this.prototype = prototype; if(databasePath == null){ databaseFolder = new File(DATABASE_FOLDER); } else{ databaseFolder = new File(databasePath); } Connection c = null; try { c = getConnection(); SqlHelper.createTable(c, tableName, prototype.newInstance()); c.close(); } catch (SQLException e) { System.out.println("Couldn't create table: " + tableName + " due to exception: " + e); e.printStackTrace(); } catch(InstantiationException | IllegalAccessException | ClassNotFoundException e){ throw new RuntimeException(e); } finally{ try { if (c != null) { c.close(); } } catch (SQLException e) { e.printStackTrace(); } } }

Target:
public SqliteIndexedStorageUtility(Class<T> prototype, String sandboxId, String tableName, String databasePath) { this.tableName = tableName; this.sandboxId = sandboxId; this.prototype = prototype; databaseFolder = new File(databasePath); Connection c = null; try { c = getConnection(); SqlHelper.createTable(c, tableName, prototype.newInstance()); c.close(); } catch (SQLException e) { System.out.println("Couldn't create table: " + tableName + " due to exception: " + e); e.printStackTrace(); } catch(InstantiationException | IllegalAccessException | ClassNotFoundException e){ throw new RuntimeException(e); } finally{ try { if (c != null) { c.close(); } } catch (SQLException e) { e.printStackTrace(); } } }
Source:
public CourseInstructorCopyTable getCopyInstructorForm() { List<CourseInstructorCopyTableRow> copyQuestionRows = buildCopyInstructorModalRows(instructors); return new CourseInstructorCopyTable(copyQuestionRows); }

Target:
public CourseInstructorCopyTable getCopyInstructorForm() { List<CourseInstructorCopyTableRow> copyInstructorModalRows = buildCopyInstructorModalRows(instructors); return new CourseInstructorCopyTable(copyInstructorModalRows); }
Source:
private static String messagesToJson(List<String> tags) { String[] array = new String[tags.size()]; return messagesToJson(tags.toArray(array)); }

Target:
private static String messagesToJson(List<String> tags) { return messagesToJson(tags.toArray(new String[0])); }
Source:
private Mono<TextAnalyticsPagedResponse<RecognizeLinkedEntitiesResult>> getRecognizedLinkedEntitiesResponseInPage( Iterable<TextDocumentInput> documents, TextAnalyticsRequestOptions options, Context context) { return service.entitiesLinkingWithResponseAsync( new MultiLanguageBatchInput().setDocuments(Transforms.toMultiLanguageInput(documents)), context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), options == null ? null : options.getModelVersion(), options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Recognized linked entities for a batch of documents - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to recognize linked entities - {}", error)) .map(this::toTextAnalyticsPagedResponse) .onErrorMap(throwable -> { if (throwable instanceof TextAnalyticsErrorException) { TextAnalyticsErrorException errorException = (TextAnalyticsErrorException) throwable; return new HttpResponseException(errorException.getMessage(), errorException.getResponse()); } return throwable; }); }

Target:
private Mono<TextAnalyticsPagedResponse<RecognizeLinkedEntitiesResult>> getRecognizedLinkedEntitiesResponseInPage( Iterable<TextDocumentInput> documents, TextAnalyticsRequestOptions options, Context context) { return service.entitiesLinkingWithResponseAsync( new MultiLanguageBatchInput().setDocuments(Transforms.toMultiLanguageInput(documents)), context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE), options == null ? null : options.getModelVersion(), options == null ? null : options.isIncludeStatistics()) .doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString())) .doOnSuccess(response -> logger.info("Recognized linked entities for a batch of documents - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to recognize linked entities - {}", error)) .map(this::toTextAnalyticsPagedResponse) .onErrorMap(throwable -> mapToHttpResponseExceptionIfExist(throwable)); }
Source:
public BigDecimal convertRain(BigDecimal value) { if (this == DEFAULT_UNIT_SYSTEM) { return value; } return value.multiply(new BigDecimal(0.0393700787)); }

Target:
public BigDecimal convertRain(BigDecimal value) { if (this == DEFAULT_UNIT_SYSTEM) { return value; } return value.multiply(MM_TO_INCHES); }
Source:
public <T> T unmarshal(String data, String marshallingFormat, Class<T> unmarshalType) { if (data == null || data.isEmpty()) { return null; } MarshallingFormat format = getFormat(marshallingFormat); Marshaller marshaller = serverMarshallers.get(format); if (marshaller == null) { if (registry != null) { marshaller = MarshallerFactory.getMarshaller(registry.getExtraClasses(), format, this.getClass().getClassLoader()); } else { marshaller = MarshallerFactory.getMarshaller(format, this.getClass().getClassLoader()); } serverMarshallers.put(format, marshaller); } Object instance = marshaller.unmarshall(data, unmarshalType); if (instance instanceof Wrapped) { return (T) ((Wrapped) instance).unwrap(); } return (T) instance; }

Target:
public <T> T unmarshal(String data, String marshallingFormat, Class<T> unmarshalType) { if (data == null || data.isEmpty()) { return null; } MarshallingFormat format = getFormat(marshallingFormat); Marshaller marshaller = serverMarshallers.get(format); if (marshaller == null) { marshaller = MarshallerFactory.getMarshaller(getExtraClasses(registry), format, this.getClass().getClassLoader()); serverMarshallers.put(format, marshaller); } Object instance = marshaller.unmarshall(data, unmarshalType); if (instance instanceof Wrapped) { return (T) ((Wrapped) instance).unwrap(); } return (T) instance; }
Source:
public void startElement(String uri, String localName, String qName, Attributes attributes) { if (qName.equals(nodeName)) { strings = new String[3]; final String[] splitStrings = attributes.getValue(0).split(SPLIT_ONE); if (splitStrings[0].substring(0, 7).equals(PREFIX_CONFIG)) { final String moduleName = splitStrings[0].substring(7).split(SPLIT_TWO)[0]; strings[0] = moduleName; strings[1] = splitStrings[1]; } } currentTag = qName; }

Target:
public void startElement(String uri, String localName, String qName, Attributes attributes) { if (qName.equals(NODE_NAME)) { final String[] moduleAndCheckName = attributes.getValue(0).split(SPLIT_CHECK_NAME_IN_ATTRIBUTE); if (moduleAndCheckName[0].startsWith(PREFIX_CONFIG)) { singleCheckNameList = new ArrayList<>(); final String moduleName = moduleAndCheckName[0].replaceAll("(.*config_)|(\\.html.*)", ""); singleCheckNameList.add(moduleName); singleCheckNameList.add(moduleAndCheckName[1]); } } currentTag = qName; }
Source:
private Object getAllRowsAndAssert(WideRowTable table, Blackhole blackhole, Consumer<Integer> assertion) { return table.getTransactionManager().runTaskThrowOnConflict(txn -> { Iterator<Map.Entry<Cell, byte[]>> iter = txn.getRowsColumnRange( table.getTableRef(), Collections.singleton(Tables.ROW_BYTES.array()), new ColumnRangeSelection(null, null), 10000); int count = 0; while (iter.hasNext()) { blackhole.consume(iter.next()); ++count; } return count; }); }

Target:
private void getAllRowsAndAssert(WideRowTable table, Blackhole blackhole, Consumer<Integer> assertion) { int rowsRead = table.getTransactionManager().runTaskThrowOnConflict(txn -> { Iterator<Map.Entry<Cell, byte[]>> iter = txn.getRowsColumnRange( table.getTableRef(), Collections.singleton(Tables.ROW_BYTES.array()), new ColumnRangeSelection(null, null), 10000); int count = 0; while (iter.hasNext()) { blackhole.consume(iter.next()); ++count; } return count; }); assertion.accept(rowsRead); }
Source:
public boolean isLDAPUSer(final String username) { boolean searchResultFlag = false; String searchFilter = "(&(objectCategory=person)(sAMAccountName=" + username + "))"; SearchControls searchControls = new SearchControls(); searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); try { init(); NamingEnumeration<SearchResult> results = this.ctx.search(this.searchBase, searchFilter, searchControls); if (results == null) { return false; } SearchResult searchResult = null; Attributes attribs = null; @SuppressWarnings("rawtypes") NamingEnumeration allMembers = null; String accoutnName = null; while (results.hasMoreElements()) { searchResult = results.nextElement(); attribs = searchResult.getAttributes(); if (attribs.size() > 0) { Attribute attribute = attribs.get("sAMAccountName"); allMembers = attribute.getAll(); while ((allMembers != null) && allMembers.hasMoreElements()) { accoutnName = (String) allMembers.next(); if (accoutnName.equalsIgnoreCase(username)) { searchResultFlag = true; break; } } } if (searchResultFlag) { break; } } } catch (NamingException e) { logger.debug(e, "Error checking LDAP user [%s]", username); } finally { if (this.ctx != null) { try { this.ctx.close(); } catch (NamingException e) { logger.debug(e, "Error closing context"); } } } return searchResultFlag; }

Target:
public boolean isLDAPUSer(final String username) { boolean result = false; try { String accountName = findAccountNameForUser(username); result = accountName != null; } catch (NamingException ex) { logger.info(ex, "Error authenticating LDAP user [%s]", username); } return result; }
Source:
static Type[] mapKeyAndValueTypes(Type context, Class<?> contextRawType) { if (context == Properties.class) return new Type[] { String.class, String.class }; Type mapType = getSupertype(context, contextRawType, Map.class); if (mapType instanceof ParameterizedType) { ParameterizedType mapParameterizedType = (ParameterizedType) mapType; return getCanonicalizedMapTypeArguments(mapParameterizedType); } return new Type[] { Object.class, Object.class }; }

Target:
static Type[] mapKeyAndValueTypes(Type context, Class<?> contextRawType) { if (context == Properties.class) return new Type[] { String.class, String.class }; Type mapType = getSupertype(context, contextRawType, Map.class); if (mapType instanceof ParameterizedType) { ParameterizedType mapParameterizedType = (ParameterizedType) mapType; return mapParameterizedType.getActualTypeArguments(); } return new Type[] { Object.class, Object.class }; }
Source:
private void flush() { synchronized (lock) { tableToBulkMutation.values().stream().forEach(mutation -> { try { mutation.flush(); } catch (final InterruptedException e) { log.error("Failed to apply mutation {}:{}", mutation, e.getMessage()); throw new RuntimeException(e); } }); } }

Target:
private void flush() { synchronized (lock) { tableToBulkMutation.values().stream().forEach(mutation -> { try { mutation.flush(); } catch (final InterruptedException e) { throw new RuntimeException(e); } }); } }
Source:
public void testUnserializableResponse_exceptionPropagatesToClientCallback() throws Throwable { IExecutorService service = client.getExecutorService("executor"); TaskWithUnserialazableResponse counterCallable = new TaskWithUnserialazableResponse(); final CountDownLatch countDownLatch = new CountDownLatch(1); final AtomicReference<Throwable> throwable = new AtomicReference<Throwable>(); service.submit(counterCallable, new ExecutionCallback() { @Override public void onResponse(Object response) { } @Override public void onFailure(Throwable t) { countDownLatch.countDown(); throwable.set(t.getCause()); } }); assertOpenEventually(countDownLatch); throw throwable.get(); }

Target:
public void testUnserializableResponse_exceptionPropagatesToClientCallback() throws Throwable { IExecutorService service = client.getExecutorService("executor"); TaskWithUnserialazableResponse counterCallable = new TaskWithUnserialazableResponse(); final CountDownLatch countDownLatch = new CountDownLatch(1); final AtomicReference<Throwable> throwable = new AtomicReference<Throwable>(); service.submit(counterCallable, new ExecutionCallback() { @Override public void onResponse(Object response) { } @Override public void onFailure(Throwable t) { throwable.set(t.getCause()); countDownLatch.countDown(); } }); assertOpenEventually(countDownLatch); throw throwable.get(); }
Source:
public CifsWinrsConnection(String type, ConnectionOptions options, AddressPortMapper mapper) { super(type, options, mapper, true); ConnectionValidator.assertIsWindowsHost(os, CIFS_PROTOCOL, cifsConnectionType); ConnectionValidator.assetNotThroughJumpstation(mapper, CIFS_PROTOCOL, cifsConnectionType); ConnectionValidator.assertNoSingleQuoteInPassword(password, CIFS_PROTOCOL, cifsConnectionType); this.options = options; }

Target:
public CifsWinrsConnection(String type, ConnectionOptions options, AddressPortMapper mapper) { super(type, options, mapper); }
Source:
private ActivityMetadata createMetadataObject(final ActivityDTO dto) { ActivityMetadata metadata = null; switch (dto.getConcept()) { case CERTIFIED_PRODUCT: metadata = new ListingActivityMetadata(); break; case DEVELOPER: metadata = new DeveloperActivityMetadata(); break; case PRODUCT: metadata = new ProductActivityMetadata(); break; case VERSION: metadata = new VersionActivityMetadata(); break; case CERTIFICATION_BODY: metadata = new CertificationBodyActivityMetadata(); break; case ATL: metadata = new TestingLabActivityMetadata(); break; default: break; } return metadata; }

Target:
private ActivityMetadata createMetadataObject(final ActivityDTO dto) { ActivityMetadata metadata = null; switch (dto.getConcept()) { case CERTIFIED_PRODUCT: metadata = new ListingActivityMetadata(); break; case DEVELOPER: metadata = new DeveloperActivityMetadata(); break; case PRODUCT: metadata = new ProductActivityMetadata(); break; case VERSION: metadata = new VersionActivityMetadata(); break; case CERTIFICATION_BODY: metadata = new CertificationBodyActivityMetadata(); break; case TESTING_LAB: metadata = new TestingLabActivityMetadata(); break; default: break; } return metadata; }
Source:
public void TXBegin(TransactionType type) { switch (type){ case WRITE_AFTER_WRITE: WWTXBegin(); return; case OPTIMISTIC: OptimisticTXBegin(); return; default: throw new IllegalArgumentException("Unsupported TXN type"); } }

Target:
public void TXBegin(TransactionType type) { switch (type){ case WRITE_AFTER_WRITE: WWTXBegin(); return; case OPTIMISTIC: OptimisticTXBegin(); return; default: throw new IllegalArgumentException("Unsupported TXN type:"+type.toString()); } }
Source:
private List<String> findPDPToEmailAddress() { Collection addresses = parameterService.getParameterValuesAsString(KFSConstants.ParameterNamespaces.PDP, KfsParameterConstants.BATCH_COMPONENT, CUPdpParameterConstants.PDP_ACH_INVALID_EMAIL_ERROR_REPORT_TO_ADDRESSES); return new ArrayList<String>(addresses); }

Target:
private List<String> findPDPToEmailAddress() { Collection addresses = parameterService.getParameterValuesAsString(KFSConstants.CoreModuleNamespaces.PDP, KfsParameterConstants.BATCH_COMPONENT, CUPdpParameterConstants.PDP_ACH_INVALID_EMAIL_ERROR_REPORT_TO_ADDRESSES); return new ArrayList<String>(addresses); }
Source:
private Versioned<Collection<? extends byte[]>> toVersioned( MapEntryValues value) { return value == null ? new Versioned<>(Lists.newArrayList(), -1) : new Versioned<>(value.values(), value.version()); }

Target:
private Versioned<Collection<? extends byte[]>> toVersioned( MapEntryValues value) { return value == null ? new Versioned<>(Collections.emptyList(), -1) : new Versioned<>(value.values(), value.version()); }
Source:
private void extractMappings() { if (config.mapping != null && config.mapping.isEmpty()) { isSimple = true; } else { isSimple = false; String[] pathMaps = config.mapping.split(","); for (String pathMap : pathMaps) { String[] mapParts = pathMap.split(":"); String field = mapParts[0]; String expression = mapParts[1]; if (field.isEmpty() && !expression.isEmpty()) { throw new IllegalArgumentException("Json path expression '" + expression + "' has not output field specified"); } if (expression.isEmpty() && !field.isEmpty()) { throw new IllegalArgumentException("Field '" + field + "' doesn't have Json path expression."); } mapping.put(field, expression); } } }

Target:
private void extractMappings() { if (config.mapping != null && config.mapping.isEmpty()) { isSimple = true; } else { isSimple = false; String[] pathMaps = config.mapping.split(","); for (String pathMap : pathMaps) { String[] mapParts = pathMap.split(":"); String field = mapParts[0]; String expression = mapParts[1]; if (field.isEmpty() && !expression.isEmpty()) { throw new IllegalArgumentException("Json path expression '" + expression + "' has no output field specified"); } if (expression.isEmpty() && !field.isEmpty()) { throw new IllegalArgumentException("Field '" + field + "' doesn't have Json path expression."); } mapping.put(field, expression); } } }
Source:
Set<ObjectId> getShallowCommits() throws IOException { if (shallowFile == null || !shallowFile.isFile()) return Collections.emptySet(); if (shallowFileSnapshot == null || shallowFileSnapshot.isModified(shallowFile)) { shallowCommitsIds = new HashSet<ObjectId>(); final BufferedReader reader = open(shallowFile); try { String line; while ((line = reader.readLine()) != null) { try { shallowCommitsIds.add(ObjectId.fromString(line)); } catch (IllegalArgumentException ex) { throw new IOException("bad shallow line: " + line); } } } finally { reader.close(); } shallowFileSnapshot = FileSnapshot.save(shallowFile); } return shallowCommitsIds; }

Target:
Set<ObjectId> getShallowCommits() throws IOException { if (shallowFile == null || !shallowFile.isFile()) return Collections.emptySet(); if (shallowFileSnapshot == null || shallowFileSnapshot.isModified(shallowFile)) { shallowCommitsIds = new HashSet<ObjectId>(); final BufferedReader reader = open(shallowFile); try { String line; while ((line = reader.readLine()) != null) { try { shallowCommitsIds.add(ObjectId.fromString(line)); } catch (IllegalArgumentException ex) { throw new IOException(MessageFormat .format(JGitText.get().badShallowLine, line)); } } } finally { reader.close(); } shallowFileSnapshot = FileSnapshot.save(shallowFile); } return shallowCommitsIds; }
Source:
private void handlePartialResults( QueryResponse solrResponse, Map<String, Serializable> responseProps) { if (solrResponse.getResponseHeader() != null) { Boolean partialResults = (Boolean) solrResponse.getResponseHeader().get("partialResults"); if (Boolean.TRUE.equals(partialResults)) { responseProps.put("partial-results", true); if (LOGGER.isDebugEnabled()) { String q = "unknown"; if (solrResponse.getResponseHeader().get("params") != null && solrResponse.getResponseHeader().get("params") instanceof SimpleOrderedMap) { q = String.valueOf( ((SimpleOrderedMap) solrResponse.getResponseHeader().get("params")).get("q")); } LOGGER.debug( "Found partial results for query that took {}ms.", solrResponse.getResults().getNumFound(), q, solrResponse.getQTime()); } } } }

Target:
private void handlePartialResults( QueryResponse solrResponse, Map<String, Serializable> responseProps) { boolean partialResults = Optional.of(solrResponse) .map(QueryResponse::getResponseHeader) .map(header -> header.get("partialResults")) .filter(Boolean.class::isInstance) .map(Boolean.class::cast) .orElse(false); if (!partialResults) { return; } responseProps.put("partial-results", true); if (LOGGER.isDebugEnabled()) { String q = Optional.of(solrResponse) .map(QueryResponse::getResponseHeader) .map(header -> header.get("params")) .filter(SimpleOrderedMap.class::isInstance) .map(SimpleOrderedMap.class::cast) .map(params -> params.get("q")) .map(String::valueOf) .orElse("unknown"); LOGGER.debug( "Found partial results for query that took {}ms.", solrResponse.getResults().getNumFound(), q, solrResponse.getQTime()); } }
Source:
public String lookup(final LogEvent event, final String key) { final Message msg = event.getMessage(); if (msg instanceof MapMessage) { try { final Map<String, String> properties = ((StringMapMessage) msg).getData(); if (properties == null) { return ""; } if (key == null || key.length() == 0 || key.equals("*")) { final StringBuilder sb = new StringBuilder("{"); boolean first = true; for (final Map.Entry<String, String> entry : properties.entrySet()) { if (!first) { sb.append(", "); } sb.append(entry.getKey()).append("=").append(entry.getValue()); first = false; } sb.append("}"); return sb.toString(); } return properties.get(key); } catch (final Exception ex) { LOGGER.warn(LOOKUP, "Error while getting property [{}].", key, ex); return null; } } return null; }

Target:
public String lookup(final LogEvent event, final String key) { final Message msg = event.getMessage(); if (msg instanceof MapMessage) { try { MapMessage<?, ?> mapMessage = (MapMessage) msg; if (key == null || key.length() == 0 || key.equals("*")) { return mapMessage.asString(MapMessage.MapFormat.JAVA_UNQUOTED.name()); } return mapMessage.get(key); } catch (final Exception ex) { LOGGER.warn(LOOKUP, "Error while getting property [{}].", key, ex); return null; } } return null; }
Source:
public SearchResult(final List<Map<String, Object>> items, final PaginationInfo pagination) { assert items != null; assert pagination != null; this.items = items; this.pagination = pagination; }

Target:
public SearchResult(final List<Map<String, Object>> items, final PaginationInfo pagination) { checkNotNull(items, "items cannot be null"); checkNotNull(pagination, "pagination cannot be null"); this.items = items; this.pagination = pagination; }
Source:
private Publisher translatePublisherDetails(PublisherDetails simple) { Maybe<Publisher> complex = Publisher.fromKey(simple.getKey()); if (!complex.isNothing()) { return complex.requireValue(); } return null; }

Target:
private Publisher translatePublisherDetails(PublisherDetails simple) { Maybe<Publisher> complex = Publisher.fromKey(simple.getKey()); if (!complex.isNothing()) { return complex.requireValue(); } else { throw new IllegalArgumentException("Publisher is not present while extracting " + "publisher details from the simple model."); } }
Source:
public DefaultClientConfiguration(Properties prop) { this(); Assert.requireNonNull(prop, "prop"); for(String key : prop.stringPropertyNames()) { setStringProperty(key, prop.getProperty(key)); } }

Target:
public DefaultClientConfiguration(Properties prop) { this(); Assert.requireNonNull(prop, "prop"); internalProperties.putAll(prop); }
Source:
public void onAfterWrite(RepositoryStreamWriteContext ctx) throws IOException { RepositoryPath repositoryPath = (RepositoryPath) ctx.getPath(); logger.debug(String.format("Closing [%s]", repositoryPath)); }

Target:
public void onAfterWrite(RepositoryStreamWriteContext ctx) throws IOException { RepositoryPath repositoryPath = (RepositoryPath) ctx.getPath(); logger.debug(String.format("Complete writing [%s]", repositoryPath)); }
Source:
public Collection<ReferenceGenome> listAllReferenceGenomeTypes() throws IOException { authorizationManager.throwIfNonAdmin(); return referenceGenomeDao.listAllReferenceGenomeTypes(); }

Target:
public Collection<ReferenceGenome> listAllReferenceGenomeTypes() throws IOException { authorizationManager.throwIfUnauthenticated(); return referenceGenomeDao.listAllReferenceGenomeTypes(); }
Source:
public void selectPhotosVideos() { photosVideos.click(); waitForElementByElement(sortingOptions); }

Target:
public void selectPhotosVideos() { photosVideos.click(); waitForElementByElement(sortingOptions); PageObjectLogging.log("selectPhotosVideos", "Photos and videos option is selected", true, driver); }
Source:
public void testReader() throws IOException { EasyMock.reset(STORAGE); EasyMock.reset(CONFIG); addExpectedPrefixObjects(PREFIXES.get(0), ImmutableList.of(EXPECTED_URIS.get(0))); addExpectedGetObjectMock(EXPECTED_URIS.get(0)); addExpectedPrefixObjects(PREFIXES.get(1), ImmutableList.of(EXPECTED_URIS.get(1))); addExpectedGetObjectMock(EXPECTED_URIS.get(1)); EasyMock.expect(CONFIG.getMaxListingLength()).andReturn(EXPECTED_MAX_LISTING_LENGTH); EasyMock.replay(STORAGE); EasyMock.replay(CONFIG); GoogleCloudStorageInputSource inputSource = new GoogleCloudStorageInputSource( STORAGE, CONFIG, null, PREFIXES, null ); InputRowSchema someSchema = new InputRowSchema( new TimestampSpec("time", "auto", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("dim1", "dim2"))), ImmutableList.of("count") ); InputSourceReader reader = inputSource.reader( someSchema, new CsvInputFormat(ImmutableList.of("time", "dim1", "dim2"), "|", false, null, 0), null ); CloseableIterator<InputRow> iterator = reader.read(); while (iterator.hasNext()) { InputRow nextRow = iterator.next(); Assert.assertEquals(NOW, nextRow.getTimestamp()); Assert.assertEquals("hello", nextRow.getDimension("dim1").get(0)); Assert.assertEquals("world", nextRow.getDimension("dim2").get(0)); } }

Target:
public void testReader() throws IOException { EasyMock.reset(STORAGE); EasyMock.reset(INPUT_DATA_CONFIG); addExpectedPrefixObjects(PREFIXES.get(0), ImmutableList.of(EXPECTED_URIS.get(0))); addExpectedGetObjectMock(EXPECTED_URIS.get(0)); addExpectedPrefixObjects(PREFIXES.get(1), ImmutableList.of(EXPECTED_URIS.get(1))); addExpectedGetObjectMock(EXPECTED_URIS.get(1)); EasyMock.expect(INPUT_DATA_CONFIG.getMaxListingLength()).andReturn(MAX_LISTING_LENGTH); EasyMock.replay(STORAGE); EasyMock.replay(INPUT_DATA_CONFIG); GoogleCloudStorageInputSource inputSource = new GoogleCloudStorageInputSource( STORAGE, INPUT_DATA_CONFIG, null, PREFIXES, null ); InputRowSchema someSchema = new InputRowSchema( new TimestampSpec("time", "auto", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("dim1", "dim2"))), ImmutableList.of("count") ); InputSourceReader reader = inputSource.reader( someSchema, new CsvInputFormat(ImmutableList.of("time", "dim1", "dim2"), "|", false, null, 0), null ); CloseableIterator<InputRow> iterator = reader.read(); while (iterator.hasNext()) { InputRow nextRow = iterator.next(); Assert.assertEquals(NOW, nextRow.getTimestamp()); Assert.assertEquals("hello", nextRow.getDimension("dim1").get(0)); Assert.assertEquals("world", nextRow.getDimension("dim2").get(0)); } }
Source:
public void afterShortExpirationEntryShouldBeAway() throws InterruptedException { final String KEY = "key"; final HazelcastInstance node = createHazelcastInstance(); try { IMap<String, String> map = node.getMap("test"); map.set(KEY, "value", 1500, TimeUnit.MILLISECONDS); map.lock(KEY); Object object = map.get(KEY); map.unlock(KEY); assertNotNull(object); Thread.sleep(1700); map.lock(KEY); object = map.get(KEY); map.unlock(KEY); assertNull(object); } finally { node.shutdown(); } }

Target:
public void afterShortExpirationEntryShouldBeAway() throws InterruptedException { final String KEY = "key"; final HazelcastInstance node = createHazelcastInstance(); try { IMap<String, String> map = node.getMap("test"); map.set(KEY, "value", 1500, TimeUnit.MILLISECONDS); map.lock(KEY); Object object = map.get(KEY); map.unlock(KEY); assertNotNull(object); sleepAtLeastMillis(1700); map.lock(KEY); object = map.get(KEY); map.unlock(KEY); assertNull(object); } finally { node.shutdown(); } }