auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void before() { Map<String, List<String>> resultMap = new HashMap<String, List<String>>(); resultMap.put(ServiceTaskUploadFormPresenter.CREATED, createdList); resultMap.put(ServiceTaskUploadFormPresenter.SKIPPED, updatedList); when(serviceTaskService.addServiceTasks(any())).thenReturn(resultMap); presenter = spy(new ServiceTaskUploadFormPresenter(view, new CallerMock<ServiceTaskService>(serviceTaskService), notificationEvent, iocManager)); presenter.init(); when(view.getSuccessInstallMessage()).thenReturn(addTaskSuccess); when(view.getSkippedMessage()).thenReturn(updateTaskSuccess); }

Target:
public void before() { Map<String, List<String>> resultMap = new HashMap<String, List<String>>(); resultMap.put(ServiceTaskUploadFormPresenter.CREATED, createdList); resultMap.put(ServiceTaskUploadFormPresenter.SKIPPED, skippedList); when(serviceTaskService.addServiceTasks(any())).thenReturn(resultMap); presenter = spy(new ServiceTaskUploadFormPresenter(view, new CallerMock<ServiceTaskService>(serviceTaskService), notificationEvent, iocManager)); presenter.init(); when(view.getSuccessInstallMessage()).thenReturn(ADD_TASK_SUCCESS); when(view.getSkippedMessage(any())).thenReturn(SKIP_TASK_SUCCESS); }
Source:
public Result processWorkPackage(final I_C_Queue_WorkPackage workPackage, final String localTrxName) { final IQueueDAO queueDAO = Services.get(IQueueDAO.class); final IRequestBL requestBL = Services.get(IRequestBL.class); final I_C_Order order = queueDAO.retrieveItems(workPackage, I_C_Order.class, localTrxName).get(0); requestBL.createTestApplianceRequestFromOrder(order); return Result.SUCCESS; }

Target:
public Result processWorkPackage(final I_C_Queue_WorkPackage workPackage, final String localTrxName) { queueDAO.retrieveItems(workPackage, I_C_Order.class, localTrxName) .forEach(requestBL::createRequestFromOrder); return Result.SUCCESS; }
Source:
public void configureMessageChannel(MessageChannel channel, String channelName) { Assert.isAssignable(AbstractMessageChannel.class, channel.getClass()); AbstractMessageChannel messageChannel = (AbstractMessageChannel) channel; BindingProperties bindingProperties = this.channelBindingServiceProperties.getBindingProperties(channelName); final String contentType = bindingProperties.getContentType(); if (bindingProperties != null && StringUtils.hasText(contentType)) { MimeType mimeType = MessageConverterUtils.getMimeType(contentType); SmartMessageConverter messageConverter = this.compositeMessageConverterFactory.getMessageConverterForType(mimeType); Class<?>[] supportedDataTypes = this.compositeMessageConverterFactory.supportedDataTypes(mimeType); messageChannel.setDatatypes(supportedDataTypes); messageChannel.setMessageConverter(new MessageWrappingMessageConverter(messageConverter, mimeType)); messageChannel.addInterceptor(new ChannelInterceptorAdapter() { @Override public Message<?> preSend(Message<?> message, MessageChannel messageChannel) { Object contentTypeFromMessage = message.getHeaders().get(MessageHeaders.CONTENT_TYPE); if (contentTypeFromMessage == null) { return messageBuilderFactory .fromMessage(message) .setHeader(MessageHeaders.CONTENT_TYPE, contentType) .build(); } return message; } }); } }

Target:
public void configureMessageChannel(MessageChannel channel, String channelName) { Assert.isAssignable(AbstractMessageChannel.class, channel.getClass()); AbstractMessageChannel messageChannel = (AbstractMessageChannel) channel; BindingProperties bindingProperties = this.channelBindingServiceProperties.getBindingProperties(channelName); final String contentType = bindingProperties.getContentType(); if (StringUtils.hasText(contentType)) { MimeType mimeType = MessageConverterUtils.getMimeType(contentType); SmartMessageConverter messageConverter = this.compositeMessageConverterFactory.getMessageConverterForType(mimeType); Class<?>[] supportedDataTypes = this.compositeMessageConverterFactory.supportedDataTypes(mimeType); messageChannel.setDatatypes(supportedDataTypes); messageChannel.setMessageConverter(new MessageWrappingMessageConverter(messageConverter, mimeType)); messageChannel.addInterceptor(new ChannelInterceptorAdapter() { @Override public Message<?> preSend(Message<?> message, MessageChannel messageChannel) { Object contentTypeFromMessage = message.getHeaders().get(MessageHeaders.CONTENT_TYPE); if (contentTypeFromMessage == null) { return messageBuilderFactory .fromMessage(message) .setHeader(MessageHeaders.CONTENT_TYPE, contentType) .build(); } return message; } }); } }
Source:
public List<AggregatorFactory> getRequiredColumns() { return Arrays.<AggregatorFactory>asList(new StringFirstAggregatorFactory(fieldName, fieldName, maxStringBytes)); }

Target:
public List<AggregatorFactory> getRequiredColumns() { return Collections.singletonList(new StringFirstAggregatorFactory(fieldName, fieldName, maxStringBytes)); }
Source:
private String genericInfoContent(Map.Entry<String, String> pair) { return String.format(FOUT_SPACES_INDENT + "<%s %s=\"%s\" %s=\"%s\"/>", XMLTags.COMMON_INFO, XMLAttributes.COMMON_NAME, pair.getKey(), XMLAttributes.COMMON_VALUE, pair.getValue()); }

Target:
private String genericInfoContent(Map.Entry<String, String> pair) { return String.format(FOUR_SPACES_INDENT + TAG_WITH_TWO_ATTRIBUTES, XMLTags.COMMON_INFO, XMLAttributes.COMMON_NAME, pair.getKey(), XMLAttributes.COMMON_VALUE, pair.getValue()); }
Source:
public void updateInitialRunFields() { getIsSysprepPossible().setEntity(!vm.getCompatibilityVersion().greaterOrEquals(Version.v4_4) && getIsWindowsOS()); getIsSysprepEnabled().setEntity(!vm.getCompatibilityVersion().greaterOrEquals(Version.v4_4) && getInitializationType() == InitializationType.Sysprep); getIsCloudInitPossible().setEntity(!getIsWindowsOS()); getIsCloudInitEnabled().setEntity(getInitializationType() == InitializationType.CloudInit); getIsCloudInitEnabled().setIsAvailable(!getIsWindowsOS()); if (getIsSysprepPossible().getEntity() && getIsSysprepEnabled().getEntity()) { getVmInitModel().updateSysprepDomain(getVmInitModel().getSysprepDomain().getSelectedItem()); } }

