auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void validateJobExecutions() { RepeatTemplate template = new RepeatTemplate(); Date startDate = new Date(); template.iterate(new RepeatCallback() { public RepeatStatus doInIteration(RepeatContext context) throws InterruptedException { List<JobExecution> failedJobExecutions = new ArrayList<>(); RepeatStatus repeatStatus = RepeatStatus.FINISHED; for (JobExecution jobExecution : jobExecutionList) { JobExecution currentJobExecution = taskJobExplorer.getJobExecution(jobExecution.getId()); String exitStatus = currentJobExecution.getExitStatus().getExitCode(); if (!exitStatus.equals(ExitStatus.FAILED.getExitCode()) && !exitStatus.equals(ExitStatus.COMPLETED.getExitCode()) && !exitStatus.equals(ExitStatus.STOPPED.getExitCode())) { repeatStatus = RepeatStatus.CONTINUABLE; } if (exitStatus.equals(ExitStatus.FAILED.getExitCode())) { failedJobExecutions.add(jobExecution); } } Thread.sleep(failOnJobFailurePollIntervalInMillis); if (repeatStatus.equals(RepeatStatus.FINISHED) && failedJobExecutions.size() > 0) { throwJobFailedException(failedJobExecutions); } if (repeatStatus.isContinuable() && failOnJobFailurewaitTimeInMillis != 0 && (new Date()).getTime() - startDate.getTime() > failOnJobFailurewaitTimeInMillis) { throw new IllegalStateException("Not all jobs were completed " + "within the time specified by spring.cloud.task.batch." + "failOnJobFailurewaitTimeInMillis."); } return repeatStatus; } }); }

Target:
private void validateJobExecutions() { RepeatTemplate template = new RepeatTemplate(); Date startDate = new Date(); template.iterate(new RepeatCallback() { public RepeatStatus doInIteration(RepeatContext context) throws InterruptedException { List<JobExecution> failedJobExecutions = new ArrayList<>(); RepeatStatus repeatStatus = RepeatStatus.FINISHED; for (JobExecution jobExecution : jobExecutionList) { JobExecution currentJobExecution = taskJobExplorer.getJobExecution(jobExecution.getId()); BatchStatus batchStatus = currentJobExecution.getStatus(); if (batchStatus.isRunning()) { repeatStatus = RepeatStatus.CONTINUABLE; } if (batchStatus.equals(BatchStatus.FAILED)) { failedJobExecutions.add(jobExecution); } } Thread.sleep(taskBatchProperties.getFailOnJobFailurePollInterval()); if (repeatStatus.equals(RepeatStatus.FINISHED) && failedJobExecutions.size() > 0) { throwJobFailedException(failedJobExecutions); } if (repeatStatus.isContinuable() && taskBatchProperties.getFailOnJobFailurewaitTime() != 0 && (new Date()).getTime() - startDate.getTime() > taskBatchProperties.getFailOnJobFailurewaitTime()) { throw new IllegalStateException("Not all jobs were completed " + "within the time specified by spring.cloud.task.batch." + "failOnJobFailurewaitTime."); } return repeatStatus; } }); }
Source:
public Channel retrieve(VeluxBridgeProvider bridge) { logger.trace("retrieve() called."); if (this.channel == null) { this.channel = new Channel(); } BCgetWLANConfig.Response response = bridge.bridgeCommunicate(new BCgetWLANConfig()); if (response != null) { logger.trace("retrieve() found successfully configuration {}.", response.getWLANConfig()); this.channel.wlanSSID = response.getWLANConfig().getSSID(); this.channel.wlanPassword = response.getWLANConfig().getPassword(); this.channel.isRetrieved = true; return channel; } else { logger.trace("retrieve() finished with failure."); return null; } }

Target:
public Channel retrieve(VeluxBridgeProvider bridge) { logger.trace("retrieve() called."); if (channel == null) { channel = new Channel(); } BCgetWLANConfig.Response response = bridge.bridgeCommunicate(new BCgetWLANConfig()); if (response != null) { logger.trace("retrieve() found successfully configuration {}.", response.getWLANConfig()); channel.wlanSSID = response.getWLANConfig().getSSID(); channel.wlanPassword = response.getWLANConfig().getPassword(); channel.isRetrieved = true; return channel; } else { logger.trace("retrieve() finished with failure."); return null; } }
Source:
public byte[] getClientBDMZip() throws SBusinessDataRepositoryException { STenantResource sTenantResource; try { sTenantResource = tenantResourcesService.get(TenantResourceType.BDM, CLIENT_BDM_ZIP); } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryException(e); } if (sTenantResource == null) { throw new SBusinessDataRepositoryException("no client-bdnm.zip found in tenant resources"); } return sTenantResource.getContent(); }

Target:
public byte[] getClientBDMZip() throws SBusinessDataRepositoryException { STenantResource sTenantResource; try { sTenantResource = tenantResourcesService.get(TenantResourceType.BDM, CLIENT_BDM_ZIP); } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryException(e); } if (sTenantResource == null) { throw new SBusinessDataRepositoryException("no client-bdm.zip found in tenant resources"); } return sTenantResource.getContent(); }
Source:
private String getOpenSearchURL(String title){ String query = "&q=srw.ti+all+\"" + title.replaceAll(" ", "%20") + "\""; return WORLDCAT_OPEN_SEARCH_URL + query.replace("\"", "%22"); }

Target:
private String getOpenSearchURL(String title) throws MalformedURLException { String query = "&q=srw.ti+all+\"" + title + "\""; URL url = new URL(WORLDCAT_OPEN_SEARCH_URL + query); return url.toString(); }
Source:
private List<Observation> convertObservationMapToList(Map<String, String> observations, DateTime obsDatetime) { List<Observation> observationList = new ArrayList<>(); for (String observationConceptName : observations.keySet()) { if (valueIsNotEmpty(observations, observationConceptName)) { Observation observation = new Observation(); ConceptName conceptName = new ConceptName(observationConceptName); Concept concept = new Concept(conceptName); observation.setConcept(concept); String observationMapValue = observations.get(observationConceptName); Observation.ObservationValue observationValue = new Observation.ObservationValue(observationMapValue); observation.setValue(observationValue); observation.setObsDatetime(obsDatetime.toDate()); observationList.add(observation); } } return observationList; }

