auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testDoNotUpdateDeviceWhenReadOnlyIsNotChanged() { final UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(false); when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); initializeCommand(parameters); command.executeVmCommand(); assertFalse(command.shouldUpdateReadOnly()); verify(vmDeviceDAO, never()).update(any(VmDevice.class)); }

Target:
public void testDoNotUpdateDeviceWhenReadOnlyIsNotChanged() { final UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(false); when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); VmDevice device = createVmDevice(diskImageGuid, vmId); doReturn(device).when(vmDeviceDAO).get(device.getId()); assertEquals(device.getIsReadOnly(), parameters.getDiskInfo().getReadOnly()); initializeCommand(parameters); command.executeVmCommand(); assertFalse(command.shouldUpdateReadOnly()); verify(command, atLeast(1)).shouldUpdateReadOnly(); verify(vmDeviceDAO, never()).update(any(VmDevice.class)); }
Source:
private static SSAInstruction[] getParticularMethodStatements( MethodReference ref, Collection<IMethod> returnValues, Context context, Map<Integer, ConstantValue> constants) { ArrayList<SSAInstruction> statements = new ArrayList<>(); int nextLocal = ref.getNumberOfParameters() + 2; IClass cls = ((TypeAbstraction) context.get(ContextKey.RECEIVER)).getType(); SSAInstructionFactory insts = ((TypeAbstraction) context.get(ContextKey.RECEIVER)) .getType() .getClassLoader() .getInstructionFactory(); if (cls != null) { for (IMethod m : returnValues) { int c = nextLocal++; constants.put(c, new ConstantValue(m)); SSAReturnInstruction R = insts.ReturnInstruction(statements.size(), c, false); statements.add(R); } } else { } SSAInstruction[] result = new SSAInstruction[statements.size()]; Iterator<SSAInstruction> it = statements.iterator(); Arrays.setAll(result, i -> it.next()); return result; }

Target:
private static SSAInstruction[] getParticularMethodStatements( MethodReference ref, Collection<IMethod> returnValues, Context context, Map<Integer, ConstantValue> constants) { ArrayList<SSAInstruction> statements = new ArrayList<>(); int nextLocal = ref.getNumberOfParameters() + 2; IClass cls = ((TypeAbstraction) context.get(ContextKey.RECEIVER)).getType(); SSAInstructionFactory insts = ((TypeAbstraction) context.get(ContextKey.RECEIVER)) .getType() .getClassLoader() .getInstructionFactory(); if (cls != null) { for (IMethod m : returnValues) { int c = nextLocal++; constants.put(c, new ConstantValue(m)); SSAReturnInstruction R = insts.ReturnInstruction(statements.size(), c, false); statements.add(R); } } else { } return statements.toArray(new SSAInstruction[0]); }
Source:
public void testDoNotValidateNameSizeImport() { checkTemplateName(false, string100); }

Target:
public void testDoNotValidateNameSizeImport() { checkTemplateName(false, string500); }
Source:
private void registerHandlers() { addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { if(!"".equals(title)){ tooltip.setHTML(title); tooltipPanel.showRelativeTo(LabelWithToolTip.this); } } }); addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { tooltipPanel.hide(true); } }); }

Target:
private void registerHandlers() { addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { if (StringUtils.isEmpty(title)) { tooltip.setHTML(title); tooltipPanel.showRelativeTo(LabelWithToolTip.this); } } }); addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { tooltipPanel.hide(true); } }); }
Source:
boolean wouldPushProject(Project.NameKey project) { if (projects.length < 1) { return true; } for (final String projectMatch : projects) { String projectName = project.get(); if (isRE(projectMatch)) { if (projectName.matches(projectMatch)) { return true; } } else if (isWildcard(projectMatch)) { if (projectName.startsWith( projectMatch.substring(0, projectMatch.length() - 1))) { return true; } } else { if (projectName.equals(projectMatch)) { return true; } } } return false; }

Target:
boolean wouldPushProject(Project.NameKey project) { if (projects.length < 1) { return true; } String projectName = project.get(); for (final String projectMatch : projects) { if (isRE(projectMatch)) { if (projectName.matches(projectMatch)) { return true; } } else if (isWildcard(projectMatch)) { if (projectName.startsWith( projectMatch.substring(0, projectMatch.length() - 1))) { return true; } } else { if (projectName.equals(projectMatch)) { return true; } } } return false; }
Source:
private HttpClientBuilder createHttpBuilder() { HttpClientBuilder httpClientBuilder = HttpClients.custom() .setDefaultCookieStore(new BasicCookieStore()) .setMaxConnTotal(128) .setMaxConnPerRoute(32); if (useTls()) { httpClientBuilder.setSSLSocketFactory( new SSLConnectionSocketFactory( getSslContext(), getSupportedProtocols(), getSupportedCipherSuites(), SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER)); } if (useBasicAuth()) { httpClientBuilder.setDefaultCredentialsProvider(getCredentialsProvider()); httpClientBuilder.addInterceptorFirst(new PreemptiveAuth(new BasicScheme())); } return httpClientBuilder; }

Target:
private HttpClientBuilder createHttpBuilder() { HttpClientBuilder httpClientBuilder = HttpClients.custom() .setDefaultCookieStore(new BasicCookieStore()) .setMaxConnTotal(128) .setMaxConnPerRoute(32); if (solrSettings.useTls()) { httpClientBuilder.setSSLSocketFactory( new SSLConnectionSocketFactory( getSslContext(), solrSettings.getSupportedProtocols(), solrSettings.getSupportedCipherSuites(), SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER)); } if (solrSettings.useBasicAuth()) { SolrPasswordUpdate solrPasswordUpdate = new SolrPasswordUpdate( new UuidGeneratorImpl(), new ClientFactoryFactoryImpl(), solrSettings.getEncryptionService()); solrPasswordUpdate.start(); httpClientBuilder.setDefaultCredentialsProvider(getCredentialsProvider()); httpClientBuilder.addInterceptorFirst(new PreemptiveAuth(new BasicScheme())); } return httpClientBuilder; }
Source:
public static String stripProlog(String line) { if (line.contains(PROLOG_START)) { int start = line.indexOf(PROLOG_START); int end = line.indexOf(PROLOG_END) + PROLOG_END.length(); if (end > start) { String prolog = line.substring(start, end); line = line.replace(prolog, ""); } } return line; }