Target:
public void updateInitialRunFields() { getIsSysprepPossible().setEntity(getIsWindowsOS()); getIsSysprepEnabled().setEntity(getInitializationType() == InitializationType.Sysprep); getIsCloudInitPossible().setEntity(!getIsWindowsOS()); getIsCloudInitEnabled().setEntity(getInitializationType() == InitializationType.CloudInit); getIsCloudInitEnabled().setIsAvailable(!getIsWindowsOS()); if (getIsSysprepPossible().getEntity() && getIsSysprepEnabled().getEntity()) { getVmInitModel().updateSysprepDomain(getVmInitModel().getSysprepDomain().getSelectedItem()); } }
Source:
private void doTestCriticalHeapAndQueryTimeout(VM server, VM client, final boolean disabledQueryMonitorForLowMem, final int queryTimeout, final boolean hitCriticalThreshold) { createLatchTestHook(server, hitCriticalThreshold, VM.getController()); AsyncInvocation queryExecution = invokeClientQuery(client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold, VM.getController()); try { criticalMemoryCountDownLatch.await(); } catch (InterruptedException e) { e.printStackTrace(); } if (hitCriticalThreshold) { vmHitsCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED_CRITICAL); } try { Thread.sleep(MAX_TEST_QUERY_TIMEOUT); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); } releaseHook(server); try { assertThat(queryExecution.get(60, SECONDS)).isEqualTo(0); } catch (Throwable e) { e.printStackTrace(); fail("queryExecution.getResult() threw Exception " + e.toString()); } }

Target:
private void doTestCriticalHeapAndQueryTimeout(VM server, VM client, final boolean disabledQueryMonitorForLowMem, final int queryTimeout, final boolean hitCriticalThreshold) throws InterruptedException { createLatchTestHook(server, hitCriticalThreshold, VM.getController()); AsyncInvocation queryExecution = invokeClientQuery(client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold, VM.getController()); criticalMemoryCountDownLatch.await(); if (hitCriticalThreshold) { vmHitsCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED_CRITICAL); } criticalMemorySetLatch.countDown(); Thread.sleep(MAX_TEST_QUERY_TIMEOUT); releaseHook(server); await().untilAsserted(() -> assertThat(queryExecution.get()).isEqualTo(0)); }
Source:
private ObjectId endObject(ObjectId id, long offset) throws IOException { PackedObjectInfo obj = new PackedObjectInfo(id); obj.setOffset(offset); obj.setCRC((int) packOut.crc32.getValue()); objectList.add(obj); objectMap.addIfAbsent(obj); packOut.flushStream(); return id; }

Target:
private ObjectId endObject(ObjectId id, long offset) { PackedObjectInfo obj = new PackedObjectInfo(id); obj.setOffset(offset); obj.setCRC((int) packOut.crc32.getValue()); objectList.add(obj); objectMap.addIfAbsent(obj); return id; }
Source:
INode toDirectory(UGIResolver ugi) { final FileStatus s = getFileStatus(); final AclStatus aclStatus = getAclStatus(); long permissions = ugi.getPermissionsProto(s, aclStatus); INodeDirectory.Builder b = INodeDirectory.newBuilder() .setModificationTime(s.getModificationTime()) .setNsQuota(DEFAULT_NAMESPACE_QUOTA) .setDsQuota(DEFAULT_STORAGE_SPACE_QUOTA) .setPermission(permissions); if (aclStatus != null) { throw new UnsupportedOperationException( "Acls not supported by ImageWriter"); } INode.Builder ib = INode.newBuilder() .setType(INode.Type.DIRECTORY) .setId(id) .setName(ByteString.copyFrom(string2Bytes(s.getPath().getName()))) .setDirectory(b); return ib.build(); }

Target:
INode toDirectory(UGIResolver ugi) { final FileStatus s = getFileStatus(); final AclStatus aclStatus = getAclStatus(); long permissions = ugi.getPermissionsProto(s, aclStatus); INodeDirectory.Builder b = INodeDirectory.newBuilder() .setModificationTime(s.getModificationTime()) .setNsQuota(DEFAULT_NAMESPACE_QUOTA) .setDsQuota(DEFAULT_STORAGE_SPACE_QUOTA) .setPermission(permissions); if (aclStatus != null) { throw new UnsupportedOperationException( "ACLs not supported by ImageWriter"); } INode.Builder ib = INode.newBuilder() .setType(INode.Type.DIRECTORY) .setId(id) .setName(ByteString.copyFrom(string2Bytes(s.getPath().getName()))) .setDirectory(b); return ib.build(); }
Source:
public void deleteTable(String tableName) throws IOException{ TableName tn = tableInfoFactory.getTableInfo(tableName); try{ if (admin.isTableEnabled(tn)) { admin.disableTable(tn); } admin.deleteTable(tn); }catch(TableNotFoundException ignored){ }catch (Exception e) { if (!admin.isTableEnabled(tn)){ admin.enableTable(tn); } throw e; } }

Target:
public void deleteTable(String tableName) throws IOException{ TableName tn = tableInfoFactory.getTableInfo(tableName); try{ if (admin.isTableEnabled(tn)) { admin.disableTable(tn); } admin.deleteTable(tn); }catch(TableNotFoundException ignored){ SpliceLogUtils.warn(LOG, "Table %s not found. It may be deleted by another running vacuum.", tableName); }catch (Exception e) { SpliceLogUtils.warn(LOG, "Deleting table %s failed", tableName); if (!admin.isTableEnabled(tn)){ SpliceLogUtils.warn(LOG, "Re-enable table %s", tableName); admin.enableTable(tn); } throw e; } }
Source:
protected void drawGuiContainerForegroundLayer(int mx, int my) { super.drawGuiContainerForegroundLayer(mx, my); helper.draw2(mx, my); ArrayList<String> list = new ArrayList<String>(); GL11.glColor4f(1f, 1f, 1f, 1f); for (Object o : inventorySlots.inventorySlots) { Slot slot = (Slot) o; if (slot.getHasStack() == false && mx - guiLeft >= slot.xDisplayPosition && my - guiTop >= slot.yDisplayPosition && mx - guiLeft < slot.xDisplayPosition + 17 && my - guiTop < slot.yDisplayPosition + 17) { list.clear(); SlotSkin comment = SlotSkin.none; if (slot instanceof ISlotWithComment) { ((ISlotWithComment) slot).getComment(list); int x, y; int strWidth = 0; for (String str : list) { int size = fontRendererObj.getStringWidth(str); if (size > strWidth) strWidth = size; } x = slot.xDisplayPosition; y = slot.yDisplayPosition; int xOffset = 0; if (guiLeft + x + strWidth + 30 > this.width) { xOffset -= strWidth + 20; } if (!list.isEmpty()) drawHoveringText((java.util.List) list, mx - guiLeft + xOffset, my - guiTop, fontRendererObj); } } } }