Target:
private List<Observation> convertObservationMapToList(Map<String, String> observations, DateTime obsDatetime) { List<Observation> observationList = new ArrayList<>(); for (String observationConceptName : observations.keySet()) { if (valueIsNotEmpty(observations, observationConceptName)) { Observation observation = new Observation(); ConceptName conceptName = new ConceptName(observationConceptName); Concept concept = new Concept(conceptName); observation.setConcept(concept); String observationMapValue = observations.get(observationConceptName); Observation.ObservationValue observationValue = new Observation.ObservationValue(observationMapValue); observation.setValue(observationValue); observation.setObsDatetime(obsDatetime.toDate()); observationList.add(observation); } else { LOGGER.warn("Observation value is null or empty for concept: " + observationConceptName + " and will not be created"); } } return observationList; }
Source:
public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids) { return Maps.filterKeys(nodes, in(Sets.newHashSet(ids))).values(); }

Target:
public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids) { return filterKeys(nodes, in(ImmutableSet.copyOf(ids))).values(); }
Source:
private boolean hasDeprecationAnnotationConstructor(Class[] classes) { Annotation[] annotations = new Annotation[0]; try { annotations = URLBuilder.class.getConstructor(classes).getAnnotations(); } catch (NoSuchMethodException e) { e.printStackTrace(); } for (Annotation annotation : annotations) { if(annotation.annotationType().equals(Deprecated.class)) { return true; } } return false; }

Target:
private boolean hasDeprecationAnnotationConstructor(Class[] classes) { try { return URLBuilder.class.getConstructor(classes).isAnnotationPresent(Deprecated.class); } catch (NoSuchMethodException e) { e.printStackTrace(); } return false; }
Source:
public void onApplicationEvent(ListenerContainerIdleEvent event) { LogFactory.getLog(this.getClass()).info(event); if ("foo".equals(event.getListenerId())) { this.event = event; this.latch.countDown(); } }

Target:
public void onApplicationEvent(ListenerContainerIdleEvent event) { if (!"foo".equals(event.getListenerId())) { this.barEventReceived = true; } logger.info("foo: " + event); this.event = event; this.latch.countDown(); }
Source:
private void activateDataCenter() { StorageDomain masterDomain = getStorageDomainDao().getStorageDomains(getStoragePool().getId(), StorageDomainType.Master).get(0); calcStoragePoolStatusByDomainsStatus(); if (masterDomain != null && masterDomain.getStatus() != null && (masterDomain.getStatus() == StorageDomainStatus.Active || masterDomain.getStatus() == StorageDomainStatus.Unknown || masterDomain.getStatus() == StorageDomainStatus.Inactive)) { resetIrs(); } }

Target:
private void activateDataCenter() { StorageDomain masterDomain = getStorageDomainDao().getStorageDomains(getStoragePool().getId(), StorageDomainType.Master).stream().findFirst().orElse(null); calcStoragePoolStatusByDomainsStatus(); if (masterDomain != null && masterDomain.getStatus() != null && (masterDomain.getStatus() == StorageDomainStatus.Active || masterDomain.getStatus() == StorageDomainStatus.Unknown || masterDomain.getStatus() == StorageDomainStatus.Inactive)) { resetIrs(); } }
Source:
private void changeLanguage(String languageCode) { if (mLanguagePreference == null || TextUtils.isEmpty(languageCode)) { return; } if (!LocaleManager.isDifferentLanguage(languageCode)) { return; } Context newContext = LocaleManager.setNewLocale(WordPress.getContext(), languageCode); updateLanguagePreference(languageCode); Map<String, Object> properties = new HashMap<>(); properties.put("app_locale", newContext.getResources().getConfiguration().locale.toString()); AnalyticsTracker.track(Stat.ACCOUNT_SETTINGS_LANGUAGE_CHANGED, properties); AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore); Intent refresh = new Intent(getActivity(), getActivity().getClass()); startActivity(refresh); getActivity().setResult(LANGUAGE_CHANGED); getActivity().finish(); }

Target:
private void changeLanguage(String languageCode) { if (mLanguagePreference == null || TextUtils.isEmpty(languageCode)) { return; } if (LocaleManager.isSameLanguage(languageCode)) { return; } LocaleManager.setNewLocale(WordPress.getContext(), languageCode); updateLanguagePreference(languageCode); Map<String, Object> properties = new HashMap<>(); properties.put("app_locale", Locale.getDefault()); AnalyticsTracker.track(Stat.ACCOUNT_SETTINGS_LANGUAGE_CHANGED, properties); AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore); Intent refresh = new Intent(getActivity(), getActivity().getClass()); startActivity(refresh); getActivity().setResult(LANGUAGE_CHANGED); getActivity().finish(); }
Source:
public String toString() { return os.toString(); }

Target:
public String toString() { return "ForwardingOs{os=" + os + "}"; }
Source:
private void checkBatteryOptimizations() { if (Application.isIgnoringBatteryOptimizations(getApplicationContext())) { showIgnoreBatteryOptimizationDialog(); } }

Target:
private void checkBatteryOptimizations() { if (PreferenceUtils.getBoolean(getString(R.string.not_request_battery_optimizations_key), false) || !TravelBehaviorUtils.isUserParticipatingInStudy()) { return; } Boolean ignoringBatteryOptimizations = Application.isIgnoringBatteryOptimizations(getApplicationContext()); if (ignoringBatteryOptimizations != null && !ignoringBatteryOptimizations) { showIgnoreBatteryOptimizationDialog(); } }
Source:
public static String getParseErrorMessage(ParseErrorMessage parseErrorMessage) { final LocalizedMessage lmessage = new LocalizedMessage( parseErrorMessage.getLineNumber(), "com.puppycrawl.tools.checkstyle.checks.javadoc.messages", parseErrorMessage.getMessageKey(), parseErrorMessage.getMessageArguments(), "", DetailNodeTreeStringPrinter.class, null); return "[ERROR:" + parseErrorMessage.getLineNumber() + "] " + lmessage.getMessage(); }

