auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void init() throws EmailException { if (args.projectCache != null) { projectState = args.projectCache.get(project.getNameKey()); } else { projectState = null; } super.init(); owners = getOwners(); watchers = getWatchers(); add(RecipientType.TO, owners); if (!watchers.isEmpty()) { add(RecipientType.BCC, watchers); } setBranchSubjectHeader(); setListIdHeader(); }

Target:
protected void init() throws EmailException { projectState = args.projectCache.get(project.getNameKey()); super.init(); Set<Account.Id> subscribers = getSubscribers(); if (!subscribers.isEmpty()) { add(RecipientType.BCC, subscribers); } setBranchSubjectHeader(); setListIdHeader(); }
Source:
public boolean canRefresh(DRepresentation representation) { return isSupported(representation) && isRequiredViewpointsSelected(representation); }

Target:
public boolean canRefresh(DRepresentation representation) { return isSupported(representation) && areRequiredViewpointsSelected(representation); }
Source:
public static Path removeFirstSegments(Path path, int count) { Objects.requireNonNull(path, "The given path must not be null"); if (path.getNameCount() <= count) { return Paths.get(""); } return path.subpath(count, path.getNameCount()); }

Target:
public static Path removeFirstSegments(Path path, int count) { Objects.requireNonNull(path, "The given path must not be null"); if (count < 0) { throw new IllegalArgumentException("The given count must not be negative - count: " + count); } if (path.getNameCount() <= count) { return Paths.get(""); } return path.subpath(count, path.getNameCount()); }
Source:
public void invoke() { for (int x = 0; x < retry; x++) { try { Optional<ManagementClient> orchestrator = getOrchestrator(); if(orchestrator.isPresent()){ UUID workflowId = sendRequest(orchestrator.get()); waitForWorkflow(workflowId, orchestrator.get(), timeout, pollPeriod); } else{ throw new IllegalStateException("Orchestrator can not be selected"); } } catch (Exception e) { log.warn("WorkflowRequest: Error while running on attempt {}, cause {}", this, x, e); } for (int y = 0; y < runtime.getParameters().getInvalidateRetry(); y++) { runtime.invalidateLayout(); Layout layoutToVerify = new Layout(runtime.getLayoutView().getLayout()); if (verifyRequest(layoutToVerify)) { log.info("WorkflowRequest: Successfully completed {}", this); return; } } log.warn("WorkflowRequest: Retrying on attempt {}", this, x); } throw new WorkflowResultUnknownException(); }

Target:
public void invoke() { for (int x = 0; x < retry; x++) { try { Optional<ManagementClient> orchestrator = getOrchestrator(); if(orchestrator.isPresent()){ UUID workflowId = sendRequest(orchestrator.get()); waitForWorkflow(workflowId, orchestrator.get(), timeout, pollPeriod); } else{ throw new IllegalStateException("Orchestrator can not be selected"); } } catch (NetworkException | TimeoutException | IllegalStateException e) { log.warn("WorkflowRequest: Error while running on attempt {}, cause {}", this, x, e); } for (int y = 0; y < runtime.getParameters().getInvalidateRetry(); y++) { runtime.invalidateLayout(); Layout layoutToVerify = new Layout(runtime.getLayoutView().getLayout()); if (verifyRequest(layoutToVerify)) { log.info("WorkflowRequest: Successfully completed {}", this); return; } } log.warn("WorkflowRequest: Retrying on attempt {}", this, x); } throw new WorkflowResultUnknownException(); }
Source:
public void refresh() { super.refresh(); Object value = this.target.eGet(this.eReference); if (value instanceof EObject) { Adapter adapter = this.composedAdapterFactory.adapt((EObject) value, IItemLabelProvider.class); if (adapter instanceof IItemLabelProvider) { IItemLabelProvider labelProvider = (IItemLabelProvider) adapter; this.text.setText(labelProvider.getText(value)); this.text.setUnderlined(false); this.image.setImage(ExtendedImageRegistry.INSTANCE.getImage(labelProvider.getImage(value))); String onClickExpression = Optional.ofNullable(this.description.getOnClickExpression()).orElse(""); if (!onClickExpression.isEmpty()) { this.text.setUnderlined(true); } } } else if (value == null) { this.image.setImage(null); this.text.setText(Messages.SingleReference_noValue); } }

Target:
public void refresh() { super.refresh(); Object value = this.target.eGet(this.eReference); if (value instanceof EObject) { Adapter adapter = this.composedAdapterFactory.adapt((EObject) value, IItemLabelProvider.class); if (adapter instanceof IItemLabelProvider) { IItemLabelProvider labelProvider = (IItemLabelProvider) adapter; this.image.setImage(ExtendedImageRegistry.INSTANCE.getImage(labelProvider.getImage(value))); String onClickExpression = Optional.ofNullable(this.description.getOnClickExpression()).orElse(""); if (onClickExpression.isEmpty()) { this.text.setText(labelProvider.getText(value)); } else { this.hyperlink.setText(labelProvider.getText(value)); } } } else if (value == null) { this.image.setImage(null); String onClickExpression = Optional.ofNullable(this.description.getOnClickExpression()).orElse(""); if (onClickExpression.isEmpty()) { this.text.setText(Messages.SingleReference_noValue); } else { this.hyperlink.setText(Messages.SingleReference_noValue); } } }
Source:
public static String getTaskSummarySeperator(String connectorKind) { AbstractRepositoryConnector connector = TasksUiPlugin.getConnector(connectorKind); if (connector != null) { return connector.getTaskIDSummarySeprator(); } else { return ""; } }

Target:
public static String getTaskSummarySeperator(String connectorKind) { AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(connectorKind); if (connector != null) { return connector.getTaskIDSummarySeprator(); } else { return ": "; } }
Source:
private Set<TestClassRequest> filterAndConvertToTestClassRequests(EngineDiscoveryRequest discoveryRequest, TestClassCollector collector) { List<ClassNameFilter> allClassNameFilters = discoveryRequest.getDiscoveryFiltersByType(ClassNameFilter.class); Filter<Class<?>> adaptedFilter = adaptFilter(composeFilters(allClassNameFilters), Class::getName); Filter<Class<?>> classFilter = new ExclusionReasonConsumingFilter<>(adaptedFilter, (testClass, reason) -> logger.fine(() -> String.format("Class %s was excluded by a class filter: %s", testClass.getName(), reason.orElse("<unknown reason>")))); Predicate<Class<?>> loggingTestClass = isPotentialJunit4Predicate(); return collector.toRequests(classFilter.toPredicate().and(loggingTestClass)); }

