auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } if (tree.is(METHOD)) { MethodTree methodTree = (MethodTree) tree; Symbol.TypeSymbol enclosingClass = methodTree.symbol().enclosingClass(); String className = enclosingClass.type().fullyQualifiedName(); MethodMatcher writeObjectMatcher = SerializableContract.writeObjectMatcher(className); if (writeObjectMatcher.matches(methodTree) && hasModifier(methodTree.modifiers(), SYNCHRONIZED)) { SynchronizationVisitor visitor = new SynchronizationVisitor(); enclosingClass.declaration().accept(visitor); if (visitor.synchronizedMethodCount == 1 && !visitor.hasSynchronizedStmt) { reportIssue(ModifiersUtils.getModifier(methodTree.modifiers(), SYNCHRONIZED), "Remove this \"synchronized\" keyword."); } } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; Symbol.TypeSymbol enclosingClass = methodTree.symbol().enclosingClass(); String className = enclosingClass.type().fullyQualifiedName(); MethodMatcher writeObjectMatcher = SerializableContract.writeObjectMatcher(className); if (writeObjectMatcher.matches(methodTree) && hasModifier(methodTree.modifiers(), SYNCHRONIZED)) { SynchronizationVisitor visitor = new SynchronizationVisitor(methodTree); enclosingClass.declaration().accept(visitor); if (!visitor.moreThanSingleLock) { reportIssue(ModifiersUtils.getModifier(methodTree.modifiers(), SYNCHRONIZED), "Remove this \"synchronized\" keyword."); } } }
Source:
public long submitjobs(int threadPoolSize) throws Exception { List<JobId> allJobs = new LinkedList<>(); ProActiveConfiguration.load(); RMFactory.setOsJavaProperty(); schedulerHelper = new SchedulerTHelper(false, SCHEDULER_CONFIGURATION_START.getPath(), RM_CONFIGURATION_START.getPath(), null); final TaskFlowJob job = SchedulerEfficiencyMetricsTest.createJob(1, 1); final ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize); long startTime = System.currentTimeMillis(); List<Future<List<JobId>>> futures = new ArrayList<>(); for (int i = 0; i < threadPoolSize; ++i) { final Future<List<JobId>> future = executorService.submit(new Callable<List<JobId>>() { @Override public List<JobId> call() throws Exception { List<JobId> result = new ArrayList<>(); try { for (int i = 0; i < numberOfJobSubmittedByThread; ++i) { result.add(schedulerHelper.submitJob(job)); } } catch (Exception e) { e.printStackTrace(); } return result; } }); futures.add(future); } for (Future<List<JobId>> future : futures) { allJobs.addAll(future.get()); } long endTime = System.currentTimeMillis(); long actualTime = endTime - startTime; for (JobId jobId : allJobs) { if (!schedulerHelper.getSchedulerInterface().getJobState(jobId).isFinished()) { schedulerHelper.getSchedulerInterface().killJob(jobId); } schedulerHelper.getSchedulerInterface().removeJob(jobId); } return actualTime; }

Target:
public long submitjobs(int threadPoolSize) throws Exception { List<JobId> allJobs = new LinkedList<>(); ProActiveConfiguration.load(); RMFactory.setOsJavaProperty(); schedulerHelper = new SchedulerTHelper(false, SCHEDULER_CONFIGURATION_START.getPath(), RM_CONFIGURATION_START.getPath(), null); final TaskFlowJob job = SchedulerEfficiencyMetricsTest.createJob(1, 1); final ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize); long startTime = System.currentTimeMillis(); List<Future<List<JobId>>> futures = new ArrayList<>(); for (int i = 0; i < threadPoolSize; ++i) { final Future<List<JobId>> future = executorService.submit(() -> { List<JobId> result = new ArrayList<>(numberOfJobSubmittedByThread); repeater.accept(numberOfJobSubmittedByThread, () -> { result.add(schedulerHelper.submitJob(job)); }); return result; }); futures.add(future); } for (Future<List<JobId>> future : futures) { allJobs.addAll(future.get()); } long endTime = System.currentTimeMillis(); long actualTime = endTime - startTime; for (JobId jobId : allJobs) { if (!schedulerHelper.getSchedulerInterface().getJobState(jobId).isFinished()) { schedulerHelper.getSchedulerInterface().killJob(jobId); } schedulerHelper.getSchedulerInterface().removeJob(jobId); } return actualTime; }
Source:
protected void setActionItem(Action action, Object result) { if (result == null) { return; } String name = result.getClass().getSimpleName().toLowerCase(); for (Method m : action.getClass().getMethods()) { if (m.getName().startsWith("set") && m.getName().replace("set", "").toLowerCase().equals(name)) { try { m.invoke(action, result); break; } catch (Exception e) { log.error("Resource to action asignment failure: ", e.getMessage()); log.debug("Exception", e); break; } } } }

Target:
protected void setActionItem(Action action, Object result) { if (result == null) { return; } String name = result.getClass().getSimpleName().toLowerCase(); for (Method m : action.getClass().getMethods()) { if (m.getName().startsWith("set") && m.getName().replace("set", "").toLowerCase().equals(name)) { try { m.invoke(action, result); break; } catch (Exception e) { log.error("Resource to action assignment failure.", e); break; } } } }
Source:
public int hashCode() { return HashUtil.combineHashCodes((null != ul) ? ul.hashCode() : 0, (null != lr) ? lr.hashCode() : 0); }

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(ul), Objects.hashCode(lr)); }
Source:
protected void registerManager() { world.getSystem(AspectSubscriptionManager.class) .get(all()) .addSubscriptionListener(new EntitySubscription.SubscriptionListener() { @Override public void inserted(IntBag entities) { added(entities); } @Override public void removed(IntBag entities) { deleted(entities); } }); }

