auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testResourceLoadingAtOpenSession() throws Exception { SessionManager.INSTANCE.addSessionsListener(new SessionManagerListener.Stub() { @Override public void notify(Session updated, int notification) { super.notify(updated, notification); if (notification == SessionListener.OPENING) { ResourceSet resourceSet = session.getTransactionalEditingDomain().getResourceSet(); EList<Resource> resources = resourceSet.getResources(); assertEquals("Wrong number of ResourceSet resources at SessionListener.OPENING notification", 2, resources.size()); } } @Override public void notifyAddSession(Session newSession) { ResourceSet resourceSet = session.getTransactionalEditingDomain().getResourceSet(); EList<Resource> resources = resourceSet.getResources(); assertEquals("Wrong number of ResourceSet resources at notifyAddSession", 1, resources.size()); } }); copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, PATH, AIRD_MODEL_FILENAME, SEMANTIC_MODEL_FILENAME); URI sessionResourceURI = URI.createPlatformResourceURI("/" + TEMPORARY_PROJECT_NAME + "/" + AIRD_MODEL_FILENAME, true); session = SessionFactory.INSTANCE.createSession(sessionResourceURI, new NullProgressMonitor()); session.open(new NullProgressMonitor()); }

Target:
public void testResourceLoadingAtOpenSession() throws Exception { copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, PATH, AIRD_MODEL_FILENAME, SEMANTIC_MODEL_FILENAME); URI sessionResourceURI = URI.createPlatformResourceURI("/" + TEMPORARY_PROJECT_NAME + "/" + AIRD_MODEL_FILENAME, true); session = SessionFactory.INSTANCE.createSession(sessionResourceURI, new NullProgressMonitor()); session.open(new NullProgressMonitor()); }
Source:
public void arrayOverridenInYaml() throws Exception { Map<String, Object> twoMap = new LinkedHashMap<String, Object>(); twoMap.put("a.b[0]", "f"); twoMap.put("a.b[1]", "h"); this.environment.add(new PropertySource("two", twoMap)); Map<String, Object> oneMap = new LinkedHashMap<String, Object>(); oneMap.put("a.b[0]", "c"); oneMap.put("a.b[1]", "d"); oneMap.put("a.b[2]", "z"); this.environment.add(new PropertySource("one", oneMap)); Mockito.when(this.repository.findOne("foo", "bar", null)).thenReturn(this.environment); String yaml = this.controller.yaml("foo", "bar", false).getBody(); assertEquals("a:\n b:\n - f\n - h\n", yaml); }

Target:
public void arrayOverridenInYaml() throws Exception { Map<String, Object> oneMap = new LinkedHashMap<String, Object>(); oneMap.put("a.b[0]", "c"); oneMap.put("a.b[1]", "d"); oneMap.put("a.b[2]", "z"); this.environment.add(new PropertySource("one", oneMap)); Map<String, Object> twoMap = new LinkedHashMap<String, Object>(); twoMap.put("a.b[0]", "f"); twoMap.put("a.b[1]", "h"); this.environment.addFirst(new PropertySource("two", twoMap)); Mockito.when(this.repository.findOne("foo", "bar", null)).thenReturn(this.environment); String yaml = this.controller.yaml("foo", "bar", false).getBody(); assertEquals("a:\n b:\n - f\n - h\n", yaml); }
Source:
private String removeNonAlphanumericChars(final String answer, final String rule) { String strippedAnswer = answer; List<String> nonAlphanumericCharsNotInRule = NON_ALPHANUMERIC_CHARS.codePoints() .mapToObj(nonAlphaCodePoint -> String.valueOf((char) nonAlphaCodePoint)) .filter(nonAlphaString -> !rule.contains(nonAlphaString)) .collect(Collectors.toList()); for (String nonAlphanumericChar : nonAlphanumericCharsNotInRule) { strippedAnswer = strippedAnswer.replace(nonAlphanumericChar, " "); } return strippedAnswer; }

Target:
private String removeNonAlphanumericChars(final String answer, final String rule) { String strippedAnswer = answer; for (char nonAlphanumericChar : NON_ALPHANUMERIC_CHARS.toCharArray()) { String nonAlphanumericCharStr = String.valueOf(nonAlphanumericChar); if (!rule.contains(nonAlphanumericCharStr)) { strippedAnswer = strippedAnswer.replace(nonAlphanumericCharStr, " "); } } return strippedAnswer; }
Source:
public ValidationResult validateUniqueId() { if (StringUtils.isBlank(host.getUniqueId()) && Config.<Boolean> getValue(ConfigValues.InstallVds)) { return new ValidationResult(VdcBllMessages.VDS_NO_UUID); } return ValidationResult.VALID; }

Target:
public ValidationResult validateUniqueId() { return ValidationResult.failWith(VdcBllMessages.VDS_NO_UUID) .when(StringUtils.isBlank(host.getUniqueId()) && Config.<Boolean> getValue(ConfigValues.InstallVds)); }
Source:
public void execute(Environment environment, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { Map<String, String> outputParams = new HashMap<>(); HttpRequestParametersHashModel requestParams = (HttpRequestParametersHashModel) params.get("params"); TemplateModelIterator iter = requestParams.keys().iterator(); while (iter.hasNext()) { String key = iter.next().toString(); TemplateModel value = requestParams.get(key); outputParams.put(key, value.toString()); } Object name = params.get("name"); if (name != null) { outputParams.put(name.toString(), params.get("value").toString()); } List<NameValuePair> paramList = new ArrayList<>(outputParams.size()); for (Object key : outputParams.keySet()) { paramList.add(new BasicNameValuePair((String) key, outputParams.get(key))); } environment.getOut().write(URLEncodedUtils.format(paramList, "UTF-8")); }

Target:
public void execute(Environment environment, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { Map<String, String> outputParams = new HashMap<>(); HttpRequestParametersHashModel requestParams = (HttpRequestParametersHashModel) params.get("params"); TemplateModelIterator iter = requestParams.keys().iterator(); while (iter.hasNext()) { String key = iter.next().toString(); TemplateModel value = requestParams.get(key); outputParams.put(key, value.toString()); } Object name = params.get("name"); if (name != null) { outputParams.put(name.toString(), params.get("value").toString()); } List<NameValuePair> paramList = new ArrayList<>(outputParams.size()); for (String key : outputParams.keySet()) { paramList.add(new BasicNameValuePair(key, outputParams.get(key))); } environment.getOut().write(URLEncodedUtils.format(paramList, "UTF-8")); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DefaultAccessRule other = (DefaultAccessRule) obj; if (discouraged != other.discouraged) return false; if (pattern == null) { if (other.pattern != null) return false; } else if (!pattern.equals(other.pattern)) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof AccessRule)) { return false; } AccessRule other = (AccessRule) obj; return isDiscouraged() == other.isDiscouraged() && getPattern().equals(other.getPattern()); }
Source:
public void addVariable(String variable, String type) { if (variables.containsKey(variable)) { String existingType = variables.get(variable); if (!existingType.equals(type)) { valid = false; errors.add("Wrong type for variable task variable '" + variable + "': expected type was '" + existingType + "' but received '" + type + "'."); } } else { variables.put(variable, type); } }