Target:
public static String stripProlog(String line) { if (line.matches("^\\s*<\\?xml\\b.*$")) { int start = line.indexOf(PROLOG_START); int end = line.indexOf(PROLOG_END) + PROLOG_END.length(); if (end > start) { String prolog = line.substring(start, end); line = line.replace(prolog, ""); } } return line; }
Source:
public void init(ConfigurationContextService configurationContextService) { if (mode != Mode.HA) { receiverManager.start(); } executorService.schedule(new Runnable() { @Override public void run() { try { log.info("Starting polling event adapters"); getEventReceiverManagementService().startPolling(); } catch (Exception e) { log.error("Unexpected error occurred", e); } } }, ConfigurationConstants.AXIS_TIME_INTERVAL_IN_MILLISECONDS * 4, TimeUnit.MILLISECONDS); executorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { checkMemberUpdate(); } }, 10, 10, TimeUnit.SECONDS); }

Target:
public void init(ConfigurationContextService configurationContextService) { if (mode != Mode.HA) { receiverManager.start(); } executorService.schedule(new Runnable() { @Override public void run() { try { log.info("Starting polling event adapters"); getEventReceiverManagementService().startPolling(); } catch (Exception e) { log.error("Unexpected error occurred when start polling event adapters", e); } } }, ConfigurationConstants.AXIS_TIME_INTERVAL_IN_MILLISECONDS * 4, TimeUnit.MILLISECONDS); executorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { checkMemberUpdate(); } }, 10, 10, TimeUnit.SECONDS); }
Source:
public static String formatDate(LocalDate sundayDate) { if (sundayDate.getDayOfWeek() != DayOfWeek.SUNDAY) throw new IllegalArgumentException("Passed date should be a Sunday"); LocalDate mondayDate = sundayDate.plusDays(1); return ISO8601_WEEK_FORMATTER.format(mondayDate); }

Target:
public static String formatDate(LocalDate sundayDate) { if (sundayDate.getDayOfWeek() != DayOfWeek.SUNDAY) { throw new IllegalArgumentException("Passed date should be a Sunday"); } LocalDate mondayDate = sundayDate.plusDays(1); return ISO8601_WEEK_FORMATTER.format(mondayDate); }
Source:
public void testCallService_1_OK_1_FAIL() throws InstallatorException, NodeExecutionException, KeyManagementException, NoSuchAlgorithmException, IOException { when(httpsClient.doHttpsPost(Mockito.anyString(), Mockito.anyString(),(Map<String,String>)Mockito.anyObject())).thenReturn(200); when(httpsClient.doHttpsGet(Mockito.anyString(), Mockito.anyString(),(Map<String,String>)Mockito.anyObject())).thenReturn(500); puppetInstallator.generateFilesinPuppetMaster(host, "test", productRelease, "install", "token"); }

Target:
public void testCallService_1_OK_1_FAIL() throws InstallatorException, NodeExecutionException, KeyManagementException, NoSuchAlgorithmException, IOException { when( httpsClient.doHttps(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), (Map<String, String>) Mockito.anyObject())).thenReturn(200).thenReturn(500); puppetInstallator.generateFilesinPuppetMaster(host, "test", productRelease, "install", "token"); }
Source:
public void testEqualsIgnoreValueOrder_sameLengthDifferentValues() { MultivaluedHashMap map = new MultivaluedHashMap(); MultivaluedHashMap differentMap = new MultivaluedHashMap(); map.put(1, Arrays.asList(new Integer[]{1, 2, 3})); differentMap.put(1, Arrays.asList(new Integer[]{1, 2, 2})); equalsIgnoreValueOrder_shouldReturnFalseForDifferentMaps(map, differentMap); map.clear(); map.put(1, Arrays.asList(new Integer[]{1, 2, 3})); map.put(2, Arrays.asList(new Integer[]{4, 5, 6})); differentMap.clear(); differentMap.put(1, Arrays.asList(new Integer[]{1, 2, 3})); differentMap.put(2, Arrays.asList(new Integer[]{4, 5, 5})); equalsIgnoreValueOrder_shouldReturnFalseForDifferentMaps(map, differentMap); }

Target:
public void testEqualsIgnoreValueOrder_sameLengthDifferentValues() { MultivaluedHashMap<Integer, Integer> map = new MultivaluedHashMap<>(); MultivaluedHashMap<Integer, Integer> differentMap = new MultivaluedHashMap<>(); map.put(1, Arrays.asList(1, 2, 3)); differentMap.put(1, Arrays.asList(1, 2, 2)); equalsIgnoreValueOrder_shouldReturnFalseForDifferentMaps(map, differentMap); map.clear(); differentMap.clear(); map.put(1, Arrays.asList(1, 2, 3)); map.put(2, Arrays.asList(4, 5, 6)); differentMap.put(1, Arrays.asList(1, 2, 3)); differentMap.put(2, Arrays.asList(4, 5, 5)); equalsIgnoreValueOrder_shouldReturnFalseForDifferentMaps(map, differentMap); }
Source:
private void checkNodeState() throws YarnException { GetClusterNodesRequest request = Records.newRecord(GetClusterNodesRequest.class); ClientRMService clientRMService = yarnCluster.getResourceManager().getClientRMService(); GetClusterNodesResponse response = clientRMService.getClusterNodes(request); List<NodeReport> nodeReports = response.getNodeReports(); LOG.info("{}", nodeReports); for (NodeReport nr: nodeReports) { if (nr.getNodeState().isUnusable()) { continue; } return; } fail("Yarn Mini cluster should have at least one usable node."); }

Target:
private void checkNodeState() throws YarnException { GetClusterNodesRequest request = Records.newRecord(GetClusterNodesRequest.class); ClientRMService clientRMService = yarnCluster.getResourceManager().getClientRMService(); GetClusterNodesResponse response = clientRMService.getClusterNodes(request); List<NodeReport> nodeReports = response.getNodeReports(); LOG.info("{}", nodeReports); for (NodeReport nr: nodeReports) { if (!nr.getNodeState().isUnusable()) { return; } } fail("Yarn Mini cluster should have at least one usable node."); }
Source:
boolean abortUndrainedBatches(RuntimeException reason) { boolean abortedSomeBatches = false; for (ProducerBatch batch : incomplete.copyAll()) { Deque<ProducerBatch> dq = getDeque(batch.topicPartition); boolean aborted = false; synchronized (dq) { if ((transactionManager != null && !batch.hasSequence()) || (transactionManager == null && !batch.isClosed())) { aborted = true; batch.abortRecordAppends(); dq.remove(batch); } } if (aborted) { batch.abort(reason); deallocate(batch); abortedSomeBatches = true; } } return abortedSomeBatches; }

