auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void setupReq() throws Exception{ MetaClass meta = Mockito.mock(MetaClass.class); SingleLinkedList<MethodRef> list = SingleLinkedList.empty(); given(meta.getPostConstructMethods()).willReturn(list); WebApp webApp = Mockito.mock(WebApp.class); setFinal(webApp, WebApp.class.getDeclaredField("bindInterceptors"), new ArrayList<BindInterceptor>(0)); given(webApp.getMetaClass(Mockito.any(GhprbTrigger.class))).willReturn(meta); req = Mockito.mock(RequestImpl.class); given(req.bindJSON(any(Class.class), any(JSONObject.class))).willCallRealMethod(); given(req.bindJSON(any(Class.class), any(Class.class), any(JSONObject.class))).willCallRealMethod(); given(req.setBindInterceptpr(any(BindInterceptor.class))).willCallRealMethod(); given(req.setBindListener(any(BindInterceptor.class))).willCallRealMethod(); given(req.getBindInterceptor()).willReturn(BindInterceptor.NOOP); given(req.getWebApp()).willReturn(webApp); req.setBindListener(BindInterceptor.NOOP); req.setBindInterceptpr(BindInterceptor.NOOP); req.setBindInterceptor(BindInterceptor.NOOP); }

Target:
private static void setupReq() throws Exception{ MetaClass meta = Mockito.mock(MetaClass.class); SingleLinkedList<MethodRef> list = SingleLinkedList.empty(); given(meta.getPostConstructMethods()).willReturn(list); WebApp webApp = Mockito.mock(WebApp.class); setFinal(webApp, WebApp.class.getDeclaredField("bindInterceptors"), new ArrayList<BindInterceptor>(0)); given(webApp.getMetaClass(Mockito.any(GhprbTrigger.class))).willReturn(meta); req = Mockito.mock(RequestImpl.class); given(req.bindJSON(any(Class.class), any(JSONObject.class))).willCallRealMethod(); given(req.bindJSON(any(Class.class), any(Class.class), any(JSONObject.class))).willCallRealMethod(); given(req.setBindInterceptor(any(BindInterceptor.class))).willCallRealMethod(); given(req.setBindListener(any(BindInterceptor.class))).willCallRealMethod(); given(req.getWebApp()).willReturn(webApp); req.setBindListener(BindInterceptor.NOOP); req.setBindInterceptpr(BindInterceptor.NOOP); req.setBindInterceptor(BindInterceptor.NOOP); }
Source:
private ContentLayer( final Builder builder ) { Preconditions.checkNotNull( builder.key, "Name cannot be null" ); Preconditions.checkNotNull( builder.displayName, "Display name cannot be null" ); key = builder.key; parentKeys = builder.parentKeys.build(); displayName = builder.displayName; description = builder.description; locale = builder.locale; icon = builder.icon; }

Target:
private ContentLayer( final Builder builder ) { Preconditions.checkNotNull( builder.key, "Key cannot be null" ); Preconditions.checkNotNull( builder.displayName, "Display name cannot be null" ); key = builder.key; parentKeys = builder.parentKeys.build(); displayName = builder.displayName; description = builder.description; locale = builder.locale; icon = builder.icon; }
Source:
private Properties getAssetProperties(Asset asset) { Properties assetProperties = new Properties(); assetProperties.put(CuCamsConstants.CapAssetApi.CAPITAL_ASSET_NUMBER, asset.getCapitalAssetNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAMPUS_TAG_NUMBER_ATTRIBUTE, asset.getCampusTagNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.BUILDING_CODE, asset.getBuildingCode()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.ROOM_NUMBER, asset.getBuildingRoomNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.ORGANIZATION_INVENTORY_NAME, asset.getOrganizationInventoryName()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.SERIAL_NUMBER, asset.getSerialNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAPITAL_ASSET_DESCRIPTION, asset.getCapitalAssetDescription()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.LAST_UPDATED, asset.getLastUpdatedTimestamp().toString()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.LAST_INVENTORY_DATE, asset.getLastInventoryDate().toString()); return assetProperties; }

Target:
private Properties getAssetProperties(Asset asset) { Properties assetProperties = new Properties(); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAPITAL_ASSET_NUMBER, asset.getCapitalAssetNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAMPUS_TAG_NUMBER_ATTRIBUTE, asset.getCampusTagNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.BUILDING_CODE, asset.getBuildingCode()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.ROOM_NUMBER, asset.getBuildingRoomNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.ORGANIZATION_INVENTORY_NAME, asset.getOrganizationInventoryName()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.SERIAL_NUMBER, asset.getSerialNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAPITAL_ASSET_DESCRIPTION, asset.getCapitalAssetDescription()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.LAST_UPDATED, asset.getLastUpdatedTimestamp().toString()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.LAST_INVENTORY_DATE, asset.getLastInventoryDate().toString()); return assetProperties; }
Source:
public static File extract(File toExtract) throws Exception { String dir = getMd5hash(toExtract); if (dir == null) { dir = UUID.randomUUID().toString(); } File targetDir = new File(DRONE_TARGET_DIRECTORY + File.separator + dir); synchronized (log) { if (!targetDir.exists() || targetDir.listFiles().length == 0) { targetDir.mkdirs(); String filePath = toExtract.getAbsolutePath(); log.info("Extracting zip file: " + toExtract + " to " + targetDir.getPath()); if (filePath.endsWith(".zip")) { Spacelift.task(toExtract, UnzipTool.class).toDir(targetDir).execute().await(); } else if (filePath.endsWith(".tar.gz")) { Spacelift.task(toExtract, UntarTool.class).gzip(true).toDir(targetDir).execute().await(); } else if (filePath.endsWith(".tar.bz2")) { Spacelift.task(toExtract, UntarTool.class).bzip2(true).toDir(targetDir).execute().await(); } else { log.info( "The file " + toExtract + " is not compressed by format by a format that is supported by Drone. " + "Drone supported formats are .zip, .tar.gz, .tar.bz2. The file will be only copied"); targetDir.mkdirs(); Files.copy(toExtract.toPath(), new File(targetDir + File.separator + toExtract.getName()).toPath(), StandardCopyOption.REPLACE_EXISTING); } } } return targetDir; }