Target:
protected void drawGuiContainerForegroundLayer(int mx, int my) { super.drawGuiContainerForegroundLayer(mx, my); helper.draw2(mx, my); ArrayList<String> list = new ArrayList<String>(); GL11.glColor4f(1f, 1f, 1f, 1f); for (Object o : inventorySlots.inventorySlots) { Slot slot = (Slot) o; if (!slot.getHasStack() && mx - guiLeft >= slot.xPos && my - guiTop >= slot.yPos && mx - guiLeft < slot.xPos + 17 && my - guiTop < slot.yPos + 17) { list.clear(); if (slot instanceof ISlotWithComment) { ((ISlotWithComment) slot).getComment(list); int x, y; int strWidth = 0; for (String str : list) { int size = fontRenderer.getStringWidth(str); if (size > strWidth) strWidth = size; } x = slot.xPos; y = slot.yPos; int xOffset = 0; if (guiLeft + x + strWidth + 30 > this.width) { xOffset -= strWidth + 20; } if (!list.isEmpty()) drawHoveringText((java.util.List) list, mx - guiLeft + xOffset, my - guiTop, fontRenderer); } } } }
Source:
public String[] getVisibleColumns() { if (isShowColumns()) { IColumnPresentation presentation = getColumnPresentation(); if (presentation != null) { String[] columns = fVisibleColumns.get(presentation.getId()); if (columns == null) { return presentation.getInitialColumns(); } else { String[] available = presentation.getAvailableColumns(); for (String column2 : columns) { boolean columnAvailable = false; for (String element : available) { if (column2.equals(element)) { columnAvailable = true; } } if (!columnAvailable || presentation.getHeader(column2) == null) { fVisibleColumns.remove(presentation.getId()); fColumnOrder.remove(presentation.getId()); fColumnSizes.remove(presentation.getId()); return presentation.getInitialColumns(); } } } return columns; } } return null; }

Target:
public String[] getVisibleColumns() { if (isShowColumns()) { IColumnPresentation presentation = getColumnPresentation(); if (presentation != null) { String[] columns = fVisibleColumns.get(presentation.getId()); if (columns == null) { return presentation.getInitialColumns(); } else { String[] available = presentation.getAvailableColumns(); for (String column : columns) { boolean columnAvailable = false; for (String element : available) { if (column.equals(element)) { columnAvailable = true; } } if (!columnAvailable || presentation.getHeader(column) == null) { fVisibleColumns.remove(presentation.getId()); fColumnOrder.remove(presentation.getId()); fColumnSizes.remove(presentation.getId()); return presentation.getInitialColumns(); } } } return columns; } } return null; }
Source:
protected boolean getForcedDecimal( List featureCollections, GeoServer geoServer, Catalog catalog) { boolean forcedDecimal = false; for (int i = 0; i < featureCollections.size(); i++) { Boolean forced = getFeatureTypeInfoProperty( catalog, (FeatureCollection) featureCollections.get(i), fti -> fti.getForcedDecimal()); if (forced != null && forced.booleanValue()) { forcedDecimal = true; } } return forcedDecimal; }

Target:
protected boolean getForcedDecimal( List featureCollections, GeoServer geoServer, Catalog catalog) { boolean forcedDecimal = false; for (int i = 0; i < featureCollections.size(); i++) { Boolean forced = getFeatureTypeInfoProperty( catalog, (FeatureCollection) featureCollections.get(i), fti -> fti.getForcedDecimal()); if (Boolean.TRUE.equals(forced)) { forcedDecimal = true; } } return forcedDecimal; }
Source:
public void visitLambdaExpression(LambdaExpressionTree tree) { if ((isMethodInvocation(tree.body()) && isUsingLambdaParamAsArg(tree)) || isBlockInvokingMethod(tree.body())) { context.addIssue(tree, this, "Replace this lambda with a method reference."); } super.visitLambdaExpression(tree); }

Target:
public void visitLambdaExpression(LambdaExpressionTree tree) { if (isSingleMethodInvocationUsingLambdaParamAsArg(tree) || isBlockInvokingMethod(tree.body())) { context.addIssue(tree, this, "Replace this lambda with a method reference."); } super.visitLambdaExpression(tree); }
Source:
public void testPush() throws Exception { RestS3Service s3Client = EasyMock.createStrictMock(RestS3Service.class); EasyMock.expect(s3Client.putObject(EasyMock.anyString(), EasyMock.<S3Object>anyObject())) .andReturn(null) .atLeastOnce(); EasyMock.replay(s3Client); S3DataSegmentPusherConfig config = new S3DataSegmentPusherConfig(); config.bucket = "bucket"; config.baseKey = "key"; S3DataSegmentPusher pusher = new S3DataSegmentPusher(s3Client, config, new DefaultObjectMapper()); File tmpDir = Files.createTempDir(); tmpDir.deleteOnExit(); File tmp = new File(tmpDir, "version.bin"); tmp.deleteOnExit(); final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1}; Files.write(data, tmp); final long size = data.length; DataSegment segmentToPush = new DataSegment( "foo", new Interval("2015/2016"), "0", Maps.<String, Object>newHashMap(), Lists.<String>newArrayList(), Lists.<String>newArrayList(), new NoneShardSpec(), 0, size ); DataSegment segment = pusher.push(tmpDir, segmentToPush); Assert.assertEquals(segmentToPush.getSize(), segment.getSize()); EasyMock.verify(s3Client); }

