auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CloudStack(Collection<Group> groups, Network network, Image image, Map<String, String> parameters, Map<String, String> tags, String template, InstanceAuthentication instanceAuthentication, String loginUserName, String publicKey, SpiFileSystem fileSystem) { this(groups, network, image, parameters, tags, template, instanceAuthentication, loginUserName, publicKey, fileSystem, null); }

Target:
public CloudStack(Collection<Group> groups, Network network, Image image, Map<String, String> parameters, Map<String, String> tags, String template, InstanceAuthentication instanceAuthentication, String loginUserName, String publicKey, SpiFileSystem fileSystem) { this(groups, network, image, parameters, tags, template, instanceAuthentication, loginUserName, publicKey, fileSystem, Collections.emptyList()); }
Source:
protected void tearDown() throws Exception { super.tearDown(); if (oldFont != null) { changeDefaultFontName(oldFont); } }

Target:
protected void tearDown() throws Exception { if (oldFont != null) { changeDefaultFontName(oldFont); } super.tearDown(); }
Source:
public PlayerCubeMap(ICubicWorldServer worldServer) { super((WorldServer) worldServer); this.cubeCache = (ServerCubeCache) getWorldServer().getChunkProvider(); this.setPlayerViewRadius(CubicChunks.Config.getVerticalCubeLoadDistance()); this.cubeGenerator = worldServer.getCubeGenerator(); }

Target:
public PlayerCubeMap(ICubicWorldServer worldServer) { super((WorldServer) worldServer); this.cubeCache = (ServerCubeCache) getWorldServer().getChunkProvider(); this.setPlayerViewDistance(worldServer.getMinecraftServer().getPlayerList().getViewDistance(), CubicChunks.Config.getVerticalCubeLoadDistance()); this.cubeGenerator = worldServer.getCubeGenerator(); }
Source:
public RestClient(Context context) { super(context, REST_API_CLASS, FlickrApi.instance(), REST_URL, REST_CONSUMER_KEY, REST_CONSUMER_SECRET, REST_CALLBACK_URL); }

Target:
public RestClient(Context context) { super(context, REST_API_INSTANCE, REST_URL, REST_CONSUMER_KEY, REST_CONSUMER_SECRET, REST_CALLBACK_URL); }
Source:
public void dataCenterDoesntExist() throws Exception { doReturn(null).when(validator).getDataCenter(); assertEquals(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST), validator.dataCenterExists()); }

Target:
public void dataCenterDoesntExist() throws Exception { when(dataCenterDao.get(any(Guid.class))).thenReturn(null); assertEquals(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST), validator.dataCenterExists()); }
Source:
public IdentityClient(String tenantId, String clientId, IdentityClientOptions options) { if (tenantId == null) { tenantId = "common"; } if (options == null) { options = new IdentityClientOptions(); } this.tenantId = tenantId; this.clientId = clientId; this.options = options; if (clientId == null) { this.publicClientApplication = null; } else { String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; PublicClientApplication.Builder publicClientApplicationBuilder = PublicClientApplication.builder(clientId); try { publicClientApplicationBuilder = publicClientApplicationBuilder.authority(authorityUrl); } catch (MalformedURLException e) { logger.logAndThrow(new RuntimeException(e)); } if (options.proxyOptions() != null) { publicClientApplicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); } this.publicClientApplication = publicClientApplicationBuilder.build(); } }