Target:
protected void registerManager() { world.getAspectSubscriptionManager() .get(all()) .addSubscriptionListener(new EntitySubscription.SubscriptionListener() { @Override public void inserted(IntBag entities) { added(entities); } @Override public void removed(IntBag entities) { deleted(entities); } }); }
Source:
private void handleMiscCode(byte cc2) { switch (cc2) { case CTRL_ROLL_UP_CAPTIONS_2_ROWS: captionRowCount = 2; setCaptionMode(CC_MODE_ROLL_UP); return; case CTRL_ROLL_UP_CAPTIONS_3_ROWS: captionRowCount = 3; setCaptionMode(CC_MODE_ROLL_UP); return; case CTRL_ROLL_UP_CAPTIONS_4_ROWS: captionRowCount = 4; setCaptionMode(CC_MODE_ROLL_UP); return; case CTRL_RESUME_CAPTION_LOADING: setCaptionMode(CC_MODE_POP_ON); return; case CTRL_RESUME_DIRECT_CAPTIONING: setCaptionMode(CC_MODE_PAINT_ON); return; } if (captionMode == CC_MODE_UNKNOWN) { return; } switch (cc2) { case CTRL_ERASE_DISPLAYED_MEMORY: if (captionMode == CC_MODE_ROLL_UP || captionMode == CC_MODE_PAINT_ON) { currentCue = new Eia608CueBuilder(); cues.clear(); } subtitle.setCues(Collections.<Cue>emptyList()); return; case CTRL_ERASE_NON_DISPLAYED_MEMORY: currentCue = new Eia608CueBuilder(); cues.clear(); return; case CTRL_END_OF_CAPTION: renderCues(); cues.clear(); return; case CTRL_CARRIAGE_RETURN: if (captionMode == CC_MODE_ROLL_UP) { for (Eia608CueBuilder cue : cues) { if (!cue.rollUp()) { cues.remove(cue); } } currentCue = new Eia608CueBuilder(); cues.add(currentCue); while (cues.size() > captionRowCount) { cues.pollFirst(); } } return; case CTRL_BACKSPACE: currentCue.backspace(); return; case CTRL_DELETE_TO_END_OF_ROW: return; } }

Target:
private void handleMiscCode(byte cc2) { switch (cc2) { case CTRL_ROLL_UP_CAPTIONS_2_ROWS: captionRowCount = 2; setCaptionMode(CC_MODE_ROLL_UP); return; case CTRL_ROLL_UP_CAPTIONS_3_ROWS: captionRowCount = 3; setCaptionMode(CC_MODE_ROLL_UP); return; case CTRL_ROLL_UP_CAPTIONS_4_ROWS: captionRowCount = 4; setCaptionMode(CC_MODE_ROLL_UP); return; case CTRL_RESUME_CAPTION_LOADING: setCaptionMode(CC_MODE_POP_ON); return; case CTRL_RESUME_DIRECT_CAPTIONING: setCaptionMode(CC_MODE_PAINT_ON); return; } if (captionMode == CC_MODE_UNKNOWN) { return; } switch (cc2) { case CTRL_ERASE_DISPLAYED_MEMORY: if (captionMode == CC_MODE_ROLL_UP || captionMode == CC_MODE_PAINT_ON) { currentCue = new Eia608CueBuilder(); cues.clear(); } subtitle.setCues(Collections.<Cue>emptyList()); return; case CTRL_ERASE_NON_DISPLAYED_MEMORY: currentCue = new Eia608CueBuilder(); cues.clear(); return; case CTRL_END_OF_CAPTION: renderCues(); cues.clear(); return; case CTRL_CARRIAGE_RETURN: if (captionMode == CC_MODE_ROLL_UP) { Iterator<Eia608CueBuilder> iterator = cues.iterator(); while (iterator.hasNext()) { Eia608CueBuilder cue = iterator.next(); if (!cue.rollUp()) { iterator.remove(); } } currentCue = new Eia608CueBuilder(); cues.add(currentCue); while (cues.size() > captionRowCount) { cues.pollFirst(); } } return; case CTRL_BACKSPACE: currentCue.backspace(); return; case CTRL_DELETE_TO_END_OF_ROW: return; } }
Source:
public CompletionStage<CacheStatusResponse> handleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId) { CompletionStage<Void> viewStage; if (joinerViewId <= viewId && clusterManagerStatus != ClusterManagerStatus.RECOVERING_CLUSTER) { viewStage = CompletableFutures.completedNull(); } else { if (trace) { log.tracef("Delaying join request from %s until view %s is installed (and cluster status is recovered)", joiner, joinerViewId); } viewStage = joinViewFuture.newConditionStage(ctmi -> ctmi.canHandleJoin(joinerViewId), joinInfo.getTimeout(), MILLISECONDS) .exceptionally(e -> wrapJoinTimeoutException(joinerViewId, e)); } return viewStage.thenApply(v -> prepareJoin(cacheName, joiner, joinInfo, joinerViewId)) .thenApply(cacheStatus -> { if (cacheStatus == null) { return null; } return cacheStatus.doJoin(joiner, joinInfo); }); }

Target:
public CompletionStage<CacheStatusResponse> handleJoin(String cacheName, Address joiner, CacheJoinInfo joinInfo, int joinerViewId) { CompletionStage<Void> viewStage; if (joinerViewId <= viewId && clusterManagerStatus != ClusterManagerStatus.RECOVERING_CLUSTER) { viewStage = CompletableFutures.completedNull(); } else { if (trace) { log.tracef("Delaying join request from %s until view %s is installed (and cluster status is recovered)", joiner, joinerViewId); } viewStage = joinViewFuture.newConditionStage(ctmi -> ctmi.canHandleJoin(joinerViewId), joinInfo.getTimeout(), MILLISECONDS) .exceptionally(e -> wrapJoinTimeoutException(joinerViewId, e)); } return viewStage.thenApply(v -> { ClusterCacheStatus cacheStatus = prepareJoin(cacheName, joiner, joinInfo, joinerViewId); if (cacheStatus == null) { return null; } return cacheStatus.doJoin(joiner, joinInfo); }); }
Source:
public void executeCommand() { Boolean tranRetVal = TransactionSupport.executeInNewTransaction(new TransactionMethod<Boolean>() { @Override public Boolean runInTransaction() { if (georepSessions != null) { for (GlusterGeoRepSession session : georepSessions) { GlusterVolumeEntity slaveVolume = getDbFacade().getGlusterVolumeDao().getById(session.getSlaveVolumeId()); if (slaveVolume == null) { continue; } VDS slaveUpServer = ClusterUtils.getInstance().getRandomUpServer(slaveVolume.getClusterId()); if (slaveUpServer == null) { handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESTORE_FAILED, VdcBllErrors.NoUpServerFoundInRemoteCluster.name()); setSucceeded(false); return false; } List<GlusterVolumeSnapshotEntity> slaveVolumeSnapshots = getGlusterVolumeSnapshotDao().getAllByVolumeId(slaveVolume.getId()); if (!deleteAllGlusterVolumeSnapshots(slaveUpServer.getId(), slaveVolume.getId(), slaveVolumeSnapshots)) { return false; } } } return true; } }); if (!tranRetVal) { return; } deleteAllGlusterVolumeSnapshots(getUpServer().getId(), getGlusterVolumeId(), snapshots); VDSReturnValue retVal = runVdsCommand(VDSCommandType.DeleteAllGlusterVolumeSnapshots, new GlusterVolumeVDSParameters(getUpServer().getId(), getGlusterVolumeName())); setSucceeded(retVal.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_ALL_SNAPSHOTS_DELETE_FAILED, retVal.getVdsError().getMessage()); } else { List<Guid> guids = new ArrayList<>(); for (GlusterVolumeSnapshotEntity snapshot : snapshots) { guids.add(snapshot.getId()); } getGlusterVolumeSnapshotDao().removeAll(guids); } }