Target:
public static File extract(File toExtract) throws Exception { String dir = getMd5hash(toExtract); if (dir == null) { dir = UUID.randomUUID().toString(); } File targetDir = new File(DRONE_TARGET_DIRECTORY + File.separator + dir); synchronized (log) { if (!targetDir.exists() || targetDir.listFiles().length == 0) { targetDir.mkdirs(); String filePath = toExtract.getAbsolutePath(); log.info("Extracting zip file: " + toExtract + " to " + targetDir.getPath()); if (filePath.endsWith(".zip")) { Spacelift.task(toExtract, UnzipTool.class).toDir(targetDir).execute().await(); } else if (filePath.endsWith(".tar.gz")) { Spacelift.task(toExtract, UntarTool.class).gzip(true).toDir(targetDir).execute().await(); } else if (filePath.endsWith(".tar.bz2")) { Spacelift.task(toExtract, UntarTool.class).bzip2(true).toDir(targetDir).execute().await(); } else { log.info( "The file " + toExtract + " is not compressed by a format that is supported by Drone. " + "Drone supported formats are .zip, .tar.gz, .tar.bz2. The file will be only copied"); targetDir.mkdirs(); Files.copy(toExtract.toPath(), new File(targetDir + File.separator + toExtract.getName()).toPath(), StandardCopyOption.REPLACE_EXISTING); } } } return targetDir; }
Source:
public AsyncSplitSource(CloseableIterator<T> iterator, Function<T, ? extends ConnectorSplit> toSplit, Executor executor) { this.iterator = new SynchronizedCloseableIterator<>(iterator); this.toSplit = requireNonNull(toSplit, "toSplit is null"); this.executor = requireNonNull(executor, "execute is null"); }

Target:
public AsyncSplitSource(CloseableIterator<T> iterator, Function<T, ? extends ConnectorSplit> toSplit, Executor executor) { this.iterator = new SynchronizedCloseableIterator<>(iterator); this.toSplit = requireNonNull(toSplit, "toSplit is null"); this.executor = requireNonNull(executor, "executor is null"); }
Source:
public void processAst(IASTTranslationUnit ast) { ast.accept(new ASTVisitor() { { shouldVisitDeclarations = true; } @Override public int visit(IASTDeclaration declaration) { if (declaration instanceof IASTSimpleDeclaration) { IASTSimpleDeclaration simple = (IASTSimpleDeclaration) declaration; IASTDeclarator decls[] = ((IASTSimpleDeclaration) declaration).getDeclarators(); if (simple.getDeclSpecifier().getStorageClass() == IASTDeclSpecifier.sc_static && declaration.getTranslationUnit().isHeaderUnit()) { if (decls.length > 0) { for (IASTDeclarator d : decls) { IBinding binding = d.getName().resolveBinding(); if (binding != null && binding instanceof IVariable) { try { IScope scope = binding.getScope(); if (scope == null) return PROCESS_CONTINUE; if (scope.getKind() == EScopeKind.eGlobal || scope.getKind() == EScopeKind.eNamespace) reportProblem(STATIC_VAR_ID, declaration, d.getName()); } catch (DOMException e) { CodanCheckersActivator.log(e); } } } } } if (decls.length == 0) return PROCESS_CONTINUE; if (decls.length != 1) reportProblem(VAR_MULTI_DEC_ID, declaration); } return PROCESS_CONTINUE; } }); }

Target:
public void processAst(IASTTranslationUnit ast) { ast.accept(new ASTVisitor() { { shouldVisitDeclarations = true; } @Override public int visit(IASTDeclaration declaration) { if (declaration instanceof IASTSimpleDeclaration) { IASTSimpleDeclaration simple = (IASTSimpleDeclaration) declaration; IASTDeclarator decls[] = ((IASTSimpleDeclaration) declaration).getDeclarators(); if (simple.getDeclSpecifier().getStorageClass() == IASTDeclSpecifier.sc_static && declaration.getTranslationUnit().isHeaderUnit()) { for (IASTDeclarator d : decls) { IBinding binding = d.getName().resolveBinding(); if (binding != null && binding instanceof IVariable) { try { IScope scope = binding.getScope(); if (scope == null) return PROCESS_CONTINUE; if (scope.getKind() == EScopeKind.eGlobal || scope.getKind() == EScopeKind.eNamespace) reportProblem(STATIC_VAR_ID, declaration, d.getName()); } catch (DOMException e) { CodanCheckersActivator.log(e); } } } } if (declaration.getParent() instanceof IASTDeclarationStatement) { IASTDeclarationStatement declStatement = (IASTDeclarationStatement) declaration.getParent(); IASTNode node = declStatement.getParent(); if (node instanceof IASTForStatement || node instanceof IASTIfStatement || node instanceof IASTSwitchStatement) { return PROCESS_CONTINUE; } } if (decls.length == 0) return PROCESS_CONTINUE; if (decls.length != 1) reportProblem(VAR_MULTI_DEC_ID, declaration); } return PROCESS_CONTINUE; } }); }
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); Passphrase transferCode = getArguments().getParcelable(EXTRA_TRANSFER_CODE); ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity); CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(theme); @SuppressLint("InflateParams") View view = LayoutInflater.from(theme).inflate(R.layout.api_display_transfer_code, null, false); alert.setView(view); alert.setPositiveButton("Got it", (dialog, which) -> dismiss()); TextView[] transferCodeTextViews = new TextView[9]; transferCodeTextViews[0] = view.findViewById(R.id.transfer_code_block_1); transferCodeTextViews[1] = view.findViewById(R.id.transfer_code_block_2); transferCodeTextViews[2] = view.findViewById(R.id.transfer_code_block_3); transferCodeTextViews[3] = view.findViewById(R.id.transfer_code_block_4); transferCodeTextViews[4] = view.findViewById(R.id.transfer_code_block_5); transferCodeTextViews[5] = view.findViewById(R.id.transfer_code_block_6); transferCodeTextViews[6] = view.findViewById(R.id.transfer_code_block_7); transferCodeTextViews[7] = view.findViewById(R.id.transfer_code_block_8); transferCodeTextViews[8] = view.findViewById(R.id.transfer_code_block_9); setTransferCode(transferCodeTextViews, transferCode); return alert.create(); }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); Passphrase transferCode = getArguments().getParcelable(EXTRA_TRANSFER_CODE); ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity); CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(theme); @SuppressLint("InflateParams") View view = LayoutInflater.from(theme).inflate(R.layout.api_display_transfer_code, null, false); alert.setView(view); alert.setPositiveButton(R.string.button_got_it, (dialog, which) -> dismiss()); TextView[] transferCodeTextViews = new TextView[9]; transferCodeTextViews[0] = view.findViewById(R.id.transfer_code_block_1); transferCodeTextViews[1] = view.findViewById(R.id.transfer_code_block_2); transferCodeTextViews[2] = view.findViewById(R.id.transfer_code_block_3); transferCodeTextViews[3] = view.findViewById(R.id.transfer_code_block_4); transferCodeTextViews[4] = view.findViewById(R.id.transfer_code_block_5); transferCodeTextViews[5] = view.findViewById(R.id.transfer_code_block_6); transferCodeTextViews[6] = view.findViewById(R.id.transfer_code_block_7); transferCodeTextViews[7] = view.findViewById(R.id.transfer_code_block_8); transferCodeTextViews[8] = view.findViewById(R.id.transfer_code_block_9); setTransferCode(transferCodeTextViews, transferCode); return alert.create(); }
Source:
private Map<String, String> retrieveByLocale(Locale locale, String messageSource, Map<String, String> messages) { try { ResourceBundle bundle = ResourceBundle.getBundle(messageSource, locale); for (String key : bundle.keySet()) { if (!messages.containsKey(key)) { messages.put(key, bundle.getString(key)); } else { log.warn("Code '{}' appears more than once in string table.", key); } } } catch (RuntimeException e) { log.error("File: '{}' could not be loaded: {}", messageSource, e.toString()); log.debug("Exception", e); } return messages; }