Target:
public void testPush() throws Exception { RestS3Service s3Client = EasyMock.createStrictMock(RestS3Service.class); EasyMock.expect(s3Client.putObject(EasyMock.anyString(), EasyMock.<S3Object>anyObject())) .andReturn(null) .atLeastOnce(); EasyMock.replay(s3Client); S3DataSegmentPusherConfig config = new S3DataSegmentPusherConfig(); config.setBucket("bucket"); config.setBaseKey("key"); S3DataSegmentPusher pusher = new S3DataSegmentPusher(s3Client, config, new DefaultObjectMapper()); File tmp = tempFolder.newFile("version.bin"); final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1}; Files.write(data, tmp); final long size = data.length; DataSegment segmentToPush = new DataSegment( "foo", new Interval("2015/2016"), "0", Maps.<String, Object>newHashMap(), Lists.<String>newArrayList(), Lists.<String>newArrayList(), new NoneShardSpec(), 0, size ); DataSegment segment = pusher.push(tempFolder.getRoot(), segmentToPush); Assert.assertEquals(segmentToPush.getSize(), segment.getSize()); EasyMock.verify(s3Client); }
Source:
private static void printConfigurationInfo() throws IOException { log.info("Executing as " + System.getProperty("user.name") + '@' + InetAddress.getLocalHost().getHostName() + " on " + System.getProperty("os.name") + ' ' + System.getProperty("os.version") + ' ' + System.getProperty("os.arch") + "; " + System.getProperty("java.vm.name") + ' ' + System.getProperty("java.runtime.version") + ' ' + (DeflaterFactory.usingIntelDeflater() ? "IntelDeflater" : "JdkDeflater")); log.info("CREATE_INDEX:" + Defaults.CREATE_INDEX + ' ' + "CREATE_MD5:" + Defaults.CREATE_MD5 + ' ' + "USE_ASYNC_IO:" + Defaults.USE_ASYNC_IO + ' ' + "BUFFER_SIZE:" + Defaults.BUFFER_SIZE + ' ' + "COMPRESSION_LEVEL:" + Defaults.COMPRESSION_LEVEL + ' ' + "NON_ZERO_BUFFER_SIZE:" + Defaults.NON_ZERO_BUFFER_SIZE + ' ' + "CUSTOM_READER_FACTORY:" + Defaults.CUSTOM_READER_FACTORY); }

Target:
private static void printConfigurationInfo() throws IOException { log.info("Executing as " + System.getProperty("user.name") + '@' + InetAddress.getLocalHost().getHostName() + " on " + System.getProperty("os.name") + ' ' + System.getProperty("os.version") + ' ' + System.getProperty("os.arch") + "; " + System.getProperty("java.vm.name") + ' ' + System.getProperty("java.runtime.version") + ' ' + (DeflaterFactory.usingIntelDeflater() ? "IntelDeflater" : "JdkDeflater")); log.info(Defaults.allDefaults().entrySet().stream().map(e -> e.getKey() + ':' + e.getValue()).collect(Collectors.<String>joining(" "))); }
Source:
public Builder(Class<?> indexedType, ScopedAnalyzerReference scopedAnalyzer) { this.indexedType = indexedType; this.scopedAnalyzer = scopedAnalyzer; this.passThroughAnalyzer = new LuceneAnalyzerReference( PassThroughAnalyzer.INSTANCE ); }

Target:
public Builder(Class<?> indexedType, ScopedAnalyzerReference scopedAnalyzer) { this.indexedType = indexedType; this.scopedAnalyzer = scopedAnalyzer; this.passThroughAnalyzer = LuceneAnalyzerReference.PASS_THROUGH; }
Source:
protected GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount())); GlusterVolumeTaskStatusEntity entity = setStartTime((GlusterVolumeTaskStatusEntity) returnValue.getReturnValue()); updateHostIP(entity); return entity.sort(); }

Target:
protected GlusterVolumeTaskStatusEntity fetchTaskStatusDetails() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeRemoveBricksStatus, new GlusterVolumeRemoveBricksVDSParameters(getUpServerId(clusterId), volume.getName(), getParameters().getBricks(), volume.getReplicaCount())); GlusterVolumeTaskStatusEntity entity = setStartTime((GlusterVolumeTaskStatusEntity) returnValue.getReturnValue()); return updateHostDetails(entity); }
Source:
public void testGetList() { server.enqueue( new MockResponse().setBody(stringFromResource("/datacenter/list.json")) ); List<DataCenter> list = dataCenterApi().list(new DepthOptions().depth(1)); assertNotNull(list); assertEquals(list.size(), 3); assertEquals(list.get(0).properties().name(), "vea"); }

Target:
public void testGetList() throws InterruptedException { server.enqueue( new MockResponse().setBody(stringFromResource("/datacenter/list.json")) ); List<DataCenter> list = dataCenterApi().list(); assertNotNull(list); assertEquals(list.size(), 3); assertEquals(list.get(0).properties().name(), "vea"); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters"); }
Source:
public CachedTransition(final Node node, final Timeline timeline) { this.node = node; this.timeline.set(timeline); mementos = node == null ? mementos : new CacheMemento[]{new CacheMemento(node)}; statusProperty().addListener(observable -> { switch (getStatus()) { case RUNNING: starting(); break; default: stopping(); break; } }); }

Target:
public CachedTransition(final Node node, final Timeline timeline) { this.node = node; this.timeline.set(timeline); mementos = node == null ? new CacheMemento[0] : new CacheMemento[]{new CacheMemento(node)}; statusProperty().addListener(observable -> { if (getStatus() == Status.RUNNING) { starting(); } else { stopping(); } }); }
Source:
public Response getClusterServers() { ImmutableMap.Builder<String, Object> entityBuilder = new ImmutableMap.Builder<>(); entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_COORDINATOR, druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_COORDINATOR) .getAllNodes() ); entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_OVERLORD, druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_OVERLORD) .getAllNodes() ); entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_BROKER, druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_BROKER) .getAllNodes() ); entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_HISTORICAL, druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_HISTORICAL) .getAllNodes() ); Set<DiscoveryDruidNode> mmNodes = druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_MM) .getAllNodes(); if (!mmNodes.isEmpty()) { entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_MM, mmNodes); } Set<DiscoveryDruidNode> routerNodes = druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_ROUTER) .getAllNodes(); if (!routerNodes.isEmpty()) { entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_ROUTER, routerNodes); } return Response.status(Response.Status.OK).entity(entityBuilder.build()).build(); }