Target:
void abortUndrainedBatches(RuntimeException reason) { for (ProducerBatch batch : incomplete.copyAll()) { Deque<ProducerBatch> dq = getDeque(batch.topicPartition); boolean aborted = false; synchronized (dq) { if ((transactionManager != null && !batch.hasSequence()) || (transactionManager == null && !batch.isClosed())) { aborted = true; batch.abortRecordAppends(); dq.remove(batch); } } if (aborted) { batch.abort(reason); deallocate(batch); } } }
Source:
public void updateComment_shouldNotUpdateTheCommentInTheDatabaseIfTheUserIsUnauthorized() throws Exception { PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline_name", "stage", "job"); goConfigService.addPipeline(pipelineConfig, "pipeline-group"); configHelper.addAuthorizedUserForPipelineGroup("valid-user"); dbHelper.newPipelineWithAllStagesPassed(pipelineConfig); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); pipelineHistoryService.updateComment("pipeline_name", 1, "test comment", new Username(new CaseInsensitiveString("invalid-user")), result); PipelineInstanceModel pim = dbHelper.getPipelineDao().findPipelineHistoryByNameAndCounter("pipeline_name", 1); assertThat(pim.getComment(), is(nullValue())); assertThat(result.httpCode(), is(401)); }

Target:
public void updateComment_shouldNotUpdateTheCommentInTheDatabaseIfTheUserIsUnauthorized() throws Exception { PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfig("pipeline_name", "stage", "job"); goConfigService.addPipeline(pipelineConfig, "pipeline-group"); configHelper.addAuthorizedUserForPipelineGroup("valid-user"); dbHelper.newPipelineWithAllStagesPassed(pipelineConfig); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); pipelineHistoryService.updateComment("pipeline_name", 1, "test comment", new Username(new CaseInsensitiveString("invalid-user")), result); PipelineInstanceModel pim = dbHelper.getPipelineDao().findPipelineHistoryByNameAndCounter("pipeline_name", 1); assertThat(pim.getComment(), is(nullValue())); assertThat(result.httpCode(), is(401)); assertThat(result.message(localizer), is("You do not have operate permissions for pipeline 'pipeline_name'.")); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EventBus.getDefault().register(this); if (discussionTopic == null) { String topicId = getArguments().getString(Router.EXTRA_DISCUSSION_TOPIC_ID); GetSpecificCourseTopicsTask getTopicsTask = new GetSpecificCourseTopicsTask(getContext(), courseData.getCourse().getId(), Collections.singletonList(topicId)) { @Override protected void onSuccess(CourseTopics courseTopics) throws Exception { super.onSuccess(courseTopics); discussionTopic = courseTopics.getCoursewareTopics().get(0).getChildren().get(0); getActivity().setTitle(discussionTopic.getName()); deferredRunnable.run(); } }; getTopicsTask.setProgressCallback(null); getTopicsTask.execute(); } else { getActivity().setTitle(discussionTopic.getName()); } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EventBus.getDefault().register(this); if (discussionTopic == null) { String topicId = getArguments().getString(Router.EXTRA_DISCUSSION_TOPIC_ID); GetSpecificCourseTopicsTask getTopicsTask = new GetSpecificCourseTopicsTask(getContext(), courseData.getCourse().getId(), Collections.singletonList(topicId)) { @Override protected void onSuccess(CourseTopics courseTopics) throws Exception { discussionTopic = courseTopics.getCoursewareTopics().get(0).getChildren().get(0); if (!getArguments().getBoolean(ARG_DISCUSSION_HAS_TOPIC_NAME)) { getActivity().setTitle(discussionTopic.getName()); } if (populatePostListRunnable != null) { populatePostListRunnable.run(); } } }; getTopicsTask.setProgressCallback(null); getTopicsTask.execute(); } else { getActivity().setTitle(discussionTopic.getName()); } }
Source:
public boolean submitTopology(String[] appConfs) { if (!this.topologyName.equals(this.topologyName.toLowerCase())) { LOG.log(Level.SEVERE, "K8s scheduler does not allow upper case topologies"); return false; } String deploymentURI = String.format( "%s/api/v1/namespaces/default/pods", this.kubernetesURI); boolean allSuccessful = true; for (int i = 0; i < appConfs.length; i++) { allSuccessful = deployContainer(appConfs[i]); if (!allSuccessful) { break; } } return allSuccessful; }

