auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void reset(Checkpoint checkpoint) throws Exception { TRACE.log(TraceLevel.DEBUG, "Reset to checkpoint " + checkpoint.getSequenceId(), CONSISTEN_ASPECT); if (fFileToWrite != null) fFileToWrite.close(); String path = (String)checkpoint.getInputStream().readObject(); long tupleCnt = checkpoint.getInputStream().readLong(); long size = checkpoint.getInputStream().readLong(); int fileNum = checkpoint.getInputStream().readInt(); if (dynamicFilename) { rawFileName = (String) checkpoint.getInputStream().readObject(); if (rawFileName == null) rawFileName = ""; } createFile(path); fFileToWrite.setTupleCnt(tupleCnt); fFileToWrite.setSize(size); fFileToWrite.setAppend(true); currentFileName = path; this.fileNum = fileNum; unsetRestarting(); }

Target:
public void reset(Checkpoint checkpoint) throws Exception { TRACE.log(TraceLevel.DEBUG, "Reset to checkpoint " + checkpoint.getSequenceId(), CONSISTEN_ASPECT); if (fFileToWrite != null) closeFile(); String path = (String)checkpoint.getInputStream().readObject(); long tupleCnt = checkpoint.getInputStream().readLong(); long size = checkpoint.getInputStream().readLong(); int fileNum = checkpoint.getInputStream().readInt(); if (dynamicFilename) { rawFileName = (String) checkpoint.getInputStream().readObject(); if (rawFileName == null) rawFileName = ""; } createFile(path); fFileToWrite.setTupleCnt(tupleCnt); fFileToWrite.setSize(size); fFileToWrite.setAppend(true); currentFileName = path; this.fileNum = fileNum; unsetRestarting(); }
Source:
public void service(Mail mail) { String logs = ""; logs += logComment(); try { logs += logHeaders(mail) + logBody(mail) + logAttribute(mail); switch (logLevel) { case INFO: logger.info(logs); break; case DEBUG: logger.debug(logs); break; case ERROR: logger.error(logs); break; case WARN: logger.warn(logs); break; default: logger.info(logs); break; } } catch (MessagingException | IOException e) { logger.error("Error logging message.", e); } if (!passThrough) { mail.setState(Mail.GHOST); } }

Target:
public void service(Mail mail) { StringBuilder logs = new StringBuilder(); logs.append(commentLog()); try { logs.append(headersLog(mail)); logs.append(bodyLog(mail)); logs.append(attributeLog(mail)); logLevel.log().accept(logger, logs.toString()); } catch (MessagingException | IOException e) { logger.error("Error logging message.", e); } if (!passThrough) { mail.setState(Mail.GHOST); } }
Source:
public void createPartControl(Composite parent) { String name = getViewSite().getSecondaryId(); if (name != null) { name = TmfViewFactory.getBaseSecId(name); } if (name != null) { fViewInfo.setName(name); } fPresentationProvider = new XmlPresentationProvider(name); TimeGraphViewer timeGraphViewer = getTimeGraphViewer(); timeGraphViewer.getTimeGraphControl().colorSettingsChanged(timeGraphViewer.getTimeGraphProvider().getStateTable()); super.createPartControl(parent); }

Target:
public void createPartControl(Composite parent) { String name = getViewSite().getSecondaryId(); if (name != null) { name = TmfViewFactory.getBaseSecId(name); } if (name != null) { fViewInfo.setName(name); } fPresentationProvider = new XmlPresentationProvider(name); super.createPartControl(parent); TimeGraphViewer timeGraphViewer = getTimeGraphViewer(); timeGraphViewer.getTimeGraphControl().colorSettingsChanged(timeGraphViewer.getTimeGraphProvider().getStateTable()); }
Source:
public NewHostModel() { super(); getExternalHostName().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { hostName_SelectedItemChanged(); } }); getExternalHostName().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getExternalDiscoveredHosts().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { discoverHostName_SelectedItemChanged(); } }); getExternalDiscoveredHosts().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getExternalHostProviderEnabled().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getProviders().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { getProviders().setIsChangable(false); providers_SelectedItemChanged(); if (getIsDiscorveredHosts().getEntity() != null) { updateHostList(getIsDiscorveredHosts().getEntity()); } else { updateHostList(true); updateHostList(false); } } }); getProviders().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getProviderSearchFilter().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getProviderSearchFilterLabel().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getExternalHostProviderEnabled().setEntity(false); setEnableSearchHost(false); }

Target:
public NewHostModel() { super(); getExternalHostName().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { hostName_SelectedItemChanged(); } }); getExternalHostName().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getExternalDiscoveredHosts().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { discoverHostName_SelectedItemChanged(); } }); getExternalDiscoveredHosts().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getExternalHostProviderEnabled().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getProviders().getSelectedItemChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { getProviders().setIsChangable(false); providers_SelectedItemChanged(); updateHostList(); } }); getProviders().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getProviderSearchFilter().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getProviderSearchFilterLabel().setIsAvailable(ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly); getExternalHostProviderEnabled().setEntity(false); setEnableSearchHost(false); }
Source:
public BeaconImpl() { this.id(ID); this.name(NAME); this.apiVersion(APIVERSION); this.organization(new BeaconOrganizationImpl()); this.description(DESCRIPTION); this.version(VERSION); this.welcomeUrl(WELCOME_URL); this.alternativeUrl(ALTERNATIVE_URL); this.createDateTime(CREATED_DATE_TIME); this.updateDateTime(UPDATE_DATE_TIME); }

Target:
public BeaconImpl() { setId(ID); setName(NAME); setApiVersion(API_VERSION); setOrganization(new BeaconOrganizationImpl()); setDescription(DESCRIPTION); setVersion(VERSION); setWelcomeUrl(WELCOME_URL); }
Source:
public java.io.InputStream searchAsInputStream(DiscoverQuery query) throws SearchServiceException, java.io.IOException { if(getSolr() == null) { return null; } HttpHost hostURL = (HttpHost)(getSolr().getHttpClient().getParams().getParameter(ClientPNames.DEFAULT_HOST)); HttpPost post = new HttpPost(hostURL.toHostString()); List<NameValuePair> postParameters = new ArrayList<>(); postParameters.add(new BasicNameValuePair("q",query.toString())); HttpResponse response = getSolr().getHttpClient().execute(post); return response.getEntity().getContent(); }