Target:
public Response getClusterServers() { ImmutableMap.Builder<String, Object> entityBuilder = new ImmutableMap.Builder<>(); entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_COORDINATOR, druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_COORDINATOR) .getAllNodes() ); entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_OVERLORD, druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_OVERLORD) .getAllNodes() ); entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_BROKER, druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_BROKER) .getAllNodes() ); entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_HISTORICAL, druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_HISTORICAL) .getAllNodes() ); Collection<DiscoveryDruidNode> mmNodes = druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_MM) .getAllNodes(); if (!mmNodes.isEmpty()) { entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_MM, mmNodes); } Collection<DiscoveryDruidNode> routerNodes = druidNodeDiscoveryProvider.getForNodeType(DruidNodeDiscoveryProvider.NODE_TYPE_ROUTER) .getAllNodes(); if (!routerNodes.isEmpty()) { entityBuilder.put(DruidNodeDiscoveryProvider.NODE_TYPE_ROUTER, routerNodes); } return Response.status(Response.Status.OK).entity(entityBuilder.build()).build(); }
Source:
protected String parseResourceName(String line) { if (line == null) { return null; } if (compilerPatterns.isEmpty()) { for (int i = 0; i < COMPILER_COMMAND_PATTERN_TEMPLATES.length; i++) { String patternTemplate = COMPILER_COMMAND_PATTERN_TEMPLATES[i]; String patternString = makePattern(patternTemplate); compilerPatterns.put(patternString, Pattern.compile(patternString)); } } Pattern pattern = compilerPatterns.get(line); Matcher fileMatcher = pattern != null ? pattern.matcher(line) : null; if (fileMatcher != null && fileMatcher.matches()) { int fileGroup = adjustFileGroup(); String sourceFileName = fileMatcher.group(fileGroup); return sourceFileName; } return null; }

Target:
protected String parseResourceName(String line) { if (line == null) { return null; } if (compilerPatterns == null) { compilerPatterns = new Pattern[COMPILER_COMMAND_PATTERN_TEMPLATES.length]; for (int i = 0; i < COMPILER_COMMAND_PATTERN_TEMPLATES.length; i++) { String patternTemplate = COMPILER_COMMAND_PATTERN_TEMPLATES[i]; String patternString = makePattern(patternTemplate); compilerPatterns[i] = Pattern.compile(patternString); } } for (Pattern pattern : compilerPatterns) { Matcher fileMatcher = pattern.matcher(line); if (fileMatcher.matches()) { int fileGroup = adjustFileGroup(); String sourceFileName = fileMatcher.group(fileGroup); return sourceFileName; } } return null; }
Source:
public boolean mkdirs(Path path) throws IOException { return getVolumeByPath(path).getFileSystem().mkdirs(path); }

Target:
public boolean mkdirs(Path path) throws IOException { return getFileSystemByPath(path).mkdirs(path); }
Source:
public void create(@PathVariable("entityTypeId") String entityTypeId, @RequestBody Map<String, Object> entityMap, HttpServletResponse response) { if (entityMap == null) { throw new MissingValueException("entity", "body"); } createInternal(entityTypeId, entityMap, response); }

Target:
public void create(@PathVariable("entityTypeId") String entityTypeId, @RequestBody Map<String, Object> entityMap, HttpServletResponse response) { createInternal(entityTypeId, entityMap, response); }
Source:
private DocumentModel addTags(CoreSession session, DocumentModel targetDoc, String tagString) { String[] tagList = tagString.split("\\|"); List<Map<String, Serializable>> tags = new ArrayList<>(); for (String tag : tagList) { Map<String, Serializable> tagMap = new HashMap<>(); tagMap.put("label", tag); tagMap.put("username", session.getPrincipal().getName()); tags.add(tagMap); } targetDoc.setPropertyValue("nxtag:tags", (Serializable) tags); return targetDoc; }

Target:
protected DocumentModel addTags(CoreSession session, DocumentModel targetDoc, String tagString) { String[] tagList = tagString.split("\\|"); String userName = session.getPrincipal().getName(); var tags = Arrays.stream(tagList) .map(s -> Map.of("label", s, "username", userName)) .collect(Collectors.toList()); targetDoc.setPropertyValue("nxtag:tags", (Serializable) tags); return targetDoc; }
Source:
public ModelAndView uploadFile(@PathVariable("candidateId") Long candidateId, @RequestParam(value = "file") final MultipartFile multipartFile, RedirectAttributes redirectAttributes) throws IOException { ModelAndView modelAndView = new ModelAndView(REDIRECT_URL_CANDIDATE_PAGE + "/" + candidateId); String fileName = multipartFile.getOriginalFilename(); try { CandidateDTO candidateDTO = candidateService.getCandidate(candidateId); String candidateCVFilename = candidateDTO.getCvFilename(); if (candidateCVFilename != null && !candidateCVFilename.isEmpty()) { throw new CandidateAlreadyHasCVFileException(); } fileValidator.validate(multipartFile); File file = createFile(candidateDTO, fileName); FileCopyUtils.copy(multipartFile.getBytes(), file); redirectAttributes.addFlashAttribute(FILE, fileName); redirectAttributes.addFlashAttribute(VALIDATION_SUCCESS_KEY, VALIDATION_FILE_SUCCESS_MESSAGE_KEY); candidateDTO.setCvFilename(fileName); candidateService.saveOrUpdate(candidateDTO); } catch (CandidateAlreadyHasCVFileException e) { log.error(FileUploadController.class.getName(), e); redirectAttributes.addFlashAttribute(VALIDATION_ERROR_KEY, CANDIDATE_ALREADY_HAS_CV_FILE_MESSAGE_KEY); } catch (FileValidationException e) { log.error(FileUploadController.class.getName(), e); redirectAttributes.addFlashAttribute(VALIDATION_ERROR_KEY, fileValidationRuleMapper.getMessageKeyByException(e)); } return modelAndView; }