Target:
protected boolean submitTopology(String[] appConfs) { if (!this.topologyName.equals(this.topologyName.toLowerCase())) { throw new TopologySubmissionException("K8S scheduler does not allow upper case topologies."); } for (String appConf : appConfs) { try { deployContainer(appConf); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Problem deploying container with config: " + appConf); return false; } } return true; }
Source:
private static void assertTimestampCorrect(String timestampString) { Timestamp timestamp = Timestamp.valueOf(timestampString); NanoTime nanoTime = NanoTimeUtils.getNanoTime(timestamp, false); final ByteBuffer buffer = ByteBuffer.wrap(nanoTime.toBinary().getBytes()); long decodedTimestampMillis = getTimestampMillis(Binary.fromConstantByteBuffer(buffer)); assertEquals(decodedTimestampMillis, timestamp.getTime()); }

Target:
private static void assertTimestampCorrect(String timestampString) { Timestamp timestamp = Timestamp.valueOf(timestampString); NanoTime nanoTime = getNanoTime(timestamp, false); ByteBuffer buffer = ByteBuffer.wrap(nanoTime.toBinary().getBytes()); long decodedTimestampMillis = getTimestampMillis(fromConstantByteBuffer(buffer)); assertEquals(decodedTimestampMillis, timestamp.getTime()); }
Source:
public boolean equals(Object obj) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } MapMappingMethod other = (MapMappingMethod) obj; if ( !getResultType().equals( other.getResultType() ) ) { return false; } if ( getSourceParameters().size() != other.getSourceParameters().size() ) { return false; } for ( int i = 0; i < getSourceParameters().size(); i++ ) { if ( !getSourceParameters().get( i ).getType().equals( other.getSourceParameters().get( i ).getType() ) ) { return false; } if ( !getSourceParameters().get( i ).getType().getTypeParameters().get( 0 ) .equals( other.getSourceParameters().get( i ).getType().getTypeParameters().get( 0 ) ) ) { return false; } } return isMapNullToDefault() == other.isMapNullToDefault(); }

Target:
public boolean equals(Object obj) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } MapMappingMethod other = (MapMappingMethod) obj; if ( !getResultType().equals( other.getResultType() ) ) { return false; } if ( getSourceParameters().size() != other.getSourceParameters().size() ) { return false; } for ( int i = 0; i < getSourceParameters().size(); i++ ) { if ( !getSourceParameters().get( i ).getType().equals( other.getSourceParameters().get( i ).getType() ) ) { return false; } List<Type> thisTypeParameters = getSourceParameters().get( i ).getType().getTypeParameters(); List<Type> otherTypeParameters = other.getSourceParameters().get( i ).getType().getTypeParameters(); if ( !thisTypeParameters.equals( otherTypeParameters ) ) { return false; } } return isMapNullToDefault() == other.isMapNullToDefault(); }
Source:
public void testAllocateWithFreeSlot() throws Exception { final CompletableFuture<SlotRequest> slotRequestFuture = new CompletableFuture<>(); resourceManagerGateway.setRequestSlotConsumer(slotRequestFuture::complete); try (SlotPoolImpl slotPool = createAndSetUpSlotPool()) { slotPool.registerTaskManager(taskManagerLocation.getResourceID()); SlotRequestId requestId1 = new SlotRequestId(); CompletableFuture<PhysicalSlot> future1 = requestNewAllocatedSlot( slotPool, requestId1 ); assertFalse(future1.isDone()); final SlotRequest slotRequest = slotRequestFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); final SlotOffer slotOffer = new SlotOffer( slotRequest.getAllocationId(), 0, DEFAULT_TESTING_PROFILE); assertTrue(slotPool.offerSlot(taskManagerLocation, taskManagerGateway, slotOffer)); PhysicalSlot slot1 = future1.get(1, TimeUnit.SECONDS); assertTrue(future1.isDone()); slotPool.releaseSlot(requestId1, null); assertEquals(1, slotPool.getAvailableSlots().size()); assertEquals(0, slotPool.getAllocatedSlots().size()); Optional<PhysicalSlot> optional = slotPool.allocateAvailableSlot( new SlotRequestId(), slotRequest.getAllocationId() ); assertTrue(optional.isPresent()); PhysicalSlot slot2 = optional.get(); assertEquals(slot1, slot2); } }

Target:
public void testAllocateWithFreeSlot() throws Exception { final CompletableFuture<SlotRequest> slotRequestFuture = new CompletableFuture<>(); resourceManagerGateway.setRequestSlotConsumer(slotRequestFuture::complete); try (SlotPoolImpl slotPool = createAndSetUpSlotPool(resourceManagerGateway)) { final AllocationID allocationId = new AllocationID(); assertTrue(registerAndOfferSlot(taskManagerLocation, slotPool, allocationId)); assertEquals(1, slotPool.getAvailableSlots().size()); assertEquals(0, slotPool.getAllocatedSlots().size()); Optional<PhysicalSlot> physicalSlot = slotPool.allocateAvailableSlot( new SlotRequestId(), allocationId); assertTrue(physicalSlot.isPresent()); assertEquals(0, slotPool.getAvailableSlots().size()); assertEquals(1, slotPool.getAllocatedSlots().size()); } }
Source:
public String toString(Integer value) throws ValueConverterException { if (value == -1) { return "*"; } else { return value.toString(); } }

Target:
public String toString(Integer value) throws ValueConverterException { if (value == -1) { return Ecl.ANY; } else { return value.toString(); } }
Source:
private static void printEnvInfo(TestContext testCtx, PrintWriter out) { out.println( "" ); out.println( "TEST CONFIGURATION" ); out.println( " measure performance : " + TestConstants.arePerformanceTestsEnabled() ); out.println( " threads : " + THREADS_COUNT ); out.println( " measured cycles : " + testCtx.measuredCyclesCount ); out.println( " warmup cycles : " + testCtx.warmupCyclesCount ); out.println( " initial book count : " + testCtx.initialBookCount ); out.println( " initial author count : " + testCtx.initialAuthorCount ); out.println( " verbose : " + VERBOSE ); out.println( " measure memory : " + MEASURE_MEMORY ); out.println( " measure task time : " + MEASURE_TASK_TIME ); out.println( " check query results : " + ASSERT_QUERY_RESULTS ); out.println( " check index state : " + CHECK_INDEX_STATE ); out.println( "" ); out.println( "HIBERNATE SEARCH PROPERTIES" ); Map<String, Object> properties = testCtx.sessionFactory.getProperties(); for ( Entry<String, Object> e : properties.entrySet() ) { if ( e.getKey().toString().startsWith( "hibernate.search" ) ) { out.println( " " + e.getKey() + " = " + e.getValue() ); } } out.println( "" ); out.println( "VERSIONS" ); out.println( " org.hibernate.search : " + Version.getVersionString() ); out.println( " org.hibernate : " + org.hibernate.Version.getVersionString() ); out.println( "" ); }

Target:
private static void printEnvInfo(TestContext testCtx, PrintWriter out) { out.println( "" ); out.println( "TEST CONFIGURATION" ); out.println( " measure performance : " + TestConstants.arePerformanceTestsEnabled() ); out.println( " threads : " + testCtx.threadCount ); out.println( " measured cycles : " + testCtx.measuredCyclesCount ); out.println( " warmup cycles : " + testCtx.warmupCyclesCount ); out.println( " initial book count : " + testCtx.initialBookCount ); out.println( " initial author count: " + testCtx.initialAuthorCount ); out.println( " verbose : " + testCtx.verbose ); out.println( " measure memory : " + testCtx.measureMemory ); out.println( " measure task time : " + testCtx.measureTaskTime ); out.println( " check query results : " + testCtx.assertQueryResults ); out.println( " check index state : " + testCtx.checkIndexState ); out.println( "" ); out.println( "HIBERNATE SEARCH PROPERTIES" ); Map<String, Object> properties = testCtx.sessionFactory.getProperties(); for ( Entry<String, Object> e : properties.entrySet() ) { if ( e.getKey().toString().startsWith( "hibernate.search" ) ) { out.println( " " + e.getKey() + " = " + e.getValue() ); } } out.println( "" ); out.println( "VERSIONS" ); out.println( " org.hibernate.search : " + Version.getVersionString() ); out.println( " org.hibernate : " + org.hibernate.Version.getVersionString() ); out.println( "" ); }
Source:
static Uri createResourceUri(Context context, int resourceId) { return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + context.getPackageName() + "/" + resourceId); }

