auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void process(JCas jCas) throws AnalysisEngineProcessException { if (tempData == null) { try { tempData = File.createTempFile("dkpro-stanford-pos-trainer", ".tsv"); out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(tempData), StandardCharsets.UTF_8)); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } Map<Sentence, Collection<Token>> index = indexCovered(jCas, Sentence.class, Token.class); for (Sentence sentence : select(jCas, Sentence.class)) { Collection<Token> tokens = index.get(sentence); for (Token token : tokens) { out.printf("%s\t%s%n", token.getText(), token.getPos().getPosValue()); } out.println(); } }

Target:
public void process(JCas jCas) throws AnalysisEngineProcessException { if (tempData == null) { try { tempData = File.createTempFile("dkpro-arktweet-pos-trainer", ".tsv"); out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(tempData), StandardCharsets.UTF_8)); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } Map<Sentence, Collection<Token>> index = indexCovered(jCas, Sentence.class, Token.class); for (Sentence sentence : select(jCas, Sentence.class)) { Collection<Token> tokens = index.get(sentence); for (Token token : tokens) { out.printf("%s\t%s%n", token.getText(), token.getPos().getPosValue()); } out.println(); } }
Source:
public void setUp() throws Exception { brickPosition = 1; insertItemIntoUserListBrick = new InsertItemIntoUserListBrick(10, 1); BrickTestUtils.createProjectAndGetStartScript("insertItemOfUserListBrickTest1") .addBrick(insertItemIntoUserListBrick); baseActivityTestRule.launchActivity(null); }

Target:
public void setUp() throws Exception { brickPosition = 1; value = 10; indexToInsert = 1; insertItemIntoUserListBrick = new InsertItemIntoUserListBrick(value, indexToInsert); BrickTestUtils.createProjectAndGetStartScript("insertItemOfUserListBrickTest1") .addBrick(insertItemIntoUserListBrick); baseActivityTestRule.launchActivity(null); }
Source:
public boolean isCallerInRole(String role) { String caller = ctx.getCallerPrincipal().getName(); if (!USER.equals(caller)) { log.severe("Caller name is not " + USER + ", but " + caller); } return ctx.isCallerInRole(role); }

Target:
public boolean isCallerInRole(String role) throws Exception { String caller = ctx.getCallerPrincipal().getName(); if (!USER.equals(caller)) { throw new Exception("Caller name is not " + USER + ", but " + caller); } return ctx.isCallerInRole(role); }
Source:
private void addDefaultBackends() { try { ResourcesPlugin.getWorkspace(); backends.add(new WorkspaceBackend(this)); } catch (IllegalStateException e) { } }

Target:
private void addDefaultBackends() { IWorkspaceRoot workspaceRoot = EcorePlugin.getWorkspaceRoot(); if (workspaceRoot != null) { backends.add(new WorkspaceBackend(this)); } }
Source:
public Iterator<String> getNameLookupKeys(String name) { HashSet<String> keys = new HashSet<String>(); ArrayList<Token> tokens = HanziToPinyin.getInstance().get(name); final int tokenCount = tokens.size(); final StringBuilder keyPinyin = new StringBuilder(); final StringBuilder keyInitial = new StringBuilder(); final StringBuilder keyOrignal = new StringBuilder(); for (int i = tokenCount - 1; i >= 0; i--) { final Token token = tokens.get(i); String tokenString = null; if (Token.PINYIN == token.type) { tokenString = token.target; } else if (Token.LATIN == token.type) { if (keyPinyin.length() > 0) { keyPinyin.insert(0, ' '); } if (keyOrignal.length() > 0) { keyOrignal.insert(0, ' '); } tokenString = token.source; } if (tokenString != null) { keyPinyin.insert(0, tokenString); if (i == tokenCount - 1 && tokenCount > 1) { keyInitial.insert(0, tokenString); } else { keyInitial.insert(0, tokenString.charAt(0)); } } keyOrignal.insert(0, token.source); keys.add(keyOrignal.toString()); keys.add(keyPinyin.toString()); keys.add(keyInitial.toString()); } return keys.iterator(); }

Target:
public Iterator<String> getNameLookupKeys(String name) { HashSet<String> keys = new HashSet<String>(); ArrayList<Token> tokens = HanziToPinyin.getInstance().get(name); final int tokenCount = tokens.size(); final StringBuilder keyPinyin = new StringBuilder(); final StringBuilder keyInitial = new StringBuilder(); final StringBuilder keyOrignal = new StringBuilder(); for (int i = tokenCount - 1; i >= 0; i--) { final Token token = tokens.get(i); if (Token.PINYIN == token.type) { keyPinyin.insert(0, token.target); if (i == tokenCount - 1) { keyInitial.insert(0, token.target); } else { keyInitial.insert(0, token.target.charAt(0)); } } else if (Token.LATIN == token.type) { if (keyPinyin.length() > 0) { keyPinyin.insert(0, ' '); } if (keyOrignal.length() > 0) { keyOrignal.insert(0, ' '); } keyPinyin.insert(0, token.source); if (i == tokenCount - 1) { keyInitial.insert(0, token.source); } else { keyInitial.insert(0, token.source.charAt(0)); } } keyOrignal.insert(0, token.source); keys.add(keyOrignal.toString()); keys.add(keyPinyin.toString()); if (i != tokenCount - 1) { keys.add(keyInitial.toString()); } } return keys.iterator(); }
Source:
private Diagnostic checkView(IFile file) throws IOException { final VView view = ViewModelHelper.loadView(file, new LinkedHashSet<String>()); final VViewModelProperties properties = ViewModelPropertiesHelper.getInhertitedPropertiesOrEmpty(view); view.setLoadingProperties(properties); return Diagnostician.INSTANCE.validate(view); }

Target:
private Optional<Diagnostic> checkView(IFile file) throws IOException { final LinkedHashSet<String> ecores = new LinkedHashSet<String>(); final VView view = ViewModelHelper.loadView(file, ecores); try { if (view != null) { final VViewModelProperties properties = ViewModelPropertiesHelper.getInhertitedPropertiesOrEmpty(view); view.setLoadingProperties(properties); return Optional.of(Diagnostician.INSTANCE.validate(view)); } return Optional.empty(); } finally { for (final String registeredEcore : ecores) { EcoreHelper.unregisterEcore(registeredEcore); } } }
Source:
public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException { Class<?> targetClass = AopUtils.getTargetClass(bean); final TypeMetadata metadata = this.typeCache.computeIfAbsent(targetClass, TypeMetadataHolder::new).get(); for (ListenerMethod lm : metadata.methods) { for (RabbitListener rabbitListener : lm.listenerAnnotations) { processAmqpListener(rabbitListener, lm.method, bean, beanName); } } if (metadata.multiMethods.length > 0) { processMultiMethodListeners(metadata.classLevelListeners, metadata.multiMethods, bean, beanName); } return bean; }