Target:
public ModelAndView uploadFile(@PathVariable("candidateId") Long candidateId, @RequestParam(value = "file") final MultipartFile multipartFile, RedirectAttributes redirectAttributes) throws IOException { ModelAndView modelAndView = new ModelAndView(REDIRECT_URL_CANDIDATE_PAGE + "/" + candidateId); String fileName = multipartFile.getOriginalFilename(); try { CandidateDTO candidateDTO = candidateService.getCandidate(candidateId); String candidateCVFilename = candidateDTO.getCvFilename(); if (StringUtils.isNotBlank(candidateCVFilename)) { throw new CandidateAlreadyHasCVFileException(); } fileValidator.validate(multipartFile); File file = createFile(candidateId, fileName); FileCopyUtils.copy(multipartFile.getBytes(), file); redirectAttributes.addFlashAttribute(FILE, fileName); redirectAttributes.addFlashAttribute(VALIDATION_SUCCESS_KEY, VALIDATION_FILE_SUCCESS_MESSAGE_KEY); candidateDTO.setCvFilename(fileName); candidateService.saveOrUpdate(candidateDTO); } catch (CandidateAlreadyHasCVFileException e) { log.error(FileUploadController.class.getName(), e); redirectAttributes.addFlashAttribute(VALIDATION_ERROR_KEY, CANDIDATE_ALREADY_HAS_CV_FILE_MESSAGE_KEY); } catch (FileValidationException e) { log.error(FileUploadController.class.getName(), e); redirectAttributes.addFlashAttribute(VALIDATION_ERROR_KEY, fileValidationRuleMapper.getMessageKeyByException(e)); } return modelAndView; }
Source:
@Test public void concurrentSingletonAccess() throws Exception { final List<Future<Long>> futures = new ArrayList<Future<Long>>(); final ObjectGraph graph = ObjectGraph.create(new LatchingModule(latch)); for (int i = 0 ; i < PERCALE ; i++) { futures.add(es.submit(new Callable<Long>() { @Override public Long call() { latch.countDown(); return graph.get(Long.class); } })); } latch.countDown(); for (Future<Long> future : futures) { assertThat(future.get(1, TimeUnit.SECONDS)) .overridingErrorMessage("Lock failure - count should never increment") .isEqualTo(0); } }

Target:
@Test public void concurrentSingletonAccess() throws Exception { final List<Future<Long>> futures = new ArrayList<Future<Long>>(); final ObjectGraph graph = ObjectGraph.create(new LatchingModule(latch)); for (int i = 0; i < THREAD_COUNT; i++) { futures.add(es.submit(new Callable<Long>() { @Override public Long call() { latch.countDown(); return graph.get(Long.class); } })); } latch.countDown(); for (Future<Long> future : futures) { assertThat(future.get(1, TimeUnit.SECONDS)) .overridingErrorMessage("Lock failure - count should never increment") .isEqualTo(0); } }
Source:
public void run(boolean resetDB, int replicationFactor, boolean updateVersion) { URI script = getScript(); Map<String, ?> vars = this.getVars(resetDB, replicationFactor, true); buildCassalogIfNeeded(); cassalog.execute(script, this.getTags(), vars); if (updateVersion) { updateVersion(0, 0); } }

Target:
public void run(boolean resetDB, int replicationFactor, boolean updateVersion) { URI script = getScript(); Map<String, ?> vars = this.getVars(resetDB, replicationFactor); cassalog.execute(script, this.getTags(), vars); if (updateVersion) { updateVersion(0, 0); } }
Source:
Mono<Response<RecognizeLinkedEntitiesResult>> recognizeLinkedEntitiesWithResponse(String text, String language, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); return recognizeBatchLinkedEntitiesWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(response -> { Iterator<RecognizeLinkedEntitiesResult> linkedEntitiesResultIterator = response.getValue().iterator(); RecognizeLinkedEntitiesResult linkedEntitiesResult = null; if (response.getStatusCode() == 200 && linkedEntitiesResultIterator.hasNext()) { linkedEntitiesResult = linkedEntitiesResultIterator.next(); if (linkedEntitiesResult.isError()) { toTextAnalyticsException(linkedEntitiesResult.getError(), logger); } } return new SimpleResponse<>(response, linkedEntitiesResult); }); }

Target:
Mono<Response<RecognizeLinkedEntitiesResult>> recognizeLinkedEntitiesWithResponse(String text, String language, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); return recognizeBatchLinkedEntitiesWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(Transforms::processSingleResponseErrorResult); }
Source:
public int getClusterCount(String clusterName, String scheme, int partitionId) throws ServiceUnavailableException { FutureCallback<Integer> clusterCountFutureCallback = new FutureCallback<>(); Runnable callback = () -> { Set<URI> uris = _state.getUriProperties(clusterName).getProperty().getUriBySchemeAndPartition(scheme, partitionId); clusterCountFutureCallback.onSuccess((uris != null) ? uris.size() : 0); }; _state.listenToCluster(clusterName, (type, name) -> callback.run()); try { return clusterCountFutureCallback.get(_timeout, _unit); } catch (ExecutionException | TimeoutException | InterruptedException e) { die("ClusterInfo", "PEGA_1017, unable to retrieve cluster count for cluster: " + clusterName + ", scheme: " + scheme + ", partition: " + partitionId + ", exception: " + e.getMessage()); return -1; } }

Target:
public int getClusterCount(String clusterName, String scheme, int partitionId) throws ServiceUnavailableException { FutureCallback<Integer> clusterCountFutureCallback = new FutureCallback<>(); _state.listenToCluster(clusterName, (type, name) -> { if (_state.getUriProperties(clusterName).getProperty() != null) { Set<URI> uris = _state.getUriProperties(clusterName).getProperty().getUriBySchemeAndPartition(scheme, partitionId); clusterCountFutureCallback.onSuccess((uris != null) ? uris.size() : 0); } else { clusterCountFutureCallback.onSuccess(0); } }); try { return clusterCountFutureCallback.get(_timeout, _unit); } catch (ExecutionException | TimeoutException | IllegalStateException | InterruptedException e ) { die("ClusterInfo", "PEGA_1017, unable to retrieve cluster count for cluster: " + clusterName + ", scheme: " + scheme + ", partition: " + partitionId + ", exception: " + e); return -1; } }
Source:
public void onLocationChanged(Location location) { if (!inViewMode && !isManualSelectedLocation) { this.location = location; if (this.location != null && location.getAccuracy() < lastLocationAccuracy) { lastLocationAccuracy = location.getAccuracy(); drawMarker(); } } }

Target:
public void onLocationChanged(Location location) { if (!inViewMode && !isManualSelectedLocation) { if (location != null && (this.location == null || (location.getAccuracy() < this.location.getAccuracy()))) { this.location = location; drawMarker(); } } }
Source:
public ResourceManager getResourceManager() { synchronized (this) { if (resourceManager == null) { Display display = Display.getCurrent(); if (display == null && PlatformUI.isWorkbenchRunning()) { display = PlatformUI.getWorkbench().getDisplay(); } if (display == null) { throw new SWTError(SWT.ERROR_THREAD_INVALID_ACCESS); } resourceManager = new LocalResourceManager( JFaceResources.getResources(display)); } } return resourceManager; }

