auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void addColumnSortHandler(ExtendedPagedTable listTable){ listTable.addColumnSortHandler(new ColumnSortEvent.Handler() { @Override public void onColumnSort(ColumnSortEvent event) { GridPreferencesStore gridPreferencesStore = listTable.getGridPreferencesStore(); if (gridPreferencesStore != null && event.getColumnSortList().size() > 0) { ColumnSortList.ColumnSortInfo columnSortInfo = event.getColumnSortList().get(0); if (columnSortInfo != null) { GridSortedColumnPreference gridSortedColumnPreference = new GridSortedColumnPreference(columnSortInfo.getColumn().getDataStoreName(), columnSortInfo.isAscending()); gridPreferencesStore.setGridSortedColumnPreference(gridSortedColumnPreference); } } listTable.saveGridPreferences(); } }); }

Target:
protected void addColumnSortHandler(ExtendedPagedTable listTable) { listTable.addColumnSortHandler(event -> { GridPreferencesStore gridPreferencesStore = listTable.getGridPreferencesStore(); if (gridPreferencesStore != null && event.getColumnSortList().size() > 0) { ColumnSortList.ColumnSortInfo columnSortInfo = event.getColumnSortList().get(0); if (columnSortInfo != null) { GridSortedColumnPreference gridSortedColumnPreference = new GridSortedColumnPreference(columnSortInfo.getColumn().getDataStoreName(), columnSortInfo.isAscending()); gridPreferencesStore.setGridSortedColumnPreference(gridSortedColumnPreference); } } listTable.saveGridPreferences(); }); }
Source:
public Workflow publish(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Workflow id to publish/unpublish", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "PublishRequest to refresh the list of repos for a user", required = true) PublishRequest request) { Workflow c = workflowDAO.findById(workflowId); checkEntry(c); checkCanShareWorkflow(user, c); Workflow checker = c.getCheckerWorkflow(); if (request.getPublish()) { boolean validTag = c.getVersions().stream().anyMatch((v) -> v.isValid()); if (validTag && (!c.getGitUrl().isEmpty() || Objects.equals(c.getMode(), WorkflowMode.HOSTED))) { c.setIsPublished(true); if (checker != null) { checker.setIsPublished(true); elasticManager.handleIndexUpdate(checker, ElasticMode.UPDATE); } } else { throw new CustomWebApplicationException("Repository does not meet requirements to publish.", HttpStatus.SC_BAD_REQUEST); } } else { c.setIsPublished(false); if (checker != null) { checker.setIsPublished(false); elasticManager.handleIndexUpdate(checker, ElasticMode.DELETE); } } long id = workflowDAO.create(c); c = workflowDAO.findById(id); if (request.getPublish()) { elasticManager.handleIndexUpdate(c, ElasticMode.UPDATE); } else { elasticManager.handleIndexUpdate(c, ElasticMode.DELETE); } return c; }

Target:
public Workflow publish(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Workflow id to publish/unpublish", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "PublishRequest to refresh the list of repos for a user", required = true) PublishRequest request) { Workflow c = workflowDAO.findById(workflowId); checkEntry(c); checkCanShareWorkflow(user, c); Workflow checker = c.getCheckerWorkflow(); if (request.getPublish()) { boolean validTag = false; Set<WorkflowVersion> versions = c.getVersions(); for (WorkflowVersion workflowVersion : versions) { if (workflowVersion.isValid()) { validTag = true; break; } } if (validTag && (!c.getGitUrl().isEmpty() || Objects.equals(c.getMode(), WorkflowMode.HOSTED))) { c.setIsPublished(true); if (checker != null) { checker.setIsPublished(true); } } else { throw new CustomWebApplicationException("Repository does not meet requirements to publish.", HttpStatus.SC_BAD_REQUEST); } } else { c.setIsPublished(false); if (checker != null) { checker.setIsPublished(false); } } long id = workflowDAO.create(c); c = workflowDAO.findById(id); if (request.getPublish()) { elasticManager.handleIndexUpdate(c, ElasticMode.UPDATE); } else { elasticManager.handleIndexUpdate(c, ElasticMode.DELETE); } return c; }
Source:
private void handleDatastreamAddOrDelete() { leaderDoAssignmentScheduled.set(false); List<Datastream> newDatastreams = _datastreamCache.getAllDatastreams(true); if (newDatastreams.isEmpty()) { _log.warn("Received a new datastream event, but there were no datastreams"); return; } try { for (Datastream ds : newDatastreams) { if (ds.getStatus() != DatastreamStatus.READY) { _destinationManager.createTopic(ds); ds.setStatus(DatastreamStatus.READY); if (!_adapter.updateDatastream(ds)) { _log.error(String.format("Failed to update datastream: %s after initializing, " + "This datastream will not be scheduled for producing events ", ds.getName())); throw new DatastreamException("Failed to update datastream destination for datastream" + ds.getName()); } } } _eventQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent()); } catch (Exception e) { _log.error("Failed to update the destination of new datastreams.", e); _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleDatastreamAddOrDelete", NUM_RETRIES, 1); if (leaderDoAssignmentScheduled.compareAndSet(false, true)) { _log.warn("Schedule retry for handling new datastream"); _executor.schedule(() -> _eventQueue.put(CoordinatorEvent.createHandleDatastreamAddOrDeleteEvent()), _config.getRetryIntervalMS(), TimeUnit.MILLISECONDS); } } }

Target:
private void handleDatastreamAddOrDelete() { boolean shouldRetry = false; leaderDatastreamAddOrDeleteEventScheduled.set(false); List<Datastream> newDatastreams = _datastreamCache.getAllDatastreams(true); if (newDatastreams.isEmpty()) { _log.warn("Received a new datastream event, but there were no datastreams"); return; } for (Datastream ds : newDatastreams) { if (ds.getStatus() != DatastreamStatus.READY) { try { _destinationManager.createTopic(ds); ds.setStatus(DatastreamStatus.READY); if (!_adapter.updateDatastream(ds)) { _log.warn(String.format("Failed to update datastream: %s after initializing, " + "This datastream will not be scheduled for producing events ", ds.getName())); shouldRetry = true; } } catch (Exception e) { _log.warn("Failed to update the destination of new datastream %s " + ds, e); shouldRetry = true; } } } if (shouldRetry) { _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleDatastreamAddOrDelete", NUM_RETRIES, 1); if (leaderDatastreamAddOrDeleteEventScheduled.compareAndSet(false, true)) { _log.warn("Schedule retry for handling new datastream"); _executor.schedule(() -> _eventQueue.put(CoordinatorEvent.createHandleDatastreamAddOrDeleteEvent()), _config.getRetryIntervalMS(), TimeUnit.MILLISECONDS); } } _eventQueue.put(CoordinatorEvent.createLeaderDoAssignmentEvent()); }
Source:
public int hashCode() { return mShouldRun ? 17 : 42; }

Target:
public int hashCode() { int result = (mShouldRun ? 1 : 0); result = 31 * result + mBlockReasons.hashCode(); return result; }
Source:
public static String getFormattedSql(Statement statement, SqlParser sqlParser, Optional<List<Expression>> parameters) { String sql = SqlFormatter.formatSql(statement, parameters); Statement parsed; try { ParsingOptions parsingOptions = new ParsingOptions(UNDEFINED ); parsed = sqlParser.createStatement(sql, parsingOptions); } catch (ParsingException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Formatted query does not parse: " + statement); } if (!statement.equals(parsed)) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Query does not round-trip: " + statement); } return sql; }

Target:
public static String getFormattedSql(Statement statement, SqlParser sqlParser, Optional<List<Expression>> parameters) { String sql = SqlFormatter.formatSql(statement, parameters); Statement parsed; try { ParsingOptions parsingOptions = new ParsingOptions(REJECT ); parsed = sqlParser.createStatement(sql, parsingOptions); } catch (ParsingException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Formatted query does not parse: " + statement); } if (!statement.equals(parsed)) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Query does not round-trip: " + statement); } return sql; }
Source:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting...", taskId); trainer.initialize(); synchronizer.globalBarrier(); workerClock.initialize(); final int initialClock = workerClock.getWorkerClock(); for (int iteration = initialClock; iteration < maxIterations; ++iteration) { if (aborted) { LOG.log(Level.INFO, "Abort a thread to completely close the task"); workerClock.recordClockNetworkWaitingTime(); return null; } trainingDataProvider.prepareDataForEpoch(); trainer.run(iteration); workerClock.clock(); } synchronizer.globalBarrier(); trainer.cleanup(); workerClock.recordClockNetworkWaitingTime(); return null; }

Target:
public byte[] call(final byte[] memento) throws Exception { LOG.log(Level.INFO, "{0} starting...", taskId); trainer.initialize(); synchronizer.globalBarrier(); workerClock.initialize(); final int initialClock = workerClock.getWorkerClock(); for (int iteration = initialClock; iteration < maxIterations; ++iteration) { if (aborted) { LOG.log(Level.INFO, "Abort a thread to completely close the task"); workerClock.recordClockNetworkWaitingTime(); return null; } trainingDataProvider.prepareDataForEpoch(); LOG.log(Level.INFO, "Starting iteration {0}", iteration); trainer.run(iteration); workerClock.clock(); } synchronizer.globalBarrier(); trainer.cleanup(); workerClock.recordClockNetworkWaitingTime(); return null; }
Source:
private void writeBamOutput(AssemblyResultSet assemblyResult, ReadLikelihoods<Haplotype> readLikelihoods, HaplotypeCallerGenotypingEngine.CalledHaplotypes calledHaplotypes) { if ( MTAC.bamOutputPath != null ) { final Set<Haplotype> calledHaplotypeSet = new HashSet<>(calledHaplotypes.getCalledHaplotypes()); if (MTAC.disableOptimizations) calledHaplotypeSet.add(assemblyResult.getReferenceHaplotype()); haplotypeBAMWriter.writeReadsAlignedToHaplotypes( assemblyResult.getHaplotypeList(), assemblyResult.getPaddedReferenceLoc(), assemblyResult.getHaplotypeList(), calledHaplotypeSet, readLikelihoods); } }

Target:
private void writeBamOutput(AssemblyResultSet assemblyResult, ReadLikelihoods<Haplotype> readLikelihoods, HaplotypeCallerGenotypingEngine.CalledHaplotypes calledHaplotypes) { if ( haplotypeBAMWriter.isPresent() ) { final Set<Haplotype> calledHaplotypeSet = new HashSet<>(calledHaplotypes.getCalledHaplotypes()); if (MTAC.disableOptimizations) { calledHaplotypeSet.add(assemblyResult.getReferenceHaplotype()); } haplotypeBAMWriter.get().writeReadsAlignedToHaplotypes( assemblyResult.getHaplotypeList(), assemblyResult.getPaddedReferenceLoc(), assemblyResult.getHaplotypeList(), calledHaplotypeSet, readLikelihoods); } }
Source:
public void setTrace(final ITmfTrace trace, final boolean disposeOnClose) { if ((fTrace != null) && fDisposeOnClose) { fTrace.dispose(); } fTrace = trace; fPackDone = false; fSelectedRank = 0; fDisposeOnClose = disposeOnClose; fTable.getDisplay().syncExec(new Runnable() { @Override public void run() { fTable.removeAll(); fCache.setTrace(fTrace); if (fTrace != null) { if (!fTable.isDisposed()) { if (fTable.getData(Key.FILTER_OBJ) == null) { fTable.setItemCount((int) fTrace.getNbEvents() + 1); } else { stopFilterThread(); fFilterMatchCount = 0; fFilterCheckCount = 0; fTable.setItemCount(3); startFilterThread(); } } } fRawViewer.setTrace(fTrace); } }); }

Target:
public void setTrace(final ITmfTrace trace, final boolean disposeOnClose) { if ((fTrace != null) && fDisposeOnClose) { fTrace.dispose(); } fTrace = trace; fPackDone = false; fSelectedRank = 0; fDisposeOnClose = disposeOnClose; fTable.getDisplay().syncExec(new Runnable() { @Override public void run() { fTable.removeAll(); fCache.setTrace(trace); if (trace != null) { if (!fTable.isDisposed()) { if (fTable.getData(Key.FILTER_OBJ) == null) { fTable.setItemCount((int) trace.getNbEvents() + 1); } else { stopFilterThread(); fFilterMatchCount = 0; fFilterCheckCount = 0; fTable.setItemCount(3); startFilterThread(); } } } fRawViewer.setTrace(trace); } }); }
Source:
public Graph unmarshall(Metadata metadata, InputStream input) throws IOException { MarshallingResponse<Graph> marshallingResponse = unmarshallWithValidation(MarshallingRequest.builder() .metadata(metadata) .input(input) .mode(MarshallingRequest.Mode.ERROR) .build()); return marshallingResponse.getResult().get(); }

Target:
public Graph unmarshall(Metadata metadata, InputStream input) { MarshallingResponse<Graph> marshallingResponse = unmarshallWithValidation(MarshallingRequest.builder() .metadata(metadata) .input(input) .mode(MarshallingRequest.Mode.ERROR) .build()); return marshallingResponse.getResult(); }
Source:
public ObisCodeValuesDto(final byte a, final byte b, final byte c, final byte d, final byte e, final byte f) { super(); this.a = a; this.b = b; this.c = c; this.d = d; this.e = e; this.f = f; }

Target:
public ObisCodeValuesDto(final byte a, final byte b, final byte c, final byte d, final byte e, final byte f) { this.a = a; this.b = b; this.c = c; this.d = d; this.e = e; this.f = f; }
Source:
public SSHActionConfig() { port = 22; outputKey = "sshOutput"; }

Target:
public SSHActionConfig() { this.port = 22; this.outputKey = "sshOutput"; }
Source:
public static void endStep(ExecutionContext context, Step step, boolean exitStatus) { if (context == null) { return; } if (context.isMonitored()) { Job job = context.getJob(); try { if (step != null) { step.markStepEnded(exitStatus); JobRepositoryFactory.getJobRepository().updateStep(step); } if (context.getExecutionMethod() == ExecutionMethod.AsJob && job != null && !exitStatus) { context.setCompleted(true); job.markJobEnded(false); JobRepositoryFactory.getJobRepository() .updateCompletedJobAndSteps(job); } else { Step parentStep = context.getStep(); if (context.getExecutionMethod() == ExecutionMethod.AsStep && parentStep != null) { context.setCompleted(true); if (!exitStatus && job != null) { job.markJobEnded(false); JobRepositoryFactory.getJobRepository() .updateCompletedJobAndSteps(job); } } } } catch (Exception e) { log.error("Exception", e); } } }

Target:
public static void endStep(ExecutionContext context, Step step, boolean exitStatus) { if (context == null) { return; } if (context.isMonitored()) { Job job = context.getJob(); try { if (step != null) { step.markStepEnded(exitStatus); JobRepositoryFactory.getJobRepository().updateStep(step); } if (context.getExecutionMethod() == ExecutionMethod.AsJob && job != null && !exitStatus) { context.setCompleted(true); job.markJobEnded(false); JobRepositoryFactory.getJobRepository() .updateCompletedJobAndSteps(job); } else { Step parentStep = context.getStep(); if (context.getExecutionMethod() == ExecutionMethod.AsStep && parentStep != null) { context.setCompleted(true); if (job != null && !exitStatus) { job.markJobEnded(false); JobRepositoryFactory.getJobRepository() .updateCompletedJobAndSteps(job); } } } } catch (Exception e) { log.error("Exception", e); } } }
Source:
public void visitMethodInvocation(MethodInvocationTree tree) { IdentifierTree methodIdentifier = null; boolean isInvocationOnSelf = false; ExpressionTree methodSelect = tree.methodSelect(); if (methodSelect.is(Tree.Kind.IDENTIFIER)) { methodIdentifier = (IdentifierTree) methodSelect; isInvocationOnSelf = !isThisOrSuper(methodIdentifier); } else if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree memberSelect = (MemberSelectExpressionTree) methodSelect; methodIdentifier = memberSelect.identifier(); isInvocationOnSelf = isThis(memberSelect.expression()); } if (isInvocationOnSelf) { Symbol symbol = methodIdentifier.symbol(); if (isOverridableMethod(symbol) && isMethodDefinedOnConstructedType(symbol) &&!isInsideAnonymousClass(methodIdentifier)) { reportIssue(methodIdentifier, "Remove this call from a constructor to the overridable \"" + methodIdentifier.name() + "\" method."); } } super.visitMethodInvocation(tree); }

Target:
public void visitMethodInvocation(MethodInvocationTree tree) { IdentifierTree methodIdentifier = null; boolean isInvocationOnSelf = false; ExpressionTree methodSelect = tree.methodSelect(); if (methodSelect.is(Tree.Kind.IDENTIFIER)) { methodIdentifier = (IdentifierTree) methodSelect; isInvocationOnSelf = !isThisOrSuper(methodIdentifier); } else if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree memberSelect = (MemberSelectExpressionTree) methodSelect; methodIdentifier = memberSelect.identifier(); isInvocationOnSelf = isThis(memberSelect.expression()); } if (isInvocationOnSelf) { Symbol symbol = methodIdentifier.symbol(); if (isOverridableMethod(symbol) && isMethodDefinedOnConstructedType(symbol)) { reportIssue(methodIdentifier, "Remove this call from a constructor to the overridable \"" + methodIdentifier.name() + "\" method."); } } super.visitMethodInvocation(tree); }
Source:
public ConnectorSplitManager getSplitManager() { return (transactionHandle, session, layout, splitSchedulingStrategy, locationBasedScheduler) -> { throw new UnsupportedOperationException(); }; }

Target:
public ConnectorSplitManager getSplitManager() { return (transactionHandle, session, layout, splitSchedulingContext) -> { throw new UnsupportedOperationException(); }; }
Source:
public static File getDiskCacheDir(Context context, String uniqueName) { final String cachePath; if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) && context.getExternalCacheDir() != null) { cachePath = context.getExternalCacheDir().getPath(); } else { cachePath = context.getCacheDir().getPath(); } return new File(cachePath + File.separator + uniqueName); }