Target:
private Map<String, String> retrieveByLocale(Locale locale, String messageSource, Map<String, String> messages) { try { ResourceBundle bundle = ResourceBundle.getBundle(messageSource, locale); for (String key : bundle.keySet()) { if (!messages.containsKey(key)) { messages.put(key, bundle.getString(key)); } else { log.warn("Code '{}' appears more than once in string table.", key); } } } catch (RuntimeException e) { log.error("File: '{}' could not be loaded: {}", messageSource, e.getMessage()); log.debug("Exception", e); } return messages; }
Source:
static boolean isJdtCoreSettingsResource(IResource resource) { IPath resourcePath = resource.getProjectRelativePath(); String prefs = JavaProject.DEFAULT_PREFERENCES_DIRNAME + File.separator + JavaProject.JAVA_CORE_PREFS_FILE; IPath expectedPath = Path.fromPortableString(prefs); boolean isJdtCoreSettingsResource = expectedPath.equals(resourcePath); return isJdtCoreSettingsResource; }

Target:
static boolean isJdtCoreSettingsResource(IResource resource) { IPath resourcePath = resource.getProjectRelativePath(); String prefs = JavaProject.DEFAULT_PREFERENCES_DIRNAME + IPath.SEPARATOR + JavaProject.JAVA_CORE_PREFS_FILE; IPath expectedPath = Path.fromPortableString(prefs); boolean isJdtCoreSettingsResource = expectedPath.equals(resourcePath); return isJdtCoreSettingsResource; }
Source:
private Tags(Map<String, String> tags, boolean isObject) throws IllegalArgumentException { if (tags == null) { return; } if (isObject) { if (tags.size() > MAX_OBJECT_TAG_COUNT) { throw new IllegalArgumentException( "too many object tags; allowed = " + MAX_OBJECT_TAG_COUNT + ", found = " + tags.size()); } } else if (tags.size() > MAX_TAG_COUNT) { throw new IllegalArgumentException( "too many bucket tags; allowed = " + MAX_TAG_COUNT + ", found = " + tags.size()); } for (Map.Entry<String, String> entry : tags.entrySet()) { String key = entry.getKey(); if (key.length() == 0 || key.length() > MAX_KEY_LENGTH || key.contains("&")) { throw new IllegalArgumentException("invalid tag key '" + key + "'"); } String value = entry.getValue(); if (value.length() > MAX_VALUE_LENGTH || value.contains("&")) { throw new IllegalArgumentException("invalid tag value '" + value + "'"); } } this.tags = Collections.unmodifiableMap(tags); }

Target:
private Tags(Map<String, String> tags, boolean isObject) throws IllegalArgumentException { if (tags == null) { return; } int limit = isObject ? MAX_OBJECT_TAG_COUNT : MAX_TAG_COUNT; if (tags.size() > limit) { throw new IllegalArgumentException( "too many " + (isObject ? "object" : "bucket") + " tags; allowed = " + limit + ", found = " + tags.size()); } for (Map.Entry<String, String> entry : tags.entrySet()) { String key = entry.getKey(); if (key.length() == 0 || key.length() > MAX_KEY_LENGTH || key.contains("&")) { throw new IllegalArgumentException("invalid tag key '" + key + "'"); } String value = entry.getValue(); if (value.length() > MAX_VALUE_LENGTH || value.contains("&")) { throw new IllegalArgumentException("invalid tag value '" + value + "'"); } } this.tags = Collections.unmodifiableMap(tags); }
Source:
public void testFieldFQNTypeIsMaintainedIfAnotherImportExists() { final JavaClassSource javaClass = Roaster.create(JavaClassSource.class); javaClass.setPackage("testPackage").setName("Main"); javaClass.addField().setName("field1").setType("package1.Type"); javaClass.addField().setName("field2").setType("package2.Type"); assertThat(javaClass.getField("field2").getType().getQualifiedName()) .isEqualTo("pa\ckage2.Type"); }