Target:
static Uri createResourceUri(Context context, int resourceId) { return new Uri.Builder().scheme(Picasso.SCHEME_RESOURCES) .appendPath(String.valueOf(resourceId)) .build(); }
Source:
private boolean shouldRunLogDeletion() { long lastLogDeletionRun = HiddenPreferences.getLastLogDeletionTime(); long aWeekBeforeNow = new Date().getTime() - (MILLISECONDS_IN_A_DAY * 7L); return new Date(lastLogDeletionRun).before(new Date(aWeekBeforeNow)); }

Target:
private boolean shouldRunLogDeletion() { long lastLogDeletionRun = HiddenPreferences.getLastLogDeletionTime(); long aWeekBeforeNow = new Date().getTime() - (DateUtils.DAY_IN_MILLIS * 7L); return new Date(lastLogDeletionRun).before(new Date(aWeekBeforeNow)); }
Source:
public JpaMetamodelEntityInformation(Class<T> domainClass, Metamodel metamodel) { super(domainClass); this.metamodel = metamodel; Assert.notNull(metamodel); ManagedType<T> type = metamodel.managedType(domainClass); if (type == null) { throw new IllegalArgumentException("The given domain class can not be found in the given Metamodel!"); } if (!(type instanceof IdentifiableType)) { throw new IllegalArgumentException("The given domain class does not contain an id attribute!"); } this.idMetadata = new IdMetadata<T>((IdentifiableType<T>) type); this.versionAttribute = findVersionAttribute(type); }

Target:
public JpaMetamodelEntityInformation(Class<T> domainClass, Metamodel metamodel) { super(domainClass); Assert.notNull(metamodel); this.metamodel = metamodel; ManagedType<T> type = metamodel.managedType(domainClass); if (type == null) { throw new IllegalArgumentException("The given domain class can not be found in the given Metamodel!"); } if (!(type instanceof IdentifiableType)) { throw new IllegalArgumentException("The given domain class does not contain an id attribute!"); } this.idMetadata = new IdMetadata<T>((IdentifiableType<T>) type); this.versionAttribute = findVersionAttribute(type); }
Source:
public MergingDigest fromByteBuffer(ByteBuffer buffer, int numBytes) { if (numBytes == 0) { return null; } buffer.limit(buffer.position() + numBytes); return MergingDigest.fromBytes(buffer); }

Target:
public MergingDigest fromByteBuffer(ByteBuffer buffer, int numBytes) { if (numBytes == 0) { return null; } ByteBuffer readOnlyBuffer = buffer.asReadOnlyBuffer(); readOnlyBuffer.limit(buffer.position() + numBytes); return MergingDigest.fromBytes(readOnlyBuffer); }
Source:
void buildClause(StringBuilder sb) { if (ctes.isEmpty()) { return; } sb.append("WITH "); if (recursive) { sb.append("RECURSIVE "); } boolean first = true; for (CTEInfo cte : ctes.values()) { if (first) { first = false; } else { sb.append(", "); } sb.append(cte.name); sb.append('('); final List<String> columnNames = cte.columnNames; sb.append(columnNames.get(0)); for (int i = 1; i < columnNames.size(); i++) { sb.append(", "); sb.append(columnNames.get(i)); } sb.append(')'); sb.append(" AS(\n"); sb.append(cte.nonRecursiveCriteriaBuilder.getQueryString()); if (cte.recursive) { sb.append("\nUNION ALL\n"); sb.append(cte.recursiveCriteriaBuilder.getQueryString()); } sb.append("\n)"); } sb.append("\n"); }

Target:
void buildClause(StringBuilder sb) { if (ctes.isEmpty()) { return; } sb.append("WITH "); if (recursive) { sb.append("RECURSIVE "); } boolean first = true; for (CTEInfo cte : ctes.values()) { if (first) { first = false; } else { sb.append(", "); } sb.append(cte.name); sb.append('('); final List<String> attributes = cte.attributes; sb.append(attributes.get(0)); for (int i = 1; i < attributes.size(); i++) { sb.append(", "); sb.append(attributes.get(i)); } sb.append(')'); sb.append(" AS(\n"); sb.append(cte.nonRecursiveCriteriaBuilder.getQueryString()); if (cte.recursive) { sb.append("\nUNION ALL\n"); sb.append(cte.recursiveCriteriaBuilder.getQueryString()); } sb.append("\n)"); } sb.append("\n"); }
Source:
public void onClickAd(@NonNull NendAdNativeVideo nendAdNativeVideo) { forwarder.adClicked(); handler.postDelayed(new Runnable() { @Override public void run() { forwarder.leftApplication(); } }, 1000); }

Target:
public void onClickAd(@NonNull NendAdNativeVideo nendAdNativeVideo) { forwarder.adClicked(); forwarder.leftApplication(); }
Source:
private void extractLambdaFromMethodCall(MethodCallExpr methodCallExpr, Supplier<MaterializedLambda> lambdaExtractor) { List<VariableDeclarator> bitMaskVariables = new ArrayList<>(); if (lambdaExtractor.get() instanceof MaterializedLambdaConsequence) { methodCallExpr.findAncestor(MethodDeclaration.class).ifPresent(node -> { bitMaskVariables.addAll(node.findAll(VariableDeclarator.class).stream() .filter(vd -> vd.getType().asString().equals(BitMask.class.getCanonicalName())) .collect(Collectors.toList())); }); } methodCallExpr.getArguments().forEach(a -> { if (a.isLambdaExpr()) { LambdaExpr lambdaExpr = a.asLambdaExpr(); try { CreatedClass aClass = lambdaExtractor.get().create(lambdaExpr.toString(), imports, staticImports, bitMaskVariables); lambdaClasses.put(aClass.getClassNameWithPackage(), aClass); ClassOrInterfaceType type = StaticJavaParser.parseClassOrInterfaceType(aClass.getClassNameWithPackage()); a.replace(lambdaInstance(type)); } catch(DoNotConvertLambdaException e) { logger.debug("Cannot externalize lambdas {}", e.getMessage()); } } }); }