Target:
private static String getParseErrorMessage(ParseErrorMessage parseErrorMessage) { final LocalizedMessage lmessage = new LocalizedMessage( parseErrorMessage.getLineNumber(), "com.puppycrawl.tools.checkstyle.checks.javadoc.messages", parseErrorMessage.getMessageKey(), parseErrorMessage.getMessageArguments(), "", DetailNodeTreeStringPrinter.class, null); return "[ERROR:" + parseErrorMessage.getLineNumber() + "] " + lmessage.getMessage(); }
Source:
void addObservations(List<Obs> observations) { for (Obs obs : observations) { if (obs == null) continue; Column column = getColumnContainingTime(point.time); if (obs.conceptUuid.equals(AppModel.ORDER_EXECUTED_CONCEPT_UUID)) { Integer count = column.executionCountsByOrderUuid.get(obs.value); column.executionCountsByOrderUuid.put( obs.value, count == null ? 1 : count + 1); } else { addObs(column, obs); } } }

Target:
void addObservations(List<Obs> observations) { for (Obs obs : observations) { if (obs == null) continue; Column column = getColumnContainingTime(obs.time); if (obs.conceptUuid.equals(AppModel.ORDER_EXECUTED_CONCEPT_UUID)) { Integer count = column.executionCountsByOrderUuid.get(obs.value); column.executionCountsByOrderUuid.put( obs.value, count == null ? 1 : count + 1); } else { addObs(column, obs); } } }
Source:
public List<String> firstTen(final String... args) { final List<String> list = new ArrayList<String>(args.length); list.addAll(Arrays.asList(args)); final List<String> result = new LinkedList<>(); result.addAll(list.subList(0, InvalidDiamondsUsage.TEN)); return result; }

Target:
public List<String> firstTen(final String... args) { final List<String> list = new ArrayList<String>(args.length); list.addAll(Arrays.asList(args)); return list; }
Source:
private FeedbackQuestionFeedbackPathSettings configureFeedbackPathSettings( FeedbackQuestionAttributes question) { FeedbackQuestionFeedbackPathSettings settings = new FeedbackQuestionFeedbackPathSettings(); settings.setSelectedGiver(question.giverType); settings.setSelectedRecipient(question.recipientType); boolean isNumberOfEntitiesToGiveFeedbackToChecked = question.numberOfEntitiesToGiveFeedbackTo != Const.MAX_POSSIBLE_RECIPIENTS; settings.setNumberOfEntitiesToGiveFeedbackToChecked(isNumberOfEntitiesToGiveFeedbackToChecked); settings.setNumOfEntitiesToGiveFeedbackToValue(isNumberOfEntitiesToGiveFeedbackToChecked ? question.numberOfEntitiesToGiveFeedbackTo : 1); boolean isCommonGiver = Const.FeedbackQuestion.COMMON_FEEDBACK_PATHS.containsKey(question.giverType); boolean isCommonPath = isCommonGiver && Const.FeedbackQuestion.COMMON_FEEDBACK_PATHS.get(question.giverType) .contains(question.recipientType); settings.setIsCommonPathSelected(isCommonPath); return settings; }

Target:
private FeedbackQuestionFeedbackPathSettings configureFeedbackPathSettings( FeedbackQuestionAttributes question) { FeedbackQuestionFeedbackPathSettings settings = new FeedbackQuestionFeedbackPathSettings(); settings.setSelectedGiver(question.giverType); settings.setSelectedRecipient(question.recipientType); boolean isNumberOfEntitiesToGiveFeedbackToChecked = question.numberOfEntitiesToGiveFeedbackTo != Const.MAX_POSSIBLE_RECIPIENTS; settings.setNumberOfEntitiesToGiveFeedbackToChecked(isNumberOfEntitiesToGiveFeedbackToChecked); settings.setNumOfEntitiesToGiveFeedbackToValue(isNumberOfEntitiesToGiveFeedbackToChecked ? question.numberOfEntitiesToGiveFeedbackTo : 1); boolean isCommonGiver = Const.FeedbackQuestion.COMMON_FEEDBACK_PATHS.containsKey(question.giverType); boolean isCommonPath = isCommonGiver && Const.FeedbackQuestion.COMMON_FEEDBACK_PATHS.get(question.giverType) .contains(question.recipientType); settings.setCommonPathSelected(isCommonPath); return settings; }
Source:
public Stream<QueryTerminationResult> killQueries( @Name( "ids" ) List<String> idTexts ) throws InvalidArgumentsException, IOException { securityContext.assertCredentialsNotExpired(); try { Set<Long> queryIds = idTexts.stream().map( catchThrown( InvalidArgumentsException.class, QueryId::fromExternalString ) ).map( catchThrown( InvalidArgumentsException.class, QueryId::kernelQueryId ) ).collect( toSet() ); Set<QueryTerminationResult> terminatedQuerys = getActiveTransactions( tx -> executingQueriesWithIds( queryIds, tx ) ).map( catchThrown( InvalidArgumentsException.class, this::killQueryTransaction ) ).collect( toSet() ); Config configs = resolver.resolveDependency( Config.class ); if ( configs.get( GraphDatabaseSettings.kill_query_verbose ) && terminatedQuerys.size() != idTexts.size() ) { for ( String id : idTexts ) { if ( !terminatedQuerys.stream().anyMatch( query -> query.queryId.equals( id ) ) ) { terminatedQuerys.add( new QueryFailedTerminationResult( fromExternalString( id ) ) ); } } } return terminatedQuerys.stream(); } catch ( UncaughtCheckedException uncaught ) { throwIfPresent( uncaught.getCauseIfOfType( InvalidArgumentsException.class ) ); throw uncaught; } }