Target:
public void testFieldFQNTypeIsMaintainedIfAnotherImportExists() { final JavaClassSource javaClass = Roaster.create(JavaClassSource.class); javaClass.setPackage("testPackage").setName("Main"); javaClass.addField().setName("field1").setType("package1.Type"); javaClass.addField().setName("field2").setType("package2.Type"); assertThat(javaClass.getField("field2").getType().getQualifiedName()) .isEqualTo("package2.Type"); }
Source:
public static void createOverrideAnnotation(ASTRewrite rewrite, ImportRewrite imports, MethodDeclaration decl, TextEditGroup group) { if (isOverrideAnnotationPresent(decl)) return; Annotation marker= rewrite.getAST().newMarkerAnnotation(); ImportRewriteContext context; ASTNode root= decl.getRoot(); if (root instanceof CompilationUnit) { context= new ContextSensitiveImportRewriteContext((CompilationUnit) root, decl.getStartPosition(), imports); } else { context= null; } marker.setTypeName(rewrite.getAST().newName(imports.addImport("java.lang.Override", context))); rewrite.getListRewrite(decl, MethodDeclaration.MODIFIERS2_PROPERTY).insertFirst(marker, group); }

Target:
public static void createOverrideAnnotation(ASTRewrite rewrite, ImportRewrite imports, MethodDeclaration decl, TextEditGroup group) { if (findAnnotation("java.lang.Override", decl.modifiers()) != null) { return; } AST ast= rewrite.getAST(); Annotation marker= ast.newMarkerAnnotation(); ImportRewriteContext context= null; ASTNode root= decl.getRoot(); if (root instanceof CompilationUnit) { context= new ContextSensitiveImportRewriteContext((CompilationUnit) root, decl.getStartPosition(), imports); } marker.setTypeName(ast.newName(imports.addImport("java.lang.Override", context))); rewrite.getListRewrite(decl, MethodDeclaration.MODIFIERS2_PROPERTY).insertFirst(marker, group); }
Source:
public void setNodeTokens(String nodeUrl, List<String> tokens) throws RMException { if (tokens.stream().filter(token -> token == null || token.isEmpty()).findFirst().isPresent()) { throw new RMException("Invalid empty token in list " + tokens); } if (allNodes.containsKey(nodeUrl)) { RMNode rmNode = allNodes.get(nodeUrl); rmNode.setNodeTokens(nodeUrl, tokens); persistUpdatedRMNodeIfRecoveryEnabled(rmNode); registerAndEmitNodeEvent(rmNode.createNodeEvent(RMEventType.NODE_STATE_CHANGED, rmNode.getState(), rmNode.getProvider().getName())); } else { throw new RMException("Unknown node " + nodeUrl); } }

Target:
public void setNodeTokens(String nodeUrl, List<String> tokens) throws RMException { if (tokens.stream().anyMatch(token -> token == null || token.isEmpty())) { throw new RMException("Invalid empty token in list " + tokens); } if (allNodes.containsKey(nodeUrl)) { RMNode rmNode = allNodes.get(nodeUrl); rmNode.setNodeTokens(nodeUrl, tokens); persistUpdatedRMNodeIfRecoveryEnabled(rmNode); registerAndEmitNodeEvent(rmNode.createNodeEvent(RMEventType.NODE_STATE_CHANGED, rmNode.getState(), rmNode.getProvider().getName())); } else { throw new RMException("Unknown node " + nodeUrl); } }
Source:
public void update() { if(isClientWorld()) { return; } if(!isActive()) { if(tick == 0) { checkMultiblockStructure(); } } else { if(tick % 4 == 0) { heatItems(); interactWithEntitiesInside(); } if(needsFuel) { consumeFuel(); } } tick = (tick + 1) % 20; }

Target:
public void update() { if(isClientWorld()) { return; } if(!isActive()) { if(tick == 0) { checkMultiblockStructure(); } } else { if(tick % 4 == 0) { heatItems(); } if(tick == 0) { interactWithEntitiesInside(); } if(needsFuel) { consumeFuel(); } } tick = (tick + 1) % 20; }
Source:
public static List<String> getReferencedTypes(final File file) { ArrayList<String> references = new ArrayList<>(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; dbf.setAttribute("<LINK_0>", Boolean.FALSE); try { db = dbf.newDocumentBuilder(); Document document; document = db.parse(file); Node rootNode = document.getDocumentElement(); NodeList childNodes = rootNode.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node n = childNodes.item(i); if (n.getNodeName().equals(LibraryElementTags.RESOURCE_ELEMENT)) { String type = ""; type = n.getAttributes().getNamedItem(LibraryElementTags.TYPE_ATTRIBUTE).getNodeValue(); references.add(type); } } } catch (Exception e) { Activator.getDefault().logError(e.getMessage(), e); } return references; }