Target:
public static File getDiskCacheDir(Context context, String uniqueName) { final String cachePath; if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) && context.getExternalCacheDir() != null) { cachePath = context.getExternalCacheDir().getPath(); } else { cachePath = context.getCacheDir().getPath(); } return new File(cachePath + File.separator + uniqueName); }
Source:
MakeBucketArgs(Builder builder) { this.bucket = new BucketName(builder.bucketName); this.bucketName = builder.bucketName; this.region = builder.region; this.objectLock = builder.objectLock; }

Target:
MakeBucketArgs(Builder builder) { super(builder); this.objectLock = builder.objectLock; }
Source:
public void initDefaultContainers(ModelDelta parentDelta) { if (fNesting != null && fNesting.length > 0) { IAdaptable[] emptyCategories = fNesting[0].getCategories(); if (emptyCategories != null) { for (IAdaptable empty : emptyCategories) { BreakpointContainer container = findExistingContainer(fChildContainers, empty); if (container == null) { IBreakpointOrganizer[] siblings = new IBreakpointOrganizer[fNesting.length - 1]; System.arraycopy(fNesting, 1, siblings, 0, siblings.length); container = new BreakpointContainer(this, empty, fNesting[0], fComparator, siblings); insertChildContainer(container); container.fDefaultContainer = true; int size = container.getChildren().length; parentDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSTALL|IModelDelta.ADDED|IModelDelta.EXPAND, size); } } } } }