Target:
public Stream<QueryTerminationResult> killQueries( @Name( "ids" ) List<String> idTexts ) throws InvalidArgumentsException, IOException { securityContext.assertCredentialsNotExpired(); try { Set<Long> queryIds = idTexts.stream().map( catchThrown( InvalidArgumentsException.class, QueryId::fromExternalString ) ).map( catchThrown( InvalidArgumentsException.class, QueryId::kernelQueryId ) ).collect( toSet() ); Set<QueryTerminationResult> terminatedQuerys = getActiveTransactions( tx -> executingQueriesWithIds( queryIds, tx ) ).map( catchThrown( InvalidArgumentsException.class, this::killQueryTransaction ) ).collect( toSet() ); boolean killQueryVerbose = resolver.resolveDependency( Config.class ).get( GraphDatabaseSettings.kill_query_verbose ); if ( killQueryVerbose && terminatedQuerys.size() != idTexts.size() ) { for ( String id : idTexts ) { if ( !terminatedQuerys.stream().anyMatch( query -> query.queryId.equals( id ) ) ) { terminatedQuerys.add( new QueryFailedTerminationResult( fromExternalString( id ) ) ); } } } return terminatedQuerys.stream(); } catch ( UncaughtCheckedException uncaught ) { throwIfPresent( uncaught.getCauseIfOfType( InvalidArgumentsException.class ) ); throw uncaught; } }
Source:
private static RecordWriter createRcFileWriter(Path target, JobConf conf, Properties properties, boolean compress) throws IOException { int columns = properties.getProperty(META_TABLE_COLUMNS).split(",").length; RCFileOutputFormat.setColumnNumber(conf, columns); CompressionCodec codec = null; if (compress) { codec = ReflectionUtil.newInstance(getOutputCompressorClass(conf, DefaultCodec.class), conf); } RCFile.Writer writer = new RCFile.Writer(target.getFileSystem(conf), conf, target, () -> {}, codec); return new ExtendedRecordWriter() { private long length; @Override public long getWrittenBytes() { return length; } @Override public void write(Writable value) throws IOException { writer.append(value); length = writer.getLength(); } @Override public void close(boolean abort) throws IOException { length = writer.getLength(); writer.close(); if (!abort) { length = target.getFileSystem(conf).getFileStatus(target).getLen(); } } }; }

Target:
private static RecordWriter createRcFileWriter(Path target, JobConf conf, Properties properties, boolean compress) throws IOException { int columns = properties.getProperty(META_TABLE_COLUMNS).split(",").length; RCFileOutputFormat.setColumnNumber(conf, columns); CompressionCodec codec = null; if (compress) { codec = ReflectionUtil.newInstance(getOutputCompressorClass(conf, DefaultCodec.class), conf); } RCFile.Writer writer = new RCFile.Writer(target.getFileSystem(conf), conf, target, () -> {}, codec); return new ExtendedRecordWriter() { private long length; @Override public long getWrittenBytes() { return length; } @Override public void write(Writable value) throws IOException { writer.append(value); length = writer.getLength(); } @Override public void close(boolean abort) throws IOException { writer.close(); if (!abort) { length = target.getFileSystem(conf).getFileStatus(target).getLen(); } } }; }
Source:
public SparseArray<List<NoteInfo>> findDuplicateNotes(long mid, List<String> keys) { Set<Long> csum = new HashSet<>(keys.size()); Map<String, List<Integer>> keyToIndexesMap = new HashMap<>(keys.size()); for (int i = 0; i < keys.size(); i++) { String key = keys.get(i); csum.add(Utils.fieldChecksum(key)); if (!keyToIndexesMap.containsKey(key)) { keyToIndexesMap.put(key, new ArrayList<Integer>()); } keyToIndexesMap.get(key).add(i); } String selection = String.format("%s=%d and %s in (%s)", Note.MID, mid, Note.CSUM, TextUtils.join(",", csum)); Cursor notesTableCursor = mResolver.query(Note.SQL_QUERY_URI, null, selection, null, null); if (notesTableCursor == null) { return null; } SparseArray<List<NoteInfo>> result = new SparseArray<>(); try { while (notesTableCursor.moveToNext()) { NoteInfo note = NoteInfo.buildFromCursor(notesTableCursor); if (note == null) { continue; } if (keyToIndexesMap.containsKey(note.getKey())) { List<Integer> outputPositions = keyToIndexesMap.get(note.getKey()); for (Integer outputPos : outputPositions) { int sparseArrayIndex = result.indexOfKey(outputPos); if (sparseArrayIndex < 0) { List<NoteInfo> duplicatesForKey = new ArrayList<>(); duplicatesForKey.add(note); result.put(outputPos, duplicatesForKey); } else { result.valueAt(sparseArrayIndex).add(note); } } } } } finally { notesTableCursor.close(); } return result; }

Target:
public SparseArray<List<NoteInfo>> findDuplicateNotes(long mid, List<String> keys) { Set<Long> csums = new HashSet<>(keys.size()); Map<String, List<Integer>> keyToIndexesMap = new HashMap<>(keys.size()); for (int i = 0; i < keys.size(); i++) { String key = keys.get(i); csums.add(Utils.fieldChecksum(key)); if (!keyToIndexesMap.containsKey(key)) { keyToIndexesMap.put(key, new ArrayList<Integer>()); } keyToIndexesMap.get(key).add(i); } String sel = String.format("%s=%d and %s in (%s)", Note.MID, mid, Note.CSUM, TextUtils.join(",", csums)); Cursor notesTableCursor = mResolver.query(Note.CONTENT_URI_V2, PROJECTION, sel, null, null); if (notesTableCursor == null) { return null; } SparseArray<List<NoteInfo>> result = new SparseArray<>(); try { while (notesTableCursor.moveToNext()) { NoteInfo note = NoteInfo.buildFromCursor(notesTableCursor); if (note == null) { continue; } if (keyToIndexesMap.containsKey(note.getKey())) { List<Integer> outputPositions = keyToIndexesMap.get(note.getKey()); for (Integer outputPos : outputPositions) { int sparseArrayIndex = result.indexOfKey(outputPos); if (sparseArrayIndex < 0) { List<NoteInfo> duplicatesForKey = new ArrayList<>(); duplicatesForKey.add(note); result.put(outputPos, duplicatesForKey); } else { result.valueAt(sparseArrayIndex).add(note); } } } } } finally { notesTableCursor.close(); } return result; }
Source:
public void releaseSerializer(final Serializer<?> serializer) { if (!created.remove(serializer)) { throw new IllegalArgumentException("Given serializer: " + serializer.getClass().getName() + " is not managed by this provider"); } if(serializer instanceof CompactPersistentJavaSerializer) { try { ((CompactPersistentJavaSerializer)serializer).close(); } catch (IOException e) { throw new RuntimeException("Unable to close the serializer: " + serializer.getClass().getName()); } } }

