auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LocalJournal( String journalLocation, boolean asyncWritesEnabled, int maxDaysToKeepEntries ) { CheckArg.isNotNull(journalLocation, "journalLocation"); this.journalLocation = journalLocation; this.asyncWritesEnabled = asyncWritesEnabled; this.maxTimeToKeepEntriesMillis = TimeUnit.DAYS.toMillis(maxDaysToKeepEntries); this.stopped = true; this.searchTimeDelta = TimeUnit.SECONDS.toMillis(1); }

Target:
public LocalJournal( String journalLocation, boolean asyncWritesEnabled, int maxDaysToKeepEntries ) { CheckArg.isNotNull(journalLocation, "journalLocation"); this.journalLocation = journalLocation; this.asyncWritesEnabled = asyncWritesEnabled; this.maxTimeToKeepEntriesMillis = TimeUnit.DAYS.toMillis(maxDaysToKeepEntries); this.stopped = true; this.searchTimeDelta = DEFAULT_LOCAL_SEARCH_DELTA; }
Source:
private void onServerEvent(ReplicaId replicaId, ServerErrorCode errorCode) { switch (errorCode) { case IO_Error: case Disk_Unavailable: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Error); break; case Partition_ReadOnly: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Partition_ReadOnly); clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Ok); clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Replica_Available); break; case Temporarily_Disabled: case Replica_Unavailable: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Replica_Unavailable); clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Ok); break; default: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Ok); clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Replica_Available); break; } clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Node_Response); }

Target:
private void onServerEvent(ReplicaId replicaId, ServerErrorCode errorCode) { switch (errorCode) { case IO_Error: case Disk_Unavailable: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Error); break; case Partition_ReadOnly: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Partition_ReadOnly); clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Ok); clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Replica_Available); break; case Temporarily_Disabled: case Replica_Unavailable: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Ok); clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Replica_Unavailable); break; default: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Ok); clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Replica_Available); break; } clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Node_Response); }
Source:
void addMetrics(Collection<KafkaMetric> metrics) { checkLocked(); if (!beanMetrics.isEmpty()) { unregister(); } for (KafkaMetric metric : metrics) { beanMetrics.put(metric.metricName().name(), metric); } register(); }