Target:
public void executeCommand() { if (georepSessions != null) { for (GlusterGeoRepSession session : georepSessions) { GlusterVolumeEntity slaveVolume = getDbFacade().getGlusterVolumeDao().getById(session.getSlaveVolumeId()); if (slaveVolume == null) { continue; } VDS slaveUpServer = ClusterUtils.getInstance().getRandomUpServer(slaveVolume.getClusterId()); if (slaveUpServer == null) { handleVdsError(AuditLogType.GLUSTER_VOLUME_ALL_SNAPSHOTS_DELETE_FAILED, VdcBllErrors.NoUpServerFoundInRemoteCluster.name()); setSucceeded(false); return; } List<GlusterVolumeSnapshotEntity> slaveVolumeSnapshots = getGlusterVolumeSnapshotDao().getAllByVolumeId(slaveVolume.getId()); if (!deleteAllGlusterVolumeSnapshots(slaveUpServer.getId(), slaveVolume.getId(), slaveVolumeSnapshots)) { return; } } } deleteAllGlusterVolumeSnapshots(getUpServer().getId(), getGlusterVolumeId(), snapshots); }
Source:
public void registerMediaButtonEventReceiver(ComponentName componentName) { audioManager.registerMediaButtonEventReceiver(componentName); }

Target:
public void registerMediaButtonEventReceiver(ComponentName componentName) { if (android.os.Build.VERSION.SDK_INT > 27) { Log.e(TAG, "registerMediaButtonEventReceiver has been deprecated and maybe not supported anymore."); return; } audioManager.registerMediaButtonEventReceiver(componentName); }
Source:
private void updateActionAvailability() { boolean isInherited = false; Permission p = getSelectedItem(); if (p != null && getEntity() != null) { isInherited = !p.getAdElementId().equals(getEntity().getId()); String everyoneSearchType = AdElementListModel.AdSearchType.EVERYONE.toString(); if (getEntity().getFirstName().toUpperCase().equals(everyoneSearchType) && p.getOwnerName().toUpperCase().equals(everyoneSearchType)) { getRemoveCommand().setIsExecutionAllowed(false); } else { getRemoveCommand().setIsExecutionAllowed(!isInherited && (getSelectedItem() != null || (getSelectedItems() != null && getSelectedItems().size() > 0))); } } getAddCommand().setIsAvailable(false); }

Target:
private void updateActionAvailability() { Permission p = getSelectedItem(); if (p != null && ApplicationGuids.everyone.asGuid().equals(p.getAdElementId())) { getRemoveCommand().setIsExecutionAllowed(false); } else { boolean isInherited = p != null && getEntity() != null && !p.getAdElementId().equals(getEntity().getId()); getRemoveCommand().setIsExecutionAllowed(!isInherited && (getSelectedItem() != null || (getSelectedItems() != null && getSelectedItems().size() > 0))); } getAddCommand().setIsAvailable(false); }
Source:
private StoreResult parseToStoreResult(@Nonnull final IMAPResponse[] ir, @Nonnull final FetchItem[] extensionItems) throws ImapAsyncClientException, ProtocolException { if (ir.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = ir[ir.length - 1]; if (taggedResponse.isBAD()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<IMAPResponse> imapResponses = new ArrayList<>(ir.length); MessageNumberSet[] modifiedMsgsets = null; Long highestModSeq = null; for (final IMAPResponse sr: ir) { imapResponses.add(parseToFetchResponse(sr, extensionItems)); sr.skipSpaces(); if (sr.readByte() == (byte) L_BRACKET) { final String responseCode = sr.readAtom(); if (sr.isOK() && responseCode.equalsIgnoreCase("HIGHESTMODSEQ")) { highestModSeq = sr.readLong(); } else if (responseCode.equalsIgnoreCase("MODIFIED")) { modifiedMsgsets = MessageNumberSet.buildMessageNumberSets(sr.readAtom()); } } } return new StoreResult(highestModSeq, imapResponses, modifiedMsgsets); }

Target:
private StoreResult parseToStoreResult(@Nonnull final IMAPResponse[] ir, @Nonnull final FetchItem[] extensionItems) throws ImapAsyncClientException, ProtocolException { if (ir.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = ir[ir.length - 1]; if (taggedResponse.isBAD()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<FetchResponse> fetchResponses = new ArrayList<>(); MessageNumberSet[] modifiedMsgsets = null; Long highestModSeq = null; for (final IMAPResponse sr: ir) { sr.skipSpaces(); if (sr.keyEquals("FETCH")) { fetchResponses.add(parseToFetchResponse(sr, extensionItems)); } else if (sr.readByte() == (byte) L_BRACKET) { final String responseCode = sr.readAtom(); if (sr.isOK() && responseCode.equalsIgnoreCase("HIGHESTMODSEQ")) { highestModSeq = sr.readLong(); } else if (responseCode.equalsIgnoreCase("MODIFIED")) { modifiedMsgsets = MessageNumberSet.buildMessageNumberSets(sr.readAtom()); } } } return new StoreResult(highestModSeq, fetchResponses, modifiedMsgsets); }
Source:
public ChamberSentry(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT,CardType.CREATURE}, "{X}"); this.subtype.add(SubType.CONSTRUCT); this.power = new MageInt(0); this.toughness = new MageInt(0); this.addAbility(new SunburstAbility(this)); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new ManacostVariableValue()), new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); this.addAbility(new SimpleActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), new ManaCostsImpl("{W}{U}{B}{R}{G}"))); }