Target:
IdentityClient(String tenantId, String clientId, IdentityClientOptions options) { if (tenantId == null) { tenantId = "common"; } if (options == null) { options = new IdentityClientOptions(); } this.tenantId = tenantId; this.clientId = clientId; this.options = options; if (clientId == null) { this.publicClientApplication = null; } else { String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/organizations/" + tenantId; PublicClientApplication.Builder publicClientApplicationBuilder = PublicClientApplication.builder(clientId); try { publicClientApplicationBuilder = publicClientApplicationBuilder.authority(authorityUrl); } catch (MalformedURLException e) { LOGGER.logAndThrow(new RuntimeException(e)); } if (options.proxyOptions() != null) { publicClientApplicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); } this.publicClientApplication = publicClientApplicationBuilder.build(); } }
Source:
public static void proceed(final List<String> resourcenames, StepContext context, String resourceDescription, final String variable, boolean inversePrecedence) { Run<?, ?> r = null; try { r = context.get(Run.class); context.get(TaskListener.class).getLogger().println("Lock acquired on [" + resourceDescription + "]"); } catch (Exception e) { context.onFailure(e); return; } LOGGER.finest("Lock acquired on [" + resourceDescription + "] by " + r.getExternalizableId()); try { BodyInvoker bodyInvoker = context.newBodyInvoker(). withCallback(new Callback(resourcenames, resourceDescription, inversePrecedence)). withDisplayName(null); if(variable != null && variable.length()>0) bodyInvoker.withContext(EnvironmentExpander.merge(context.get(EnvironmentExpander.class), new EnvironmentExpander() { @Override public void expand(EnvVars env) throws IOException, InterruptedException { final String resources = resourcenames.toString(); final String resourcesString = resources.substring(1, resources.length()-1); LOGGER.finest("Setting [" + variable + "] to [" + resourcesString + "] for the duration of the block"); env.override(variable, resourcesString); } })); bodyInvoker.start(); } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } }

Target:
public static void proceed(final List<String> resourcenames, StepContext context, String resourceDescription, final String variable, boolean inversePrecedence) { Run<?, ?> r = null; try { r = context.get(Run.class); context.get(TaskListener.class).getLogger().println("Lock acquired on [" + resourceDescription + "]"); } catch (Exception e) { context.onFailure(e); return; } LOGGER.finest("Lock acquired on [" + resourceDescription + "] by " + r.getExternalizableId()); try { BodyInvoker bodyInvoker = context.newBodyInvoker(). withCallback(new Callback(resourcenames, resourceDescription, inversePrecedence)). withDisplayName(null); if(variable != null && variable.length()>0) bodyInvoker.withContext(EnvironmentExpander.merge(context.get(EnvironmentExpander.class), new EnvironmentExpander() { @Override public void expand(EnvVars env) throws IOException, InterruptedException { final String resources = COMMA_JOINER.join(resourcenames); LOGGER.finest("Setting [" + variable + "] to [" + resources + "] for the duration of the block"); env.override(variable, resources); } })); bodyInvoker.start(); } catch (IOException | InterruptedException e) { throw new RuntimeException(e); } }
Source:
public Optional<TaskContext> getTaskContextByTaskId(TaskId taskId) { return taskContexts.stream().filter(context -> context.getTaskId().equals(taskId)).findFirst(); }

Target:
public TaskContext getTaskContextByTaskId(TaskId taskId) { TaskContext taskContext = taskContexts.get(taskId); verify(taskContext != null, "task does not exist"); return taskContext; }
Source:
public Void visitValues(ValuesNode node, Void context) { visitPlan(node, context); node.getRows().forEach( rows -> rows.forEach(row -> checkNotOriginalExpression(row))); return null; }

Target:
public Void visitValues(ValuesNode node, Void context) { visitPlan(node, context); node.getRows().forEach(rows -> rows.forEach(Visitor::checkNotOriginalExpression)); return null; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_news, container, false); unbinder = ButterKnife.bind(this, view); ViewUtil.setTopPaddingDp(toolbar, (int) DimenUtil.getTranslucentStatusBarHeight(getContext())); ViewUtil.setBackgroundDrawable(toolbar, GradientUtil.getCubicGradient( ContextCompat.getColor(getContext(), R.color.lead_gradient_start), Gravity.TOP)); getAppCompatActivity().setSupportActionBar(toolbar); getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true); getAppCompatActivity().getSupportActionBar().setTitle(""); NewsItem item = GsonUnmarshaller.unmarshal(NewsItem.class, getActivity().getIntent().getStringExtra(EXTRA_NEWS_ITEM)); WikiSite wiki = GsonUnmarshaller.unmarshal(WikiSite.class, getActivity().getIntent().getStringExtra(EXTRA_WIKI)); Uri imageUri = item.featureImage(); int height = imageUri == null ? DimenUtil.getContentTopOffsetPx(getContext()) : newsFeatureImageHeightForDevice(); if (imageUri == null) { toolbar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.main_toolbar_background)); } DimenUtil.setViewHeight(image, height); image.getHierarchy().setFadeDuration(0); image.loadImage(imageUri); text.setText(stripHtml(item.story())); initRecycler(); links.setAdapter(new RecyclerAdapter(item.linkCards(wiki), new Callback())); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_news, container, false); unbinder = ButterKnife.bind(this, view); ViewUtil.setTopPaddingDp(toolbar, (int) DimenUtil.getTranslucentStatusBarHeight(getContext())); ViewUtil.setBackgroundDrawable(toolbar, GradientUtil.getCubicGradient( ContextCompat.getColor(getContext(), R.color.lead_gradient_start), Gravity.TOP)); getAppCompatActivity().setSupportActionBar(toolbar); getAppCompatActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true); getAppCompatActivity().getSupportActionBar().setTitle(""); NewsItem item = GsonUnmarshaller.unmarshal(NewsItem.class, getActivity().getIntent().getStringExtra(EXTRA_NEWS_ITEM)); WikiSite wiki = GsonUnmarshaller.unmarshal(WikiSite.class, getActivity().getIntent().getStringExtra(EXTRA_WIKI)); Uri imageUri = item.featureImage(); int height = imageUri == null ? DimenUtil.getContentTopOffsetPx(getContext()) : newsFeatureImageHeightForDevice(); if (imageUri == null) { toolbar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.main_toolbar_background)); } DimenUtil.setViewHeight(image, height); image.loadImage(imageUri); text.setText(stripHtml(item.story())); initRecycler(); links.setAdapter(new RecyclerAdapter(item.linkCards(wiki), new Callback())); return view; }
Source:
public void launch() { String pidFile = getRunDir() + "/" + AbstractSoftwareProcessSshDriver.PID_FILENAME; entity.setAttribute(ElasticSearchNode.PID_FILE, pidFile); StringBuilder commandBuilder = new StringBuilder() .append(String.format("%s/bin/elasticsearch -d -p %s", getExpandedInstallDir(), pidFile)); if (entity.getConfig(ElasticSearchNode.TEMPLATE_CONFIGURATION_URL) != null) { commandBuilder.append(" -Des.config=" + Os.mergePaths(getRunDir(), getConfigFile())); } appendConfigIfPresent(commandBuilder, ElasticSearchNode.DATA_DIR, "es.path.data", Os.mergePaths(getRunDir(), "data")); appendConfigIfPresent(commandBuilder, ElasticSearchNode.LOG_DIR, "es.path.logs", Os.mergePaths(getRunDir(), "logs")); appendConfigIfPresent(commandBuilder, ElasticSearchNode.NODE_NAME.getConfigKey(), "es.node.name"); appendConfigIfPresent(commandBuilder, ElasticSearchNode.CLUSTER_NAME.getConfigKey(), "es.cluster.name"); appendConfigIfPresent(commandBuilder, ElasticSearchNode.MULTICAST_ENABLED, "es.discovery.zen.ping.multicast.enabled"); appendConfigIfPresent(commandBuilder, ElasticSearchNode.UNICAST_ENABLED, "es.discovery.zen.ping.unicast.enabled"); commandBuilder.append(" > out.log 2> err.log < /dev/null"); newScript(MutableMap.of("usePidFile", false), LAUNCHING) .updateTaskAndFailOnNonZeroResultCode() .body.append(commandBuilder.toString()) .execute(); }