Target:
private void extractLambdaFromMethodCall(MethodCallExpr methodCallExpr, Supplier<MaterializedLambda> lambdaExtractor) { methodCallExpr.getArguments().forEach(a -> { if (a.isLambdaExpr()) { LambdaExpr lambdaExpr = a.asLambdaExpr(); try { CreatedClass aClass = lambdaExtractor.get().create(lambdaExpr.toString(), imports, staticImports); lambdaClasses.put(aClass.getClassNameWithPackage(), aClass); ClassOrInterfaceType type = StaticJavaParser.parseClassOrInterfaceType(aClass.getClassNameWithPackage()); a.replace(lambdaInstance(type)); } catch(DoNotConvertLambdaException e) { logger.debug("Cannot externalize lambdas {}", e.getMessage()); } } }); }
Source:
public void processProfilesQueuedDuringInitialization_shouldNotThrowIndexOutOfBoundsException() { RegionAdvisor.QueuedBucketProfile qbp = new RegionAdvisor.QueuedBucketProfile(mock(InternalDistributedMember.class), serials, true); DistributionManager distributionManager = mock(DistributionManager.class); when(regionAdvisor.getDistributionManager()).thenReturn(distributionManager); when(distributionManager.isCurrentMember(any())).thenReturn(true); regionAdvisor.preInitQueue.add(qbp); ProxyBucketRegion pbr = mock(ProxyBucketRegion.class); when(pbr.getBucketAdvisor()).thenReturn(mock(BucketAdvisor.class)); regionAdvisor.buckets = new ProxyBucketRegion[] {pbr, pbr, pbr}; regionAdvisor.processProfilesQueuedDuringInitialization(); }

Target:
public void processProfilesQueuedDuringInitialization_shouldNotThrowIndexOutOfBoundsException() { RegionAdvisor.QueuedBucketProfile queuedBucketProfile = new RegionAdvisor.QueuedBucketProfile(mock(InternalDistributedMember.class), serials, true); DistributionManager distributionManager = mock(DistributionManager.class); when(regionAdvisor.getDistributionManager()).thenReturn(distributionManager); when(distributionManager.isCurrentMember(any())).thenReturn(true); regionAdvisor.preInitQueue.add(queuedBucketProfile); ProxyBucketRegion proxyBucketRegion = mock(ProxyBucketRegion.class); BucketAdvisor bucketAdvisor = mock(BucketAdvisor.class); when(proxyBucketRegion.getBucketAdvisor()).thenReturn(bucketAdvisor); regionAdvisor.buckets = new ProxyBucketRegion[] {proxyBucketRegion, proxyBucketRegion, proxyBucketRegion}; regionAdvisor.processProfilesQueuedDuringInitialization(); verify(bucketAdvisor, times(0)).removeIdWithSerial(any(InternalDistributedMember.class), anyInt(), anyBoolean()); }
Source:
public void revokeSession(String user) { String sql = "UPDATE " + tableName + " SET " + col.HAS_SESSION + "=? WHERE LOWER(" + col.NAME + ")=?;"; if (user != null) { try (PreparedStatement pst = con.prepareStatement(sql)) { pst.setInt(1, 0); pst.setString(2, user); pst.executeUpdate(); } catch (SQLException ex) { logSqlException(ex); } } }

Target:
public void revokeSession(String user) { String sql = "UPDATE " + tableName + " SET " + col.HAS_SESSION + "=? WHERE LOWER(" + col.NAME + ")=?;"; try (PreparedStatement pst = con.prepareStatement(sql)) { pst.setInt(1, 0); pst.setString(2, user); pst.executeUpdate(); } catch (SQLException ex) { logSqlException(ex); } }
Source:
private void applyTtlUpdate(MessageInfo messageInfo, RemoteReplicaInfo remoteReplicaInfo) throws IOException, MessageFormatException, StoreException { MessageFormatInputStream ttlUpdateStream = new TtlUpdateMessageFormatInputStream(messageInfo.getStoreKey(), messageInfo.getAccountId(), messageInfo.getContainerId(), messageInfo.getOperationTimeMs()); MessageInfo info = new MessageInfo(messageInfo.getStoreKey(), ttlUpdateStream.getSize(), false, true, messageInfo.getAccountId(), messageInfo.getContainerId(), messageInfo.getOperationTimeMs()); MessageFormatWriteSet writeSet = new MessageFormatWriteSet(ttlUpdateStream, Collections.singletonList(info), false); DataNodeId remoteNode = remoteReplicaInfo.getReplicaId().getDataNodeId(); try { remoteReplicaInfo.getLocalStore().updateTtl(writeSet); logger.trace("Remote node: Thread name: Remote replica: Key ttl updated id: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } catch (StoreException e) { if (e.getErrorCode() == StoreErrorCodes.ID_Deleted || e.getErrorCode() == StoreErrorCodes.Already_Updated) { logger.trace("Remote node: Thread name: Remote replica: Key already updated: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } else { throw e; } } if (notification != null) { notification.onBlobReplicaUpdated(dataNodeId.getHostname(), dataNodeId.getPort(), messageInfo.getStoreKey().getID(), BlobReplicaSourceType.REPAIRED, UpdateType.TTL_UPDATE, messageInfo); } }

Target:
private void applyTtlUpdate(MessageInfo messageInfo, RemoteReplicaInfo remoteReplicaInfo) throws IOException, MessageFormatException, StoreException { MessageFormatInputStream ttlUpdateStream = new TtlUpdateMessageFormatInputStream(messageInfo.getStoreKey(), messageInfo.getAccountId(), messageInfo.getContainerId(), messageInfo.getExpirationTimeInMs(), messageInfo.getOperationTimeMs()); MessageInfo info = new MessageInfo(messageInfo.getStoreKey(), ttlUpdateStream.getSize(), false, true, messageInfo.getExpirationTimeInMs(), messageInfo.getAccountId(), messageInfo.getContainerId(), messageInfo.getOperationTimeMs()); MessageFormatWriteSet writeSet = new MessageFormatWriteSet(ttlUpdateStream, Collections.singletonList(info), false); DataNodeId remoteNode = remoteReplicaInfo.getReplicaId().getDataNodeId(); try { remoteReplicaInfo.getLocalStore().updateTtl(writeSet); logger.trace("Remote node: Thread name: Remote replica: Key ttl updated id: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } catch (StoreException e) { if (e.getErrorCode() == StoreErrorCodes.ID_Deleted || e.getErrorCode() == StoreErrorCodes.Already_Updated) { logger.trace("Remote node: Thread name: Remote replica: Key already updated: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } else { throw e; } } if (notification != null) { notification.onBlobReplicaUpdated(dataNodeId.getHostname(), dataNodeId.getPort(), messageInfo.getStoreKey().getID(), BlobReplicaSourceType.REPAIRED, UpdateType.TTL_UPDATE, messageInfo); } }
Source:
public void setup() throws NamingException { TestUtil.cleanupSingletonSessionId(); Properties properties= new Properties(); properties.setProperty("mary", "HR"); properties.setProperty("john", "HR"); userGroupCallback = new JBossUserGroupCallbackImpl(properties); createRuntimeManager(); new InitialContext().rebind("java:comp/UserTransaction", com.arjuna.ats.jta.UserTransaction.userTransaction()); new InitialContext().rebind("java:comp/TransactionManager", TransactionManager.transactionManager()); new InitialContext().rebind("java:comp/TransactionSynchronizationRegistry", new com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple()); }