Target:
public ChamberSentry(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT,CardType.CREATURE}, "{X}"); this.subtype.add(SubType.CONSTRUCT); this.power = new MageInt(0); this.toughness = new MageInt(0); this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(), ColorsOfManaSpentToCastCount.getInstance(), true))); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new ManacostVariableValue()), new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); ability.addCost(new ChamberSentryRemoveVariableCountersSourceCost(CounterType.P1P1.createInstance())); ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); this.addAbility(new SimpleActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), new ManaCostsImpl("{W}{U}{B}{R}{G}"))); }
Source:
public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; if (doc.getXObject(Group.CLASS_REFERENCE) == null) { return; } DocumentReference docReference = doc.getDocumentReference(); if ("PhenoTipsGroupTemplate".equals(docReference.getName())) { return; } XWikiContext context = (XWikiContext) data; DocumentReference adminsReference = new DocumentReference(docReference.getName() + " Administrators", docReference.getLastSpaceReference()); XWiki xwiki = context.getWiki(); try { XWikiDocument adminsDoc = xwiki.getDocument(adminsReference, context); setMembers(this.dab.getCurrentUserReference(), adminsDoc, context); setRights(adminsReference, adminsDoc, context); adminsDoc.setParent(docReference.toString()); xwiki.saveDocument(adminsDoc, "Automatically created administrative group", true, context); setMembers(adminsReference, doc, context); setRights(adminsReference, doc, context); } catch (XWikiException ex) { this.logger.error("Failed to set up the new group [{}]: {}", docReference, ex.getMessage(), ex); } }

Target:
public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; if (doc.getXObject(Group.CLASS_REFERENCE) == null) { return; } DocumentReference docReference = doc.getDocumentReference(); if ("PhenoTipsGroupTemplate".equals(docReference.getName())) { return; } XWikiContext context = (XWikiContext) data; DocumentReference adminsReference = new DocumentReference(docReference.getName() + " Administrators", docReference.getLastSpaceReference()); XWiki xwiki = context.getWiki(); try { XWikiDocument adminsDoc = xwiki.getDocument(adminsReference, context); setMembers(this.dab.getCurrentUserReference(), adminsDoc, context); setRights(adminsReference, adminsDoc, context); adminsDoc.setParentReference(new EntityReference(docReference)); xwiki.saveDocument(adminsDoc, "Automatically created administrative group", true, context); setMembers(adminsReference, doc, context); setRights(adminsReference, doc, context); } catch (XWikiException ex) { this.logger.error("Failed to set up the new group [{}]: {}", docReference, ex.getMessage(), ex); } }
Source:
private void compileRulesLevel(PackageDescr packageDescr, PackageRegistry pkgRegistry, List<RuleDescr> rules) { boolean parallelRulesBuild = this.kBase == null && parallelRulesBuildThreshold != -1 && rules.size() > parallelRulesBuildThreshold; if (parallelRulesBuild) { Map<String, RuleBuildContext> ruleCxts = new ConcurrentHashMap<>(); ForkJoinPool pool = new ForkJoinPool(); try { pool.submit(() -> rules.stream().parallel() .filter(ruleDescr -> filterAccepts(ResourceChange.Type.RULE, ruleDescr.getNamespace(), ruleDescr.getName())) .forEach(ruleDescr -> { initRuleDescr(packageDescr, pkgRegistry, ruleDescr); RuleBuildContext context = buildRuleBuilderContext(pkgRegistry, ruleDescr); ruleCxts.put(ruleDescr.getName(), context); List<? extends KnowledgeBuilderResult> results = addRule(context); if (!results.isEmpty()) { synchronized (this.results) { this.results.addAll(results); } } }) ).get(); } catch (InterruptedException | ExecutionException e) { logger.error("An error has occurred during rules compilation", e); } for (RuleDescr ruleDescr : rules) { RuleBuildContext context = ruleCxts.get(ruleDescr.getName()); if (context != null) { pkgRegistry.getPackage().addRule(context.getRule()); } } } else { for (RuleDescr ruleDescr : rules) { if (filterAccepts(ResourceChange.Type.RULE, ruleDescr.getNamespace(), ruleDescr.getName())) { initRuleDescr(packageDescr, pkgRegistry, ruleDescr); RuleBuildContext context = buildRuleBuilderContext(pkgRegistry, ruleDescr); this.results.addAll(addRule(context)); pkgRegistry.getPackage().addRule(context.getRule()); } } } }

Target:
private void compileRulesLevel(PackageDescr packageDescr, PackageRegistry pkgRegistry, List<RuleDescr> rules) { boolean parallelRulesBuild = this.kBase == null && parallelRulesBuildThreshold != -1 && rules.size() > parallelRulesBuildThreshold; if (parallelRulesBuild) { Map<String, RuleBuildContext> ruleCxts = new ConcurrentHashMap<>(); ForkJoinPool pool = new ForkJoinPool(); try { pool.submit(() -> rules.stream().parallel() .filter(ruleDescr -> filterAccepts(ResourceChange.Type.RULE, ruleDescr.getNamespace(), ruleDescr.getName())) .forEach(ruleDescr -> { initRuleDescr(packageDescr, pkgRegistry, ruleDescr); RuleBuildContext context = buildRuleBuilderContext(pkgRegistry, ruleDescr); ruleCxts.put(ruleDescr.getName(), context); List<? extends KnowledgeBuilderResult> results = addRule(context); if (!results.isEmpty()) { synchronized (this.results) { this.results.addAll(results); } } }) ).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("Rules compilation failed or interrupted", e); } for (RuleDescr ruleDescr : rules) { RuleBuildContext context = ruleCxts.get(ruleDescr.getName()); if (context != null) { pkgRegistry.getPackage().addRule(context.getRule()); } } } else { for (RuleDescr ruleDescr : rules) { if (filterAccepts(ResourceChange.Type.RULE, ruleDescr.getNamespace(), ruleDescr.getName())) { initRuleDescr(packageDescr, pkgRegistry, ruleDescr); RuleBuildContext context = buildRuleBuilderContext(pkgRegistry, ruleDescr); this.results.addAll(addRule(context)); pkgRegistry.getPackage().addRule(context.getRule()); } } } }
Source:
public MemcacheClientBuilder<V> withRequestBatchSize(final int batchSize) { this.batchSize = batchSize; return this; }

