auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ExecutionResult execute(Item item) { final ProcessType processType = getProcessType(item); <START> String[] compNames = { "tCreateTable", "tELTMSSqlMap", "tMSSqlBulkExec", "tMSSqlConnection", END> "tMSSqlInput", "tMSSqlOutput", "tMSSqlOutputBulkExec", "tMSSqlRow", "tMSSqlSCD", "tMSSqlSP", "tMSSqlCDC"}; IComponentConversion conversion = new IComponentConversion() { @Override public void transform(NodeType node) { if (node == null) { return; } ElementParameterType driverList = ComponentUtilities.getNodeProperty(node, "MSSQL_DRIVER"); if (driverList == null) { ComponentUtilities.addNodeProperty(node, "MSSQL_DRIVER", "CLOSED_LIST"); ComponentUtilities.setNodeValue(node, "MSSQL_DRIVER", "JTDS"); } } }; for (String name : compNames) { IComponentFilter filter = new NameComponentFilter(name); try { ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion> asList(conversion)); } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } } return ExecutionResult.SUCCESS_NO_ALERT; }</code><technical_language>please add components here. include tdq components</technical_language>

Target:
public ExecutionResult execute(Item item) { final ProcessType processType = getProcessType(item); String[] compNames = { "tCreateTable", "tELTMSSqlMap", "tMSSqlBulkExec", "tMSSqlConnection", "tMSSqlInput", "tMSSqlOutput", "tMSSqlOutputBulkExec", "tMSSqlRow", "tMSSqlSCD", "tMSSqlSP", "tMSSqlCDC", "tMSSqlInvalidRows", "tMSSqlValidRows"}; IComponentConversion conversion = new IComponentConversion() { @Override public void transform(NodeType node) { if (node == null) { return; } ElementParameterType driverList = null; if ("tCreateTable".equals(node.getComponentName())) { driverList = ComponentUtilities.getNodeProperty(node, "MSSQL_DRIVER"); } else { driverList = ComponentUtilities.getNodeProperty(node, "DRIVER"); } if (driverList == null) { if ("tCreateTable".equals(node.getComponentName())) { ComponentUtilities.addNodeProperty(node, "MSSQL_DRIVER", "CLOSED_LIST"); ComponentUtilities.setNodeValue(node, "MSSQL_DRIVER", "JTDS"); } else { ComponentUtilities.addNodeProperty(node, "DRIVER", "CLOSED_LIST"); ComponentUtilities.setNodeValue(node, "DRIVER", "JTDS"); } } } }; for (String name : compNames) { IComponentFilter filter = new NameComponentFilter(name); try { ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion> asList(conversion)); } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } } return ExecutionResult.SUCCESS_NO_ALERT; }
Source:
<code>protected Type visitLambdaExpression(LambdaExpression node, StackableAstVisitorContext<Context> context) { verifyNoAggregatesOrWindowFunctions(functionRegistry, node.getBody(), "Lambda expression"); if (!context.getContext().isExpectingLambda()) { throw new SemanticException(STANDALONE_LAMBDA, node, "Lambda expression should always be used inside a function"); } List<Type> types = context.getContext().getFunctionInputTypes(); List<LambdaArgumentDeclaration> lambdaArguments = node.getArguments(); if (types.size() != lambdaArguments.size()) { throw new SemanticException(INVALID_PARAMETER_USAGE, node, <START> format("expected a lambda function takes %s parameters (actual: %s)", types.size(), lambdaArguments.size())); <END> } verify(types.size() == lambdaArguments.size()); Map<String, LambdaArgumentDeclaration> nameToLambdaArgumentDeclarationMap = new HashMap<>(); if (context.getContext().isInLambda()) { nameToLambdaArgumentDeclarationMap.putAll(context.getContext().getNameToLambdaArgumentDeclarationMap()); } for (int i = 0; i < lambdaArguments.size(); i++) { LambdaArgumentDeclaration lambdaArgument = lambdaArguments.get(i); nameToLambdaArgumentDeclarationMap.put(lambdaArgument.getName(), lambdaArgument); setExpressionType(lambdaArgument, types.get(i)); } Type returnType = process(node.getBody(), new StackableAstVisitorContext<Context>(Context.inLambda(nameToLambdaArgumentDeclarationMap))); FunctionType functionType = new FunctionType(types, returnType); return setExpressionType(node, functionType); }</code><technical_language>"Expected a lambda takes %s arguments %s"</technical_language>

Target:
protected Type visitLambdaExpression(LambdaExpression node, StackableAstVisitorContext<Context> context) { verifyNoAggregatesOrWindowFunctions(functionRegistry, node.getBody(), "Lambda expression"); if (!context.getContext().isExpectingLambda()) { throw new SemanticException(STANDALONE_LAMBDA, node, "Lambda expression should always be used inside a function"); } List<Type> types = context.getContext().getFunctionInputTypes(); List<LambdaArgumentDeclaration> lambdaArguments = node.getArguments(); if (types.size() != lambdaArguments.size()) { throw new SemanticException(INVALID_PARAMETER_USAGE, node, format("Expected a lambda that takes %s argument(s) but got %s", types.size(), lambdaArguments.size())); } verify(types.size() == lambdaArguments.size()); Map<String, LambdaArgumentDeclaration> nameToLambdaArgumentDeclarationMap = new HashMap<>(); if (context.getContext().isInLambda()) { nameToLambdaArgumentDeclarationMap.putAll(context.getContext().getNameToLambdaArgumentDeclarationMap()); } for (int i = 0; i < lambdaArguments.size(); i++) { LambdaArgumentDeclaration lambdaArgument = lambdaArguments.get(i); nameToLambdaArgumentDeclarationMap.put(lambdaArgument.getName(), lambdaArgument); setExpressionType(lambdaArgument, types.get(i)); } Type returnType = process(node.getBody(), new StackableAstVisitorContext<Context>(Context.inLambda(nameToLambdaArgumentDeclarationMap))); FunctionType functionType = new FunctionType(types, returnType); return setExpressionType(node, functionType); }
Source:
<code>private static boolean streamExists(AmazonKinesisClient kinesisClient, String streamName) { <START> DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest(); <END> describeStreamRequest.setStreamName(streamName); try { kinesisClient.describeStream(describeStreamRequest); return true; } catch (ResourceNotFoundException e) { return false; } }</code><technical_language>instead of this again, refactor call method do exception handling</technical_language>