Target:
public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException { Class<?> targetClass = AopUtils.getTargetClass(bean); final TypeMetadata metadata = this.typeCache.computeIfAbsent(targetClass, this::buildMetadata); for (ListenerMethod lm : metadata.listenerMethods) { for (RabbitListener rabbitListener : lm.annotations) { processAmqpListener(rabbitListener, lm.method, bean, beanName); } } if (metadata.handlerMethods.length > 0) { processMultiMethodListeners(metadata.classAnnotations, metadata.handlerMethods, bean, beanName); } return bean; }
Source:
private void updateRowsRuler(int firstRowIndex, int firstRowPositionY, @Nullable List<String> rowsLabels) { if (rowsRuler != null && rowsLabels != null) { int distanceFromRuler = getVerticalDistanceOnScreen(rowsRuler); rowsRuler.onLabelsChanged(rowsLabels, firstRowIndex, firstRowPositionY + distanceFromRuler, rowHeightPx); } }

Target:
private void updateRowsRuler(int firstRowIndex, int firstRowPositionY, @Nullable List<String> rowsLabels) { if (rowsRuler != null && rowsLabels != null) { int distanceFromRuler = getVerticalDistanceOnScreenFrom(rowsRuler); rowsRuler.onLabelsChanged(rowsLabels, firstRowIndex, firstRowPositionY + distanceFromRuler, rowHeightPx); } }
Source:
public LocalDate getFirstAppearance() { if (super.isEmpty()) { return null; } LocalDate firstAppearance = super.get(0).getFirstAppearance(); for (int index = 1; index < super.size(); index++) { LocalDate firstAppearance = super.get(index).getFirstAppearance(); if (firstAppearance.isBefore(firstAppearance)) { firstAppearance = firstAppearance; } } return firstAppearance; }

Target:
public LocalDate getFirstAppearance() { if (super.isEmpty()) { return null; } LocalDate firstAppearance = super.get(0).getFirstAppearance(); for (int index = 1; index < super.size(); index++) { LocalDate otherFirstAppearance = super.get(index).getFirstAppearance(); if (otherFirstAppearance.isBefore(firstAppearance)) { firstAppearance = otherFirstAppearance; } } return firstAppearance; }
Source:
@Override public void close() { for (Map.Entry<String, JedisPool> entry : jedisPoolCache.asMap().entrySet()) { try { entry.getValue().destroy(); } catch (Exception e) { LOGGER.warn("While destroying JedisPool " + entry.getKey()); } } jedisPoolCache.invalidateAll(); }

Target:
@Override public void close() { jedisPoolCache.invalidateAll(); }
Source:
private static Object convertAndResolveUnionToPrimitive(Schema schema, String key, String value) throws ParseException { Schema unionSchema = schema.getField(key).schema(); List<Schema> types = unionSchema.getTypes(); Object convertedValue = null; for (int i = 0; i < types.size(); i++) { try { if (types.get(i).getType() == Type.NULL) { if (value == null || value.equals("null")) { convertedValue = null; break; } else { continue; } } convertedValue = convertValueToAvroPrimitive(types.get(i).getType(), key, value); } catch (RuntimeException e) { continue; } break; } return convertedValue; }

Target:
private static Object convertAndResolveUnionToPrimitive(Schema schema, String key, String value) throws ParseException { Schema unionSchema = schema.getField(key).schema(); List<Schema> types = unionSchema.getTypes(); Object convertedValue = null; for (int i = 0; i < types.size(); i++) { try { if (types.get(i).getType() == Type.NULL) { if (value == null || value.equals("null")) { convertedValue = null; break; } else { continue; } } convertedValue = convertValueToAvroPrimitive(types.get(i).getType(), key, value); } catch (RuntimeException e) { LOG.error("Could not handle schema resolution", e); continue; } break; } return convertedValue; }
Source:
StagingArea(DefaultRevisionIndex index, String branchPath, ObjectMapper mapper) { this.index = index; this.branchPath = branchPath; this.mapper = mapper; this.exclusions = Sets.newHashSet(); reset(); }

Target:
StagingArea(DefaultRevisionIndex index, String branchPath, ObjectMapper mapper) { this.index = index; this.branchPath = branchPath; this.mapper = mapper; this.exclusions = Collections.emptySet(); reset(); }
Source:
private void encodeLocalizedTitles(Described entity, DBObject dbObject) { Iterable<DBObject> localizedTitles = Iterables.transform(entity.getLocalizedTitles(), new Function<LocalizedTitle, DBObject>() { @Override public DBObject apply(LocalizedTitle input) { return localizedTitleTranslator.toDBObject(new BasicDBObject(), input); } }); dbObject.put(LOCALIZED_TITLES_KEY, localizedTitles); }

Target:
private void encodeLocalizedTitles(Described entity, DBObject dbObject) { List<LocalizedTitle> sortedTitles = LOCALIZED_TITLE_ORDERING.sortedCopy(entity.getLocalizedTitles()); BasicDBList dbTitles = new BasicDBList(); for (LocalizedTitle localizedTitle: sortedTitles) { dbTitles.add(localizedTitleTranslator.toDBObject(new BasicDBObject(), localizedTitle)); } dbObject.put(LOCALIZED_TITLES_KEY, dbTitles); }
Source:
public void scanFile(MavenFileScannerContext context) { MavenDependencyMatcher matcher; try { matcher = MavenDependencyMatcher.withName(dependencyName).withVersion(version); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("[" + KEY + "] Unable to build matchers from provided dependency name: " + dependencyName, e); } for (Dependency dependency : new MavenDependencyCollector(context.getMavenProject()).allDependencies()) { if (matcher.matches(dependency)) { context.reportIssue(this, dependency, "Remove this forbidden dependency."); } } }

Target:
public void scanFile(MavenFileScannerContext context) { for (Dependency dependency : new MavenDependencyCollector(context.getMavenProject()).allDependencies()) { if (getMatcher().matches(dependency)) { context.reportIssue(this, dependency, "Remove this forbidden dependency."); } } }
Source:
public PagedFlux<PeekedMessageItem> peekMessage() { try { return peekMessages(null); } catch (RuntimeException ex) { return pagedFluxError(logger, ex); } }