Target:
public void initDefaultContainers(ModelDelta parentDelta) { if (fNesting != null && fNesting.length > 0) { IAdaptable[] emptyCategories = fNesting[0].getCategories(); if (emptyCategories != null) { for (IAdaptable category : emptyCategories) { BreakpointContainer container = findExistingContainer(fChildContainers, category); if (container == null) { IBreakpointOrganizer[] siblings = new IBreakpointOrganizer[fNesting.length - 1]; System.arraycopy(fNesting, 1, siblings, 0, siblings.length); container = new BreakpointContainer(this, category, fNesting[0], fComparator, siblings); insertChildContainer(container); container.fDefaultContainer = true; int size = container.getChildren().length; parentDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSTALL|IModelDelta.ADDED|IModelDelta.EXPAND, size); } } } } }
Source:
public Option<Instant> getEnd() { return this.repeat == -1 ? None.instance() : new Some<>(Instant.ofEpochMilli(this.start + this.repeat * this.period + this.duration)); }

Target:
public Option<Instant> getEnd() { return repeat == REPEAT_FOREVER || duration == WINDOW_REMAINS_OPEN_FOREVER ? None.instance() : new Some<>(Instant.ofEpochMilli(start + repeat * period + duration)); }
Source:
public static void register() { CapabilityManager.INSTANCE.register(IItemHandler.class, new Capability.IStorage<IItemHandler>() { @Override public NBTBase writeNBT(Capability<IItemHandler> capability, IItemHandler instance, EnumFacing side) { if (!(instance instanceof INBTSerializable)) throw new RuntimeException(); else return ((INBTSerializable) instance).serializeNBT(); } @Override @SuppressWarnings("unchecked") public void readNBT(Capability<IItemHandler> capability, IItemHandler instance, EnumFacing side, NBTBase base) { if (!(instance instanceof INBTSerializable)) throw new RuntimeException(); else ((INBTSerializable) instance).deserializeNBT(base); } }, () -> new ItemHandler(new ItemHolder(1))); }