Target:
private static boolean streamExists(AmazonKinesisClient kinesisClient, String streamName) { try { getStreamState(kinesisClient, streamName); return true; } catch (ResourceNotFoundException e) { return false; } }
Source:
<code>static ResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { <START> String[] prefixes = new String[keyPrefix.length + 1]; prefixes[0] = SUBSYSTEM_NAME; System.arraycopy(keyPrefix, 0, prefixes, 1, keyPrefix.length); <END> return getResourceDescriptionResolver(false, prefixes); }</code><technical_language>This a bit unnecessary. avoid it</technical_language>

Target:
static ResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { return getResourceDescriptionResolver(false, keyPrefix); }
Source:
<code>private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); Type type = fEntryModelTypes.get(interval.getAttribute()); if (statusObj instanceof Integer) { int status = (int) statusObj; if (type == Type.CPU) { if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } } else if (type == Type.CURRENT_THREAD) { Object processName = null; if (fExecNamesCache.containsEntry(status, interval)) { NavigableSet<ITmfStateInterval> intervalSet = fExecNamesCache.get(status); <START> for (ITmfStateInterval i : intervalSet) { if (CACHE_COMPARATOR.compare(i, interval) == 0) { processName = i.getValue(); break; } } <END> } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); fExecNamesCache.put(status, namedInterval); processName = namedInterval.getValue(); } } if (processName instanceof String) { return new TimeGraphState(startTime, duration, status, (String) processName); } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }</code><technical_language>ceiling</technical_language>

Target:
private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); Type type = fEntryModelTypes.get(interval.getAttribute()); if (statusObj instanceof Integer) { int status = (int) statusObj; if (type == Type.CPU) { if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } } else if (type == Type.CURRENT_THREAD) { Object processName = null; synchronized (fExecNamesCache) { if (fExecNamesCache.containsEntry(status, interval)) { NavigableSet<ITmfStateInterval> intervalSet = fExecNamesCache.get(status); ITmfStateInterval execNameInterval = intervalSet.ceiling(interval); if (execNameInterval != null && CACHE_COMPARATOR.compare(execNameInterval, interval) == 0) { processName = execNameInterval.getValue(); } } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); fExecNamesCache.put(status, namedInterval); processName = namedInterval.getValue(); } } } if (processName instanceof String) { return new TimeGraphState(startTime, duration, status, (String) processName); } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }
Source:
<code>public void setChecked(boolean checked) { <START> if (item instanceof Checkable) { <END> ((Checkable) item).setChecked(checked); } this.checked = checked; }</code><technical_language>spaces. need indent tabs</technical_language>

Target:
public void setChecked(boolean checked) { if (checkable) { ((Checkable) item).setChecked(checked); } }
Source:
<code>public static boolean hasSnapshot(String version) { <START> return StringUtils.isNotEmpty(version) && version.endsWith(SNAPSHOT); <END> }</code><technical_language>StringUtils.endsWith(str, suffix), null safe. java return StringUtils.endsWith(version, SNAPSHOT);</technical_language>

Target:
public static boolean hasSnapshot(String version) { return StringUtils.endsWith(version, SNAPSHOT); }
Source:
<code>public DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) { super(vertx, createChannel(options.isIpV6() ? io.vertx.core.datagram.impl.InternetProtocolFamily.IPv6 : io.vertx.core.datagram.impl.InternetProtocolFamily.IPv4, new DatagramSocketOptions(options)), vertx.getOrCreateContext()); ContextImpl creatingContext = vertx.getContext(); if (creatingContext != null && creatingContext.isMultiThreadedWorkerContext()) { throw new IllegalStateException("Cannot use DatagramSocket in a multi-threaded worker verticle"); } channel().config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); context.nettyEventLoop().register(channel); if (options.getLogActivity()) { channel().pipeline().addLast("logging", new LoggingHandler()); } channel.pipeline().addLast("handler", new DatagramServerHandler(this)); channel().config().setMaxMessagesPerRead(1); channel().config().setAllocator(PartialPooledByteBufAllocator.INSTANCE); <START> VertxMetrics metrics = vertx.metricsSPI(); <END> this.metrics = metrics != null ? metrics.createMetrics(this, options) : null; }</code><technical_language>FakeVertxMetrics DummyVertxMetrics factories updated reflect new expectations (return null if metrics options is disabled)</technical_language>

Target:
private DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) { DatagramChannel channel = createChannel(options.isIpV6() ? io.vertx.core.datagram.impl.InternetProtocolFamily.IPv6 : io.vertx.core.datagram.impl.InternetProtocolFamily.IPv4, new DatagramSocketOptions(options)); ContextImpl context = vertx.getOrCreateContext(); if (context.isMultiThreadedWorkerContext()) { throw new IllegalStateException("Cannot use DatagramSocket in a multi-threaded worker verticle"); } channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); channel.config().setMaxMessagesPerRead(1); channel.config().setAllocator(PartialPooledByteBufAllocator.INSTANCE); context.nettyEventLoop().register(channel); if (options.getLogActivity()) { channel.pipeline().addLast("logging", new LoggingHandler()); } VertxMetrics metrics = vertx.metricsSPI(); this.metrics = metrics != null ? metrics.createMetrics(this, options) : null; this.channel = channel; this.context = context; }
Source:
<code>public Expression find(HumanTaskDefinition humanTaskDefinition, long expressionDefinitionId) { <START> return humanTaskDefinition != null ? humanTaskDefinition.getUserFilter().accept(this, expressionDefinitionId) : null; <END> }</code><technical_language>NPE getUserFilter().accept</technical_language>