Target:
void addMetrics(Collection<KafkaMetric> metrics) { checkLocked(); if (metrics.isEmpty()) { return; } if (!beanMetrics.isEmpty()) { unregister(); } for (KafkaMetric metric : metrics) { beanMetrics.put(metric.metricName().name(), metric); } register(); }
Source:
public void visitFile(Path source, Path relativePath) { logger.info("Looking into file: ", source); String skipRegex = "\\.tmcrc|metadata\\.yml|(.*)Hidden(.*)"; if (source.getFileName().toString().matches(skipRegex)) { logger.info("Skipping file: ", source); return; } Path destination = toPath.resolve(relativePath); try { copyWithFilters(source, destination); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
private void visitFile(Path source, Path relativePath) throws IOException { Path destination = toPath.resolve(relativePath); if (skipFilename(source)) { return; } if (looksLikeBinary(source)) { justCopy(source, destination); } else { copyWithFilters(source, destination); } }
Source:
public void testAfterPropertiesSet_codeListIdPattern_is_notnull() throws Exception { testTarget.setCodeListIdPattern(Pattern.compile("A_.+")); testTarget.afterPropertiesSet(); List<CodeList> expectedCodeLists = new ArrayList<CodeList>(); expectedCodeLists.add(getApplicationContext().getBean( "A_simpleI18nCodeList", CodeList.class)); expectedCodeLists.add(getApplicationContext().getBean( "A_numberRangeCodeList", CodeList.class)); expectedCodeLists.add(getApplicationContext().getBean( "A_simpleMapCodeList", CodeList.class)); assertThat(testTarget.getCodeLists(), is(containsInAnyOrder(expectedCodeLists.toArray()))); }

Target:
public void testAfterPropertiesSet_codeListIdPattern_is_notnull() throws Exception { testTarget.setCodeListIdPattern(Pattern.compile("A_.+")); testTarget.afterPropertiesSet(); assertThat(testTarget.getCodeLists(), is(containsInAnyOrder( getApplicationContext().getBean("A_simpleI18nCodeList", CodeList.class), getApplicationContext().getBean("A_numberRangeCodeList", CodeList.class), getApplicationContext().getBean("A_simpleMapCodeList", CodeList.class)))); }
Source:
public Mono<MsalToken> authenticateWithDeviceCode(TokenRequestContext request, Consumer<DeviceCodeInfo> deviceCodeConsumer) { return Mono.fromFuture(() -> { DeviceCodeFlowParameters parameters = DeviceCodeFlowParameters.builder(new HashSet<>(request.getScopes()), dc -> deviceCodeConsumer.accept(new DeviceCodeInfo(dc.userCode(), dc.deviceCode(), dc.verificationUri(), OffsetDateTime.now().plusSeconds(dc.expiresIn()), dc.message()))).build(); return getPublicClientApplication(false).acquireToken(parameters); }).onErrorResume(t -> Mono.error(new ClientAuthenticationException("Failed to acquire token with device code", null, t))).map(ar -> new MsalToken(ar, options)); }

Target:
public Mono<MsalToken> authenticateWithDeviceCode(TokenRequestContext request, Consumer<DeviceCodeInfo> deviceCodeConsumer) { return Mono.fromFuture(() -> { DeviceCodeFlowParameters parameters = DeviceCodeFlowParameters.builder(new HashSet<>(request.getScopes()), dc -> deviceCodeConsumer.accept(new DeviceCodeInfo(dc.userCode(), dc.deviceCode(), dc.verificationUri(), OffsetDateTime.now().plusSeconds(dc.expiresIn()), dc.message()))).build(); return getPublicClientApplication(false).acquireToken(parameters); }).onErrorMap(t -> new ClientAuthenticationException("Failed to acquire token with device code", null, t)) .map(ar -> new MsalToken(ar, options)); }
Source:
public void testForceGarbageCollection() throws Exception { ServerConfiguration conf = newServerConfiguration(); conf.setGcWaitTime(60000); conf.setMinorCompactionInterval(120000); conf.setMajorCompactionInterval(240000); LedgerDirsManager dirManager = new LedgerDirsManager(conf, conf.getLedgerDirs(), new DiskChecker(conf.getDiskUsageThreshold(), conf.getDiskUsageWarnThreshold())); CheckpointSource cp = new CheckpointSource() { @Override public Checkpoint newCheckpoint() { return null; } @Override public void checkpointComplete(Checkpoint checkPoint, boolean compact) throws IOException { } }; for (File journalDir : conf.getJournalDirs()) { Bookie.checkDirectoryStructure(journalDir); } for (File dir : dirManager.getAllLedgerDirs()) { Bookie.checkDirectoryStructure(dir); } InterleavedLedgerStorage storage = new InterleavedLedgerStorage(); storage.initialize( conf, LedgerManagerFactory .newLedgerManagerFactory( conf, new ZkLayoutManager( zkc, conf.getZkLedgersRootPath(), ZkUtils.getACLs(conf))) .newLedgerManager(), dirManager, dirManager, cp, Checkpointer.NULL, NullStatsLogger.INSTANCE); storage.start(); long startTime = MathUtils.now(); storage.gcThread.enableForceGC(); storage.gcThread.triggerGC().get(); storage.gcThread.triggerGC().get(); assertTrue("Minor or major compaction did not trigger even on forcing.", storage.gcThread.lastMajorCompactionTime > startTime && storage.gcThread.lastMinorCompactionTime > startTime); storage.shutdown(); }

Target:
public void testForceGarbageCollection() throws Exception { ServerConfiguration conf = newServerConfiguration(); conf.setGcWaitTime(60000); conf.setMinorCompactionInterval(120000); conf.setMajorCompactionInterval(240000); LedgerDirsManager dirManager = new LedgerDirsManager(conf, conf.getLedgerDirs(), new DiskChecker(conf.getDiskUsageThreshold(), conf.getDiskUsageWarnThreshold())); CheckpointSource cp = new CheckpointSource() { @Override public Checkpoint newCheckpoint() { return null; } @Override public void checkpointComplete(Checkpoint checkPoint, boolean compact) throws IOException { } }; for (File journalDir : conf.getJournalDirs()) { Bookie.checkDirectoryStructure(journalDir); } for (File dir : dirManager.getAllLedgerDirs()) { Bookie.checkDirectoryStructure(dir); } InterleavedLedgerStorage storage = new InterleavedLedgerStorage(); storage.initialize( conf, LedgerManagerFactory .newLedgerManagerFactory( conf, RegistrationManager.instantiateRegistrationManager(conf).getLayoutManager()) .newLedgerManager(), dirManager, dirManager, null, cp, Checkpointer.NULL, NullStatsLogger.INSTANCE); storage.start(); long startTime = MathUtils.now(); storage.gcThread.enableForceGC(); storage.gcThread.triggerGC().get(); storage.gcThread.triggerGC().get(); assertTrue("Minor or major compaction did not trigger even on forcing.", storage.gcThread.lastMajorCompactionTime > startTime && storage.gcThread.lastMinorCompactionTime > startTime); storage.shutdown(); }
Source:
public synchronized void setValue(int index, Object value) { if (index < 0 || index >= size()) { throw new IndexOutOfBoundsException(); } values.set(index, value); }

Target:
public void setValue(int index, Object value) { if (index < 0 || index >= size()) { throw new IndexOutOfBoundsException(); } values.set(index, value); }
Source:
private void parseSingleRuleNode(RuleSetReferenceId ruleSetReferenceId, RuleSetBuilder ruleSetBuilder, Node ruleNode) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Element ruleElement = (Element) ruleNode; if (StringUtils.isNotBlank(ruleSetReferenceId.getRuleName()) && !isRuleName(ruleElement, ruleSetReferenceId.getRuleName())) { return; } Rule rule = new RuleFactory().buildRule(ruleElement, resourceLoader); rule.setRuleSetName(ruleSetBuilder.getName()); ruleSetBuilder.addRule(rule); }

Target:
private void parseSingleRuleNode(RuleSetReferenceId ruleSetReferenceId, RuleSetBuilder ruleSetBuilder, Node ruleNode) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Element ruleElement = (Element) ruleNode; if (StringUtils.isNotBlank(ruleSetReferenceId.getRuleName()) && !isRuleName(ruleElement, ruleSetReferenceId.getRuleName())) { return; } Rule rule = new RuleFactory(resourceLoader).buildRule(ruleElement); rule.setRuleSetName(ruleSetBuilder.getName()); ruleSetBuilder.addRule(rule); }
Source:
private boolean loadMediaInfo() { Log.d(TAG, "Loading media info"); if (controller != null) { Playable media = controller.getMedia(); if (media != null) { txtvTitle.setText(media.getEpisodeTitle()); mFeedName.setText(media.getFeedTitle()); onPositionObserverUpdate(); Glide.with(getActivity()) .load(media.getImageLocation()) .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate() .into(imgvCover); fragmentLayout.setVisibility(View.VISIBLE); if (controller.isPlayingVideoLocally()) { butPlay.setVisibility(View.GONE); } else { butPlay.setVisibility(View.VISIBLE); } return true; } else { Log.w(TAG, "loadMediaInfo was called while the media object of playbackService was null!"); return false; } } else { Log.w(TAG, "loadMediaInfo was called while playbackService was null!"); return false; } }

Target:
private boolean loadMediaInfo() { Log.d(TAG, "Loading media info"); if (controller == null) { Log.w(TAG, "loadMediaInfo was called while PlaybackController was null!"); return false; } Playable media = controller.getMedia(); if (media != null) { txtvTitle.setText(media.getEpisodeTitle()); mFeedName.setText(media.getFeedTitle()); onPositionObserverUpdate(); Glide.with(getActivity()) .load(media.getImageLocation()) .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate() .into(imgvCover); fragmentLayout.setVisibility(View.VISIBLE); if (controller.isPlayingVideoLocally()) { butPlay.setVisibility(View.GONE); } else { butPlay.setVisibility(View.VISIBLE); } return true; } else { Log.w(TAG, "loadMediaInfo was called while the media object of playbackService was null!"); return false; } }
Source:
public Simulation cloneSimulation() { Simulation toReturn = new Simulation(); this.scenarios.forEach(scenario -> toReturn.scenarios.add(scenario.cloneScenario())); final List<FactMapping> originalFactMappings = this.simulationDescriptor.getUnmodifiableFactMappings(); for (int i = 0; i < originalFactMappings.size(); i++) { final FactMapping originalFactMapping = originalFactMappings.get(i); final FactIdentifier clonedFactIdentifier = originalFactMapping.getFactIdentifier().cloneFactIdentifier(); final ExpressionIdentifier clonedExpressionIdentifier = originalFactMapping.getExpressionIdentifier().cloneExpressionIdentifier(); final FactMapping clonedFactMapping = toReturn.simulationDescriptor.addFactMapping(i, clonedFactIdentifier, clonedExpressionIdentifier); clonedFactMapping.setFactAlias(originalFactMapping.getFactAlias()); clonedFactMapping.setExpressionAlias(originalFactMapping.getExpressionAlias()); originalFactMapping.getExpressionElements().forEach(expressionElement -> clonedFactMapping.getExpressionElements().add(new ExpressionElement(expressionElement.getStep()))); } return toReturn; }