Target:
public java.io.InputStream searchAsInputStream(DiscoverQuery query) throws SearchServiceException, java.io.IOException { if(getSolr() == null) { return null; } HttpHost hostURL = (HttpHost)(getSolr().getHttpClient().getParams().getParameter(ClientPNames.DEFAULT_HOST)); HttpPost post = new HttpPost(hostURL.toHostString()); List<NameValuePair> postParameters = new ArrayList<>(); postParameters.add(new BasicNameValuePair("q",query.toString())); post.setEntity(new UrlEncodedFormEntity(postParameters)); HttpResponse response = getSolr().getHttpClient().execute(post); return response.getEntity().getContent(); }
Source:
public void shouldInjectParamValueModificationInGeneralParam() { VariantMultipartFormParameters variant = new VariantMultipartFormParameters(); HttpMessage message = createMessage(); String paramName = "person"; String newValue = "injected"; variant.setMessage(message); variant.setParameter(message, new NameValuePair(NameValuePair.TYPE_POST_DATA, paramName, DEFAULT_PARAM_CONTENT, 1), paramName, newValue); StringBuilder testBodyBuilder = new StringBuilder(320); testBodyBuilder.append("--------------------------d74496d66958873e").append(CRLF); testBodyBuilder.append("Content-Disposition: form-data; name=\"person\"").append(CRLF); testBodyBuilder.append(CRLF); testBodyBuilder.append(newValue).append(CRLF); testBodyBuilder.append("--------------------------d74496d66958873e").append(CRLF); testBodyBuilder.append("Content-Disposition: form-data; name=\"somefile\"; filename=\"file.ext\"").append(CRLF); testBodyBuilder.append("Content-Type: ").append(DEFAULT_CONTENT_TYPE).append(CRLF); testBodyBuilder.append(CRLF); testBodyBuilder.append(DEFAULT_FILE_PARAM_CONTENT).append(CRLF); testBodyBuilder.append("--------------------------d74496d66958873e--").append(CRLF); assertTrue(message.getRequestBody().toString().equals(testBodyBuilder.toString())); }

Target:
public void shouldInjectParamValueModificationInGeneralParam() { VariantMultipartFormParameters variant = new VariantMultipartFormParameters(); HttpMessage message = createMessage(); String paramName = "person"; String newValue = "injected"; variant.setMessage(message); variant.setParameter(message, new NameValuePair(NameValuePair.TYPE_POST_DATA, paramName, DEFAULT_PARAM_CONTENT, 1), paramName, newValue); HttpMessage newMsg = createMessage(newValue, DEFAULT_FILE_NAME, DEFAULT_CONTENT_TYPE, DEFAULT_FILE_PARAM_CONTENT); assertThat(message.getRequestBody().toString(), equalTo(newMsg.getRequestBody().toString())); }
Source:
public boolean finished() { return !processFuture.isCancelled() && !processFuture.isDone(); }

Target:
public boolean finished() { return processFuture.isDone(); }
Source:
public Page getOutput() { if (!pageBuilder.isFull() && probe != null) { processProbe(); } if (pageBuilder.isFull()) { Page page = pageBuilder.build(); pageBuilder.reset(); return page; } if (finishing) { Page page = null; if (!pageBuilder.isEmpty()) { page = pageBuilder.build(); pageBuilder.reset(); } finished = true; return page; } return null; }

Target:
public Page getOutput() { verify(!finished); if (!pageBuilder.isFull() && probe != null) { processProbe(); } if (pageBuilder.isFull()) { Page page = pageBuilder.build(); pageBuilder.reset(); return page; } if (finishing && probe == null) { Page page = null; if (!pageBuilder.isEmpty()) { page = pageBuilder.build(); pageBuilder.reset(); } pagesSpatialIndexFactory.probeOperatorFinished(); pagesSpatialIndexFuture = null; finished = true; return page; } return null; }
Source:
public GerritClient getAdminClient() { if (adminClient == null) { String adminUsername = "admin@mylyn.eclipse.org"; String adminPassword = "mylyntest"; WebLocation location = new WebLocation(GerritFixture.current().getRepositoryUrl(), adminUsername, adminPassword, new IProxyProvider() { public Proxy getProxyForHost(String host, String proxyType) { return WebUtil.getProxyForUrl(GerritFixture.current().getRepositoryUrl()); } }); TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository( GerritFixture.current().getRepositoryUrl()); adminClient = new GerritClient(repository, location); } return adminClient; }

Target:
public GerritClient getAdminClient() { if (adminClient == null) { UserCredentials credentials = GerritFixture.current().getCredentials(PrivilegeLevel.ADMIN); WebLocation location = new WebLocation(GerritFixture.current().getRepositoryUrl(), credentials.getUserName(), credentials.getPassword(), new IProxyProvider() { public Proxy getProxyForHost(String host, String proxyType) { return WebUtil.getProxyForUrl(GerritFixture.current().getRepositoryUrl()); } }); TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository( GerritFixture.current().getRepositoryUrl()); adminClient = new GerritClient(repository, location); } return adminClient; }
Source:
public Response getEvents(@PathParam(value = "name") String traceName, ControlFlowViewRequestFilter req) { TraceModel traceModel = traceManager.get(traceName); if (traceModel == null) { return Response.status(Status.NOT_FOUND).entity("No Such Trace").build(); } ITimeGraphDataProvider provider = analysisManager.getTimeGraphProvider(traceModel, CONTROL_FLOW); if (provider == null) { return Response.status(Status.METHOD_NOT_ALLOWED).entity("Analysis cannot run").build(); } TmfModelResponse<List<ITimeGraphRowModel>> response = provider.fetchRowModel(new TimeGraphQueryFilter(req.getEntries(), req.getStart(), req.getEnd(), req.getResolution()), null); if (response.getStatus() == TmfModelResponse.Status.CANCELLED || response.getStatus() == TmfModelResponse.Status.FAILED) { return Response.serverError().entity(response.getStatusMessage()).build(); } return Response.ok() .entity(response.getModel()).build(); }