Target:
public static List<String> getReferencedTypes(final File file) { List<String> references = new ArrayList<>(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; dbf.setAttribute("<LINK_0>", Boolean.FALSE); try { db = dbf.newDocumentBuilder(); Document document; document = db.parse(file); Node rootNode = document.getDocumentElement(); NodeList childNodes = rootNode.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node n = childNodes.item(i); if (n.getNodeName().equals(LibraryElementTags.RESOURCE_ELEMENT)) { String type = ""; type = n.getAttributes().getNamedItem(LibraryElementTags.TYPE_ATTRIBUTE).getNodeValue(); references.add(type); } } } catch (Exception e) { Activator.getDefault().logError(e.getMessage(), e); } return references; }
Source:
protected boolean addVmImages() { if (getVmTemplate().getDiskMap().size() > 0) { if (getVm().getStatus() != VMStatus.Down) { log.error("Cannot add images. VM is not Down"); throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } VmHandler.LockVm(getVmId()); for (DiskImage dit : getImagesToCheckDestinationStorageDomains()) { CreateSnapshotFromTemplateParameters tempVar = new CreateSnapshotFromTemplateParameters( dit.getImageId(), getParameters().getVmStaticData().getId()); tempVar.setDestStorageDomainId(diskInfoDestinationMap.get(dit.getId()).getStorageIds().get(0)); tempVar.setDiskAlias(diskInfoDestinationMap.get(dit.getId()).getDiskAlias()); tempVar.setStorageDomainId(dit.getStorageIds().get(0)); tempVar.setVmSnapshotId(getVmSnapshotId()); tempVar.setParentCommand(VdcActionType.AddVm); tempVar.setEntityInfo(getParameters().getEntityInfo()); tempVar.setParentParameters(getParameters()); tempVar.setQuotaId(diskInfoDestinationMap.get(dit.getId()).getQuotaId()); VdcReturnValueBase result = getBackend().runInternalAction(VdcActionType.CreateSnapshotFromTemplate, tempVar, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (!result.getSucceeded()) { throw new VdcBLLException(result.getFault().getError()); } else { getTaskIdList().addAll(result.getInternalVdsmTaskIdList()); DiskImage newImage = (DiskImage) result.getActionReturnValue(); srcDiskToTargetDiskMapping.put(dit.getId(), newImage.getId()); newDiskImages.add(newImage); } } } return true; }

Target:
protected boolean addVmImages() { if (getVmTemplate().getDiskMap().size() > 0) { if (getVm().getStatus() != VMStatus.Down) { log.error("Cannot add images. VM is not Down"); throw new VdcBLLException(VdcBllErrors.IRS_IMAGE_STATUS_ILLEGAL); } VmHandler.LockVm(getVmId()); for (DiskImage dit : getImagesToCheckDestinationStorageDomains()) { CreateSnapshotFromTemplateParameters tempVar = new CreateSnapshotFromTemplateParameters( dit.getImageId(), getParameters().getVmStaticData().getId()); tempVar.setDestStorageDomainId(diskInfoDestinationMap.get(dit.getId()).getStorageIds().get(0)); tempVar.setDiskAlias(diskInfoDestinationMap.get(dit.getId()).getDiskAlias()); tempVar.setStorageDomainId(dit.getStorageIds().get(0)); tempVar.setVmSnapshotId(getVmSnapshotId()); tempVar.setParentCommand(VdcActionType.AddVm); tempVar.setEntityInfo(getParameters().getEntityInfo()); tempVar.setParentParameters(getParameters()); tempVar.setQuotaId(diskInfoDestinationMap.get(dit.getId()).getQuotaId()); VdcReturnValueBase result = getBackend().runInternalAction(VdcActionType.CreateSnapshotFromTemplate, tempVar, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (!result.getSucceeded()) { throw new VdcBLLException(result.getFault().getError()); } else { getTaskIdList().addAll(result.getInternalVdsmTaskIdList()); DiskImage newImage = (DiskImage) result.getActionReturnValue(); srcDiskIdToTargetDiskIdMapping.put(dit.getId(), newImage.getId()); } } } return true; }
Source:
public void testGetCinderDiskByDiskAndImageIds() { Guid cinderImageId = new Guid("42058975-3d5e-484a-80c1-01c31207f580"); DiskImage result = dao.getDiskImageByDiskAndImageIds(FixturesTool.FLOATING_CINDER_DISK_ID, cinderImageId); assertNotNull(result); assertEquals(FixturesTool.FLOATING_CINDER_DISK_ID, result.getId()); assertEquals(cinderImageId, result.getImageId()); }

Target:
public void testGetCinderDiskByDiskAndImageIds() { DiskImage result = dao.getDiskImageByDiskAndImageIds( FixturesTool.FLOATING_CINDER_DISK_ID, FixturesTool.CINDER_IMAGE_ID); assertNotNull(result); assertEquals(FixturesTool.FLOATING_CINDER_DISK_ID, result.getId()); assertEquals(FixturesTool.CINDER_IMAGE_ID, result.getImageId()); }
Source:
public void test_A_topology() throws Exception { Cluster cluster = consumer.readTopology(); String json = mapper.writeValueAsString(cluster.toMap()); System.out.println(json); assertThat(json, equalTo(read("/topology.json"))); }

Target:
public void test_A_topology() throws Exception { Cluster cluster = consumer.readTopology(); String json = mapper.writeValueAsString(cluster.toMap()); System.out.println(json); }
Source:
public void testInsertPartitionedTableOverwriteExistingPartition() { for (TestingHiveStorageFormat storageFormat : getAllTestingHiveStorageFormat(immutablePartitionSession)) { testInsertPartitionedTableOverwriteExistingPartition( Session.builder(storageFormat.getSession()) .setCatalogSessionProperty(immutablePartitionSession.getCatalog().get(), "insert_overwrite_existing_partitions", "true") .build(), storageFormat.getFormat()); } }

Target:
public void testInsertPartitionedTableOverwriteExistingPartition() { testInsertPartitionedTableOverwriteExistingPartition( Session.builder(getSession()) .setCatalogSessionProperty(catalog, "insert_existing_partitions_behavior", "OVERWRITE") .build(), HiveStorageFormat.ORC); }
Source:
public void visitReturnStatement(ReturnStatementTree tree) { if(tree.expression()== null || !isIncrementOrDecrement(tree.expression())) { scan(tree.expression()); } }

Target:
public void visitReturnStatement(ReturnStatementTree tree) { ExpressionTree expression = tree.expression(); if(expression == null || !isIncrementOrDecrement(expression)) { scan(expression); } }
Source:
public MavenExecutionResult readMavenProject(File pomFile, ProjectBuildingRequest configuration) throws CoreException { long start = System.currentTimeMillis(); log.debug("Reading Maven project: {}", pomFile.getAbsoluteFile()); MavenExecutionResult result = new DefaultMavenExecutionResult(); try { configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); ProjectBuildingResult projectBuildingResult = lookup(ProjectBuilder.class).build(pomFile, configuration); result.setProject(projectBuildingResult.getProject()); result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult()); MavenExecutionRequest executionRequest = createExecutionRequest(); populateDefaults(executionRequest); ((DefaultMavenExecutionRequest) executionRequest).setProjectBuildingConfiguration(configuration); processLifecycleParticipants(projectBuildingResult.getProject(), executionRequest, configuration.getRepositorySession()); } catch(ProjectBuildingException ex) { if(ex.getResults() != null && ex.getResults().size() == 1) { ProjectBuildingResult projectBuildingResult = ex.getResults().get(0); result.setProject(projectBuildingResult.getProject()); result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult()); } result.addException(ex); } catch(RuntimeException e) { result.addException(e); } finally { log.debug("Read Maven project: in ms", pomFile.getAbsoluteFile(), System.currentTimeMillis() - start); } return result; }

