auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testFromInPredicateWithCastsAndNulls() { Expression originalExpression = new InPredicate( C_BIGINT.toSymbolReference(), new InListExpression(ImmutableList.of(cast(toExpression(null, SMALLINT), BIGINT)))); ExtractionResult result = fromPredicate(originalExpression); assertEquals(result.getRemainingExpression(), TRUE_LITERAL); assertEquals(result.getTupleDomain(), TupleDomain.none()); originalExpression = not(new InPredicate( cast(C_SMALLINT, BIGINT), new InListExpression(ImmutableList.of(toExpression(null, BIGINT))))); result = fromPredicate(originalExpression); assertEquals(result.getRemainingExpression(), not(equal(cast(C_SMALLINT, BIGINT), toExpression(null, BIGINT)))); assertEquals(result.getTupleDomain(), TupleDomain.all()); originalExpression = new InPredicate( C_BIGINT.toSymbolReference(), new InListExpression(ImmutableList.of(cast(toExpression(null, SMALLINT), BIGINT), toExpression(1L, BIGINT)))); result = fromPredicate(originalExpression); assertEquals(result.getRemainingExpression(), TRUE_LITERAL); assertEquals(result.getTupleDomain(), withColumnDomains(ImmutableMap.of(C_BIGINT, Domain.create(ValueSet.ofRanges(Range.equal(BIGINT, 1L)), false)))); originalExpression = not(new InPredicate( C_BIGINT.toSymbolReference(), new InListExpression(ImmutableList.of(cast(toExpression(null, SMALLINT), BIGINT), toExpression(1L, SMALLINT))))); result = fromPredicate(originalExpression); assertEquals(result.getRemainingExpression(), TRUE_LITERAL); assertEquals(result.getTupleDomain(), TupleDomain.none()); }

Target:
public void testFromInPredicateWithCastsAndNulls() { assertPredicateIsAlwaysFalse(new InPredicate( C_BIGINT.toSymbolReference(), new InListExpression(ImmutableList.of(cast(toExpression(null, SMALLINT), BIGINT))))); Expression originalExpression = not(new InPredicate( cast(C_SMALLINT, BIGINT), new InListExpression(ImmutableList.of(toExpression(null, BIGINT))))); ExtractionResult result = fromPredicate(originalExpression); assertEquals(result.getRemainingExpression(), not(equal(cast(C_SMALLINT, BIGINT), toExpression(null, BIGINT)))); assertEquals(result.getTupleDomain(), TupleDomain.all()); originalExpression = new InPredicate( C_BIGINT.toSymbolReference(), new InListExpression(ImmutableList.of(cast(toExpression(null, SMALLINT), BIGINT), toExpression(1L, BIGINT)))); result = fromPredicate(originalExpression); assertEquals(result.getRemainingExpression(), TRUE_LITERAL); assertEquals(result.getTupleDomain(), withColumnDomains(ImmutableMap.of(C_BIGINT, Domain.create(ValueSet.ofRanges(Range.equal(BIGINT, 1L)), false)))); assertPredicateIsAlwaysFalse(not(new InPredicate( C_BIGINT.toSymbolReference(), new InListExpression(ImmutableList.of(cast(toExpression(null, SMALLINT), BIGINT), toExpression(1L, SMALLINT)))))); }
Source:
public void process(QueryEnded event) { if (event.getCurrentValue() == QueryStatus.Status.CLOSED) { return; } QueryContext queryContext = queryService.getQueryContext(event.getQueryHandle()); if (queryContext == null) { LOG.warn("Could not find the context for " + event.getQueryHandle() + " for event:" + event.getCurrentValue() + ". No email generated"); return; } boolean whetherMailNotify = Boolean.parseBoolean(queryContext.getConf().get(GrillConfConstants.GRILL_WHETHER_MAIL_NOTIFY, GrillConfConstants.GRILL_WHETHER_MAIL_NOTIFY_DEFAULT)); if(!whetherMailNotify){ return; } String queryName = queryContext.getQueryName(); queryName = queryName == null ? "" : queryName; String mailSubject = "Query " + queryName + " " + queryContext.getStatus().getStatus() + ": " + event.getQueryHandle(); String mailMessage = createMailMessage(queryContext); String to = queryContext.getSubmittedUser() + "@" + conf.get(GrillConfConstants.GRILL_SERVER_DOMAIN); String cc = queryContext.getConf().get(GrillConfConstants.GRILL_QUERY_RESULT_EMAIL_CC, GrillConfConstants.GRILL_QUERY_RESULT_DEFAULT_EMAIL_CC); LOG.info("Sending completion email for query handle: " + event.getQueryHandle()); sendMail(host, port, from, to, cc, mailSubject, mailMessage, mailSmtpTimeout, mailSmtpConnectionTimeout); }

Target:
public void process(QueryEnded event) { if (event.getCurrentValue() == QueryStatus.Status.CLOSED) { return; } QueryContext queryContext = queryService.getQueryContext(event.getQueryHandle()); if (queryContext == null) { LOG.warn("Could not find the context for " + event.getQueryHandle() + " for event:" + event.getCurrentValue() + ". No email generated"); return; } boolean whetherMailNotify = Boolean.parseBoolean(queryContext.getConf().get(GrillConfConstants.GRILL_WHETHER_MAIL_NOTIFY, GrillConfConstants.GRILL_WHETHER_MAIL_NOTIFY_DEFAULT)); if(!whetherMailNotify){ return; } String queryName = queryContext.getQueryName(); queryName = queryName == null ? "" : queryName; String mailSubject = "Query " + queryName + " " + queryContext.getStatus().getStatus() + ": " + event.getQueryHandle(); String mailMessage = createMailMessage(queryContext); String to = queryContext.getSubmittedUser() + "@" + queryService.getServerDomain(); String cc = queryContext.getConf().get(GrillConfConstants.GRILL_QUERY_RESULT_EMAIL_CC, GrillConfConstants.GRILL_QUERY_RESULT_DEFAULT_EMAIL_CC); LOG.info("Sending completion email for query handle: " + event.getQueryHandle()); sendMail(host, port, from, to, cc, mailSubject, mailMessage, mailSmtpTimeout, mailSmtpConnectionTimeout); }
Source:
public Uri getContentUri() { return generateContentUri(UploadModel.context,getMediaUri().getPath()); }