Target:
public Response getEvents(@PathParam(value = "name") String traceName, ControlFlowViewRequestFilter req) { TraceModel traceModel = traceManager.get(traceName); if (traceModel == null) { return Response.status(Status.NOT_FOUND).entity("No Such Trace").build(); } ITimeGraphDataProvider provider = analysisManager.getTimeGraphProvider(traceModel, CONTROL_FLOW); if (provider == null) { return Response.status(Status.METHOD_NOT_ALLOWED).entity("Analysis cannot run").build(); } TmfModelResponse<List<ITimeGraphRowModel>> response = provider.fetchRowModel(new TimeGraphQueryFilter(req.getEntries(), req.getStart(), req.getEnd(), req.getResolution()), null); if (response.getStatus() == TmfModelResponse.Status.CANCELLED || response.getStatus() == TmfModelResponse.Status.FAILED) { return Response.serverError().entity(response.getStatusMessage()).build(); } return Response.ok() .entity(response).build(); }
Source:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { Preconditions.checkNotNull(emitExpressions); Schema inputSchema = Objects.requireNonNull(getChild().getSchema()); List<GenericEvaluator> evals = new ArrayList<>(); final ExpressionOperatorParameter parameters = new ExpressionOperatorParameter( inputSchema, null, getNodeID(), getPythonFunctionRegistrar()); for (Expression expr : emitExpressions) { GenericEvaluator evaluator; if (expr.isConstant()) { evaluator = new ConstantEvaluator(expr, parameters); } else if (expr.isRegisteredPythonUDF()) { evaluator = new PythonUDFEvaluator(expr, parameters); } else { evaluator = new GenericEvaluator(expr, parameters); } evaluator.compile(); Preconditions.checkArgument(!evaluator.needsState()); evals.add(evaluator); } setEmitEvaluators(evals); outputBuffer = new TupleBatchBuffer(generateSchema()); }

Target:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { Preconditions.checkNotNull(emitExpressions); Schema inputSchema = Objects.requireNonNull(getChild().getSchema()); List<GenericEvaluator> evals = new ArrayList<>(); final ExpressionOperatorParameter parameters = new ExpressionOperatorParameter( inputSchema, null, getNodeID(), getPythonFunctionRegistrar()); for (Expression expr : emitExpressions) { GenericEvaluator evaluator; if (expr.isConstant()) { evaluator = new ConstantEvaluator(expr, parameters); } else if (expr.isRegisteredPythonUDF()) { evaluator = new PythonUDFEvaluator(expr, parameters); } else { evaluator = new GenericEvaluator(expr, parameters); } Preconditions.checkArgument(!evaluator.needsState()); evals.add(evaluator); } setEmitEvaluators(evals); outputBuffer = new TupleBatchBuffer(generateSchema()); }
Source:
public ChannelFuture write(Object obj) { if (obj instanceof HttpContent) { metrics.bytesWritten(remoteAddress(), ((HttpContent) obj).content().readableBytes()); } return lastWriteFuture = super.write(obj); }

Target:
public ChannelFuture write(Object obj) { if (metrics.isEnabled()) { long bytes = getBytes(obj); if (bytes == -1) { log.warn("Metrics could not be updated to include bytes written because of unknown object " + obj.getClass() + " being written."); } else { bytesWritten += bytes; } } return lastWriteFuture = super.write(obj); }
Source:
private void emailExportEntityList(List entities, Map<String, String> headerMap, TableWriter tableWriter, boolean showNullsCells) throws IOException { Set<String> keys = headerMap.keySet(); String[] fields = keys.toArray(new String[keys.size()]); try { tableWriter.writeHeader(fields); for (Object entity : entities) { Map<String, String> row = buildRow(entity, headerMap); if (showNullsCells) { for (Entry<String, String> entry : row.entrySet()) { if (entry.getValue() == null) { String key = entry.getKey(); row.put(key, "NULL"); } } } tableWriter.writeRow(row, fields); } } catch (IOException e) { throw new IOException("IO Error when writing data", e); } finally { tableWriter.close(); } }

Target:
private void emailExportEntityList(List entities, Map<String, String> headerMap, TableWriter tableWriter, boolean showNullsCells) throws IOException { Set<String> keys = headerMap.keySet(); String[] fields = keys.toArray(new String[keys.size()]); try { tableWriter.writeHeader(fields); for (Object entity : entities) { Map<String, String> row = buildRow(entity, headerMap); if (showNullsCells) { for (Entry<String, String> entry : row.entrySet()) { if (entry.getValue() == null) { entry.setValue(NULL); } } } tableWriter.writeRow(row, fields); } } catch (IOException e) { throw new IOException("IO Error when writing data", e); } finally { tableWriter.close(); } }
Source:
public void publishFinish(IProgressMonitor monitor) throws CoreException { super.publishFinish(monitor); final File localFolder = getDeploymentsRootFolder(); syncPodsToDirectory(localFolder, monitor); deleteOldDeployments(getServer()); syncDirectoryToPods(localFolder, monitor); final IResource resource = OpenShiftServerUtils.getResource(getServer(), monitor); loadPodPathIfEmpty(resource, monitor); }

Target:
public void publishFinish(IProgressMonitor monitor) throws CoreException { super.publishFinish(monitor); final File localFolder = getDeploymentsRootFolder(); syncDirectoryToPods(localFolder, monitor); final IResource resource = OpenShiftServerUtils.getResource(getServer(), monitor); loadPodPathIfEmpty(resource, monitor); }
Source:
public void testPublishWithNullVideoTitle() { byte[] testBytes = {}; String testString = "Test"; when(urlService.inputStreamToByteArray(inputStream)).thenReturn(testBytes); when(facebookService.publishToFacebook(any(byte[].class), any(String.class), any(String.class), any(String.class), any(String.class))).thenReturn(testString); Response response = resource.publish(key, "Test", inputStream, contentDisposition, "photo", "Test", null); String result = (String) response.getEntity(); assertEquals(response.getStatusInfo(), Response.Status.OK); assertEquals(result, "Test"); }