Target:
public static void register() { CapabilityManager.INSTANCE.register(IItemHandler.class, new Capability.IStorage<IItemHandler>() { @Override public NBTBase writeNBT(Capability<IItemHandler> capability, IItemHandler instance, EnumFacing side) { if (!(instance instanceof INBTSerializable)) throw new IllegalArgumentException("the IItemHandler must implement INBTSerializable"); else return ((INBTSerializable) instance).serializeNBT(); } @Override @SuppressWarnings("unchecked") public void readNBT(Capability<IItemHandler> capability, IItemHandler instance, EnumFacing side, NBTBase base) { if (!(instance instanceof INBTSerializable)) throw new IllegalArgumentException("the IItemHandler must implement INBTSerializable"); else ((INBTSerializable) instance).deserializeNBT(base); } }, () -> new ItemStackHandler((1))); }
Source:
public void onFailed(Guid cmdId, List<Guid> childCmdIds) { super.onFailed(cmdId, childCmdIds); getCommand().unlockImageInDb(); log.error("Failed extending disk. ID: {}", getDiskId()); updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getCommand().getNewDiskSizeInGB()); getCommand().endAction(); CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId); }

Target:
public void onFailed(Guid cmdId, List<Guid> childCmdIds) { super.onFailed(cmdId, childCmdIds); log.error("Failed extending disk. ID: {}", getDiskId()); updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getCommand().getNewDiskSizeInGB()); getCommand().endAction(); CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId); }
Source:
public Optional<StoredObject> findByKey(@Nullable Tenant tenant, String bucket, String key) { VirtualObject cachedObject = virtualObjectCache.get(key); if (cachedObject != null) { if ((tenant == null || cachedObject.getTenant().is(tenant)) && cachedObject.getBucket().equals(bucket)) { return Optional.of(cachedObject); } return Optional.empty(); } VirtualObject virtualObject = oma.select(VirtualObject.class) .eqIgnoreNull(VirtualObject.TENANT, tenant) .eq(VirtualObject.BUCKET, bucket) .eq(VirtualObject.OBJECT_KEY, key) .queryFirst(); if (virtualObject != null && !virtualObject.isTemporary()) { virtualObjectCache.put(key, virtualObject); } return Optional.ofNullable(virtualObject); }

Target:
public Optional<StoredObject> findByKey(@Nullable Tenant tenant, String bucket, String key) { VirtualObject cachedObject = virtualObjectCache.get(key); if (cachedObject != null) { if (checkIntegrity(cachedObject, tenant, bucket)) { return Optional.of(cachedObject); } return Optional.empty(); } VirtualObject virtualObject = oma.select(VirtualObject.class) .eqIgnoreNull(VirtualObject.TENANT, tenant) .eq(VirtualObject.BUCKET, bucket) .eq(VirtualObject.OBJECT_KEY, key) .queryFirst(); if (virtualObject != null && !virtualObject.isTemporary()) { virtualObjectCache.put(key, virtualObject); } return Optional.ofNullable(virtualObject); }
Source:
private static void printMetacardData( final CSVPrinter csvPrinter, final Iterator iterator, Metacard metacard) { try { csvPrinter.printRecord(() -> iterator); } catch (IOException ioe) { LOGGER.debug( "Failed to print the CSV data for metacard with id {}: {}", metacard.getId(), ioe); } }