Target:
public Mono<PeekedMessageItem> peekMessage() { try { return peekMessages(null).single(); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
public Plan optimize(final Collection<EvaluatorParameters> activeEvaluators, final int availableEvaluators) { if (callsSkipped < callsToSkip) { callsSkipped++; return PlanImpl.newBuilder().build(); } if (callsMade == maxCallsToMake) { return PlanImpl.newBuilder().build(); } final String evaluatorToAdd = "new-" + callsMade; callsMade++; EvaluatorParameters srcEvaluator = null; for (final EvaluatorParameters evaluator : activeEvaluators) { if (!evaluator.getDataInfos().isEmpty()) { srcEvaluator = evaluator; break; } } if (srcEvaluator == null) { return PlanImpl.newBuilder().build(); } final DataInfo srcDataInfo = srcEvaluator.getDataInfos().iterator().next(); final int numUnitsToMove = srcDataInfo.getNumUnits() / 2; final TransferStep transferStep = new TransferStepImpl( srcEvaluator.getId(), evaluatorToAdd, new DataInfoImpl(srcDataInfo.getDataType(), numUnitsToMove)); return PlanImpl.newBuilder() .addEvaluatorToAdd(evaluatorToAdd) .addTransferStep(transferStep) .build(); }

Target:
public Plan optimize(final Collection<EvaluatorParameters> activeEvaluators, final int availableEvaluators) { if (callsSkipped < callsToSkip) { callsSkipped++; return PlanImpl.newBuilder().build(); } if (callsMade == maxCallsToMake) { return PlanImpl.newBuilder().build(); } final String evaluatorToAdd = "new-" + callsMade; callsMade++; EvaluatorParameters srcEvaluator = null; for (final EvaluatorParameters evaluator : activeEvaluators) { if (!evaluator.getDataInfos().isEmpty()) { srcEvaluator = evaluator; break; } } if (srcEvaluator == null) { return PlanImpl.newBuilder() .addEvaluatorToAdd(evaluatorToAdd) .build(); } final DataInfo srcDataInfo = srcEvaluator.getDataInfos().iterator().next(); final int numUnitsToMove = srcDataInfo.getNumUnits() / 2; final TransferStep transferStep = new TransferStepImpl( srcEvaluator.getId(), evaluatorToAdd, new DataInfoImpl(srcDataInfo.getDataType(), numUnitsToMove)); return PlanImpl.newBuilder() .addEvaluatorToAdd(evaluatorToAdd) .addTransferStep(transferStep) .build(); }
Source:
public InterpreterClient launch(InterpreterLaunchContext context) throws IOException { LOGGER.info("Launching Interpreter: " + context.getInterpreterSettingGroup()); this.context = context; this.properties = context.getProperties(); int connectTimeout = getConnectTimeout(); if (connectTimeout < 200000) { LOGGER.info("DockerInterpreterLauncher needs to pull the image and create the container, " + "it takes a long time, so the force is set to 200 seconds."); connectTimeout = 200000; } StandardInterpreterLauncher interpreterLauncher = null; if (isSpark()) { interpreterLauncher = new SparkInterpreterLauncher(zConf, recoveryStorage); } else { interpreterLauncher = new StandardInterpreterLauncher(zConf, recoveryStorage); } interpreterLauncher.setProperties(context.getProperties()); Map<String, String> env = interpreterLauncher.buildEnvFromProperties(context); return new DockerInterpreterProcess( zConf, zConf.getDockerContainerImage(), context.getInterpreterGroupId(), context.getInterpreterSettingGroup(), context.getInterpreterSettingName(), properties, env, context.getZeppelinServerHost(), Integer.toString(context.getZeppelinServerRPCPort()), connectTimeout); }

Target:
public InterpreterClient launch(InterpreterLaunchContext context) throws IOException { LOGGER.info("Launching Interpreter: " + context.getInterpreterSettingGroup()); this.context = context; this.properties = context.getProperties(); int connectTimeout = getConnectTimeout(); if (connectTimeout < 200000) { LOGGER.warn("DockerInterpreterLauncher needs to pull the image and create the container, " + "it takes a long time, If the creation of the interpreter on docker fails, " + "please increase the value of `zeppelin.interpreter.connect.timeout` " + "in `zeppelin-site.xml`, recommend 200 seconds."); } StandardInterpreterLauncher interpreterLauncher = null; if (isSpark()) { interpreterLauncher = new SparkInterpreterLauncher(zConf, recoveryStorage); } else { interpreterLauncher = new StandardInterpreterLauncher(zConf, recoveryStorage); } interpreterLauncher.setProperties(context.getProperties()); Map<String, String> env = interpreterLauncher.buildEnvFromProperties(context); return new DockerInterpreterProcess( zConf, zConf.getDockerContainerImage(), context.getInterpreterGroupId(), context.getInterpreterSettingGroup(), context.getInterpreterSettingName(), properties, env, context.getZeppelinServerHost(), Integer.toString(context.getZeppelinServerRPCPort()), connectTimeout); }
Source:
static private String requireNonNull(String required, String message) throws ConfigurationRuntimeException { if (required == null) throw new ConfigurationRuntimeException(message); return required; }

Target:
private static String requireNonNull(String required, String message) throws ConfigurationRuntimeException { if (required == null) throw new ConfigurationRuntimeException(message); return required; }
Source:
public static MultipartUploadResponse create(String accountId, String bucketId, String contentType, String fileId, Map<String, String> fileInfo, String fileName, long uploadTimestamp) { return new AutoValue_MultipartUploadResponse(accountId, bucketId, contentType, fileId, fileInfo, fileName, new Date(uploadTimestamp)); }

Target:
public static MultipartUploadResponse create(String accountId, String bucketId, String contentType, String fileId, Map<String, String> fileInfo, String fileName, long uploadTimestamp) { return new AutoValue_MultipartUploadResponse(accountId, bucketId, contentType, fileId, ImmutableMap.copyOf(fileInfo), fileName, new Date(uploadTimestamp)); }
Source:
public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403); before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403); get("", mimeType, this::index); get(Routes.Environments.NAME, mimeType, this::show); post("", mimeType, this::create); put(Routes.Environments.NAME, mimeType, this::update); patch(Routes.Environments.NAME, mimeType, this::partialUpdate); delete(Routes.Environments.NAME, mimeType, this::remove); exception(InvalidGoCipherTextRuntimeException.class, (InvalidGoCipherTextRuntimeException exception, Request request, Response response) -> { response.status(HttpStatus.INTERNAL_SERVER_ERROR.value()); response.body(MessageJson.create(HaltApiMessages.errorWhileEncryptingMessage())); }); exception(HttpException.class, this::httpException); }); }