Target:
public MemcacheClientBuilder<V> withRequestBatchSize(final int batchSize) { checkArgument(batchSize > 0, "batch size must be > 0"); this.batchSize = batchSize; return this; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TimestampSpec that = (TimestampSpec) o; return Objects.equal(this.timestampColumn, that.timestampColumn) && Objects.equal(this.timestampFormat, that.timestampFormat) && Objects.equal(this.timeZone, that.timeZone) && Objects.equal(this.missingValue, that.missingValue); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TimestampSpec that = (TimestampSpec) o; if (!timestampColumn.equals(that.timestampColumn)) { return false; } if (!timestampFormat.equals(that.timestampFormat)) { return false; } if (missingValue != null ? !missingValue.equals(that.missingValue) : that.missingValue != null) { return false; } return timeZone != null ? timeZone.equals(that.timeZone) : that.timeZone == null; }
Source:
public static SegmentGeneratorConfig generateSegmentGeneratorConfig(TableConfig tableConfig, BatchConfig batchConfig, Schema schema, File inputFile, File outputSegmentDir) throws ClassNotFoundException, IOException { SegmentGeneratorConfig segmentGeneratorConfig = new SegmentGeneratorConfig(tableConfig, schema); segmentGeneratorConfig.setTableName(tableConfig.getTableName()); segmentGeneratorConfig.setOutDir(outputSegmentDir.getAbsolutePath()); segmentGeneratorConfig.setInputFilePath(inputFile.getAbsolutePath()); FileFormat fileFormat = batchConfig.getInputFormat(); segmentGeneratorConfig.setFormat(fileFormat); segmentGeneratorConfig.setRecordReaderPath(RecordReaderFactory.getRecordReaderClassName(fileFormat.toString())); String readerConfigClassName = RecordReaderFactory.getRecordReaderConfigClassName(fileFormat.toString()); if (readerConfigClassName != null) { Map<String, String> configs = batchConfig.getRecordReaderProps(); if (configs == null) { configs = Collections.emptyMap(); } JsonNode jsonNode = new ObjectMapper().valueToTree(IngestionConfigUtils.getRecordReaderProps(configs)); Class<?> clazz = PluginManager.get().loadClass(readerConfigClassName); RecordReaderConfig recordReaderConfig = (RecordReaderConfig) JsonUtils.jsonNodeToObject(jsonNode, clazz); segmentGeneratorConfig.setReaderConfig(recordReaderConfig); } segmentGeneratorConfig.setSegmentNameGenerator( new SimpleSegmentNameGenerator(tableConfig.getTableName(), String.valueOf(System.currentTimeMillis()))); return segmentGeneratorConfig; }

Target:
public static SegmentGeneratorConfig generateSegmentGeneratorConfig(TableConfig tableConfig, BatchConfig batchConfig, Schema schema, File inputFile, File outputSegmentDir) throws ClassNotFoundException, IOException { SegmentGeneratorConfig segmentGeneratorConfig = new SegmentGeneratorConfig(tableConfig, schema); segmentGeneratorConfig.setTableName(tableConfig.getTableName()); segmentGeneratorConfig.setOutDir(outputSegmentDir.getAbsolutePath()); segmentGeneratorConfig.setInputFilePath(inputFile.getAbsolutePath()); FileFormat fileFormat = batchConfig.getInputFormat(); segmentGeneratorConfig.setFormat(fileFormat); segmentGeneratorConfig.setRecordReaderPath(RecordReaderFactory.getRecordReaderClassName(fileFormat.toString())); Map<String, String> configs = batchConfig.getRecordReaderProps(); segmentGeneratorConfig.setReaderConfig( RecordReaderFactory.getRecordReaderConfig(fileFormat, IngestionConfigUtils.getRecordReaderProps(configs))); segmentGeneratorConfig.setSegmentNameGenerator( new SimpleSegmentNameGenerator(tableConfig.getTableName(), String.valueOf(System.currentTimeMillis()))); return segmentGeneratorConfig; }
Source:
public static boolean equalsLowerCase(CharSequence l, int lLo, int lHi, CharSequence r, int rLo, int rHi) { if (l == r) { return true; } int ll = lHi - lLo; if (ll != rHi - rLo) { return false; } for (int i = 0; i < ll; i++) { if (Character.toLowerCase(l.charAt(i + lLo)) != r.charAt(i + rLo)) { return false; } } return true; }

Target:
public static boolean equalsLowerCase(CharSequence l, int lLo, int lHi, CharSequence r, int rLo, int rHi) { if (l == r) { return true; } int ll = lHi - lLo; if (ll != rHi - rLo) { return false; } for (int i = 0; i < ll; i++) { if (Character.toLowerCase(l.charAt(i + lLo)) != Character.toLowerCase(r.charAt(i + rLo))) { return false; } } return true; }
Source:
public void getSchedulePlansIncludeDeleted() { dao.getSchedulePlans(ClientInfo.UNKNOWN_CLIENT, TestConstants.TEST_STUDY, false); verify(mapper).queryPage(eq(DynamoSchedulePlan.class), queryCaptor.capture()); Condition condition = new Condition().withComparisonOperator(ComparisonOperator.NE) .withAttributeValueList(new AttributeValue().withN("1")); assertEquals(condition, queryCaptor.getValue().getQueryFilter().get("deleted")); }

Target:
public void getSchedulePlansIncludeDeleted() { dao.getSchedulePlans(ClientInfo.UNKNOWN_CLIENT, TestConstants.TEST_STUDY, true); verify(mapper).queryPage(eq(DynamoSchedulePlan.class), queryCaptor.capture()); assertNull(queryCaptor.getValue().getQueryFilter()); }
Source:
public <T extends TopLevelItem> T create(Class<T> type, String name) { visit("newJob"); fillIn("name", name); findCaption(type, getFinder()).click(); try { executeScript( "var obj = document.getElementById('name');" + "var ev = document.createEvent('MouseEvents');" + "ev.initEvent('blur', true, false);" + "obj.dispatchEvent(ev);" + "return true;"); } catch(Exception e) { } clickButton("OK"); waitFor(by.name("config"), 10); final T j = get(type, name); waitFor().withTimeout(3, TimeUnit.SECONDS) .until(new Callable<Object>() { @Override public Object call() throws Exception { try { j.getJson(); return true; } catch (Exception e) { return false; } } }); return j; }

Target:
public <T extends TopLevelItem> T create(Class<T> type, String name) { visit("newJob"); fillIn("name", name); findCaption(type, getFinder()).click(); try { blur(find(By.name("name"))); } catch (Exception e) { } clickButton("OK"); waitFor(by.name("config"), 10); final T j = get(type, name); waitFor().withTimeout(3, TimeUnit.SECONDS) .until(new Callable<Object>() { @Override public Object call() throws Exception { try { j.getJson(); return true; } catch (Exception e) { return false; } } }); return j; }
Source:
public void testCanBeSatisfiedBy() { final NetworkRequest request = new NetworkRequest.Builder() .setCapabilities(TEST_CAPABILITIES) .build(); assertFalse(request.canBeSatisfiedBy(null)); assertFalse(request.canBeSatisfiedBy(new NetworkCapabilities())); assertTrue(request.canBeSatisfiedBy(TEST_CAPABILITIES.addCapability(NET_CAPABILITY_MMS))); assertEquals(request.canBeSatisfiedBy(TEST_CAPABILITIES), TEST_CAPABILITIES.satisfiedByNetworkCapabilities(TEST_CAPABILITIES)); }