Target:
public void testPublishWithNullVideoTitle() { byte[] testBytes = {}; when(urlService.inputStreamToByteArray(inputStream)).thenReturn(testBytes); when(facebookService.publishToFacebook(any(byte[].class), any(String.class), any(String.class), any(String.class), any(String.class))).thenReturn("Test"); Response response = resource.publish(key, "Test", inputStream, contentDisposition, "photo", "Test", null); String result = (String) response.getEntity(); assertEquals(response.getStatusInfo(), Response.Status.OK); assertEquals(result, "Test"); }
Source:
public int hashCode() { int hashCode = 0; if (this.isSystemLibrary()) { hashCode++; } for (int i = 0; i < this.entries.length; i++) { hashCode = hashCode * 17 + this.entries.hashCode(); } return hashCode; }

Target:
public int hashCode() { int hashCode = 0; if (this.isSystemLibrary()) { hashCode++; } for (int i = 0; i < this.entries.length; i++) { hashCode = hashCode * 17 + this.entries[i].hashCode(); } return hashCode; }
Source:
public void extractErrors() throws Exception { String errorField1 = "field1"; String errorField2 = "field2"; Form form = Mockito.mock(Form.class); Map<String, List<ValidationError>> errorMap = new HashMap<String, List<ValidationError>>(); errorMap.put(errorField1, Arrays.asList(new ValidationError("errorkey1", "errorMessage1"), new ValidationError("errorkey2", "errorMessage2"))); errorMap.put(errorField2, Collections.singletonList(new ValidationError("errorkey21", "errorMessage21"))); Mockito.when(form.errors()).thenReturn(errorMap); ErrorsBean result = formResolver.extractErrors(form); List<ErrorBean> errors = result.getGlobalErrors(); checkError(errors.get(0), errorField1, "errorkey1", "errorMessage1"); checkError(errors.get(1), errorField1, "errorkey2", "errorMessage2"); checkError(errors.get(2), errorField2, "errorkey21", "errorMessage21"); }

Target:
public void extractErrors() throws Exception { String errorField1 = "field1"; String errorField2 = "field2"; Form form = formWithSomeErrorsForFields(errorField1, errorField2); ErrorsBean result = formResolver.extractErrors(form); List<ErrorBean> errors = result.getGlobalErrors(); checkError(errors.get(0), errorField1, "errorkey1", "errorMessage1"); checkError(errors.get(1), errorField1, "errorkey2", "errorMessage2"); checkError(errors.get(2), errorField2, "errorkey21", "errorMessage21"); }
Source:
public void processExplosion(CallbackInfo ci) { List<Object> cause = Lists.newArrayList(); if (this.shooter != null) { cause.add(NamedCause.igniter(this.shooter)); } cause.add(NamedCause.source(this)); this.shooter = null; ExplosionEvent.Pre event = SpongeEventFactory.createExplosionEventPre(Cause.of(cause), (World) this.worldObj); SpongeImpl.postEvent(event); if (event.isCancelled()) { ci.cancel(); } }

Target:
public void processExplosion(CallbackInfo ci) { List<Object> cause = Lists.newArrayList(); if (this.shooter != null) { cause.add(NamedCause.igniter(this.shooter)); } cause.add(NamedCause.source(this)); this.shooter = null; ExplosionEvent.Pre event = SpongeEventFactory.createExplosionEventPre(Cause.of(cause), (World) this.worldObj); if (SpongeImpl.postEvent(event)) { ci.cancel(); } }
Source:
public GeographyPointValue(double longitude, double latitude) { m_latitude = latitude + 0.0; m_longitude = longitude + 0.0; if (m_latitude < -90.0 || m_latitude > 90.0) { throw new IllegalArgumentException("Latitude out of range in GeographyPointValue constructor"); } if (m_longitude < -180.0 || m_longitude > 180.0) { throw new IllegalArgumentException("Longitude out of range in GeographyPointValue constructor"); } }

Target:
public GeographyPointValue(double longitude, double latitude) { m_latitude = latitude; m_longitude = longitude; if (m_latitude < -90.0 || m_latitude > 90.0) { throw new IllegalArgumentException("Latitude out of range in GeographyPointValue constructor"); } if (m_longitude < -180.0 || m_longitude > 180.0) { throw new IllegalArgumentException("Longitude out of range in GeographyPointValue constructor"); } }
Source:
public synchronized void save(Note note, AuthenticationInfo subject) throws IOException { super.save(note, subject); if (this.enableWebHDFS) uploadNoteListToHDFS(note); }

Target:
public synchronized void save(Note note, AuthenticationInfo subject) throws IOException { super.save(note, subject); if (this.enableWebHDFS) { uploadNoteToHDFS(note); } }
Source:
public void printNfoldCorrssvalidationNbAcc(int classesNum, double thres, int minWordsAppearenceCount) { double acc = 0; double precision = 0; double recall = 0; double total = 0; double confusionMatrix[][] = new double[classesNum][classesNum]; for (int i = 0; i < folds.length; i++) { DocumentCollection train = getTrain(i); DocumentCollection test = getTest(i); FeatureMap map = new FeatureMap(); map.addDocs(train, minWordsAppearenceCount, false); MemoryEfficientNB nb = new MemoryEfficientNB(train, map, classesNum); acc += nb.getAcc(test) / ((double) folds.length); for (int j = 0; j < test.docs.size(); j++) { total++; Document d = test.docs.elementAt(j); int label = nb.classify(d, thres); if (label > -1) { recall++; confusionMatrix[d.classID][label]++; } if (label == d.classID) precision++; } } logger.info("Accuracy: " + acc); logger.info("Within " + thres + " confidence threshold:"); logger.info("\tPrecision=" + precision / recall); logger.info("\tRecall=" + recall / total); logger.info("\tConfusion matrix within confidence threshold:"); for (int i = 0; i < classesNum; i++) { for (int j = 0; j < classesNum; j++) System.out.print(confusionMatrix[i][j] + "\t"); logger.info(""); } }