Target:
public void setup() throws NamingException { TestUtil.cleanupSingletonSessionId(); Properties properties= new Properties(); properties.setProperty("mary", "HR"); properties.setProperty("john", "HR"); userGroupCallback = new JBossUserGroupCallbackImpl(properties); createRuntimeManager(); }
Source:
private Collection<MpackRecommendationResponse.HostGroup> getHostgroups(ClusterTopology topology) { Map<StackId, String> mpackNameByStackId = topology.getMpacks().stream().collect( toMap( MpackInstance::getStackId, MpackInstance::getMpackName )); topology.getComponentsByHostgroup().entrySet().stream().collect( toMap( e -> e.getKey(), components -> components.getValue().stream() .map(comp -> MpackRecommendationResponse.HostGroup.createComponent(comp.componentName(), mpackNameByStackId.get(comp.stackId()), comp.serviceName().orElseGet(() -> comp.serviceType()))) .collect(toSet()) ) ); return null; }

Target:
private Collection<MpackRecommendationResponse.HostGroup> getHostgroups(ClusterTopology topology) { Map<StackId, String> mpackNameByStackId = topology.getMpacks().stream().collect( toMap( MpackInstance::getStackId, MpackInstance::getMpackName )); topology.getComponentsByHostGroup().entrySet().stream().collect( toMap( e -> e.getKey(), components -> components.getValue().stream() .map(comp -> MpackRecommendationResponse.HostGroup.createComponent(comp.componentName(), mpackNameByStackId.get(comp.stackId()), comp.serviceName().orElseGet(() -> comp.serviceType()))) .collect(toSet()) ) ); return null; }
Source:
public void testPopulateMenu() { placeManager = mock(PlaceManager.class); final DMNEditorMenuSessionItems menuItems = spy(new DMNEditorMenuSessionItems(builder, sessionCommands, placeManager)); final MenuItem menuItem = mock(MenuItem.class); doNothing().when(menuItems).superPopulateMenu(any()); doReturn(menuItem).when(menuItems).newPerformAutomaticLayout(); menuItems.populateMenu(fileMenuBuilder); verify(menuItems).addPerformAutomaticLayout(any()); }

Target:
public void testPopulateMenu() { final DMNEditorMenuSessionItems menuItems = spy(new DMNEditorMenuSessionItems(builder, sessionCommands, placeManager)); final MenuItem menuItem = mock(MenuItem.class); doNothing().when(menuItems).superPopulateMenu(any()); doReturn(menuItem).when(menuItems).newPerformAutomaticLayout(); menuItems.populateMenu(fileMenuBuilder); verify(menuItems).addPerformAutomaticLayout(any()); }
Source:
public static PcapFile getPcapFile(Path filePath) throws IOException, BadPcapFileException { if (filePath.getFileName().toString().endsWith(PCAPNG_EXTENSION)) { try (PcapFile dummy = new PcapNgFile(filePath)) { return dummy; } } try (PcapFile dummy = new PcapOldFile(filePath)) { return dummy; } }

Target:
public static PcapFile getPcapFile(Path filePath) throws IOException, BadPcapFileException { if (filePath.getFileName().toString().endsWith(PCAPNG_EXTENSION)) { return new PcapNgFile(filePath); } return new PcapOldFile(filePath); }
Source:
static Realm createAndValidate(RealmConfiguration configuration, ColumnIndices[] globalCacheArray) { Realm realm = new Realm(configuration); long currentVersion = realm.getVersion(); long requiredVersion = configuration.getSchemaVersion(); final ColumnIndices columnIndices = RealmCache.findColumnIndices(globalCacheArray, requiredVersion); if (!configuration.isSyncConfiguration()) { if (currentVersion != UNVERSIONED && currentVersion < requiredVersion && columnIndices == null) { realm.doClose(); throw new RealmMigrationNeededException(configuration.getPath(), String.format("Realm on disk need to migrate from v%s to v%s", currentVersion, requiredVersion)); } if (currentVersion != UNVERSIONED && requiredVersion < currentVersion && columnIndices == null) { realm.doClose(); throw new IllegalArgumentException(String.format("Realm on disk is newer than the one specified: v%s vs. v%s", currentVersion, requiredVersion)); } } if (columnIndices == null) { try { initializeRealm(realm); } catch (RuntimeException e) { realm.doClose(); throw e; } } else { realm.schema.columnIndices = columnIndices.clone(); } return realm; }