Target:
public Uri getContentUri() { return originalContentUri; }
Source:
public void onManagementStopped(ManagementTransitionInfo info) { synchronized (this) { if (managementContext == null && nonDeploymentManagementContext.getMode() == NonDeploymentManagementContext.NonDeploymentManagementContextMode.MANAGEMENT_STOPPED) { return; } if (managementContext != info.getManagementContext()) { throw new IllegalStateException("Has different management context: "+managementContext+"; expected "+info.getManagementContext()); } getSubscriptionContext().unsubscribeAll(); entityChangeListener = EntityChangeListener.NOOP; managementContextUsable.set(false); currentlyDeployed.set(false); executionContext = null; subscriptionContext = null; } entity.invalidateReferences(); synchronized (this) { managementContext = null; nonDeploymentManagementContext.setMode(NonDeploymentManagementContext.NonDeploymentManagementContextMode.MANAGEMENT_STOPPED); } }

Target:
public void onManagementStopped(ManagementTransitionInfo info) { synchronized (this) { if (managementContext == null && nonDeploymentManagementContext.getMode() == NonDeploymentManagementContextMode.MANAGEMENT_STOPPED) { return; } if (managementContext != info.getManagementContext()) { throw new IllegalStateException("Has different management context: "+managementContext+"; expected "+info.getManagementContext()); } getSubscriptionContext().unsubscribeAll(); entityChangeListener = EntityChangeListener.NOOP; managementContextUsable.set(false); currentlyDeployed.set(false); executionContext = null; subscriptionContext = null; } entity.invalidateReferences(); synchronized (this) { managementContext = null; nonDeploymentManagementContext.setMode(NonDeploymentManagementContextMode.MANAGEMENT_STOPPED); } }
Source:
private static List<ApplicationTracer> getTracers() { if (tracers == null) { synchronized (ApplicationTracer.class) { if (tracers == null) { List<ApplicationTracer> t = new ArrayList<>(); for (ApplicationTracer tracer : ServiceLoader.load(EvaluationTrace.ApplicationTracer.class, Stapler.getCurrent().getWebApp().getClassLoader())) { try { t.add(tracer); } catch (Exception e) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Exception thrown when notifying tracer", e); } } } tracers = t; } } } return tracers; }

Target:
private static List<ApplicationTracer> getTracers() { synchronized (ApplicationTracer.class) { if (tracers == null) { List<ApplicationTracer> t = new ArrayList<>(); for (ApplicationTracer tracer : ServiceLoader.load(EvaluationTrace.ApplicationTracer.class, Stapler.getCurrent().getWebApp().getClassLoader())) { try { t.add(tracer); } catch (Exception e) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Exception thrown when notifying tracer", e); } } } tracers = t; } } return tracers; }
Source:
public void writeProjectOutput(MemoryFileSystem trgMfs, ResultsImpl messages) { MemoryFileSystem srcMfs = new MemoryFileSystem(); ModelWriter modelWriter = new ModelWriter(); List<String> modelFiles = new ArrayList<>(); for (ModelBuilderImpl modelBuilder : modelBuilders) { final ModelWriter.Result result = modelWriter.writeModel( srcMfs, modelBuilder.getPackageModels() ); modelFiles.addAll(result.getModelFiles()); final String[] sources = result.getSources(); if(sources.length != 0) { CompilationResult res = getCompiler().compile(sources, srcMfs, trgMfs, getClassLoader()); ClassLoader byteClassLoader = trgMfs.memoryClassLoader(getClassLoader()); for (PackageModel pm : modelBuilder.getPackageModels()) { pm.validateConsequence(byteClassLoader, messages); } Stream.of(res.getErrors()).collect(groupingBy(CompilationProblem::getFileName)) .forEach( (name, errors) -> { errors.forEach( messages::addMessage ); File srcFile = srcMfs.getFile( name ); if ( srcFile instanceof MemoryFile ) { String src = new String ( srcMfs.getFileContents( ( MemoryFile ) srcFile ) ); messages.addMessage( Message.Level.ERROR, name, "Java source of " + name + " in error:\n" + src); } } ); for (CompilationProblem problem : res.getWarnings()) { messages.addMessage(problem); } } } modelWriter.writeModelFile(modelFiles, trgMfs); }

Target:
public void writeProjectOutput(MemoryFileSystem trgMfs, ResultsImpl messages) { MemoryFileSystem srcMfs = new MemoryFileSystem(); ModelWriter modelWriter = new ModelWriter(); List<String> modelFiles = new ArrayList<>(); for (ModelBuilderImpl modelBuilder : modelBuilders) { final ModelWriter.Result result = modelWriter.writeModel( srcMfs, modelBuilder.getPackageModels() ); modelFiles.addAll(result.getModelFiles()); final String[] sources = result.getSources(); if(sources.length != 0) { CompilationResult res = getCompiler().compile(sources, srcMfs, trgMfs, getClassLoader()); for (PackageModel pm : modelBuilder.getPackageModels()) { pm.validateConsequence(getClassLoader(), trgMfs, messages); } Stream.of(res.getErrors()).collect(groupingBy(CompilationProblem::getFileName)) .forEach( (name, errors) -> { errors.forEach( messages::addMessage ); File srcFile = srcMfs.getFile( name ); if ( srcFile instanceof MemoryFile ) { String src = new String ( srcMfs.getFileContents( ( MemoryFile ) srcFile ) ); messages.addMessage( Message.Level.ERROR, name, "Java source of " + name + " in error:\n" + src); } } ); for (CompilationProblem problem : res.getWarnings()) { messages.addMessage(problem); } } } modelWriter.writeModelFile(modelFiles, trgMfs); }
Source:
private PartitionInfo makePartitionInfo(String name, int id) { PartitionInfo pi = mock(PartitionInfo.class); when(pi.partition()).thenReturn(id); when(pi.topic()).thenReturn(name); return pi; }

Target:
private PartitionInfo makePartitionInfo(String name, int id) { return new PartitionInfo(name, id, null, null, null); }
Source:
public void testDecompression() throws OrcCorruptionException { byte[] sourceBytes = generateRandomBytes(); byte[] compressedBytes = new byte[1024 * 1024]; int size = compressor.compress(sourceBytes, 0, sourceBytes.length, compressedBytes, 0, compressedBytes.length); int outputSize = decompressor.decompress(compressedBytes, 0, size, new OrcDecompressor.OutputBuffer() { @Override public byte[] initialize(int size) { return new byte[size]; } @Override public byte[] grow(int size) { throw new RuntimeException(); } }); Assert.assertEquals(outputSize, sourceBytes.length); }

Target:
public void testDecompression() throws OrcCorruptionException { byte[] sourceBytes = generateRandomBytes(); byte[] compressedBytes = new byte[1024 * 1024]; int size = compressor.compress(sourceBytes, 0, sourceBytes.length, compressedBytes, 0, compressedBytes.length); byte[] output = new byte[sourceBytes.length]; int outputSize = decompressor.decompress( compressedBytes, 0, size, new OrcDecompressor.OutputBuffer() { @Override public byte[] initialize(int size) { return output; } @Override public byte[] grow(int size) { throw new RuntimeException(); } }); Assert.assertEquals(outputSize, sourceBytes.length); Assert.assertEquals(output, sourceBytes); }
Source:
public Iterator<SpreadsheetRecord> iterator() { final Iterator<CSVRecord> iterator = myParser.iterator(); return new Iterator<SpreadsheetRecord>() { @Override public boolean hasNext() { return iterator.hasNext(); } @Override public SpreadsheetRecord next() { return new CsvRecordImpl(iterator.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }

Target:
public Iterator<SpreadsheetRecord> iterator() { return Iterators.transform(myParser.iterator(), CsvRecordImpl::new); }
Source:
public <T extends NodeProperty> T getNodeProperty(Class<T> clazz) { for (NodeProperty p: getNodeProperties()) { if (clazz.isInstance(p)) return clazz.cast(p); } return null; }

Target:
public <T extends NodeProperty> T getNodeProperty(Class<T> clazz) { for (NodeProperty p: getNodeProperties()) { if (clazz.isInstance(p)) { return clazz.cast(p); } } return null; }
Source:
public ResponseEntity<String> browse() { try { Map<String,SortedSet<String>> storages = new HashMap<>(); storages.put("storages", new TreeSet<String>(configurationManager.getConfiguration() .getStorages().keySet())); return ResponseEntity.ok(new ObjectMapper().writeValueAsString(storages)); } catch (Exception e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(String.format("{ 'error': '%s' }", e.getMessage())); } }

Target:
public ResponseEntity<String> browse() { try { Map<String,SortedSet<String>> storages = new HashMap<>(); storages.put("storages", new TreeSet<String>(configurationManager.getConfiguration() .getStorages() .keySet())); return ResponseEntity.ok(objectMapper.writer().writeValueAsString(storages)); } catch (Exception e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(String.format("{ 'error': '%s' }", e.getMessage())); } }
Source:
private String removeBearerPrefix(String rawHeader) { if (StringUtils.isEmpty(rawHeader)) return null; return rawHeader.replaceFirst("bearer ", ""); }

Target:
String removeBearerPrefix(String rawHeader) { if (StringUtils.isEmpty(rawHeader)) { warn().log("cannot remove Bearer prefix from null value"); return null; } String token = rawHeader.replaceFirst(BEARER_PREFIX_UC, "").trim(); info().log("bearer prefix removed from service auth header"); return token; }
Source:
private void commonTestPart(final URL url, final String possibleCausingIssues) throws Exception { final String responseBody = HttpRequest.get(url + "index.jsp", 10, TimeUnit.SECONDS); Assert.assertThat("Unexpected EL evaluation for ${Boolean.TRUE}; " + possibleCausingIssues, responseBody, CoreMatchers.containsString("Boolean.TRUE: --- " + Boolean.TRUE + " ---")); Assert.assertThat("Unexpected EL evaluation for ${Integer.MAX_VALUE}; " + possibleCausingIssues, responseBody, CoreMatchers.containsString("Integer.MAX_VALUE: --- " + Integer.MAX_VALUE + " ---")); Assert.assertThat("Unexpected EL evaluation for ${DummyConstants.FOO}; " + possibleCausingIssues, responseBody, CoreMatchers.containsString("DummyConstants.FOO: --- " + DummyConstants.FOO + " ---")); Assert.assertThat("Unexpected EL evaluation for ${DummyEnum.VALUE}; " + possibleCausingIssues, responseBody, CoreMatchers.containsString("DummyEnum.VALUE: --- " + DummyEnum.VALUE + " ---")); }

Target:
private void commonTestPart(final URL url, final String possibleCausingIssues) throws Exception { final String responseBody = HttpRequest.get(url + "index.jsp", 10, TimeUnit.SECONDS); Assert.assertTrue("Unexpected EL evaluation for ${Boolean.TRUE}; " + possibleCausingIssues, responseBody.contains("Boolean.TRUE: --- " + Boolean.TRUE + " ---")); Assert.assertTrue("Unexpected EL evaluation for ${Integer.MAX_VALUE}; " + possibleCausingIssues, responseBody.contains("Integer.MAX_VALUE: --- " + Integer.MAX_VALUE + " ---")); Assert.assertTrue("Unexpected EL evaluation for ${DummyConstants.FOO}; " + possibleCausingIssues, responseBody.contains("DummyConstants.FOO: --- " + DummyConstants.FOO + " ---")); Assert.assertTrue("Unexpected EL evaluation for ${DummyEnum.VALUE}; " + possibleCausingIssues, responseBody.contains("DummyEnum.VALUE: --- " + DummyEnum.VALUE + " ---")); }
Source:
private void processSnapshotTransferEndMarker(LogReplicationEntry message) { snapshotWriter.snapshotTransferDone(message); completeSnapshotApply(message); }

Target:
private void processSnapshotTransferEndMarker(LogReplicationEntry message) { snapshotWriter.setSnapshotTransferDoneAndStartApply(message); completeSnapshotApply(message); }
Source:
private void sendMergedEmail(final ReplaceResult result) { if (result != null && result.mergedIntoRef != null) { workQueue.getDefaultQueue() .submit(requestScopePropagator.wrap(new Runnable() { @Override public void run() { try { final MergedSender cm = mergedSenderFactory.create(result.change); cm.setFrom(currentUser.getAccountId()); cm.setPatchSet(result.patchSet, result.info); cm.send(); } catch (EmailException e) { final PatchSet.Id psi = result.patchSet.getId(); log.error("Cannot send email for submitted patch set " + psi, e); } } @Override public String toString() { return "send email for submitted patch set"; } })); try { hooks.doChangeMergedHook(result.change, currentUser.getAccount(), result.patchSet, db); } catch (OrmException err) { log.error("Cannot open change: " + result.change.getChangeId(), err); } } }

Target:
private void sendMergedEmail(final ReplaceResult result) { if (result != null && result.mergedIntoRef != null) { workQueue.getDefaultQueue() .submit(requestScopePropagator.wrap(new Runnable() { @Override public void run() { try { final MergedSender cm = mergedSenderFactory.create(result.change); cm.setFrom(currentUser.getAccountId()); cm.setPatchSet(result.patchSet, result.info); cm.send(); } catch (EmailException e) { final PatchSet.Id psi = result.patchSet.getId(); log.error("Cannot send email for submitted patch set " + psi, e); } } @Override public String toString() { return "send-email merged"; } })); try { hooks.doChangeMergedHook(result.change, currentUser.getAccount(), result.patchSet, db); } catch (OrmException err) { log.error("Cannot open change: " + result.change.getChangeId(), err); } } }
Source:
public boolean equals(final Object o) { if (!super.equals(o)) { return false; } final ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator that = (ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator) o; if (numStdDevs != that.numStdDevs) { return false; } return true; }

Target:
public boolean equals(final Object o) { if (!super.equals(o)) { return false; } if (!(o instanceof ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator)) { return false; } final ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator that = (ArrayOfDoublesSketchToEstimateAndBoundsPostAggregator) o; if (numStdDevs != that.numStdDevs) { return false; } return true; }
Source:
private void stageLicenseFile(Configuration config) { String path = null; try { path = config.m_voltdbRoot.getCanonicalPath(); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to get voltdbroot path", false, e); } File destF = new VoltFile(path, Constants.LICENSE_FILE_NAME); if (config.m_forceVoltdbCreate && destF.exists()) { destF.delete(); } if (config.m_pathToLicense != null) { File licenseF = new VoltFile(config.m_pathToLicense); try { Files.copy(licenseF, destF); hostLog.info("Archive license file to VoltDB root directory: " + destF.getAbsolutePath()); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to stage license file to " + path, false, e); } } }

Target:
private void stageLicenseFile(Configuration config) { if (!MiscUtils.isPro()) { return; } String path = null; try { path = config.m_voltdbRoot.getCanonicalPath(); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to get voltdbroot path", false, e); } File destF = new VoltFile(path, Constants.LICENSE_FILE_NAME); if (config.m_forceVoltdbCreate && destF.exists()) { destF.delete(); } if (config.m_pathToLicense != null) { File licenseF = new File(config.m_pathToLicense); try { Files.copy(licenseF, destF); hostLog.info("License file is copied to VoltDB root directory: " + destF.getAbsolutePath()); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to copy license file to " + path, false, e); } } }
Source:
public LoginResponse login(@Valid @RequestBody LoginRequest login, HttpServletRequest request) { if (login == null) { throw new MissingValueException("login", "request"); } if (isUser2fa()) { throw new LoginMethodDisabledException(); } return runAsSystem(() -> { UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(login.getUsername(), login.getPassword()); authToken.setDetails(new WebAuthenticationDetails(request)); Authentication authentication = authenticationManager.authenticate(authToken); if (!authentication.isAuthenticated()) { throw new UnknownUsernamePasswordException(); } User user = dataService.findOne(USER, new QueryImpl<User>().eq(UserMetaData.USERNAME, authentication.getName()), User.class); if (user.isChangePassword()) { throw new ChangePasswordException(); } SecurityContextHolder.getContext().setAuthentication(authentication); String token = tokenService.generateAndStoreToken(authentication.getName(), "REST API login"); return new LoginResponse(token, user.getUsername(), user.getFirstName(), user.getLastName()); }); }

Target:
public LoginResponse login(@Valid @RequestBody LoginRequest login, HttpServletRequest request) { if (isUser2fa()) { throw new LoginDisabledTwoFactorAuthenticationException(); } return runAsSystem(() -> { UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(login.getUsername(), login.getPassword()); authToken.setDetails(new WebAuthenticationDetails(request)); Authentication authentication = authenticationManager.authenticate(authToken); if (!authentication.isAuthenticated()) { throw new UnknownUsernamePasswordException(); } User user = dataService.findOne(USER, new QueryImpl<User>().eq(UserMetaData.USERNAME, authentication.getName()), User.class); if (user.isChangePassword()) { throw new ChangePasswordException(); } SecurityContextHolder.getContext().setAuthentication(authentication); String token = tokenService.generateAndStoreToken(authentication.getName(), "REST API login"); return new LoginResponse(token, user.getUsername(), user.getFirstName(), user.getLastName()); }); }
Source:
public void starOrganization(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Organization to star.", required = true) @PathParam("organizationId") Long organizationId, @ApiParam(value = "StarRequest to star an organization for a user", required = true) StarRequest request) { Organization organization = organizationDAO.findApprovedById(organizationId); boolean isOrgApproved = isOrganizationApproved(organizationId); throwErrorIfOrganizationNotFound(isOrgApproved); Set<User> starredUsers = organization.getStarredUsers(); if (!starredUsers.contains(user)) { organization.addStarredUser(user); } else { throw new CustomWebApplicationException( "You cannot star the organization " + organization.getName() + " because you have already starred it.", HttpStatus.SC_BAD_REQUEST); } }

Target:
public void starOrganization(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Organization to star.", required = true) @PathParam("organizationId") Long organizationId, @ApiParam(value = "StarRequest to star an organization for a user", required = true) StarRequest request) { Organization organization = organizationDAO.findApprovedById(organizationId); checkOrganization(organization); Set<User> starredUsers = organization.getStarredUsers(); if (!starredUsers.contains(user)) { organization.addStarredUser(user); } else { throw new CustomWebApplicationException( "You cannot star the organization " + organization.getName() + " because you have already starred it.", HttpStatus.SC_BAD_REQUEST); } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof AbstractTreeNode) { AbstractTreeNode other = (AbstractTreeNode)o; return Objects.equals(parent, other.parent) && Objects.equals(getId(), other.getId()); } return false; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof AbstractTreeNode)) { return false; } AbstractTreeNode other = (AbstractTreeNode)o; return Objects.equals(parent, other.parent) && Objects.equals(getId(), other.getId()); }
Source:
public void shutdown() { if (mergeExecutor != null) { mergeExecutor.shutdownNow(); } }

Target:
public void shutdown() { if (mergeExecutor != null) { mergeExecutor.shutdownNow(); mergeExecutor = null; } }
Source:
public Map<String, String> importFrom(@Context UriInfo uriInfo, MultipartFormDataInput input) throws IOException { this.auth.requireManage(); Map<String, List<InputPart>> formDataMap = input.getFormDataMap(); String providerId = formDataMap.get("providerId").get(0).getBodyAsString(); InputPart file = formDataMap.get("file").get(0); InputStream inputStream = file.getBody(InputStream.class, null); IdentityProviderFactory providerFactory = getProviderFactorytById(providerId); Map<String, String> config = providerFactory.parseConfig(inputStream); adminEvent.realm(realm).operation(OperationType.ACTION).resourcePath(providerFactory, uriInfo.getPath()).representation(config).success(); return config; }

Target:
public Map<String, String> importFrom(@Context UriInfo uriInfo, MultipartFormDataInput input) throws IOException { this.auth.requireManage(); Map<String, List<InputPart>> formDataMap = input.getFormDataMap(); String providerId = formDataMap.get("providerId").get(0).getBodyAsString(); InputPart file = formDataMap.get("file").get(0); InputStream inputStream = file.getBody(InputStream.class, null); IdentityProviderFactory providerFactory = getProviderFactorytById(providerId); Map<String, String> config = providerFactory.parseConfig(inputStream); adminEvent.operation(OperationType.CREATE).resourcePath(providerFactory, uriInfo.getPath()).representation(config).success(); return config; }
Source:
public CloudStack(Collection<Group> groups, Network network, Image image, Map<String, String> parameters, Tags tags, String template, InstanceAuthentication instanceAuthentication, String loginUserName, String publicKey, SpiFileSystem fileSystem) { this.groups = ImmutableList.copyOf(groups); this.network = network; this.image = image; this.parameters = ImmutableMap.copyOf(parameters); this.tags = tags; this.template = template; this.instanceAuthentication = instanceAuthentication; this.loginUserName = loginUserName; this.publicKey = publicKey; this.fileSystem = Optional.ofNullable(fileSystem); }

Target:
public CloudStack(Collection<Group> groups, Network network, Image image, Map<String, String> parameters, Tags tags, String template, InstanceAuthentication instanceAuthentication, String loginUserName, String publicKey, SpiFileSystem fileSystem) { this.groups = ImmutableList.copyOf(groups); this.network = network; this.image = image; this.parameters = ImmutableMap.copyOf(parameters); this.tags = new Tags(tags); this.template = template; this.instanceAuthentication = instanceAuthentication; this.loginUserName = loginUserName; this.publicKey = publicKey; this.fileSystem = Optional.ofNullable(fileSystem); }
Source:
public synchronized void flush(String source) { pendingFutures.clear(); }

Target:
public synchronized void flush(String source) { super.flush(source); }
Source:
public VMListReturnForXmlRpc getExternalVmList(String uri, String username, String password, List<String> vmsNames) { JsonRpcRequest request; if(vmsNames == null) { request = new RequestBuilder("Host.getExternalVMs") .withParameter("uri", uri) .withParameter("username", username) .withParameter("password", password) .build(); } else { request = new RequestBuilder("Host.getExternalVMs") .withParameter("uri", uri) .withParameter("username", username) .withParameter("password", password) .withParameter("vm_names", vmsNames) .build(); } Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("vmList") .withResponseType(Object[].class); return new VMListReturnForXmlRpc(response); }

Target:
public VMListReturnForXmlRpc getExternalVmList(String uri, String username, String password, List<String> vmsNames) { RequestBuilder requestBuilder = new RequestBuilder("Host.getExternalVMs") .withParameter("uri", uri) .withParameter("username", username) .withParameter("password", password) .withOptionalParameterAsList("vm_names", vmsNames); JsonRpcRequest request = requestBuilder.build(); Map<String, Object> response = new FutureMap(this.client, request).withResponseKey("vmList") .withResponseType(Object[].class); return new VMListReturnForXmlRpc(response); }
Source:
public Cloud(String url) throws MalformedURLException { URL u = new URL(url); this.scheme = u.getProtocol(); this.host = u.getHost(); this.port = u.getPort() == -1 ? u.getDefaultPort() : u.getPort(); String path = u.getPath(); this.pathPrefix = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; }

Target:
public Cloud(String url) throws MalformedURLException { URL u = new URL(url); this.scheme = u.getProtocol(); this.host = u.getHost(); this.port = u.getPort() < 0 ? u.getDefaultPort() : u.getPort(); String path = u.getPath(); this.pathPrefix = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; }
Source:
private List<ApplicabilityToken> getStoredApplicabilities() { List<ApplicabilityToken> appls = new LinkedList<>(); appls.addAll(AtsClientService.getApplicabilityEndpoint( AtsClientService.get().getAtsBranch()).getApplicabilityReferenceTokens(workItem.getStoreObject())); return appls; }

Target:
private List<ApplicabilityToken> getStoredApplicabilities() { return AtsClientService.getApplicabilityEndpoint( AtsClientService.get().getAtsBranch()).getApplicabilityReferenceTokens(workItem.getStoreObject()); }
Source:
private static String formatLocalDateTime(LocalDateTime localDateTime, String pattern) { if (localDateTime == null) { return ""; } String processedPattern; if (localDateTime.getHour() == 12 && localDateTime.getMinute() == 0) { processedPattern = pattern.replace("a", "'NOON'"); } else { processedPattern = pattern; } DateTimeFormatter formatter = DateTimeFormatter.ofPattern(processedPattern); return localDateTime.format(formatter); }

Target:
private static String formatLocalDateTime(LocalDateTime localDateTime, String pattern) { if (localDateTime == null) { return ""; } String processedPattern = pattern; if (localDateTime.getHour() == 12 && localDateTime.getMinute() == 0) { processedPattern = pattern.replace("a", "'NOON'"); } DateTimeFormatter formatter = DateTimeFormatter.ofPattern(processedPattern); return localDateTime.format(formatter); }
Source:
public void testGroupByLongColumn() { GroupByQuery query = GroupByQuery .builder() .setDataSource(QueryRunnerTestHelper.dataSource) .setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird) .setDimensions(Lists.<DimensionSpec>newArrayList(new DefaultDimensionSpec("__time", "time_alias", ValueType.LONG))) .setDimFilter(new SelectorDimFilter("quality", "entertainment", null)) .setAggregatorSpecs( Arrays.asList( QueryRunnerTestHelper.rowsCount, new LongSumAggregatorFactory("idx", "index") ) ) .setGranularity(QueryRunnerTestHelper.dayGran) .build(); if (config.getDefaultStrategy().equals(GroupByStrategySelector.STRATEGY_V1)) { expectedException.expect(UnsupportedOperationException.class); } List<Row> expectedResults = Arrays.asList( GroupByQueryRunnerTestHelper.createExpectedRow( "2011-04-01", "time_alias", 1301616000000L, "rows", 1L, "idx", 158L ), GroupByQueryRunnerTestHelper.createExpectedRow( "2011-04-02", "time_alias", 1301702400000L, "rows", 1L, "idx", 166L ) ); Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query); TestHelper.assertExpectedObjects(expectedResults, results, ""); }

Target:
public void testGroupByLongColumn() { if (config.getDefaultStrategy().equals(GroupByStrategySelector.STRATEGY_V1)) { expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("GroupBy v1 only supports dimensions with an outputType of STRING."); } GroupByQuery query = GroupByQuery .builder() .setDataSource(QueryRunnerTestHelper.dataSource) .setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird) .setDimensions(Lists.<DimensionSpec>newArrayList(new DefaultDimensionSpec("qualityLong", "ql_alias", ValueType.LONG))) .setDimFilter(new SelectorDimFilter("quality", "entertainment", null)) .setAggregatorSpecs( Arrays.asList( QueryRunnerTestHelper.rowsCount, new LongSumAggregatorFactory("idx", "index") ) ) .addOrderByColumn(new OrderByColumnSpec( "ql_alias", OrderByColumnSpec.Direction.ASCENDING, StringComparators.NUMERIC )) .setGranularity(QueryRunnerTestHelper.dayGran) .build(); Assert.assertEquals( Functions.<Sequence<Row>>identity(), query.getLimitSpec().build( query.getDimensions(), query.getAggregatorSpecs(), query.getPostAggregatorSpecs() ) ); List<Row> expectedResults = Arrays.asList( GroupByQueryRunnerTestHelper.createExpectedRow( "2011-04-01", "ql_alias", 1200L, "rows", 1L, "idx", 158L ), GroupByQueryRunnerTestHelper.createExpectedRow( "2011-04-02", "ql_alias", 1200L, "rows", 1L, "idx", 166L ) ); Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query); TestHelper.assertExpectedObjects(expectedResults, results, ""); }
Source:
public String removeBracketsForArrayString(String arrayString) { return arrayString.substring(1, arrayString.length() - 1).trim(); }

Target:
private String removeBracketsForArrayString(String arrayString) { return arrayString.substring(1, arrayString.length() - 1).trim(); }
Source:
public void remove () { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); K[] keyTable = map.keyTable; V[] valueTable = map.valueTable; int loc = currentIndex; final int mask = map.mask; K key; while ((key = keyTable[loc + 1 & mask]) != null && (loc + 1 & mask) != map.place(key)) { keyTable[loc] = key; valueTable[loc] = valueTable[loc + 1 & mask]; ++loc; } if(loc != currentIndex) --nextIndex; keyTable[loc] = null; valueTable[loc] = null; --map.size; currentIndex = -1; }

Target:
public void remove () { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); K[] keyTable = map.keyTable; V[] valueTable = map.valueTable; final int mask = map.mask; int loc = currentIndex, nl = (loc + 1 & mask); K key; while ((key = keyTable[nl]) != null && nl != map.place(key)) { keyTable[loc] = key; valueTable[loc] = valueTable[nl]; loc = nl; nl = loc + 1 & mask; } if (loc != currentIndex) --nextIndex; keyTable[loc] = null; valueTable[loc] = null; --map.size; currentIndex = -1; }
Source:
public void multiIndex_incompatibleAnalyzer_skipAnalysis() { StubMappingSearchScope scope = indexManager.createSearchScope( incompatibleAnalyzerIndexManager ); String absoluteFieldPath = indexMapping.analyzedStringField1.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query().asReference() .predicate( f -> f.simpleQueryString().onField( absoluteFieldPath ).matching( TERM_5 ) .skipAnalysis() ) .toQuery(); assertThat( query ).assertThat( query ).hasDocRefHitsAnyOrder( b -> { b.doc( INDEX_NAME, DOCUMENT_1 ); b.doc( INCOMPATIBLE_ANALYZER_INDEX_NAME, INCOMPATIBLE_ANALYZER_INDEX_DOCUMENT_1 ); } ); }

Target:
public void multiIndex_incompatibleAnalyzer_skipAnalysis() { StubMappingSearchScope scope = indexManager.createSearchScope( incompatibleAnalyzerIndexManager ); String absoluteFieldPath = indexMapping.analyzedStringField1.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query().asReference() .predicate( f -> f.simpleQueryString().onField( absoluteFieldPath ).matching( TERM_5 ) .skipAnalysis() ) .toQuery(); assertThat( query ).hasDocRefHitsAnyOrder( b -> { b.doc( INDEX_NAME, DOCUMENT_1 ); b.doc( INCOMPATIBLE_ANALYZER_INDEX_NAME, INCOMPATIBLE_ANALYZER_INDEX_DOCUMENT_1 ); } ); }
Source:
private void updateStickyProfile(IPerson person, UserProfile stickyProfile, String profileName) { if (person.getID() == -1) { try { throw new RuntimeException(); } catch (Exception e) { e.printStackTrace(System.out); } } stickyProfile.setProfileName(profileName); layoutStore.updateUserProfile(person, stickyProfile); }

Target:
private void updateStickyProfile(IPerson person, UserProfile stickyProfile, String profileName) { stickyProfile.setProfileName(profileName); layoutStore.updateUserProfile(person, stickyProfile); }
Source:
public void testRankWithString() throws Exception { Client client = getClient(); long input[][] = expected.clone(); shuffleArrayOfLongs(input); ClientResponse cr; VoltTable vt; for (long row : input) { cr = client.callProcedure("T_STRING.insert", row[colA], row[colB], Long.toString(row[colC], 10)); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); } String sql = "select A, B, C, rank() over (partition by A order by B) as R from T_STRING ORDER BY A, B, C, R;"; cr = client.callProcedure("@AdHoc", sql); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); vt = cr.getResults()[0]; assertEquals(expected.length, vt.getRowCount()); for (int rowIdx = 0; vt.advanceRow(); rowIdx += 1) { assertEquals(expected[rowIdx][colA], vt.getLong(0)); assertEquals(expected[rowIdx][colB], vt.getLong(1)); assertEquals(Long.toString(expected[rowIdx][colC], 10), vt.getString(2)); assertEquals(expected[rowIdx][colR_A], vt.getLong(3)); } }

Target:
public void testRankWithString() throws Exception { Client client = getClient(); long input[][] = expected.clone(); shuffleArrayOfLongs(input); ClientResponse cr; VoltTable vt; for (long row : input) { cr = client.callProcedure("T_STRING.insert", row[colA], row[colB], Long.toString(row[colC], 10)); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); cr = client.callProcedure("T_STRING_A.insert", Long.toString(row[colA], 10), row[colB], row[colC]); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); } String sql; sql = "select A, B, C, rank() over (partition by A order by B) as R from T_STRING ORDER BY A, B, C, R;"; cr = client.callProcedure("@AdHoc", sql); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); vt = cr.getResults()[0]; assertEquals(expected.length, vt.getRowCount()); for (int rowIdx = 0; vt.advanceRow(); rowIdx += 1) { assertEquals(expected[rowIdx][colA], vt.getLong(0)); assertEquals(expected[rowIdx][colB], vt.getLong(1)); assertEquals(Long.toString(expected[rowIdx][colC], 10), vt.getString(2)); assertEquals(expected[rowIdx][colR_A], vt.getLong(3)); } sql = "select A, B, C, rank() over (partition by A order by B) as R from T_STRING_A ORDER BY A, B, C, R;"; cr = client.callProcedure("@AdHoc", sql); assertEquals(ClientResponse.SUCCESS, cr.getStatus()); vt = cr.getResults()[0]; assertEquals(expected.length, vt.getRowCount()); for (int rowIdx = 0; vt.advanceRow(); rowIdx += 1) { assertEquals(Long.toString(expected[rowIdx][colA], 10), vt.getString(0)); assertEquals(expected[rowIdx][colB], vt.getLong(1)); assertEquals(expected[rowIdx][colC], vt.getLong(2)); assertEquals(expected[rowIdx][colR_A], vt.getLong(3)); } }
Source:
public String createTeam(@PathVariable int tournamentId, Model model, HttpSession session) { if (session.getAttribute("member") == null) { return "redirect:denied"; } Member member = (Member) session.getAttribute("member"); List<Team> teams = member.getTeams(); model.addAttribute("teams", teams); TournamentDao tournamentDao = new TournamentDao(); List<Tournament> tournaments = tournamentDao.getLastXTournaments(5); model.addAttribute("tournaments", tournaments); model.addAttribute("tournamentId", tournamentId); return "createTeam"; }