Target:
public Simulation cloneSimulation() { Simulation toReturn = new Simulation(); this.scenarios.forEach(scenario -> toReturn.scenarios.add(scenario.cloneScenario())); final List<FactMapping> originalFactMappings = this.simulationDescriptor.getUnmodifiableFactMappings(); for (int i = 0; i < originalFactMappings.size(); i++) { final FactMapping originalFactMapping = originalFactMappings.get(i); toReturn.simulationDescriptor.addFactMapping(i, originalFactMapping); } return toReturn; }
Source:
public Payload(final Object data, final Visibility visibility, final String visibilityId) { if(null == data){ this.type = Object.class.getName(); }else{ this.type = data.getClass().getName(); } this.data = data; this.visibility = visibility; this.visibilityId = visibilityId; }

Target:
public Payload(final Object data, final Visibility visibility, final String visibilityId) { this.type = data.getClass().getName(); this.data = data; this.visibility = visibility; this.visibilityId = visibilityId; }
Source:
private boolean fileIsInRepository(AbstractFile file) throws TskCoreException { if (fileRepositoryLookupCache.containsKey(file.getId())) { return fileRepositoryLookupCache.get(file.getId()).equals(FileRepoState.EXISTS); } if (file.getSha256Hash() == null || file.getSha256Hash().isEmpty()) { throw new TskCoreException("Missing SHA-256 hash for file " + file.getName() + "(ID: " + file.getId() + ")"); } try { boolean exists = FileRepository.exists(file); if (exists) { fileRepositoryLookupCache.put(file.getId(), FileRepoState.EXISTS); } else { fileRepositoryLookupCache.put(file.getId(), FileRepoState.DOES_NOT_EXIST); } return exists; } catch (IOException | FileRepositoryException ex) { throw new TskCoreException("Error looking up file in file repository"); } }

Target:
private boolean fileIsInRepository(AbstractFile file) throws TskCoreException { if (fileRepositoryLookupCache.containsKey(file.getId())) { return fileRepositoryLookupCache.get(file.getId()).equals(FileRepoState.EXISTS); } if (file.getSha256Hash() == null || file.getSha256Hash().isEmpty()) { throw new TskCoreException("Missing SHA-256 hash for file " + file.getName() + "(ID: " + file.getId() + ")"); } try { boolean exists = FileRepository.exists(file); if (exists) { fileRepositoryLookupCache.put(file.getId(), FileRepoState.EXISTS); } else { fileRepositoryLookupCache.put(file.getId(), FileRepoState.DOES_NOT_EXIST); } return exists; } catch (IOException | FileRepositoryException ex) { throw new TskCoreException("Error looking up file in file repository", ex); } }
Source:
protected void updateURLInformation() { String url = serverUrlCombo.getText(); apiKey.setToolTipText( NLS.bind(Messages.BugzillaRestRepositorySettingsPage_Please_create_or_copy_the_API_Key_from, url)); apiKeyLabel.setToolTipText( NLS.bind(Messages.BugzillaRestRepositorySettingsPage_Please_create_or_copy_the_API_Key_from, url)); apikeyPreferenceLink.setText(url + userprefs); apikeyPreferenceLink .setToolTipText(NLS.bind(Messages.BugzillaRestRepositorySettingsPage_View_your_apikey_settings, url)); apikeyPreferenceLink.setEnabled(TasksUiInternal.isValidUrl(url + userprefs)); }

Target:
protected void updateURLInformation() { String url = serverUrlCombo.getText() + userprefs; apiKey.setToolTipText( NLS.bind(Messages.BugzillaRestRepositorySettingsPage_Please_create_or_copy_the_API_Key_from, url)); apiKeyLabel.setToolTipText( NLS.bind(Messages.BugzillaRestRepositorySettingsPage_Please_create_or_copy_the_API_Key_from, url)); apikeyPreferenceLink.setText(url); apikeyPreferenceLink .setToolTipText(NLS.bind(Messages.BugzillaRestRepositorySettingsPage_View_your_apikey_settings, url)); apikeyPreferenceLink.setEnabled(TasksUiInternal.isValidUrl(url)); }
Source:
public void deleteEntity(WebContext ctx, Optional<? extends BaseEntity<?>> optionalEntity) { if (ctx.isSafePOST()) { optionalEntity.ifPresent(entity -> { if (entity.getDescriptor().isComplexDelete() && Sirius.isFrameworkEnabled(Processes.FRAMEWORK_PROCESSES)) { Processes processes = globalContext.getPart(Processes.class); String processId = processes.createProcessForCurrentUser("delete-entity", NLS.fmtr("BizController.deleteProcessTitle") .set("entity", Strings.limit(entity, 30)) .format(), "fa-trash", Collections.emptyMap()); tasks.defaultExecutor().fork(() -> { processes.execute(processId, process -> { process.log(ProcessLog.info() .withNLSKey("BizController.startDelete") .withContext("entity", String.valueOf(entity))); entity.getDescriptor().getMapper().delete(entity); process.log(ProcessLog.success().withNLSKey("BizController.deleteCompleted")); }); }); UserContext.message(Message.info(NLS.get("BizController.deletingInBackground")) .withAction("/ps/" + processId, NLS.get("BizController.deleteProcess"))); } else { entity.getDescriptor().getMapper().delete(entity); showDeletedMessage(); } }); } }