Target:
private Set<TestClassRequest> filterAndConvertToTestClassRequests(EngineDiscoveryRequest discoveryRequest, TestClassCollector collector) { List<ClassNameFilter> allClassNameFilters = discoveryRequest.getDiscoveryFiltersByType(ClassNameFilter.class); Filter<Class<?>> adaptedFilter = adaptFilter(composeFilters(allClassNameFilters), Class::getName); Filter<Class<?>> classFilter = new ExclusionReasonConsumingFilter<>(adaptedFilter, (testClass, reason) -> logger.fine(() -> String.format("Class %s was excluded by a class filter: %s", testClass.getName(), reason.orElse("<unknown reason>")))); return collector.toRequests(classFilter.toPredicate().and(loggingPotentialJUnit4TestClassPredicate())); }
Source:
public Stream<A> toStream(final Bounded<A> bounded) { final F<A, A> id = identity(); return Stream.fromFunction(this, id, bounded.min()).takeWhile(item -> !item.equals(bounded.max())); }

Target:
public Stream<A> toStream(final Bounded<A> bounded) { final F<A, A> id = identity(); return Stream.fromFunction(this, id, bounded.min()).takeWhile(item -> order.isLessThanOrEqualTo(item, bounded.max())); }
Source:
public void validateArgs(CommandLine cl) throws InvalidArgumentException { CommandUtils.checkNumOfArgsEquals(this, cl, 2); }

Target:
public void validateArgs(CommandLine cl) throws InvalidArgumentException { CommandUtils.checkNumOfArgsEquals(this, cl, 1); }
Source:
public boolean equals(Object other) { if (!(other instanceof CommittedOffset)) { return false; } CommittedOffset otherOffset = (CommittedOffset) other; return this.offset == otherOffset.offset && this.leaderEpoch.equals(otherOffset.leaderEpoch) && this.metadata.equals(otherOffset.metadata); }

Target:
public boolean equals(Object other) { if (!(other instanceof CommittedOffset)) { return false; } CommittedOffset otherOffset = (CommittedOffset) other; return this.offset == otherOffset.offset && this.leaderEpoch.equals(otherOffset.leaderEpoch) && Objects.equals(this.metadata, otherOffset.metadata); }
Source:
protected Single<Boolean> put(@NonNull final Uri uri, @NonNull final U item) { checkNotNull(item); checkNotNull(uri); int index = ++nextOperationIndex; completionNotifiers.put(index, PublishSubject.create()); operationSubject.onNext(CoreUpdateValue.create(index, uri, item)); return completionNotifiers.get(index) .first() .toSingle(); }

Target:
protected Single<Boolean> put(@NonNull final Uri uri, @NonNull final U item) { checkNotNull(item); checkNotNull(uri); return createModifyingOperation(index -> CoreValuePut.create(index, uri, item)); }
Source:
AdminEmailAttributes() { this.createDate = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP; this.emailId = Const.ParamsNames.ADMIN_EMAIL_ID; this.isInTrashBin = false; }

Target:
AdminEmailAttributes() { createDate = Const.TIME_REPRESENTS_DEFAULT_TIMESTAMP; emailId = Const.ParamsNames.ADMIN_EMAIL_ID; }
Source:
protected void executeCommand() { StorageDomainDR storageDomainDR = storageDomainDRDao.get(getParameters().getStorageDomainId(), getParameters().getGeoRepSessionId()); if (storageDomainDR == null) { storageDomainDR = new StorageDomainDR(); storageDomainDR.setStorageDomainId(getParameters().getStorageDomainId()); storageDomainDR.setGeoRepSessionId(getParameters().getGeoRepSessionId()); } else { if (storageDomainDR.getJobId() != null) { schedulerUtil.deleteJob(storageDomainDR.getJobId()); } } if (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE) { String jobId = schedulerUtil.scheduleACronJob(new GlusterStorageDomainDRSyncJob(), "syncData", new Class[] { String.class, String.class }, new Object[] { getParameters().getStorageDomainId().toString(), getParameters().getGeoRepSessionId().toString() }, getParameters().getSchedule().toCronExpression()); storageDomainDR.setScheduleCronExpression(getParameters().getSchedule().toCronExpression()); storageDomainDR.setJobId(jobId); storageDomainDRDao.saveOrUpdate(storageDomainDR); } else { storageDomainDRDao.remove(storageDomainDR.getStorageDomainId(), storageDomainDR.getGeoRepSessionId()); } setSucceeded(true); }

Target:
protected void executeCommand() { StorageDomainDR storageDomainDR = storageDomainDRDao.get(getParameters().getStorageDomainId(), getParameters().getGeoRepSessionId()); if (storageDomainDR == null) { storageDomainDR = new StorageDomainDR(); storageDomainDR.setStorageDomainId(getParameters().getStorageDomainId()); storageDomainDR.setGeoRepSessionId(getParameters().getGeoRepSessionId()); } else if (storageDomainDR.getJobId() != null) { schedulerUtil.deleteJob(storageDomainDR.getJobId()); } if (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE) { String jobId = schedulerUtil.scheduleACronJob(new GlusterStorageDomainDRSyncJob(), "syncData", new Class[] { String.class, String.class }, new Object[] { getParameters().getStorageDomainId().toString(), getParameters().getGeoRepSessionId().toString() }, getParameters().getSchedule().toCronExpression()); storageDomainDR.setScheduleCronExpression(getParameters().getSchedule().toCronExpression()); storageDomainDR.setJobId(jobId); storageDomainDRDao.saveOrUpdate(storageDomainDR); } else { storageDomainDRDao.remove(storageDomainDR.getStorageDomainId(), storageDomainDR.getGeoRepSessionId()); } setSucceeded(true); }
Source:
public ImmutableAttributeSet generate(@NonNull final GeneratedComponentRequest request) { final PP_ComponentGenerator generator = componentRepository.getByProductId(request.getProductId()); if (generator == null) { throw new AdempiereException("No Component Generator for product " + request.getProductId()); } final IComponentGenerator generatorClass = javaClassBL.newInstance(generator.getJavaClassId()); return generatorClass.generate(request.getQty(), generator.getParams(), request.getAttributes()); }

