auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Expr binaryOp(BinaryOpExprBase binary, Expr left, Expr right) { try { return binary.getClass() .getDeclaredConstructor(String.class, Expr.class, Expr.class) .newInstance(binary.op, left, right); } catch (Exception e) { log.info(e, "failed to rewrite expression " + binary); return binary; } }

Target:
public static Expr binaryOp(BinaryOpExprBase binary, Expr left, Expr right) { try { return binary.getClass() .getDeclaredConstructor(String.class, Expr.class, Expr.class) .newInstance(binary.op, left, right); } catch (Exception e) { log.warn(e, "failed to rewrite expression " + binary); return binary; } }
Source:
private PartitionIterator sendNextRequests() { List<PartitionIterator> concurrentQueries = new ArrayList<>(concurrencyFactor); List<ReadRepair> readRepairs = new ArrayList<>(concurrencyFactor); try { for (int i = 0; i < concurrencyFactor && ranges.hasNext();) { ReplicaPlan.ForRangeRead range = ranges.next(); @SuppressWarnings("resource") SingleRangeResponse response = query(range, i == 0); concurrentQueries.add(response); readRepairs.add(response.readRepair); rangesQueried += range.vnodeCount(); i += range.vnodeCount(); } } catch (Throwable t) { for (PartitionIterator response: concurrentQueries) response.close(); throw t; } Tracing.trace("Submitted concurrent range requests", concurrentQueries.size()); counter = DataLimits.NONE.newCounter(command.nowInSec(), true, command.selectsFullPartition(), enforceStrictLiveness); return counter.applyTo(concatAndBlockOnRepair(concurrentQueries, readRepairs)); }

Target:
private PartitionIterator sendNextRequests() { List<PartitionIterator> concurrentQueries = new ArrayList<>(concurrencyFactor); List<ReadRepair> readRepairs = new ArrayList<>(concurrencyFactor); try { for (int i = 0; i < concurrencyFactor && ranges.hasNext();) { ReplicaPlan.ForRangeRead range = ranges.next(); @SuppressWarnings("resource") SingleRangeResponse response = query(range, i == 0); concurrentQueries.add(response); readRepairs.add(response.readRepair); rangesQueried += range.vnodeCount(); i += range.vnodeCount(); } batchesRequested++; } catch (Throwable t) { for (PartitionIterator response: concurrentQueries) response.close(); throw t; } Tracing.trace("Submitted concurrent range requests", concurrentQueries.size()); counter = DataLimits.NONE.newCounter(command.nowInSec(), true, command.selectsFullPartition(), enforceStrictLiveness); return counter.applyTo(concatAndBlockOnRepair(concurrentQueries, readRepairs)); }
Source:
public static Modify fromString(String s) { String[] arr = s.split("\\s+"); if (arr.length != 2) { return null; } if (arr[0].equals("insert")) { return insert(Integer.parseInt(arr[1])); } else if (arr[0].equals("replace")) { String[] arr2 = arr[1].split("-"); if (arr2.length != 2) { return null; } return replace(Integer.parseInt(arr2[0]), Integer.parseInt(arr2[1])); } return null; }

Target:
public static Modify fromString(String s) { String[] arr = s.split("\\s+"); if (arr.length != 2) { return null; } if ("insert".equals(arr[0])) { return insert(Integer.parseInt(arr[1])); } else if ("replace".equals(arr[0])) { String[] arr2 = arr[1].split("-"); if (arr2.length != 2) { return null; } return replace(Integer.parseInt(arr2[0]), Integer.parseInt(arr2[1])); } return null; }
Source:
public InvalidCursorOperation(final Reason reason) { super(); this.reason = reason; }

Target:
public InvalidCursorOperation(final Reason reason) { this.reason = reason; }
Source:
private void addTrustManagerService(OperationContext context, ModelNode ssl, ServiceName serviceName, ServiceTarget serviceTarget) throws OperationFailedException { final ServiceBuilder<TrustManager[]> serviceBuilder; char[] keystorePassword = KeystoreAttributes.KEYSTORE_PASSWORD.resolveModelAttribute(context, ssl).asString() .toCharArray(); final String provider = KeystoreAttributes.KEYSTORE_PROVIDER.resolveModelAttribute(context, ssl).asString(); if (!JKS.equalsIgnoreCase(provider)) { final ProviderTrustManagerService trustManagerService = new ProviderTrustManagerService(provider, keystorePassword); serviceBuilder = serviceTarget.addService(serviceName, trustManagerService); } else { final String path = KeystoreAttributes.KEYSTORE_PATH.resolveModelAttribute(context, ssl).asString(); ModelNode relativeToNode = KeystoreAttributes.KEYSTORE_RELATIVE_TO.resolveModelAttribute(context, ssl); String relativeTo = relativeToNode.isDefined() ? relativeToNode.asString() : null; final FileTrustManagerService trustManagerService = new FileTrustManagerService(JKS.toLowerCase(Locale.ENGLISH), path, relativeTo, keystorePassword); serviceBuilder = serviceTarget.addService(serviceName, trustManagerService); if (relativeTo != null) { serviceBuilder.addDependency(PathManagerService.SERVICE_NAME, PathManager.class, trustManagerService.getPathManagerInjector()); serviceBuilder.addDependency(pathName(relativeTo)); } } serviceBuilder.setInitialMode(ON_DEMAND).install(); }

Target:
private void addTrustManagerService(OperationContext context, ModelNode ssl, ServiceName serviceName, ServiceTarget serviceTarget) throws OperationFailedException { final ServiceBuilder<TrustManager[]> serviceBuilder; char[] keystorePassword = KeystoreAttributes.KEYSTORE_PASSWORD.resolveModelAttribute(context, ssl).asString() .toCharArray(); final String provider = KeystoreAttributes.KEYSTORE_PROVIDER.resolveModelAttribute(context, ssl).asString(); if (!JKS.equalsIgnoreCase(provider)) { final ProviderTrustManagerService trustManagerService = new ProviderTrustManagerService(provider, keystorePassword); serviceBuilder = serviceTarget.addService(serviceName, trustManagerService); } else { String path = KeystoreAttributes.KEYSTORE_PATH.resolveModelAttribute(context, ssl).asString(); ModelNode relativeToNode = KeystoreAttributes.KEYSTORE_RELATIVE_TO.resolveModelAttribute(context, ssl); String relativeTo = relativeToNode.isDefined() ? relativeToNode.asString() : null; FileTrustManagerService trustManagerService = new FileTrustManagerService(provider, path, relativeTo, keystorePassword); serviceBuilder = serviceTarget.addService(serviceName, trustManagerService); if (relativeTo != null) { serviceBuilder.addDependency(PathManagerService.SERVICE_NAME, PathManager.class, trustManagerService.getPathManagerInjector()); serviceBuilder.addDependency(pathName(relativeTo)); } } serviceBuilder.setInitialMode(ON_DEMAND).install(); }
Source:
public boolean isFifoQueue() { if (queueName.endsWith(".fifo")) { return true; } return false; }