Target:
public void addVariable(String variable, String type) { addVariable(Optional.empty(), variable, type); }
Source:
public ConfigSaveState updateFullConfig(FullConfigUpdateCommand command) { ConfigSaveState configSaveState; LOGGER.info("Config update request by is in queue - {}", UserHelper.getUserName().getUsername(), command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update request by is being processed", UserHelper.getUserName().getUsername()); configSaveState = cachedConfigService.writeFullConfigWithLock(command); } catch (Exception e) { LOGGER.info("Full config update failed", e); throw e; } finally { LOGGER.info("Config update request by is completed", UserHelper.getUserName().getUsername()); } } return configSaveState; }

Target:
public ConfigSaveState updateFullConfig(FullConfigUpdateCommand command) { ConfigSaveState configSaveState; LOGGER.info("Config update request by is in queue - {}", UserHelper.getUserName().getUsername(), command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update request by is being processed", UserHelper.getUserName().getUsername()); configSaveState = cachedConfigService.writeFullConfigWithLock(command); } catch (Exception e) { LOGGER.error("Full config update failed", e); throw e; } finally { LOGGER.info("Config update request by is completed", UserHelper.getUserName().getUsername()); } } return configSaveState; }
Source:
public void setLastSnapshotTransferCompleteTimestamp(long topologyConfigId, long ts) { CorfuStoreMetadata.Timestamp timestamp = corfuStore.getTimestamp(); long persistedTopologyConfigId = query(timestamp, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID); long persistedSnapshotStart = query(timestamp, LogReplicationMetadataType.LAST_SNAPSHOT_STARTED); log.debug("setLastSnapTransferDone snapshotStart topologyConfigId={}, ts={}, persistedTopologyConfigID={}," + " persistedSiteConfigID={}, persistedSnapshotStart={}", topologyConfigId, ts, persistedTopologyConfigId, persistedSnapshotStart); if (topologyConfigId != persistedTopologyConfigId || ts <= persistedTopologyConfigId) { log.warn("Metadata mismatch, persisted={}, intended={}. Snapshot Transfer complete timestamp " + "will not be persisted, current={}", persistedTopologyConfigId, topologyConfigId, ts, persistedSnapshotStart); return; } TxBuilder txBuilder = corfuStore.tx(NAMESPACE); appendUpdate(txBuilder, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID, topologyConfigId); appendUpdate(txBuilder, LogReplicationMetadataType.LAST_SNAPSHOT_TRANSFERRED, ts); txBuilder.commit(timestamp); log.debug("Commit snapshot transfer complete timestamp={}, for topologyConfigId={}", ts, topologyConfigId); }

Target:
public void setLastSnapshotTransferCompleteTimestamp(long topologyConfigId, long ts) { CorfuStoreMetadata.Timestamp timestamp = corfuStore.getTimestamp(); long persistedTopologyConfigId = query(timestamp, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID); long persistedSnapshotStart = query(timestamp, LogReplicationMetadataType.LAST_SNAPSHOT_STARTED); log.debug("Update last snapshot transfer completed, topologyConfigId={}, transferCompleteTs={}," + " persistedTopologyConfigID={}, persistedSnapshotStart={}", topologyConfigId, ts, persistedTopologyConfigId, persistedSnapshotStart); if (topologyConfigId != persistedTopologyConfigId || ts < persistedSnapshotStart) { log.warn("Metadata mismatch, persisted={}, intended={}. Snapshot Transfer complete timestamp " + "will not be persisted, current={}", persistedTopologyConfigId, topologyConfigId, ts, persistedSnapshotStart); return; } TxBuilder txBuilder = corfuStore.tx(NAMESPACE); appendUpdate(txBuilder, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID, topologyConfigId); appendUpdate(txBuilder, LogReplicationMetadataType.LAST_SNAPSHOT_TRANSFERRED, ts); txBuilder.commit(timestamp); log.debug("Commit snapshot transfer complete timestamp={}, for topologyConfigId={}", ts, topologyConfigId); }
Source:
<IO> VersionOrdinal getVersionForDataStream(final IO in) { if (in instanceof VersionedDataStream) { final VersionOrdinal v = ((VersionedDataStream) in).getVersion(); return v != null ? v : Version.getCurrentVersion(); } else { return Version.getCurrentVersion(); } }

Target:
<IO> Version getVersionForDataStream(final IO in) { if (in instanceof VersionedDataStream) { final Version v = ((VersionedDataStream) in).getVersion(); return v != null ? v : Version.getCurrentVersion(); } else { return Version.getCurrentVersion(); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); final boolean isUserProfileEnabled = environment.getConfig().isUserProfilesEnabled(); if (isUserProfileEnabled) { profile = loginPrefs.getCurrentUserProfile(); if (profile != null) { sendGetUpdatedAccountCall(); } } if (!isUserProfileEnabled) { toolbarCallbacks.getProfileView().setVisibility(View.GONE); } EventBus.getDefault().register(this); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); EventBus.getDefault().register(this); }
Source:
public void testImportMultiFilesPKViolations() throws Exception { try(PreparedStatement ps = methodWatcher.prepareStatement(format("call SYSCS_UTIL.IMPORT_DATA(" + "'%s'," + "'%s'," + "null," + "'%s'," + "','," + "null," + "null," + "null," + "null," + "-1," + "'%s'," + "'true'," + "null)", spliceSchemaWatcher.schemaName,multiPK.tableName, getResourceDirectory()+"/multiFilePKViolation", BADDIR.getCanonicalPath()))){ try (ResultSet rs = ps.executeQuery()) { assertTrue(rs.next()); int failed = rs.getInt(2); assertEquals("Failed rows don't match", 4, failed); boolean exists = existsBadFile(BADDIR, "multiFilePKViolation.bad"); List<String> badFiles = getAllBadFiles(BADDIR, "multiFilePKViolation.bad"); assertTrue("Bad file " +badFiles+" does not exist.",exists); List<String> badLines = new ArrayList<>(); for(String badFile : badFiles) { badLines.addAll(Files.readAllLines((new File(BADDIR, badFile)).toPath(), Charset.defaultCharset())); } assertTrue("Expected some lines in bad files "+badFiles, badLines.size()==4); } } try(ResultSet rs = methodWatcher.executeQuery("select count(*) from "+multiPK)){ Assert.assertTrue("Did not return a row!",rs.next()); long c = rs.getLong(1); Assert.assertEquals("Incorrect row count!",9,c); Assert.assertFalse("Returned too many rows!",rs.next()); } }

Target:
public void testImportMultiFilesPKViolations() throws Exception { try(PreparedStatement ps = methodWatcher.prepareStatement(format("call SYSCS_UTIL.IMPORT_DATA(" + "'%s'," + "'%s'," + "null," + "'%s'," + "','," + "null," + "null," + "null," + "null," + "-1," + "'%s'," + "'true'," + "null)", spliceSchemaWatcher.schemaName,multiPK.tableName, getResourceDirectory()+"/multiFilePKViolation", BADDIR.getCanonicalPath()))){ try (ResultSet rs = ps.executeQuery()) { assertTrue(rs.next()); int failed = rs.getInt(2); assertEquals("Failed rows don't match", 4, failed); boolean exists = existsBadFile(BADDIR, "multiFilePKViolation.bad"); List<String> badFiles = getAllBadFiles(BADDIR, "multiFilePKViolation.bad"); assertTrue("Bad file " +badFiles+" does not exist.",exists); List<String> badLines = new ArrayList<>(); for(String badFile : badFiles) { badLines.addAll(Files.readAllLines((new File(BADDIR, badFile)).toPath(), Charset.defaultCharset())); } assertEquals("Expected some lines in bad files "+badFiles, 4, badLines.size()); } } try(ResultSet rs = methodWatcher.executeQuery("select count(*) from "+multiPK)){ Assert.assertTrue("Did not return a row!",rs.next()); long c = rs.getLong(1); Assert.assertEquals("Incorrect row count!",9,c); Assert.assertFalse("Returned too many rows!",rs.next()); } }
Source:
public static List<PluginData> listPluginsAndRemoveTempFiles(SitePaths site) throws IOException { return listPlugins(site, false); }

Target:
public static List<PluginData> listPluginsAndRemoveTempFiles(SitePaths site) throws IOException { return listPlugins(site, true); }
Source:
public synchronized void step() { tree.rebuild(layoutModel.getGraph().nodes(), layoutModel); super.step(); }

Target:
public synchronized void step() { tree.rebuild(layoutModel); super.step(); }
Source:
public void start() { config.load(); consoleManager.setupConsole(); opsList.load(); whitelist.load(); banManager.load(); loadPlugins(); DefaultPermissions.registerCorePermissions(); SpoutCommandMap.initSpoutPermissions(this); commandMap.register(new MeCommand(this)); commandMap.register(new ColorCommand(this)); commandMap.register(new KickCommand(this)); commandMap.register(new ListCommand(this)); commandMap.register(new TimeCommand(this)); commandMap.register(new WhitelistCommand(this)); commandMap.register(new BanCommand(this)); commandMap.register(new GameModeCommand(this)); commandMap.register(new OpCommand(this)); commandMap.register(new DeopCommand(this)); commandMap.register(new StopCommand(this)); commandMap.register(new SaveCommand(this)); commandMap.register(new SayCommand(this)); commandMap.removeAllOfType(ReloadCommand.class); commandMap.register(new ReloadCommand(this)); commandMap.register(new GiveCommand(this)); commandMap.register(new HelpCommand(this, commandMap.getKnownCommands(false))); enablePlugins(PluginLoadOrder.STARTUP); String world = config.getString("server.world-name", "world"); createWorld(WorldCreator.name(world).environment(Environment.NORMAL)); if (getAllowNether()) { createWorld(WorldCreator.name(world + "_nether").environment(Environment.NETHER)); } if (getAllowEnd()) { createWorld(WorldCreator.name(world + "_the_end").environment(Environment.THE_END)); } enablePlugins(PluginLoadOrder.POSTWORLD); commandMap.registerServerAliases(); consoleManager.refreshCommands(); }

Target:
public void start() { config.load(); consoleManager.setupConsole(); opsList.load(); whitelist.load(); banManager.load(); loadPlugins(); DefaultPermissions.registerCorePermissions(); SpoutCommandMap.initSpoutPermissions(this); commandMap.register(new MeCommand(this)); commandMap.register(new ColorCommand(this)); commandMap.register(new KickCommand(this)); commandMap.register(new ListCommand(this)); commandMap.register(new TimeCommand(this)); commandMap.register(new WhitelistCommand(this)); commandMap.register(new BanCommand(this)); commandMap.register(new GameModeCommand(this)); commandMap.register(new OpCommand(this)); commandMap.register(new DeopCommand(this)); commandMap.register(new StopCommand(this)); commandMap.register(new SaveCommand(this)); commandMap.register(new SayCommand(this)); commandMap.register(new TpCommand(this)); commandMap.removeAllOfType(ReloadCommand.class); commandMap.register(new ReloadCommand(this)); commandMap.register(new GiveCommand(this)); commandMap.register(new HelpCommand(this, commandMap.getKnownCommands(false))); enablePlugins(PluginLoadOrder.STARTUP); String world = config.getString("server.world-name", "world"); createWorld(WorldCreator.name(world).environment(Environment.NORMAL)); if (getAllowNether()) { createWorld(WorldCreator.name(world + "_nether").environment(Environment.NETHER)); } if (getAllowEnd()) { createWorld(WorldCreator.name(world + "_the_end").environment(Environment.THE_END)); } enablePlugins(PluginLoadOrder.POSTWORLD); commandMap.registerServerAliases(); consoleManager.refreshCommands(); }
Source:
public ValidationResult canAddRngDevice(VDSGroup cluster, VmRngDevice rngDevice) { VmRngDevice.Source source = rngDevice.getSource(); boolean supported = cluster != null && isFeatureSupported(cluster.getcompatibility_version()) && cluster.getRequiredRngSources().contains(source); if (supported) { return ValidationResult.VALID; } return new ValidationResult(VdcBllMessages.ACTION_NOT_SUPPORTED_FOR_CLUSTER_POOL_LEVEL); }

Target:
public ValidationResult canAddRngDevice(VDSGroup cluster, VmRngDevice rngDevice) { VmRngDevice.Source source = rngDevice.getSource(); boolean supported = cluster != null && isFeatureSupported(cluster.getcompatibility_version()) && cluster.getRequiredRngSources().contains(source); if (!supported) { return new ValidationResult(VdcBllMessages.ACTION_NOT_SUPPORTED_FOR_CLUSTER_POOL_LEVEL); } return ValidationResult.VALID; }
Source:
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { setSite(site); setInput(input); if (input instanceof FileEditorInput) { final FileEditorInput fileEI = (FileEditorInput) input; final IFile file = fileEI.getFile(); final IPath path = file.getFullPath(); final String pathStr = path.toString(); final URI uri = URI.createPlatformResourceURI(pathStr, true); this.resourceSet = new ResourceSetImpl(); this.resource = this.resourceSet.getResource(uri, true); } else if (input instanceof ResourceEditorInput) { final ResourceEditorInput resourceEI = (ResourceEditorInput) input; this.resource = resourceEI.getResource(); this.resourceSet = this.resource.getResourceSet(); } else if (input instanceof ResourceSetEditorInput) { final ResourceSetEditorInput resourceSetEI = (ResourceSetEditorInput) input; this.resourceSet = resourceSetEI.getResourceSet(); } if (this.resourceSet == null) { this.resourceSet = new ResourceSetImpl(); this.resourceSet.getResources().add(this.resource); } final AdapterFactory adapterFactory = new AdapterFactoryImpl(); final CommandStack commandStack = new BasicCommandStack(); this.editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, this.resourceSet); }

Target:
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { setSite(site); setInput(input); if (input instanceof FileEditorInput) { final FileEditorInput fileEI = (FileEditorInput) input; final IFile file = fileEI.getFile(); final IPath path = file.getFullPath(); final String pathStr = path.toString(); final URI uri = URI.createPlatformResourceURI(pathStr, true); this.resourceSet = new ResourceSetImpl(); this.resource = this.resourceSet.getResource(uri, true); } else if (input instanceof ResourceEditorInput) { final ResourceEditorInput resourceEI = (ResourceEditorInput) input; this.resource = resourceEI.getResource(); this.resourceSet = this.resource.getResourceSet(); } else if (input instanceof ResourceSetEditorInput) { final ResourceSetEditorInput resourceSetEI = (ResourceSetEditorInput) input; this.resourceSet = resourceSetEI.getResourceSet(); } if (this.resourceSet == null) { final String message = String .format("The EditorInput (%s) is not compatible with the TreeEditor", input.getClass().getName()); throw new IllegalArgumentException(message); } final AdapterFactory adapterFactory = new AdapterFactoryImpl(); final CommandStack commandStack = new BasicCommandStack(); this.editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, this.resourceSet); }
Source:
public void testSkippedMessageIsAddedWhenTheMessageAttributeIsNull() throws IOException, URISyntaxException { TestResult testResult = new TestResult(); testResult.parse(getDataFile("SKIPPED_MESSAGE/skippedTestResult.xml"), null); List<SuiteResult> suiteResults = new ArrayList<>(testResult.getSuites()); CaseResult caseResult = suiteResults.get(0).getCases().get(0); assertNotNull(caseResult.getSkippedMessage()); assertEquals("Given skip This Test........................................................pending\n", caseResult.getSkippedMessage()); }

Target:
public void testSkippedMessageIsAddedWhenTheMessageAttributeIsNull() throws IOException, URISyntaxException { TestResult testResult = new TestResult(); testResult.parse(getDataFile("SKIPPED_MESSAGE/skippedTestResult.xml"), null); List<SuiteResult> suiteResults = new ArrayList<>(testResult.getSuites()); CaseResult caseResult = suiteResults.get(0).getCases().get(0); assertEquals("Given skip This Test........................................................pending\n", caseResult.getSkippedMessage()); }
Source:
public Status scan(String table, String startKey, int recordCount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { Query<String, User> goraQuery = dataStore.newQuery(); goraQuery.setStartKey(startKey); goraQuery.setLimit(recordCount); Result<String, User> resultSet = goraQuery.execute(); while (resultSet.next()) { HashMap<String, ByteIterator> hm = new HashMap<>(); for (int i = 0; i < fieldCount; i++) { String field = FIELDS[i + 1]; int fieldIndex = i + 1; String value = resultSet.get().get(fieldIndex).toString(); hm.put(field, new StringByteIterator(value)); } result.add(hm); } } catch (Exception e) { LOG.info("There is a problem in scanning data from the table \n"+e.getMessage(), e); return Status.ERROR; } return Status.OK; }

Target:
public Status scan(String table, String startKey, int recordCount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { Query<String, User> goraQuery = dataStore.newQuery(); goraQuery.setStartKey(startKey); goraQuery.setLimit(recordCount); Result<String, User> resultSet = goraQuery.execute(); while (resultSet.next()) { HashMap<String, ByteIterator> resultsMap = new HashMap<>(); for (int fieldCount = 0; fieldCount < totalFieldCount; fieldCount++) { String field = FIELDS[fieldCount + 1]; int fieldIndex = fieldCount + 1; String value = resultSet.get().get(fieldIndex).toString(); resultsMap.put(field, new StringByteIterator(value)); } result.add(resultsMap); } } catch (Exception e) { LOG.info("There is a problem in scanning data from the table \n {}", e.getMessage(), e); return Status.ERROR; } return Status.OK; }
Source:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { FeedData feedData = feedsData.get(position); if (feedData == null) { ((FeedHeaderHolder) holder).bind(headersData.get(position)); } else { boolean isFirst = feedsData.get(position - 1) == null; boolean isLast = getItemCount() - 1 == position || feedsData.get(position + 1) == null; ((FeedHolder) holder).bind(feedData.getUserFeed(), feedData.getAvatarUrl(), isFirst, isLast); } }

Target:
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { FeedData feedData = feedsData.get(position); if (feedData == null) { ((FeedHeaderHolder) holder).bind(headersData.get(position)); } else { ((FeedHolder) holder).bind(feedData.getUserFeed(), feedData.getAvatarUrl(), feedsData.get(position - 1) == null, feedsData.get(position + 1) == null); } }
Source:
private IMethod[] getAllRippleMethods(IProgressMonitor pm, WorkingCopyOwner owner) throws CoreException { IMethod[] rippleMethods= findAllRippleMethods(pm, owner); if (fDeclarationToMatch == null) return rippleMethods; List<IMethod> rippleMethodsList= new ArrayList<>(Arrays.asList(rippleMethods)); List<IMethod> filteredMethods= new ArrayList<>(rippleMethodsList.size()); for (Iterator<IMethod> iter= rippleMethodsList.iterator(); iter.hasNext(); ) { IMethod currentMethod= iter.next(); Object match= fDeclarationToMatch.get(currentMethod); if (match != null) { filteredMethods.add(currentMethod); fBinaryRefs.add((SearchMatch) match); } } fDeclarationToMatch= null; return filteredMethods.toArray(new IMethod[filteredMethods.size()]); }

Target:
private IMethod[] getAllRippleMethods(IProgressMonitor pm, WorkingCopyOwner owner) throws CoreException { IMethod[] rippleMethods= findAllRippleMethods(pm, owner); if (fDeclarationToMatch == null) return rippleMethods; List<IMethod> rippleMethodsList= Arrays.asList(rippleMethods); List<IMethod> filteredMethods= new ArrayList<>(rippleMethodsList.size()); for (Iterator<IMethod> iter= rippleMethodsList.iterator(); iter.hasNext(); ) { IMethod currentMethod= iter.next(); Object match= fDeclarationToMatch.get(currentMethod); if (match != null) { fBinaryRefs.add((SearchMatch) match); } else { filteredMethods.add(currentMethod); } } fDeclarationToMatch= null; return filteredMethods.toArray(new IMethod[filteredMethods.size()]); }
Source:
public boolean nextResult() throws IOException{ cellScannerIndex=0; previousResult = currentResult; currentResult = this.resultScanner.next(); if(currentResult == null) { throw new DoNotRetryIOException("Memstore scanner shouldn't end prematurely"); } if (currentResult.rawCells() != null && CellUtil.matchingFamily(currentResult.rawCells()[0], FLUSH) ) { if (LOG.isTraceEnabled()) LOG.trace("CURRENT CELL: " + currentResult.rawCells()[0]); assert currentResult.rawCells().length == 1; if (previousResult != null && previousResult.rawCells() != null) { assert previousResult.rawCells().length > 0; KeyValue previousCell = (KeyValue) previousResult.rawCells()[previousResult.rawCells().length - 1]; if (LOG.isTraceEnabled()) LOG.trace("PREVIOUS CELL: " + previousCell); if (CellUtil.matchingRows(currentResult.rawCells()[0], HConstants.EMPTY_START_ROW)) { byte[] rowId = Bytes.add( CellUtil.cloneRow(previousCell), CellUtil.cloneRow(currentResult.rawCells()[0])); currentResult = Result.create(new KeyValue[]{new KeyValue(rowId, FLUSH, FLUSH, previousCell.getTimestamp(), new byte[0])}); if (LOG.isTraceEnabled()) LOG.trace("NEW CELL: " + currentResult.rawCells()[0]); } } } cells=currentResult.rawCells(); peakKeyValue = (KeyValue) current(); rows++; return true; }

Target:
public boolean nextResult() throws IOException{ cellScannerIndex=0; previousResult = currentResult; currentResult = this.resultScanner.next(); if(currentResult == null) { throw new DoNotRetryIOException("Memstore scanner shouldn't end prematurely"); } if (currentResult.rawCells() != null && CellUtil.matchingFamily(currentResult.rawCells()[0], FLUSH) ) { if (LOG.isTraceEnabled()) LOG.trace("CURRENT CELL: " + currentResult.rawCells()[0]); assert currentResult.rawCells().length == 1; if (previousResult != null && previousResult.rawCells() != null) { assert previousResult.rawCells().length > 0; KeyValue previousCell = (KeyValue) previousResult.rawCells()[previousResult.rawCells().length - 1]; if (LOG.isTraceEnabled()) LOG.trace("PREVIOUS CELL: " + previousCell); if (CellUtil.matchingRows(currentResult.rawCells()[0], HConstants.EMPTY_START_ROW)) { byte[] rowId = Bytes.add(CellUtil.cloneRow(previousCell), new byte[]{0}); currentResult = Result.create(new KeyValue[]{new KeyValue(rowId, FLUSH, FLUSH, previousCell.getTimestamp(), new byte[0])}); if (LOG.isTraceEnabled()) LOG.trace("NEW CELL: " + currentResult.rawCells()[0]); } } } cells=currentResult.rawCells(); peakKeyValue = (KeyValue) current(); rows++; return true; }
Source:
public static String getConcatedTypeNameValues(Query query, List<String> typeNames, String typeName) { List<String> filteredTypeNames; Set<String> queryTypeNames = query.getTypeNames(); if (queryTypeNames != null && queryTypeNames.size() > 0) { filteredTypeNames = new ArrayList<String>(queryTypeNames); for (String name : typeNames) { if (!filteredTypeNames.contains(name)) { filteredTypeNames.add(name); } } } else { filteredTypeNames = typeNames; } if (query.isAllowDottedKeys()) { return getConcatedTypeNameValues(filteredTypeNames, typeName, "."); } else { return getConcatedTypeNameValues(filteredTypeNames, typeName); } }

Target:
public static String getConcatedTypeNameValues(Query query, List<String> typeNames, String typeName) { Set<String> queryTypeNames = query.getTypeNames(); if (queryTypeNames != null && queryTypeNames.size() > 0) { List<String> filteredTypeNames = new ArrayList<String>(queryTypeNames); for (String name : typeNames) { if (!filteredTypeNames.contains(name)) { filteredTypeNames.add(name); } } return getConcatedTypeNameValues(filteredTypeNames, typeName, getTypeNameValuesSeparator(query)); } else { return getConcatedTypeNameValues(typeNames, typeName, getTypeNameValuesSeparator(query)); } }
Source:
private XSDSchema getSchema(String resourceName) { InputStream inputStream = getClass().getResourceAsStream(resourceName); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { IOUtils.copy(inputStream, outputStream); String xsd = new String(outputStream.toByteArray()); XSDSchema schema = Util.getXSDSchema(xsd); return schema; } catch (Exception e) { LOG.error(e.getMessage(), e); } finally { IOUtils.closeQuietly(outputStream); IOUtils.closeQuietly(inputStream); } return null; }

Target:
private XSDSchema getSchema(String resourceName) { InputStream inputStream = getClass().getResourceAsStream(resourceName); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { IOUtils.copy(inputStream, outputStream); String xsd = new String(outputStream.toByteArray()); XSDSchema schema = Util.getXSDSchema(xsd); return schema; } catch (Exception e) { LOG.error("Fail in parsing schema:", e); } finally { IOUtils.closeQuietly(outputStream); IOUtils.closeQuietly(inputStream); } return null; }
Source:
public ArrayList<ConfigNode> children() { return children; }

Target:
final public Collection<AbstractConfigNode> children() { return children; }
Source:
protected MutableBoundedValue<Short> constructValue(Short actualValue) { return SpongeValueFactory.boundedBuilder(Keys.SPAWNER_MAXIMUM_NEARBY_ENTITIES) .minimum((short) 0) .maximum(Short.MAX_VALUE) .defaultValue(DataConstants.DEFAULT_SPAWNER_MAXMIMUM_NEARBY_ENTITIES) .actualValue(actualValue) .build(); }

Target:
protected MutableBoundedValue<Short> constructValue(Short actualValue) { return SpongeValueFactory.boundedBuilder(this.key) .minimum((short) 0) .maximum(Short.MAX_VALUE) .defaultValue(DataConstants.DEFAULT_SPAWNER_MAXMIMUM_NEARBY_ENTITIES) .actualValue(actualValue) .build(); }
Source:
public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE); }