Target:
public ImmutableAttributeSet generate(@NonNull final GeneratedComponentRequest request) { final ComponentGenerator generator = componentRepository.getByProductId(request.getProductId()).orElseThrow(() -> new AdempiereException("No Component Generator for product " + request.getProductId())); final IComponentGenerator generatorClass = javaClassBL.newInstance(generator.getJavaClassId()); return generatorClass.generate(request.getQty(), request.getAttributes(), generator.getParams()); }
Source:
public void connect(String exchangeName, String routeKey) throws IOException { connection = factory.newConnection(); channel = connection.createChannel(); this.exchangeName = exchangeName; this.routeKey = routeKey; try { channel.exchangeDeclarePassive(exchangeName); } catch (IOException e) { if (!channel.isOpen()) { channel = connection.createChannel(); } channel.exchangeDeclare(exchangeName, "direct"); } try { channel.queueDeclarePassive(routeKey); } catch (IOException e) { channel.queueDeclare(routeKey, false, false, false, null); } channel.queueBind(routeKey, exchangeName, routeKey); }

Target:
public void connect(String exchangeName, String routeKey) throws IOException { connection = factory.newConnection(); channel = connection.createChannel(); this.routeKey = routeKey; try { channel.exchangeDeclarePassive(exchangeName); } catch (IOException e) { if (!channel.isOpen()) { channel = connection.createChannel(); } channel.exchangeDeclare(exchangeName, "direct"); } try { channel.queueDeclarePassive(routeKey); } catch (IOException e) { if (!channel.isOpen()) { channel = connection.createChannel(); } channel.queueDeclare(routeKey, false, false, false, null); } channel.queueBind(routeKey, exchangeName, routeKey); }
Source:
public void setUp() throws URISyntaxException { tracer = DistributedTracer.builder().build(); bus = new GuavaEventBus(); clientFactory = HttpClient.Factory.createDefault(); class Handler extends Session implements HttpHandler { private Handler(Capabilities capabilities) { super(new SessionId(UUID.randomUUID()), uri, capabilities); } @Override public HttpResponse execute(HttpRequest req) throws UncheckedIOException { return new HttpResponse(); } } ImmutableCapabilities caps = new ImmutableCapabilities("browserName", "cheese"); uri = new URI("http://localhost:1234"); local = LocalNode.builder(tracer, bus, clientFactory, uri) .add(caps, new TestSessionFactory((id, c) -> new Handler(c))) .maximumConcurrentSessions(2) .build(); }

Target:
public void setUp() throws URISyntaxException { tracer = DistributedTracer.builder().build(); bus = new GuavaEventBus(); clientFactory = HttpClient.Factory.createDefault(); class Handler extends Session implements HttpHandler { private Handler(Capabilities capabilities) { super(new SessionId(UUID.randomUUID()), uri, capabilities); } @Override public HttpResponse execute(HttpRequest req) throws UncheckedIOException { return new HttpResponse(); } } Capabilities caps = new ImmutableCapabilities("browserName", "cheese"); uri = new URI("http://localhost:1234"); local = LocalNode.builder(tracer, bus, clientFactory, uri) .add(caps, new TestSessionFactory((id, c) -> new Handler(c))) .maximumConcurrentSessions(2) .build(); }
Source:
protected StringReader sanitizeXmlDocument(DefaultHandler handler, InputStream inputStream) throws IOException { if (log.isDebugEnabled()) { log.debug("Sanitizing XML document destined for handler " + handler.getClass()); } try { StringBuilder listingDocBuffer = new StringBuilder(); BufferedReader br = new BufferedReader( new InputStreamReader(inputStream, Constants.DEFAULT_ENCODING)); char[] buf = new char[8192]; int read = -1; while ((read = br.read(buf)) != -1) { listingDocBuffer.append(buf, 0, read); } br.close(); String listingDoc = pattern.matcher(listingDocBuffer).replaceAll("&#013;"); return new StringReader(listingDoc); } catch (IOException e) { throw e; } catch (Throwable t) { try { inputStream.close(); } catch (IOException e) { if (log.isErrorEnabled()) { log.error("Unable to close response InputStream after failure sanitizing XML document", e); } } throw new AmazonClientException("Failed to sanitize XML document destined for handler " + handler.getClass(), t); } }

Target:
protected StringReader sanitizeXmlDocument(DefaultHandler handler, InputStream inputStream) throws IOException { if (log.isDebugEnabled()) { log.debug("Sanitizing XML document destined for handler " + handler.getClass()); } BufferedReader br = null; try { StringBuilder listingDocBuffer = new StringBuilder(); char[] buf = new char[8192]; int read = -1; br = new BufferedReader( new InputStreamReader(inputStream, Constants.DEFAULT_ENCODING)); while ((read = br.read(buf)) != -1) { listingDocBuffer.append(buf, 0, read); } br.close(); String listingDoc = pattern.matcher(listingDocBuffer).replaceAll("&#013;"); return new StringReader(listingDoc); } catch (IOException e) { throw e; } catch (Throwable t) { try { inputStream.close(); } catch (IOException e) { if (log.isErrorEnabled()) { log.error("Unable to close response InputStream after failure sanitizing XML document", e); } } throw new AmazonClientException("Failed to sanitize XML document destined for handler " + handler.getClass(), t); } finally { IOUtils.closeQuietly(br, log); } }
Source:
public static void addFileHandler(String fileName) { try { FileHandler fh = new FileHandler(fileName); fh.setFormatter(new SimpleFormatter()); getOvirtLogger().addHandler(fh); } catch (SecurityException | IOException ex) { throw new IllegalArgumentException( String.format("Error accessing log file '%s': '%s'", fileName, ex.getMessage()), ex); } }

Target:
public static void addFileHandler(String fileName) { try { FileHandler fh = new FileHandler(fileName); fh.setFormatter(new SimpleFormatter()); OVIRT_LOGGER.addHandler(fh); } catch (SecurityException | IOException ex) { throw new IllegalArgumentException( String.format("Error accessing log file '%s': '%s'", fileName, ex.getMessage()), ex); } }
Source:
private static void cleanOldWorkDir() { Path oldWorkDir = Paths.get(PathManager.getConfigPath()).resolve("sonarlint").resolve("work"); if (!oldWorkDir.toFile().isDirectory()) { return; } try (Stream<Path> stream = Files.list(oldWorkDir)) { stream.filter(f -> f.getFileName().toString().startsWith(".sonartmp_")) .forEach(FileUtils::deleteRecursively); } catch (IOException e) { } }