Target:
boolean isFifoQueue() { if (queueName.endsWith(".fifo")) { return true; } return false; }
Source:
private boolean isSameTenant(DocumentModel registrationDoc, UserRegistrationConfiguration configuration) { NuxeoPrincipal originatingPrincipal = getOriginatingPrincipal(registrationDoc); if (originatingPrincipal.isAdministrator()) { return true; } return StringUtils.equals((String) registrationDoc.getPropertyValue(configuration.getUserInfoTenantIdField()), originatingPrincipal.getTenantId()); }

Target:
private boolean isSameTenant(DocumentModel registrationDoc, UserRegistrationConfiguration configuration) { NuxeoPrincipal originatingPrincipal = getOriginatingPrincipal(registrationDoc); if (originatingPrincipal == null) { return registrationDoc.getPropertyValue(configuration.getUserInfoTenantIdField()) == null; } if (originatingPrincipal.isAdministrator()) { return true; } return Objects.equals(registrationDoc.getPropertyValue(configuration.getUserInfoTenantIdField()), originatingPrincipal.getTenantId()); }
Source:
public void messagesLogGetsClosed() throws Exception { File storeDir = this.storeDir.graphDbDir(); BatchInserter inserter = BatchInserters.inserter( storeDir, fileSystemRule.get(), stringMap() ); inserter.shutdown(); assertTrue( new File( storeDir, "debug.log" ).delete() ); }

Target:
public void messagesLogGetsClosed() throws Exception { File storeDir = this.storeDir.graphDbDir(); BatchInserter inserter = BatchInserters.inserter( storeDir, fileSystemRule.get(), stringMap() ); inserter.shutdown(); assertTrue( new File( storeDir, INTERNAL_LOG_FILE ).delete() ); }
Source:
public StateSystemEventRequest(ITmfStateProvider sp, TmfTimeRange timeRange, int index, int nbRequested) { super(ITmfEvent.class, timeRange, index, nbRequested, ITmfEventRequest.ExecutionType.BACKGROUND, TmfStateSystemAnalysisModule.this.getDependencyLevel()); this.sci = sp; trace = sci.getTrace(); }

Target:
public StateSystemEventRequest(ITmfStateProvider sp, TmfTimeRange timeRange, int index, int nbRequested) { super(ITmfEvent.class, timeRange, index, nbRequested, ITmfEventRequest.ExecutionType.BACKGROUND, TmfStateSystemAnalysisModule.this.getDependencyLevel()); sci = sp; trace = sci.getTrace(); }
Source:
public void setDayViewAdapter(DayViewAdapter adapter) { for (int i = 0; i < getChildCount(); i++) { if (getChildAt(i) instanceof CalendarCellView) { ((CalendarCellView) getChildAt(i)).removeAllViews(); adapter.makeCellView((CalendarCellView) getChildAt(i)); } } }

Target:
public void setDayViewAdapter(DayViewAdapter adapter) { for (int i = 0; i < getChildCount(); i++) { if (getChildAt(i) instanceof CalendarCellView) { CalendarCellView cell = ((CalendarCellView) getChildAt(i)); cell.removeAllViews(); adapter.makeCellView(cell); } } }
Source:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) res; response.setHeader("Access-Control-Allow-Origin", "http://localhost:9000"); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with,accept,content-type,authorization"); chain.doFilter(req, res); }

Target:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) res; response.setHeader("Access-Control-Allow-Origin", "http://localhost:9000"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with,accept,content-type,authorization"); chain.doFilter(req, res); }
Source:
protected Configuration getConfiguration(String testName) throws IOException { conf.unset(TxConstants.Manager.CFG_TX_HDFS_USER); conf.set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, tmpFolder.newFolder().getAbsolutePath()); conf.set(TxConstants.Persist.CFG_TX_SNAPHOT_CODEC_CLASSES, SnapshotCodecV4.class.getName()); return conf; }

Target:
protected Configuration getConfiguration(String testName) throws IOException { conf.unset(TxConstants.Manager.CFG_TX_HDFS_USER); conf.set(TxConstants.Manager.CFG_TX_SNAPSHOT_DIR, tmpFolder.newFolder().getAbsolutePath()); return conf; }
Source:
public void checkSelectedCellsWithHiddenColumnMultipleColumnsFirstHidden() { final GridColumn<String> column2 = new StringPopupColumn(new BaseHeaderMetaData("title"), columnRenderer, 200.0); this.model.appendColumn(column2); this.column.setVisible(false); setupSelectionContext(); checkRenderedSelectedCells(0, 0, 2, 1, 0, 0, column2.getWidth()); }

Target:
public void checkSelectedCellsWithHiddenColumnMultipleColumnsFirstHidden() { final GridColumn<String> column2 = makeGridColumn(200.0); this.model.appendColumn(column2); this.column.setVisible(false); setupSelectionContext(); checkRenderedSelectedCells(0, 0, 2, 1, 0, 0, column2.getWidth()); }
Source:
public void init(final GlusterVolumeGeoRepActionConfirmationModel model) { super.init(model); model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if(args.propertyName.equalsIgnoreCase("forceLabel")) { getView().setForceLabelMessage(model.getForceLabel()); } else if(args.propertyName.equalsIgnoreCase("forceHelp")) { getView().setForceHelp(model.getForceHelp()); } else if (args.propertyName.equalsIgnoreCase("Message")) { getView().setErrorMessage(model.getMessage()); } else if(args.propertyName.equalsIgnoreCase("messageSet")) { getView().setMessage(model.getMessage()); } } }); }