Target:
public void printNfoldCorrssvalidationNbAcc(int classesNum, double thres, int minWordsAppearenceCount) { double acc = 0; double precision = 0; double recall = 0; double total = 0; double confusionMatrix[][] = new double[classesNum][classesNum]; for (int i = 0; i < folds.length; i++) { DocumentCollection train = getTrain(i); DocumentCollection test = getTest(i); FeatureMap map = new FeatureMap(); map.addDocs(train, minWordsAppearenceCount, false); MemoryEfficientNB nb = new MemoryEfficientNB(train, map, classesNum); acc += nb.getAcc(test) / ((double) folds.length); for (int j = 0; j < test.docs.size(); j++) { total++; Document d = test.docs.elementAt(j); int label = nb.classify(d, thres); if (label > -1) { recall++; confusionMatrix[d.classID][label]++; } if (label == d.classID) precision++; } } System.out.println("Accuracy: " + acc); System.out.println("Within " + thres + " confidence threshold:"); System.out.println("\tPrecision=" + precision / recall); System.out.println("\tRecall=" + recall / total); System.out.println("\tConfusion matrix within confidence threshold:"); for (int i = 0; i < classesNum; i++) { for (int j = 0; j < classesNum; j++) logger.info(confusionMatrix[i][j] + "\t"); System.out.println(); } }
Source:
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); StringBuilder sb = new StringBuilder(); File licenseDir = new File(PathManager.getHomePath(), "license"); assert licenseDir.exists(); for (File file : TemplateUtils.listFiles(licenseDir)) { sb.append("<br><br>"); String licenseText = null; try { licenseText = Files.toString(file, Charsets.UTF_8); licenseText = licenseText.replaceAll("\\<.*?\\>", ""); } catch (IOException e) { e.printStackTrace(); } if (licenseText != null) { sb.append(licenseText.replace("\n", "<br>")); } } String text = "<html>" + sb.toString() + "</html>"; JBScrollPane pane = new JBScrollPane(new JBLabel(text)); pane.setPreferredSize(new Dimension(600, 400)); panel.add(pane, BorderLayout.CENTER); return panel; }

Target:
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); StringBuilder sb = new StringBuilder(5000); File licenseDir = new File(PathManager.getHomePath(), "license"); assert licenseDir.exists() : licenseDir; for (File file : TemplateUtils.listFiles(licenseDir)) { sb.append("<br><br>"); String licenseText = null; try { licenseText = Files.toString(file, Charsets.UTF_8); licenseText = licenseText.replaceAll("\\<.*?\\>", ""); sb.append(licenseText.replace("\n", "<br>")); } catch (IOException e) { e.printStackTrace(); } } String text = "<html>" + sb.toString() + "</html>"; JBScrollPane pane = new JBScrollPane(new JBLabel(text)); pane.setPreferredSize(new Dimension(600, 400)); panel.add(pane, BorderLayout.CENTER); return panel; }
Source:
public static long xxHash64(@SqlType(StandardTypes.REAL) long value) { return XxHash64.hash((int) value); }

Target:
public static long xxHash64(@SqlType(StandardTypes.REAL) long value) { return XxHash64.hash(floatToIntBits(intBitsToFloat((int) value))); }
Source:
public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Type type) { Bind b = (Bind) annotation; String nameFromAnnotation = b == null ? Bind.NO_VALUE : b.value(); Optional<String> name = ParameterUtil.findParameterName(nameFromAnnotation, param); QualifiedType<?> qualifiedType = QualifiedType.of(type).withAnnotations(new Qualifiers().qualifiers(param)); return (stmt, arg) -> { stmt.bindByType(index, arg, qualifiedType); name.ifPresent(n -> stmt.bindByType(n, arg, qualifiedType)); }; }

Target:
public SqlStatementParameterCustomizer createForParameter(Annotation annotation, Class<?> sqlObjectType, Method method, Parameter param, int index, Type type) { Bind b = (Bind) annotation; String nameFromAnnotation = b == null ? Bind.NO_VALUE : b.value(); Optional<String> name = ParameterUtil.findParameterName(nameFromAnnotation, param); return (stmt, arg) -> { QualifiedType<?> qualifiedType = QualifiedType.of(type).withAnnotations( stmt.getConfig(Qualifiers.class).findFor(param)); stmt.bindByType(index, arg, qualifiedType); name.ifPresent(n -> stmt.bindByType(n, arg, qualifiedType)); }; }
Source:
public void should_failed_when_event_isNot_ON_ENTER_Or_ON_FINISH(){ ConnectorEventFilter failFilter = new ConnectorEventFilter("a"); }

Target:
public void should_failed_when_event_isNot_ON_ENTER_Or_ON_FINISH() { new ConnectorEventFilter("a"); }
Source:
synchronized void updateOwner(final int blockId, final int oldOwnerId, final int newOwnerId) { LOG.log(Level.FINER, "Update owner of block {0} from store {1} to store {2}", new Object[]{blockId, oldOwnerId, newOwnerId}); if (!movingBlocks.contains(blockId)) { throw new RuntimeException("The block " + blockId + " + is not locked for move"); } if (!storeIdToBlockIds.containsKey(oldOwnerId)) { throw new RuntimeException("MemoryStore " + oldOwnerId + " has been lost."); } if (!storeIdToBlockIds.containsKey(newOwnerId)) { throw new RuntimeException("MemoryStore " + newOwnerId + " has been lost."); } if (!storeIdToBlockIds.get(oldOwnerId).remove(blockId)) { throw new RuntimeException("Store " + oldOwnerId + " does not own block " + blockId); } if (!storeIdToBlockIds.get(newOwnerId).add(blockId)) { throw new RuntimeException("Store " + newOwnerId + " already owns block " + blockId); } final Set<Integer> blocksInOldStore = storeIdToBlockIds.get(oldOwnerId); final Set<Integer> blocksInNewStore = storeIdToBlockIds.get(newOwnerId); blocksInOldStore.remove(blockId); blocksInNewStore.add(blockId); blockIdToStoreId.put(blockId, newOwnerId); }