Target:
public MavenExecutionResult readMavenProject(File pomFile, ProjectBuildingRequest configuration) throws CoreException { long start = System.currentTimeMillis(); log.debug("Reading Maven project: {}", pomFile.getAbsoluteFile()); MavenExecutionResult result = new DefaultMavenExecutionResult(); try { configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); ProjectBuildingResult projectBuildingResult = lookup(ProjectBuilder.class).build(pomFile, configuration); result.setProject(projectBuildingResult.getProject()); result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult()); if (hasLifecycleParticipants(projectBuildingResult.getProject())) { MavenExecutionRequest executionRequest = createExecutionRequest(); populateDefaults(executionRequest); ((DefaultMavenExecutionRequest) executionRequest).setProjectBuildingConfiguration(configuration); processLifecycleParticipants(projectBuildingResult.getProject(), executionRequest, configuration.getRepositorySession()); } } catch(ProjectBuildingException ex) { if(ex.getResults() != null && ex.getResults().size() == 1) { ProjectBuildingResult projectBuildingResult = ex.getResults().get(0); result.setProject(projectBuildingResult.getProject()); result.setDependencyResolutionResult(projectBuildingResult.getDependencyResolutionResult()); } result.addException(ex); } catch(RuntimeException e) { result.addException(e); } finally { log.debug("Read Maven project: in ms", pomFile.getAbsoluteFile(), System.currentTimeMillis() - start); } return result; }
Source:
public Collection<Order> getOrder(OrderQueryParams... orderQueryParams) throws IOException { return Arrays.stream(orderQueryParams) .filter(oq -> oq instanceof OrderQueryParamCurrencyPair) .map(oq -> (OrderQueryParamCurrencyPair) oq) .flatMap( oq -> { try { return getBithumbOrderDetail(oq.getOrderId(), oq.getCurrencyPair()).getData() .stream() .map(detail -> BithumbAdapters.adaptOrderDetail(detail, oq.getOrderId())); } catch (IOException e) { return null; } catch (BithumbException e) { throw BithumbErrorAdapter.adapt(e); } }) .filter(Objects::nonNull) .collect(Collectors.toList()); }

Target:
public Collection<Order> getOrder(OrderQueryParams... orderQueryParams) throws IOException { return Arrays.stream(orderQueryParams) .filter(oq -> oq instanceof OrderQueryParamCurrencyPair) .map(oq -> (OrderQueryParamCurrencyPair) oq) .map( oq -> { try { BithumbResponse<BithumbOrderDetail> r = getBithumbOrderDetail(oq.getOrderId(), oq.getCurrencyPair()); return BithumbAdapters.adaptOrderDetail(r.getData(), oq.getOrderId()); } catch (IOException e) { throw new RuntimeException(e); } catch (BithumbException e) { throw BithumbErrorAdapter.adapt(e); } }) .filter(Objects::nonNull) .collect(Collectors.toList()); }
Source:
public String asSummaryString() { return "Kafka 0.10 scan source"; }

Target:
public String asSummaryString() { return "Kafka-0.10"; }
Source:
public void makeUnDiscoverablePatchUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/discoverable", "false"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient().perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnauthorized()); getClient(token).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.discoverable", Matchers.is(true))); }

Target:
public void makeUnDiscoverablePatchUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/discoverable", false); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient().perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnauthorized()); getClient(token).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.discoverable", Matchers.is(true))); }
Source:
public Note merge(Note base, Note ours, Note theirs, ObjectReader reader, ObjectInserter inserter) throws IOException { if (ours == null) { return theirs; } if (theirs == null) { return ours; } if (ours.getData().equals(theirs.getData())) { return ours; } ObjectLoader lo = reader.open(ours.getData()); byte[] sep = new byte[] {'\n'}; ObjectLoader lt = reader.open(theirs.getData()); try (UnionInputStream union = new UnionInputStream( lo.openStream(), new ByteArrayInputStream(sep), lt.openStream())) { ObjectId noteData = inserter.insert(Constants.OBJ_BLOB, lo.getSize() + sep.length + lt.getSize(), union); return new Note(ours, noteData); } }

Target:
public Note merge(Note base, Note ours, Note theirs, ObjectReader reader, ObjectInserter inserter) throws IOException { if (ours == null) { return theirs; } if (theirs == null) { return ours; } if (ours.getData().equals(theirs.getData())) { return ours; } ObjectLoader lo = reader.open(ours.getData()); byte[] sep = new byte[] {'\n'}; ObjectLoader lt = reader.open(theirs.getData()); try (ByteArrayInputStream b = new ByteArrayInputStream(sep); UnionInputStream union = new UnionInputStream( lo.openStream(), b, lt.openStream())) { ObjectId noteData = inserter.insert(Constants.OBJ_BLOB, lo.getSize() + sep.length + lt.getSize(), union); return new Note(ours, noteData); } }
Source:
private Set<SupportedAdditionalClusterFeature> getSupportedAdditionalClusterFeatures(Boolean enabled) { SupportedAdditionalClusterFeature clusterFeature = new SupportedAdditionalClusterFeature(); AdditionalFeature feature = new AdditionalFeature(Guid.newGuid(), "libgfapi_supported", Version.v4_1, null, null); clusterFeature.setFeature(feature); clusterFeature.setEnabled(enabled); return Collections.singleton(clusterFeature); }