Target:
public void releaseSerializer(final Serializer<?> serializer) throws IOException { if (!created.remove(serializer)) { throw new IllegalArgumentException("Given serializer: " + serializer.getClass().getName() + " is not managed by this provider"); } if(serializer instanceof Closeable) { ((Closeable)serializer).close(); } }
Source:
private void overlayText(Canvas canvas, Matrix matrix) { if (mOverlayParams == null || !initOverlayParams(matrix)) { return; } mOverlayParams.paint.setTextAlign(Align.LEFT); canvas.drawText(mOverlayParams.suraText, mOverlayParams.offsetX, mOverlayParams.topBaseline, mOverlayParams.paint); mOverlayParams.paint.setTextAlign(Align.RIGHT); canvas.drawText(mOverlayParams.juzText, getWidth() - mOverlayParams.offsetX, mOverlayParams.topBaseline, mOverlayParams.paint); mOverlayParams.paint.setTextAlign(Align.CENTER); canvas.drawText(mOverlayParams.pageText, getWidth() / 2.0f, mOverlayParams.bottomBaseline, mOverlayParams.paint); if (!mOverlayParams.rub3Text.equals("")) { mOverlayParams.paint.setTextAlign(Align.CENTER); canvas.drawText(mOverlayParams.rub3Text, getWidth() / 2.0f, mOverlayParams.topBaseline, mOverlayParams.paint); } mDidDraw = true; }

Target:
private void overlayText(Canvas canvas, Matrix matrix) { if (mOverlayParams == null || !initOverlayParams(matrix)) { return; } mOverlayParams.paint.setTextAlign(Align.LEFT); canvas.drawText(mOverlayParams.suraText, mOverlayParams.offsetX, mOverlayParams.topBaseline, mOverlayParams.paint); mOverlayParams.paint.setTextAlign(Align.CENTER); canvas.drawText(mOverlayParams.pageText, getWidth() / 2.0f, mOverlayParams.bottomBaseline, mOverlayParams.paint); mOverlayParams.paint.setTextAlign(Align.RIGHT); canvas.drawText(mOverlayParams.juzText + mOverlayParams.rub3Text, getWidth() - mOverlayParams.offsetX, mOverlayParams.topBaseline, mOverlayParams.paint); mDidDraw = true; }
Source:
private static void addEmptyCD(Guid dstId) { VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), dstId), VmDeviceType.DISK, VmDeviceType.CDROM, Collections.<String, Object> singletonMap(VdsProperties.Path, ""), true, true, ""); }

Target:
private static void addEmptyCD(Guid dstId) { VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), dstId), VmDeviceType.DISK, VmDeviceType.CDROM, Collections.<String, Object> singletonMap(VdsProperties.Path, ""), true, true); }
Source:
public void test() throws Exception { startDefaultMasterDontWaitForZK(new MockCuratorClientFactory(), "--zk-connection-timeout", "1"); final HeliosClient client = defaultClient(); try { client.listMasters().get().get(0); Assert.fail("Exception should have been thrown, as ZK doesnt exist"); } catch (ExecutionException e) { Assert.assertTrue(e.getCause() instanceof HeliosException); } }

Target:
public void test() throws Exception { startDefaultMasterDontWaitForZK(new MockCuratorClientFactory(), "--zk-connection-timeout", "1"); final HeliosClient client = defaultClient(); try { client.listMasters().get().get(0); fail("Exception should have been thrown, as ZK doesnt exist"); } catch (ExecutionException e) { assertTrue(e.getCause() instanceof HeliosException); } }
Source:
private void changeWorkingDirOwner(String containerId, LineConsumer machineLogger) throws MachineException { String prepareCmd = "CHE_USER=`id -un`;" + "sudo chown -R ${CHE_USER}:docker /home/user;" + "sudo ln -s /home/user `eval echo \"~${CHE_USER}\"`"; final String[] command = {"/bin/sh", "-c", prepareCmd}; Exec exec; try { exec = docker.createExec(CreateExecParams.create(containerId, command).withDetach(false)); } catch (IOException e) { throw new MachineException(format("Error occurs while initializing command %s in docker container %s: %s", Arrays.toString(command), containerId, e.getMessage()), e); } try { docker.startExec(StartExecParams.create(exec.getId()), new LogMessagePrinter(machineLogger)); } catch (IOException e) { throw new MachineException(format("Error occurs while executing command %s in docker container %s: %s", Arrays.toString(exec.getCommand()), containerId, e.getMessage()), e); } }

Target:
private void changeWorkingDirOwner(String containerId, LineConsumer machineLogger) throws MachineException { String prepareCmd = "CHE_USER=`id -un`;" + "sudo chown -R ${CHE_USER}:docker /home/user;" + "sudo ln -s /home/user `eval echo \"~${CHE_USER}\"`"; final String[] command = {"/bin/sh", "-c", prepareCmd}; Exec exec; try { exec = docker.createExec(CreateExecParams.create(containerId, command).withDetach(false)); } catch (IOException e) { LOG.error(format("Error occurs while initializing command %s in docker container %s: %s", Arrays.toString(command), containerId, e.getMessage()), e); return; } try { docker.startExec(StartExecParams.create(exec.getId()), new LogMessagePrinter(machineLogger)); } catch (IOException e) { LOG.error(format("Error occurs while executing command %s in docker container %s: %s", Arrays.toString(exec.getCommand()), containerId, e.getMessage()), e); } }
Source:
public AvailabilityType getAvailability() { if (ApacheServerComponent.getUseBMX()) lastKnownAvailability = getAvailabilityBMXInternal(); else lastKnownAvailability = getAvailabilityInternal(); return lastKnownAvailability; }

Target:
public AvailabilityType getAvailability() { if (resourceContext.getParentResourceComponent().getUseBMX()) lastKnownAvailability = getAvailabilityBMXInternal(); else lastKnownAvailability = getAvailabilityInternal(); return lastKnownAvailability; }
Source:
public byte[][] transformToBytesValuesSV(ProjectionBlock projectionBlock) { if (_results == null) { _results = new byte[DocIdSetPlanNode.MAX_DOC_PER_CALL][]; } String[] argumentValues = _transformFunction.transformToStringValuesSV(projectionBlock); int length = projectionBlock.getNumDocs(); for (int i = 0; i < length; i++) { try { Geometry geometry = _reader.read(argumentValues[i]); Preconditions.checkArgument(geometry instanceof Polygon, "The geometry object must be polygon"); _results[i] = GeometrySerializer.serialize(geometry); } catch (ParseException e) { Utils.rethrowException( new RuntimeException(String.format("Failed to parse geometry from string: %s", argumentValues[i]))); } } return _results; }