Target:
public String toString() { return new ToStringBuilder(this) .appendSuper(super.toString()) .append("event", getEvent()) .append("rule", getRule()) .append("service", getService()) .append("operation", getOperation()) .append("endPoint", getEndPoint()) .toString(); }
Source:
public void test_connectLjava_net_SocketAddressI_setSOTimeout() throws Exception { class SocketConnector extends Thread { private final int timeout; private final Socket theSocket; private final SocketAddress address; private Exception exception = null; @Override public void run() { try { theSocket.connect(address, timeout); } catch (SocketTimeoutException e) { } catch (Exception e) { exception = e; } } private SocketConnector(int timeout, Socket theSocket, SocketAddress address) { this.timeout = timeout; this.theSocket = theSocket; this.address = address; } private Exception getException() { return exception; } } try (final Socket theSocket = new Socket()) { final SocketConnector connector = new SocketConnector(5000, theSocket, UNREACHABLE_ADDRESS); connector.start(); theSocket.setSoTimeout(1000); Thread.sleep(10); assertTrue("Socket option not set during connect: 10 ", Math.abs(1000 - theSocket.getSoTimeout()) <= 10); Thread.sleep(50); theSocket.setSoTimeout(2000); assertTrue("Socket option not set during connect: 50 ", Math.abs(2000 - theSocket.getSoTimeout()) <= 10); connector.join(); Exception e = connector.getException(); if (e != null) { e.printStackTrace(); } assertNull(e); } }