Target:
private static void printMetacardData( final CSVPrinter csvPrinter, final Iterator iterator, Metacard metacard) { try { csvPrinter.printRecord(() -> iterator); } catch (IOException ioe) { LOGGER.debug("Failed to print the CSV data for metacard with id: {}", metacard.getId(), ioe); } }
Source:
public TableInputHandler getTableInputHandler(String tableId) { TableInputHandler tableInputHandler = tableInputHandlerMap.get(tableId); if (tableInputHandler == null) { synchronized (this) { tableInputHandler = tableInputHandlerMap.get(tableId); if (tableInputHandler == null) { TableInputHandler newTableInputHandler = constructTableInputHandler(tableId); return newTableInputHandler; } else { return tableInputHandler; } } } else { return tableInputHandler; } }

Target:
public TableInputHandler getTableInputHandler(String tableId) { TableInputHandler tableInputHandler = tableInputHandlerMap.get(tableId); synchronized (this) { if (tableInputHandler == null) { return constructTableInputHandler(tableId); } return tableInputHandler; } }
Source:
public static <T> T getValue(ExpressionTree expression, Function<ExpressionTree,T> resolver) { T value = resolver.apply(expression); if (value == null && expression.is(Tree.Kind.IDENTIFIER)) { ExpressionTree last = ReassignmentFinder.getClosestReassignmentOrDeclarationExpression(expression, ((IdentifierTree) expression).symbol()); value = last == null || !isStrictAssignmentOrDeclaration(last) || last == expression ? null : getValue(last, resolver); } return value; }

Target:
public static <T> T getValue(ExpressionTree expression, Function<ExpressionTree,T> resolver) { T value = resolver.apply(expression); if (value == null && expression.is(Tree.Kind.IDENTIFIER)) { ExpressionTree last = ReassignmentFinder.getClosestReassignmentOrDeclarationExpression(expression, ((IdentifierTree) expression).symbol()); if (last == null || !isStrictAssignmentOrDeclaration(last) || last == expression) { value = null; } else { value = getValue(last, resolver); } } return value; }
Source:
@Test public void testElementSizeCorruptionCheckNoProblem() throws IOException { QueueFile queueFile = new QueueFile(file); try { queueFile.peek(); } catch (IOException e) { fail("Peek found corruption.", e); } }

Target:
@Test public void testElementSizeCorruptionCheckNoProblem() throws IOException { QueueFile queueFile = new QueueFile(file); queueFile.peek(); }
Source:
public ParameterValue getDefaultParameterValue() { if (runId != null) { return createValue(runId); } Run<?,?> lastBuild = null; Job project = getProject(); if (project == null) { LOGGER.log(WARNING, "project should not be null when retrieving default parameter value"); return null; } switch (getFilter()) { case COMPLETED: lastBuild = project.getLastCompletedBuild(); break; case SUCCESSFUL: lastBuild = project.getLastSuccessfulBuild(); break; case STABLE : lastBuild = project.getLastStableBuild(); break; default: lastBuild = project.getLastBuild(); break; } if (lastBuild != null) { return createValue(lastBuild.getExternalizableId()); } else { return null; } }

Target:
public ParameterValue getDefaultParameterValue() { if (runId != null) { return createValue(runId); } Run<?,?> lastBuild = null; Job project = getProject(); if (project == null) { return null; } switch (getFilter()) { case COMPLETED: lastBuild = project.getLastCompletedBuild(); break; case SUCCESSFUL: lastBuild = project.getLastSuccessfulBuild(); break; case STABLE : lastBuild = project.getLastStableBuild(); break; default: lastBuild = project.getLastBuild(); break; } if (lastBuild != null) { return createValue(lastBuild.getExternalizableId()); } else { return null; } }
Source:
private static void replaceIdeaActions() { replaceAction("NewProject", new AndroidNewProjectAction()); replaceAction("WelcomeScreen.CreateNewProject", new AndroidNewProjectAction()); replaceAction("NewModule", new AndroidNewModuleAction()); replaceAction("NewModuleInGroup", new AndroidNewModuleInGroupAction()); replaceAction("ImportProject", new AndroidImportProjectAction()); replaceAction("WelcomeScreen.ImportProject", new AndroidImportProjectAction()); replaceAction("ImportModule", new AndroidActionRemover("Import Module...", new ImportModuleAction())); replaceAction("MakeModule", new AndroidActionRemover("Make Module", new MakeModuleAction())); replaceAction("Compile", new AndroidActionRemover("Compile", new CompileAction())); replaceAction("GenerateAntBuild", new AndroidActionRemover("Generate Ant Build...", new GenerateAntBuildAction())); }

Target:
private static void replaceIdeaActions() { replaceAction("NewProject", new AndroidNewProjectAction()); replaceAction("WelcomeScreen.CreateNewProject", new AndroidNewProjectAction()); replaceAction("NewModule", new AndroidNewModuleAction()); replaceAction("NewModuleInGroup", new AndroidNewModuleInGroupAction()); replaceAction("ImportProject", new AndroidImportProjectAction()); replaceAction("WelcomeScreen.ImportProject", new AndroidImportProjectAction()); replaceAction("ImportModule", new AndroidActionRemover(new ImportModuleAction(), "Import Module...")); replaceAction("MakeModule", new AndroidActionRemover(new MakeModuleAction(), "Make Module")); replaceAction("Compile", new AndroidActionRemover(new CompileAction(), "Compile")); replaceAction("GenerateAntBuild", new AndroidActionRemover(new GenerateAntBuildAction(), "Generate Ant Build...")); }
Source:
private boolean isApiProduct(Object object) { try { APIProduct apiProduct = (APIProduct) object; return (apiProduct != null) ? true : false; } catch (Exception e) { return false; } }

Target:
private boolean isApiProduct(Object object) { return (object) instanceof APIProduct; }
Source:
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { OpenShiftServerBehaviour beh = getOpenShiftServerBehaviour(configuration); IServer server = beh.getServer(); launch.addProcess(new ServerProcess(launch, server, getLabel(launch.getLaunchMode()))); beh.setServerStarting(); waitForDeploymentConfigAndPods(server, monitor); enableDevModeForNodeJsProject(OpenShiftServerUtils.getDeploymentConfig(server), server); try { IReplicationController rc = OpenShiftServerUtils.getReplicationController(server); toggleDebugging(mode, monitor, beh, server, rc); } catch (CoreException e) { beh.setServerStopped(); throw e; } }