Target:
public byte[][] transformToBytesValuesSV(ProjectionBlock projectionBlock) { if (_results == null) { _results = new byte[DocIdSetPlanNode.MAX_DOC_PER_CALL][]; } String[] argumentValues = _transformFunction.transformToStringValuesSV(projectionBlock); int length = projectionBlock.getNumDocs(); for (int i = 0; i < length; i++) { try { Geometry geometry = _reader.read(argumentValues[i]); Preconditions.checkArgument(geometry instanceof Polygon, "The geometry object must be polygon"); _results[i] = GeometrySerializer.serialize(geometry); } catch (ParseException e) { new RuntimeException(String.format("Failed to parse geometry from string: %s", argumentValues[i])); } } return _results; }
Source:
public MBeanServerConnection getMBeanServerConnection(Subject delegationSubject) { throw new UnsupportedOperationException( "Jolokia currently do not support connections using a subject, if you have a use case please let us know"); }

Target:
public MBeanServerConnection getMBeanServerConnection(Subject delegationSubject) { throw new UnsupportedOperationException( "Jolokia currently do not support connections using a subject, if you have a use case, raise an issue in Jolokias github repo"); }
Source:
public Response getStatus(@PathParam("nodeId") String nodeId) { Set<Node> nodes = nodeManager.getNodes(NodeState.ACTIVE); Node node = nodes.stream() .filter(n -> n.getNodeIdentifier().equals(nodeId)) .findFirst() .orElse(null); if (node == null) { return Response.status(Response.Status.NOT_FOUND).build(); } Request request = prepareGet() .setUri(uriBuilder() .scheme("http") .hostAndPort(fromParts(node.getHostAndPort().getHostText(), node.getHostAndPort().getPort())) .appendPath("v1") .appendPath("info") .build()) .build(); InputStream responseStream = httpClient.execute(request, new StreamingJsonResponseHandler()); return Response.ok(responseStream, APPLICATION_JSON_TYPE).build(); }

Target:
public Response getStatus(@PathParam("nodeId") String nodeId) { return proxyJsonResponse(nodeId, "v1/status"); }
Source:
public void validate(final String uri) throws URIHandlerException { if(uri!=null){ try { URI uriParsed = URI.create(uri); String scheme = uriParsed.getScheme(); if(!(URIBuilder.VIEW_SCHEME.equals(scheme) || URIBuilder.DATASET_SCHEME.equals(scheme))) { LOG.error("Unexpected scheme: view, uri was {}", uri); XException xException = new XException(ErrorCode.E0904, scheme, uri); throw new URIHandlerException(xException); } } catch (IllegalArgumentException iae) { XException xException = new XException(ErrorCode.E0906, iae); throw new URIHandlerException(xException); } } }

Target:
public void validate(final String uri) throws URIHandlerException { try { URI uriParsed = URI.create(uri); String scheme = uriParsed.getScheme(); if(!(URIBuilder.VIEW_SCHEME.equals(scheme) || URIBuilder.DATASET_SCHEME.equals(scheme))) { LOG.error("Unexpected scheme: view, uri was "+ uri); XException xException = new XException(ErrorCode.E0904, scheme, uri); throw new URIHandlerException(xException); } } catch (IllegalArgumentException iae) { XException xException = new XException(ErrorCode.E0906, iae); throw new URIHandlerException(xException); } }
Source:
public void setKeyAndIv(byte[] keyIvCombo) { if (keyIvCombo.length == 48) { this.aeskey = new byte[32]; this.iv = new byte[16]; System.arraycopy(keyIvCombo, 0, this.iv, 0, 16); System.arraycopy(keyIvCombo, 16, this.aeskey, 0, 32); } else if (keyIvCombo.length == 44) { this.aeskey = new byte[32]; this.iv = new byte[12]; System.arraycopy(keyIvCombo, 0, this.iv, 0, 12); System.arraycopy(keyIvCombo, 12, this.aeskey, 0, 32); } else if (keyIvCombo.length >= 32) { this.aeskey = new byte[32]; System.arraycopy(keyIvCombo, 0, aeskey, 0, 32); } else if (keyIvCombo.length >= 16) { this.aeskey = new byte[16]; System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16); } else if (keyIvCombo.length >= 12) { this.aeskey = new byte[12]; System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 12); } }

Target:
public void setKeyAndIv(byte[] keyIvCombo) { if (keyIvCombo.length == 48) { this.aeskey = new byte[32]; this.iv = new byte[16]; System.arraycopy(keyIvCombo, 0, this.iv, 0, 16); System.arraycopy(keyIvCombo, 16, this.aeskey, 0, 32); } else if (keyIvCombo.length == 44) { this.aeskey = new byte[32]; this.iv = new byte[12]; System.arraycopy(keyIvCombo, 0, this.iv, 0, 12); System.arraycopy(keyIvCombo, 12, this.aeskey, 0, 32); } else if (keyIvCombo.length >= 32) { this.aeskey = new byte[32]; System.arraycopy(keyIvCombo, 0, aeskey, 0, 32); } }
Source:
public void execute(CloudStackClient cloudStackClient, Pool pool, DelegateExecution execution) { if (execution.getVariable(ProcessVariables.NETWORK_ID) != null) { LOG.warn("Network process variable ({}) will be overwritten!", ProcessVariables.NETWORK_ID); } final String networkName = Networks.formatNameFromBusinessKey(execution.getProcessBusinessKey()); final String zoneId = pool.getOption(ProviderOptions.ZONE_ID); final String networkOffering = pool.getOption(ProviderOptions.NETWORK_OFFERING); Network network; try { network = Networks.getByName(cloudStackClient, networkName); LOG.info("Network with name exists.", networkName); } catch (NoSuchElementException e) { LOG.info(String.format("Creating network %s in zone %s with offering %s", networkName, zoneId, networkOffering)); network = cloudStackClient.getNetworkClient().createNetworkInZone(zoneId, networkOffering, networkName, networkName, CreateNetworkOptions.NONE); } LOG.info("Storing network id in process variable {}", network.getId(), ProcessVariables.NETWORK_ID); execution.setVariable(ProcessVariables.NETWORK_ID, network.getId()); }