Target:
public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403); before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403); get("", mimeType, this::index); get(Routes.Environments.NAME, mimeType, this::show); post("", mimeType, this::create); put(Routes.Environments.NAME, mimeType, this::update); patch(Routes.Environments.NAME, mimeType, this::partialUpdate); delete(Routes.Environments.NAME, mimeType, this::remove); exception(HttpException.class, this::httpException); }); }
Source:
public int compare(FileEntry o1, FileEntry o2) { return (o1.offset - o2.offset) > 0 ? -1 : 1; }

Target:
public int compare(FileEntry o1, FileEntry o2) { long diff = o1.offset - o2.offset; return (diff == 0) ? 0 : ((diff > 0) ? -1 : 1); }
Source:
protected StreamComponentDefinition determineUpstreamStreamComponentDefinition(final EvaluatorContext context) throws NotFoundException { final StreamComponentDefinition assumedDownstreamToMatch = context.getStreamComponentDefinition(); if(!assumedDownstreamToMatch.isFound() || !assumedDownstreamToMatch.getStreamDefinition().isFound() || assumedDownstreamToMatch.getStreamDefinition().getStream().getUpstream() == null) return null; final StreamDefinition upstreamStreamDef = new StreamDefinition(assumedDownstreamToMatch.getStreamDefinition().getStream().getUpstream().getName(), assumedDownstreamToMatch.getName()); final ArrayList<StreamDefinition> tmp = new ArrayList<>(); tmp.add(upstreamStreamDef); StreamDefinitionUtil.matchStreams(context.getAphrodite(), tmp); return upstreamStreamDef.getStreamComponents().get(0); }

Target:
protected StreamComponentDefinition determineUpstreamStreamComponentDefinition(final EvaluatorContext context) throws NotFoundException { final StreamComponentDefinition assumedDownstreamToMatch = context.getStreamComponentDefinition(); if(!assumedDownstreamToMatch.isFound() || !assumedDownstreamToMatch.getStreamDefinition().isFound() || assumedDownstreamToMatch.getStreamDefinition().getStream().getUpstream() == null) return null; final StreamDefinition upstreamStreamDef = new StreamDefinition(assumedDownstreamToMatch.getStreamDefinition().getStream().getUpstream().getName(), assumedDownstreamToMatch.getName()); StreamDefinitionUtil.matchStreams(context.getAphrodite(), Arrays.asList(upstreamStreamDef)); return upstreamStreamDef.getStreamComponents().get(0); }
Source:
public void updateInPerspective(ActionEvent event) { Optional<DebugConfiguration> configurationOptional = configurationsManager.getCurrentDebugConfiguration(); if (configurationOptional.isPresent() && configuration.equals(configurationOptional.get())) { event.getPresentation().setVisible(false); } else { event.getPresentation().setVisible(true); } }

Target:
public void updateInPerspective(ActionEvent event) { Optional<DebugConfiguration> configurationOptional = configurationsManager.getCurrentDebugConfiguration(); boolean isCurrentConfig = configurationOptional.isPresent() && configuration.equals(configurationOptional.get()); event.getPresentation().setEnabledAndVisible(!isCurrentConfig); }
Source:
public static Branch getWorkingBranch(TeamWorkFlowArtifact teamArt, boolean force) throws OseeCoreException { long now = new Date().getTime(); boolean notSet = hridToWorkingBranchCacheUpdated.get(teamArt.getHumanReadableId()) == null; if (notSet || force || (now - hridToWorkingBranchCacheUpdated.get(teamArt.getHumanReadableId()) > 1000)) { hridToWorkingBranchCache.put(teamArt.getHumanReadableId(), getWorkingBranchExcludeStates(teamArt, BranchState.REBASELINED, BranchState.DELETED, BranchState.PURGED)); hridToWorkingBranchCacheUpdated.put(teamArt.getHumanReadableId(), now); } return hridToWorkingBranchCache.get(teamArt.getHumanReadableId()); }

Target:
public static Branch getWorkingBranch(TeamWorkFlowArtifact teamArt, boolean force) throws OseeCoreException { long now = new Date().getTime(); boolean notSet = hridToWorkingBranchCacheUpdated.get(teamArt.getHumanReadableId()) == null; if (notSet || force || (now - hridToWorkingBranchCacheUpdated.get(teamArt.getHumanReadableId()) > 1000)) { hridToWorkingBranchCache.put( teamArt.getHumanReadableId(), getWorkingBranchExcludeStates(teamArt, BranchState.REBASELINED, BranchState.DELETED, BranchState.PURGED, BranchState.COMMIT_IN_PROGRESS, BranchState.CREATION_IN_PROGRESS, BranchState.DELETE_IN_PROGRESS, BranchState.PURGE_IN_PROGRESS)); hridToWorkingBranchCacheUpdated.put(teamArt.getHumanReadableId(), now); } return hridToWorkingBranchCache.get(teamArt.getHumanReadableId()); }
Source:
public void testInvalidMessageFormatInSqlFile() throws Exception { final DefaultConfiguration filterCfg = createModuleConfig(SuppressWithPlainTextCommentFilter.class); filterCfg.addAttribute("onCommentFormat", "CSON (\\w+)"); filterCfg.addAttribute("messageFormat", "e[l"); final DefaultConfiguration checkCfg = createModuleConfig(RegexpSinglelineCheck.class); checkCfg.addAttribute("format", "^.*COUNT\\(\\*\\).*$"); checkCfg.addAttribute("message", "Don''t use COUNT(*), use COUNT(1) instead."); final String[] suppressed = CommonUtil.EMPTY_STRING_ARRAY; final String[] violationMessages = { "2: Don't use COUNT(*), use COUNT(1) instead.", }; try { verifySuppressed( "InputSuppressWithPlainTextCommentFilterWithCustomOnComment.sql", removeSuppressed(violationMessages, suppressed), filterCfg, checkCfg ); fail("CheckstyleException is expected"); } catch (CheckstyleException ex) { final IllegalArgumentException cause = (IllegalArgumentException) ex.getCause(); assertEquals("Invalid exception message", "unable to parse expanded comment e[l", cause.getMessage()); } }