Target:
public synchronized ResourceManager getResourceManager() { if (resourceManager == null) { Display display = PlatformUI.getWorkbench().getDisplay(); if (display == null) { throw new IllegalStateException(); } resourceManager = new LocalResourceManager(JFaceResources .getResources(display)); } return resourceManager; }
Source:
private void deleteBlob(final String blobId, FutureResult<Void> futureResult, final Callback<Void> callback) { deleteManager.submitDeleteBlobOperation(blobId, futureResult, new Callback<Void>() { @Override public void onCompletion(Void result, Exception exception) { if (exception == null) { backgroundDeleter.initiateChunkDeletesIfAny(blobId); } callback.onCompletion(result, exception); } }); readyForPollCallback.onPollReady(); }

Target:
private void deleteBlob(final String blobId, FutureResult<Void> futureResult, final Callback<Void> callback) { deleteManager.submitDeleteBlobOperation(blobId, futureResult, new Callback<Void>() { @Override public void onCompletion(Void result, Exception exception) { if (exception == null) { backgroundDeleter.initiateChunkDeletesIfAny(blobId); } if (callback != null) { callback.onCompletion(result, exception); } } }); readyForPollCallback.onPollReady(); }
Source:
public SonarLintHotspotsListPanel(Project project) { this.project = project; treeModel = new DefaultTreeModel(null); hotspotsTree = new Tree(treeModel); hotspotsTree.setCellRenderer(new HotspotCellRenderer()); hotspotsTree.getEmptyText().setText("No hotspot to display, open one from SonarQube"); EditSourceOnDoubleClickHandler.install(hotspotsTree, this::navigateToLocation); EditSourceOnEnterKeyHandler.install(hotspotsTree, this::navigateToLocation); }

Target:
public SonarLintHotspotsListPanel(Project project) { this.project = project; treeModel = new DefaultTreeModel(null); hotspotsTree = new Tree(treeModel); hotspotsTree.setCellRenderer(new HotspotCellRenderer()); hotspotsTree.getEmptyText().setText("No hotspots to display, open one from SonarQube"); EditSourceOnDoubleClickHandler.install(hotspotsTree, this::navigateToLocation); EditSourceOnEnterKeyHandler.install(hotspotsTree, this::navigateToLocation); }
Source:
static void detectLanguagesCountryHintRunner(BiConsumer<List<String>, String> testRunner) { final List<String> inputs = new ArrayList<>(Arrays.asList( "This is written in English", "Este es un document escrito en Español.", "~@!~:)")); testRunner.accept(inputs, "US"); }

Target:
static void detectLanguagesCountryHintRunner(BiConsumer<List<String>, String> testRunner) { final List<String> inputs = Arrays.asList( "This is written in English", "Este es un document escrito en Español.", "~@!~:)"); testRunner.accept(inputs, "en"); }
Source:
public void connectionObserverTests() { final String url = "tcp://123.123.123.123"; final String name = "TestName12@!"; MqttBrokerConnection a; try { a = new MqttBrokerConnection(name, url, false); } catch (ConfigurationException e) { fail(); return; } assertFalse(a.isConnectionObservers()); isConnected = true; MqttConnectionObserver connectionObserver = new MqttConnectionObserver() { @Override public void setConnected(boolean connected) { isConnected = connected; } }; a.addConnectionObserver(connectionObserver); assertFalse(isConnected); assertTrue(a.isConnectionObservers()); a.removeConnectionObserver(connectionObserver); assertFalse(a.isConnectionObservers()); }

Target:
public void connectionObserverTests() throws ConfigurationException { final String url = "tcp://123.123.123.123"; final String name = "TestName12@!"; MqttBrokerConnection a = new MqttBrokerConnection(name, url, false); assertFalse(a.isConnectionObservers()); MqttConnectionObserver connectionObserver = mock(MqttConnectionObserver.class); a.addConnectionObserver(connectionObserver); verify(connectionObserver).setConnected(false); assertTrue(a.isConnectionObservers()); a.removeConnectionObserver(connectionObserver); assertFalse(a.isConnectionObservers()); }
Source:
void populate(final int row, final PluginInfo plugin) { if (plugin.disabled() || plugin.indexUrl() == null) { table.setText(row, 1, plugin.name()); } else { table.setWidget(row, 1, new Anchor(plugin.name(), Gerrit.selfRedirect(plugin.indexUrl()), "_blank")); if (new ExtensionScreen(plugin.name() + "/settings").isFound()) { Anchor adminScreenAcnhcor = new Anchor(new ImageResourceRenderer().render(Gerrit.RESOURCES.gear()), Gerrit.selfRedirect("#/x/" + plugin.name() + "/settings")); adminScreenAcnhcor.setTitle(Util.C.pluginSettingsToolTip()); table.setWidget(row, 2, adminScreenAcnhcor); } } table.setText(row, 3, plugin.version()); table.setText(row, 4, plugin.disabled() ? Util.C.pluginDisabled() : Util.C.pluginEnabled()); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell()); setRowItem(row, plugin); }

Target:
void populate(final int row, final PluginInfo plugin) { if (plugin.disabled() || plugin.indexUrl() == null) { table.setText(row, 1, plugin.name()); } else { table.setWidget(row, 1, new Anchor(plugin.name(), Gerrit.selfRedirect(plugin.indexUrl()), "_blank")); if (new ExtensionScreen(plugin.name() + "/settings").isFound()) { InlineHyperlink adminScreenLink = new InlineHyperlink(); adminScreenLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.gear())); adminScreenLink.setTargetHistoryToken("/x/" + plugin.name() + "/settings"); adminScreenLink.setTitle(Util.C.pluginSettingsToolTip()); table.setWidget(row, 2, adminScreenLink); } } table.setText(row, 3, plugin.version()); table.setText(row, 4, plugin.disabled() ? Util.C.pluginDisabled() : Util.C.pluginEnabled()); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell()); setRowItem(row, plugin); }
Source:
public void testAnswerQuestion() { DateData ans; FormEntryController fec = fpi.getFormEntryController(); FormEntryPrompt prompt; fec.jumpToIndex(FormIndex.createBeginningOfFormIndex()); Localizer l = fpi.getFormDef().getLocalizer(); l.setDefaultLocale(l.getAvailableLocales()[0]); l.setLocale(l.getAvailableLocales()[0]); do { QuestionDef q = fpi.getCurrentQuestion(); if (q == null) { continue; } ans = new DateData(new Date()); fec.answerQuestion(ans); fec.stepToNextEvent(); prompt = fpi.getFormEntryModel().getQuestionPrompt(); String unwrappedDateString = prompt.getLongText(); String javaDateString = new SimpleDateFormat("dd MMM, yyyy").format(new Date()); assertEquals(javaDateString, unwrappedDateString); fec.stepToNextEvent(); prompt = fpi.getFormEntryModel().getQuestionPrompt(); unwrappedDateString = prompt.getLongText(); javaDateString = new SimpleDateFormat("dd MMM, yyyy").format(new Date()); assertEquals(javaDateString, unwrappedDateString); } while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM); }