Target:
public void execute(CloudStackClient cloudStackClient, Pool pool, DelegateExecution execution) { if (execution.getVariable(ProcessVariables.NETWORK_ID) != null) { LOG.warn("Network process variable ({}) will be overwritten!", ProcessVariables.NETWORK_ID); } final String networkName = Networks.formatNameFromBusinessKey(execution.getProcessBusinessKey()); final String zoneId = pool.getProvider().getOption(ProviderOptions.ZONE_ID); final String networkOffering = pool.getProvider().getOption(ProviderOptions.NETWORK_OFFERING); Network network; try { network = Networks.getByName(cloudStackClient, networkName); LOG.info("Network with name exists.", networkName); } catch (NoSuchElementException e) { LOG.info(String.format("Creating network %s in zone %s with offering %s", networkName, zoneId, networkOffering)); network = cloudStackClient.getNetworkClient().createNetworkInZone(zoneId, networkOffering, networkName, networkName, CreateNetworkOptions.NONE); } LOG.info("Storing network id in process variable {}", network.getId(), ProcessVariables.NETWORK_ID); execution.setVariable(ProcessVariables.NETWORK_ID, network.getId()); }
Source:
public ResourceTable stageUpgradeTable(ResourceTable global, ResourceTable incoming, ResourceTable recovery, String profileRef, boolean clearProgress) throws UnfullfilledRequirementsException, StorageFullException, UnresolvedResourceException { if(global.getTableReadiness() != ResourceTable.RESOURCE_TABLE_INSTALLED) { repair(global, incoming, recovery); if(global.getTableReadiness() != ResourceTable.RESOURCE_TABLE_INSTALLED) { throw new IllegalArgumentException("Global resource table was not ready for upgrading"); } throw new IllegalArgumentException("Global resource table was not ready for upgrading"); } if(clearProgress) { incoming.clear(); } Vector<ResourceLocation> locations = new Vector<ResourceLocation>(); locations.addElement(new ResourceLocation(Resource.RESOURCE_AUTHORITY_REMOTE, profileRef)); Resource r = new Resource(Resource.RESOURCE_VERSION_UNKNOWN, APP_PROFILE_RESOURCE_ID , locations, "Application Descriptor"); incoming.addResource(r, incoming.getInstallers().getProfileInstaller(false), null); incoming.prepareResources(global, this, APP_PROFILE_RESOURCE_ID); return incoming; }

Target:
public ResourceTable stageUpgradeTable(ResourceTable global, ResourceTable incoming, ResourceTable recovery, String profileRef, boolean clearProgress) throws UnfullfilledRequirementsException, StorageFullException, UnresolvedResourceException { if(global.getTableReadiness() != ResourceTable.RESOURCE_TABLE_INSTALLED) { repair(global, incoming, recovery); if(global.getTableReadiness() != ResourceTable.RESOURCE_TABLE_INSTALLED) { throw new IllegalArgumentException("Global resource table was not ready for upgrading"); } } if(clearProgress) { incoming.clear(); } Vector<ResourceLocation> locations = new Vector<ResourceLocation>(); locations.addElement(new ResourceLocation(Resource.RESOURCE_AUTHORITY_REMOTE, profileRef)); Resource r = new Resource(Resource.RESOURCE_VERSION_UNKNOWN, APP_PROFILE_RESOURCE_ID , locations, "Application Descriptor"); incoming.addResource(r, incoming.getInstallers().getProfileInstaller(false), null); incoming.prepareResources(global, this, APP_PROFILE_RESOURCE_ID); return incoming; }
Source:
private EntityRef getChestEntity(EntityRef building) { ConstructedBuildingComponent buildingComponent = building.getComponent(ConstructedBuildingComponent.class); Vector3i chestPosition = buildingComponent.boundingRegions.get(0).max(); return blockEntityRegistry.getBlockEntityAt(chestPosition); }

Target:
private EntityRef getChestEntity(EntityRef building) { ConstructedBuildingComponent buildingComponent = building.getComponent(ConstructedBuildingComponent.class); Vector3i chestPosition = buildingComponent.boundingRegions.get(Constants.CHEST_BLOCK_INDEX).max(); return blockEntityRegistry.getBlockEntityAt(chestPosition); }
Source:
public void testNotUsername() { testingClient.server("passwordPolicy").run(session -> { RealmModel realmModel = session.getContext().getRealm(); PasswordPolicyManagerProvider policyManager = session.getProvider(PasswordPolicyManagerProvider.class); realmModel.setPasswordPolicy(PasswordPolicy.parse(session, NotUsernamePasswordPolicyProviderFactory.ID)); Assert.assertEquals("invalidPasswordNotUsernameMessage", policyManager.validate("jdoe", "jdoe").getMessage()); assertNull(policyManager.validate("jdoe", "ab&d1234")); }); }

Target:
public void testNotUsername() { testingClient.server("passwordPolicy").run(session -> { RealmModel realmModel = session.getContext().getRealm(); PasswordPolicyManagerProvider policyManager = session.getProvider(PasswordPolicyManagerProvider.class); realmModel.setPasswordPolicy(PasswordPolicy.parse(session, "notUsername")); Assert.assertEquals("invalidPasswordNotUsernameMessage", policyManager.validate("jdoe", "jdoe").getMessage()); assertNull(policyManager.validate("jdoe", "ab&d1234")); }); }
Source:
public HttpMessage sendQueryByGraphQlPost(String query) { HttpMessage message = null; try { HttpRequestBody msgBody = new HttpRequestBody(query); HttpRequestHeader msgHeader = new HttpRequestHeader(HttpRequestHeader.POST, endpointUrl, "HTTP/1.1"); msgHeader.setHeader("Accept", "application/json"); msgHeader.setHeader("Content-Type", "application/graphql"); msgHeader.setContentLength(msgBody.length()); message = new HttpMessage(msgHeader, msgBody); send(message); } catch (IOException e) { LOG.error(e.getMessage()); } return message; }

Target:
private HttpMessage sendQueryByGraphQlPost(String query) { try { HttpRequestBody msgBody = new HttpRequestBody(query); HttpRequestHeader msgHeader = new HttpRequestHeader(HttpRequestHeader.POST, endpointUrl, HttpHeader.HTTP11); msgHeader.setHeader("Accept", HttpHeader.JSON_CONTENT_TYPE); msgHeader.setHeader(HttpHeader.CONTENT_TYPE, GRAPHQL_CONTENT_TYPE); msgHeader.setContentLength(msgBody.length()); HttpMessage message = new HttpMessage(msgHeader, msgBody); send(message); return message; } catch (IOException e) { LOG.error(e.getMessage()); } return null; }
Source:
public void testBasics() throws Exception { client.create().forPath("/test"); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.INITIALIZED); Assert.assertEquals(cache.getCurrentChildren("/test"), Collections.emptySortedSet()); client.create().forPath("/test/one", "hey there".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/one"); Assert.assertEquals(cache.getCurrentChildren("/test"), ImmutableSortedSet.of("one")); Assert.assertEquals(new String(cache.getCurrentData("/test/one").getData()), "hey there"); client.setData().forPath("/test/one", "sup!".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_UPDATED, "/test/one"); Assert.assertEquals(cache.getCurrentChildren("/test"), ImmutableSortedSet.of("one")); Assert.assertEquals(new String(cache.getCurrentData("/test/one").getData()), "sup!"); client.delete().forPath("/test/one"); assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/one"); Assert.assertEquals(cache.getCurrentChildren("/test"), Collections.emptySortedSet()); assertNoMoreEvents(); }