Target:
public Expression find(HumanTaskDefinition humanTaskDefinition, long expressionDefinitionId) { return humanTaskDefinition != null ? getExpressionFromContainer(humanTaskDefinition.getUserFilter(), expressionDefinitionId) : null; }
Source:
<code>public void testConvertAdHocSubprocessNode_SlaDueDate() { <START> final String SLA_DUE_DATE = "12/25/1983"; <END> SubProcess subProcess = bpmn2.createAdHocSubProcess(); subProcess.setId(UUID.randomUUID().toString()); subProcess.setTriggeredByEvent(Boolean.TRUE); CustomElement.slaDueDate.setValue(subProcess, SLA_DUE_DATE); Result<BpmnNode> result = tested.convertSubProcess(subProcess); BpmnNode node = result.value(); AdHocSubprocess adHocSubprocess = (AdHocSubprocess) node.value().getContent().getDefinition(); assertNotNull(adHocSubprocess); assertNotNull(adHocSubprocess.getExecutionSet()); AdHocSubprocessTaskExecutionSet executionSet = adHocSubprocess.getExecutionSet(); SLADueDate slaDueDate = executionSet.getSlaDueDate(); assertNotNull(slaDueDate); assertTrue(slaDueDate.getValue().contains(SLA_DUE_DATE)); }</code><technical_language>Common variables for more test methods moved class a constant</technical_language>

Target:
public void testConvertAdHocSubprocessNode_SlaDueDate() { SubProcess subProcess = bpmn2.createAdHocSubProcess(); subProcess.setTriggeredByEvent(Boolean.TRUE); CustomElement.slaDueDate.setValue(subProcess, SLA_DUE_DATE); Result<BpmnNode> result = tested.convertSubProcess(subProcess); BpmnNode node = result.value(); AdHocSubprocess adHocSubprocess = (AdHocSubprocess) node.value().getContent().getDefinition(); assertNotNull(adHocSubprocess); assertBaseSubprocessExecutionSet(adHocSubprocess.getExecutionSet()); }
Source:
<code>public Maybe<A> filter(@NotNull F<A, Boolean> f) { <START> return this.value == null ? this : f.apply(this.value) ? this : empty(); <END> }</code><technical_language>Please parenthesise nested ternaries</technical_language>

Target:
public Maybe<A> filter(@NotNull F<A, Boolean> f) { return this.filter((Predicate<A>) f::apply); }
Source:
<code>public APISession login(final String userName, final String password) throws LoginException { try { return loginInternal(userName, password, null); <START> } catch (final UnknownUserException e) { <END> throw e; } catch (final LoginException e) { throw e; } catch (final Exception e) { throw new LoginException(e); } }</code><technical_language>need UnknownUserException extends LoginException</technical_language>

Target:
public APISession login(final String userName, final String password) throws LoginException { try { return loginInternal(userName, password, null); } catch (final LoginException e) { throw e; } catch (final Exception e) { throw new LoginException(e); } }
Source:
<code><START> @Test public void deleteChildlessDirectoryTest() { <END> boolean deleted; if (Files.exists(DIRECTORY)) { try { deleted = BundleGeneratorUtils.delete(DIRECTORY); } catch (IOException e) { deleted = false; } } else { deleted = false; } Assert.assertTrue(deleted); }</code><technical_language>check formatting</technical_language>

Target:
public void deleteChildlessDirectoryTest() { boolean deleted; if (Files.exists(DIRECTORY)) { try { deleted = BundleGeneratorUtils.delete(DIRECTORY); } catch (IOException e) { deleted = false; } } else { deleted = false; } Assert.assertTrue(deleted); }
Source:
<code>public void start() { if (!enabled || started.getAndSet(true)) { <START> log.info("ShardOrganizationManager return"); <END> return; } startDiscovery(); }</code><technical_language>Do need this</technical_language>

Target:
public void start() { if (!enabled || started.getAndSet(true)) { return; } startDiscovery(); }
Source:
<code>private void restorePrivateDnsSetting() { Settings.Global.putString(mCR, Settings.Global.PRIVATE_DNS_MODE, mOldMode); if (mOldMode <START> == "hostname") <END> { Settings.Global.putString( mCR, Settings.Global.PRIVATE_DNS_SPECIFIER, mOldDnsSpecifier); CountDownLatch latch = new CountDownLatch(1); NetworkRequest request = new NetworkRequest.Builder().clearCapabilities().build(); NetworkCallback callback = new NetworkCallback() { @Override public void onLinkPropertiesChanged(Network n, LinkProperties lp) { if (!lp.getValidatedPrivateDnsServers().isEmpty() && mOldDnsSpecifier.equals(lp.getPrivateDnsServerName())) { latch.countDown(); } } }; mCM.registerNetworkCallback(request, callback); try { latch.await(PRIVATE_DNS_SETTING_TIMEOUT_MS, TimeUnit.MILLISECONDS); Thread.sleep(PRIVATE_DNS_PROBE_MS); } catch (InterruptedException e) { } finally { mCM.unregisterNetworkCallback(callback); } } }</code><technical_language>this work? Generally correct == for objects. "hostname".equals(mOldMode) correct</technical_language>