Target:
public void test_connectLjava_net_SocketAddressI_setSOTimeout() throws Exception { final AtomicReference<Exception> exceptionRef = new AtomicReference<>(); class SocketConnector extends Thread { private final int timeout; private final Socket theSocket; private final SocketAddress address; @Override public void run() { try { theSocket.connect(address, timeout); } catch (Exception e) { exceptionRef.set(e); } } private SocketConnector(int timeout, Socket theSocket, SocketAddress address) { this.timeout = timeout; this.theSocket = theSocket; this.address = address; } } try (final Socket theSocket = new Socket()) { final SocketConnector connector = new SocketConnector(5000, theSocket, UNREACHABLE_ADDRESS); connector.start(); theSocket.setSoTimeout(1000); Thread.sleep(10); assertTrue("Socket option not set during connect: 10 ", Math.abs(1000 - theSocket.getSoTimeout()) <= 10); Thread.sleep(50); theSocket.setSoTimeout(2000); assertTrue("Socket option not set during connect: 50 ", Math.abs(2000 - theSocket.getSoTimeout()) <= 10); connector.join(); Exception e = exceptionRef.get(); if (!(e instanceof SocketTimeoutException)) { fail(printStackTraceToString(e)); } } }
Source:
protected void AddVmTemplateImages() { Guid srcStorageDomain = mImages.get(0).getstorage_id().getValue(); Guid vmSnapshotId = Guid.NewGuid(); for (DiskImage diskImage : mImages) { CreateImageTemplateParameters createParams = new CreateImageTemplateParameters(diskImage.getId(), getVmTemplateId(), getVmTemplateName(), getVmId()); if (!diskImage.getstorage_id().equals(Guid.Empty)) { createParams.setStorageDomainId(diskImage.getstorage_id().getValue()); } else { createParams.setStorageDomainId(srcStorageDomain); } createParams.setVmSnapshotId(vmSnapshotId); createParams.setEntityId(getParameters().getEntityId()); createParams.setDestinationStorageDomainId(getStorageDomainId().getValue()); createParams.setParentParemeters(getParameters()); getParameters().getImagesParameters().add(createParams); VdcReturnValueBase retValue = Backend.getInstance().runInternalAction( VdcActionType.CreateImageTemplate, createParams, = ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); QuotaManager.reduceCommandStorageSize(createParams.getStorageDomainId(), diskImage.getsize(), getStoragePool().getQuotaEnforcementType(), getCommandId(), getParameters().getQuotaId()); getReturnValue().getTaskIdList().addAll(retValue.getInternalTaskIdList()); } }