Target:
public void init(final GlusterVolumeGeoRepActionConfirmationModel model) { super.init(model); model.getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if(args.propertyName.equalsIgnoreCase("forceLabel")) { getView().setForceLabelMessage(model.getForceLabel()); } else if(args.propertyName.equalsIgnoreCase("forceHelp")) { getView().setForceHelp(model.getForceHelp()); } else if (args.propertyName.equalsIgnoreCase("Message")) { getView().setErrorMessage(model.getMessage()); } else if(args.propertyName.equalsIgnoreCase("ActionConfirmationMessage")) { getView().setActionConfirmationMessage(model.getMessage()); } } }); }
Source:
protected void orchestrateMerge(MavenProject project) throws MavenExecutionException { mergeTiles(project); mergeModel(project, project.getArtifact().toString(), project.getFile(), "project"); System.out.println("finished"); }

Target:
protected void orchestrateMerge(MavenProject project) throws MavenExecutionException { Model ourPureModel = loadModel(getArtifactFromCoordinates(project.getGroupId(), project.getArtifactId(), project.getVersion())); Model propertyCollectionModel = project.getModel().clone(); collectTiles(propertyCollectionModel); resolveTiles(); Collections.reverse(tileDiscoveryOrder); mergePropertyModels(ourPureModel, propertyCollectionModel, project.getModel()); mergeModel(project.getModel(), ourPureModel); }
Source:
public PageResult<Installation> findInstallationsByVariantForDeveloper(String variantID, String developer, Integer page, Integer pageSize) { CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Installation> query = builder.createQuery(Installation.class); Root<Installation> v = query.from(Installation.class); final Join join = v.join("variant"); final Predicate[] predicates = getPredicates(variantID, developer, builder, join); query.where(predicates); List<Installation> result = entityManager.createQuery(query) .setFirstResult(page * pageSize).setMaxResults(pageSize).getResultList(); CriteriaQuery<Long> countQuery = builder.createQuery(Long.class); final Join<Object, Object> join1 = countQuery.from(Installation.class).join("variant"); countQuery.where(getPredicates(variantID, developer, builder, join1)); final Long count = entityManager.createQuery(countQuery.select(builder.count(join1))).getSingleResult(); return new PageResult<Installation>(result, count); }

Target:
public PageResult<Installation> findInstallationsByVariantForDeveloper(String variantID, String developer, Integer page, Integer pageSize) { final CriteriaBuilder builder = entityManager.getCriteriaBuilder(); final CriteriaQuery<Installation> query = builder.createQuery(Installation.class); Root<Installation> v = query.from(Installation.class); final Join join = v.join("variant"); final Predicate[] predicates = getPredicates(variantID, developer, builder, join); query.where(predicates); List<Installation> result = entityManager.createQuery(query) .setFirstResult(page * pageSize).setMaxResults(pageSize).getResultList(); CriteriaQuery<Long> countQuery = builder.createQuery(Long.class); final Join<Object, Object> join1 = countQuery.from(Installation.class).join("variant"); countQuery.where(getPredicates(variantID, developer, builder, join1)); final Long count = entityManager.createQuery(countQuery.select(builder.count(join1))).getSingleResult(); return new PageResult<Installation>(result, count); }
Source:
public static void exposeResourcesToView(Map<String, String> resources, String host) { put(resources, host, "CATALOG_UTILS_JS", CATALOG_UTILS_JS); put(resources, host, "COLLECTION_INFO_JS", COLLECTION_INFO_JS); put(resources, host, "DATE_UTILS_JS", DATE_UTILS_JS); put(resources, host, "FAVICON_ICO", FAVICON_ICO); put(resources, host, "MAIN_CSS", MAIN_CSS); put(resources, host, "PARTICIPANT_ADD_JS", PARTICIPANT_ADD_JS); put(resources, host, "SERIES_ADD_JS", SERIES_ADD_JS); put(resources, host, "SERIES_INFO_JS", SERIES_INFO_JS); put(resources, host, "SALE_IMPORT_FORM_JS", SALE_IMPORT_FORM_JS); put(resources, host, "SIMILAR_SERIES_FORM_JS", SIMILAR_SERIES_FORM_JS); put(resources, host, "ADD_COMMENT_FORM_JS", ADD_COMMENT_FORM_JS); put(resources, host, "CATALOG_PRICE_FORM_JS", CATALOG_PRICE_FORM_JS); put(resources, host, "CATALOG_NUMBERS_FORM_JS", CATALOG_NUMBERS_FORM_JS); put(resources, host, "RELEASE_YEAR_FORM_JS", RELEASE_YEAR_FORM_JS); put(resources, host, "SERIES_SALES_BLOCK_JS", SERIES_SALES_BLOCK_JS); }

Target:
public static void exposeResourcesToView(Map<String, String> resources, String host) { put(resources, host, "CATALOG_UTILS_JS", CATALOG_UTILS_JS); put(resources, host, "COLLECTION_INFO_JS", COLLECTION_INFO_JS); put(resources, host, "DATE_UTILS_JS", DATE_UTILS_JS); put(resources, host, "FAVICON_ICO", FAVICON_ICO); put(resources, host, "MAIN_CSS", MAIN_CSS); put(resources, host, "PARTICIPANT_ADD_JS", PARTICIPANT_ADD_JS); put(resources, host, "SERIES_ADD_JS", SERIES_ADD_JS); put(resources, host, "SERIES_INFO_JS", SERIES_INFO_JS); put(resources, host, "SALE_IMPORT_FORM_JS", SALE_IMPORT_FORM_JS); put(resources, host, "SIMILAR_SERIES_FORM_JS", SIMILAR_SERIES_FORM_JS); put(resources, host, "ADD_COMMENT_FORM_JS", ADD_COMMENT_FORM_JS); put(resources, host, "CATALOG_PRICE_FORM_JS", CATALOG_PRICE_FORM_JS); put(resources, host, "CATALOG_NUMBERS_FORM_JS", CATALOG_NUMBERS_FORM_JS); put(resources, host, "RELEASE_YEAR_FORM_JS", RELEASE_YEAR_FORM_JS); put(resources, host, "SERIES_SALES_LIST_JS", SERIES_SALES_LIST_JS); }
Source:
public boolean tryDelete() { try { if (deleteHandler == null) { return false; } return deleteHandler.apply(this); } catch (Exception e) { throw handleErrorInCallback(e, "deleteHandler"); } }