Target:
public String createTeam(@PathVariable int tournamentId, Model model, HttpSession session) { Member member = (Member) session.getAttribute("member"); if (member == null) { return "redirect:/denied"; } Set<Team> teams = member.getTeams(); model.addAttribute("teams", teams); TournamentDao tournamentDao = new TournamentDao(); List<Tournament> tournaments = tournamentDao.getLastXTournaments(5); model.addAttribute("tournaments", tournaments); model.addAttribute("tournamentId", tournamentId); return "createTeam"; }
Source:
public void deleteIncludedGroups(final AccountGroup.Id groupId, final Set<AccountGroupIncludedGroup.Key> keys, final AsyncCallback<VoidResult> callback) { run(callback, new Action<VoidResult>() { public VoidResult run(final ReviewDb db) throws OrmException, NoSuchGroupException, Failure { final GroupControl control = groupControlFactory.validateFor(groupId); if (control.getAccountGroup().getType() != AccountGroup.Type.INTERNAL) { throw new Failure(new NameAlreadyUsedException()); } final Account.Id me = getAccountId(); for (final AccountGroupIncludedGroup.Key k : keys) { final AccountGroupIncludedGroup m = db.accountGroupIncludedGroups().get(k); if (m != null) { if (!control.canRemoveGroup(m.getIncludedGroupId())) { throw new Failure(new NoSuchEntityException()); } AccountGroupIncludedGroupAudit audit = null; for (AccountGroupIncludedGroupAudit a : db.accountGroupIncludedGroupsAudit() .byGroupIncludedGroup(m.getGroupId(), m.getIncludedGroupId())) { if (a.isActive()) { audit = a; break; } } if (audit != null) { audit.removed(me); db.accountGroupIncludedGroupsAudit() .update(Collections.singleton(audit)); } db.accountGroupIncludedGroups().delete(Collections.singleton(m)); includedGroupCache.evictIncludedGroup(m.getIncludedGroupId()); } includedGroupCache.evictGroup(groupId); } return VoidResult.INSTANCE; } }); }