Target:
private static void cleanOldWorkDir() { Path oldWorkDir = Paths.get(PathManager.getConfigPath()).resolve("sonarlint").resolve("work"); if (!Files.isDirectory(oldWorkDir)) { return; } try (Stream<Path> stream = Files.list(oldWorkDir)) { stream.filter(f -> f.getFileName().toString().startsWith(".sonartmp_")) .forEach(FileUtils::deleteRecursively); } catch (IOException e) { } }
Source:
private void initSiteSettings() { mSiteSettings = SiteSettingsInterface.getInterface(getActivity(), getSelectedSite(), this); mSiteSettings.init(true); }

Target:
private void initSiteSettings() { mSiteSettings = SiteSettingsInterface.getInterface(getActivity(), getSelectedSite(), this); if (mSiteSettings != null) { mSiteSettings.init(true); } }
Source:
@Override public BufferedImage toImage() { BufferedImage image = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB); int[] data = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { data[j + (i*128)] = 0; } } return image; }

Target:
public BufferedImage toImage() { BufferedImage image = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB); int[] data = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { data[j + (i*128)] = getPixel(j, i).getColor().getRgb(); } } return image; }
Source:
public InventoryConfig() { configPath = Paths.get(System.getProperty("jboss.server.config.dir"), "hawkular"); ispnReindex = Boolean.parseBoolean(System.getProperty(ISPN_REINDEX, ISPN_REINDEX_DEFAULT)); dataPath = Paths.get(System.getProperty("jboss.server.data.dir")); scrapeLocation = new File(dataPath.toFile(), "prometheus"); scrapeLocation.mkdirs(); }

Target:
public InventoryConfig() { ispnReindex = Boolean.parseBoolean(System.getProperty(ISPN_REINDEX, ISPN_REINDEX_DEFAULT)); configPath = Paths.get(System.getProperty("jboss.server.config.dir"), "hawkular"); configPath.toFile().mkdirs(); dataPath = Paths.get(System.getProperty("jboss.server.data.dir")); scrapeLocation = new File(dataPath.toFile(), "prometheus"); scrapeLocation.mkdirs(); }
Source:
public void factoryTestBadJson() throws Exception { Properties properties = new Properties(); JSONObject jsonObject = new JSONObject().put("POST", UPLOAD_ENDPOINT); properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, jsonObject.toString()); try { new AmbryUrlSigningServiceFactory(new VerifiableProperties(properties), new MetricRegistry()).getUrlSigningService(); fail("Expected exception"); } catch (Exception ex) { assertTrue(ex instanceof IllegalStateException); } jsonObject = new JSONObject().put("GET", DOWNLOAD_ENDPOINT); properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, jsonObject.toString()); try { new AmbryUrlSigningServiceFactory(new VerifiableProperties(properties), new MetricRegistry()).getUrlSigningService(); fail("Expected exception"); } catch (Exception ex) { assertTrue(ex instanceof IllegalStateException); } properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, "[Garbage string &%#123"); try { new AmbryUrlSigningServiceFactory(new VerifiableProperties(properties), new MetricRegistry()).getUrlSigningService(); fail("Expected exception"); } catch (Exception ex) { assertTrue(ex instanceof IllegalStateException); } }

Target:
public void factoryTestBadJson() { Properties properties = new Properties(); JSONObject jsonObject = new JSONObject().put("POST", UPLOAD_ENDPOINT); properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, jsonObject.toString()); try { new AmbryUrlSigningServiceFactory(new VerifiableProperties(properties), new MetricRegistry()).getUrlSigningService(); fail("Expected exception"); } catch (IllegalStateException ex) { } jsonObject = new JSONObject().put("GET", DOWNLOAD_ENDPOINT); properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, jsonObject.toString()); try { new AmbryUrlSigningServiceFactory(new VerifiableProperties(properties), new MetricRegistry()).getUrlSigningService(); fail("Expected exception"); } catch (IllegalStateException ex) { } properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, "[Garbage string &%#123"); try { new AmbryUrlSigningServiceFactory(new VerifiableProperties(properties), new MetricRegistry()).getUrlSigningService(); fail("Expected exception"); } catch (IllegalStateException ex) { } }
Source:
public int store(final String credsStore, final DockerCredentialHelperAuth auth) throws IOException, InterruptedException { final Process process = exec("store", credsStore); try (final Writer outStreamWriter = new OutputStreamWriter(process.getOutputStream(), StandardCharsets.UTF_8)) { try (final BufferedWriter writer = new BufferedWriter(outStreamWriter)) { writer.write(mapper.writeValueAsString(auth) + "\n"); writer.flush(); } } return process.waitFor(); }

Target:
public int store(final String credsStore, final DockerCredentialHelperAuth auth) throws IOException, InterruptedException { final Process process = exec("store", credsStore); try (final Writer outStreamWriter = new OutputStreamWriter(process.getOutputStream(), StandardCharsets.UTF_8)) { try (final BufferedWriter writer = new BufferedWriter(outStreamWriter)) { writer.write(mapper.writeValueAsString(auth)); writer.newLine(); writer.flush(); } } return process.waitFor(); }
Source:
public void connect(MessageContext messageContext) throws ConnectException { String fileLocation = getParameter(messageContext, "filelocation") == null ? "" : getParameter( messageContext, "filelocation").toString(); String filename = getParameter(messageContext, "file") == null ? "" : getParameter( messageContext, "file").toString(); String content = getParameter(messageContext, "content") == null ? "" : getParameter( messageContext, "content").toString(); String newFileName = getParameter(messageContext, "newfilename") == null ? "" : getParameter( messageContext, "newfilename").toString(); String filebeforepprocess = getParameter(messageContext, "filebeforepprocess") == null ? "" : getParameter( messageContext, "filebeforepprocess").toString(); boolean isFileExist = false; try { isFileExist = isFileExist(fileLocation, filename, content); } catch (FileSystemException e) { handleException(e.getMessage(),e, messageContext); } generateResults(messageContext, isFileExist); }