Target:
public boolean tryDelete() { try { if (!canDelete()) { return false; } return deleteHandler.apply(this); } catch (Exception e) { throw handleErrorInCallback(e, "deleteHandler"); } }
Source:
List<ItemDefinition> itemDefinitions() { return dmnGraphUtils.getDefinitions().getItemDefinition(); }

Target:
List<ItemDefinition> itemDefinitions() { final Optional<Definitions> definitions = Optional.ofNullable(dmnGraphUtils.getDefinitions()); if (definitions.isPresent()) { return definitions.get().getItemDefinition(); } return new ArrayList<>(); }
Source:
private Result runCommand(Context taskContext, Config taskConfig, JobConsoleLogger console) throws IOException, InterruptedException { ProcessBuilder curl = createCurlCommandWithOptions(taskContext, taskConfig); logger.error("Launching command: " + curl.command()); console.printLine("Launching command: " + curl.command()); curl.environment().putAll(taskContext.getEnvironmentVariables()); console.printEnvironment(curl.environment()); Process curlProcess = curl.start(); console.readErrorOf(curlProcess.getErrorStream()); console.readOutputOf(curlProcess.getInputStream()); int exitCode = curlProcess.waitFor(); curlProcess.destroy(); if (exitCode != 0) { return new Result(false, "Failed downloading file. Please check the output"); } return new Result(true, "Downloaded file: " + CURLED_FILE); }

Target:
private Result runCommand(Context taskContext, Config taskConfig, JobConsoleLogger console) throws IOException, InterruptedException { ProcessBuilder curl = createCurlCommandWithOptions(taskContext, taskConfig); console.printLine("Launching command: " + curl.command()); curl.environment().putAll(taskContext.getEnvironmentVariables()); console.printEnvironment(curl.environment()); Process curlProcess = curl.start(); console.readErrorOf(curlProcess.getErrorStream()); console.readOutputOf(curlProcess.getInputStream()); int exitCode = curlProcess.waitFor(); curlProcess.destroy(); if (exitCode != 0) { return new Result(false, "Failed downloading file. Please check the output"); } return new Result(true, "Downloaded file: " + CURLED_FILE); }
Source:
private void postProcess(Path tmpDir, GoGoDuckModule module) throws GoGoDuckException { File[] directoryListing = tmpDir.toFile().listFiles(); if (directoryListing != null) { for (File file : directoryListing) { try { logger.info(String.format("Checking file %s for packed variable", file.getAbsolutePath())); if (!module.unpackNetcdf()) { logger.info(String.format("No packed variable found in %s", file.getAbsolutePath())); return; } File tmpFile = File.createTempFile("ncpdq", ".nc"); logger.info(String.format("Unpacking file (ncpdq) '%s' to '%s'", file.toPath(), tmpFile.toPath())); List<String> command = new ArrayList<>(); command.add(goGoDuckConfig.getNcpdqPath()); command.add("-O"); command.add("-U"); command.add(file.getAbsolutePath()); command.add(tmpFile.getAbsolutePath()); GoGoDuck.execute(command); Files.delete(file.toPath()); Files.move(tmpFile.toPath(), file.toPath()); } catch (Exception e) { throw new GoGoDuckException(String.format("Could not run ncpdq on file '%s'", file.toPath())); } } } else { throw new GoGoDuckException("No files available for post processing"); } }

Target:
private void postProcess(Path tmpDir, GoGoDuckModule module) throws GoGoDuckException { File[] directoryListing = tmpDir.toFile().listFiles(); if (directoryListing != null) { for (File file : directoryListing) { try { if (!module.unpackNetcdf()) { logger.info(String.format("Not unpacking file %s", file.getAbsolutePath())); return; } File tmpFile = File.createTempFile("ncpdq", ".nc"); logger.info(String.format("Unpacking file (ncpdq) '%s' to '%s'", file.toPath(), tmpFile.toPath())); List<String> command = new ArrayList<>(); command.add(goGoDuckConfig.getNcpdqPath()); command.add("-O"); command.add("-U"); command.add(file.getAbsolutePath()); command.add(tmpFile.getAbsolutePath()); GoGoDuck.execute(command); Files.delete(file.toPath()); Files.move(tmpFile.toPath(), file.toPath()); } catch (Exception e) { throw new GoGoDuckException(String.format("Could not run ncpdq on file '%s'", file.toPath())); } } } else { throw new GoGoDuckException("No files available for post processing"); } }
Source:
public QRCodeGenerator providesQRCodeGenerator() { return new QRCodeGenerator() { @Override public Observable<Bitmap> generateQRCode(Collection<String> selectedPasswordKeys) { return QRCodeUtils.getQRCodeGeneratorObservable(selectedPasswordKeys); } }; }

Target:
public QRCodeGenerator providesQRCodeGenerator() { return new ObservableQRCodeGenerator(); }
Source:
public MaxwellKafkaProducer(MaxwellContext context, Properties kafkaProperties, String kafkaTopic) { super(context); this.queue = new LinkedBlockingQueue<>(100); this.worker = new MaxwellKafkaProducerWorker(context, kafkaProperties, kafkaTopic, this.queue); new Thread(this.worker, "maxwell-kafka-producer").start(); }

Target:
public MaxwellKafkaProducer(MaxwellContext context, Properties kafkaProperties, String kafkaTopic) { super(context); this.queue = new ArrayBlockingQueue<>(100); this.worker = new MaxwellKafkaProducerWorker(context, kafkaProperties, kafkaTopic, this.queue); new Thread(this.worker, "maxwell-kafka-worker").start(); }
Source:
public void completeBuilderShouldUpdateUriObject() { Uri oldUri = mock(Uri.class); Uri newUri = mock(Uri.class); DeleteQuery query = DeleteQuery.builder() .uri(oldUri) .uri(newUri) .build(); assertThat(query.uri()).isEqualTo(newUri); }