Target:
public void testCanBeSatisfiedBy() { final WifiNetworkSpecifier specifier1 = new WifiNetworkSpecifier.Builder() .setSsidPattern(new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL)) .setBssidPattern(ARBITRARY_ADDRESS, ARBITRARY_ADDRESS) .build(); final WifiNetworkSpecifier specifier2 = new WifiNetworkSpecifier.Builder() .setSsidPattern(new PatternMatcher(OTHER_SSID, PatternMatcher.PATTERN_LITERAL)) .setBssidPattern(ARBITRARY_ADDRESS, ARBITRARY_ADDRESS) .build(); final NetworkCapabilities cap = new NetworkCapabilities() .addTransportType(TRANSPORT_WIFI) .addCapability(NET_CAPABILITY_INTERNET); final NetworkCapabilities capWithSp = new NetworkCapabilities(cap).setNetworkSpecifier(specifier1); final NetworkCapabilities cellCap = new NetworkCapabilities() .addTransportType(TRANSPORT_CELLULAR) .addCapability(NET_CAPABILITY_MMS) .addCapability(NET_CAPABILITY_INTERNET); final NetworkRequest request = new NetworkRequest.Builder() .addTransportType(TRANSPORT_WIFI) .addCapability(NET_CAPABILITY_INTERNET) .setNetworkSpecifier(specifier1) .build(); assertFalse(request.canBeSatisfiedBy(null)); assertFalse(request.canBeSatisfiedBy(new NetworkCapabilities())); assertTrue(request.canBeSatisfiedBy(cap)); assertTrue(request.canBeSatisfiedBy( new NetworkCapabilities(cap).addTransportType(TRANSPORT_VPN))); assertTrue(request.canBeSatisfiedBy(capWithSp)); assertFalse(request.canBeSatisfiedBy( new NetworkCapabilities(cap).setNetworkSpecifier(specifier2))); assertFalse(request.canBeSatisfiedBy(cellCap)); assertEquals(request.canBeSatisfiedBy(capWithSp), new NetworkCapabilities(capWithSp).satisfiedByNetworkCapabilities(capWithSp)); }
Source:
public void start() { this.waitStrategy = new HostPortWaitStrategy() .withStartupTimeout(Duration.of(300, SECONDS)); this.withCreateContainerCmdModifier(createContainerCmd -> { createContainerCmd.withHostName(hostname); createContainerCmd.withName(getContainerName()); }); super.start(); log.info("Started bookie at cluster {}", hostname, clusterName); }

Target:
public void start() { if (Strings.isNullOrEmpty(extraServerComponents)) { this.waitStrategy = new HttpWaitStrategy() .forPath("/heartbeat") .forStatusCode(200) .forPort(BOOKIE_HTTP_PORT) .withStartupTimeout(Duration.of(60, SECONDS)); } else { this.waitStrategy = new HostPortWaitStrategy() .withStartupTimeout(Duration.of(300, SECONDS)); } this.withCreateContainerCmdModifier(createContainerCmd -> { createContainerCmd.withHostName(hostname); createContainerCmd.withName(getContainerName()); }); super.start(); log.info("Started bookie at cluster {}", hostname, clusterName); }
Source:
public GoogleBuilder() { super(GoogleAuthProvider.PROVIDER_ID); if (getApplicationContext().getString(R.string.default_web_client_id) .equals(UNCONFIGURED_CONFIG_VALUE)) { throw new RuntimeException("Check your google-services plugin configuration," + " the client id string wasn't populated."); } }

Target:
public GoogleBuilder() { super(GoogleAuthProvider.PROVIDER_ID); Preconditions.checkConfigured(getApplicationContext(), "Check your google-services plugin configuration, the" + " default_web_client_id string wasn't populated.", R.string.default_web_client_id); }
Source:
public void sendEventAsync(String jsonEvent) { ExecutorService executorService = executor.get(); if (executorService == null) { final int maxSize = Integer.getInteger(getClass().getName() + ".max", this.maxSize); executorService = new ThreadPoolExecutor( Math.min(Integer.getInteger(getClass().getName() + ".core", coreSize), maxSize), maxSize, Integer.getInteger(getClass().getName() + ".keepAliveMs", keepAliveMs), MILLISECONDS, new LinkedBlockingQueue<>(), new ThreadFactory() { private final AtomicInteger counter = new AtomicInteger(); @Override public Thread newThread(final Runnable worker) { final Thread thread = new Thread(worker, HttpEventSender.class.getName() + "-thread-" + counter.incrementAndGet()); thread.setPriority(Thread.NORM_PRIORITY); thread.setDaemon(false); return thread; } }); if (!executor.compareAndSet(null, executorService)) { executorService.shutdownNow(); executorService = executor.get(); } } executorService.execute(new LogSender(jsonEvent)); }

Target:
public void sendEventAsync(String jsonEvent) { ExecutorService executorService = executor.get(); if (executorService == null) { executorService = new ThreadPoolExecutor(Math.min(coreSize, maxSize), maxSize, keepAliveMs, MILLISECONDS, queueSize < 0 ? new LinkedBlockingQueue<>() : (queueSize == 0 ? new SynchronousQueue<>() : new ArrayBlockingQueue<>(queueSize)), new ThreadFactory() { private final AtomicInteger counter = new AtomicInteger(); @Override public Thread newThread(final Runnable worker) { final Thread thread = new Thread(worker, HttpEventSender.class.getName() + "-thread-" + counter.incrementAndGet()); thread.setPriority(Thread.NORM_PRIORITY); thread.setDaemon(false); return thread; } }); if (!executor.compareAndSet(null, executorService)) { executorService.shutdownNow(); executorService = executor.get(); } } executorService.execute(new LogSender(jsonEvent)); }
Source:
public String getValue(final String parm, final String parsedParm, final Event event, final EventUtil eventUtil) { if (event.getNodeid() != null) { try { return eventUtil.getPrimaryInterface(event.getNodeid()); } catch (SQLException ex) { LoggerFactory.getLogger(getClass()).info("primary interface ipaddr unavailable for node with id:", event.getNodeid(), ex); } } return null; }