Target:
public void testBasics() throws Exception { client.create().forPath("/test"); cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.INITIALIZED); Assert.assertEquals(cache.getCurrentChildren("/test").keySet(), ImmutableSet.of()); client.create().forPath("/test/one", "hey there".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/one"); Assert.assertEquals(cache.getCurrentChildren("/test").keySet(), ImmutableSet.of("one")); Assert.assertEquals(new String(cache.getCurrentData("/test/one").getData()), "hey there"); client.setData().forPath("/test/one", "sup!".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_UPDATED, "/test/one"); Assert.assertEquals(cache.getCurrentChildren("/test").keySet(), ImmutableSet.of("one")); Assert.assertEquals(new String(cache.getCurrentData("/test/one").getData()), "sup!"); client.delete().forPath("/test/one"); assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/one"); Assert.assertEquals(cache.getCurrentChildren("/test").keySet(), ImmutableSet.of()); assertNoMoreEvents(); }
Source:
private void addCommands() { UICommand tempVar = new UICommand("onRemove", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); getCommands().add(tempVar); UICommand tempVar2 = new UICommand("cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); getCommands().add(tempVar2); }

Target:
private void addCommands() { getCommands().add(new UICommand("onRemove", this).setTitle(ConstantsManager.getInstance().getConstants().ok()) .setIsDefault(true)); getCommands().add(new UICommand("cancel", this).setTitle(ConstantsManager.getInstance().getConstants().cancel()) .setIsCancel(true)); }
Source:
public void testNonEmpty() { Observable<String> source = Observable.just("Chicago", "Houston", "Phoenix"); final AtomicBoolean wasCalled = new AtomicBoolean(false); source.doOnEmpty(new Action0() { @Override public void call() { wasCalled.set(true); } }).subscribe(); assert(!wasCalled.get()); }

Target:
public void testNonEmpty() { Observable<String> source = Observable.just("Chicago", "Houston", "Phoenix"); final AtomicBoolean wasCalled = new AtomicBoolean(false); source.doOnEmpty(new Action0() { @Override public void call() { wasCalled.set(true); } }).subscribe(); assertFalse(wasCalled.get()); }
Source:
private JsonObject getSlotCounts() { int freeSlots = 0; int totalSlots = 0; int usedSlots = 0; for (RemoteProxy proxy : getRegistry().getAllProxies()) { totalSlots += proxy.getTestSlots().size() > proxy.getMaxNumberOfConcurrentTestSessions() ? proxy.getMaxNumberOfConcurrentTestSessions() : proxy.getTestSlots().size(); usedSlots += proxy.getTotalUsed(); } freeSlots = totalSlots - usedSlots; JsonObject result = new JsonObject(); result.addProperty("free", freeSlots); result.addProperty("total", totalSlots); return result; }

Target:
private JsonObject getSlotCounts() { int totalSlots = 0; int usedSlots = 0; for (RemoteProxy proxy : getRegistry().getAllProxies()) { totalSlots += Math.min(proxy.getMaxNumberOfConcurrentTestSessions(), proxy.getTestSlots().size()); usedSlots += proxy.getTotalUsed(); } JsonObject result = new JsonObject(); result.addProperty("free", totalSlots - usedSlots); result.addProperty("total", totalSlots); return result; }
Source:
public SubstringDimExtractionFn( @JsonProperty("index") int index, @Nullable @JsonProperty("length") Integer length ) { Preconditions.checkArgument(length == null || length >= 0, "length must be positive"); this.index = index; this.length = length != null ? length : -1; this.end = index + this.length; }

Target:
public SubstringDimExtractionFn( @JsonProperty("index") int index, @Nullable @JsonProperty("length") Integer length ) { Preconditions.checkArgument(length == null || length > 0, "length must be strictly positive"); this.index = index; this.end = length != null ? index + length : -1; }
Source:
protected Object executeWithSubject() { final PrintStream console = System.out; final SearchFormsLoader loader; console.println(ansi().fgBrightCyan().a("Initializing Search Form Template Loader").reset()); if (SearchFormsUtil.allNull(formsDir, formsFile, resultsFile)) { console.println( ansi() .fgYellow() .a("No options selected, falling back to default directory locations.") .reset()); loader = generateLoader(catalogFramework, endpointUtil, null, null, null); } else { LOGGER.debug("Attempting loader initialization"); loader = generateLoader(catalogFramework, endpointUtil, formsDir, formsFile, resultsFile); } List<Metacard> parsedMetacards = loader.retrieveSystemTemplateMetacards(); if (!parsedMetacards.isEmpty()) { console.println( ansi() .fgYellow() .a("Loader initialized, beginning ingestion of system templates.") .reset()); loader.bootstrap(parsedMetacards); console.println(ansi().fgBrightGreen().a("System templates successfully ingested.").reset()); return null; } console.println(ansi().fgBrightRed().a("No system forms to load, halting ingest.").reset()); return null; }

Target:
protected Object executeWithSubject() { console.println(ansi().fgBrightCyan().a("Initializing Search Form Template Loader").reset()); final SearchFormsLoader loader = generateLoader(catalogFramework, endpointUtil, formsDir, formsFile, resultsFile); List<Metacard> parsedMetacards = loader.retrieveSystemTemplateMetacards(); if (!parsedMetacards.isEmpty()) { printColor(Ansi.Color.GREEN, "Loader initialized, beginning ingestion of system templates."); loader.bootstrap(parsedMetacards); printColor(Ansi.Color.GREEN, "System templates successfully ingested."); } else { printColor(WARNING_COLOR, "No system forms to load, halting ingest."); } return null; }