Target:
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { OpenShiftServerBehaviour beh = getOpenShiftServerBehaviour(configuration); IServer server = beh.getServer(); launch.addProcess(new ServerProcess(launch, server, getLabel(launch.getLaunchMode()))); beh.setServerStarting(); waitForDeploymentConfigAndPods(server, monitor); enableDevModeForNodeJsProject(OpenShiftServerUtils.getReplicationController(server), server); try { IReplicationController rc = OpenShiftServerUtils.getReplicationController(server); toggleDebugging(mode, monitor, beh, server, rc); } catch (CoreException e) { beh.setServerStopped(); throw e; } }
Source:
public void putAlias(String alias, List<String> jobs) { mapLock.lock(); try { alias2jobs.put(alias, jobs); job2alias.put(jobs.get(0), alias); StringWriter sw = new StringWriter(); mapper.writeValue(sw, jobs); spawnDataStore.putAsChild(ALIAS_PATH, alias, sw.toString()); } catch (Exception e) { log.warn("failed to put alias: {}", alias, e); throw Throwables.propagate(e); } finally { mapLock.unlock(); } }

Target:
public void putAlias(String alias, List<String> jobs) { mapLock.lock(); try { alias2jobs.put(alias, jobs); job2alias.put(jobs.get(0), alias); spawnDataStore.putAsChild(ALIAS_PATH, alias, mapper.writeValueAsString(jobs)); } catch (Exception e) { log.warn("failed to put alias: {}", alias, e); throw Throwables.propagate(e); } finally { mapLock.unlock(); } }
Source:
protected void executeCommand() { GlusterVolumeGeoRepCreateParameters parameter = getParameters(); String slaveHost = parameter.getSlaveHost(); String slaveSShFingerPrint = GlusterUtil.getInstance().getHostSSHFingerPrint(slaveHost); VDSReturnValue sessionCreateReturnValue = null; VDSReturnValue passwordlessSSHCreateReturnValue = runVdsCommand(VDSCommandType.CreatePasswordLessSSHSession, new GlusterSshSessionParameters(slaveHost, slaveSShFingerPrint, parameter.getUserName(), parameter.getSlaveUserPassword())); if (passwordlessSSHCreateReturnValue.getSucceeded()) { sessionCreateReturnValue = runVdsCommand(VDSCommandType.GlusterVolumeGeoRepSessionCreate, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), masterVolume.getName(), slaveHost, parameter.getSlaveVolumeName(), parameter.isForce())); if (!sessionCreateReturnValue.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_CREATE_FAILED, sessionCreateReturnValue.getVdsError().getMessage()); return; } setSucceeded(sessionCreateReturnValue.getSucceeded()); } else { handleVdsError(AuditLogType.GLUSTER_VOLUME_PASSWORD_LESS_SSH_FAILED, passwordlessSSHCreateReturnValue.getVdsError().getMessage()); setSucceeded(false); } getReturnValue().setActionReturnValue(sessionCreateReturnValue); }

Target:
protected void executeCommand() { GlusterVolumeGeoRepCreateParameters parameter = getParameters(); String slaveHost = parameter.getSlaveHost(); String slaveSShFingerPrint = GlusterUtil.getInstance().getHostSSHFingerPrint(slaveHost); VDSReturnValue sessionCreateReturnValue = null; VDSReturnValue passwordlessSSHCreateReturnValue = runVdsCommand(VDSCommandType.CreatePasswordLessSSHSession, new GlusterSshSessionParameters(slaveHost, slaveSShFingerPrint, parameter.getUserName(), parameter.getSlaveUserPassword())); if (passwordlessSSHCreateReturnValue.getSucceeded()) { sessionCreateReturnValue = runVdsCommand(VDSCommandType.GlusterVolumeGeoRepSessionCreate, new GlusterVolumeGeoRepSessionVDSParameters(upServer.getId(), masterVolume.getName(), slaveHost, parameter.getSlaveVolumeName(), parameter.isForce())); if (!sessionCreateReturnValue.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_GEO_REP_CREATE_FAILED, sessionCreateReturnValue.getVdsError().getMessage()); return; } setSucceeded(sessionCreateReturnValue.getSucceeded()); GlusterGeoRepSession newSession = new GlusterGeoRepSession(); newSession.setMasterVolumeId(masterVolume.getId()); newSession.setMasterVolumeName(masterVolume.getName()); newSession.setSlaveHostName(slaveHost); newSession.setSlaveVolumeName(parameter.getSlaveVolumeName()); newSession.setSlaveVolumeId(getGlusterVolumeDao().getByName(getVdsDAO().getByName(slaveHost).getVdsGroupId(), parameter.getSlaveVolumeName()).getId()); newSession.setSlaveNodeUuid(getVdsDAO().getByName(slaveHost).getId()); getGlusterGeoRepDao().save(newSession); } else { handleVdsError(AuditLogType.GLUSTER_VOLUME_PASSWORD_LESS_SSH_FAILED, passwordlessSSHCreateReturnValue.getVdsError().getMessage()); setSucceeded(false); } getReturnValue().setActionReturnValue(sessionCreateReturnValue); }
Source:
public IgniteTestResources(IgniteLogger log) throws IgniteCheckedException { assert log != null; this.log = log.getLogger(getClass()); jmx = prepareMBeanServer(); ctx = new GridTestKernalContext(log); rsrcProc = new GridResourceProcessor(ctx); }

Target:
public IgniteTestResources(IgniteLogger log) throws IgniteCheckedException { assert log != null; this.log = log.getLogger(getClass()); this.jmx = prepareMBeanServer(); this.ctx = new GridTestKernalContext(log); this.rsrcProc = new GridResourceProcessor(ctx); }
Source:
protected void storeDialog(IDialogSettings settings) { super.storeDialog(settings); settings.put(SHOW_DERIVED, showDerivedResourcesAction.isChecked()); if (groupResourcesByLocationAction.didRun()) { settings.put(FILTER_BY_LOCATION, this.groupResourcesByLocationAction.isChecked()); } XMLMemento memento = XMLMemento.createWriteRoot("workingSet"); workingSetFilterActionGroup.saveState(memento); workingSetFilterActionGroup.dispose(); StringWriter writer = new StringWriter(); try { memento.save(writer); settings.put(WORKINGS_SET_SETTINGS, writer.getBuffer().toString()); } catch (IOException e) { StatusManager.getManager() .handle(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "", e)); } }