Target:
protected void AddVmTemplateImages() { Guid srcStorageDomain = mImages.get(0).getstorage_ids().get(0); Guid vmSnapshotId = Guid.NewGuid(); for (DiskImage diskImage : mImages) { CreateImageTemplateParameters createParams = new CreateImageTemplateParameters(diskImage.getId(), getVmTemplateId(), getVmTemplateName(), getVmId()); if (!Guid.Empty.equals(diskImage.getstorage_ids().get(0))) { createParams.setStorageDomainId(diskImage.getstorage_ids().get(0)); } else { createParams.setStorageDomainId(srcStorageDomain); } createParams.setVmSnapshotId(vmSnapshotId); createParams.setEntityId(getParameters().getEntityId()); createParams.setDestinationStorageDomainId(getStorageDomainId().getValue()); createParams.setParentParemeters(getParameters()); getParameters().getImagesParameters().add(createParams); VdcReturnValueBase retValue = Backend.getInstance().runInternalAction( VdcActionType.CreateImageTemplate, createParams, = ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); QuotaManager.reduceCommandStorageSize(createParams.getStorageDomainId(), diskImage.getsize(), getStoragePool().getQuotaEnforcementType(), getCommandId(), getParameters().getQuotaId()); getReturnValue().getTaskIdList().addAll(retValue.getInternalTaskIdList()); } }
Source:
public void write(JsonGenerator jg, DocumentModel document) throws IOException { jg.writeObjectFieldStart(NAME); int resultCount; try (SessionWrapper wrapper = ctx.getSession(document)) { String escapedId = NXQL.escapeString(document.getId()); resultCount = wrapper.getSession() .queryProjection( String.format(org.nuxeo.ecm.platform.rendition.Constants.ALL_PUBLICATION_QUERY, escapedId, escapedId), 0, 0) .size(); } jg.writeNumberField("resultsCount", resultCount); jg.writeEndObject(); }