Target:
public void launch() { String pidFile = getRunDir() + "/" + AbstractSoftwareProcessSshDriver.PID_FILENAME; entity.setAttribute(ElasticSearchNode.PID_FILE, pidFile); StringBuilder commandBuilder = new StringBuilder() .append(String.format("%s/bin/elasticsearch -d -p %s", getExpandedInstallDir(), pidFile)); if (entity.getConfig(ElasticSearchNode.TEMPLATE_CONFIGURATION_URL) != null) { commandBuilder.append(" -Des.config=" + Os.mergePaths(getRunDir(), getConfigFile())); } appendConfigIfPresent(commandBuilder, "es.path.data", ElasticSearchNode.DATA_DIR, Os.mergePaths(getRunDir(), "data")); appendConfigIfPresent(commandBuilder, "es.path.logs", ElasticSearchNode.LOG_DIR, Os.mergePaths(getRunDir(), "logs")); appendConfigIfPresent(commandBuilder, "es.node.name", ElasticSearchNode.NODE_NAME.getConfigKey()); appendConfigIfPresent(commandBuilder, "es.cluster.name", ElasticSearchNode.CLUSTER_NAME.getConfigKey()); appendConfigIfPresent(commandBuilder, "es.discovery.zen.ping.multicast.enabled", ElasticSearchNode.MULTICAST_ENABLED); appendConfigIfPresent(commandBuilder, "es.discovery.zen.ping.unicast.enabled", ElasticSearchNode.UNICAST_ENABLED); commandBuilder.append(" > out.log 2> err.log < /dev/null"); newScript(MutableMap.of("usePidFile", false), LAUNCHING) .updateTaskAndFailOnNonZeroResultCode() .body.append(commandBuilder.toString()) .execute(); }
Source:
public void endMessage() { writeNullForMissingFieldsAtCurrentLevel(); flush(); columns.endRecord(); if (DEBUG) log("< MESSAGE END >"); if (DEBUG) printState(); }

Target:
public void endMessage() { writeNullForMissingFieldsAtCurrentLevel(); if (columns.isColumnFlushNeeded()) { flush(); } columns.endRecord(); if (DEBUG) log("< MESSAGE END >"); if (DEBUG) printState(); }
Source:
private String convertPathForAntPathMatcher(Path path, String targetSeparator) { String convertedPath = path.toString().replace("\\", targetSeparator).replace("/", targetSeparator); if (convertedPath.startsWith(targetSeparator)) { convertedPath = convertedPath.substring(1); } return convertedPath; }

Target:
private String convertPathForAntPathMatcher(Path path, String targetSeparator) { String convertedPath = path.toString().replace("\\", targetSeparator).replace("/", targetSeparator); if (convertedPath.startsWith(targetSeparator)) { convertedPath = convertedPath.substring(targetSeparator.length()); } return convertedPath; }
Source:
private void cancelApplication(Application application, Person canceller, Optional<String> comment) { if (canceller.hasRole(OFFICE)) { application.setStatus(ApplicationStatus.CANCELLED); final Application savedApplication = applicationService.save(application); LOG.info("Cancelled application for leave: {}", savedApplication); final ApplicationComment savedComment = commentService.create(savedApplication, CANCELLED, comment, canceller); applicationMailService.sendCancelledByOfficeNotification(savedApplication, savedComment); } else { application.setStatus(ApplicationStatus.ALLOWED_CANCEL_RE); final Application savedApplication = applicationService.save(application); LOG.info("Request cancellation of application for leave: {}", savedApplication); final ApplicationComment createdComment = commentService.create(savedApplication, CANCEL_REQUESTED, comment, canceller); applicationMailService.sendCancellationRequest(savedApplication, createdComment); } }