Target:
public void completeBuilderShouldUpdateUriObject() { Uri oldUri = mock(Uri.class); Uri newUri = mock(Uri.class); DeleteQuery query = DeleteQuery.builder() .uri(oldUri) .uri(newUri) .build(); assertThat(query.uri()).isSameAs(newUri); }
Source:
public static SendTabData fromBundle(Bundle bundle) { if (bundle == null) { throw new IllegalArgumentException("bundle must not be null"); } String text = bundle.getString(Intent.EXTRA_TEXT); String subject = bundle.getString(Intent.EXTRA_SUBJECT); String title = bundle.getString(Intent.EXTRA_TITLE); String theTitle = subject; if (theTitle == null) { theTitle = title; } String theUri = null; if (text != null && WebURLFinder.isWebURL(text)) { theUri = text; } else { StringBuffer sb = new StringBuffer(); for (String data : new String[] { text, subject, title }) { if (data != null) { sb.append(data); sb.append("\n\n"); } } theUri = new WebURLFinder(sb.toString()).bestWebURL(); } return new SendTabData(theTitle, theUri); }

Target:
protected static SendTabData fromBundle(Bundle bundle) { if (bundle == null) { throw new IllegalArgumentException("bundle must not be null"); } String text = bundle.getString(Intent.EXTRA_TEXT); String subject = bundle.getString(Intent.EXTRA_SUBJECT); String title = bundle.getString(Intent.EXTRA_TITLE); String theTitle = subject; if (theTitle == null) { theTitle = title; } List<String> strings = new ArrayList<String>(); strings.add(text); strings.add(subject); strings.add(title); String theUri = new WebURLFinder(strings).bestWebURL(); return new SendTabData(theTitle, theUri); }
Source:
public static void markAsLinkNote(View view) { EAnnotation specificStyles = view.getEAnnotation(ViewQuery.SPECIFIC_STYLES); if (specificStyles == null) { specificStyles = EcoreFactory.eINSTANCE.createEAnnotation(); specificStyles.setSource(ViewQuery.SPECIFIC_STYLES); specificStyles.getDetails().put(SiriusNoteEditPart.LINK_NOTE_STYLE, null); view.getEAnnotations().add(specificStyles); } else { specificStyles.getDetails().put(SiriusNoteEditPart.LINK_NOTE_STYLE, null); } }

Target:
public static void markAsLinkNote(View view) { EAnnotation specificStyles = view.getEAnnotation(ViewQuery.SPECIFIC_STYLES); if (specificStyles == null) { specificStyles = EcoreFactory.eINSTANCE.createEAnnotation(); specificStyles.setSource(ViewQuery.SPECIFIC_STYLES); view.getEAnnotations().add(specificStyles); } specificStyles.getDetails().put(SiriusNoteEditPart.LINK_NOTE_STYLE, null); }
Source:
private Map<String, Object> toModel() { HashMap<String, Object> model = new HashMap<>(); model.put("knowSomeone", knowSomeone.length() > 0 ? "checked" : ""); model.put("connectToStrangers", connectToStrangers.length() > 0 ? "checked" : ""); model.put("haveMonthlyLimit", haveMonthlyLimit.length() > 0 ? "checked" : ""); model.put("downloadLimit", downloadLimit); model.put("uploadLimit", uploadLimit); model.put("bandwidthMonthlyLimit", bandwidthMonthlyLimit); model.put("storageLimit", storageLimit); model.put("setPassword", setPassword.length() > 0 ? "checked" : ""); if (downloadLimitDetected == null || uploadLimitDetected == null) detectBandwidthLimit(); model.put("downloadLimitDetected", downloadLimitDetected != null ? downloadLimitDetected : l10n("bandwidthCommonInternetConnectionSpeedsDetectedUnavailable")); model.put("uploadLimitDetected", uploadLimitDetected != null ? uploadLimitDetected : l10n("bandwidthCommonInternetConnectionSpeedsDetectedUnavailable")); model.put("errors", errors); return model; }

Target:
private Map<String, Object> toModel() { HashMap<String, Object> model = new HashMap<>(); model.put("knowSomeone", knowSomeone.length() > 0 ? "checked" : ""); model.put("connectToStrangers", connectToStrangers.length() > 0 ? "checked" : ""); model.put("haveMonthlyLimit", haveMonthlyLimit.length() > 0 ? "checked" : ""); model.put("downloadLimit", downloadLimit); model.put("uploadLimit", uploadLimit); model.put("bandwidthMonthlyLimit", bandwidthMonthlyLimit); model.put("minBandwidthMonthlyLimit", String.format("%.2f", BandwidthLimit.minMonthlyLimit)); model.put("storageLimit", storageLimit); if (isPasswordEmpty) { model.put("setPassword", setPassword.length() > 0 ? "checked" : ""); } model.put("isPasswordEmpty", isPasswordEmpty); if (downloadLimitDetected == null || uploadLimitDetected == null) { detectBandwidthLimit(); } model.put("downloadLimitDetected", downloadLimitDetected != null ? downloadLimitDetected : l10n("bandwidthCommonInternetConnectionSpeedsDetectedUnavailable")); model.put("uploadLimitDetected", uploadLimitDetected != null ? uploadLimitDetected : l10n("bandwidthCommonInternetConnectionSpeedsDetectedUnavailable")); model.put("errors", errors); return model; }
Source:
private int calculateDigits(long time0, long time1) { int numDigits = 5; long timeRange = time1 - time0; if (fTimeProvider.getTimeFormat().equals(TimeFormat.CALENDAR)) { numDigits += 8; if (timeRange < 10000) { numDigits += 10; } else if (timeRange < 10000000) { numDigits += 6; } } else { long sec = time1 / SEC_IN_NS; numDigits = Long.toString(sec).length(); int thousandGroups = (numDigits - 1) / 3; numDigits += thousandGroups; numDigits += 12; if (fTimeProvider.getTimeFormat().equals(TimeFormat.CYCLES)) { numDigits += Messages.Utils_ClockCyclesUnit.length(); } } return numDigits; }

Target:
private int calculateDigits(long time0, long time1) { int numDigits = 5; long timeRange = time1 - time0; if (fTimeProvider.getTimeFormat() == TimeFormat.CALENDAR) { numDigits += 8; if (timeRange < 10000) { numDigits += 10; } else if (timeRange < 10000000) { numDigits += 6; } } else { long sec = time1 / SEC_IN_NS; numDigits = Long.toString(sec).length(); int thousandGroups = (numDigits - 1) / 3; numDigits += thousandGroups; numDigits += 12; if (fTimeProvider.getTimeFormat() == TimeFormat.CYCLES) { numDigits += Messages.Utils_ClockCyclesUnit.length(); } } return numDigits; }
Source:
public void run() { scheduler.freeze(); try { DateTime deadLine = DateTime.now().plusSeconds(possibleDealyInSeconds); while (DateTime.now().isBefore(deadLine) && otherTaskIsRunning()) { Thread.sleep(10000); } if (!otherTaskIsRunning()) { synchronizationAPI.freeze(); try { removeOldBackups(); performBackup(); } finally { synchronizationAPI.resume(); } } else { LOGGER.info("Backup will not be performed because there is still some jobs running"); } } catch (IOException | InterruptedException e) { LOGGER.error("", e); } finally { scheduler.resume(); } }