Target:
public void deleteEntity(WebContext ctx, Optional<? extends BaseEntity<?>> optionalEntity) { if (ctx.isSafePOST()) { optionalEntity.ifPresent(entity -> { if (entity.getDescriptor().isComplexDelete() && processes != null) { deleteComplexEntity(entity); } else { entity.getDescriptor().getMapper().delete(entity); showDeletedMessage(); } }); } }
Source:
public ImmutableSet<EventClass> outgoingEvents() { AggregateClass<A> aggregateClass = aggregateClass(); SetView<EventClass> eventClasses = union(aggregateClass.outgoingEvents(), aggregateClass.importableEvents()); return eventClasses.immutableCopy(); }

Target:
public ImmutableSet<EventClass> outgoingEvents() { return aggregateClass().outgoingEvents(); }
Source:
private static String escapeSpecialCharacters(String str) { StringBuilder builder = new StringBuilder(); for (int j = 0; j < str.length(); j++) { char c = str.charAt(j); if (c == '%') { builder.append('%'); } if (contains(c, SPECIAL_CHARS)) { builder.append('^'); } builder.append(c); } return builder.toString(); }

Target:
private static String escapeSpecialCharacters(String str) { StringBuilder builder = new StringBuilder(); for (int j = 0; j < str.length(); j++) { char c = str.charAt(j); if (c == PERCENT_CHAR) { builder.append(PERCENT_CHAR); } if (contains(c, SPECIAL_CHARS)) { builder.append(ESCAPE_CHAR); } builder.append(c); } return builder.toString(); }
Source:
public void testGetProjectedSchema1() throws Exception { MessageType originalMsg = MessageTypeParser.parseMessageType( "message hive_schema {\n" + " optional group structCol {\n" + " optional int32 a;\n" + " optional double b;\n" + " optional boolean c;\n" + " optional fixed_len_byte_array(3) d (DECIMAL(5,2));\n" + " }\n" + "}\n"); testConversion("structCol", "struct<a:int>", DataWritableReadSupport .getProjectedSchema(originalMsg, Arrays.asList("structCol"), Arrays.asList(0), new HashSet<>(Arrays.asList("structCol.a"))).toString()); }

Target:
public void testGetProjectedSchema1() throws Exception { MessageType originalMsg = MessageTypeParser.parseMessageType( "message hive_schema {\n" + " optional group structCol {\n" + " optional int32 a;\n" + " optional double b;\n" + " optional boolean c;\n" + " optional fixed_len_byte_array(3) d (DECIMAL(5,2));\n" + " }\n" + "}\n"); testConversion("structCol", "struct<a:int>", DataWritableReadSupport .getProjectedSchema(originalMsg, Arrays.asList("structCol"), Arrays.asList(0), Sets.newHashSet("structCol.a")).toString()); }
Source:
public CloudBigtableTableConfiguration build() { return new CloudBigtableTableConfiguration(projectId, zoneId, clusterId, tableId, additionalConfigurations); }

Target:
public CloudBigtableTableConfiguration build() { return new CloudBigtableTableConfiguration(projectId, zoneId, clusterId, tableId, additionalConfiguration); }
Source:
public String getMissingRunTypeClass() { if (null != dataFile && dataFile.getMissingRunTypes().size() > 0) { return "show"; } return "hidden"; }

Target:
public String getMissingRunTypeClass() { if (null != dataFile && dataFile.getMissingRunTypes().size() > 0) { return "shown"; } return "hidden"; }
Source:
public List<String> getInvalidityInfo() { return null; }

Target:
public List<String> getInvalidityInfo() { return new ArrayList<String>(); }
Source:
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { try { MediaType mediaType = ContentNegotiationResolver.INSTANCE.getContentType(request, response, supportedMediaTypes); if (MediaType.APPLICATION_JSON.equals(mediaType)) { request.getRequestDispatcher("/me").forward(request, response); } else { request.getSession().setAttribute(FormController.SPRING_SECURITY_AUTHENTICATION_FAILED_KEY, errorModelFactory.toError(request, exception)); this.delegate.onAuthenticationFailure(request, response, exception); } } catch (UnresolvedMediaTypeException ex) { log.error("Couldn't resolve media type: {}", ex.getMessage(), ex); } finally { FailedAuthenticationRequestEvent event = createFailureEvent(request, response, exception); publisher.publish(event); } }

Target:
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { try { MediaType mediaType = ContentNegotiationResolver.INSTANCE.getContentType(request, response, supportedMediaTypes); if (MediaType.APPLICATION_JSON.equals(mediaType)) { request.getRequestDispatcher(meUri).forward(request, response); } else { request.getSession().setAttribute(FormController.SPRING_SECURITY_AUTHENTICATION_FAILED_KEY, errorModelFactory.toError(request, exception)); this.delegate.onAuthenticationFailure(request, response, exception); } } catch (UnresolvedMediaTypeException ex) { log.error("Couldn't resolve media type: {}", ex.getMessage(), ex); } finally { FailedAuthenticationRequestEvent event = createFailureEvent(request, response, exception); publisher.publish(event); } }
Source:
public static void main(String[] args) throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { ServerBootstrap b = new ServerBootstrap(); b.option(ChannelOption.SO_BACKLOG, 1024); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new HttpNativeServerInitializer()); b.bind(PORT).sync().channel(); System.err.println("Server started, will shutdown now."); System.exit(0); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }

Target:
public static void main(String[] args) throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(); boolean serverStartSucess = false; try { ServerBootstrap b = new ServerBootstrap(); b.option(ChannelOption.SO_BACKLOG, 1024); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new HttpNativeServerInitializer()); Channel channel = b.bind(0).sync().channel(); System.err.println("Server started, will shutdown now."); channel.close().sync(); serverStartSucess = true; } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } System.exit(serverStartSucess ? 0 : 1); }
Source:
ColorBuffer getOutputString(Rows rows, Rows.Row row, String delim) { ColorBuffer buf = beeLine.getColorBuffer(); for (int i = 0; i < row.values.length; i++) { if (buf.getVisibleLength() > 0) { buf.green(delim); } if (row.values[i] == null) { continue; } ColorBuffer v; if (row.isMeta) { v = beeLine.getColorBuffer().center(row.values[i], row.sizes[i]); if (rows.isPrimaryKey(i)) { buf.cyan(v.getMono()); } else { buf.bold(v.getMono()); } } else { v = beeLine.getColorBuffer().pad(row.values[i], row.sizes[i]); if (rows.isPrimaryKey(i)) { buf.cyan(v.getMono()); } else { buf.append(v.getMono()); } } } if (row.deleted) { buf = beeLine.getColorBuffer().red(buf.getMono()); } else if (row.updated) { buf = beeLine.getColorBuffer().blue(buf.getMono()); } else if (row.inserted) { buf = beeLine.getColorBuffer().green(buf.getMono()); } return buf; }