Target:
public void connect(MessageContext messageContext) throws ConnectException { String fileLocation = getParameter(messageContext, "filelocation") == null ? "" : getParameter( messageContext, "filelocation").toString(); String filename = getParameter(messageContext, "file") == null ? "" : getParameter( messageContext, "file").toString(); String content = getParameter(messageContext, "content") == null ? "" : getParameter( messageContext, "content").toString(); String newFileName = getParameter(messageContext, "newfilename") == null ? "" : getParameter( messageContext, "newfilename").toString(); String filebeforepprocess = getParameter(messageContext, "filebeforepprocess") == null ? "" : getParameter( messageContext, "filebeforepprocess").toString(); boolean isFileExist = false; try { isFileExist = isFileExist(fileLocation, filename, content); } catch (FileSystemException e) { handleException("Error while checking a file: " + e.getMessage(), e, messageContext); } generateResults(messageContext, isFileExist); }
Source:
public void subscribe(Topic topic, StreamObserver<Subscription> responseObserver) { log().debug("Creating the subscription to a topic: {}", topic); try { final Target target = topic.getTarget(); final BoundedContext boundedContext = selectBoundedContext(target); final Stand stand = boundedContext.getStand(); final Subscription subscription = stand.subscribe(target); responseObserver.onNext(subscription); responseObserver.onCompleted(); } catch (@SuppressWarnings("OverlyBroadCatchBlock") Exception e) { log().error("Error processing subscription request", e); responseObserver.onError(e); responseObserver.onCompleted(); } }

Target:
public void subscribe(Topic topic, StreamObserver<Subscription> responseObserver) { log().debug("Creating the subscription to a topic: {}", topic); try { final Target target = topic.getTarget(); final BoundedContext boundedContext = selectBoundedContext(target); final Stand stand = boundedContext.getStand(); final Subscription subscription = stand.subscribe(target); responseObserver.onNext(subscription); responseObserver.onCompleted(); } catch (@SuppressWarnings("OverlyBroadCatchBlock") Exception e) { log().error("Error processing subscription request", e); responseObserver.onError(e); } }
Source:
public void updateImagePath(List<Process> processes) { for (Process process : processes) { try { FileformatInterface rdf = serviceManager.getProcessService().readMetadataFile(process); MetadataTypeInterface mdt = UghHelper.getMetadataType(process, "pathimagefiles"); List<? extends MetadataInterface> allImagePaths = rdf.getDigitalDocument().getPhysicalDocStruct() .getAllMetadataByType(mdt); if (allImagePaths.size() > 0) { for (MetadataInterface md : allImagePaths) { rdf.getDigitalDocument().getPhysicalDocStruct().getAllMetadata().remove(md); } } MetadataInterface newMetadata = UghImplementation.INSTANCE.createMetadata(mdt); if (SystemUtils.IS_OS_WINDOWS) { newMetadata.setStringValue("file:/" + serviceManager.getFileService().getImagesDirectory(process) + process.getTitle() + DIRECTORY_SUFFIX); } else { newMetadata.setStringValue("file://" + serviceManager.getFileService().getImagesDirectory(process) + process.getTitle() + DIRECTORY_SUFFIX); } rdf.getDigitalDocument().getPhysicalDocStruct().addMetadata(newMetadata); serviceManager.getFileService().writeMetadataFile(rdf, process); Helper.setMeldung(KITODO_SCRIPT_FIELD, "ImagePath updated: ", process.getTitle()); } catch (DocStructHasNoTypeException | UghHelperException | MetadataTypeNotAllowedException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung(e.getMessage()); } catch (Exception e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung(KITODO_SCRIPT_FIELD, "Error while updating imagepath", e); } } Helper.setMeldung(KITODO_SCRIPT_FIELD, "", "updateImagePath finished"); }

Target:
public void updateImagePath(List<Process> processes) { for (Process process : processes) { try { FileformatInterface rdf = serviceManager.getProcessService().readMetadataFile(process); MetadataTypeInterface mdt = UghHelper.getMetadataType(process, "pathimagefiles"); List<? extends MetadataInterface> allImagePaths = rdf.getDigitalDocument().getPhysicalDocStruct() .getAllMetadataByType(mdt); if (allImagePaths.size() > 0) { for (MetadataInterface md : allImagePaths) { rdf.getDigitalDocument().getPhysicalDocStruct().getAllMetadata().remove(md); } } MetadataInterface newMetadata = UghImplementation.INSTANCE.createMetadata(mdt); if (SystemUtils.IS_OS_WINDOWS) { newMetadata.setStringValue("file:/" + serviceManager.getFileService().getImagesDirectory(process) + process.getTitle() + DIRECTORY_SUFFIX); } else { newMetadata.setStringValue("file://" + serviceManager.getFileService().getImagesDirectory(process) + process.getTitle() + DIRECTORY_SUFFIX); } rdf.getDigitalDocument().getPhysicalDocStruct().addMetadata(newMetadata); serviceManager.getFileService().writeMetadataFile(rdf, process); Helper.setMeldung(KITODO_SCRIPT_FIELD, "ImagePath updated: ", process.getTitle()); } catch (UghHelperException | MetadataTypeNotAllowedException | PreferencesException | IOException | ReadException | WriteException | RuntimeException e) { Helper.setErrorMessage(KITODO_SCRIPT_FIELD, "Error while updating imagepath", logger, e); } } Helper.setMeldung(KITODO_SCRIPT_FIELD, "", "updateImagePath finished"); }
Source:
private String getTemplatizedCreatedDate() { if (dateCreated != null) { if (UploadableFile.DateTimeWithSource.EXIF_SOURCE.equals(dateCreatedSource)) { java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd"); return String.format(Locale.ENGLISH, TEMPLATE_DATE_ACC_TO_EXIF, dateformat.format(dateCreated)) + "\n"; } else { java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd"); return String.format(Locale.ENGLISH, TEMPLATE_DATA_OTHER_SOURCE, dateformat.format(dateCreated)) + "\n"; } } return ""; }