Target:
public void run() { scheduler.freeze(); try { DateTime deadLine = DateTime.now().plusSeconds(possibleDelayInSeconds); while (DateTime.now().isBefore(deadLine) && someTaskIsRunning()) { Thread.sleep(10000); } if (noTaskIsRunning()) { synchronizationAPI.freeze(); try { removeOldBackups(); performBackup(); } finally { synchronizationAPI.resume(); } } else { LOGGER.warn("Backup will not be performed because there is still some jobs running. " + "Waititng time can be changed by using the property 'pa.server.backup.possile.delay'."); } } catch (IOException | InterruptedException e) { LOGGER.error("", e); } finally { scheduler.resume(); } }
Source:
private boolean canBridgeFirewall(final String prvNic) { final Script cmd = new Script(_securityGroupPath, _timeout.getMillis(), s_logger); cmd.add("can_bridge_firewall"); cmd.add(prvNic); final String result = cmd.execute(); if (result != null) { return false; } return true; }

Target:
private boolean canBridgeFirewall(final String prvNic) { final Script cmd = new Script(_securityGroupPath, _timeout, s_logger); cmd.add("can_bridge_firewall"); cmd.add(prvNic); final String result = cmd.execute(); if (result != null) { return false; } return true; }
Source:
public Response createCluster(@PathParam("clusterId") String clusterId, @DefaultValue("false") @QueryParam("recreate") String recreate, @DefaultValue("false") @QueryParam("addCloudConfig") String addCloudConfig, String content) { boolean recreateIfExists = Boolean.valueOf(recreate); boolean cloudConfigIncluded = Boolean.valueOf(addCloudConfig); ClusterSetup clusterSetup = getClusterSetup(); if (!cloudConfigIncluded) { try { clusterSetup.addCluster(clusterId, recreateIfExists, null); } catch (Exception ex) { _logger.error("Failed to create cluster " + clusterId + ", exception: " + ex); return serverError(ex); } return created(); } else { ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a vaild ZNRecord!"); } try { CloudConfig cloudConfig = new CloudConfig.Builder(record).build(); clusterSetup.addCluster(clusterId, recreateIfExists, cloudConfig); } catch (Exception ex) { _logger.error("Error in adding a CloudConfig to cluster: " + clusterId, ex); return badRequest(ex.getMessage()); } return created(); } }

Target:
public Response createCluster(@PathParam("clusterId") String clusterId, @DefaultValue("false") @QueryParam("recreate") String recreate, @DefaultValue("false") @QueryParam("addCloudConfig") String addCloudConfig, String content) { boolean recreateIfExists = Boolean.valueOf(recreate); boolean cloudConfigIncluded = Boolean.valueOf(addCloudConfig); ClusterSetup clusterSetup = getClusterSetup(); CloudConfig cloudConfig = null; if (cloudConfigIncluded) { ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a vaild ZNRecord!"); } try { cloudConfig = new CloudConfig.Builder(record).build(); clusterSetup.addCluster(clusterId, recreateIfExists, cloudConfig); } catch (Exception ex) { _logger.error("Error in adding a CloudConfig to cluster: " + clusterId, ex); return badRequest(ex.getMessage()); } } clusterSetup.addCluster(clusterId, recreateIfExists, cloudConfig); return created(); }
Source:
private void columnDelta1(SafeHtmlBuilder sb, FileInfo info) { sb.openTd().setStyleName(R.css().deltaColumn1()); if (!Patch.COMMIT_MSG.equals(info.path()) && !info.binary()) { if (Gerrit.getUserAccount().getGeneralPreferences() .isSizeBarInChangeTable()) { sb.append(info.lines_inserted() + info.lines_deleted()); } else if (!ChangeType.DELETED.matches(info.status())) { if (ChangeType.ADDED.matches(info.status())) { sb.append(info.lines_inserted()) .append(" lines"); } else { sb.append("+") .append(info.lines_inserted()) .append(", -") .append(info.lines_deleted()); } } } sb.closeTd(); }

Target:
private void columnDelta1(SafeHtmlBuilder sb, FileInfo info) { sb.openTd().setStyleName(R.css().deltaColumn1()); if (!Patch.COMMIT_MSG.equals(info.path()) && !info.binary()) { if (showChangeSizeBars) { sb.append(info.lines_inserted() + info.lines_deleted()); } else if (!ChangeType.DELETED.matches(info.status())) { if (ChangeType.ADDED.matches(info.status())) { sb.append(info.lines_inserted()) .append(" lines"); } else { sb.append("+") .append(info.lines_inserted()) .append(", -") .append(info.lines_deleted()); } } } sb.closeTd(); }
Source:
private static void writeExpressionAudit(PathAddress pa, ModelNode resourceDescription) { String paString = getPaString(pa); if (resourceDescription.hasDefined(ModelDescriptionConstants.ATTRIBUTES)) { for (Property property : resourceDescription.get(ModelDescriptionConstants.ATTRIBUTES).asPropertyList()) { ModelNode attrdesc = property.getValue(); if (!attrdesc.hasDefined(ModelDescriptionConstants.STORAGE) || AttributeAccess.Storage.CONFIGURATION.name().toLowerCase().equals(attrdesc.get(ModelDescriptionConstants.STORAGE).asString().toLowerCase())) { StringBuilder sb = new StringBuilder(paString); sb.append(",").append(property.getName()); sb.append(",").append(attrdesc.get(ModelDescriptionConstants.TYPE).asString()); sb.append(",").append(attrdesc.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false)); sb.append(",").append(attrdesc.get(ModelDescriptionConstants.DESCRIPTION).asString()); } } } if (resourceDescription.hasDefined(ModelDescriptionConstants.CHILDREN)) { for (Property childTypeProp : resourceDescription.get(ModelDescriptionConstants.CHILDREN).asPropertyList()) { String childType = childTypeProp.getName(); ModelNode childTypeDesc = childTypeProp.getValue(); if (childTypeDesc.hasDefined(ModelDescriptionConstants.MODEL_DESCRIPTION)) { for (Property childInstanceProp : childTypeDesc.get(ModelDescriptionConstants.MODEL_DESCRIPTION).asPropertyList()) { PathAddress childAddress = pa.append(childType, childInstanceProp.getName()); writeExpressionAudit(childAddress, childInstanceProp.getValue()); } } } } }

Target:
private static void writeExpressionAudit(PathAddress pa, ModelNode resourceDescription) { String paString = getPaString(pa); if (LOGGER.isTraceEnabled()) { if (resourceDescription.hasDefined(ModelDescriptionConstants.ATTRIBUTES)) { for (Property property : resourceDescription.get(ModelDescriptionConstants.ATTRIBUTES).asPropertyList()) { ModelNode attrdesc = property.getValue(); if (!attrdesc.hasDefined(ModelDescriptionConstants.STORAGE) || AttributeAccess.Storage.CONFIGURATION.name().toLowerCase().equals(attrdesc.get(ModelDescriptionConstants.STORAGE).asString().toLowerCase())) { StringBuilder sb = new StringBuilder(paString); sb.append(",").append(property.getName()); sb.append(",").append(attrdesc.get(ModelDescriptionConstants.TYPE).asString()); sb.append(",").append(attrdesc.get(ModelDescriptionConstants.EXPRESSIONS_ALLOWED).asBoolean(false)); sb.append(",").append(attrdesc.get(ModelDescriptionConstants.DESCRIPTION).asString()); LOGGER.trace(sb.toString()); } } } } if (resourceDescription.hasDefined(ModelDescriptionConstants.CHILDREN)) { for (Property childTypeProp : resourceDescription.get(ModelDescriptionConstants.CHILDREN).asPropertyList()) { String childType = childTypeProp.getName(); ModelNode childTypeDesc = childTypeProp.getValue(); if (childTypeDesc.hasDefined(ModelDescriptionConstants.MODEL_DESCRIPTION)) { for (Property childInstanceProp : childTypeDesc.get(ModelDescriptionConstants.MODEL_DESCRIPTION).asPropertyList()) { PathAddress childAddress = pa.append(childType, childInstanceProp.getName()); writeExpressionAudit(childAddress, childInstanceProp.getValue()); } } } } }
Source:
public void generateElasticChangeEvents(int oldPartitionCnt, int newPartitionCnt, long spHandle, long uniqueId) { hostLog.info("Generating Elastic Change event"); ByteBuffer paramBuffer = ByteBuffer.allocate(8); paramBuffer.putInt(oldPartitionCnt); paramBuffer.putInt(newPartitionCnt); generateDREvent( EventType.DR_ELASTIC_CHANGE, uniqueId, m_lastCommittedSpHandle, spHandle, paramBuffer.array()); }

Target:
public void generateElasticChangeEvents(int oldPartitionCnt, int newPartitionCnt, long spHandle, long uniqueId) { ByteBuffer paramBuffer = ByteBuffer.allocate(8); paramBuffer.putInt(oldPartitionCnt); paramBuffer.putInt(newPartitionCnt); generateDREvent( EventType.DR_ELASTIC_CHANGE, uniqueId, m_lastCommittedSpHandle, spHandle, paramBuffer.array()); }
Source:
public static synchronized int getStyledColor(Theme theme, @AttrRes int attr) { theme.resolveAttribute(attr, TYPED_VALUE, true); return TYPED_VALUE.data; }

Target:
public static int getStyledColor(Theme theme, @AttrRes int attr) { theme.resolveAttribute(attr, TYPED_VALUE, true); return TYPED_VALUE.data; }
Source:
public SparkAnalysisRunner(JavaSparkContext sparkContext, SparkJobContext sparkJobContext, Integer minPartitions) { _sparkContext = sparkContext; _sparkJobContext = sparkJobContext; if ((minPartitions != null) && (minPartitions > 0)) { _minPartitions = minPartitions; } else { logger.warn( "Minimum number of partitions needs to be a positive number, but specified: {}. Disregarding the value and inferring the number of partitions automatically", minPartitions); _minPartitions = null; } }

Target:
public SparkAnalysisRunner(JavaSparkContext sparkContext, SparkJobContext sparkJobContext, Integer minPartitions) { _sparkContext = sparkContext; _sparkJobContext = sparkJobContext; if (minPartitions != null) { if (minPartitions > 0) { _minPartitions = minPartitions; } else { logger.warn( "Minimum number of partitions needs to be a positive number, but specified: {}. Disregarding the value and inferring the number of partitions automatically", minPartitions); _minPartitions = null; } } else { _minPartitions = null; } }
Source:
public void testExtensionClassLoader() throws ClassNotFoundException { final ClassLoader globalParent = ClassLoaderUtils.getParentClassLoader(); final File[] jarFiles = new File[] { new File("src/test/resources/FooBarPlugin.jar") }; final ClassLoader parent1 = ClassLoaderUtils.createClassLoader(jarFiles, null); final ClassLoader c1 = new ExtensionClassLoader(parent1, globalParent, "Extension1"); final Class<?> bazTransformer1 = c1.loadClass("foo.bar.transformer.BazTransformer"); Assert.assertNotNull(bazTransformer1); final ClassLoader parent2 = ClassLoaderUtils.createClassLoader(jarFiles, null); final ClassLoader c2 = new ExtensionClassLoader(parent2, globalParent, "Extension2"); final Class<?> bazTransformer2 = c2.loadClass("foo.bar.transformer.BazTransformer"); Assert.assertNotNull(bazTransformer2); final ClassLoader loader1 = bazTransformer1.getClassLoader(); final ClassLoader loader2 = bazTransformer2.getClassLoader(); Assert.assertEquals("Extension classloader for: Extension1", loader1.toString()); Assert.assertEquals("Extension classloader for: Extension2", loader2.toString()); }

Target:
public void testExtensionClassLoader() throws ClassNotFoundException { final ClassLoader globalParent = ClassLoaderUtils.getParentClassLoader(); final File[] jarFiles = new File[] { new File("src/test/resources/FooBarPlugin.jar") }; final ClassLoader parent1 = ClassLoaderUtils.createClassLoader(jarFiles, null); final ClassLoader c1 = new ExtensionClassLoader(parent1, globalParent, "Extension1"); final Class<?> bazTransformer1 = c1.loadClass("foo.bar.transformer.BazTransformer"); Assert.assertNotNull(bazTransformer1); final ClassLoader parent2 = ClassLoaderUtils.createClassLoader(jarFiles, null); final ClassLoader c2 = new ExtensionClassLoader(parent2, globalParent, "Extension2"); final Class<?> bazTransformer2 = c2.loadClass("foo.bar.transformer.BazTransformer"); Assert.assertNotNull(bazTransformer2); final ClassLoader loader1 = bazTransformer1.getClassLoader(); final ClassLoader loader2 = bazTransformer2.getClassLoader(); Assert.assertEquals("Extension classloader for: Extension1", loader1.toString()); Assert.assertEquals("Extension classloader for: Extension2", loader2.toString()); Assert.assertNotEquals(bazTransformer1, bazTransformer2); }
Source:
public AssetReportCreateRequest withFirstName(String firstName) { notNull(firstName, "firstName"); options = options.orElse(new Options()); options.get().user = options.get().user.orElse(new Options.UserOptions()); options.get().user.get().clientUserId = firstName; return this; }

Target:
public AssetReportCreateRequest withFirstName(String firstName) { notNull(firstName, "firstName"); options = options.orElse(new Options()); options.get().user = options.get().user.orElse(new Options.UserOptions()); options.get().user.get().firstName = firstName; return this; }
Source:
public void onResponseContent(Buffer content) { logger.debug("Jetty received response content of size " + String.valueOf(content.length())); JSONObject responseJson = new JSONObject(); try { responseJson.put("id", mRequestId); responseJson.put("body", content.asArray()); if (this.getStatus() != STATUS_CANCELLING && this.getStatus() != STATUS_CANCELLED) mSocket.emit("responseContentBinary", responseJson); logger.debug(String.format("Sent content to request %d", mRequestId)); } catch (JSONException e) { logger.error(e.getMessage()); } }

Target:
public void onResponseContent(Buffer content) { logger.debug("Jetty received response content of size " + String.valueOf(content.length())); JSONObject responseJson = new JSONObject(); try { responseJson.put("id", mRequestId); responseJson.put("body", content.asArray()); if (this.getStatus() != STATUS_CANCELLING && this.getStatus() != STATUS_CANCELLED) { mSocket.emit("responseContentBinary", responseJson); } logger.debug("Sent content to request {}", mRequestId); } catch (JSONException e) { logger.error(e.getMessage()); } }
Source:
public void testFetchLabelIdsForEmptyString() throws Exception { NGramGenerator ngram = new NGramGenerator(""); List<ResultSetFuture> result = searchPlugin.fetchLabelIds(ngram); assertNotNull(result); }

Target:
public void testFetchLabelIdsForEmptyString() throws Exception { List<ResultSetFuture> result = searchPlugin.fetchLabelIds(ImmutableSet.<String>of().iterator()); assertTrue(result.isEmpty()); }
Source:
private static RemediationFunction remediationFunction(AnalyzerMessage issue) { String ruleKey = ruleKey(issue); try { RuleJSON rule = getRuleJSON(ruleKey); if (rule.remediation == null) { return null; } switch (rule.remediation.func) { case "Linear": return RemediationFunction.LINEAR; case "Constant/Issue": return RemediationFunction.CONST; default: return null; } } catch (IOException | JsonParseException e) { LOG.warn("JSON metadata for rule " + ruleKey + " couldn't be loaded. Constant remediation function will be assumed." + " Provide rule JSON file if you want to customize metadata for tests."); LOG.debug(e.getMessage()); return null; } }

Target:
private static RemediationFunction remediationFunction(AnalyzerMessage issue) { String ruleKey = ruleKey(issue); try { RuleJSON rule = getRuleJSON(ruleKey); if (rule.remediation == null) { return null; } switch (rule.remediation.func) { case "Linear": return RemediationFunction.LINEAR; case "Constant/Issue": return RemediationFunction.CONST; default: return null; } } catch (IOException | JsonParseException e) { LOG.debug("Remediation function and cost not provided, \"constant\" is assumed."); return null; } }
Source:
protected boolean checkIfLunDiskCanBeAdded() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (StorageServerConnections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } if (getVm() == null) { return true; } return validate(getSnapshotValidator().vmNotDuringSnapshot(getVmId())) && validate(getSnapshotValidator().vmNotInPreview(getVmId())) && validate(new VmValidator(getVm()).vmNotLocked()); }

Target:
protected boolean checkIfLunDiskCanBeAdded() { LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); switch (lun.getLunType()) { case UNKNOWN: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_HAS_NO_VALID_TYPE); case ISCSI: if (lun.getLunConnections() == null || lun.getLunConnections().isEmpty()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } for (StorageServerConnections conn : lun.getLunConnections()) { if (StringUtils.isEmpty(conn.getiqn()) || StringUtils.isEmpty(conn.getconnection()) || StringUtils.isEmpty(conn.getport())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS); } } break; } if (getDiskLunMapDao().getDiskIdByLunId(lun.getLUN_id()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_LUN_IS_ALREADY_IN_USE); } if (getVm() != null) { if (!isVmNotInPreviewSnapshot()) { return false; } if (!isVmNotLocked()) { return false; } } return true; }
Source:
public int hashCode() { if (isDisposed()) return 0; return (((alpha * 31) + this.getGreen()) * 31 + this.getBlue()) * 31 + this.getRed(); }

Target:
public int hashCode() { if (isDisposed()) return 0; return (((this.getAlpha() * 31) + this.getGreen()) * 31 + this.getBlue()) * 31 + this.getRed(); }
Source:
void setResourceInformation(Resource resource, String resourceName, long amount) throws Exception { if (!isYarnResourceTypesAvailable) { throw new UnsupportedOperationException("Should not try to set ResourceInformation because the underlying Yarn does not support it."); } setResourceInfoMethod.invoke( resource, resourceName, resourceInfoNewInstance.invoke(null, resourceName, amount)); }

Target:
void setResourceInformation(Resource resource, String resourceName, long amount) { setResourceInformationUnSafe(resource, resourceName, amount); }