Target:
ColorBuffer getOutputString(Rows rows, Rows.Row row, String delim) { ColorBuffer buf = beeLine.getColorBuffer(); for (int i = 0; i < row.values.length; i++) { if (buf.getVisibleLength() > 0) { buf.green(delim); } ColorBuffer v; if (row.isMeta) { v = beeLine.getColorBuffer().center(row.values[i], row.sizes[i]); if (rows.isPrimaryKey(i)) { buf.cyan(v.getMono()); } else { buf.bold(v.getMono()); } } else { v = beeLine.getColorBuffer().pad(row.values[i], row.sizes[i]); if (rows.isPrimaryKey(i)) { buf.cyan(v.getMono()); } else { buf.append(v.getMono()); } } } if (row.deleted) { buf = beeLine.getColorBuffer().red(buf.getMono()); } else if (row.updated) { buf = beeLine.getColorBuffer().blue(buf.getMono()); } else if (row.inserted) { buf = beeLine.getColorBuffer().green(buf.getMono()); } return buf; }
Source:
protected void addInTarget(AttributeChange diff, boolean rightToLeft) { final Match match = diff.getMatch(); final EObject expectedContainer; if (rightToLeft) { expectedContainer = match.getLeft(); } else { expectedContainer = match.getRight(); } if (expectedContainer == null) { } else { final Comparison comparison = match.getComparison(); final EStructuralFeature attribute = diff.getAttribute(); final Object expectedValue = diff.getValue(); if (attribute.isMany()) { final int insertionIndex = findInsertionIndex(comparison, diff, rightToLeft); final List<Object> targetList = (List<Object>)safeEGet(expectedContainer, attribute); addAt(targetList, expectedValue, insertionIndex); } else { safeESet(expectedContainer, attribute, expectedValue); } } }

Target:
protected void addInTarget(AttributeChange diff, boolean rightToLeft) { final Match match = diff.getMatch(); final EObject expectedContainer; if (rightToLeft) { expectedContainer = match.getLeft(); } else { expectedContainer = match.getRight(); } if (expectedContainer == null) { } else { final Comparison comparison = match.getComparison(); final EStructuralFeature attribute = diff.getAttribute(); final Object expectedValue = diff.getValue(); if (attribute.isMany()) { final int insertionIndex = findInsertionIndex(comparison, diff, rightToLeft); final List<Object> targetList = (List<Object>)expectedContainer.eGet(attribute); addAt(targetList, expectedValue, insertionIndex); } else { expectedContainer.eSet(attribute, expectedValue); } } }
Source:
public void testStartOvertime_default() { ClockModel pc = sbm.getClockModel(Clock.ID_PERIOD); ClockModel jc = sbm.getClockModel(Clock.ID_JAM); ClockModel lc = sbm.getClockModel(Clock.ID_LINEUP); ClockModel tc = sbm.getClockModel(Clock.ID_TIMEOUT); ClockModel ic = sbm.getClockModel(Clock.ID_INTERMISSION); ((DefaultSettingsModel) sbm.getSettings()).set("Clock." + Clock.ID_LINEUP + ".OvertimeTime", "60000"); assertFalse(pc.isRunning()); pc.setTime(0); assertTrue(pc.isTimeAtEnd()); pc.setNumber(pc.getMaximumNumber()); assertFalse(jc.isRunning()); jc.setTime(0); assertTrue(jc.isTimeAtEnd()); assertFalse(lc.isRunning()); lc.setMaximumTime(30000); assertFalse(tc.isRunning()); ic.start(); sbm.startOvertime(); advance(0); assertTrue(sbm.isInOvertime()); assertFalse(pc.isRunning()); assertFalse(jc.isRunning()); assertTrue(lc.isRunning()); assertEquals(60000, lc.getMaximumTime()); assertFalse(tc.isRunning()); assertFalse(ic.isRunning()); }

Target:
public void testStartOvertime_default() { (sbm.getSettingsModel()).set("Clock." + Clock.ID_LINEUP + ".OvertimeTime", "60000"); assertFalse(pc.isRunning()); pc.setTime(0); assertTrue(pc.isTimeAtEnd()); pc.setNumber(pc.getMaximumNumber()); assertFalse(jc.isRunning()); jc.setTime(0); assertTrue(jc.isTimeAtEnd()); assertFalse(lc.isRunning()); lc.setMaximumTime(30000); assertFalse(tc.isRunning()); ic.start(); sbm.startOvertime(); advance(0); assertTrue(sbm.isInOvertime()); assertFalse(pc.isRunning()); assertFalse(jc.isRunning()); assertTrue(lc.isRunning()); assertEquals(60000, lc.getMaximumTime()); assertFalse(tc.isRunning()); assertFalse(ic.isRunning()); }
Source:
private static void setUpPingForChannel(final Channel channel, int timeoutSeconds, int intervalSeconds) { final AtomicBoolean isInClosed = new AtomicBoolean(false); final PingThread t = new PingThread(channel, timeoutSeconds * 1000L, intervalSeconds * 1000L) { protected void onDead(Throwable cause) { try { for (PingFailureAnalyzer pfa : PingFailureAnalyzer.all()) { pfa.onPingFailure(channel,cause); } if (isInClosed.get()) { LOGGER.log(FINE,"Ping failed after the channel "+channel.getName()+" is already partially closed.",cause); } else { LOGGER.log(INFO,"Ping failed. Terminating the channel "+channel.getName()+".",cause); channel.close(cause); } } catch (IOException e) { LOGGER.log(SEVERE,"Failed to terminate the channel "+channel.getName(),e); } } protected void onDead() { onDead(null); } }; channel.addListener(new Channel.Listener() { @Override public void onClosed(Channel channel, IOException cause) { LOGGER.fine("Terminating ping thread for " + channel.getName()); isInClosed.set(true); t.interrupt(); } }); t.start(); LOGGER.fine("Ping thread started for " + channel + " with a " + intervalSeconds + " second interval and a " + timeoutSeconds + " second timeout."); }