Target:
private void restorePrivateDnsSetting() throws InterruptedException { Settings.Global.putString(mCR, Settings.Global.PRIVATE_DNS_MODE, mOldMode); if ("hostname".equals(mOldMode)) { Settings.Global.putString( mCR, Settings.Global.PRIVATE_DNS_SPECIFIER, mOldDnsSpecifier); mCtsNetUtils.awaitPrivateDnsSetting("restorePrivateDnsSetting timeout", mCM.getActiveNetwork(), mOldDnsSpecifier, PRIVATE_DNS_SETTING_TIMEOUT_MS, true); } }
Source:
<code>public void testNameToFullModuleNameMap() throws Exception { <START> final Reflections reflections = new Reflections(new ConfigurationBuilder() <END> .setUrls(new URL("file:target/classes")) .setScanners(new SubTypesScanner())); final Set<Class<? extends AbstractViolationReporter>> classes = reflections.getSubTypesOf(AbstractViolationReporter.class); final Class<PackageObjectFactory> packageObjectFactoryClass = PackageObjectFactory.class; final Field field = packageObjectFactoryClass.getDeclaredField("NAME_TO_FULL_MODULE_NAME"); field.setAccessible(true); final Collection<String> canonicalNames = ((Map<String, String>) field.get(null)).values(); assertFalse(classes.stream() .anyMatch(clazz -> !canonicalNames.contains(clazz.getCanonicalName()) && !Modifier.isAbstract(clazz.getModifiers()) && !"Check".equals(clazz.getSimpleName()))); }</code><technical_language>CheckUtil.getCheckstyleModules instead of adding this new dependency? is a module, returned method</technical_language>

Target:
public void testNameToFullModuleNameMap() throws Exception { final Set<Class<?>> classes = CheckUtil.getCheckstyleModules(); final Class<PackageObjectFactory> packageObjectFactoryClass = PackageObjectFactory.class; final Field field = packageObjectFactoryClass.getDeclaredField("NAME_TO_FULL_MODULE_NAME"); field.setAccessible(true); final Collection<String> canonicalNames = ((Map<String, String>) field.get(null)).values(); assertFalse(classes.stream() .anyMatch(clazz -> !canonicalNames.contains(clazz.getCanonicalName()))); }
Source:
<code>public SftpSession getSession() { JSchSessionWrapper jschSession = this.sharedJschSession; SftpSession sftpSession; if (this.sharedSessionLock != null) { this.sharedSessionLock.lock(); } try { if (jschSession == null || !jschSession.isConnected()) { jschSession = new JSchSessionWrapper(initJschSession()); } sftpSession = new SftpSession(jschSession); sftpSession.connect(); } catch (Exception e) { throw new IllegalStateException("failed to create SFTP Session", e); } finally { if (this.sharedSessionLock != null) { this.sharedSessionLock.unlock(); } } if (this.isSharedSession) { <START> this.sharedJschSession = jschSession; <END> } jschSession.addChannel(); return sftpSession; }</code><technical_language>write field call? In case, done while lock is held; possibility of a concurrent update</technical_language>

Target:
public SftpSession getSession() { JSchSessionWrapper jschSession = this.sharedJschSession; SftpSession sftpSession; if (this.sharedSessionLock != null) { this.sharedSessionLock.lock(); } try { boolean freshJschSession = false; if (jschSession == null || !jschSession.isConnected()) { jschSession = new JSchSessionWrapper(initJschSession()); freshJschSession = true; } sftpSession = new SftpSession(jschSession); sftpSession.connect(); if (this.isSharedSession && freshJschSession) { this.sharedJschSession = jschSession; } } catch (Exception e) { throw new IllegalStateException("failed to create SFTP Session", e); } finally { if (this.sharedSessionLock != null) { this.sharedSessionLock.unlock(); } } jschSession.addChannel(); return sftpSession; }
Source:
<code>public void loadListTable(final String key, final Consumer<ListTable<T>> readyCallback) { preferences.load(preferences -> { final GridGlobalPreferences pref = new GridGlobalPreferences(key, getInitColumns(), getBannedColumns()); pref.setPageSize(preferences.getItemsPerPage()); final ListTable<T> newListGrid = new ListTable<>(pref); newListGrid.setShowLastPagerButton(false); newListGrid.setShowFastFordwardPagerButton(false); newListGrid.enableDataGridMinWidth(true); initSelectionModel(newListGrid); addColumnSortHandler(newListGrid); userPreferencesService.call((GridPreferencesStore preferencesStore) -> { if (preferencesStore == null) { newListGrid.setGridPreferencesStore(new GridPreferencesStore(pref)); } else { newListGrid.setGridPreferencesStore(preferencesStore); } initColumns(newListGrid); newListGrid.loadPageSizePreferences(); newListGrid.setPreferencesService(userPreferencesService); addNewTableToColumn(newListGrid); listTable = newListGrid; reloadColumnSortList(); <START> listTable.getGridPreferencesStore().setPreferenceKey(null); <END> readyCallback.accept(listTable); }).loadUserPreferences(key, UserPreferencesType.GRIDPREFERENCES); }, error -> new DefaultWorkbenchErrorCallback().error(error)); }</code><technical_language>if I this right, setting a null key skip saving columns state modified in UI, is want? basically columns persisted saving filter right</technical_language>