Target:
private Set<SupportedAdditionalClusterFeature> getSupportedAdditionalClusterFeatures(Boolean enabled) { SupportedAdditionalClusterFeature clusterFeature = new SupportedAdditionalClusterFeature(); AdditionalFeature feature = new AdditionalFeature(Guid.newGuid(), VmInfoBuildUtils.VDSM_LIBGF_CAP_NAME, Version.v4_1, null, null); clusterFeature.setFeature(feature); clusterFeature.setEnabled(enabled); return Collections.singleton(clusterFeature); }
Source:
public void remove() { setDead(); }

Target:
public void remove() { this.setDead(); }
Source:
static <A extends Annotation> A getAnnotationFromClass(Class<?> clazz, Class<A> a) { try { return clazz.getAnnotation(a); } catch (Throwable t) { String msg = "Encountered problems when parsing the annotation on class " + clazz.getCanonicalName() + ". "; msg += SUFFIX; throw new TypeNotPresentException(msg, t); } }

Target:
static <A extends Annotation> A getAnnotationFromClass(Class<?> clazz, Class<A> a) { Objects.requireNonNull(clazz, "Cannot retrieve annotations from a null class."); Objects.requireNonNull(a, "Cannot work with a null annotation"); try { return clazz.getAnnotation(a); } catch (Throwable t) { String msg = "Encountered problems when parsing the annotation on class " + clazz.getCanonicalName() + ". "; msg += SUFFIX; throw new TypeNotPresentException(msg, t); } }
Source:
protected void updateProvidedObjectsHolder(URL url, Set<E> providedObjects) { if (providedObjects != null && !providedObjects.isEmpty()) { List<String> uids = new ArrayList<String>(); for (E providedObject : providedObjects) { String uid = getUID(providedObject); E oldProvidedObject = providedObjectsHolder.get(uid); uids.add(uid); providedObjectsHolder.put(uid, providedObject); notifyListeners(oldProvidedObject, providedObject); } providerPortfolio.put(url, uids); } }

Target:
protected void updateProvidedObjectsHolder(URL url, Set<E> providedObjects) { if (providedObjects != null && !providedObjects.isEmpty()) { List<String> uids = new ArrayList<String>(); for (E providedObject : providedObjects) { String uid = getUID(providedObject); uids.add(uid); E oldProvidedObject = providedObjectsHolder.put(uid, providedObject); notifyListeners(oldProvidedObject, providedObject); } providerPortfolio.put(url, uids); } }
Source:
public void lineGetStyle(LineStyleEvent event) { List<StyleRange> styles = new ArrayList<StyleRange>(); int token; StyleRange lastStyle; if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) { styles.add(new StyleRange(event.lineOffset, event.lineText.length(), getColor(COMMENT), null)); event.styles = styles.toArray(new StyleRange[styles.size()]); return; } Color defaultFgColor = ((Control)event.widget).getForeground(); scanner.setRange(event.lineText); token = scanner.nextToken(); while (token != EOF) { if (token == OTHER) { } else if (token != WHITE) { Color color = getColor(token); if ((!color.equals(defaultFgColor)) || (token == KEY)) { StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null); if (token == KEY) { style.fontStyle = SWT.BOLD; } if (styles.isEmpty()) { styles.add(style); } else { lastStyle = styles.get(styles.size()-1); if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) { lastStyle.length += style.length; } else { styles.add(style); } } } } else if ((!styles.isEmpty()) && ((lastStyle=styles.get(styles.size()-1)).fontStyle == SWT.BOLD)) { int start = scanner.getStartOffset() + event.lineOffset; lastStyle = styles.get(styles.size() - 1); if (lastStyle.start + lastStyle.length == start) { lastStyle.length += scanner.getLength(); } } token= scanner.nextToken(); } event.styles = styles.toArray(new StyleRange[styles.size()]); }

Target:
public void lineGetStyle(LineStyleEvent event) { List<StyleRange> styles = new ArrayList<>(); int token; StyleRange lastStyle; if (inBlockComment(event.lineOffset, event.lineOffset + event.lineText.length())) { styles.add(new StyleRange(event.lineOffset, event.lineText.length(), getColor(COMMENT), null)); event.styles = styles.toArray(new StyleRange[styles.size()]); return; } Color defaultFgColor = ((Control)event.widget).getForeground(); scanner.setRange(event.lineText); token = scanner.nextToken(); while (token != EOF) { if (token == OTHER) { } else if (token != WHITE) { Color color = getColor(token); if ((!color.equals(defaultFgColor)) || (token == KEY)) { StyleRange style = new StyleRange(scanner.getStartOffset() + event.lineOffset, scanner.getLength(), color, null); if (token == KEY) { style.fontStyle = SWT.BOLD; } if (styles.isEmpty()) { styles.add(style); } else { lastStyle = styles.get(styles.size()-1); if (lastStyle.similarTo(style) && (lastStyle.start + lastStyle.length == style.start)) { lastStyle.length += style.length; } else { styles.add(style); } } } } else if ((!styles.isEmpty()) && ((lastStyle=styles.get(styles.size()-1)).fontStyle == SWT.BOLD)) { int start = scanner.getStartOffset() + event.lineOffset; lastStyle = styles.get(styles.size() - 1); if (lastStyle.start + lastStyle.length == start) { lastStyle.length += scanner.getLength(); } } token= scanner.nextToken(); } event.styles = styles.toArray(new StyleRange[styles.size()]); }
Source:
private void increaseSize(int length) { length = Math.max(length + 1, 4 * p.length); int pn[] = new int[length]; int qn[] = new int[length]; System.arraycopy(p, 0, pn, 0, p.length); System.arraycopy(q, 0, qn, 0, q.length); p = pn; q = qn; }

Target:
private void increaseSize(int length) { length = Math.max(length + 1, 4 * p.length); Out.debug("increasing length to " + length); int pn[] = new int[length]; int qn[] = new int[length]; System.arraycopy(p, 0, pn, 0, p.length); System.arraycopy(q, 0, qn, 0, q.length); p = pn; q = qn; }
Source:
private List<String> readServersFromFile(String filename) { List<String> servers = new ArrayList<>(); if (filename == null) { return servers; } else { try { Files.readAllLines(Paths.get(filename)).stream().map(String::trim) .filter(((Predicate<String>) String::isEmpty).negate()).map(String::toLowerCase) .forEach(servers::add); } catch (IOException e) { LOG.warn("Exception while reading excludes file, continuing anyways", e); } return servers; } }