Target:
private void cancelApplication(Application application, Person canceller, Optional<String> comment) { if (canceller.hasRole(OFFICE)) { application.setStatus(ApplicationStatus.CANCELLED); final Application savedApplication = applicationService.save(application); LOG.info("Cancelled application for leave: {}", savedApplication); final ApplicationComment savedComment = commentService.create(savedApplication, CANCELLED, comment, canceller); applicationMailService.sendCancelledByOfficeNotification(savedApplication, savedComment); } else { final Application savedApplication = applicationService.save(application); LOG.info("Request cancellation of application for leave: {}", savedApplication); final ApplicationComment createdComment = commentService.create(savedApplication, CANCEL_REQUESTED, comment, canceller); applicationMailService.sendCancellationRequest(savedApplication, createdComment); } }
Source:
public ListenableFuture<?> execute(SetPath statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { throw new PrestoException(GENERIC_INTERNAL_ERROR, format("temporary exception to test set path: %s", statement.getPath())); }

Target:
public ListenableFuture<?> execute(SetPath statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { throw new UnsupportedOperationException("SET PATH not implemented yet"); }
Source:
public void validateUnsupportedLanguage_shouldFailValue() { CreatePaymentRequest createPaymentRequest = createPaymentRequestBuilderWithReturnUrl().language("unsupported language").build(); expectedException.expect(PaymentValidationException.class); expectedException.expect(aValidationExceptionContaining("P0102", "Invalid attribute value: language. Must be \"en\" or \"cy\"")); paymentRequestValidator.validate(createPaymentRequest); }

Target:
public void validateUnsupportedLanguage_shouldFailValue() { CreatePaymentRequest createPaymentRequest = createPaymentRequestBuilderWithReturnUrl().language("unsupported language").build(); expectedException.expect(aValidationExceptionContaining("P0102", "Invalid attribute value: language. Must be \"en\" or \"cy\"")); paymentRequestValidator.validate(createPaymentRequest); }
Source:
public static List<Concept> conceptListHelper(String descriptor) { List<Concept> ret = new ArrayList<>(); Set<String> duplicates = new HashSet<>(); if (descriptor == null || descriptor.length() == 0) { return ret; } ConceptService cs = Context.getConceptService(); for (StringTokenizer st = new StringTokenizer(descriptor, "|"); st.hasMoreTokens();) { String s = st.nextToken().trim(); if(duplicates.contains(s)) { continue; } else { duplicates.add(s); } boolean isSet = s.startsWith("set:"); if (isSet) { s = s.substring(4).trim(); } Concept c = null; if (s.startsWith("name:")) { String name = s.substring(5).trim(); c = cs.getConceptByName(name); } else { try { c = cs.getConcept(Integer.valueOf(s.trim())); } catch (Exception ex) } if (c != null) { if (isSet) { List<Concept> inSet = cs.getConceptsByConceptSet(c); ret.addAll(inSet); } else { ret.add(c); } } } return ret; }

Target:
public static List<Concept> conceptListHelper(String descriptor) { List<Concept> ret = new ArrayList<>(); if (descriptor == null || descriptor.length() == 0) { return ret; } ConceptService cs = Context.getConceptService(); for (StringTokenizer st = new StringTokenizer(descriptor, "|"); st.hasMoreTokens();) { String s = st.nextToken().trim(); boolean isSet = s.startsWith("set:"); if (isSet) { s = s.substring(4).trim(); } Concept c = null; if (s.startsWith("name:")) { String name = s.substring(5).trim(); c = cs.getConceptByName(name); } else { try { c = cs.getConcept(Integer.valueOf(s.trim())); } catch (Exception ex) } if (c != null) { if (isSet) { List<Concept> inSet = cs.getConceptsByConceptSet(c); ret.addAll(inSet); } else { ret.add(c); } } } return ret; }
Source:
public Object getHeader(String name, Supplier<Object> defaultValueSupplier) { IllegalArgumentAssertion.assertNotNull(name, "name"); IllegalArgumentAssertion.assertNotNull(defaultValueSupplier, "defaultValueSupplier"); Object answer = getHeaders().get(name); return answer != null ? answer : defaultValueSupplier.get(); }

Target:
public Object getHeader(String name, Supplier<Object> defaultValueSupplier) { ObjectHelper.notNull(name, "name"); ObjectHelper.notNull(defaultValueSupplier, "defaultValueSupplier"); Object answer = getHeaders().get(name); return answer != null ? answer : defaultValueSupplier.get(); }
Source:
private String variableContent(JobVariable jobVariable) { if (jobVariable.getModel() != null && !jobVariable.getModel().trim().isEmpty()) { return String.format(FOUT_SPACES_INDENT + "<%s %s=\"%s\" %s=\"%s\" %s=\"%s\" />", XMLTags.VARIABLE.getXMLName(), XMLAttributes.VARIABLE_NAME, jobVariable.getName(), XMLAttributes.VARIABLE_VALUE, jobVariable.getValue(), XMLAttributes.VARIABLE_MODEL, jobVariable.getModel()); } else { return String.format(FOUT_SPACES_INDENT + "<%s %s=\"%s\" %s=\"%s\" />", XMLTags.VARIABLE.getXMLName(), XMLAttributes.VARIABLE_NAME, jobVariable.getName(), XMLAttributes.VARIABLE_VALUE, jobVariable.getValue()); } }

Target:
private String variableContent(JobVariable jobVariable) { if (jobVariable.getModel() != null && !jobVariable.getModel().trim().isEmpty()) { return String.format(FOUR_SPACES_INDENT + TAG_WITH_THREE_ATTRIBUTES, XMLTags.VARIABLE.getXMLName(), XMLAttributes.VARIABLE_NAME, jobVariable.getName(), XMLAttributes.VARIABLE_VALUE, jobVariable.getValue(), XMLAttributes.VARIABLE_MODEL, jobVariable.getModel()); } else { return String.format(FOUR_SPACES_INDENT + TAG_WITH_TWO_ATTRIBUTES, XMLTags.VARIABLE.getXMLName(), XMLAttributes.VARIABLE_NAME, jobVariable.getName(), XMLAttributes.VARIABLE_VALUE, jobVariable.getValue()); } }
Source:
public static DecisionRule duplicateDecisionRule(final int index, final DecisionTable dtable) { final DecisionRule rule = new DecisionRule(); final DecisionRule source = dtable.getRule().get(index); for (UnaryTests ie : source.getInputEntry()) { final UnaryTests ut = new UnaryTests(); ut.getText().setValue(ie.getText().getValue()); rule.getInputEntry().add(ut); ut.setParent(rule); } for (LiteralExpression oe : source.getOutputEntry()) { final LiteralExpression le = new LiteralExpression(); le.getText().setValue(oe.getText().getValue()); rule.getOutputEntry().add(le); le.setParent(rule); } final Description d = new Description(); d.setValue(source.getDescription().getValue()); rule.setDescription(d); rule.setParent(dtable); return rule; }

Target:
public static DecisionRule duplicateDecisionRule(final int index, final DecisionTable dtable) { final DecisionRule rule = new DecisionRule(); final DecisionRule source = dtable.getRule().get(index); for (UnaryTests ie : source.getInputEntry()) { final UnaryTests ut = new UnaryTests(); ut.getText().setValue(ie.getText().getValue()); ut.setConstraintType(ie.getConstraintType()); rule.getInputEntry().add(ut); ut.setParent(rule); } for (LiteralExpression oe : source.getOutputEntry()) { final LiteralExpression le = new LiteralExpression(); le.getText().setValue(oe.getText().getValue()); rule.getOutputEntry().add(le); le.setParent(rule); } final Description d = new Description(); d.setValue(source.getDescription().getValue()); rule.setDescription(d); rule.setParent(dtable); return rule; }
Source:
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { super.onLoad(parent, name); if (buildMixIn == null) { buildMixIn = createBuildMixIn(); } buildMixIn.onLoad(parent, name); builds = buildMixIn.getRunMap(); triggers().setOwner(this); for (Trigger t : triggers()) { try { t.start(this, Items.currentlyUpdatingByXml()); } catch (Exception e) { Logger.getLogger(AbstractProject.class.getName()).log(Level.WARNING, "could not start trigger '" + t + "' while loading project '" + name + "'", e); } } if(scm==null) scm = new NullSCM(); if(transientActions==null) transientActions = new Vector<Action>(); updateTransientActions(); }

Target:
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { super.onLoad(parent, name); if (buildMixIn == null) { buildMixIn = createBuildMixIn(); } buildMixIn.onLoad(parent, name); builds = buildMixIn.getRunMap(); triggers().setOwner(this); for (Trigger t : triggers()) { try { t.start(this, Items.currentlyUpdatingByXml()); } catch (Throwable e) { LOGGER.log(Level.WARNING, "could not start trigger while loading project '" + getFullName() + "'", e); } } if(scm==null) scm = new NullSCM(); if(transientActions==null) transientActions = new Vector<Action>(); updateTransientActions(); }
Source:
private void setPropertyIfMetadataPresent( Node node, String propertyName, Object value ) throws RepositoryException { if (value != null) { if (value instanceof String && !StringUtil.isBlank((String) value)) { node.setProperty(propertyName, (String) value); } else if (value instanceof Boolean) { node.setProperty(propertyName, (Boolean) value); } else if (value instanceof Long) { node.setProperty(propertyName, (Long) value); } else if (value instanceof Integer) { node.setProperty(propertyName, new Long((Integer) value)); } else if (value instanceof Double) { node.setProperty(propertyName, (Double) value); } else if (value instanceof Calendar) { node.setProperty(propertyName, (Calendar) value); } else if (value instanceof byte[]) { InputStream is = new ByteArrayInputStream((byte []) value); javax.jcr.Binary binaryProperty = node.getSession().getValueFactory().createBinary(is); node.setProperty(propertyName, binaryProperty); } else if (value instanceof List<?>) { ValueFactory vf = node.getSession().getValueFactory(); List<Value> values = new ArrayList<Value>(); for (Object val : (List<?>) value) { if (val instanceof String) { values.add(vf.createValue((String) val)); } } if (values.size() > 0) { Value[] valuesArray = new Value[values.size()]; values.toArray(valuesArray); node.setProperty(propertyName, valuesArray); } } else { throw new IllegalArgumentException(String.format("The value of the property %s has unknown type and couldn't be saved.", propertyName)); } } }

Target:
private void setPropertyIfMetadataPresent( Node node, String propertyName, Object value ) throws RepositoryException { if (value != null) { if (value instanceof String && !StringUtil.isBlank((String) value)) { node.setProperty(propertyName, (String) value); } else if (value instanceof Boolean) { node.setProperty(propertyName, (Boolean) value); } else if (value instanceof Long) { node.setProperty(propertyName, (Long) value); } else if (value instanceof Integer) { node.setProperty(propertyName, new Long((Integer) value)); } else if (value instanceof Double) { node.setProperty(propertyName, (Double) value); } else if (value instanceof Calendar) { node.setProperty(propertyName, (Calendar) value); } else if (value instanceof byte[]) { InputStream is = new ByteArrayInputStream((byte []) value); javax.jcr.Binary binaryProperty = node.getSession().getValueFactory().createBinary(is); node.setProperty(propertyName, binaryProperty); } else if (value instanceof List<?>) { ValueFactory vf = node.getSession().getValueFactory(); List<Value> values = new ArrayList<Value>(); for (Object val : (List<?>) value) { if (val instanceof String) { values.add(vf.createValue((String) val)); } } if (values.size() > 0) { node.setProperty(propertyName, values.toArray(new Value[values.size()])); } } else { throw new IllegalArgumentException(String.format("The value of the property %s has unknown type and couldn't be saved.", propertyName)); } } }
Source:
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException { Query<Boolean> connectQuery = new Query<Boolean>() { @Override public void execute(DataRequestMonitor<Boolean> rm) { connect(rm); } }; try { fExecutor.execute(connectQuery); connectQuery.get(); } catch (InterruptedException e) { } catch (ExecutionException e) { } catch (CancellationException e) { System.out.println(); } catch (RejectedExecutionException e) { } }

Target:
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException { Query<Boolean> connectQuery = new Query<Boolean>() { @Override public void execute(DataRequestMonitor<Boolean> rm) { connect(rm); } }; try { fExecutor.execute(connectQuery); connectQuery.get(); } catch (InterruptedException e) { } catch (ExecutionException e) { } catch (CancellationException e) { } catch (RejectedExecutionException e) { } }
Source:
void send(Feature feature, FeatureStateStorageWrapper storageWrapper) { String featureName = feature.name(); try { LOG.info("Starting to update state of feature {}.", featureName); String featureStateAsString = serialize(storageWrapper); LOG.info("Successfully serialized state of feature {}.", featureName); producer.send(buildRecord(featureName, featureStateAsString), buildCallback(featureName)); } catch (Exception e) { LOG.error("An error occurred while updating state of feature {}.", featureName, e); } }

Target:
private void send(Feature feature, FeatureStateStorageWrapper storageWrapper) { String featureName = feature.name(); try { LOG.debug("Starting to update state of feature {}.", featureName); String featureStateAsString = serialize(storageWrapper); LOG.debug("Successfully serialized state of feature {}.", featureName); producer.send(buildRecord(featureName, featureStateAsString), buildCallback(featureName)); } catch (Exception e) { LOG.error("An error occurred while updating state of feature {}.", featureName, e); } }
Source:
public AbstractUID(List<String> segments) { int minNumberOfSegments = getMinimalNumberOfSegments(); int numberOfSegments = segments.size(); if (numberOfSegments < minNumberOfSegments) { throw new IllegalArgumentException( String.format("UID must have at least %d segments.", minNumberOfSegments)); } for (int i = 0; i < numberOfSegments; i++) { String segment = segments.get(i); validateSegment(segment, i, numberOfSegments); } this.segments = segments; }

Target:
public AbstractUID(List<String> segments) { int minNumberOfSegments = getMinimalNumberOfSegments(); int numberOfSegments = segments.size(); if (numberOfSegments < minNumberOfSegments) { throw new IllegalArgumentException( String.format("UID must have at least %d segments.", minNumberOfSegments)); } for (int i = 0; i < numberOfSegments; i++) { String segment = segments.get(i); validateSegment(segment, i, numberOfSegments); } this.segments = Collections.unmodifiableList(new ArrayList<>(segments)); }
Source:
private void runPlumberAPI() { source_.withSaveFilesBeforeCommand(new Command() { @Override public void execute() { events_.fireEvent(new LaunchPlumberAPIEvent(getPath())); } }, new Command() { public void execute() { } }, "Run Plumber API"); }

Target:
private void runPlumberAPI() { source_.withSaveFilesBeforeCommand(new Command() { @Override public void execute() { events_.fireEvent(new LaunchPlumberAPIEvent(getPath())); } }, () -> {}, "Run Plumber API"); }
Source:
private void initServerBootstrap() { eventLoopGroup = new NioEventLoopGroup(); serverBootstrap = new ServerBootstrap() .group(eventLoopGroup) .channel(NioServerSocketChannel.class) .childHandler(new RestfulServiceChannelInitializer(configuration)); }

Target:
private void initServerBootstrap() { bossEventLoopGroup = new NioEventLoopGroup(); workerEventLoopGroup = new NioEventLoopGroup(DEFAULT_WORKER_GROUP_THREADS); serverBootstrap = new ServerBootstrap() .group(bossEventLoopGroup, workerEventLoopGroup) .channel(NioServerSocketChannel.class) .childHandler(new RestfulServiceChannelInitializer(configuration)); }
Source:
private void installPendingUpdate() { InstallStagedUpdateTask<LoginActivity> task = new InstallStagedUpdateTask<LoginActivity>(TASK_UPGRADE_INSTALL) { @Override protected void deliverResult(LoginActivity receiver, AppInstallStatus result) { if (result == AppInstallStatus.Installed) { Toast.makeText(LoginActivity.this, Localization.get("login.update.install.success"), Toast.LENGTH_LONG).show(); } else { CommCareApplication._().reportNotificationMessage(NotificationMessageFactory.message(result)); } } @Override protected void deliverUpdate(LoginActivity receiver, int[]... update) { } @Override protected void deliverError(LoginActivity receiver, Exception e) { e.printStackTrace(); Log.e(TAG, "update installation on login failed: " + e.getMessage()); Toast.makeText(LoginActivity.this, Localization.get("login.update.install.success"), Toast.LENGTH_LONG).show(); } }; task.connect(this); task.execute(); }

Target:
private void installPendingUpdate() { InstallStagedUpdateTask<LoginActivity> task = new InstallStagedUpdateTask<LoginActivity>(TASK_UPGRADE_INSTALL) { @Override protected void deliverResult(LoginActivity receiver, AppInstallStatus result) { if (result == AppInstallStatus.Installed) { Toast.makeText(receiver, Localization.get("login.update.install.success"), Toast.LENGTH_LONG).show(); } else { CommCareApplication._().reportNotificationMessage(NotificationMessageFactory.message(result)); } localLoginOrPullAndLogin(); } @Override protected void deliverUpdate(LoginActivity receiver, int[]... update) { } @Override protected void deliverError(LoginActivity receiver, Exception e) { e.printStackTrace(); Log.e(TAG, "update installation on login failed: " + e.getMessage()); Toast.makeText(receiver, Localization.get("login.update.install.failure"), Toast.LENGTH_LONG).show(); localLoginOrPullAndLogin(); } }; task.connect(this); task.execute(); }
Source:
public Selector build() { Preconditions.checkState(this.type != null); boolean requiresLocation = this.arguments.containsKey("x") || this.arguments.containsKey("y") || this.arguments.containsKey("z") || this.arguments.containsKey("dx") || this.arguments.containsKey("dy") || this.arguments.containsKey("dz") || this.arguments.containsKey("rm") || this.arguments.containsKey("r") || (this.arguments.containsKey("c") && !this.type.equals(SelectorTypes.RANDOM_PLAYER)); return new SpongeSelector(this.type, this.arguments, requiresLocation); }

Target:
public Selector build() { Preconditions.checkState(this.type != null); boolean requiresLocation = Collections.disjoint(this.arguments.keySet(), LOCATION_DEPENDENT_ARGS) || this.type.equals(SelectorTypes.NEAREST_PLAYER) || (this.arguments.containsKey("c") && !this.type.equals(SelectorTypes.RANDOM_PLAYER)); return new SpongeSelector(this.type, this.arguments, requiresLocation); }
Source:
private HoverDto hover(TextDocumentPositionParams positionParams) { String uri = prefixURI(positionParams.getTextDocument().getUri()); positionParams.getTextDocument().setUri(uri); positionParams.setUri(prefixURI(positionParams.getUri())); HoverDto result = new HoverDto(); result.setContents(new ArrayList<>()); try { List<InitializedLanguageServer> servers = languageServerRegistry.getApplicableLanguageServers(uri).stream() .flatMap(Collection::stream).collect(toList()); OperationUtil.doInParallel(servers, new LSOperation<InitializedLanguageServer, Hover>() { @Override public boolean canDo(InitializedLanguageServer element) { return truish(element.getInitializeResult().getCapabilities().getHoverProvider()); } @Override public CompletableFuture<Hover> start(InitializedLanguageServer element) { return element.getServer().getTextDocumentService().hover(positionParams); } @Override public boolean handleResult(InitializedLanguageServer element, Hover hover) { if (hover != null) { List<Either<String, MarkedString>> contents = hover.getContents().stream() .map((Function<Either<String, MarkedString>, Either<String, MarkedString>>)either -> { String left = either.getLeft(); if (left != null) { return Either.forLeft(left); } MarkedString right = new MarkedStringDto(either.getRight()); return Either.forRight(right); }).collect(toList()); result.getContents().addAll(contents); } return true; } }, 10000); return result; } catch (LanguageServerException e) { throw new JsonRpcException(-27000, e.getMessage()); } }

Target:
private HoverDto hover(TextDocumentPositionParams positionParams) { String uri = prefixURI(positionParams.getTextDocument().getUri()); positionParams.getTextDocument().setUri(uri); positionParams.setUri(prefixURI(positionParams.getUri())); HoverDto result = new HoverDto(); result.setContents(new ArrayList<>()); try { List<InitializedLanguageServer> servers = languageServerRegistry.getApplicableLanguageServers(uri).stream() .flatMap(Collection::stream).collect(Collectors.toList()); OperationUtil.doInParallel(servers, new LSOperation<InitializedLanguageServer, Hover>() { @Override public boolean canDo(InitializedLanguageServer element) { return truish(element.getInitializeResult().getCapabilities().getHoverProvider()); } @Override public CompletableFuture<Hover> start(InitializedLanguageServer element) { return element.getServer().getTextDocumentService().hover(positionParams); } @Override public boolean handleResult(InitializedLanguageServer element, Hover hover) { if (hover != null) { HoverDto hoverDto = new HoverDto(hover); result.getContents().addAll(hoverDto.getContents()); } return true; } }, 10000); return result; } catch (LanguageServerException e) { throw new JsonRpcException(-27000, e.getMessage()); } }
Source:
public void setContext( final ProjectContext context, final boolean includeDefaultPackage, final Command packagesLoadedCommand ) { noPackage(); packages.clear(); if ( context.getActiveProject() == null ) { return; } final Package activePackage = context.getActivePackage(); projectService.call( new RemoteCallback<Set<Package>>() { @Override public void callback( final Set<Package> pkgs ) { final List<Package> sortedPackages = new ArrayList<Package>(); sortedPackages.addAll( pkgs ); Collections.sort( sortedPackages, new Comparator<Package>() { @Override public int compare( final Package p1, final Package p2 ) { return p1.getCaption().compareTo( p2.getCaption() ); } } ); if ( !includeDefaultPackage ) { sortedPackages.remove( 0 ); } if ( sortedPackages.size() == 0 ) { return; } addPackagesToSelect( sortedPackages, activePackage ); if ( packagesLoadedCommand != null ) { packagesLoadedCommand.execute(); } } } ).resolvePackages( context.getActiveProject() ); }

Target:
public void setContext( final ProjectContext context, final boolean includeDefaultPackage, final Command packagesLoadedCommand ) { noPackage(); packages.clear(); if ( context.getActiveProject() == null ) { return; } final Package activePackage = context.getActivePackage(); projectService.call( new RemoteCallback<Set<Package>>() { @Override public void callback( final Set<Package> pkgs ) { final List<Package> sortedPackages = new ArrayList<Package>(); sortedPackages.addAll( pkgs ); Collections.sort( sortedPackages, ( p1, p2 ) -> p1.getCaption().compareTo( p2.getCaption() ) ); if ( !includeDefaultPackage ) { sortedPackages.remove( 0 ); } if ( sortedPackages.size() == 0 ) { return; } addPackagesToSelect( sortedPackages, activePackage ); if ( packagesLoadedCommand != null ) { packagesLoadedCommand.execute(); } } } ).resolvePackages( context.getActiveProject() ); }
Source:
public Cluster create(AutoscaleStackV4Response stack) { Cluster cluster = new Cluster(); cluster.setStackName(stack.getName()); cluster.setStackCrn(stack.getStackCrn()); cluster.setStackId(stack.getStackId()); cluster.setStackType(stack.getStackType()); cluster.setTunnel(stack.getTunnel()); cluster.setState(ClusterState.PENDING); if (stack.getCloudPlatform() != null) { cluster.setCloudPlatform(stack.getCloudPlatform().toUpperCase()); } String gatewayPort = String.valueOf(stack.getGatewayPort()); ClusterManager clusterManager = new ClusterManager(stack.getClusterManagerIp(), gatewayPort, stack.getUserNamePath(), stack.getPasswordPath(), ClusterManagerVariant.CLOUDERA_MANAGER); cluster.setClusterManager(clusterManager); ClusterPertain clusterPertain = new ClusterPertain(stack.getTenant(), stack.getWorkspaceId(), stack.getUserId(), stack.getUserCrn()); cluster.setClusterPertain( clusterPertainRepository.findByUserId(clusterPertain.getUserId()) .orElseGet(() -> clusterPertainRepository.save(clusterPertain))); cluster = save(cluster); securityConfigService.syncSecurityConfigForCluster(cluster.getId()); calculateClusterStateMetrics(); return cluster; }

Target:
public Cluster create(AutoscaleStackV4Response stack) { Cluster cluster = new Cluster(); cluster.setStackName(stack.getName()); cluster.setStackCrn(stack.getStackCrn()); cluster.setStackId(stack.getStackId()); cluster.setStackType(stack.getStackType()); cluster.setTunnel(stack.getTunnel()); cluster.setState(ClusterState.PENDING); if (stack.getCloudPlatform() != null) { cluster.setCloudPlatform(stack.getCloudPlatform().toUpperCase()); } String gatewayPort = String.valueOf(stack.getGatewayPort()); ClusterManager clusterManager = new ClusterManager(stack.getClusterManagerIp(), gatewayPort, stack.getUserNamePath(), stack.getPasswordPath(), ClusterManagerVariant.CLOUDERA_MANAGER); cluster.setClusterManager(clusterManager); ClusterPertain clusterPertain = new ClusterPertain(stack.getTenant(), stack.getWorkspaceId(), stack.getUserId(), stack.getUserCrn()); cluster.setClusterPertain( clusterPertainRepository.findByUserCrn(clusterPertain.getUserCrn()) .orElseGet(() -> clusterPertainRepository.save(clusterPertain))); cluster = save(cluster); securityConfigService.syncSecurityConfigForCluster(cluster.getId()); calculateClusterStateMetrics(); return cluster; }
Source:
public void run() { ui.header("Git Repositories"); File d = gerrit.path("Location of Git repositories", "basePath", "git"); File b = gerrit.path("Location of archive directory", "archivePath", "git"); if (d == null) { throw die("gerrit.basePath is required"); } if (b == null) { throw die("gerrit.archivePath is required"); } if (!d.exists() && !d.mkdirs()) { throw die("Cannot create " + d); } if (!b.exists() && !b.mkdirs()) { throw die("Cannot create " + b); } }

Target:
public void run() { ui.header("Git Repositories"); File d = gerrit.path("Location of Git repositories", "basePath", "git"); File b = gerrit.path("Location of archive directory", "archivePath", "archive"); if (d == null) { throw die("gerrit.basePath is required"); } if (b == null) { throw die("gerrit.archivePath is required"); } if (!d.exists() && !d.mkdirs()) { throw die("Cannot create " + d); } if (!b.exists() && !b.mkdirs()) { throw die("Cannot create " + b); } }
Source:
public void testZkConnectionManager() { final String TEST_ROOT = "/testZkConnectionManager/IDEALSTATES"; final String TEST_PATH = TEST_ROOT + TEST_NODE + TestHelper.getTestMethodName(); ZkConnectionManager zkConnectionManager = new ZkConnectionManager(new ZkConnection(ZK_ADDR), HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, null); Assert.assertTrue(zkConnectionManager.waitUntilConnected(1, TimeUnit.SECONDS)); zkConnectionManager.createPersistent(TEST_PATH, true); zkConnectionManager.writeData(TEST_PATH, "Test"); Assert.assertNotNull(zkConnectionManager.readData(TEST_PATH)); zkConnectionManager.deleteRecursively(TEST_ROOT); SharedZkClient sharedZkClient = new SharedZkClient(zkConnectionManager, new HelixZkClient.ZkClientConfig(), null); try { zkConnectionManager.close(); Assert.fail("Dedicated ZkClient cannot be closed while sharing!"); } catch (ZkClientException hex) { } sharedZkClient.close(); Assert.assertTrue(sharedZkClient.isClosed()); Assert.assertFalse(sharedZkClient.waitUntilConnected(100, TimeUnit.MILLISECONDS)); zkConnectionManager.close(); Assert.assertTrue(zkConnectionManager.isClosed()); Assert.assertFalse(zkConnectionManager.waitUntilConnected(100, TimeUnit.MILLISECONDS)); try { new SharedZkClient(zkConnectionManager, new HelixZkClient.ZkClientConfig(), null); Assert.fail("Sharing a closed dedicated ZkClient shall fail."); } catch (ZkClientException hex) { } deleteCluster("testZkConnectionManager"); }

Target:
public void testZkConnectionManager() { final String TEST_ROOT = "/testZkConnectionManager/IDEALSTATES"; final String TEST_PATH = TEST_ROOT + TEST_NODE; ZkConnectionManager zkConnectionManager = new ZkConnectionManager(new ZkConnection(ZK_ADDR), HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, null); Assert.assertTrue(zkConnectionManager.waitUntilConnected(1, TimeUnit.SECONDS)); zkConnectionManager.createPersistent(TEST_PATH, true); zkConnectionManager.writeData(TEST_PATH, "Test"); Assert.assertNotNull(zkConnectionManager.readData(TEST_PATH)); zkConnectionManager.deleteRecursively(TEST_ROOT); SharedZkClient sharedZkClient = new SharedZkClient(zkConnectionManager, new HelixZkClient.ZkClientConfig(), null); try { zkConnectionManager.close(); Assert.fail("Dedicated ZkClient cannot be closed while sharing!"); } catch (ZkClientException hex) { } sharedZkClient.close(); Assert.assertTrue(sharedZkClient.isClosed()); Assert.assertFalse(sharedZkClient.waitUntilConnected(100, TimeUnit.MILLISECONDS)); zkConnectionManager.close(); Assert.assertTrue(zkConnectionManager.isClosed()); Assert.assertFalse(zkConnectionManager.waitUntilConnected(100, TimeUnit.MILLISECONDS)); try { new SharedZkClient(zkConnectionManager, new HelixZkClient.ZkClientConfig(), null); Assert.fail("Sharing a closed dedicated ZkClient shall fail."); } catch (ZkClientException hex) { } deleteCluster("testZkConnectionManager"); }
Source:
public void enrichAnnotation(VariantAnnotation variantAnnotation) { if (enrichers != null) { Iterator<Entry<String, AnnotationEnricher>> it = enrichers.entrySet().iterator(); while (it.hasNext()) { Entry<String, AnnotationEnricher> enricher = it.next(); try { enricher.getValue().enrich(variantAnnotation); } catch (Exception e) { LOG.warn("Failed to enrich with " + enricher.getKey() + ": " + variantAnnotation.getVariant() + " " + e.getLocalizedMessage()); } } for (AnnotationEnricher enricher: enrichers.values()) { try { enricher.enrich(variantAnnotation); } catch (Exception e) { } } } }

Target:
public void enrichAnnotation(VariantAnnotation variantAnnotation) { if (enrichers != null) { Iterator<Entry<String, AnnotationEnricher>> it = enrichers.entrySet().iterator(); while (it.hasNext()) { Entry<String, AnnotationEnricher> enricher = it.next(); try { enricher.getValue().enrich(variantAnnotation); } catch (Exception e) { LOG.warn("Failed to enrich with " + enricher.getKey() + ": " + variantAnnotation.getVariant() + " " + e.getLocalizedMessage()); } } } }
Source:
public void testForValueOn() { final AdministrativeStatusType administrativeStatusType = AdministrativeStatusType.ON; final AdministrativeStatusTypeDto administrativeStatusTypeDto = this.configurationMapper.map( administrativeStatusType, AdministrativeStatusTypeDto.class); assertNotNull(administrativeStatusType); assertNotNull(administrativeStatusTypeDto); assertEquals(administrativeStatusType.value(), administrativeStatusTypeDto.value()); }

Target:
public void testForValueOn() { final AdministrativeStatusType administrativeStatusType = AdministrativeStatusType.ON; final AdministrativeStatusTypeDto administrativeStatusTypeDto = this.configurationMapper.map( administrativeStatusType, AdministrativeStatusTypeDto.class); assertNotNull(administrativeStatusTypeDto); assertEquals(administrativeStatusType.value(), administrativeStatusTypeDto.value()); }
Source:
public TransactionTemplate() { this( null, new Monitor.Adapter(), 0, 0, ex -> !Error.class.isInstance( ex ) && !TransactionTerminatedException.class.isInstance( ex ) ); }

Target:
public TransactionTemplate() { this( (GraphDatabaseService) Proxy.newProxyInstance( GraphDatabaseService.class.getClassLoader(), new Class<?>[]{GraphDatabaseService.class}, ( proxy, method, args ) -> { throw new IllegalArgumentException( "You need to call 'with(GraphDatabaseService)' on the template in order to use it" ); } ), new Monitor.Adapter(), 0, 0, ex -> !Error.class.isInstance( ex ) && !TransactionTerminatedException.class.isInstance( ex ) ); }
Source:
public int read(byte[] bytes, int offset, int length) throws IOException { if (length == 0) { return 0; } if (position >= streamSize) { return -1; } int count = (int) Math.min(length, streamSize - position); Arrays.fill(bytes, offset, offset + count, (byte) 0); position += count; return count; }

Target:
public int read(byte[] bytes, int offset, int length) throws IOException { if (bytes == null) { throw new NullPointerException(); } else if (offset < 0 || length < 0 || length > bytes.length - offset) { throw new IndexOutOfBoundsException(); } else if (length == 0) { return 0; } if (position >= streamSize) { return -1; } int count = (int) Math.min(length, streamSize - position); Arrays.fill(bytes, offset, offset + count, (byte) 0); position += count; return count; }
Source:
public void setOnForceCompleteListener(@Nullable OnForceCompleteListener l) { this.onForceCompleteListener = l; post(() -> { if (!isFocused()) { onForceComplete(-2, AdapterView.INVALID_ROW_ID); } }); }

Target:
public void setOnForceCompleteListener(@Nullable OnForceCompleteListener l) { this.onForceCompleteListener = l; post(() -> { if (!isFocused()) { onForceComplete(AdapterView.INVALID_POSITION, AdapterView.INVALID_ROW_ID); } }); }