Target:
public void loadListTable(final String key, final Consumer<ListTable<T>> readyCallback) { preferences.load(preferences -> { final GridGlobalPreferences pref = new GridGlobalPreferences(key, getInitColumns(), getBannedColumns()); pref.setPageSize(preferences.getItemsPerPage()); final ListTable<T> newListGrid = new ListTable<>(pref); newListGrid.setShowLastPagerButton(false); newListGrid.setShowFastFordwardPagerButton(false); newListGrid.enableDataGridMinWidth(true); initSelectionModel(newListGrid); addColumnSortHandler(newListGrid); userPreferencesService.call((GridPreferencesStore preferencesStore) -> { if (preferencesStore == null) { newListGrid.setGridPreferencesStore(new GridPreferencesStore(pref)); } else { newListGrid.setGridPreferencesStore(preferencesStore); } initColumns(newListGrid); newListGrid.loadPageSizePreferences(); newListGrid.setPreferencesService(userPreferencesService); addNewTableToColumn(newListGrid); listTable = newListGrid; listTable.setPersistPreferencesOnChange(false); reloadColumnSortList(); readyCallback.accept(listTable); }).loadUserPreferences(key, UserPreferencesType.GRIDPREFERENCES); }, error -> new DefaultWorkbenchErrorCallback().error(error)); }
Source:
<code>public void run() { { try { int addCount = 0; Collection curC = null; <START> if (CollectionClass.TrecText.equals(collectionClass)) { <END> curC = new TrecCollection((TrecCollection)c); } else if (CollectionClass.GOV2.equals(collectionClass)) { curC = new Gov2Collection((Gov2Collection)c); } else if (CollectionClass.CW09.equals(collectionClass)) { curC = new ClueWeb09Collection((ClueWeb09Collection)c); } else if (CollectionClass.CW12.equals(collectionClass)) { curC = new ClueWeb12Collection((ClueWeb12Collection)c); } curC.prepareInput(inputFile); while (curC.hasNext()) { Indexable d = (Indexable)curC.next(); if (d != null) { switch (collectionClass) { case CW09: case CW12: addCount += indexWarcRecord((WarcRecord) d); break; default: addCount += indexSimpleRecord(d); } } } curC.finishInput(); System.out.println("./" + inputFile.getParent().getFileName().toString() + File.separator + inputFile.getFileName().toString() + "\t" + addCount); } catch (IOException ioe) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected IOException:", ioe); } } }</code><technical_language>occurs name simply collection name a command-line parameter, add package prefix, instantiate w/ Class.forName. cleaner? get rid of Enum if-thens</technical_language>

Target:
public void run() { { try { int addCount = 0; Collection curC = (Collection)Class.forName("io.anserini.index.collections."+collectionClass+"Collection").newInstance(); curC.prepareInput(inputFile); while (curC.hasNext()) { Indexable d = (Indexable)curC.next(); if (d != null) { addCount += indexRecord(d); } } curC.finishInput(); System.out.println("./" + inputFile.getParent().getFileName().toString() + File.separator + inputFile.getFileName().toString() + "\t" + addCount); } catch (IOException ioe) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected IOException:", ioe); } catch (ClassNotFoundException cfe) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected ClassNotFoundException:", cfe); } catch (IllegalAccessException iae) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected IllegalAccessException:", iae); } catch (InstantiationException ie) { LOG.error(Thread.currentThread().getName() + ": ERROR: unexpected InstantiationException:", ie); } } }
Source:
<code>protected void determineRailDirection() { <START> EnumRailDirection dir = TrackTools.getTrackDirection(getWorld(), getPos()); <END> if (TrackTools.isRailBlockAt(getWorld(), getPos().east()) && TrackTools.isRailBlockAt(getWorld(), getPos().west())) { if (dir != EnumRailDirection.EAST_WEST) TrackTools.setTrackDirection(getWorld(), getPos(), EnumRailDirection.EAST_WEST); } else if (dir != EnumRailDirection.NORTH_SOUTH) TrackTools.setTrackDirection(getWorld(), getPos(), EnumRailDirection.NORTH_SOUTH); }</code><technical_language>This need raw function, infinite loop. I code hand check though</technical_language>

Target:
protected void determineRailDirection() { EnumRailDirection dir = TrackTools.getTrackDirectionRaw(getWorld().getBlockState(getPos())); if (TrackTools.isRailBlockAt(getWorld(), getPos().east()) && TrackTools.isRailBlockAt(getWorld(), getPos().west())) { if (dir != EnumRailDirection.EAST_WEST) TrackTools.setTrackDirection(getWorld(), getPos(), EnumRailDirection.EAST_WEST); } else if (dir != EnumRailDirection.NORTH_SOUTH) TrackTools.setTrackDirection(getWorld(), getPos(), EnumRailDirection.NORTH_SOUTH); }
Source:
<code>private void assertOpen() { if (status == State.CLOSED) { throw new IllegalStateException("Operations cannot be performed on closed TransactionManager."); } if (status == State.CLOSED_BY_CALLBACK_FAILURE) { throw new IllegalStateException("Operations cannot be performed on closed TransactionManager." <START> + " Closed due to a callback throw.", callbackException); <END> } }</code><technical_language>throw -> failure exception</technical_language>

Target:
private void assertOpen() { if (status == State.CLOSED) { throw new IllegalStateException("Operations cannot be performed on closed TransactionManager."); } if (status == State.CLOSED_BY_CALLBACK_FAILURE) { throw new IllegalStateException("Operations cannot be performed on closed TransactionManager." + " Closed due to a callback failure.", callbackThrowable); } }
Source:
<code>public void deleteNetworkInterfaceCardResourceDoesNotExist() { final NetworkInterfaceCardApi nicApi = api.getNetworkInterfaceCardApi(resourcegroup); <START> URI uri = nicApi.delete(NETWORKINTERFACECARD_NAME); <END> if (uri != null) { assertTrue(uri.toString().contains("api-version")); assertTrue(uri.toString().contains("operationresults")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.FAILED == api.getJobApi().jobStatus(uri); } }, 60 * 2 * 1000 ).apply(uri); assertTrue(jobDone, "delete operation did not complete in the configured timeout"); } }</code><technical_language>expect this test return null, assert URI is null forget rest.</technical_language>