Target:
static void setUpPingForChannel(final Channel channel, int timeoutSeconds, int intervalSeconds) { final AtomicBoolean isInClosed = new AtomicBoolean(false); final PingThread t = new PingThread(channel, timeoutSeconds * 1000L, intervalSeconds * 1000L) { protected void onDead(Throwable cause) { try { for (PingFailureAnalyzer pfa : PingFailureAnalyzer.all()) { pfa.onPingFailure(channel,cause); } if (isInClosed.get()) { LOGGER.log(Level.FINE,"Ping failed after the channel "+channel.getName()+" is already partially closed.",cause); } else { LOGGER.log(Level.INFO,"Ping failed. Terminating the channel "+channel.getName()+".",cause); channel.close(cause); } } catch (IOException e) { LOGGER.log(Level.SEVERE,"Failed to terminate the channel "+channel.getName(),e); } } protected void onDead() { onDead(null); } }; channel.addListener(new Channel.Listener() { @Override public void onClosed(Channel channel, IOException cause) { LOGGER.fine("Terminating ping thread for " + channel.getName()); isInClosed.set(true); t.interrupt(); } }); t.start(); LOGGER.log(Level.FINE, "Ping thread started for {0} with a {1} second interval and a {2} second timeout.", new Object[] { channel, intervalSeconds, timeoutSeconds }); }
Source:
public BaseSRXControlledSubsystem( String systemName, int masterChannel, boolean invertMaster, boolean invertMasterSensor, WPIFactory factory, PIDPropertyManager pidPropertyManager, XPropertyManager propManager){ log.info("Creating " + systemName + " system"); this.pidPropertyManager = pidPropertyManager; this.systemName = systemName; this.masterChannel = masterChannel; systemSpeedThresh = propManager.createPersistentProperty(systemName + " nominal speed thresh (TPC)", 1); systemCurrentSpeed = propManager.createEphemeralProperty(systemName + " current speed (TPC)", 0); systemTargetSpeed = propManager.createEphemeralProperty(systemName + " goal speed (TPC)", 0); systemOutputPower = propManager.createEphemeralProperty(systemName + " voltage", 0); atSpeedProp = propManager.createEphemeralProperty("Is" + systemName + " at speed?", false); systemTalonError = propManager.createEphemeralProperty(systemName + " speed error", 0); enablesystemLogging = propManager.createEphemeralProperty("Is " + systemName + " logging enabled?", false); masterMotor = factory.getCANTalonSpeedController(masterChannel); initializeMotorConfiguration(invertMaster, invertMasterSensor); masterMotor.createTelemetryProperties(systemName + " master", propManager); }

Target:
public BaseSRXControlledSubsystem( String systemName, int masterChannel, boolean invertMaster, boolean invertMasterSensor, WPIFactory factory, PIDPropertyManager pidPropertyManager, XPropertyManager propManager){ super(systemName); log.info("Creating " + systemName + " system"); this.pidPropertyManager = pidPropertyManager; this.systemName = systemName; this.masterChannel = masterChannel; systemSpeedThresh = propManager.createPersistentProperty(systemName + " nominal speed thresh (TPC)", 1); systemCurrentSpeed = propManager.createEphemeralProperty(systemName + " current speed (TPC)", 0); systemTargetSpeed = propManager.createEphemeralProperty(systemName + " goal speed (TPC)", 0); systemOutputPower = propManager.createEphemeralProperty(systemName + " voltage", 0); atSpeedProp = propManager.createEphemeralProperty("Is" + systemName + " at speed?", false); systemTalonError = propManager.createEphemeralProperty(systemName + " speed error", 0); enablesystemLogging = propManager.createEphemeralProperty("Is " + systemName + " logging enabled?", false); masterMotor = factory.getCANTalonSpeedController(masterChannel); initializeMasterMotorConfiguration(invertMaster, invertMasterSensor); masterMotor.createTelemetryProperties(systemName + " master", propManager); }
Source:
private String getAdditionalXmsHeaders(Map<String, String> headers) { final List<String> xmsHeaderNameArray = headers.entrySet().stream() .filter(entry -> entry.getKey().toLowerCase(Locale.ROOT).startsWith("x-ms-")) .filter(entry -> entry.getValue() != null) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (xmsHeaderNameArray.isEmpty()) { return ""; } Collections.sort(xmsHeaderNameArray, Collator.getInstance()); final StringBuilder canonicalizedHeaders = new StringBuilder(); for (final String key : xmsHeaderNameArray) { if (canonicalizedHeaders.length() > 0) { canonicalizedHeaders.append('\n'); } canonicalizedHeaders.append(key.toLowerCase(Locale.ROOT)) .append(':') .append(headers.get(key)); } return canonicalizedHeaders.toString(); }

Target:
private String getAdditionalXmsHeaders(Map<String, String> headers) { final List<String> xmsHeaderNameArray = headers.entrySet().stream() .filter(entry -> entry.getKey().toLowerCase(Locale.ROOT).startsWith("x-ms-")) .filter(entry -> entry.getValue() != null) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (xmsHeaderNameArray.isEmpty()) { return ""; } Collections.sort(xmsHeaderNameArray, Collator.getInstance(Locale.ROOT)); final StringBuilder canonicalizedHeaders = new StringBuilder(); for (final String key : xmsHeaderNameArray) { if (canonicalizedHeaders.length() > 0) { canonicalizedHeaders.append('\n'); } canonicalizedHeaders.append(key.toLowerCase(Locale.ROOT)) .append(':') .append(headers.get(key)); } return canonicalizedHeaders.toString(); }
Source:
public MantaClient(final ConfigContext config, final MantaConnectionFactoryConfigurator connectionFactoryConfigurator) { dumpConfig(config); ConfigContext.validate(config); this.url = config.getMantaURL(); this.config = config; this.home = ConfigContext.deriveHomeDirectoryFromUser(config.getMantaUser()); this.beanSupervisor = new MantaMBeanSupervisor(); final KeyPair keyPair = new KeyPairFactory(config).createKeyPair(); final Signer.Builder builder = new Signer.Builder(keyPair); if (BooleanUtils.isTrue(config.disableNativeSignatures())) { builder.providerCode("stdlib"); } final ThreadLocalSigner signer = new ThreadLocalSigner(builder); this.signerRef = new WeakReference<>(signer); final MantaConnectionFactory connectionFactory = new MantaConnectionFactory( config, keyPair, signer, connectionFactoryConfigurator); final MantaApacheHttpClientContext connectionContext = new MantaApacheHttpClientContext(connectionFactory); if (BooleanUtils.isTrue(config.isClientEncryptionEnabled())) { this.httpHelper = new EncryptionHttpHelper(connectionContext, config); } else { this.httpHelper = new StandardHttpHelper(connectionContext, config); } this.uriSigner = new UriSigner(this.config, keyPair, signer); this.beanSupervisor = new MantaMBeanSupervisor(); beanSupervisor.expose(this.config); beanSupervisor.expose(connectionFactory); this.findForkJoinPool = FindForkJoinPoolFactory.getInstance(config); }