Target:
public void testAnswerQuestion() { DateData ans; FormEntryController fec = fpi.getFormEntryController(); FormEntryPrompt prompt; fec.jumpToIndex(FormIndex.createBeginningOfFormIndex()); Localizer l = fpi.getFormDef().getLocalizer(); l.setDefaultLocale(l.getAvailableLocales()[0]); l.setLocale(l.getAvailableLocales()[0]); fec.stepToNextEvent(); ans = new DateData(new Date()); fec.answerQuestion(ans); fec.stepToNextEvent(); prompt = fpi.getFormEntryModel().getQuestionPrompt(); String unwrappedDateString = prompt.getLongText(); String javaDateString = new SimpleDateFormat("dd MMM, yyyy", Locale.US).format(new Date()); assertEquals(javaDateString, unwrappedDateString); fec.stepToNextEvent(); prompt = fpi.getFormEntryModel().getQuestionPrompt(); unwrappedDateString = prompt.getLongText(); javaDateString = new SimpleDateFormat("dd MMM, yyyy", Locale.US).format(new Date()); assertEquals(javaDateString, unwrappedDateString); }
Source:
public @NonNull Multimap<@NonNull String, @NonNull Object> getMetadata() { return HashMultimap.create(); }

Target:
public @NonNull Multimap<@NonNull String, @NonNull Object> getMetadata() { return fModel.getMetadata(); }
Source:
public static SDIndex interval(Integer begin, Integer strides, Integer end){ if(strides == 0){ throw new ND4JIllegalArgumentException("Invalid index : strides can not be 0."); } SDIndex sdIndex = new SDIndex(); sdIndex.indexType = IndexType.INTERVAL; sdIndex.interval_begin = begin; sdIndex.interval_end = end; sdIndex.interval_strides = strides; return sdIndex; }

Target:
public static SDIndex interval(Integer begin, Integer strides, Integer end){ if(strides == 0){ throw new ND4JIllegalArgumentException("Invalid index : strides can not be 0."); } SDIndex sdIndex = new SDIndex(); sdIndex.indexType = IndexType.INTERVAL; if(begin != null) { sdIndex.intervalBegin = begin.longValue(); } if(end != null){ sdIndex.intervalEnd = end.longValue(); } if(strides != null){ sdIndex.intervalStrides = strides.longValue(); } return sdIndex; }
Source:
public Collection<? extends GrantedAuthority> mapAuthorities(Collection<? extends GrantedAuthority> externalAuthorities) { logger.debug(String.format("Map authorities [%s]", externalAuthorities)); Collection<? extends GrantedAuthority> result = externalAuthorities.stream() .map(GrantedAuthority::getAuthority) .map(a -> getRolesMapping().get(a)) .filter(a -> a != null) .map(a -> new SimpleGrantedAuthority(a)) .collect(Collectors.toSet()); logger.debug(String.format("Authorities mapped [%s]", result)); return result; }

Target:
public Collection<? extends GrantedAuthority> mapAuthorities(Collection<? extends GrantedAuthority> externalAuthorities) { logger.debug(String.format("Map authorities [%s]", externalAuthorities)); Collection<? extends GrantedAuthority> result = externalAuthorities.stream() .map(GrantedAuthority::getAuthority) .map(a -> getRolesMapping().get(a)) .filter(Objects::nonNull) .map(SimpleGrantedAuthority::new) .collect(Collectors.toSet()); logger.debug(String.format("Authorities mapped [%s]", result)); return result; }
Source:
public void runCommand(final String idTopMenuCommand, final String idCommandName) { WebDriverWait redrawMenuItemsWait = new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC); loader.waitOnClosed(); try { redrawMenuItemsWait .until(ExpectedConditions.visibilityOfElementLocated(By.id(idTopMenuCommand))) .click(); } catch (WebDriverException ex) { LOG.error(ex.getLocalizedMessage(), ex); WaitUtils.sleepQuietly(REDRAW_UI_ELEMENTS_TIMEOUT_SEC, TimeUnit.MILLISECONDS); redrawMenuItemsWait .until(ExpectedConditions.visibilityOfElementLocated(By.id(idTopMenuCommand))) .click(); } try { redrawMenuItemsWait .until(ExpectedConditions.visibilityOfElementLocated(By.id(idCommandName))) .click(); } catch (TimeoutException e) { seleniumWebDriver.findElement(By.id(idTopMenuCommand)).click(); redrawMenuItemsWait .until(ExpectedConditions.visibilityOfElementLocated(By.id(idCommandName))) .click(); } redrawMenuItemsWait.until( ExpectedConditions.invisibilityOfElementLocated(By.id(idCommandName))); }

Target:
public void runCommand(final String idTopMenuCommand, final String idCommandName) { loader.waitOnClosed(); try { redrawMenuItemsWait .until(ExpectedConditions.visibilityOfElementLocated(By.id(idTopMenuCommand))) .click(); } catch (WebDriverException ex) { LOG.error(ex.getLocalizedMessage(), ex); WaitUtils.sleepQuietly(REDRAW_UI_ELEMENTS_TIMEOUT_SEC, TimeUnit.MILLISECONDS); redrawMenuItemsWait .until(ExpectedConditions.visibilityOfElementLocated(By.id(idTopMenuCommand))) .click(); } try { redrawMenuItemsWait .until(ExpectedConditions.visibilityOfElementLocated(By.id(idCommandName))) .click(); } catch (TimeoutException e) { seleniumWebDriver.findElement(By.id(idTopMenuCommand)).click(); redrawMenuItemsWait .until(ExpectedConditions.visibilityOfElementLocated(By.id(idCommandName))) .click(); } redrawMenuItemsWait.until( ExpectedConditions.invisibilityOfElementLocated(By.id(idCommandName))); }