Target:
public void deleteNetworkInterfaceCardResourceDoesNotExist() { final NetworkInterfaceCardApi nicApi = api.getNetworkInterfaceCardApi(resourcegroup); URI uri = nicApi.delete(NETWORKINTERFACECARD_NAME); assertNull(uri); }
Source:
<code>public void testGetAllVariablesWithExclusionsForReporters() { MetricRegistry registry = TestingMetricRegistry.builder().setNumberReporters(2).build(); AbstractMetricGroup<?> group = new GenericMetricGroup(registry, null, "test") { @Override protected void putVariables(Map<String, String> variables) { variables.put("k1", "v1"); variables.put("k2", "v2"); } }; group.getAllVariables(-1, Collections.emptySet()); assertThat(group.getAllVariables(0, Collections.singleton("k1")), not(IsMapContaining.hasKey("k1"))); <START> assertThat(group.getAllVariables(0, Collections.singleton("k1")), (IsMapContaining.hasKey("k2"))); assertThat(group.getAllVariables(1, Collections.singleton("k2")), (IsMapContaining.hasKey("k1"))); <END> assertThat(group.getAllVariables(1, Collections.singleton("k2")), not(IsMapContaining.hasKey("k2"))); }</code><technical_language>a minor thing, I remove brackets IsMapContaining.hasKey(..) code more readable</technical_language>

Target:
public void testGetAllVariablesWithExclusionsForReporters() { MetricRegistry registry = TestingMetricRegistry.builder().setNumberReporters(2).build(); AbstractMetricGroup<?> group = new GenericMetricGroup(registry, null, "test") { @Override protected void putVariables(Map<String, String> variables) { variables.put("k1", "v1"); variables.put("k2", "v2"); } }; group.getAllVariables(-1, Collections.emptySet()); assertThat(group.getAllVariables(0, Collections.singleton("k1")), not(IsMapContaining.hasKey("k1"))); assertThat(group.getAllVariables(0, Collections.singleton("k1")), IsMapContaining.hasKey("k2")); assertThat(group.getAllVariables(1, Collections.singleton("k2")), IsMapContaining.hasKey("k1")); assertThat(group.getAllVariables(1, Collections.singleton("k2")), not(IsMapContaining.hasKey("k2"))); }
Source:
<code>public static String decodeUriPath(String path) { if (path == null) { return null; } try { <START> return URLDecoder.decode(path.replace("+", "%2B"), "UTF-8"); <END> } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }</code><technical_language>I Charsets.UTF_8 some avoid try catch</technical_language>

Target:
public static String decodeUriPath(String path) { if (path == null) { return null; } try { return URLDecoder.decode(path.replace("+", "%2B"), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
<code><START> public void reset() { <END> pathTextField.setText(null); j2GBBreakupRadioButton.setSelected(true); }</code><technical_language>this method need public</technical_language>

Target:
void reset() { pathTextField.setText(null); j2GBBreakupRadioButton.setSelected(true); }
Source:
<code><START> public void switchToNewUser(String jwt, String url) { <END> switchToNewUserInternal(jwt, url); }</code><technical_language>Remove this</technical_language>

Target:
public void switchToNewUser(String jwt, String url) { if (TextUtils.isEmpty(jwt) || TextUtils.isEmpty(url)) { super.switchToNewUser(); } else { super.switchToNewUser(jwt, url); } final UserAccount userAccount = SmartSyncUserAccountManager.getInstance().getCurrentUser(); CacheManager.softReset(userAccount); MetadataManager.reset(userAccount); }
Source:
<code>public void captureFile(Path src, Digest digest, boolean isActionCache) throws IOException { Path target = toPath(digest.getHash(), isActionCache); <START> ensureParentExists(target); <END> src.renameTo(target); }</code><technical_language>Path a method called createDirectoryAndParents. instead</technical_language>

Target:
public void captureFile(Path src, Digest digest, boolean isActionCache) throws IOException { Path target = toPath(digest.getHash(), isActionCache); target.getParentDirectory().createDirectoryAndParents(); src.renameTo(target); }
Source:
<code>public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!server.getPluginManager().isPluginEnabled("Essentials")) { playerMsg("Essentials is not enabled on this server"); return true; } TFM_Util.adminAction(sender.getName(), "Wiping Essentials Warps", true); <START> <END> TFM_Util.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "warps")); playerMsg("All Warps deleted."); return true; }</code><technical_language>I nitpicking here, lowercase 'W'</technical_language>

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (!server.getPluginManager().isPluginEnabled("Essentials")) { playerMsg("Essentials is not enabled on this server"); return true; } TFM_Util.adminAction(sender.getName(), "Wiping Essentials warps", true); TFM_Util.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "warps")); playerMsg("All Warps deleted."); return true; }
Source:
<code>public static String[] getStringValuesFromDatabaseForInternalRoles(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try(PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt) ) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try (ResultSet rs = prepStmt.executeQuery()) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); String domain = rs.getString(2); if (domain != null) { name = UserCoreUtil.addDomainToName(name, domain); } <START> lst.add(name); <END> } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } }</code><technical_language>try-with-resource pattern automatically handles ResultSet PreparedStatement objects, Connection, "dbConnection" in this scope, needs closed "DatabaseUtil.closeAllConnections(dbConnection);"</technical_language>