Target:
public void testInvalidMessageFormatInSqlFile() throws Exception { final DefaultConfiguration filterCfg = createModuleConfig(SuppressWithPlainTextCommentFilter.class); filterCfg.addAttribute("onCommentFormat", "CSON (\\w+)"); filterCfg.addAttribute("messageFormat", "e[l"); final DefaultConfiguration checkCfg = createModuleConfig(RegexpSinglelineCheck.class); checkCfg.addAttribute("format", "^.*COUNT\\(\\*\\).*$"); final String[] suppressed = CommonUtil.EMPTY_STRING_ARRAY; final String[] violationMessages = { "2: " + getCheckMessage(RegexpSinglelineCheck.class, MSG_REGEXP_EXCEEDED, "^.*COUNT\\(\\*\\).*$"), }; try { verifySuppressed( "InputSuppressWithPlainTextCommentFilterWithCustomOnComment.sql", removeSuppressed(violationMessages, suppressed), filterCfg, checkCfg ); fail("CheckstyleException is expected"); } catch (CheckstyleException ex) { final IllegalArgumentException cause = (IllegalArgumentException) ex.getCause(); assertEquals("Invalid exception message", "unable to parse expanded comment e[l", cause.getMessage()); } }
Source:
public void refresh() { String labelExpression = this.description.getLabelExpression(); EAttribute eAttribute = EefPackage.Literals.EEF_WIDGET_DESCRIPTION__LABEL_EXPRESSION; this.newEval().call(eAttribute, labelExpression, String.class, new ISuccessfulResultConsumer<String>() { @Override public void apply(String value) { EEFGroupController.this.newLabelConsumer.apply(value); } }); List<IValidationRuleResult> validationRuleResults = new ArrayList<IValidationRuleResult>(); EAttribute auditEAttribute = EefPackage.Literals.EEF_RULE_AUDIT_DESCRIPTION__AUDIT_EXPRESSION; EAttribute messageEAttribute = EefPackage.Literals.EEF_VALIDATION_RULE_DESCRIPTION__MESSAGE_EXPRESSION; for (EEFSemanticValidationRuleDescription semanticValidationRule : this.description.getSemanticValidationRules()) { boolean isValid = true; for (EEFRuleAuditDescription audit : semanticValidationRule.getAudits()) { String auditExpression = audit.getAuditExpression(); Boolean result = this.newEval().get(auditEAttribute, auditExpression, Boolean.class); isValid = isValid && (result != null && result.booleanValue()); if (!isValid) { break; } } if (isValid) { validationRuleResults.add(new ValidationRuleResult(semanticValidationRule)); } else { String messageExpression = semanticValidationRule.getMessageExpression(); String message = this.newEval().get(messageEAttribute, messageExpression, String.class); validationRuleResults.add(new InvalidValidationRuleResult(semanticValidationRule, message, null, semanticValidationRule.getSeverity() .getValue())); } } this.validationConsumer.apply(validationRuleResults); }

Target:
public void refresh() { super.refresh(); String labelExpression = this.description.getLabelExpression(); EAttribute eAttribute = EefPackage.Literals.EEF_WIDGET_DESCRIPTION__LABEL_EXPRESSION; this.newEval().call(eAttribute, labelExpression, String.class, new ISuccessfulResultConsumer<String>() { @Override public void apply(String value) { EEFGroupController.this.newLabelConsumer.apply(value); } }); }
Source:
private Boolean savedAccountQuestion(final Long accountId, final Question question, final DateTime created) { final List<AccountQuestion> questions = questionResponseReadDAO.getAskedQuestionByQuestionIdCreatedDate(accountId, question.id, created); if (questions.isEmpty()) { return Boolean.FALSE; } else { LOGGER.info("event=multiple_question_impression account_id={} question_id={} usr_local_utc_date={}", accountId, question.id, created); return Boolean.TRUE; } }

Target:
private Boolean savedAccountQuestion(final Long accountId, final Question question, final DateTime created) { final List<AccountQuestion> questions = questionResponseReadDAO.getAskedQuestionByQuestionIdCreatedDate(accountId, question.id, created); return !questions.isEmpty(); }
Source:
protected void applyCenterCrop(@NonNull TextureView view, @NonNull Matrix transformMatrix) { float xScale = (float)view.getWidth() / intrinsicVideoSize.x; float yScale = (float)view.getHeight() / intrinsicVideoSize.y; float scale = Math.max(xScale, yScale); xScale = scale / xScale; yScale = scale / yScale; applyScale(view, transformMatrix, xScale, yScale); }

Target:
protected void applyCenterCrop(@NonNull TextureView view, @NonNull Matrix transformMatrix) { float xScale = (float)view.getWidth() / intrinsicVideoSize.x; float yScale = (float)view.getHeight() / intrinsicVideoSize.y; float scale = Math.max(xScale, yScale); applyScale(view, transformMatrix, scale, scale); }
Source:
void testNonJapanAttack() { advanceToStep(bridge, "japaneseEndTurn"); advanceToStep(bridge, "japaneseBattle"); final List<Unit> infantryUs = infantry.create(1, americans); final Collection<TerritoryEffect> territoryEffects = TerritoryEffectHelper.getEffects(queensland); whenGetRandom(bridge) .thenAnswer(withValues(1)) .thenAnswer(withValues(1)) .thenAnswer(withValues(1)); DiceRoll roll = DiceRoll.rollDice( infantryUs, true, americans, bridge, mock(IBattle.class), "", territoryEffects, null, infantryUs); assertEquals(1, roll.getHits()); final List<Unit> marineUs = marine.create(1, americans); roll = DiceRoll.rollDice( marineUs, true, americans, bridge, mock(IBattle.class), "", territoryEffects, null, infantryUs); assertEquals(1, roll.getHits()); final List<Unit> infantryChina = infantry.create(1, chinese); roll = DiceRoll.rollDice( infantryChina, true, chinese, bridge, mock(IBattle.class), "", territoryEffects, null, infantryUs); assertEquals(1, roll.getHits()); }