Target:
synchronized void updateOwner(final int blockId, final int oldOwnerId, final int newOwnerId) { LOG.log(Level.FINER, "Update owner of block {0} from store {1} to store {2}", new Object[]{blockId, oldOwnerId, newOwnerId}); if (!movingBlocks.contains(blockId)) { throw new RuntimeException("The block " + blockId + " has not been chosen for migration or has already been released"); } if (!storeIdToBlockIds.containsKey(oldOwnerId)) { throw new RuntimeException("MemoryStore " + oldOwnerId + " has been lost."); } if (!storeIdToBlockIds.containsKey(newOwnerId)) { throw new RuntimeException("MemoryStore " + newOwnerId + " has been lost."); } if (!storeIdToBlockIds.get(oldOwnerId).contains(blockId)) { throw new RuntimeException("Store " + oldOwnerId + " does not own block " + blockId); } if (storeIdToBlockIds.get(newOwnerId).contains(blockId)) { throw new RuntimeException("Store " + newOwnerId + " already owns block " + blockId); } final Set<Integer> blocksInOldStore = storeIdToBlockIds.get(oldOwnerId); final Set<Integer> blocksInNewStore = storeIdToBlockIds.get(newOwnerId); blocksInOldStore.remove(blockId); blocksInNewStore.add(blockId); blockIdToStoreId.put(blockId, newOwnerId); }
Source:
public Node description() { mergePanel = new MergeEntries(firstEntry, secondEntry, database.getMode()); VBox container = new VBox(10); Label header = new Label(name); header.getStyleClass().add("sectionHeader"); container.getChildren().add(header); container.getChildren().add(mergePanel); container.setMargin(mergePanel, new Insets(5, 5, 5, 5)); return container; }

Target:
public Node description() { mergePanel = new MergeEntries(oldEntry, newEntry, Localization.lang("In JabRef"), Localization.lang("On disk"), DefaultRadioButtonSelectionMode.LEFT); VBox container = new VBox(10); Label header = new Label(name); header.getStyleClass().add("sectionHeader"); container.getChildren().add(header); container.getChildren().add(mergePanel); container.setMargin(mergePanel, new Insets(5, 5, 5, 5)); return container; }
Source:
public Callable<File> updateSynch(final String id, final InputStream content) { if (id.endsWith("/")) { throw new IllegalArgumentException( "Identifiers for use with this indexer may not end in '/'!"); } final String fileName = id.substring(id.lastIndexOf("/") + 1) + "-jcr.xml"; final File file = new File(path, fileName); LOGGER.debug("Updating to file: {}", id, file); return new Callable<File>() { @Override public File call() { FileOutputStream out = null; final byte[] buf = new byte[4096]; int len = 0; try { out = new FileOutputStream(file); while ((len = content.read(buf)) > 0 ) { out.write(buf, 0, len); } } catch (final IOException e) { LOGGER.error("Failed to write to file: {}", file); propagate(e); } finally { if (out != null) { try { out.close(); } catch (final IOException e) { } } } return file; } }; }

Target:
public Callable<File> updateSynch(final String id, final InputStream content) { if (id.endsWith("/")) { throw new IllegalArgumentException( "Identifiers for use with this indexer may not end in '/'!"); } return new Callable<File>() { @Override public File call() throws IOException { final String fileName = URLEncoder.encode(id, "UTF-8") + "-jcr.xml"; LOGGER.debug("Updating to file: {}", id, getPath() + File.pathSeparatorChar + fileName); final Path p = Paths.get(getPath(), fileName); Files.copy(content, p, new CopyOption[]{}); return p.toFile(); } }; }
Source:
default Map<String, Object> getStats() { throw new UnsupportedOperationException("This Jobby does not implement getJobStats()."); }

Target:
default Map<String, Object> getStats() { throw new UnsupportedOperationException( StringUtils.format("This Jobby does not implement getJobStats(), Jobby class: [%s]", getClass()) ); }
Source:
public static void closeChannel(Channel channel) { Map<Long, Request> unfinishedRequests = UNFINISHED_REQUESTS.remove(channel); if (unfinishedRequests != null && unfinishedRequests.size() > 0) { for (Request r : unfinishedRequests.values()) { Response disconnectResponse = new Response(r.getId()); disconnectResponse.setStatus(Response.CHANNEL_INACTIVE); disconnectResponse.setErrorMessage("Channel " + channel + " is inactive. Directly return the unFinished request."); DefaultFuture.received(channel, disconnectResponse); } unfinishedRequests.clear(); } }

Target:
public static void closeChannel(Channel channel) { for (long id : CHANNELS.keySet()) { if (channel.equals(CHANNELS.get(id))) { DefaultFuture future = getFuture(id); if (future != null && !future.isDone()) { Response disconnectResponse = new Response(future.getId()); disconnectResponse.setStatus(Response.CHANNEL_INACTIVE); disconnectResponse.setErrorMessage("Channel " + channel + " is inactive. Directly return the unFinished request : " + future.getRequest()); DefaultFuture.received(channel, disconnectResponse); } } } }
Source:
public ImmutableRatesProviderBuilder iborIndexCurve(IborIndex index, Curve forwardCurve) { ArgChecker.notNull(index, "currency"); ArgChecker.notNull(forwardCurve, "forwardCurve"); this.indexCurves.put(index, forwardCurve); return this; }

Target:
public ImmutableRatesProviderBuilder iborIndexCurve(IborIndex index, Curve forwardCurve) { ArgChecker.notNull(index, "index"); ArgChecker.notNull(forwardCurve, "forwardCurve"); this.indexCurves.put(index, forwardCurve); return this; }
Source:
public void ReturnViewWithSizeFormatted_WhenAsked() throws Exception { View view = adapter.getView(0, null, viewGroup); TextView sizeView = (TextView) view.findViewById(R.id.item_history_type); String sizeViewText = sizeView.getText().toString(); assertTrue(sizeViewText.matches( "([0-9]*\\.[0-9]+[0-9]+[K]+[B])|([0-9],[0-9]+[0-9]+[K]+[B])" )); }