Target:
public void deleteIncludedGroups(final AccountGroup.Id groupId, final Set<AccountGroupIncludedGroup.Key> keys, final AsyncCallback<VoidResult> callback) { run(callback, new Action<VoidResult>() { public VoidResult run(final ReviewDb db) throws OrmException, NoSuchGroupException, Failure { final GroupControl control = groupControlFactory.validateFor(groupId); if (control.getAccountGroup().getType() != AccountGroup.Type.INTERNAL) { throw new Failure(new NameAlreadyUsedException()); } for (final AccountGroupIncludedGroup.Key k : keys) { if (!groupId.equals(k.getGroupId())) { throw new Failure(new NoSuchEntityException()); } } final Account.Id me = getAccountId(); for (final AccountGroupIncludedGroup.Key k : keys) { final AccountGroupIncludedGroup m = db.accountGroupIncludedGroups().get(k); if (m != null) { if (!control.canRemoveGroup(m.getIncludedGroupId())) { throw new Failure(new NoSuchEntityException()); } AccountGroupIncludedGroupAudit audit = null; for (AccountGroupIncludedGroupAudit a : db .accountGroupIncludedGroupsAudit().byGroupIncludedGroup( m.getGroupId(), m.getIncludedGroupId())) { if (a.isActive()) { audit = a; break; } } if (audit != null) { audit.removed(me); db.accountGroupIncludedGroupsAudit().update( Collections.singleton(audit)); } db.accountGroupIncludedGroups().delete(Collections.singleton(m)); includedGroupCache.evictIncludedGroup(m.getIncludedGroupId()); } } return VoidResult.INSTANCE; } }); }
Source:
public PartialFileHistory getFileHistoryWithLastVersionByPath(String path) { try (PreparedStatement preparedStatement = getStatement("filehistory.select.master.findLatestFileVersionsForPath.sql")) { preparedStatement.setString(1, path); try (ResultSet resultSet = preparedStatement.executeQuery()) { String latestFileHistoryId = null; Long latestFileVersion = null; VectorClock latestVectorClock = null; while (resultSet.next()) { VectorClock clock = VectorClock.parseVectorClock(resultSet.getString("vectorclock_serialized")); if (latestVectorClock == null || VectorClock.compare(clock, latestVectorClock) == VectorClock.VectorClockComparison.GREATER) { latestVectorClock = clock; latestFileHistoryId = resultSet.getString("filehistory_id"); latestFileVersion = resultSet.getLong("version"); } } if (latestFileHistoryId == null) { return null; } PartialFileHistory fileHistory = getLastVersionByFileHistoryId(latestFileHistoryId); if (fileHistory.getLastVersion().getVersion() == latestFileVersion) { return fileHistory; } else { return null; } } } catch (SQLException e) { throw new RuntimeException(e); } }