Target:
void testNonJapanAttack() { advanceToStep(bridge, "japaneseEndTurn"); advanceToStep(bridge, "japaneseBattle"); final List<Unit> infantryUs = infantry.create(1, americans); final Collection<TerritoryEffect> territoryEffects = TerritoryEffectHelper.getEffects(queensland); whenGetRandom(bridge) .thenAnswer(withValues(1)) .thenAnswer(withValues(1)) .thenAnswer(withValues(1)); DiceRoll roll = DiceRoll.rollDice( infantryUs, true, americans, bridge, mock(IBattle.class), territoryEffects); assertEquals(1, roll.getHits()); final List<Unit> marineUs = marine.create(1, americans); roll = DiceRoll.rollDice(marineUs, true, americans, bridge, mock(IBattle.class), territoryEffects); assertEquals(1, roll.getHits()); final List<Unit> infantryChina = infantry.create(1, chinese); roll = DiceRoll.rollDice( infantryChina, true, chinese, bridge, mock(IBattle.class), territoryEffects); assertEquals(1, roll.getHits()); }
Source:
private static void runMemoryTest(ITmfTrace[] testTraces, String testName, int loop_count) { Performance perf = Performance.getDefault(); PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + MEMORY + '#' + testName); perf.tagAsSummary(pm, TEST_SUMMARY + MEMORY + ':' + testName, Dimension.CPU_TIME); for (int i = 0; i < loop_count; i++) { TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", testTraces, BLOCK_SIZE); pm.start(); try { experiment.synchronizeTraces(true); } catch (TmfTraceException e) { fail("Failed at iteration " + i + " with message: " + e.getMessage()); } pm.stop(); } pm.commit(); }

Target:
private static void runMemoryTest(ITmfTrace[] testTraces, String testName, int loop_count) { Performance perf = Performance.getDefault(); PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + MEMORY + '#' + testName); perf.tagAsSummary(pm, TEST_SUMMARY + MEMORY + ':' + testName, Dimension.USED_JAVA_HEAP); for (int i = 0; i < loop_count; i++) { TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "Test experiment", testTraces, BLOCK_SIZE); System.gc(); pm.start(); try { experiment.synchronizeTraces(true); } catch (TmfTraceException e) { fail("Failed at iteration " + i + " with message: " + e.getMessage()); } System.gc(); pm.stop(); } pm.commit(); }
Source:
public Collection<VocabularyTerm> getAssociatedTerms(Double standardDeviation) { ResourceBundle configuration = ResourceBundle.getBundle("measurementsAssociatedTerms"); List<VocabularyTerm> terms = new ArrayList<>(); if (null == standardDeviation || standardDeviation <= -3) { addResolvedTermsToList(configuration, this.getName(), "extremeBelowNormal", terms); } if (null == standardDeviation || standardDeviation <= -2) { addResolvedTermsToList(configuration, this.getName(), "belowNormal", terms); } if (null == standardDeviation || standardDeviation >= 2) { addResolvedTermsToList(configuration, this.getName(), "aboveNormal", terms); } if (null == standardDeviation || standardDeviation >= 3) { addResolvedTermsToList(configuration, this.getName(), "extremeAboveNormal", terms); } return terms; }

Target:
public Collection<VocabularyTerm> getAssociatedTerms(Double standardDeviation) { ResourceBundle configuration = ResourceBundle.getBundle("measurementsAssociatedTerms"); List<String> configKeys; if (standardDeviation != null) { configKeys = new LinkedList<>(); if (standardDeviation <= -3) { configKeys.add(MeasurementUtils.FUZZY_VALUE_TO_CONFIG_KEY.get( MeasurementUtils.VALUE_EXTREME_BELOW_NORMAL)); } if (standardDeviation <= -2) { configKeys.add(MeasurementUtils.FUZZY_VALUE_TO_CONFIG_KEY.get( MeasurementUtils.VALUE_BELOW_NORMAL)); } if (standardDeviation >= 2) { configKeys.add(MeasurementUtils.FUZZY_VALUE_TO_CONFIG_KEY.get( MeasurementUtils.VALUE_ABOVE_NORMAL)); } if (standardDeviation >= 3) { configKeys.add(MeasurementUtils.FUZZY_VALUE_TO_CONFIG_KEY.get( MeasurementUtils.VALUE_EXTREME_ABOVE_NORMAL)); } } else { configKeys = new LinkedList<>(MeasurementUtils.FUZZY_VALUE_TO_CONFIG_KEY.values()); } List<VocabularyTerm> terms = new ArrayList<>(); for (String key : configKeys) { terms.addAll(getResolvedTermsForConfigKey(configuration, this.getName(), key)); } return terms; }
Source:
public void migrateIfNecessary_1_4_to_1_5() throws Exception { String toMigrate = getFileContent("scesim-1-3-rule.scesim"); assertTrue(toMigrate.contains("dmoSession")); String migrated = instance.migrateIfNecessary(toMigrate); assertTrue(migrated.contains("<ScenarioSimulationModel version=\"" + currentVersion + "\">")); assertTrue(!migrated.contains("dmoSession")); }

Target:
public void migrateIfNecessary_1_4_to_1_5() throws Exception { String toMigrate = getFileContent("scesim-1-3-rule.scesim"); assertTrue(toMigrate.contains("dmoSession")); String migrated = instance.migrateIfNecessary(toMigrate); assertFalse(migrated.contains("<ScenarioSimulationModel version=\"1.3\">")); assertFalse(migrated.contains("<ScenarioSimulationModel version=\"1.4\">")); assertTrue(migrated.contains("<ScenarioSimulationModel version=\"" + currentVersion + "\">")); assertTrue(!migrated.contains("dmoSession")); }
Source:
public List<String> checkGlusterQuorum(Cluster cluster, Iterable<Guid> selectedHostIdsForMaintenance) { List<String> volumesWithoutQuorum = new ArrayList<>(); if (cluster.supportsGlusterService()) { List<GlusterBrickEntity> bricksGoingToMaintenance = new ArrayList<>(); for (Guid serverId : selectedHostIdsForMaintenance) { bricksGoingToMaintenance.addAll(getGlusterBrickDao().getGlusterVolumeBricksByServerId(serverId)); } List<GlusterVolumeEntity> volumesInCluster = getGlusterVolumeDao().getByClusterId(cluster.getId()); for (GlusterVolumeEntity volume : volumesInCluster) { if (volume.getStatus() == GlusterStatus.UP && volume.getVolumeType().isReplicatedType() && !isQuorumMet(volume, bricksGoingToMaintenance)) { volumesWithoutQuorum.add(volume.getName()); } } } return volumesWithoutQuorum; }