Target:
public MantaClient(final ConfigContext config, final MantaConnectionFactoryConfigurator connectionFactoryConfigurator) { dumpConfig(config); ConfigContext.validate(config); this.url = config.getMantaURL(); this.config = config; this.home = ConfigContext.deriveHomeDirectoryFromUser(config.getMantaUser()); final KeyPair keyPair = new KeyPairFactory(config).createKeyPair(); final Signer.Builder builder = new Signer.Builder(keyPair); if (BooleanUtils.isTrue(config.disableNativeSignatures())) { builder.providerCode("stdlib"); } final ThreadLocalSigner signer = new ThreadLocalSigner(builder); this.signerRef = new WeakReference<>(signer); final MantaConnectionFactory connectionFactory = new MantaConnectionFactory( config, keyPair, signer, connectionFactoryConfigurator); final MantaApacheHttpClientContext connectionContext = new MantaApacheHttpClientContext(connectionFactory); if (BooleanUtils.isTrue(config.isClientEncryptionEnabled())) { this.httpHelper = new EncryptionHttpHelper(connectionContext, config); } else { this.httpHelper = new StandardHttpHelper(connectionContext, config); } this.uriSigner = new UriSigner(this.config, keyPair, signer); this.beanSupervisor = new MantaMBeanSupervisor(); beanSupervisor.expose(this.config); beanSupervisor.expose(connectionFactory); this.findForkJoinPool = FindForkJoinPoolFactory.getInstance(config); }
Source:
public Map<IProject, IProject[]> getDanglingReferences() { IProject[] projects = getRoot().getProjects(IContainer.INCLUDE_HIDDEN); Map<IProject, IProject[]> result = new HashMap<>(projects.length); for (IProject project : projects) { if (!project.isAccessible()) continue; IProject[] refs = ((Project)project).internalGetDescription().getReferencedProjects(false); List<IProject> dangling = new ArrayList<>(refs.length); for (IProject ref : refs) if (!ref.exists()) dangling.add(ref); if (!dangling.isEmpty()) result.put(project, dangling.toArray(new IProject[dangling.size()])); } return result; }

Target:
public Map<IProject, IProject[]> getDanglingReferences() { IProject[] projects = getRoot().getProjects(IContainer.INCLUDE_HIDDEN); Map<IProject, IProject[]> result = new HashMap<>(projects.length); for (IProject project : projects) { if (!project.isAccessible()) { continue; } IProject[] refs = ((Project)project).internalGetDescription().getReferencedProjects(false); List<IProject> dangling = new ArrayList<>(refs.length); for (IProject ref : refs) { if (!ref.exists()) { dangling.add(ref); } } if (!dangling.isEmpty()) { result.put(project, dangling.toArray(new IProject[dangling.size()])); } } return result; }
Source:
public PackFile(final File packFile, Iterable<PackExt> extensions) { this.packFile = packFile; this.packLastModified = (int) (packFile.lastModified() >> 10); this.extensions = new ArrayList<PackExt>(PackExt.values().length); for (PackExt ext : extensions) { this.extensions.add(ext); } hash = System.identityHashCode(this) * 31; length = Long.MAX_VALUE; }

Target:
public PackFile(final File packFile, Iterable<PackExt> extensions) { this.packFile = packFile; this.packLastModified = (int) (packFile.lastModified() >> 10); int bits = 0; for (PackExt ext : extensions) bits |= 1 << ext.getPosition(); this.extensions = bits; hash = System.identityHashCode(this) * 31; length = Long.MAX_VALUE; }
Source:
private void handleAccessToken(List<String> commandLineArgs, TaskExecutionInformation taskExecutionInformation) { boolean containsAccessToken = false; boolean useUserAccessToken = false; final String dataflowServerAccessTokenKey = "dataflow-server-access-token"; final String dataflowServerUseUserAccessToken = "dataflow-server-use-user-access-token"; for (String commandLineArg : commandLineArgs) { if (commandLineArg.startsWith("--" + dataflowServerAccessTokenKey)) { containsAccessToken = true; } if (StringUtils.trimAllWhitespace(commandLineArg).equalsIgnoreCase("--" + dataflowServerUseUserAccessToken + "=true")) { useUserAccessToken = true; } } final String dataflowAccessTokenPropertyKey = "app." + taskExecutionInformation.getTaskDefinition().getRegisteredAppName() + "." + dataflowServerAccessTokenKey; for (Map.Entry<String, String> taskDeploymentProperty : taskExecutionInformation.getTaskDeploymentProperties().entrySet()) { if (taskDeploymentProperty.getKey().equals(dataflowAccessTokenPropertyKey)) { containsAccessToken = true; } } if(isUseUserAccessToken()) { useUserAccessToken = true; } if (!containsAccessToken && useUserAccessToken && oauth2TokenUtilsService != null) { final String token = oauth2TokenUtilsService.getAccessTokenOfAuthenticatedUser(); if (token != null) { taskExecutionInformation.getTaskDeploymentProperties().put(dataflowAccessTokenPropertyKey, token); } } }