Target:
public void write(JsonGenerator jg, DocumentModel document) throws IOException { jg.writeObjectFieldStart(NAME); int resultCount; try (SessionWrapper wrapper = ctx.getSession(document)) { String escapedId = NXQL.escapeString(document.getId()); resultCount = wrapper.getSession() .queryProjection( String.format(ALL_PUBLICATION_QUERY, escapedId, escapedId), 0, 0) .size(); } jg.writeNumberField("resultsCount", resultCount); jg.writeEndObject(); }
Source:
public void testDeserializeSimpleDefinition() throws Exception { String yaml = "{\n" + " \"openapi\": \"3.0.0-rc0\",\n" + " \"info\": {\n" + " \"title\": \"Swagger Petstore\",\n" + " \"description\": \"This is a sample server Petstore server. You can find out more about Swagger at [<LINK_2>](<LINK_0> or on [irc.freenode.net, #swagger](<LINK_1> For this sample, you can use the api key `special-key` to test the authorization filters.\",\n" + " \"termsOfService\": \"<LINK_2>/terms/\",\n" + " \"contact\": {\n" + " \"email\": \"apiteam@swagger.io\"\n" + " },\n" + " \"license\": {\n" + " \"name\": \"Apache 2.0\",\n" + " \"url\": \"<LINK_4>\"\n" + " },\n" + " \"version\": \"1.0.0\"\n" + " }\n" + "}"; SwaggerParseResult result = new OpenAPIV3Parser().readContents(yaml, null, null); assertNotNull(result.getOpenAPI()); }