Target:
public String getValue(final String parm, final String parsedParm, final Event event, final EventUtil eventUtil) { if (event.getNodeid() != null) { try { return eventUtil.getPrimaryInterface(event.getNodeid()); } catch (SQLException ex) { LOG.info("primary interface ipaddr unavailable for node with id: {}", event.getNodeid(), ex); } } return null; }
Source:
public static ArrayPool<byte[]> getByteArrayPool() { synchronized (Caches.class) { if (byteArrayPool == null) { byteArrayPool = new ArrayPool(1024, 8 * 1024 * 1024, 2028 * 1024 * 1024, new ByteArrayAllocator()); } } return byteArrayPool; }

Target:
public static ArrayPool<byte[]> getByteArrayPool() { synchronized (Caches.class) { if (byteArrayPool == null) { byteArrayPool = new ArrayPool(BYTE_SMALLEST_ARRAY_SIZE, BYTE_LARGEST_ARRAY_SIZE, BYTE_POOL_CAPACITY, new ByteArrayAllocator()); } } return byteArrayPool; }
Source:
private void doPostProjectUsersUpdate(final Project project, final User... users) { final URI usersUri = getUsersUri(project); final ProjectUsersUpdateResult projectUsersUpdateResult = restTemplate.postForObject(usersUri, new Users(users), ProjectUsersUpdateResult.class); if (!projectUsersUpdateResult.getFailed().isEmpty()) { throw new ProjectUsersUpdateException("Unable to update users: " + projectUsersUpdateResult.getFailed()); } }

Target:
private void doPostProjectUsersUpdate(final Project project, final User... users) { final URI usersUri = getUsersUri(project); try { final ProjectUsersUpdateResult projectUsersUpdateResult = restTemplate.postForObject(usersUri, new Users(users), ProjectUsersUpdateResult.class); if (!projectUsersUpdateResult.getFailed().isEmpty()) { throw new ProjectUsersUpdateException("Unable to update users: " + projectUsersUpdateResult.getFailed()); } } catch (RestClientException e) { throw new GoodDataException("Unable to update users in project", e); } }
Source:
private Map<Archive, Resource> parseSingle(Archive archive, File single) throws Exception { ResourceBuilder rb = new ResourceBuilder(); boolean hasIdentity = rb.addFile(single, single.toURI()); String name = archive.getWithoutVersion(); MavenVersion version = archive.revision.version; BridgeRepository.addInformationCapability(rb, name, version.getOSGiVersion(), repo.toString(), !hasIdentity ? Constants.NOT_A_BUNDLE_S : null, archive.revision.group, archive.revision.artifact, version.toString(), archive.extension, archive.classifier); Resource resource = rb.build(); return Collections.singletonMap(archive, resource); }

Target:
private Map<Archive, Resource> parseSingle(Archive archive, File single) throws Exception { ResourceBuilder rb = new ResourceBuilder(); boolean hasIdentity = rb.addFile(single, single.toURI()); if (!hasIdentity) { String name = archive.getWithoutVersion(); MavenVersion version = archive.revision.version; BridgeRepository.addInformationCapability(rb, name, version.getOSGiVersion(), repo.toString(), Constants.NOT_A_BUNDLE_S); } MavenCapability.addMavenCapability(rb, archive.revision.group, archive.revision.artifact, archive.revision.version, archive.classifier, repo.toString()); Resource resource = rb.build(); return Collections.singletonMap(archive, resource); }
Source:
public int execute(ExecutionContext context) throws IOException, InterruptedException { ImmutableList.Builder<String> command = createCommandList(); ProcessBuilder processBuilder = new ProcessBuilder(command.build()); Map<String, String> env = processBuilder.environment(); env.clear(); env.putAll(context.getEnvironment()); env.put("BUCK_INVOKING_RULE", invokingRule.toString()); env.put("BUCK_TARGET", invokingRule.toString()); env.put("BUCK_DIRECTORY_ROOT", filesystem.getRootPath().toAbsolutePath().toString()); processBuilder.directory(filesystem.getRootPath().toAbsolutePath().toFile()); int exitCode = -1; try { exitCode = context.getProcessExecutor().execute(processBuilder.start()).getExitCode(); } catch (IOException e) { e.printStackTrace(context.getStdErr()); return exitCode; } return exitCode; }

Target:
public int execute(ExecutionContext context) throws IOException, InterruptedException { ProcessBuilder processBuilder = new ProcessBuilder(createCommand()); Map<String, String> env = processBuilder.environment(); env.clear(); env.putAll(context.getEnvironment()); processBuilder.directory(filesystem.getRootPath().toAbsolutePath().toFile()); int exitCode = -1; try { exitCode = context.getProcessExecutor().execute(processBuilder.start()).getExitCode(); } catch (IOException e) { e.printStackTrace(context.getStdErr()); return exitCode; } return exitCode; }
Source:
protected static Ds3Request makeRequiredParam( final Ds3Request ds3Request, final String nameSpacing, final String optionalParamName, final int responseCode, final String responseType, final String responseComponentType) { return new Ds3Request( nameSpaceSplitRequest(ds3Request.getName(), nameSpacing), ds3Request.getHttpVerb(), ds3Request.getClassification(), ds3Request.getBucketRequirement(), ds3Request.getObjectRequirement(), ds3Request.getAction(), ds3Request.getResource(), ds3Request.getResourceType(), ds3Request.getOperation(), modifyResponseCode( ds3Request.getDs3ResponseCodes(), responseCode, responseType, responseComponentType), removeDs3Param( ds3Request.getOptionalQueryParams(), optionalParamName), addDs3Param( ds3Request.getRequiredQueryParams(), getDs3Param(ds3Request.getOptionalQueryParams(), optionalParamName)) ); }

Target:
protected static Ds3Request makeRequiredParam( final Ds3Request ds3Request, final String nameSpacing, final String optionalParamName, final int responseCode, final String responseType, final String responseComponentType) throws ResponseTypeNotFoundException { return new Ds3Request( nameSpaceSplitRequest(ds3Request.getName(), nameSpacing), ds3Request.getHttpVerb(), ds3Request.getClassification(), ds3Request.getBucketRequirement(), ds3Request.getObjectRequirement(), ds3Request.getAction(), ds3Request.getResource(), ds3Request.getResourceType(), ds3Request.getOperation(), modifyResponseCode( ds3Request.getDs3ResponseCodes(), responseCode, responseType, responseComponentType), removeDs3Param( ds3Request.getOptionalQueryParams(), optionalParamName), addDs3Param( ds3Request.getRequiredQueryParams(), getDs3Param(ds3Request.getOptionalQueryParams(), optionalParamName)) ); }
Source:
private Optional<Object> buildExportStatements(String nodeId, Alien4CloudApplication toscaApplication, Operation op, String computeName, String script) { Map<String, PaaSNodeTemplate> builtPaaSNodeTemplates = getAllNodes(toscaApplication); PaaSNodeTemplate paasNodeTemplate = builtPaaSNodeTemplates.get(computeName); Map<String, IValue> inputParameters = op.getInputParameters(); if (inputParameters == null) { return Optional.absent(); } Object testvalue = null; List<Object> dsls = Lists.newArrayList(); for (Map.Entry<String, IValue> entry : inputParameters.entrySet()) { Optional<Object> value = resolve(inputParameters, entry.getKey(), paasNodeTemplate, builtPaaSNodeTemplates, toscaApplication.getKeywordMap(nodeId)); if (value.isPresent()) { dsls.add(BrooklynDslCommon.formatString("export %s=\"%s\"", entry.getKey(), value.get())); if (!DslUtils.resolved(value.get())) { testvalue = value.get(); } } } dsls.add(script); return Optional.of(BrooklynDslCommon.formatString(Strings.repeat("%s\n", dsls.size()), dsls.toArray())); }