Target:
public PartialFileHistory getFileHistoryWithLastVersionByPath(String path) { try (PreparedStatement preparedStatement = getStatement("filehistory.select.master.findLatestFileVersionsForPath.sql")) { preparedStatement.setString(1, path); try (ResultSet resultSet = preparedStatement.executeQuery()) { String latestFileHistoryId = null; Long latestFileVersion = null; VectorClock latestVectorClock = null; while (resultSet.next()) { VectorClock resultSetVectorClock = VectorClock.parseVectorClock(resultSet.getString("vectorclock_serialized")); boolean vectorClockIsGreater = latestVectorClock == null || VectorClock.compare(resultSetVectorClock, latestVectorClock) == VectorClock.VectorClockComparison.GREATER; if (vectorClockIsGreater) { latestVectorClock = resultSetVectorClock; latestFileHistoryId = resultSet.getString("filehistory_id"); latestFileVersion = resultSet.getLong("version"); } } if (latestFileHistoryId == null) { return null; } PartialFileHistory fileHistory = getLastVersionByFileHistoryId(latestFileHistoryId); if (fileHistory.getLastVersion().getVersion() == latestFileVersion) { return fileHistory; } else { return null; } } } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
private static void runHeadless(Config options, String saveFile) { try { final Server server = new Server( options, false ); final String teamA = options.get("bc.game.team-a"); final URL teamAClasses; if (options.get("bc.game.team-a.classes") != null) { teamAClasses = new URL(options.get("bc.game.team-a.classes")); } else { teamAClasses = null; } final String teamAPackage; if (options.get("bc.game.team-a.package") != null) { teamAPackage = options.get("bc.game.team-a.package"); } else { teamAPackage = teamA; } final String teamB = options.get("bc.game.team-b"); final URL teamBClasses; if (options.get("bc.game.team-b.classes") != null) { teamBClasses = new URL(options.get("bc.game.team-b.classes")); } else { teamBClasses = null; } final String teamBPackage; if (options.get("bc.game.team-b.package") != null) { teamBPackage = options.get("bc.game.team-b.package"); } else { teamBPackage = teamB; } final String[] maps = options.get("bc.game.maps").split(","); final boolean bestOfThree; if (options.get("bc.game.best-of-three").equals("true") && maps.length == 3) { bestOfThree = true; } else { bestOfThree = false; } server.addGameNotification(new GameInfo( teamA, teamAPackage, teamAClasses, teamB, teamBPackage, teamBClasses, maps, new File(options.get("bc.server.save-file")), bestOfThree )); server.terminateNotification(); server.run(); } catch (Exception e) { e.printStackTrace(); } }

Target:
private static void runHeadless(Config options, String saveFile) { try { final Server server = new Server( options, false ); final String teamA = options.get("bc.game.team-a"); final URL teamAClasses; if (options.get("bc.game.team-a.classes") != null) { teamAClasses = new URL(options.get("bc.game.team-a.classes")); } else { teamAClasses = null; } final String teamAPackage; if (options.get("bc.game.team-a.package") != null) { teamAPackage = options.get("bc.game.team-a.package"); } else { teamAPackage = teamA; } final String teamB = options.get("bc.game.team-b"); final URL teamBClasses; if (options.get("bc.game.team-b.classes") != null) { teamBClasses = new URL(options.get("bc.game.team-b.classes")); } else { teamBClasses = null; } final String teamBPackage; if (options.get("bc.game.team-b.package") != null) { teamBPackage = options.get("bc.game.team-b.package"); } else { teamBPackage = teamB; } final String[] maps = options.get("bc.game.maps").split(","); server.addGameNotification(new GameInfo( teamA, teamAPackage, teamAClasses, teamB, teamBPackage, teamBClasses, maps, new File(options.get("bc.server.save-file")), options.getBoolean("bc.game.best-of-three") && maps.length == 3 )); server.terminateNotification(); server.run(); } catch (Exception e) { e.printStackTrace(); } }