Target:
public void testDeserializeSimpleDefinition() throws Exception { String json = "{\n" + " \"openapi\": \"3.0.0-rc0\",\n" + " \"info\": {\n" + " \"title\": \"Swagger Petstore\",\n" + " \"description\": \"This is a sample server Petstore server. You can find out more about Swagger at [<LINK_2>](<LINK_0> or on [irc.freenode.net, #swagger](<LINK_1> For this sample, you can use the api key `special-key` to test the authorization filters.\",\n" + " \"termsOfService\": \"<LINK_2>/terms/\",\n" + " \"contact\": {\n" + " \"email\": \"apiteam@swagger.io\"\n" + " },\n" + " \"license\": {\n" + " \"name\": \"Apache 2.0\",\n" + " \"url\": \"<LINK_4>\"\n" + " },\n" + " \"version\": \"1.0.0\"\n" + " }\n" + "}"; ParseOptions options = new ParseOptions(); options.setResolve(true); SwaggerParseResult result = new OpenAPIV3Parser().readContents(json, null, options); assertNotNull(result.getOpenAPI()); }
Source:
public Page getNextPage() { try { batchId++; long start = System.nanoTime(); int batchSize = parquetReader.nextBatch(); readTimeNanos += System.nanoTime() - start; if (closed || batchSize <= 0) { close(); return null; } Block[] blocks = new Block[hiveColumnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { if (constantBlocks[fieldId] != null) { blocks[fieldId] = constantBlocks[fieldId].getRegion(0, batchSize); } else { Type type = types.get(fieldId); Optional<Field> field = fields.get(fieldId); int fieldIndex = useParquetColumnNames ? getFieldIndex(fileSchema, columnNames.get(fieldId)) : hiveColumnIndexes[fieldId]; if (fieldIndex != -1 && field.isPresent()) { blocks[fieldId] = new LazyBlock(batchSize, new ParquetBlockLoader(field.get())); } else { blocks[fieldId] = RunLengthEncodedBlock.create(type, null, batchSize); } } } return new Page(batchSize, blocks); } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, e); } }