Target:
public List<String> checkGlusterQuorum(Cluster cluster, Iterable<Guid> selectedHostIdsForMaintenance) { List<String> volumesWithoutQuorum = new ArrayList<>(); if (cluster.supportsGlusterService()) { List<GlusterBrickEntity> bricksGoingToMaintenance = new ArrayList<>(); for (Guid serverId : selectedHostIdsForMaintenance) { bricksGoingToMaintenance.addAll(brickDao.getGlusterVolumeBricksByServerId(serverId)); } List<GlusterVolumeEntity> volumesInCluster = volumeDao.getByClusterId(cluster.getId()); volumesWithoutQuorum = volumesInCluster.stream() .filter(volume -> volume.getStatus() == GlusterStatus.UP && volume.getVolumeType().isReplicatedType() && !isQuorumMet(volume, bricksGoingToMaintenance)) .map(v -> v.getName()) .collect(Collectors.toList()); } return volumesWithoutQuorum; }
Source:
private AggregationInfo buildAggregationInfo(Function function) { List<Expression> operands = function.getOperands(); if (operands == null || operands.isEmpty()) { throw new Pql2CompilationException("Aggregation function expects non null argument"); } List<String> args = new ArrayList<>(operands.size()); String functionName = function.getOperator(); if (functionName.equalsIgnoreCase(AggregationFunctionType.COUNT.getName())) { args = Collections.singletonList("*"); } else { if (functionName.equalsIgnoreCase(AggregationFunctionType.DISTINCT.getName())) { Set<String> expressionSet = new HashSet<>(); for (Expression operand : operands) { String expression = getColumnExpression(operand); if (expressionSet.add(expression)) { args.add(expression); } } } else { for (Expression operand : operands) { args.add(getColumnExpression(operand)); } } } AggregationInfo aggregationInfo = new AggregationInfo(); aggregationInfo.setAggregationType(functionName); aggregationInfo.setAggregationFunctionArgs(args); aggregationInfo.setIsInSelectList(true); return aggregationInfo; }

Target:
private AggregationInfo buildAggregationInfo(Function function) { List<Expression> operands = function.getOperands(); if (operands == null || operands.isEmpty()) { throw new Pql2CompilationException("Aggregation function expects non null argument"); } List<String> args = new ArrayList<>(operands.size()); String functionName = function.getOperator(); if (functionName.equalsIgnoreCase(AggregationFunctionType.COUNT.getName())) { args = Collections.singletonList("*"); } else { if (functionName.equalsIgnoreCase(AggregationFunctionType.DISTINCT.getName())) { Set<String> expressionSet = new TreeSet<>(); for (Expression operand : operands) { String expression = getColumnExpression(operand); if (expressionSet.add(expression)) { args.add(expression); } } } else { for (Expression operand : operands) { args.add(getColumnExpression(operand)); } } } AggregationInfo aggregationInfo = new AggregationInfo(); aggregationInfo.setAggregationType(functionName); aggregationInfo.setExpressions(args); aggregationInfo.setIsInSelectList(true); return aggregationInfo; }
Source:
public static Optional<HiveBucketFilter> getHiveBucketFilter(Table table, TupleDomain<ColumnHandle> effectivePredicate) { Optional<HiveBucketProperty> hiveBucketProperty = table.getStorage().getBucketProperty(); if (!hiveBucketProperty.isPresent() || !hiveBucketProperty.get().getBucketFunctionType().equals(HIVE_COMPATIBLE)) { return Optional.empty(); } Optional<Map<ColumnHandle, Set<NullableValue>>> bindings = TupleDomain.extractFixedValueSets(effectivePredicate); if (!bindings.isPresent()) { return Optional.empty(); } Optional<Set<Integer>> buckets = getHiveBuckets(table, bindings.get()); if (buckets.isPresent()) { return Optional.of(new HiveBucketFilter(buckets.get())); } if (!effectivePredicate.getDomains().isPresent()) { return Optional.empty(); } Optional<Domain> domain = effectivePredicate.getDomains().get().entrySet().stream() .filter(entry -> ((HiveColumnHandle) entry.getKey()).getName().equals(BUCKET_COLUMN_NAME)) .findFirst() .map(Entry::getValue); if (!domain.isPresent()) { return Optional.empty(); } ValueSet values = domain.get().getValues(); ImmutableSet.Builder<Integer> builder = ImmutableSet.builder(); int bucketCount = table.getStorage().getBucketProperty().get().getBucketCount(); for (int i = 0; i < bucketCount; i++) { if (values.containsValue((long) i)) { builder.add(i); } } return Optional.of(new HiveBucketFilter(builder.build())); }

Target:
public static Optional<HiveBucketFilter> getHiveBucketFilter(Table table, TupleDomain<ColumnHandle> effectivePredicate) { Optional<HiveBucketProperty> hiveBucketProperty = table.getStorage().getBucketProperty(); if (!hiveBucketProperty.isPresent()) { return Optional.empty(); } if (!hiveBucketProperty.get().getBucketFunctionType().equals(HIVE_COMPATIBLE)) { return Optional.empty(); } Optional<Map<ColumnHandle, Set<NullableValue>>> bindings = TupleDomain.extractFixedValueSets(effectivePredicate); if (!bindings.isPresent()) { return Optional.empty(); } Optional<Set<Integer>> buckets = getHiveBuckets(table, bindings.get()); if (buckets.isPresent()) { return Optional.of(new HiveBucketFilter(buckets.get())); } if (!effectivePredicate.getDomains().isPresent()) { return Optional.empty(); } Optional<Domain> domain = effectivePredicate.getDomains().get().entrySet().stream() .filter(entry -> ((HiveColumnHandle) entry.getKey()).getName().equals(BUCKET_COLUMN_NAME)) .findFirst() .map(Entry::getValue); if (!domain.isPresent()) { return Optional.empty(); } ValueSet values = domain.get().getValues(); ImmutableSet.Builder<Integer> builder = ImmutableSet.builder(); int bucketCount = table.getStorage().getBucketProperty().get().getBucketCount(); for (int i = 0; i < bucketCount; i++) { if (values.containsValue((long) i)) { builder.add(i); } } return Optional.of(new HiveBucketFilter(builder.build())); }
Source:
private void setVmLeasesAvailability() { TModel model = getModel(); Version compVer = model.getSelectedCluster().getCompatibilityVersion(); if (model.getCustomCompatibilityVersion().getSelectedItem() != null) { compVer = model.getCustomCompatibilityVersion().getSelectedItem(); } vmLeasesSupported = AsyncDataProvider.getInstance().isVmLeasesFeatureSupported(compVer); if (!vmLeasesSupported) { model.getLease().setIsChangeable(vmLeasesSupported, constants.vmLeasesSupported()); } else { model.getLease().setIsChangeable(model.getIsHighlyAvailable().getEntity()); } }