Target:
public void ReturnViewWithSizeFormatted_WhenAsked() throws Exception { Locale english = new Locale("en", "EN"); Locale.setDefault(english); View view = adapter.getView(0, null, viewGroup); TextView sizeView = (TextView) view.findViewById(R.id.item_history_type); assertThat(sizeView).hasText("1.00KB"); }
Source:
public void onBookPlacedInInventory(OnChangedComponent event, EntityRef inventoryEntity, InventoryComponent inventoryComponent) { if (inventoryEntity.getParentPrefab().getName().equals(Constants.PEDESTAL_PREFAB)) { for (EntityRef item : inventoryComponent.itemSlots) { DisplayNameComponent nameComponent = item.getComponent(DisplayNameComponent.class); if (nameComponent != null && nameComponent.name.equals(Constants.RESEARCH_BOOK_NAME)) { BookComponent bookComponent = item.getComponent(BookComponent.class); List<String> textList = bookComponent.pages; String recipePrefabName = ""; for (String text : textList) { int i = text.indexOf("<recipe"); if (i != -1) { text = text.substring(i); i = text.indexOf(">"); recipePrefabName = text.substring("<recipe".length(), i).replaceAll("\\s", ""); logger.info(recipePrefabName); break; } } Prefab recipe = prefabManager.getPrefab(recipePrefabName); BookRecipeComponent recipeComponent = recipe.getComponent(BookRecipeComponent.class); LaboratoryComponent laboratoryComponent = inventoryEntity.getComponent(LaboratoryComponent.class); logger.info("owner" + laboratoryComponent.laboratoryEntity.getOwner()); addResearchTask(recipeComponent.blockIngredientsList, recipeComponent.blockResult, laboratoryComponent.laboratoryEntity.getOwner(), laboratoryComponent.laboratoryEntity); EntityRef exclamationPoint = entityManager.create(Constants.EXCLAMATION_PREFAB); LocationComponent locationComponent = exclamationPoint.getComponent(LocationComponent.class); LocationComponent pedestalLocationComponent = inventoryEntity.getComponent(LocationComponent.class); locationComponent.setWorldPosition(pedestalLocationComponent.getWorldPosition().addY(1f)); inventoryManager.giveItem(inventoryEntity, inventoryEntity, exclamationPoint); break; } } } }

Target:
public void onBookPlacedInInventory(OnChangedComponent event, EntityRef inventoryEntity, InventoryComponent inventoryComponent) { if (inventoryEntity.getParentPrefab().getName().equals(Constants.PEDESTAL_PREFAB)) { for (EntityRef item : inventoryComponent.itemSlots) { DisplayNameComponent nameComponent = item.getComponent(DisplayNameComponent.class); if (nameComponent != null && nameComponent.name.equals(Constants.RESEARCH_BOOK_NAME)) { getResearchRecipe(item, inventoryEntity); break; } } } }
Source:
protected String generateVmConfiguration(VM vm, List<DiskImage> disks, Map<Guid, VmDevice> vmDevices) { if (vm.getInterfaces() == null || vm.getInterfaces().isEmpty()) { vm.setInterfaces(getVmNetworkInterfaceDao().getAllForVm(vm.getId())); } if (StringUtils.isEmpty(vm.getVmtName())) { VmTemplate t = getVmTemplateDao().get(vm.getVmtGuid()); vm.setVmtName(t.getName()); } if (vmDevices == null) { VmDeviceUtils.setVmDevices(vm.getStaticData()); } else { vm.getStaticData().setManagedDeviceMap(vmDevices); } if (disks == null) { disks = ImagesHandler.filterImageDisks(getDiskDao().getAllForVm(vm.getId()), false, true, true); disks.addAll(ImagesHandler.getCinderLeafImages(getDiskDao().getAllForVm(vm.getId()), false)); } for (DiskImage image : disks) { image.setStorageIds(null); } vm.setClusterCompatibilityVersionOrigin(vm.getClusterCompatibilityVersion()); return new OvfManager().exportVm(vm, new ArrayList<>(disks), ClusterUtils.getCompatibilityVersion(vm)); }

Target:
protected String generateVmConfiguration(VM vm, List<DiskImage> disks, Map<Guid, VmDevice> vmDevices) { if (vm.getInterfaces() == null || vm.getInterfaces().isEmpty()) { vm.setInterfaces(getVmNetworkInterfaceDao().getAllForVm(vm.getId())); } if (StringUtils.isEmpty(vm.getVmtName())) { VmTemplate t = getVmTemplateDao().get(vm.getVmtGuid()); vm.setVmtName(t.getName()); } if (vmDevices == null) { VmDeviceUtils.setVmDevices(vm.getStaticData()); } else { vm.getStaticData().setManagedDeviceMap(vmDevices); } if (disks == null) { disks = ImagesHandler.filterImageDisks(getDiskDao().getAllForVm(vm.getId()), false, true, true); disks.addAll(ImagesHandler.getCinderLeafImages(getDiskDao().getAllForVm(vm.getId()), false)); } for (DiskImage image : disks) { image.setStorageIds(null); } return new OvfManager().exportVm(vm, new ArrayList<>(disks), ClusterUtils.getCompatibilityVersion(vm)); }
Source:
public AzkabanWebServer(final Server server, final Props props) throws Exception { this.props = requireNonNull(props); this.server = server; this.velocityEngine = configureVelocityEngine(props.getBoolean(VELOCITY_DEV_MODE_PARAM, false)); this.sessionCache = new SessionCache(props); this.userManager = loadUserManager(props); this.executorManager = SERVICE_PROVIDER.getInstance(ExecutorManager.class); this.projectManager = SERVICE_PROVIDER.getInstance(ProjectManager.class); this.triggerManager = SERVICE_PROVIDER.getInstance(TriggerManager.class); this.metricsManager = SERVICE_PROVIDER.getInstance(MetricsManager.class); this.registry = new MetricRegistry(); loadBuiltinCheckersAndActions(); this.scheduleManager = loadScheduleManager(this.triggerManager); final String triggerPluginDir = props.getString("trigger.plugin.dir", "plugins/triggers"); loadPluginCheckersAndActions(triggerPluginDir); this.baseClassLoader = this.getClassLoader(); if (props.containsKey(DEFAULT_TIMEZONE_ID)) { final String timezone = props.getString(DEFAULT_TIMEZONE_ID); System.setProperty("user.timezone", timezone); TimeZone.setDefault(TimeZone.getTimeZone(timezone)); DateTimeZone.setDefault(DateTimeZone.forID(timezone)); logger.info("Setting timezone to " + timezone); } configureMBeanServer(); }