Target:
public Page getNextPage() { try { batchId++; long start = System.nanoTime(); int batchSize = parquetReader.nextBatch(); readTimeNanos += System.nanoTime() - start; if (closed || batchSize <= 0) { close(); return null; } Block[] blocks = new Block[hiveColumnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { if (constantBlocks[fieldId] != null) { blocks[fieldId] = constantBlocks[fieldId].getRegion(0, batchSize); } else { Type type = types.get(fieldId); Optional<Field> field = fields.get(fieldId); int fieldIndex; if (useParquetColumnNames) { fieldIndex = getFieldIndex(fileSchema, columnNames.get(fieldId)); } else { fieldIndex = hiveColumnIndexes[fieldId]; } if (fieldIndex != -1 && field.isPresent()) { blocks[fieldId] = new LazyBlock(batchSize, new ParquetBlockLoader(field.get())); } else { blocks[fieldId] = RunLengthEncodedBlock.create(type, null, batchSize); } } } return new Page(batchSize, blocks); } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, e); } }
Source:
public void setUp() throws Exception { Path entryPath = Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); testRepo.addContent(entryPath); projectName = testRepo.getName(); String subPathToGithubArchive = "/archive/master.zip"; String pathToGithubArchive = String.format("%s%s", testRepo.getHtmlUrl(), subPathToGithubArchive); TestFactoryInitializer.TestFactoryBuilder factoryBuilder = testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); ProjectConfigDto projectConfigDto = factoryBuilder.getWorkspace().getProjects().get(0); projectConfigDto.setName(projectName); projectConfigDto.setPath("/" + projectName); projectConfigDto.getSource().setParameters(ImmutableMap.of("skipFirstLevel", "true")); projectConfigDto.getSource().setType("zip"); projectConfigDto.getSource().setLocation(pathToGithubArchive); testFactory = factoryBuilder.build(); }

Target:
public void setUp() throws Exception { Path entryPath = Paths.get(getClass().getResource("/projects/default-spring-project").getPath()); testRepo.addContent(entryPath); projectName = testRepo.getName(); String urlToDownloadZippedRepoFromGitHub = String.format("%s%s", testRepo.getHtmlUrl(), "/archive/master.zip"); TestFactoryInitializer.TestFactoryBuilder factoryBuilder = testFactoryInitializer.fromTemplate(FactoryTemplate.MINIMAL); ProjectConfigDto projectConfigDto = factoryBuilder.getWorkspace().getProjects().get(0); projectConfigDto.setName(projectName); projectConfigDto.setPath("/" + projectName); projectConfigDto.getSource().setParameters(ImmutableMap.of("skipFirstLevel", "true")); projectConfigDto.getSource().setType("zip"); projectConfigDto.getSource().setLocation(urlToDownloadZippedRepoFromGitHub); testFactory = factoryBuilder.build(); }
Source:
private FileStorage getJarStorage (StreamlineConfiguration configuration, StorageManager storageManager) { FileStorage fileStorage = null; try { fileStorage = ReflectionHelper.newInstance(configuration.getFileStorageConfiguration().getClassName()); fileStorage.init(configuration.getFileStorageConfiguration().getProperties()); if (fileStorage instanceof DbFileStorage) { ((DbFileStorage) fileStorage).setStorageManager(storageManager); } } catch (Exception e) { throw new RuntimeException(e); } return fileStorage; }

Target:
private FileStorage getJarStorage (StreamlineConfiguration configuration, StorageManager storageManager) { FileStorage fileStorage = null; try { fileStorage = ReflectionHelper.newInstance(configuration.getFileStorageConfiguration().getClassName()); fileStorage.init(configuration.getFileStorageConfiguration().getProperties()); if (fileStorage instanceof StorageManagerAware) { ((StorageManagerAware) fileStorage).setStorageManager(storageManager); } } catch (Exception e) { throw new RuntimeException(e); } return fileStorage; }
Source:
public ServerSelector() { Queue<ServerComponent> widgets = getServers(); if (initServer != null || Core.quickLaunchByUuid > 0) { if (runServer(widgets)) { initServer = null; return; } } setLayout(new BorderLayout()); setPreferredSize(new Dimension(600, 350)); JPanel interior = new JPanel(null); int i = 0; int y = 0; while (widgets != null && !widgets.isEmpty()) { final ServerComponent w = widgets.poll(); w.setSize(300, 100); if (i % 2 == 0 && i != 0) { y += 100; } w.setLocation(i % 2 == 0 ? 0 : 300, y); interior.add(w); i++; } y += 100; interior.setPreferredSize(new Dimension(300, y)); JScrollPane scrlInterior = new JScrollPane(interior); scrlInterior .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrlInterior .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); add(scrlInterior); }

Target:
public ServerSelector() { Queue<ServerComponent> widgets = getServers(); if (initServer != null || Core.getQuickLaunchByUuid() > -1) { if (runServer(widgets)) { initServer = null; return; } } setLayout(new BorderLayout()); setPreferredSize(new Dimension(600, 350)); JPanel interior = new JPanel(null); int i = 0; int y = 0; while (widgets != null && !widgets.isEmpty()) { final ServerComponent w = widgets.poll(); w.setSize(300, 100); if (i % 2 == 0 && i != 0) { y += 100; } w.setLocation(i % 2 == 0 ? 0 : 300, y); interior.add(w); i++; } y += 100; interior.setPreferredSize(new Dimension(300, y)); JScrollPane scrlInterior = new JScrollPane(interior); scrlInterior .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrlInterior .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); add(scrlInterior); }
Source:
private List<Object> buildParametersList() { List<Object> result = new ArrayList(this.generatorParameters.length); for (String param : this.generatorParameters) { result.add(param); } return result; }

Target:
private List<String> buildParametersList() { return Arrays.asList(this.generatorParameters); }