Target:
private void setVmLeasesAvailability() { TModel model = getModel(); Version compVer = model.getSelectedCluster().getCompatibilityVersion(); if (model.getCustomCompatibilityVersion().getSelectedItem() != null) { compVer = model.getCustomCompatibilityVersion().getSelectedItem(); } vmLeasesSupported = AsyncDataProvider.getInstance().isVmLeasesFeatureSupported(compVer); if (!vmLeasesSupported) { model.getLease().setIsChangeable(false, constants.vmLeasesSupported()); } else { model.getLease().setIsChangeable(model.getIsHighlyAvailable().getEntity()); } }
Source:
protected void processPacket() { assert (request instanceof BookieProtocol.AddRequest); BookieProtocol.AddRequest add = (BookieProtocol.AddRequest) request; if (requestProcessor.bookie.isReadOnly()) { LOG.warn("BookieServer is running in readonly mode," + " so rejecting the request from the client!"); sendResponse(BookieProtocol.EREADONLY, ResponseBuilder.buildErrorResponse(BookieProtocol.EREADONLY, add), requestProcessor.addRequestStats); add.release(); return; } startTimeNanos = MathUtils.nowInNano(); int rc = BookieProtocol.EOK; ByteBuf addData = add.getData(); try { if (add.isRecoveryAdd()) { requestProcessor.bookie.recoveryAddEntry(addData, this, channel, add.getMasterKey()); } else { requestProcessor.bookie.addEntry(addData, this, channel, add.getMasterKey()); } } catch (IOException e) { LOG.error("Error writing " + add, e); rc = BookieProtocol.EIO; } catch (BookieException.LedgerFencedException lfe) { LOG.error("Attempt to write to fenced ledger", lfe); rc = BookieProtocol.EFENCED; } catch (BookieException e) { LOG.error("Unauthorized access to ledger " + add.getLedgerId(), e); rc = BookieProtocol.EUA; } catch (Throwable t) { LOG.error("Unexpected exception while writing {}@{} : {}", new Object[] { add.ledgerId, add.entryId, t.getMessage(), t }); rc = BookieProtocol.EBADREQ; } finally { addData.release(); } if (rc != BookieProtocol.EOK) { requestProcessor.addEntryStats.registerFailedEvent(MathUtils.elapsedNanos(startTimeNanos), TimeUnit.NANOSECONDS); sendResponse(rc, ResponseBuilder.buildErrorResponse(rc, add), requestProcessor.addRequestStats); add.recycle(); } }

Target:
protected void processPacket() { assert (request instanceof BookieProtocol.AddRequest); BookieProtocol.AddRequest add = (BookieProtocol.AddRequest) request; if (requestProcessor.bookie.isReadOnly()) { LOG.warn("BookieServer is running in readonly mode," + " so rejecting the request from the client!"); sendResponse(BookieProtocol.EREADONLY, ResponseBuilder.buildErrorResponse(BookieProtocol.EREADONLY, add), requestProcessor.addRequestStats); add.release(); return; } startTimeNanos = MathUtils.nowInNano(); int rc = BookieProtocol.EOK; ByteBuf addData = add.getData(); try { if (add.isRecoveryAdd()) { requestProcessor.bookie.recoveryAddEntry(addData, this, channel, add.getMasterKey()); } else { requestProcessor.bookie.addEntry(addData, this, channel, add.getMasterKey()); } } catch (IOException e) { LOG.error("Error writing " + add, e); rc = BookieProtocol.EIO; } catch (BookieException.LedgerFencedException lfe) { LOG.error("Attempt to write to fenced ledger", lfe); rc = BookieProtocol.EFENCED; } catch (BookieException e) { LOG.error("Unauthorized access to ledger " + add.getLedgerId(), e); rc = BookieProtocol.EUA; } catch (Throwable t) { LOG.error("Unexpected exception while writing {}@{} : {}", add.ledgerId, add.entryId, t.getMessage(), t); rc = BookieProtocol.EBADREQ; } finally { addData.release(); } if (rc != BookieProtocol.EOK) { requestProcessor.addEntryStats.registerFailedEvent(MathUtils.elapsedNanos(startTimeNanos), TimeUnit.NANOSECONDS); sendResponse(rc, ResponseBuilder.buildErrorResponse(rc, add), requestProcessor.addRequestStats); add.recycle(); } }
Source:
ExecutionPlan getExecutionPlan(String runId) { Map<String, String> allowedUserConfig = new HashMap<>(userConfig); Map<String, String> generatedConfig = new HashMap<>(); if (!LegacyTaskApplication.class.isAssignableFrom(appDesc.getAppClass())) { if (userConfig.containsKey(TaskConfig.INPUT_STREAMS())) { LOG.warn("SamzaApplications should not specify task.inputs in configuration. " + "Specify them using InputDescriptors instead. Ignoring configured task.inputs value of " + userConfig.get(TaskConfig.INPUT_STREAMS())); allowedUserConfig.remove(TaskConfig.INPUT_STREAMS()); } generatedConfig.putAll(getGeneratedConfig(runId)); } MapConfig generatedJobConfigs = JobConfigUtil.generateJobIdAndName(new MapConfig(allowedUserConfig)); allowedUserConfig.putAll(generatedJobConfigs); Config mergedConfig = JobNodeConfigurationGenerator.mergeConfig(allowedUserConfig, generatedConfig); StreamManager streamManager = buildAndStartStreamManager(mergedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(mergedConfig, streamManager); return planner.plan(appDesc); } finally { streamManager.stop(); } }

Target:
ExecutionPlan getExecutionPlan(String runId) { Map<String, String> allowedUserConfig = new HashMap<>(userConfig); Map<String, String> generatedConfig = new HashMap<>(); if (!LegacyTaskApplication.class.isAssignableFrom(appDesc.getAppClass())) { if (userConfig.containsKey(TaskConfig.INPUT_STREAMS())) { LOG.warn("SamzaApplications should not specify task.inputs in configuration. " + "Specify them using InputDescriptors instead. Ignoring configured task.inputs value of " + userConfig.get(TaskConfig.INPUT_STREAMS())); allowedUserConfig.remove(TaskConfig.INPUT_STREAMS()); } generatedConfig.putAll(getGeneratedConfig(runId)); } Config mergedConfig = JobNodeConfigurationGenerator.mergeConfig(allowedUserConfig, generatedConfig); StreamManager streamManager = buildAndStartStreamManager(mergedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(mergedConfig, streamManager); return planner.plan(appDesc); } finally { streamManager.stop(); } }
Source:
public static String appendClause(String query, String clause) { if (StringUtils.isEmpty(query)) { return clause; } else if (StringUtils.isEmpty(clause)) { return query; } else { return query + " AND " + clause; } }

Target:
public static String appendClause(String query, String clause) { if (StringUtils.isBlank(query)) { return clause; } else if (StringUtils.isBlank(clause)) { return query; } else { return query + " AND " + clause; } }