Target:
private Optional<Object> buildExportStatements(String nodeId, Alien4CloudApplication toscaApplication, Operation op, String computeName, String script) { Map<String, PaaSNodeTemplate> builtPaaSNodeTemplates = getAllNodes(toscaApplication); PaaSNodeTemplate paasNodeTemplate = builtPaaSNodeTemplates.get(computeName); Map<String, IValue> inputParameters = op.getInputParameters(); if (inputParameters == null) { return Optional.absent(); } List<Object> dsls = Lists.newArrayList(); for (Map.Entry<String, IValue> entry : inputParameters.entrySet()) { Optional<Object> value = resolve(inputParameters, entry.getKey(), paasNodeTemplate, builtPaaSNodeTemplates, toscaApplication.getKeywordMap(nodeId)); if (value.isPresent() && !Strings.isBlank(entry.toString())) { dsls.add(BrooklynDslCommon.formatString("export %s=\"%s\"", entry.getKey(), value.get())); } } dsls.add(script); return Optional.of(BrooklynDslCommon.formatString(Strings.repeat("%s\n", dsls.size()), dsls.toArray())); }
Source:
private void validateLotAndScale(final TransactionDto transactionDto) { final LotsSearchDto lotsSearchDto = new LotsSearchDto(); lotsSearchDto.setLotIds(Lists.newArrayList(transactionDto.getLot().getLotId())); final List<ExtendedLotDto> result = this.lotService.searchLots(lotsSearchDto, null); if (result.size() == 1) { final Integer scaleId = result.get(0).getScaleId(); this.inventoryScaleValidator.validateNotNullInventoryScaleId(this.errors, scaleId); } else { this.errors.rejectValue("transaction.wrong.lot", ""); } }

Target:
private void validateLotAndScale(final TransactionDto transactionDto) { final LotsSearchDto lotsSearchDto = new LotsSearchDto(); lotsSearchDto.setLotIds(Lists.newArrayList(transactionDto.getLot().getLotId())); final List<ExtendedLotDto> result = this.lotService.searchLots(lotsSearchDto, null); if (result.size() == 1) { final ExtendedLotDto lot = result.get(0); final Integer scaleId = lot.getScaleId(); this.inventoryScaleValidator.validateNotNullInventoryScaleId(this.errors, scaleId); if (lot.getStatus().equalsIgnoreCase(LotStatus.CLOSED.name())) { this.errors.reject("transaction.closed.lot", ""); } } else { this.errors.reject("transaction.wrong.lot", ""); } }
Source:
static FeignException errorReading(Request request, Response ignored, IOException cause) { return new FeignException( format("%s reading %s %s", cause.getMessage(), request.httpMethod().name(), request.url()), cause); }

Target:
static FeignException errorReading(Request request, Response ignored, IOException cause) { return new FeignException( format("%s reading %s %s", cause.getMessage(), request.httpMethod(), request.url()), cause); }
Source:
public void testBumpTransactionalEpochOnRecoverableAddPartitionRequestError() { final long producerId = 13131L; final short initialEpoch = 1; final short bumpedEpoch = 2; doInitTransactions(producerId, initialEpoch); transactionManager.beginTransaction(); transactionManager.failIfNotReadyForSend(); transactionManager.maybeAddPartitionToTransaction(tp0); prepareAddPartitionsToTxnResponse(Errors.INVALID_PRODUCER_ID_MAPPING, tp0, initialEpoch, producerId); sender.runOnce(); assertTrue(transactionManager.hasAbortableError()); TransactionalRequestResult abortResult = transactionManager.beginAbort(); prepareInitPidResponse(Errors.NONE, false, producerId, bumpedEpoch); sender.runOnce(); assertEquals(bumpedEpoch, transactionManager.producerIdAndEpoch().epoch); assertTrue(abortResult.isCompleted()); assertTrue(abortResult.isSuccessful()); assertTrue(transactionManager.isReady()); }

Target:
public void testBumpTransactionalEpochOnRecoverableAddPartitionRequestError() { final long producerId = 13131L; final short initialEpoch = 1; final short bumpedEpoch = 2; doInitTransactions(producerId, initialEpoch); transactionManager.beginTransaction(); transactionManager.failIfNotReadyForSend(); transactionManager.maybeAddPartitionToTransaction(tp0); prepareAddPartitionsToTxnResponse(Errors.INVALID_PRODUCER_ID_MAPPING, tp0, initialEpoch, producerId); runUntil(transactionManager::hasAbortableError); TransactionalRequestResult abortResult = transactionManager.beginAbort(); prepareInitPidResponse(Errors.NONE, false, producerId, bumpedEpoch); runUntil(abortResult::isCompleted); assertEquals(bumpedEpoch, transactionManager.producerIdAndEpoch().epoch); assertTrue(abortResult.isSuccessful()); assertTrue(transactionManager.isReady()); }
Source:
private boolean isEmulatedMachineChanged() { return !StringUtils.equals( getParameters().getVm().getCustomEmulatedMachine(), getVm().getCustomEmulatedMachine()); }

Target:
private boolean isEmulatedMachineChanged() { return !Objects.equals( getParameters().getVm().getCustomEmulatedMachine(), getVm().getCustomEmulatedMachine()); }
Source:
public String getPropertiesPath() { if (propsPath == null) { URL propLocation = SiteConfiguration.getAccumuloPropsLocation(); propsPath = propLocation.getFile(); } return propsPath; }

Target:
public synchronized String getPropertiesPath() { if (propsPath == null) { propsPath = SiteConfiguration.getAccumuloPropsLocation().getFile(); } return propsPath; }