Target:
public AzkabanWebServer(final Server server, final Props props) throws Exception { this.props = requireNonNull(props); this.server = server; this.velocityEngine = configureVelocityEngine(props.getBoolean(VELOCITY_DEV_MODE_PARAM, false)); this.sessionCache = new SessionCache(props); this.userManager = loadUserManager(props); this.executorManager = SERVICE_PROVIDER.getInstance(ExecutorManager.class); this.projectManager = SERVICE_PROVIDER.getInstance(ProjectManager.class); this.triggerManager = SERVICE_PROVIDER.getInstance(TriggerManager.class); this.metricsManager = SERVICE_PROVIDER.getInstance(MetricsManager.class); this.registry = SERVICE_PROVIDER.getInstance(MetricRegistry.class); loadBuiltinCheckersAndActions(); this.scheduleManager = loadScheduleManager(this.triggerManager); final String triggerPluginDir = props.getString("trigger.plugin.dir", "plugins/triggers"); loadPluginCheckersAndActions(triggerPluginDir); this.baseClassLoader = this.getClassLoader(); if (props.containsKey(DEFAULT_TIMEZONE_ID)) { final String timezone = props.getString(DEFAULT_TIMEZONE_ID); System.setProperty("user.timezone", timezone); TimeZone.setDefault(TimeZone.getTimeZone(timezone)); DateTimeZone.setDefault(DateTimeZone.forID(timezone)); logger.info("Setting timezone to " + timezone); } configureMBeanServer(); }
Source:
public Object convert(Class destClass, Object srcObject) { Class<?> srcObjectClass = srcObject.getClass(); OffsetDateTime result; if (Date.class.isAssignableFrom(srcObjectClass)) { Instant instant = ((Date) srcObject).toInstant(); result = OffsetDateTime.ofInstant(instant, ZoneId.systemDefault()); } else if (Instant.class.isAssignableFrom(srcObjectClass)) { result = OffsetDateTime.ofInstant(((Instant) srcObject), ZoneId.systemDefault()); } else if (Long.class.isAssignableFrom(srcObjectClass)) { Instant instant = Instant.ofEpochMilli((Long) srcObject); result= OffsetDateTime.ofInstant(instant, ZoneId.systemDefault()); } else { return super.convert(destClass, srcObject); } if (OffsetTime.class.isAssignableFrom(destClass)) { return result.toOffsetTime(); } return result; }

Target:
public Object convert(Class destClass, Object srcObject) { OffsetDateTime offsetDateTime = convertToOffsetDateTime(srcObject); if (offsetDateTime != null) { if (OffsetTime.class.isAssignableFrom(destClass)) { return offsetDateTime.toOffsetTime(); } return offsetDateTime; } return super.convert(destClass, srcObject); }
Source:
public Adapter getContentAdapter() { if (adapter == null) { adapter = new AdapterImpl() { @Override public void notifyChanged(final Notification notification) { int type = notification.getEventType(); switch (type) { case Notification.ADD: case Notification.ADD_MANY: case Notification.REMOVE: case Notification.REMOVE_MANY: Display.getDefault().asyncExec(new Runnable() { @Override public void run() { refreshChildren(); } }); break; case Notification.SET: break; } } }; } return adapter; }

Target:
public Adapter getContentAdapter() { if (null == adapter) { adapter = new AdapterImpl() { @Override public void notifyChanged(final Notification notification) { int type = notification.getEventType(); switch (type) { case Notification.ADD: case Notification.ADD_MANY: case Notification.REMOVE: case Notification.REMOVE_MANY: Display.getDefault().asyncExec(new Runnable() { @Override public void run() { refreshChildren(); } }); break; case Notification.SET: break; } } }; } return adapter; }
Source:
protected void parseDataType(XMLExtendedStreamReader reader, ConfigurationBuilder builder, ConfigurationBuilderHolder holder) throws XMLStreamException { EncodingConfigurationBuilder encodingBuilder = builder.encoding(); for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); if (attribute == Attribute.MEDIA_TYPE) { if (reader.getSchema().since(11, 0)) { encodingBuilder.mediaType(value); } else { throw ParseUtils.unexpectedAttribute(reader, i); } } else { throw ParseUtils.unexpectedAttribute(reader, i); } } while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case KEY_DATA_TYPE: ContentTypeConfigurationBuilder keyBuilder = encodingBuilder.key(); parseContentType(reader, holder, keyBuilder); ParseUtils.requireNoContent(reader); break; case VALUE_DATA_TYPE: ContentTypeConfigurationBuilder valueBuilder = encodingBuilder.value(); parseContentType(reader, holder, valueBuilder); ParseUtils.requireNoContent(reader); break; default: throw ParseUtils.unexpectedElement(reader); } } }

Target:
protected void parseDataType(XMLExtendedStreamReader reader, ConfigurationBuilder builder, ConfigurationBuilderHolder holder) throws XMLStreamException { EncodingConfigurationBuilder encodingBuilder = builder.encoding(); for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); if (attribute == Attribute.MEDIA_TYPE && reader.getSchema().since(11, 0)) { encodingBuilder.mediaType(value); } else { throw ParseUtils.unexpectedAttribute(reader, i); } } while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case KEY_DATA_TYPE: ContentTypeConfigurationBuilder keyBuilder = encodingBuilder.key(); parseContentType(reader, holder, keyBuilder); ParseUtils.requireNoContent(reader); break; case VALUE_DATA_TYPE: ContentTypeConfigurationBuilder valueBuilder = encodingBuilder.value(); parseContentType(reader, holder, valueBuilder); ParseUtils.requireNoContent(reader); break; default: throw ParseUtils.unexpectedElement(reader); } } }
Source:
public <C extends ServiceConfiguration<?, ?>> Collection<C> getServices(Class<C> configurationType) throws IllegalArgumentException { return serviceConfigurations.stream().filter(service -> configurationType.isAssignableFrom(service.getClass())).map(configurationType::cast).collect(toList()); }

Target:
public <C extends ServiceConfiguration<?, ?>> Collection<C> getServices(Class<C> configurationType) throws IllegalArgumentException { return serviceConfigurations.stream().filter(configurationType::isInstance).map(configurationType::cast).collect(toList()); }
Source:
public SalesforceDroidGapActivity() { super(); delegate = new SalesforceActivityDelegate(this); authConfig = AuthConfigUtil.getMyDomainAuthConfig(SalesforceHybridSDKManager.getInstance().getLoginServerManager().getSelectedLoginServer().url); }

Target:
public SalesforceDroidGapActivity() { super(); delegate = new SalesforceActivityDelegate(this); }