Target:
private List<String> readServersFromFile(String filename) throws IOException { List<String> servers = new ArrayList<>(); if (filename != null) { try { Files.readAllLines(Paths.get(filename)).stream().map(String::trim) .filter(((Predicate<String>) String::isEmpty).negate()).map(String::toLowerCase) .forEach(servers::add); } catch (IOException e) { LOG.error("Exception while reading servers from file,", e); throw e; } } return servers; }
Source:
default Collection<T> getItems(Predicate<T> pred) { List<T> filteredItems = new ArrayList<>(); for (T item : getItems()) { if (pred.test(item)) { filteredItems.add(item); } } return filteredItems; }

Target:
default Collection<T> getItems(Predicate<T> pred) { return getItemsStream(pred) .collect(Collectors.toList()); }
Source:
private static DetailAST getParent(DetailAST commentBlock) { DetailAST result = commentBlock.getParent(); if (result == null) { result = commentBlock.getNextSibling(); } final List<Integer> typesArrayList = new ArrayList<>(Arrays.asList( TokenTypes.TYPE, TokenTypes.MODIFIERS, TokenTypes.ANNOTATION, TokenTypes.ANNOTATIONS, TokenTypes.ARRAY_DECLARATOR, TokenTypes.TYPE_PARAMETERS, TokenTypes.DOT)); while (true) { final int type = result.getType(); if (typesArrayList.contains(type)) { result = result.getParent(); } else if (type == TokenTypes.SINGLE_LINE_COMMENT) { result = result.getNextSibling(); } else { break; } } return result; }

Target:
private static DetailAST getParent(DetailAST commentBlock) { DetailAST result = commentBlock.getParent(); if (result == null) { result = commentBlock.getNextSibling(); } while (true) { final int type = result.getType(); if (TYPES_HASH_SET.contains(type)) { result = result.getParent(); } else if (type == TokenTypes.SINGLE_LINE_COMMENT) { result = result.getNextSibling(); } else { break; } } return result; }
Source:
private void updateLabelList() { AsyncQuery getLabelsQuery = new AsyncQuery(); getLabelsQuery.asyncCallback = new INewAsyncCallback() { @SuppressWarnings("unchecked") @Override public void onSuccess(Object model, Object result) { final List<Label> allLabels = (List<Label>) result; boolean isAnyTemplateBehavior = getBehavior().isAnyTemplateBehavior() || getBehavior().isNewTemplateBehavior(); if (getIsNew() || isAnyTemplateBehavior) { labelList.setItems(allLabels); labelList.setSelectedItems(new ArrayList<Label>()); } else { AsyncQuery getLabelsByVmIdQuery = new AsyncQuery(); getLabelsByVmIdQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<Label> vmLabelsList = (List<Label>) returnValue; labelList.setItems(allLabels); labelList.setSelectedItems(vmLabelsList); } }; Guid vmId = ((ExistingVmModelBehavior) getBehavior()).getVm().getId(); AsyncDataProvider.getInstance().getLabelListByEntityId(getLabelsByVmIdQuery, vmId); } labelList.setIsChangeable(false); } }; AsyncDataProvider.getInstance().getLabelList(getLabelsQuery); }

Target:
private void updateLabelList() { AsyncQuery getLabelsQuery = new AsyncQuery(); getLabelsQuery.asyncCallback = new INewAsyncCallback() { @SuppressWarnings("unchecked") @Override public void onSuccess(Object model, Object result) { final List<Label> allLabels = (List<Label>) result; boolean isExistingVmBehavior = getBehavior() instanceof ExistingVmModelBehavior; if (isExistingVmBehavior) { AsyncQuery getLabelsByVmIdQuery = new AsyncQuery(); getLabelsByVmIdQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<Label> vmLabelsList = (List<Label>) returnValue; labelList.setItems(allLabels); labelList.setSelectedItems(vmLabelsList); } }; Guid vmId = ((ExistingVmModelBehavior) getBehavior()).getVm().getId(); AsyncDataProvider.getInstance().getLabelListByEntityId(getLabelsByVmIdQuery, vmId); } else { labelList.setItems(allLabels); labelList.setSelectedItems(new ArrayList<Label>()); } labelList.setIsChangeable(false); } }; AsyncDataProvider.getInstance().getLabelList(getLabelsQuery); }
Source:
public void addRecords(Map<TopicPartition, List<KafkaMessage>> records) { log.debug("Adding records to stream"); for (Map.Entry<TopicPartition, List<KafkaMessage>> entry : records.entrySet()) { for (KafkaMessage message : entry.getValue()) { BlockingQueue<KafkaMessage> queue = topicQueue.get(entry.getKey().topic()); if (queue != null) { queue.add(message); } } } }

Target:
public void addRecords(Map<TopicPartition, List<KafkaMessage>> records) { log.debug("Adding records to stream"); for (Map.Entry<TopicPartition, List<KafkaMessage>> entry : records.entrySet()) { final String topic = entry.getKey().topic(); final BlockingQueue<KafkaMessage> queue = topicQueue.get(topic); if (queue != null) { for (KafkaMessage message : entry.getValue()) { queue.add(message); } } else { log.error("Tried to add records to non-existant topic '{}'; listing records...", topic); for (KafkaMessage message : entry.getValue()) { log.error("Missed adding message on topic '{}': {}", topic, message.getMsg()); } } } }
Source:
private static void validateTextSearchArgument(Object textSearch) throws QueryException { if (!(textSearch instanceof String)) { throw new QueryException("$search operator expects a String"); } }

Target:
private static void validateTextSearchArgument(Object textSearch) throws QueryException { if (!(textSearch instanceof String)) { throw new QueryException("$search operator requires a String operand"); } }