Target:
protected void storeDialog(IDialogSettings settings) { super.storeDialog(settings); settings.put(SHOW_DERIVED, showDerivedResourcesAction.isChecked()); settings.put(FILTER_BY_LOCATION, this.groupResourcesByLocationAction.isChecked()); XMLMemento memento = XMLMemento.createWriteRoot("workingSet"); workingSetFilterActionGroup.saveState(memento); workingSetFilterActionGroup.dispose(); StringWriter writer = new StringWriter(); try { memento.save(writer); settings.put(WORKINGS_SET_SETTINGS, writer.getBuffer().toString()); } catch (IOException e) { StatusManager.getManager() .handle(new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "", e)); } }
Source:
public AbstractLunRemoveColumn(SanStorageModelBase model) { super(new AbstractToggleButtonCell<LunModel>() { @Override public void onClickEvent(LunModel lunModel) { if (lunModel != null && !model.getMetadataDevices().contains(lunModel.getLunId())) { lunModel.setRemoveLunSelected(!lunModel.isRemoveLunSelected()); } } @Override public void render(Context context, LunModel value, SafeHtmlBuilder sb, String id) { String inputId = id + "_input"; SafeHtml input; boolean lastLunAvailable = false; if (model.getMetadataDevices().size() == 0) { lastLunAvailable = model.getNumOfLUNsToRemove() == model.getItems().size() - 1; } model.getRequireTableRefresh().setEntity(lastLunAvailable); if (model.getMetadataDevices().contains(value.getLunId()) || model.getSelectedLuns().size() == 1 || lastLunAvailable) { input = templates.disabled(inputId, constants.notAvailableLabel()); } else if (value.isRemoveLunSelected()) { input = templates.toggledDown(inputId, "Remove"); } else { input = templates.toggledUp(inputId, "Remove"); } sb.append(templates.span(id, input)); } }); }

Target:
public AbstractLunRemoveColumn(SanStorageModelBase model) { super(new AbstractToggleButtonCell<LunModel>() { @Override public void onClickEvent(LunModel lunModel) { if (lunModel != null && !model.getMetadataDevices().contains(lunModel.getLunId())) { lunModel.setRemoveLunSelected(!lunModel.isRemoveLunSelected()); } } @Override public void render(Context context, LunModel value, SafeHtmlBuilder sb, String id) { String inputId = id + "_input"; SafeHtml input; boolean lastLunAvailable = false; if (model.getMetadataDevices().size() == 0) { lastLunAvailable = model.getNumOfLUNsToRemove() == model.getItems().size() - 1; } model.getRequireTableRefresh().setEntity(lastLunAvailable); if (model.getMetadataDevices().contains(value.getLunId()) || model.getSelectedLuns().size() == 1 || lastLunAvailable) { input = templates.disabled(inputId, uiConstants.notAvailableLabel()); } else if (value.isRemoveLunSelected()) { input = templates.toggledDown(inputId, constants.removeSanStorage()); } else { input = templates.toggledUp(inputId, constants.removeSanStorage()); } sb.append(templates.span(id, input)); } }); }
Source:
public void whitelistSanity() throws Exception { try (InputStream is = ClassFilterImpl.class.getResourceAsStream("whitelisted-classes.txt")) { List<String> lines = IOUtils.readLines(is); assertThat("whitelist is ordered", new TreeSet<>(lines), contains(lines.toArray(new String[0]))); for (String line : lines) { try { Class.forName(line); } catch (ClassNotFoundException x) { System.err.println("skipping checks of unknown class " + line); } } } }

Target:
public void whitelistSanity() throws Exception { try (InputStream is = ClassFilterImpl.class.getResourceAsStream("whitelisted-classes.txt")) { List<String> lines = IOUtils.readLines(is, StandardCharsets.UTF_8).stream().filter(line -> !line.matches("#.*|\\s*")).collect(Collectors.toList()); assertThat("whitelist is ordered", new TreeSet<>(lines), contains(lines.toArray(new String[0]))); for (String line : lines) { try { Class.forName(line); } catch (ClassNotFoundException x) { System.err.println("skipping checks of unknown class " + line); } } } }
Source:
private PrestoThriftService openClient(PrestoThriftSplit split) { if (split.getHosts().isEmpty()) { return client.get(thriftHeader); } return client.get(Optional.of(split.getHosts().stream() .map(host -> host.toHostAddress().toString()) .collect(joining(","))), thriftHeader); }

Target:
private PrestoThriftService openClient(PrestoThriftSplit split) { if (split.getHosts().isEmpty()) { return client.get(thriftHeaders); } String hosts = split.getHosts().stream() .map(host -> host.toHostAddress().toString()) .collect(joining(",")); return client.get(Optional.of(hosts), thriftHeaders); }
Source:
public void testLoadCommodityCodeFile() { byte[] content = commodityCodeUpdateService.getFileContent(DATA_FILE_PATH); ArrayList<CommodityCode> someCommodityCodes = (ArrayList<CommodityCode>) commodityCodeUpdateService.parseCommodityCodeList(content); assertNotSame(content.length, 0); assertEquals(NUMBER_OF_RECORDS_IN_DATA_FILE, someCommodityCodes.size()); }

Target:
public void testLoadCommodityCodeFile() { assertTrue(commodityCodeUpdateService.loadCommodityCodeFile(DATA_FILE_PATH)); }
Source:
public void clearAddressOnInterfaceChange() { final UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setDiskInterface(DiskInterface.VirtIO_SCSI); when(diskDao.get(diskImageGuid)).thenAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { final DiskImage oldDisk = createDiskImage(); oldDisk.setDiskInterface(DiskInterface.VirtIO); assertNotSame (oldDisk.getDiskInterface(), parameters.getDiskInfo().getDiskInterface()); return oldDisk; } }); initializeCommand(parameters); VmDevice device = createVmDevice(diskImageGuid, vmId); command.executeVmCommand(); verify(vmDeviceDAO, times(1)).clearDeviceAddress(device.getDeviceId()); }

Target:
public void clearAddressOnInterfaceChange() { final UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setDiskInterface(DiskInterface.VirtIO_SCSI); when(diskDao.get(diskImageGuid)).thenAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { final DiskImage oldDisk = createDiskImage(); oldDisk.setDiskInterface(DiskInterface.VirtIO); assertNotSame (oldDisk.getDiskInterface(), parameters.getDiskInfo().getDiskInterface()); return oldDisk; } }); initializeCommand(parameters); command.executeVmCommand(); verify(vmDeviceDAO).clearDeviceAddress(diskImageGuid); }
Source:
private static boolean hasCaption(TagNode node) { if (node.getChildren().stream().anyMatch(TableWithoutCaptionCheck::isCaption)) { return true; } else { return node.getChildren().stream().filter(child -> !isTable(child)).anyMatch(TableWithoutCaptionCheck::hasCaption); } }