Target:
static Realm createAndValidate(RealmConfiguration configuration, ColumnIndices[] globalCacheArray) { Realm realm = new Realm(configuration); final long currentVersion = realm.getVersion(); final long requiredVersion = configuration.getSchemaVersion(); final ColumnIndices columnIndices = RealmCache.findColumnIndices(globalCacheArray, requiredVersion); if (columnIndices != null) { realm.schema.columnIndices = columnIndices.clone(); } else { final boolean syncingConfig = configuration.isSyncConfiguration(); if (!syncingConfig && (currentVersion != UNVERSIONED)) { if (currentVersion < requiredVersion) { realm.doClose(); throw new RealmMigrationNeededException( configuration.getPath(), String.format("Realm on disk need to migrate from v%s to v%s", currentVersion, requiredVersion)); } if (requiredVersion < currentVersion) { realm.doClose(); throw new IllegalArgumentException( String.format("Realm on disk is newer than the one specified: v%s vs. v%s", currentVersion, requiredVersion)); } } try { if (!syncingConfig) { initializeRealm(realm); } else { initializeSyncedRealm(realm); } } catch (RuntimeException e) { realm.doClose(); throw e; } } return realm; }
Source:
public void filterConfigurationChangesCapabilities() throws Exception { List<ConfigurationChange> filtered_S_configurationChanges = page.filter().setFilter("s").getAllConfigurationChanges(); Assert.assertTrue("Some unexpected differences found! Either some changes are not displayed or some extra appeared. Some could fail due to the <LINK_0>", isChangesListsEqual(changesResource.getFilteredConfigurationChanges(page.filter().getCurrentFilter()), filtered_S_configurationChanges)); List<ConfigurationChange> filtered_SU_configurationChanges = page.filter().appendSymbol('u').getAllConfigurationChanges(); Assert.assertTrue("Some unexpected differences found! Either some changes are not displayed or some extra appeared. Some could fail due to the <LINK_0>", isChangesListsEqual(changesResource.getFilteredConfigurationChanges(page.filter().getCurrentFilter()), filtered_SU_configurationChanges)); List<ConfigurationChange> filtered_STAR_configurationChanges = page.filter().appendSymbol('*').getAllConfigurationChanges(); Assert.assertTrue("Some unexpected configuration changes appeared.", filtered_STAR_configurationChanges.isEmpty()); Assert.assertTrue("Some unexpected differences found! Either some changes are not displayed or some extra appeared. Some could fail due to the <LINK_0>", isChangesListsEqual(filtered_SU_configurationChanges, page.filter().removeSymbol().getAllConfigurationChanges())); }

Target:
public void filterConfigurationChangesCapabilities() throws Exception { List<ConfigurationChange> filtered_S_configurationChanges = page.filter().setFilter("s").getAllConfigurationChanges(); Assert.assertTrue(LISTS_NOT_EQUAL_MESSAGE, isChangesListsEqual(changesResource.getFilteredConfigurationChanges(page.filter().getCurrentFilter()), filtered_S_configurationChanges)); List<ConfigurationChange> filtered_SU_configurationChanges = page.filter().appendSymbol('u').getAllConfigurationChanges(); Assert.assertTrue(LISTS_NOT_EQUAL_MESSAGE, isChangesListsEqual(changesResource.getFilteredConfigurationChanges(page.filter().getCurrentFilter()), filtered_SU_configurationChanges)); List<ConfigurationChange> filtered_STAR_configurationChanges = page.filter().appendSymbol('*').getAllConfigurationChanges(); Assert.assertTrue("Some unexpected configuration changes appeared.", filtered_STAR_configurationChanges.isEmpty()); Assert.assertTrue(LISTS_NOT_EQUAL_MESSAGE, isChangesListsEqual(filtered_SU_configurationChanges, page.filter().removeSymbol().getAllConfigurationChanges())); }
Source:
private DataFetcher buildDataFetcher(BuildContext buildCtx, TypeDefinition parentType, FieldDefinition fieldDef) { String fieldName = fieldDef.getName(); String parentTypeName = parentType.getName(); TypeDefinitionRegistry typeRegistry = buildCtx.getTypeRegistry(); RuntimeWiring runtimeWiring = buildCtx.getWiring(); WiringFactory wiringFactory = runtimeWiring.getWiringFactory(); FieldWiringEnvironment wiringEnvironment = new FieldWiringEnvironment(typeRegistry, parentType, fieldDef); DataFetcher dataFetcher; if (wiringFactory.providesDataFetcher(wiringEnvironment)) { dataFetcher = wiringFactory.getDataFetcher(wiringEnvironment); assertNotNull(dataFetcher, "The WiringFactory indicated it provides a data fetcher but then returned null"); } else { dataFetcher = runtimeWiring.getDataFetcherForType(parentTypeName).get(fieldName); if (dataFetcher == null) { dataFetcher = runtimeWiring.getDefaultDataFetcherForType(parentTypeName); if (dataFetcher == null) { dataFetcher = wiringFactory.getDefaultDataFetcher(wiringEnvironment); assertNotNull(dataFetcher, "The WiringFactory indicated MUST provide a data fetcher of last resort as part of its contract"); } } } return dataFetcher; }

Target:
private DataFetcher buildDataFetcher(BuildContext buildCtx, TypeDefinition parentType, FieldDefinition fieldDef) { String fieldName = fieldDef.getName(); String parentTypeName = parentType.getName(); TypeDefinitionRegistry typeRegistry = buildCtx.getTypeRegistry(); RuntimeWiring runtimeWiring = buildCtx.getWiring(); WiringFactory wiringFactory = runtimeWiring.getWiringFactory(); FieldWiringEnvironment wiringEnvironment = new FieldWiringEnvironment(typeRegistry, parentType, fieldDef); DataFetcher dataFetcher; if (wiringFactory.providesDataFetcher(wiringEnvironment)) { dataFetcher = wiringFactory.getDataFetcher(wiringEnvironment); assertNotNull(dataFetcher, "The WiringFactory indicated it provides a data fetcher but then returned null"); } else { dataFetcher = runtimeWiring.getDataFetcherForType(parentTypeName).get(fieldName); if (dataFetcher == null) { dataFetcher = runtimeWiring.getDefaultDataFetcherForType(parentTypeName); if (dataFetcher == null) { dataFetcher = wiringFactory.getDefaultDataFetcher(wiringEnvironment); assertNotNull(dataFetcher, "The WiringFactory indicated MUST provide a default data fetcher as part of its contract"); } } } return dataFetcher; }
Source:
private void doSave() { final Path path = getCanvasHandler().getDiagram().getMetadata().getPath(); stateHolder.saveFile(path, new ServiceCallback<String>() { @Override public void onSuccess(final String xml) { resetContentHash(); notificationEvent.fire(new NotificationEvent(org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants.INSTANCE.ItemSavedSuccessfully())); hideLoadingViews(); } @Override public void onError(final ClientRuntimeError error) { onSaveError(error); } }); }

Target:
private void doSave() { final Path path = getCanvasHandler().getDiagram().getMetadata().getPath(); getContent().then(xml -> { vfsService.saveFile(path, (String) xml, new ServiceCallback<String>() { @Override public void onSuccess(final String xml) { resetContentHash(); notificationEvent.fire(new NotificationEvent(INSTANCE.ItemSavedSuccessfully())); hideLoadingViews(); } @Override public void onError(final ClientRuntimeError error) { onSaveError(error); } }); return promises.resolve(); }); }
Source:
public final int hashCode() { return (int) (w2 >>> 32); }

Target:
public final int hashCode() { return (int) (w2); }