Target:
private void handleAccessToken(List<String> commandLineArgs, TaskExecutionInformation taskExecutionInformation) { boolean containsAccessToken = false; boolean useUserAccessToken = false; final String dataflowServerAccessTokenKey = "dataflow-server-access-token"; final String dataflowServerUseUserAccessToken = "dataflow-server-use-user-access-token"; for (String commandLineArg : commandLineArgs) { if (commandLineArg.startsWith("--" + dataflowServerAccessTokenKey)) { containsAccessToken = true; } if (StringUtils.trimAllWhitespace(commandLineArg).equalsIgnoreCase("--" + dataflowServerUseUserAccessToken + "=true")) { useUserAccessToken = true; } } final String dataflowAccessTokenPropertyKey = "app." + taskExecutionInformation.getTaskDefinition().getRegisteredAppName() + "." + dataflowServerAccessTokenKey; for (Map.Entry<String, String> taskDeploymentProperty : taskExecutionInformation.getTaskDeploymentProperties().entrySet()) { if (taskDeploymentProperty.getKey().equals(dataflowAccessTokenPropertyKey)) { containsAccessToken = true; } } if(TaskServiceUtils.isUseUserAccessToken(this.taskConfigurationProperties, this.composedTaskRunnerConfigurationProperties)) { useUserAccessToken = true; } if (!containsAccessToken && useUserAccessToken && oauth2TokenUtilsService != null) { final String token = oauth2TokenUtilsService.getAccessTokenOfAuthenticatedUser(); if (token != null) { taskExecutionInformation.getTaskDeploymentProperties().put(dataflowAccessTokenPropertyKey, token); } } }
Source:
public GeofenceCircle(String wkt) throws ParseException { super(); fromWKT(wkt); }

Target:
public GeofenceCircle(String wkt) throws ParseException { fromWkt(wkt); }
Source:
public static Set<String> getRequiredFields(Query query) { Set<String> dimensions = new HashSet<>(); Set<String> dimsInFilter = getDimensionsInFilter(query.getFilter()); if (dimsInFilter != null) { dimensions.addAll(dimsInFilter); } if (query instanceof TopNQuery) { TopNQuery q = (TopNQuery) query; dimensions.addAll(extractFieldsFromAggregations(q.getAggregatorSpecs())); dimensions.add(q.getDimensionSpec().getDimension()); } else if (query instanceof TimeseriesQuery) { TimeseriesQuery q = (TimeseriesQuery) query; dimensions.addAll(extractFieldsFromAggregations(q.getAggregatorSpecs())); } else if (query instanceof GroupByQuery) { GroupByQuery q = (GroupByQuery) query; dimensions.addAll(extractFieldsFromAggregations(q.getAggregatorSpecs())); for (DimensionSpec spec : q.getDimensions()) { String dim = spec.getDimension(); dimensions.add(dim); } } return dimensions; }

Target:
public static Set<String> getRequiredFields(Query query) { Set<String> dimensions = new HashSet<>(); Set<String> dimsInFilter = getDimensionsInFilter(query.getFilter()); if (dimsInFilter != null) { dimensions.addAll(dimsInFilter); } if (query instanceof TopNQuery) { TopNQuery q = (TopNQuery) query; dimensions.addAll(extractFieldsFromAggregations(q.getAggregatorSpecs())); dimensions.add(q.getDimensionSpec().getDimension()); } else if (query instanceof TimeseriesQuery) { TimeseriesQuery q = (TimeseriesQuery) query; dimensions.addAll(extractFieldsFromAggregations(q.getAggregatorSpecs())); } else if (query instanceof GroupByQuery) { GroupByQuery q = (GroupByQuery) query; dimensions.addAll(extractFieldsFromAggregations(q.getAggregatorSpecs())); for (DimensionSpec spec : q.getDimensions()) { String dim = spec.getDimension(); dimensions.add(dim); } } else { throw new UnsupportedOperationException("Method getRequeiredFields only support TopNQuery/TimeseriesQuery/GroupByQuery"); } return dimensions; }
Source:
private static String serializePropertyValue(PropertyInterface property, com.xpn.xwiki.objects.classes.PropertyClass propertyClass, XWikiContext context) { if (propertyClass instanceof ComputedFieldClass) { XWikiDocument document = context.getDoc(); try { context.setDoc(property.getObject().getOwnerDocument()); ComputedFieldClass computedFieldClass = (ComputedFieldClass) propertyClass; return computedFieldClass.getComputedValue(propertyClass.getName(), "", property.getObject(), context); } finally { context.setDoc(document); } } else { return serializePropertyValue(property); } }

Target:
private String serializePropertyValue(PropertyInterface property, com.xpn.xwiki.objects.classes.PropertyClass propertyClass, XWikiContext context) { if (propertyClass instanceof ComputedFieldClass) { XWikiDocument document = context.getDoc(); try { context.setDoc(property.getObject().getOwnerDocument()); ComputedFieldClass computedFieldClass = (ComputedFieldClass) propertyClass; return computedFieldClass.getComputedValue(propertyClass.getName(), "", property.getObject(), context); } catch (Exception e) { logger.error("Error while computing property value of [{}]", propertyClass.getName(), property.getObject(), e); return serializePropertyValue(property); } finally { context.setDoc(document); } } else { return serializePropertyValue(property); } }
Source:
public WorkspaceConfigImpl createWorkspaceConfig( Devfile devfile, RecipeFileContentProvider recipeFileContentProvider) throws DevfileFormatException, DevfileRecipeFormatException { integrityValidator.validateDevfile(devfile); return devfileConverter.devFileToWorkspaceConfig(devfile, recipeFileContentProvider); }

Target:
public WorkspaceConfigImpl createWorkspaceConfig( Devfile devfile, RecipeFileContentProvider recipeFileContentProvider) throws DevfileFormatException, DevfileRecipeFormatException, DevfileException { integrityValidator.validateDevfile(devfile); return devfileConverter.devFileToWorkspaceConfig(devfile, recipeFileContentProvider); }
Source:
public void onChildMoved(DataSnapshot snapshot, String previousChildKey) { int oldIndex = getIndexForKey(snapshot.getKey()); mSnapshots.remove(oldIndex); int newIndex = previousChildKey == null ? 0 : (getIndexForKey(previousChildKey) + 1); mSnapshots.add(newIndex, snapshot); mSnapshotMap.put(snapshot.getKey(), newIndex); notifyChangedListeners(OnChangedListener.EventType.MOVED, newIndex, oldIndex); }

Target:
public void onChildMoved(DataSnapshot snapshot, String previousChildKey) { int oldIndex = getIndexForKey(snapshot.getKey()); mSnapshots.remove(oldIndex); int newIndex = previousChildKey == null ? 0 : (scanArrayForKey(previousChildKey) + 1); mSnapshots.add(newIndex, snapshot); mSnapshotMap.clear(); for (int i = 0; i < mSnapshots.size(); i++) { mSnapshotMap.put(mSnapshots.get(i).getKey(), i); } notifyChangedListeners(OnChangedListener.EventType.MOVED, newIndex, oldIndex); }