Target:
private String getTemplatizedCreatedDate() { if (dateCreated != null) { java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd"); if (UploadableFile.DateTimeWithSource.EXIF_SOURCE.equals(dateCreatedSource)) { return String.format(Locale.ENGLISH, TEMPLATE_DATE_ACC_TO_EXIF, dateFormat.format(dateCreated)) + "\n"; } else { return String.format(Locale.ENGLISH, TEMPLATE_DATA_OTHER_SOURCE, dateFormat.format(dateCreated)) + "\n"; } } return ""; }
Source:
public Expression superInvoke(String methodName) { SuperMethodInvocation superMethodInvocation = getAST().newSuperMethodInvocation(); superMethodInvocation.setName(simpleName(methodName)); return superMethodInvocation; }

Target:
public Expression superInvoke(String methodName) { SuperMethodInvocation smi = getAST().newSuperMethodInvocation(); smi.setName(simpleName(methodName)); return smi; }
Source:
private static AttachToTarget fromJson(JsonInput input) { SessionId sessionId = new SessionId(input.nextString()); TargetInfo targetInfo = null; Boolean waitForDebugger = null; while (input.hasNext()) { switch (input.nextName()) { case "targetInfo": targetInfo = input.read(TargetInfo.class); break; case "waitingForDebugger": waitForDebugger = input.nextBoolean(); break; default: input.skipValue(); break; } } return new AttachToTarget(sessionId, targetInfo, waitForDebugger); }

Target:
private static AttachToTarget fromJson(JsonInput input) { SessionId sessionId = input.read(SessionId.class); TargetInfo targetInfo = null; Boolean waitForDebugger = null; while (input.hasNext()) { switch (input.nextName()) { case "targetInfo": targetInfo = input.read(TargetInfo.class); break; case "waitingForDebugger": waitForDebugger = input.nextBoolean(); break; default: input.skipValue(); break; } } return new AttachToTarget(sessionId, targetInfo, waitForDebugger); }
Source:
public MsSpectrumType getSpectrumType() { MsSpectrumType spectrumType = SpectrumTypeDetectionAlgorithm.detectSpectrumType(mzValues, intensityValues, getMzBinaryDataInfo().getArrayLength()); return spectrumType; }

Target:
public MsSpectrumType getSpectrumType() { if (getCVValue(MzMLCV.cvCentroidSpectrum) != null) return MsSpectrumType.CENTROIDED; if (getCVValue(MzMLCV.cvProfileSpectrum) != null) return MsSpectrumType.PROFILE; return null; }
Source:
public String getUuidProperty() { return RestTestConstants2_2.ORDER_UUID; }

Target:
public String getUuidProperty() { return null; }
Source:
public LocalIOComponentFamilyDefinition() { super(NAME, new FixedDatastoreDefinition(), new FixedDatasetDefinition(), new FixedInputDefinition(), new DevNullOutputDefinition(), new RowGeneratorDefinition(), new FixedFlowInputDefinition()); }

Target:
public LocalIOComponentFamilyDefinition() { super(NAME, new FixedDatastoreDefinition(), new FixedDatasetDefinition(), new FixedInputDefinition(), new DevNullOutputDefinition(), new FixedFlowInputDefinition()); }
Source:
private static String getWebsiteLinkWithFallback(Playable media) { String link = null; if (media != null) { link = media.getWebsiteLink(); if (link == null) { if (media instanceof FeedMedia) { link = FeedItemUtil.getLinkWithFallback(((FeedMedia)media).getItem()); } } } return link; }

Target:
private static String getWebsiteLinkWithFallback(Playable media) { if (media == null) { return null; } else if (media.getWebsiteLink() != null) { return media.getWebsiteLink(); } else if (media instanceof FeedMedia) { return FeedItemUtil.getLinkWithFallback(((FeedMedia)media).getItem()); } return null; }
Source:
public String createFunction( final String name, final String definition, final String outputType, final Boolean isMultiValued, final FunctionLanguage lang, final String binary, final Set<Integer> workers) throws DbException, InterruptedException { String response = ""; Set<Integer> actualWorkers = workers; if (workers == null) { actualWorkers = getWorkers().keySet(); } try { Map<Integer, SubQueryPlan> workerPlans = new HashMap<>(); for (Integer workerId : actualWorkers) { workerPlans.put( workerId, new SubQueryPlan( new DbCreateFunction( EmptyRelation.of(Schema.EMPTY_SCHEMA), name, definition, outputType, isMultiValued, lang, binary))); } ListenableFuture<Query> qf = queryManager.submitQuery( "create function", "create function", "create function", new SubQueryPlan(new EmptySink(new EOSSource())), workerPlans); try { qf.get().getQueryId(); } catch (ExecutionException e) { throw new DbException("Error executing query", e.getCause()); } } catch (CatalogException e) { throw new DbException(e); } if (response == "") { try { catalog.registerFunction(name, definition, outputType, isMultiValued, lang); } catch (CatalogException e) { throw new DbException(e); } } else { response = "Function is not valid"; } return response; }

Target:
public String createFunction( final String name, final String definition, final String outputType, final Boolean isMultiValued, final FunctionLanguage lang, final String binary, final Set<Integer> workers) throws DbException, InterruptedException { String response = ""; Set<Integer> actualWorkers = workers; if (workers == null) { actualWorkers = getWorkers().keySet(); } try { Map<Integer, SubQueryPlan> workerPlans = new HashMap<>(); for (Integer workerId : actualWorkers) { workerPlans.put( workerId, new SubQueryPlan( new DbCreateFunction( EmptyRelation.of(Schema.EMPTY_SCHEMA), name, definition, outputType, isMultiValued, lang, binary))); } ListenableFuture<Query> qf = queryManager.submitQuery( "create function", "create function", "create function", new SubQueryPlan(new EmptySink(new EOSSource())), workerPlans); try { qf.get().getQueryId(); } catch (ExecutionException e) { throw new DbException("Error executing query", e.getCause()); } } catch (CatalogException e) { throw new DbException(e); } try { catalog.registerFunction(name, definition, outputType, isMultiValued, lang); } catch (CatalogException e) { throw new DbException(e); } return response; }
Source:
public void lockSecret() throws Exception { Optional<String> absent = factory.begin(() -> secretControlStore.lockProjectSecret(projectId, SecretScopes.PROJECT, KEY1, (control, value) -> value)); assertThat(absent, is(Optional.absent())); factory.begin(() -> secretControlStore.setProjectSecret(projectId, SecretScopes.PROJECT, KEY1, VALUE1)); Optional<String> present = factory.begin(() -> secretControlStore.lockProjectSecret(projectId, SecretScopes.PROJECT, KEY1, (control, value) -> value)); assertThat(present, is(Optional.of(VALUE1))); }

Target:
public void lockSecret() throws Exception { factory.begin(() -> secretControlStore.setProjectSecret(projectId, SecretScopes.PROJECT, KEY1, VALUE1)); AtomicReference<Optional<String>> blockedGetValue = new AtomicReference<>(null); AtomicBoolean comitting = new AtomicBoolean(false); AtomicBoolean blockedCheckComitting = new AtomicBoolean(false); Thread thread = factory.begin(() -> secretControlStore.lockProjectSecret(projectId, SecretScopes.PROJECT, KEY1, (control, value) -> { try { AtomicBoolean started = new AtomicBoolean(false); Thread t = new Thread(() -> { started.set(true); try { blockedGetValue.set( factory.begin(() -> secretControlStore.lockProjectSecret(projectId, SecretScopes.PROJECT, KEY1, (c1, v1) -> v1))); } catch (Exception ex) { throw new RuntimeException(ex); } blockedCheckComitting.set(comitting.get()); }); t.setDaemon(true); t.start(); while (!started.get()) { Thread.sleep(500); } Thread.sleep(500); control.setProjectSecret(projectId, SecretScopes.PROJECT, KEY1, VALUE1 + ".changed"); comitting.set(true); return t; } catch (InterruptedException ex) { throw new AssertionError(ex); } })); thread.join(); assertThat(blockedGetValue.get(), is(Optional.of(VALUE1 + ".changed"))); assertThat(blockedCheckComitting.get(), is(true)); }
Source:
protected Iterable<TreePath> getChildren(TreePath path, long id, TreeIterator i) { if (!path.getFileStatus().isDirectory()) { return Collections.emptyList(); } try { ArrayList<TreePath> ret = new ArrayList<>(); for (FileStatus s : fs.listStatus(path.getFileStatus().getPath())) { ret.add(new TreePath(s, id, i, fs, getAclStatus(fs, s.getPath()))); } return ret; } catch (FileNotFoundException e) { throw new ConcurrentModificationException("FS modified"); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
protected Iterable<TreePath> getChildren(TreePath path, long id, TreeIterator i) { if (!path.getFileStatus().isDirectory()) { return Collections.emptyList(); } try { ArrayList<TreePath> ret = new ArrayList<>(); for (FileStatus s : fs.listStatus(path.getFileStatus().getPath())) { AclStatus aclStatus = getAclStatus(fs, s.getPath()); ret.add(new TreePath(s, id, i, fs, aclStatus)); } return ret; } catch (FileNotFoundException e) { throw new ConcurrentModificationException("FS modified"); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public void bindInputs(BindingService bindingService) { if (log.isDebugEnabled()) { log.debug(String.format("Binding inputs for %s:%s", this.channelNamespace, this.type)); } for (Map.Entry<String, BoundElementHolder> channelHolderEntry : this.inputHolders.entrySet()) { String inputChannelName = channelHolderEntry.getKey(); BoundElementHolder boundElementHolder = channelHolderEntry.getValue(); if (boundElementHolder.isBindable()) { if (log.isDebugEnabled()) { log.debug(String.format("Binding %s:%s:%s", this.channelNamespace, this.type, inputChannelName)); } bindingService.bindConsumer(boundElementHolder.getBoundElement(), inputChannelName); } } }

Target:
public void bindInputs(BindingService bindingService) { if (log.isDebugEnabled()) { log.debug(String.format("Binding inputs for %s:%s", this.channelNamespace, this.type)); } for (Map.Entry<String, BoundTargetHolder> boundTargetHolderEntry : this.inputHolders.entrySet()) { String inputTargetName = boundTargetHolderEntry.getKey(); BoundTargetHolder boundTargetHolder = boundTargetHolderEntry.getValue(); if (boundTargetHolder.isBindable()) { if (log.isDebugEnabled()) { log.debug(String.format("Binding %s:%s:%s", this.channelNamespace, this.type, inputTargetName)); } bindingService.bindConsumer(boundTargetHolder.getBoundTarget(), inputTargetName); } } }
Source:
public FragmentHelper(Fragment fragment) { super(fragment.getContext(), (FlowParameters) fragment.getArguments().getParcelable(ExtraConstants.EXTRA_FLOW_PARAMS)); mFragment = fragment; }

Target:
public FragmentHelper(Fragment fragment) { super(fragment.getContext().getApplicationContext(), (FlowParameters) fragment.getArguments().getParcelable(ExtraConstants.EXTRA_FLOW_PARAMS)); mFragment = fragment; }
Source:
private String convertToFullyQualifiedClassName(final String factType) { if (factType.contains(".")) { return factType; } String fullyQualifiedClassName = null; for (Import imp : imports.getImports()) { if (imp.getType().endsWith(factType)) { fullyQualifiedClassName = imp.getType(); break; } } if (fullyQualifiedClassName == null) { fullyQualifiedClassName = packageName + "." + factType; } return fullyQualifiedClassName; }

Target:
private String convertToFullyQualifiedClassName(final String factType) { if (factType.contains(".")) { return factType; } final Optional<String> fullyQualifiedClassName = findFQCNFromImports(factType); if (fullyQualifiedClassName.isPresent()) { return fullyQualifiedClassName.get(); } else { return packageName + "." + factType; } }
Source:
JSONObject toJson() throws JSONException { JSONObject metadata = new JSONObject(); switch (currentJsonVersion) { case JSON_VERSION_1: metadata.put(JSON_VERSION_KEY, JSON_VERSION_1); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(STATUS_KEY, status.name()); metadata.put(DESCRIPTION_KEY, description); metadata.put(IS_PRIVATE_KEY, !cacheable); metadata.put(PARENT_ACCOUNT_ID_KEY, parentAccountId); break; case JSON_VERSION_2: metadata.put(Container.JSON_VERSION_KEY, JSON_VERSION_2); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(Container.STATUS_KEY, status.name()); metadata.put(DESCRIPTION_KEY, description); metadata.put(ENCRYPTED_KEY, encrypted); metadata.put(PREVIOUSLY_ENCRYPTED_KEY, previouslyEncrypted); metadata.put(CACHEABLE_KEY, cacheable); metadata.put(MEDIA_SCAN_DISABLED_KEY, mediaScanDisabled); metadata.putOpt(REPLICATION_POLICY_KEY, replicationPolicy); metadata.put(TTL_REQUIRED_KEY, ttlRequired); JSONArray contentTypeWhitelistForFilenamesOnDownloadJson = new JSONArray(); contentTypeWhitelistForFilenamesOnDownload.forEach(contentTypeWhitelistForFilenamesOnDownloadJson::put); metadata.put(CONTENT_TYPE_WHITELIST_FOR_FILENAMES_ON_DOWNLOAD, contentTypeWhitelistForFilenamesOnDownloadJson); break; default: throw new IllegalStateException("Unsupported container json version=" + currentJsonVersion); } return metadata; }

Target:
JSONObject toJson() throws JSONException { JSONObject metadata = new JSONObject(); switch (currentJsonVersion) { case JSON_VERSION_1: metadata.put(JSON_VERSION_KEY, JSON_VERSION_1); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(STATUS_KEY, status.name()); metadata.put(DESCRIPTION_KEY, description); metadata.put(IS_PRIVATE_KEY, !cacheable); metadata.put(PARENT_ACCOUNT_ID_KEY, parentAccountId); break; case JSON_VERSION_2: metadata.put(Container.JSON_VERSION_KEY, JSON_VERSION_2); metadata.put(CONTAINER_ID_KEY, id); metadata.put(CONTAINER_NAME_KEY, name); metadata.put(Container.STATUS_KEY, status.name()); metadata.put(DESCRIPTION_KEY, description); metadata.put(ENCRYPTED_KEY, encrypted); metadata.put(PREVIOUSLY_ENCRYPTED_KEY, previouslyEncrypted); metadata.put(CACHEABLE_KEY, cacheable); metadata.put(MEDIA_SCAN_DISABLED_KEY, mediaScanDisabled); metadata.putOpt(REPLICATION_POLICY_KEY, replicationPolicy); metadata.put(TTL_REQUIRED_KEY, ttlRequired); if (contentTypeWhitelistForFilenamesOnDownload != null && !contentTypeWhitelistForFilenamesOnDownload.isEmpty()) { JSONArray contentTypeWhitelistForFilenamesOnDownloadJson = new JSONArray(); contentTypeWhitelistForFilenamesOnDownload.forEach(contentTypeWhitelistForFilenamesOnDownloadJson::put); metadata.put(CONTENT_TYPE_WHITELIST_FOR_FILENAMES_ON_DOWNLOAD, contentTypeWhitelistForFilenamesOnDownloadJson); } break; default: throw new IllegalStateException("Unsupported container json version=" + currentJsonVersion); } return metadata; }
Source:
public PatchSetAttribute asPatchSetAttribute(final PatchSet patchSet) { PatchSetAttribute p = new PatchSetAttribute(); p.revision = patchSet.getRevision().get(); p.number = Integer.toString(patchSet.getPatchSetId()); p.ref = patchSet.getRefName(); p.uploader = asAccountAttribute(patchSet.getUploader()); p.createdOn = patchSet.getCreatedOn().getTime() / 1000L; final PatchSet.Id pId = patchSet.getId(); try { final ReviewDb db = schema.open(); try { p.parents = new ArrayList<String>(); for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf( patchSet.getId())) { p.parents.add(a.getAncestorRevision().get()); } Account.Id authorId = psInfoFactory.get(db, pId).getAuthor().getAccount(); if (authorId == null) { p.author = new AccountAttribute(); p.author.email = ""; p.author.name = "[Forge Author or non-Gerrit User]"; p.author.username = ""; } else { p.author = asAccountAttribute(authorId); } Change change = db.changes().get(pId.getParentKey()); List<Patch> list = patchListCache.get(change, patchSet).toPatchList(pId); for (Patch pe : list) { if (!Patch.COMMIT_MSG.equals(pe.getFileName())) { p.sizeDeletions -= pe.getDeletions(); p.sizeInsertions += pe.getInsertions(); } } } finally { db.close(); } } catch (OrmException e) { log.error("Cannot load patch set data for " + patchSet.getId(), e); } catch (PatchSetInfoNotAvailableException e) { log.error(String.format("Cannot get authorEmail for %s.", pId), e); } catch (PatchListNotAvailableException e) { log.error(String.format("Cannot get size information for %s.", pId), e); } return p; }

Target:
public PatchSetAttribute asPatchSetAttribute(final PatchSet patchSet) { PatchSetAttribute p = new PatchSetAttribute(); p.revision = patchSet.getRevision().get(); p.number = Integer.toString(patchSet.getPatchSetId()); p.ref = patchSet.getRefName(); p.uploader = asAccountAttribute(patchSet.getUploader()); p.createdOn = patchSet.getCreatedOn().getTime() / 1000L; final PatchSet.Id pId = patchSet.getId(); try { final ReviewDb db = schema.open(); try { p.parents = new ArrayList<String>(); for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf( patchSet.getId())) { p.parents.add(a.getAncestorRevision().get()); } Account.Id authorId = psInfoFactory.get(db, pId).getAuthor().getAccount(); if (authorId == null) { p.author = new AccountAttribute(); p.author.email = psInfoFactory.get(db, pId).getAuthor().getEmail(); p.author.name = psInfoFactory.get(db, pId).getAuthor().getName(); p.author.username = ""; } else { p.author = asAccountAttribute(authorId); } Change change = db.changes().get(pId.getParentKey()); List<Patch> list = patchListCache.get(change, patchSet).toPatchList(pId); for (Patch pe : list) { if (!Patch.COMMIT_MSG.equals(pe.getFileName())) { p.sizeDeletions -= pe.getDeletions(); p.sizeInsertions += pe.getInsertions(); } } } finally { db.close(); } } catch (OrmException e) { log.error("Cannot load patch set data for " + patchSet.getId(), e); } catch (PatchSetInfoNotAvailableException e) { log.error(String.format("Cannot get authorEmail for %s.", pId), e); } catch (PatchListNotAvailableException e) { log.error(String.format("Cannot get size information for %s.", pId), e); } return p; }
Source:
public Seq<V> values() { return Stream.ofAll(iterator()).map(Tuple2::_2); }

Target:
public Seq<V> values() { return iterator().map(Tuple2::_2).toStream(); }
Source:
public final void addContextData( String key, String value ) { this.context = context.with(key, value); this.cache.addContextData(key, value); }

Target:
final void addContextData( String key, String value ) { this.context = context.with(key, value); this.cache.addContextData(key, value); }