Target:
private static boolean hasCaption(TagNode node) { return !node.getChildren().isEmpty() && isCaption(node.getChildren().get(0)); }
Source:
FileExtensionFilter(String ext) { extension = "."+ext; }

Target:
FileExtensionFilter(String ext) { extension = ext; }
Source:
public void define(NewController context) { NewAction action = context.createAction("add_user") .setDescription(format("Add a user to a group.<br />" + "'%s' or '%s' must be provided.<br />" + "Requires the following permission: 'Administer System'.", PARAM_GROUP_ID, PARAM_GROUP_NAME)) .setHandler(this) .setPost(true) .setSince("5.2") .setChangelog(new Change("6.4", "It's no more possible to add a user to the default group")); defineGroupWsParameters(action); defineLoginWsParameter(action); }

Target:
public void define(NewController context) { NewAction action = context.createAction("add_user") .setDescription(format("Add a user to a group.<br />" + "'%s' or '%s' must be provided.<br />" + "Requires the following permission: 'Administer System'.", PARAM_GROUP_ID, PARAM_GROUP_NAME)) .setHandler(this) .setPost(true) .setSince("5.2") .setChangelog(new Change("6.4", "It's no longer possible to add a user to the default group")); defineGroupWsParameters(action); defineLoginWsParameter(action); }
Source:
public ClusterTopology getClusterTopology(String clusterName) { Map<String, InstanceConfig> instanceConfigMap = new HashMap<>(); String path = PropertyPathBuilder.instanceConfig(clusterName); BaseDataAccessor<ZNRecord> baseAccessor = new ZkBaseDataAccessor<>(_zkClient); List<ZNRecord> znRecords = baseAccessor.getChildren(path, null, 0, 0, 0); for (ZNRecord record : znRecords) { if (record != null) { InstanceConfig instanceConfig = new InstanceConfig(record); instanceConfigMap.put(instanceConfig.getInstanceName(), instanceConfig); } } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient)); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); List<LiveInstance> liveInstances = accessor.getChildValues(keyBuilder.liveInstances(), true); List<String> liveNodes = new ArrayList<>(); liveInstances.forEach(liveInstance -> liveNodes.add(liveInstance.getInstanceName())); ConfigAccessor configAccessor = new ConfigAccessor(_zkClient); ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName); return new ClusterTopology(liveNodes, instanceConfigMap, clusterConfig); }

Target:
public ClusterTopology getClusterTopology(String clusterName) { Map<String, InstanceConfig> instanceConfigMap = new HashMap<>(); String path = PropertyPathBuilder.instanceConfig(clusterName); BaseDataAccessor<ZNRecord> baseAccessor = new ZkBaseDataAccessor<>(_zkClient); List<ZNRecord> znRecords = baseAccessor.getChildren(path, null, 0, 0, 0); for (ZNRecord record : znRecords) { if (record != null) { InstanceConfig instanceConfig = new InstanceConfig(record); instanceConfigMap.put(instanceConfig.getInstanceName(), instanceConfig); } } path = PropertyPathBuilder.liveInstance(clusterName); List<String> liveNodes = baseAccessor.getChildNames(path, 0); ConfigAccessor configAccessor = new ConfigAccessor(_zkClient); ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName); return new ClusterTopology(liveNodes, instanceConfigMap, clusterConfig); }
Source:
public SingularMatrixException(){ super("Singular matrix expected."); }

Target:
public SingularMatrixException() { super("Regular (or non-singular) matrix expected."); }
Source:
private void appendRemarks(MutableColumn column, String remarks) { final String existingRemarks = column.getRemarks(); if (existingRemarks == null) { column.setRemarks(remarks); } else { column.setRemarks(existingRemarks + ", " + remarks); } }

Target:
private static void appendRemarks(MutableColumn column, String remarks) { final String existingRemarks = column.getRemarks(); if (existingRemarks == null) { column.setRemarks(remarks); } else { column.setRemarks(existingRemarks + ", " + remarks); } }
Source:
protected void handleJSON(HttpServletRequest request, HttpServletResponse response, JSONObject json) throws IOException { List<ScoreBoardJSONSetter.JSONSet> jsl = new ArrayList<ScoreBoardJSONSetter.JSONSet>(); JSONObject state = json.getJSONObject("state"); Flag flag = null; if (request.getPathInfo().equalsIgnoreCase("/load")) { flag = Flag.FROM_AUTOSAVE; } for (String key: state.keySet()) { Object value = state.get(key); String v; if (value == JSONObject.NULL) { v = null; } else { v = value.toString(); } jsl.add(new ScoreBoardJSONSetter.JSONSet(key, v, flag)); } if (request.getPathInfo().equalsIgnoreCase("/load")) { scoreBoard.reset(); ScoreBoardJSONSetter.set(scoreBoard, jsl); } else if (request.getPathInfo().equalsIgnoreCase("/merge")) { ScoreBoardJSONSetter.set(scoreBoard, jsl); } else { response.sendError(HttpServletResponse.SC_NOT_FOUND, "Must specify to load or merge"); } response.setContentType("text/plain"); response.setStatus(HttpServletResponse.SC_OK); }

Target:
protected void handleJSON(HttpServletRequest request, HttpServletResponse response, JSONObject json) throws IOException { List<ScoreBoardJSONSetter.JSONSet> jsl = new ArrayList<>(); JSONObject state = json.getJSONObject("state"); for (String key: state.keySet()) { Object value = state.get(key); String v; if (value == JSONObject.NULL) { v = null; } else { v = value.toString(); } jsl.add(new ScoreBoardJSONSetter.JSONSet(key, v, Flag.FROM_AUTOSAVE)); } if (request.getPathInfo().equalsIgnoreCase("/load")) { scoreBoard.reset(); ScoreBoardJSONSetter.set(scoreBoard, jsl); } else if (request.getPathInfo().equalsIgnoreCase("/merge")) { ScoreBoardJSONSetter.set(scoreBoard, jsl); } else { response.sendError(HttpServletResponse.SC_NOT_FOUND, "Must specify to load or merge"); } response.setContentType("text/plain"); response.setStatus(HttpServletResponse.SC_OK); }