Target:
public static String[] getStringValuesFromDatabaseForInternalRoles(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try(PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt) ) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try (ResultSet rs = prepStmt.executeQuery()) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); String domain = rs.getString(2); if (domain != null) { name = UserCoreUtil.addDomainToName(name, domain); } lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); }finally { close(dbConnection); } }
Source:
<code>public void syncAssetNodes() { List<String> syncPaths = new ArrayList<>(); syncPaths.addAll(this.remoteAssetsConfig.getTagSyncPaths()); syncPaths.addAll(this.remoteAssetsConfig.getDamSyncPaths()); try { <START> for (String syncPath : syncPaths) { <END> this.session.refresh(true); JSONObject topLevelJson = getJsonFromUri(syncPath); Node topLevelSyncNode = getOrCreateNode(syncPath, (String) topLevelJson.get(JcrConstants.JCR_PRIMARYTYPE)); createOrUpdateNodes(topLevelJson, topLevelSyncNode); this.session.save(); } } catch (IOException e) { LOG.error("IO Exception {}", e); } catch (JSONException e) { LOG.error("Json Exception {}", e); } catch (RepositoryException e) { LOG.error("Repository Exception {}", e); } }</code><technical_language>this is creates "remove asset nodes"... is this assets reside in syncPath folder? this feature descend folder sub-tree</technical_language>

Target:
public void syncAssetNodes() { ResourceResolver remoteAssetsResolver = this.remoteAssetsConfig.getResourceResolver(); try { List<String> syncPaths = new ArrayList<>(); syncPaths.addAll(this.remoteAssetsConfig.getTagSyncPaths()); syncPaths.addAll(this.remoteAssetsConfig.getDamSyncPaths()); for (String syncPath : syncPaths) { LOG.info("Starting sync of nodes for {}", syncPath); remoteAssetsResolver.refresh(); JsonObject topLevelJsonWithChildren = getJsonFromUri(syncPath); String resourcePrimaryType = topLevelJsonWithChildren.getAsJsonPrimitive(JcrConstants.JCR_PRIMARYTYPE).getAsString(); Resource topLevelSyncResource = getOrCreateNode(remoteAssetsResolver, syncPath, resourcePrimaryType); createOrUpdateNodes(remoteAssetsResolver, topLevelJsonWithChildren, topLevelSyncResource); remoteAssetsResolver.commit(); LOG.info("Completed sync of nodes for {}", syncPath); } } catch (Exception e) { LOG.error("Unexpected error sync'ing remote asset nodes", e); } finally { this.remoteAssetsConfig.closeResourceResolver(remoteAssetsResolver); } }
Source:
<code>public Client resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, final NativeWebRequest request, final WebDataBinderFactory binderFactory) throws Exception { <START> final Optional<String> clientId = Optional.ofNullable(authorizationService.getSubject().isPresent() ? <END> authorizationService.getSubject().get().getName():"unauthenticated"); if (clientId.filter(settings.getAdminClientId()::equals).isPresent() || settings.getAuthMode() == OFF) { return new FullAccessClient(clientId.orElse(FULL_ACCESS_CLIENT_ID)); } return clientId.map(client -> new NakadiClient(client, getRealm())) .orElseThrow(() -> new UnauthorizedUserException("Client unauthorized")); }</code><technical_language>If a longer Optional, right</technical_language>

Target:
public Client resolveArgument(final MethodParameter parameter, final ModelAndViewContainer mavContainer, final NativeWebRequest request, final WebDataBinderFactory binderFactory) { final String clientId = authorizationService.getSubject().map(Subject::getName) .orElse(SecuritySettings.UNAUTHENTICATED_CLIENT_ID); if(settings.getAuthMode() == OFF) { return new FullAccessClient(clientId); } else { if (clientId.equals(settings.getAdminClientId())) { return new FullAccessClient(FULL_ACCESS_CLIENT_ID); } else if (!authorizationService.getSubject().isPresent()) { throw new UnauthorizedUserException("Client unauthorized"); } else { return new NakadiClient(clientId, getRealm()); } } }
Source:
<code>private String getPrintedJndiTree(ByteArrayOutputStream buffer) { try { <START> return buffer.toString("utf-8"); <END> } catch (UnsupportedEncodingException e) { return null; } }</code><technical_language>a constant. :warning: buffer.toString(StandardCharsets.UTF_8.name()); <LINK_0></technical_language>

Target:
private String getPrintedJndiTree(ByteArrayOutputStream buffer) { try { return buffer.toString(StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { return null; } }
Source:
<code>private static byte[] compress(final byte[] raw) throws IOException { <START> final ByteArrayOutputStream out = new ByteArrayOutputStream(); <END> final GZIPOutputStream gz = new GZIPOutputStream(out); gz.write(raw); gz.finish(); gz.flush(); return out.toByteArray(); }</code><technical_language>Worth initializing raw.length+32, save in-line expansion writing out byte array</technical_language>

Target:
private static byte[] compress(final byte[] raw) throws IOException { final int maxLen = raw.length + 32; final ByteArrayOutputStream out = new ByteArrayOutputStream(maxLen); final GZIPOutputStream gz = new GZIPOutputStream(out); gz.write(raw); gz.finish(); gz.flush(); return out.toByteArray(); }
Source:
<code>private void assertMatchesEvery(ImmutableSet<InboxMessage> messages, CatchUp job) { for (InboxMessage message : messages) { assertThat(CatchUpStation.matches(job, message)) .isTrue(); <START> <END> } }</code><technical_language>Please remove this empty line</technical_language>

Target:
private void assertMatchesEvery(ImmutableSet<InboxMessage> messages, CatchUp job) { for (InboxMessage message : messages) { assertThat(job.matches(message)) .isTrue(); } }
Source:
<code>public void testRepeater() throws Exception { Task<?> t; t = Tasks.requiring(Repeater.create().until(Callables.returning(true)).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); <START> t.get(Duration.ONE_SECOND); <END> t = Tasks.testing(Repeater.create().until(Callables.returning(true)).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); Assert.assertEquals(t.get(Duration.ONE_SECOND), true); t = Tasks.requiring(Repeater.create().until(Callables.returning(false)).limitIterationsTo(2).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); try { t.get(Duration.ONE_SECOND); Assert.fail("Should have failed"); } catch (Exception e) { } t = Tasks.testing(Repeater.create().until(Callables.returning(false)).limitIterationsTo(2).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); Assert.assertEquals(t.get(Duration.ONE_SECOND), false); }</code><technical_language>short timeouts in non-integration tests. timing out in cloudbees, presume in apace jenkins. this is a performance test, set higher (e.g. 30 seconds)</technical_language>

Target:
public void testRepeater() throws Exception { Task<?> t; t = Tasks.requiring(Repeater.create().until(Callables.returning(true)).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); t.get(Duration.TEN_SECONDS); t = Tasks.testing(Repeater.create().until(Callables.returning(true)).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); Assert.assertEquals(t.get(Duration.TEN_SECONDS), true); t = Tasks.requiring(Repeater.create().until(Callables.returning(false)).limitIterationsTo(2).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); try { t.get(Duration.TEN_SECONDS); Assert.fail("Should have failed"); } catch (Exception e) { } t = Tasks.testing(Repeater.create().until(Callables.returning(false)).limitIterationsTo(2).every(Duration.millis(1))).build(); app.getExecutionContext().submit(t); Assert.assertEquals(t.get(Duration.TEN_SECONDS), false); }
Source:
<code>private int selectNextReadingInputIndex() throws IOException { updateAvailability(); checkInputSelectionAgainstIsFinished(); <START> if (inputSelectionHandler.isInputUnavailable(0) && inputSelectionHandler.isInputUnavailable(1)) { fullCheckAndSetAvailable(); } <END> int readingInputIndex = inputSelectionHandler.selectNextInputIndex(lastReadInputIndex); if (readingInputIndex == InputSelection.NONE_AVAILABLE) { return InputSelection.NONE_AVAILABLE; } if (inputSelectionHandler.shouldSetAvailableForAnotherInput()) { checkAndSetAvailable(1 - readingInputIndex); } return readingInputIndex; }</code><technical_language>explained above, StreamTwoInputProcessor#updateAvailability() do trick (% starvation check in L181)</technical_language>

Target:
private int selectNextReadingInputIndex() throws IOException { updateAvailability(); checkInputSelectionAgainstIsFinished(); int readingInputIndex = inputSelectionHandler.selectNextInputIndex(lastReadInputIndex); if (readingInputIndex == InputSelection.NONE_AVAILABLE) { return InputSelection.NONE_AVAILABLE; } if (inputSelectionHandler.shouldSetAvailableForAnotherInput()) { checkAndSetAvailable(1 - readingInputIndex); } return readingInputIndex; }
Source:
<code>private boolean pathMatch() { Byte[] curr; int size = 0; try { outputStream.close(); outputStream = new ByteArrayOutputStream(); for (Byte[] bb : allKeys) { <START> if (bb[0] == 0x19) { <END> size = size + 9; } else { size = size + ArrayUtils.toPrimitive(bb).length; } outputStream.write(ArrayUtils.toPrimitive(bb)); } } catch (IOException e1) { e1.printStackTrace(); } curr = ArrayUtils.toObject(Arrays.copyOfRange(outputStream.toByteArray(), 0, size)); boolean contains = false; this.matched = false; Byte[] prefix; for (Byte[] path : paths) { if (path.length < curr.length) { prefix = Arrays.copyOfRange(curr, 0, path.length); contains = contains || Arrays.equals(prefix, path); } else { prefix = Arrays.copyOfRange(path, 0, curr.length); contains = contains || Arrays.equals(prefix, curr); } if (path.length == curr.length && contains) { this.objectMatchLevel = this.levelObject; this.matched = true; this.literal = false; } } return contains; }</code><technical_language>Again, 9 19</technical_language>

Target:
private boolean pathMatch() { outputStream.reset(); for (Byte[] bb : allKeys) { outputStream.write(ArrayUtils.toPrimitive(bb), 0, ArrayUtils.toPrimitive(bb).length); } boolean contains = false; this.matched = false; prefixStream.reset(); if (pathStream.size() < outputStream.size()) { prefixStream.write(outputStream.toByteArray(), 0, pathStream.size()); contains = Arrays.equals(prefixStream.toByteArray(), pathStream.toByteArray()); } else { prefixStream.write(pathStream.toByteArray(), 0, outputStream.size()); contains = Arrays.equals(prefixStream.toByteArray(), outputStream.toByteArray()); } if (pathStream.size() == outputStream.size() && contains) { this.objectMatchLevel = this.levelObject; this.matched = true; this.literal = false; } return contains; }
Source:
<code><START> public static SyncConfiguration automatic() { <END> SyncUser user = SyncUser.currentUser(); if (user == null) { throw new IllegalStateException("No user was logged in."); } return getDefaultConfig(user); }</code><technical_language>default automatic naming. "default" feels a more static, while "automatic" is more active. returned configuration change calls due actions (changing active user), more active term felt a fit. This perception is subjective, though. worth noting is Cocoa's SyncConfiguration.automatic() returns a Realm.Configuration, a SyncConfiguration. done minimize amount of code required returned configuration. if this is applicable Java not, I examples of API used</technical_language>

Target:
public static SyncConfiguration automatic() { SyncUser user = SyncUser.current(); if (user == null) { throw new IllegalStateException("No user was logged in."); } return getDefaultConfig(user); }