auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String getDeleteUserErrorMessages(AuthenticatedUser au) { String retVal = ""; if (!dvObjSvc.findByAuthenticatedUserId(au).isEmpty()) { retVal += BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.dvobjects"); } if (!roleAssigneeSvc.getAssignmentsFor(au.getIdentifier()).isEmpty()) { if (!retVal.isEmpty()) { retVal += "; "; } retVal += BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.roleAssignments"); } if (!gbRespSvc.findByAuthenticatedUserId(au).isEmpty()) { if (!retVal.isEmpty()) { retVal += "; "; } retVal += BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.gbResps"); } if (!datasetVersionService.getDatasetVersionUsersByAuthenticatedUser(au).isEmpty()) { if (!retVal.isEmpty()) { retVal += "; "; } retVal += BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.versionUser"); } if (!explicitGroupService.findGroups(au).isEmpty()) { if (!retVal.isEmpty()) { retVal += "; "; } retVal += BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.groupMember"); } if (userHasPendingAccessRequests(au)) { if (!retVal.isEmpty()) { retVal += "; "; } retVal += BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.pendingRequests"); } if (!retVal.isEmpty()) { retVal = BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.prefix", Arrays.asList(au.getIdentifier())) + " " + retVal + "."; } return retVal; }

Target:
public String getDeleteUserErrorMessages(AuthenticatedUser au) { String retVal = ""; List<String> reasons= new ArrayList(); if (!dvObjSvc.findByAuthenticatedUserId(au).isEmpty()) { reasons.add(BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.dvobjects")); } if (!roleAssigneeSvc.getAssignmentsFor(au.getIdentifier()).isEmpty()) { reasons.add(BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.roleAssignments")); } if (!gbRespSvc.findByAuthenticatedUserId(au).isEmpty()) { reasons.add( BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.gbResps")); } if (!datasetVersionService.getDatasetVersionUsersByAuthenticatedUser(au).isEmpty()) { reasons.add(BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.versionUser")); } if (!reasons.isEmpty()) { retVal = BundleUtil.getStringFromBundle("admin.api.deleteUser.failure.prefix", Arrays.asList(au.getIdentifier())); retVal += " " + reasons.stream().collect(Collectors.joining("; ")) + "."; } return retVal; }
Source:
public void testFindWorkingTemplateNoNPE() throws DotDataException, DotSecurityException { try { Template t = templateAPI.findWorkingTemplate("NO_TEMPLATE", APILocator.getUserAPI().getSystemUser(), false); assertTrue(t==null); } catch(NullPointerException e) { assertTrue("getting non-existant working template should not throw an NPE", false); } }

Target:
public void testFindWorkingTemplateNoNPE() throws DotDataException, DotSecurityException { try { final Template template = templateAPI.findWorkingTemplate("NO_TEMPLATE", APILocator.getUserAPI().getSystemUser(), false); assertNull(template); } catch(NullPointerException e) { Logger.error(this, "getting non-existant template should not throw an NPE", e); assertTrue("getting non-existant template should not throw an NPE", false); } }
Source:
public void testSimple() { final KafkaProducer<String, String> producer = mock(KafkaProducer.class); KafkaBolt<String, String> bolt = makeBolt(producer); OutputCollector collector = mock(OutputCollector.class); TopologyContext context = mock(TopologyContext.class); Map<String, Object> conf = new HashMap<>(); bolt.prepare(conf, context, collector); MkTupleParam param = new MkTupleParam(); param.setFields("key", "message"); Tuple testTuple = Testing.testTuple(Arrays.asList("KEY", "VALUE"), param); bolt.execute(testTuple); verify(producer).send(argThat(new ArgumentMatcher<ProducerRecord<String, String>>() { @Override public boolean matches(ProducerRecord<String, String> arg) { LOG.info("GOT ->", arg); LOG.info(" {}", arg.topic(), arg.key(), arg.value()); return "MY_TOPIC".equals(arg.topic()) && "KEY".equals(arg.key()) && "VALUE".equals(arg.value()); } }), any(Callback.class)); verify(collector).ack(testTuple); }

Target:
public void testSimple() { MockProducer<String, String> producer = new MockProducer<>(Cluster.empty(), false, null, null, null); KafkaBolt<String, String> bolt = makeBolt(producer); OutputCollector collector = mock(OutputCollector.class); TopologyContext context = mock(TopologyContext.class); Map<String, Object> conf = new HashMap<>(); bolt.prepare(conf, context, collector); String key = "KEY"; String value = "VALUE"; Tuple testTuple = createTestTuple(key, value); bolt.execute(testTuple); assertThat(producer.history().size(), is(1)); ProducerRecord<String, String> arg = producer.history().get(0); LOG.info("GOT ->", arg); LOG.info("{}, {}, {}", arg.topic(), arg.key(), arg.value()); assertThat(arg.topic(), is("MY_TOPIC")); assertThat(arg.key(), is(key)); assertThat(arg.value(), is(value)); producer.completeNext(); verify(collector).ack(testTuple); }
Source:
public CompletableFuture<PhysicalSlot> requestNewAllocatedSlot(@Nonnull SlotRequestId slotRequestId, @Nonnull ResourceProfile resourceProfile, @Nullable Time timeout) { assertRunningInMainThread(); LOG.debug("Request new allocated slot with slot request id and resource profile {}", slotRequestId, resourceProfile); final PendingRequest pendingRequest = PendingRequest.createNormalRequest(slotRequestId, resourceProfile); if (timeout != null) { FutureUtils .orTimeout( pendingRequest.getSlotFuture(), timeout.toMilliseconds(), TimeUnit.MILLISECONDS, componentMainThreadExecutor) .whenCompleteAsync((physicalSlot, throwable) -> { if (throwable instanceof TimeoutException) { timeoutPendingSlotRequest(slotRequestId); } }, componentMainThreadExecutor); } return internalRequestNewAllocatedSlot(pendingRequest); }

Target:
public CompletableFuture<PhysicalSlot> requestNewAllocatedSlot(@Nonnull SlotRequestId slotRequestId, @Nonnull ResourceProfile resourceProfile, @Nullable Time timeout) { assertRunningInMainThread(); LOG.debug("Request new allocated slot with slot request id and resource profile {}", slotRequestId, resourceProfile); final PendingRequest pendingRequest = PendingRequest.createNormalRequest(slotRequestId, resourceProfile); return internalRequestNewSlot(pendingRequest, timeout); }
Source:
public void configure(Binder binder) { String typeName = MomentSketchAggregatorFactory.TYPE_NAME; if (ComplexMetrics.getSerdeForType(typeName) == null) { ComplexMetrics.registerSerde(typeName, new MomentSketchComplexMetricSerde()); } }

Target:
public void configure(Binder binder) { ComplexMetrics.registerSerde( MomentSketchAggregatorFactory.TYPE_NAME, MomentSketchComplexMetricSerde::new ); }
Source:
protected void configure() { Names.bindProperties(binder(), Collections.singletonMap(Constants.PROPERTY_PRETTY_PRINT_PAYLOADS, "true")); bind(GsonModule.DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class); }

Target:
protected void configure() { }
Source:
public HighAvailabilityServices createHAServices(Configuration configuration, Executor executor) throws Exception { return new KubernetesHaServices( KubeClientFactory.fromConfiguration(configuration), executor, configuration, BlobUtils.createBlobStoreFromConfig(configuration)); }

Target:
public HighAvailabilityServices createHAServices(Configuration configuration, Executor executor) throws Exception { final KubeClientFactory kubeClientFactory = new DefaultKubeClientFactory(); return new KubernetesHaServices( kubeClientFactory.fromConfiguration(configuration, executor), executor, configuration, BlobUtils.createBlobStoreFromConfig(configuration)); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("\t\tDiffie-Hellman public key: "); sb.append(getPublicKey().toString()); sb.append(StringUtil.lineSeparator()); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); if (hint.equals("")) { sb.append("\t\tPSK Identity Hint: ").append("psk hint not present"); } else { sb.append("\t\tPSK Identity Hint: ").append(hint); } sb.append("\t\tEC Diffie-Hellman public key: "); sb.append(getPublicKey().toString()); sb.append(StringUtil.lineSeparator()); return sb.toString(); }
Source:
private boolean fullyDelete(File file) { if (file.isDirectory()) { File[] children = file.listFiles(); if (children != null) { for (File children1 : children) { fullyDelete(new File(file, children1.getName())); } } } if (file.delete()) { return true; } return !file.exists(); }

Target:
private boolean fullyDelete(File file) { if (file.isDirectory()) { File[] children = file.listFiles(); if (children != null) { for (File child : children) { fullyDelete(new File(file, child.getName())); } } } if (file.delete()) { return true; } return !file.exists(); }
Source:
public ResponseEntity<AppUserDTO> activateUser(@PathVariable("code") String code) { UserRegistration userRegistration = userRegistrationDao.findByCode(code); if (userRegistration == null) { throw new BadRequestException("Invalid registration code"); } else { AppUser user = userRegistration.getUser(); user.setActivated(true); user.setUserRegistration(null); appUserDao.saveAndFlush(user); userRegistrationDao.delete(userRegistration.getId()); return new ResponseEntity<>(appUserConverter.convertTo(user), HttpStatus.OK); } }

Target:
public ResponseEntity<AppUserDTO> activateUser(@PathVariable("code") String code) { UserRegistration userRegistration = userRegistrationDao.findByCode(code); if (userRegistration == null) { throw new BadRequestException("Invalid registration code"); } else { AppUser user = userRegistration.getUser(); user.setActivated(true); user.setUserRegistration(null); appUserDao.saveAndFlush(user); return new ResponseEntity<>(appUserConverter.convertTo(user), HttpStatus.OK); } }
Source:
public Response<?> apply(ReviewerResource rsrc, Input input) throws AuthException, ResourceNotFoundException, OrmException, IOException { ChangeControl control = rsrc.getControl(); Change.Id changeId = rsrc.getChange().getId(); ReviewDb db = dbProvider.get(); StringBuilder msg = new StringBuilder(); msg.append("Remove the following approvals:\n\n"); db.changes().beginTransaction(changeId); try { List<PatchSetApproval> del = Lists.newArrayList(); for (PatchSetApproval a : approvals(db, rsrc)) { if (control.canRemoveReviewer(a)) { del.add(a); msg.append("* ") .append(a.getLabel()).append(" ").append(a.getValue()) .append(" by ").append(userFactory.create(a.getAccountId()).getNameEmail()) .append("\n"); } else { throw new AuthException("delete not permitted"); } } if (del.isEmpty()) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db); db.patchSetApprovals().delete(del); db.commit(); ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(rsrc.getChange().getId(), ChangeUtil.messageUUID(db)), ((IdentifiedUser) control.getCurrentUser()).getAccountId(), TimeUtil.nowTs(), rsrc.getChange().currentPatchSetId()); changeMessage.setMessage(msg.toString()); db.changeMessages().insert(Collections.singleton(changeMessage)); } finally { db.rollback(); } indexer.index(rsrc.getChange()); return Response.none(); }

Target:
public Response<?> apply(ReviewerResource rsrc, Input input) throws AuthException, ResourceNotFoundException, OrmException, IOException { ChangeControl control = rsrc.getControl(); Change.Id changeId = rsrc.getChange().getId(); ReviewDb db = dbProvider.get(); StringBuilder msg = new StringBuilder(); msg.append("Removed the following approvals:\n\n"); db.changes().beginTransaction(changeId); try { List<PatchSetApproval> del = Lists.newArrayList(); for (PatchSetApproval a : approvals(db, rsrc)) { if (control.canRemoveReviewer(a)) { del.add(a); if (a.getValue() != 0) { msg.append("* ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(a.getAccountId()).getNameEmail()) .append("\n"); } } else { throw new AuthException("delete not permitted"); } } if (del.isEmpty()) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db); db.patchSetApprovals().delete(del); ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(rsrc.getChange().getId(), ChangeUtil.messageUUID(db)), ((IdentifiedUser) control.getCurrentUser()).getAccountId(), TimeUtil.nowTs(), rsrc.getChange().currentPatchSetId()); changeMessage.setMessage(msg.toString()); db.changeMessages().insert(Collections.singleton(changeMessage)); db.commit(); } finally { db.rollback(); } indexer.index(rsrc.getChange()); return Response.none(); }
Source:
public void showCoreContextMenu(Context context, View v) { PopupMenu popup = new PopupMenu(this, v); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(android.view.MenuItem item) { switch (item.getItemId()) { case R.id.menu_add_core: showDialog(R.id.DIALOG_ADD_CORE); break; case R.id.menu_edit_core: if (dbHelper.hasCores()) { showDialog(R.id.DIALOG_EDIT_CORE); } break; case R.id.menu_delete_core: if (dbHelper.hasCores()) { showDialog(R.id.DIALOG_DELETE_CORE); } updateCoreSpinner(); break; } return false; } }); popup.inflate(R.menu.context_core); if (core.getCount()==0) { popup.getMenu().getItem(1).setEnabled(false); popup.getMenu().getItem(2).setEnabled(false); } popup.show(); }

Target:
public void showCoreContextMenu(Context context, View v) { PopupMenu popup = new PopupMenu(this, v); popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(android.view.MenuItem item) { switch (item.getItemId()) { case R.id.menu_add_core: showDialog(R.id.DIALOG_ADD_CORE); break; case R.id.menu_edit_core: if (dbHelper.hasCores()) { showDialog(R.id.DIALOG_EDIT_CORE); } break; case R.id.menu_delete_core: if (dbHelper.hasCores()) { showDialog(R.id.DIALOG_DELETE_CORE); } updateCoreSpinner(); break; } return false; } }); popup.inflate(R.menu.context_core); if (core.getCount()==0) { popup.getMenu().findItem(R.id.menu_edit_core).setEnabled(false); popup.getMenu().findItem(R.id.menu_delete_core).setEnabled(false); } popup.show(); }
Source:
public FilteredAggregatorFactory( @JsonProperty("name") String name, @JsonProperty("aggregator") AggregatorFactory delegate, @JsonProperty("filter") DimFilter filter ) { Preconditions.checkNotNull(delegate); Preconditions.checkNotNull(filter); Preconditions.checkArgument( filter instanceof SelectorDimFilter || filter instanceof NotDimFilter, "FilteredAggregator currently only supports filters of type selector and not" ); this.name = name; this.delegate = delegate; this.filter = filter; }

Target:
public FilteredAggregatorFactory( @JsonProperty("name") String name, @JsonProperty("aggregator") AggregatorFactory delegate, @JsonProperty("filter") DimFilter filter ) { Preconditions.checkNotNull(delegate); Preconditions.checkNotNull(filter); Preconditions.checkArgument( filter instanceof SelectorDimFilter || (filter instanceof NotDimFilter && ((NotDimFilter) filter).getField() instanceof SelectorDimFilter), "FilteredAggregator currently only supports filters of type 'selector' and their negation" ); this.name = name; this.delegate = delegate; this.filter = filter; }
Source:
public boolean isPutIntoOven() throws OvenException { try { final URL url = new URL("<LINK_0>"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.connect(); int inOven = connection.getResponseCode(); return inOven == 200; } catch (IOException ex) { throw new OvenException(); } }

Target:
public boolean isPutIntoOven() throws OvenException { try { final URL url = new URL("<LINK_0>"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.connect(); int inOven = connection.getResponseCode(); return inOven == 200; } catch (IOException ex) { throw new OvenException(ex); } }
Source:
public void findAll() throws Exception { final Operator operator = new Operator("id", "name", "description", "domainName", "friendlyName"); final List<Operator> operators = Lists.newArrayList(operator); context.checking(new Expectations() {{ oneOf(repository).findAll(); will(returnValue(operators)); }}); Reply<?> reply = service.findAll(); List<OperatorDTO> expected = Lists.newArrayList(new OperatorDTO("id", "name", "description", "domainName", "friendlyName")); assertThat(reply, containsValue(expected)); assertThat(reply, isOk()); }

Target:
public void findAll() throws Exception { final Operator operator = new Operator("id1", "name1", "description1", "domainName1", "friendlyName1"); final Operator anotherOperator = new Operator("id2", "name2", "description2", "domainName2", "friendlyName2"); final List<Operator> operators = Lists.newArrayList(operator, anotherOperator); context.checking(new Expectations() {{ oneOf(repository).findAll(); will(returnValue(operators)); }}); Reply<?> reply = service.findAll(); List<OperatorDTO> expected = Lists.newArrayList( new OperatorDTO("id1", "name1", "description1", "domainName1", "friendlyName1"), new OperatorDTO("id2", "name2", "description2", "domainName2", "friendlyName2") ); assertThat(reply, containsValue(expected)); assertThat(reply, isOk()); }
Source:
private void refresh() { Util.PROJECT_SVC.projectDetail(projectName, new GerritCallback<ProjectDetail>() { public void onSuccess(final ProjectDetail result) { com.google.gerrit.client.account.Util.ACCOUNT_SEC.myGroups(new GerritCallback<List<AccountGroup>>() { public void onSuccess(List<AccountGroup> myGroups) { boolean userHasOwnRight = Util.hasOwnRight(result, myGroups); enableForm(userHasOwnRight); saveProject.setVisible(userHasOwnRight); saveProject.setEnabled(false); display(result); } }); } }); }

Target:
private void refresh() { Util.PROJECT_SVC.projectDetail(projectName, new GerritCallback<ProjectDetail>() { public void onSuccess(final ProjectDetail result) { enableForm(result.canModifyData); saveProject.setVisible(result.canModifyData); saveProject.setEnabled(false); display(result); } }); }
Source:
public Map<String, Set<MentionNotificationParameter>> getMentions() { return this.mentions; }

Target:
public Map<String, Set<MentionNotificationParameter>> getMentions() { return this.unmodifiableMentions; }
Source:
public Builder(InternalEnvironment internalEnvironment) { this.internalEnvironment = internalEnvironment; setType(TYPE); }

Target:
public Builder(InternalEnvironment internalEnvironment) { this.internalEnvironment = internalEnvironment; }
Source:
public void testHostDiscoveryFromSourceCloses() throws Exception { Listenable<ConnectionStateListener> connectionStateListener = mock(Listenable.class); CuratorFramework curatorFramework = mock(CuratorFramework.class); CuratorConnection connection = mock(CuratorConnection.class); HostDiscoverySource closingHostDiscoverySource = mock(HostDiscoverySource.class); HostDiscovery closedHostDiscovery = mock(HostDiscovery.class); HostDiscoverySource nonClosingHostDiscoverySource = mock(HostDiscoverySource.class); HostDiscovery unclosedHostDiscovery = mock(HostDiscovery.class); when(curatorFramework.getState()).thenReturn(CuratorFrameworkState.STARTED); when(curatorFramework.getConnectionStateListenable()).thenReturn(connectionStateListener); when(connection.getCurator()).thenReturn(curatorFramework); when(closingHostDiscoverySource.forService(anyString())).thenReturn(closedHostDiscovery); when(nonClosingHostDiscoverySource.forService(anyString())).thenReturn(unclosedHostDiscovery); ServicePool<Service> servicePool = (ServicePool<Service>) ServicePoolBuilder.create(Service.class) .withServiceFactory(_serviceFactory) .withCachingPolicy(_cachingPolicy) .withHostDiscoverySource(closingHostDiscoverySource) .withHostDiscoverySource(nonClosingHostDiscoverySource) .withPartitionFilter(_partitionFilter) .build(); servicePool.close(); verify(closedHostDiscovery).close(); verify(unclosedHostDiscovery, never()).close(); }

Target:
public void testHostDiscoveryFromSourceCloses() throws Exception { HostDiscoverySource closingHostDiscoverySource = mock(HostDiscoverySource.class); HostDiscovery closedHostDiscovery = mock(HostDiscovery.class); HostDiscoverySource nonClosingHostDiscoverySource = mock(HostDiscoverySource.class); HostDiscovery unclosedHostDiscovery = mock(HostDiscovery.class); when(closingHostDiscoverySource.forService(anyString())).thenReturn(closedHostDiscovery); when(nonClosingHostDiscoverySource.forService(anyString())).thenReturn(unclosedHostDiscovery); ServicePool<Service> servicePool = (ServicePool<Service>) ServicePoolBuilder.create(Service.class) .withServiceFactory(_serviceFactory) .withCachingPolicy(_cachingPolicy) .withHostDiscoverySource(closingHostDiscoverySource) .withHostDiscoverySource(nonClosingHostDiscoverySource) .withPartitionFilter(_partitionFilter) .build(); servicePool.close(); verify(closedHostDiscovery).close(); verify(unclosedHostDiscovery, never()).close(); }
Source:
private static VdsNumaNode getNumaNodeWithLowerCpuIds(VdsNumaNode mostPinnedPnumaNode, VdsNumaNode currNode) { if (mostPinnedPnumaNode != null && !mostPinnedPnumaNode.getCpuIds().isEmpty() && Collections.min(currNode.getCpuIds()) < Collections.min(mostPinnedPnumaNode.getCpuIds())) { return currNode; } else { return mostPinnedPnumaNode; } }

Target:
private static VdsNumaNode getNumaNodeWithLowerCpuIds(VdsNumaNode mostPinnedPnumaNode, VdsNumaNode currNode) { return Objects.compare(currNode.getCpuIds(), mostPinnedPnumaNode.getCpuIds(), Comparator.comparing(Collections::min)) < 0 ? currNode: mostPinnedPnumaNode; }
Source:
private AutoCloseable setPageSetting(WizardProjectsImportPage wpip, String settingName, boolean settingValue) { wpip.saveWidgetValues(); IDialogSettings dialogSettings = wpip.getWizard().getDialogSettings(); boolean originalValue = dialogSettings.getBoolean(settingName); dialogSettings.put(settingName, settingValue); wpip.restoreWidgetValues(); return () -> { dialogSettings.put(settingName, originalValue); wpip.restoreWidgetValues(); }; }

Target:
private AutoCloseable setPageSetting(WizardProjectsImportPage wpip, String settingName, boolean settingValue) { IDialogSettings dialogSettings = wpip.getWizard().getDialogSettings(); wpip.saveWidgetValues(); boolean originalValue = dialogSettings.getBoolean(settingName); dialogSettings.put(settingName, settingValue); wpip.restoreWidgetValues(); return () -> { dialogSettings.put(settingName, originalValue); wpip.restoreWidgetValues(); }; }
Source:
public boolean fetch( BuckEventBus eventBus, URI uri, Optional<PasswordAuthentication> authentication, Path output ) throws IOException { if (!("https".equals(uri.getScheme()) || "http".equals(uri.getScheme()))) { return false; } DownloadEvent.Started started = DownloadEvent.started(uri); eventBus.post(started); try { HttpURLConnection connection = createConnection(uri); if (authentication.isPresent()) { PasswordAuthentication p = authentication.get(); String authStr = p.getUserName() + ":" + new String(p.getPassword()); String authEncoded = BaseEncoding.base64().encode(authStr.getBytes()); connection.addRequestProperty("Authorization", "Basic " + authEncoded); } if (HttpURLConnection.HTTP_OK != connection.getResponseCode()) { LOG.info("Unable to download %s: %s", uri, connection.getResponseMessage()); return false; } long contentLength = connection.getContentLengthLong(); try (InputStream is = new BufferedInputStream(connection.getInputStream()); OutputStream os = new BufferedOutputStream(Files.newOutputStream(output))) { long read = 0; while (true) { int r = is.read(); read++; if (r == -1) { break; } if (read % PROGRESS_REPORT_EVERY_N_BYTES == 0) { eventBus.post(new DownloadProgressEvent(uri, contentLength, read)); } os.write(r); } } return true; } finally { eventBus.post(DownloadEvent.finished(started)); } }

Target:
public boolean fetch( BuckEventBus eventBus, URI uri, Optional<PasswordAuthentication> authentication, Path output ) throws IOException { if (!("https".equals(uri.getScheme()) || "http".equals(uri.getScheme()))) { return false; } DownloadEvent.Started started = DownloadEvent.started(uri); eventBus.post(started); try { HttpURLConnection connection = createConnection(uri); if (authentication.isPresent()) { if ("https".equals(uri.getScheme()) && connection instanceof HttpsURLConnection) { PasswordAuthentication p = authentication.get(); String authStr = p.getUserName() + ":" + new String(p.getPassword()); String authEncoded = BaseEncoding.base64().encode(authStr.getBytes()); connection.addRequestProperty("Authorization", "Basic " + authEncoded); } else { LOG.info("Refusing to send basic authentication over plain http."); return false; } } if (HttpURLConnection.HTTP_OK != connection.getResponseCode()) { LOG.info("Unable to download %s: %s", uri, connection.getResponseMessage()); return false; } long contentLength = connection.getContentLengthLong(); try (InputStream is = new BufferedInputStream(connection.getInputStream()); OutputStream os = new BufferedOutputStream(Files.newOutputStream(output))) { long read = 0; while (true) { int r = is.read(); read++; if (r == -1) { break; } if (read % PROGRESS_REPORT_EVERY_N_BYTES == 0) { eventBus.post(new DownloadProgressEvent(uri, contentLength, read)); } os.write(r); } } return true; } finally { eventBus.post(DownloadEvent.finished(started)); } }
Source:
public void addArtifact(Artifact artifact) { Artifact artifactParent = Optional.of(artifact).map(a -> a.getHierarchyParent()).orElse(artifact); artifacts.remove(artifactParent); artifacts.add(artifactParent); }

Target:
public void addArtifact(Artifact artifact) { artifacts.remove(artifact); artifacts.add(artifact); }
Source:
public void send(Interest<?, ?> interest, Object inventoryEvent) { InventoryEvent<?> message = InventoryEvent.from(interest.getAction(), inventoryEvent); try { ProducerConnectionContext producerConnectionContext = init(); Map<String, String> headers = toHeaders(interest); messageProcessor.send(producerConnectionContext, message, headers); Log.LOG.debugf("Sent message %s with headers %s to %s", message, headers, producerConnectionContext.getDestination()); } catch (JMSException | NamingException e) { LOG.failedToSendMessage(message.toString()); } }

Target:
public void send(Interest<?, ?> interest, Object inventoryEvent) { InventoryEvent<?> message = InventoryEvent.from(interest.getAction(), inventoryEvent); try { init(); Map<String, String> headers = toHeaders(interest); messageProcessor.send(producerConnectionContext, message, headers); Log.LOG.debugf("Sent message %s with headers %s to %s", message, headers, producerConnectionContext.getDestination()); } catch (JMSException e) { LOG.failedToSendMessage(message.toString()); } }
Source:
public ContainerHeartbeatResponse requestHeartbeat() { String queryUrl = String.format(heartbeatEndpoint, coordinatorUrl, executionEnvContainerId); ObjectMapper mapper = new ObjectMapper(); ContainerHeartbeatResponse response; String reply = ""; try { reply = httpGet(new URL(queryUrl)); log.debug("Container Heartbeat got response {}", reply); response = mapper.readValue(reply, ContainerHeartbeatResponse.class); return response; } catch (IOException e) { log.error("Error in container heart beat protocol. Query url: response: {}", queryUrl, reply); response = new ContainerHeartbeatResponse(); response.setAlive(false); return response; } }

Target:
public ContainerHeartbeatResponse requestHeartbeat() { ObjectMapper mapper = new ObjectMapper(); ContainerHeartbeatResponse response; String reply = ""; try { reply = httpGet(new URL(heartbeatEndpoint)); LOG.debug("Container Heartbeat got response {}", reply); response = mapper.readValue(reply, ContainerHeartbeatResponse.class); return response; } catch (IOException e) { LOG.error("Error in container heart beat protocol. Query url: response: {}", heartbeatEndpoint, reply); } response = new ContainerHeartbeatResponse(false); return response; }
Source:
protected void copyVmDevices() { getVmDeviceUtils().copyVmDevices(vmDevicesSourceId, getVmId(), getSrcDeviceIdToTargetDeviceIdMapping(), isSoundDeviceEnabled(), getParameters().isConsoleEnabled(), isVirtioScsiEnabled(), isBalloonEnabled(), getParameters().getGraphicsDevices().keySet(), false, getEffectiveCompatibilityVersion()); if (getVmTemplate().getUsbPolicy() != getVm().getUsbPolicy()) { getVmDeviceUtils().updateUsbSlots(getVmTemplate(), getVm().getStaticData()); } if (getInstanceTypeId() != null) { copyDiskDevicesFromTemplate(); } }

Target:
protected void copyVmDevices() { getVmDeviceUtils().copyVmDevices(vmDevicesSourceId, getVmId(), getSrcDeviceIdToTargetDeviceIdMapping(), isSoundDeviceEnabled(), getParameters().isConsoleEnabled(), isVirtioScsiEnabled(), isBalloonEnabled(), getParameters().getGraphicsDevices().keySet(), false, getEffectiveCompatibilityVersion()); if (getInstanceTypeId() != null) { copyDiskDevicesFromTemplate(); } }
Source:
private StackPane getActivationPane(BibEntry entry) { StackPane activation = new StackPane(); activation.setId("citation-relation-tab"); VBox alignment = new VBox(); alignment.setId("activation-alignment"); alignment.setFillWidth(true); alignment.setAlignment(Pos.BASELINE_CENTER); Label infoLabel = new Label(Localization.lang("The search is currently deactivated")); Button activate = new Button(Localization.lang("Activate")); activate.setOnAction( event -> { JabRefPreferences prefs = JabRefPreferences.getInstance(); prefs.putBoolean(JabRefPreferences.ACTIVATE_CITATIONRELATIONS, true); dialogService.notify(Localization.lang("Please restart JabRef for preferences to take effect.")); bindToEntry(entry); }); activate.setDefaultButton(true); alignment.getChildren().addAll(infoLabel, activate); activation.getChildren().add(alignment); return activation; }

Target:
private StackPane getActivationPane(BibEntry entry) { StackPane activation = new StackPane(); activation.setId("citation-relation-tab"); VBox alignment = new VBox(); alignment.setId("activation-alignment"); alignment.setFillWidth(true); alignment.setAlignment(Pos.BASELINE_CENTER); Label infoLabel = new Label(Localization.lang("The search is currently deactivated.")); Button activate = new Button(Localization.lang("Activate")); activate.setOnAction( event -> { JabRefPreferences prefs = JabRefPreferences.getInstance(); prefs.putBoolean(JabRefPreferences.ACTIVATE_CITATIONRELATIONS, true); dialogService.notify(Localization.lang("Please restart JabRef for preferences to take effect.")); bindToEntry(entry); }); activate.setDefaultButton(true); alignment.getChildren().addAll(infoLabel, activate); activation.getChildren().add(alignment); return activation; }
Source:
@Before public void init() throws SQLException { StringBuilder url = new StringBuilder("jdbc:mysql://"); url.append(envOr("MYSQL_HOST", "127.0.0.1")); url.append(":").append(envOr("MYSQL_TCP_PORT", 3306)); String db = envOr("MYSQL_DB", null); if (db != null) url.append("/").append(db); url.append("?statementInterceptors=").append(TracingStatementInterceptor.class.getName()); url.append("&zipkinServiceName=").append("myservice"); MysqlDataSource dataSource = new MysqlDataSource(); dataSource.setUrl(url.toString()); dataSource.setUser(System.getenv("MYSQL_USER")); assumeTrue("Minimally, the environment variable MYSQL_USER must be set", dataSource.getUser() != null); dataSource.setPassword(envOr("MYSQL_PASS", "")); connection = dataSource.getConnection(); spans.clear(); }

Target:
@Before public void init() throws SQLException { StringBuilder url = new StringBuilder("jdbc:mysql://"); url.append(envOr("MYSQL_HOST", "127.0.0.1")); url.append(":").append(envOr("MYSQL_TCP_PORT", 3306)); String db = envOr("MYSQL_DB", null); if (db != null) url.append("/").append(db); url.append("?statementInterceptors=").append(TracingStatementInterceptor.class.getName()); url.append("&zipkinServiceName=").append("myservice"); url.append("&serverTimezone=").append("UTC"); MysqlDataSource dataSource = new MysqlDataSource(); dataSource.setUrl(url.toString()); dataSource.setUser(System.getenv("MYSQL_USER")); assumeTrue("Minimally, the environment variable MYSQL_USER must be set", dataSource.getUser() != null); dataSource.setPassword(envOr("MYSQL_PASS", "")); connection = dataSource.getConnection(); spans.clear(); }
Source:
private List<String> assignSegment(String segmentName, Map<String, Map<String, String>> currentAssignment, InstancePartitions instancePartitions) { int numReplicaGroups = instancePartitions.getNumReplicaGroups(); if (_isDimTable) { return SegmentAssignmentUtils.getInstancesForDimTable(instancePartitions); } if (numReplicaGroups == 1) { return SegmentAssignmentUtils .assignSegmentWithoutReplicaGroup(currentAssignment, instancePartitions, _replication); } else { int partitionId; if (_partitionColumn == null) { partitionId = 0; } else { OfflineSegmentZKMetadata segmentZKMetadata = ZKMetadataProvider .getOfflineSegmentZKMetadata(_helixManager.getHelixPropertyStore(), _offlineTableName, segmentName); Preconditions .checkState(segmentZKMetadata != null, "Failed to find segment ZK metadata for segment: %s of table: %s", segmentName, _offlineTableName); int segmentPartitionId = getPartitionId(segmentZKMetadata); int numPartitions = instancePartitions.getNumPartitions(); partitionId = segmentPartitionId % numPartitions; } return SegmentAssignmentUtils.assignSegmentWithReplicaGroup(currentAssignment, instancePartitions, partitionId); } }

Target:
private List<String> assignSegment(String segmentName, Map<String, Map<String, String>> currentAssignment, InstancePartitions instancePartitions) { int numReplicaGroups = instancePartitions.getNumReplicaGroups(); if (numReplicaGroups == 1) { return SegmentAssignmentUtils .assignSegmentWithoutReplicaGroup(currentAssignment, instancePartitions, _replication); } else { int partitionId; if (_partitionColumn == null) { partitionId = 0; } else { OfflineSegmentZKMetadata segmentZKMetadata = ZKMetadataProvider .getOfflineSegmentZKMetadata(_helixManager.getHelixPropertyStore(), _offlineTableName, segmentName); Preconditions .checkState(segmentZKMetadata != null, "Failed to find segment ZK metadata for segment: %s of table: %s", segmentName, _offlineTableName); int segmentPartitionId = getPartitionId(segmentZKMetadata); int numPartitions = instancePartitions.getNumPartitions(); partitionId = segmentPartitionId % numPartitions; } return SegmentAssignmentUtils.assignSegmentWithReplicaGroup(currentAssignment, instancePartitions, partitionId); } }
Source:
public void start(Stage primaryStage) throws Exception { stage = primaryStage; stage.setTitle(DNAINATOR); stage.getIcons().add(new Image(getClass().getResourceAsStream(ICON))); setDimensions(); try { BorderPane rootLayout = FXMLLoader.load(getClass().getResource(FXML)); Scene scene = new Scene(rootLayout); stage.setScene(scene); } catch (IOException e) { e.printStackTrace(); } stage.show(); }

Target:
public void start(Stage primaryStage) throws Exception { primaryStage.setTitle(DNAINATOR); primaryStage.getIcons().add(new Image(getClass().getResourceAsStream(ICON))); setDimensions(primaryStage); try { BorderPane rootLayout = FXMLLoader.load(getClass().getResource(FXML)); Scene scene = new Scene(rootLayout); primaryStage.setScene(scene); } catch (IOException e) { e.printStackTrace(); } primaryStage.show(); }
Source:
public void corruptedScoreRulesTest() { setSolverConfigCalculatorClass(TestdataCorruptedDifferentValuesCalculator.class); switch (environmentMode) { case FULL_ASSERT: case NON_INTRUSIVE_FULL_ASSERT: assertIllegalStateExceptionWhileSolving("not the uncorruptedScore"); break; case FAST_ASSERT: assertIllegalStateExceptionWhileSolving("Score corruption analysis could not be generated "); break; case REPRODUCIBLE: case NON_REPRODUCIBLE: case PRODUCTION: break; default: throw new AssertionError("Missing case for " + environmentMode); } }

Target:
public void corruptedScoreRulesTest() { setSolverConfigCalculatorClass(TestdataCorruptedDifferentValuesCalculator.class); switch (environmentMode) { case FULL_ASSERT: case NON_INTRUSIVE_FULL_ASSERT: assertIllegalStateExceptionWhileSolving("not the uncorruptedScore"); break; case FAST_ASSERT: assertIllegalStateExceptionWhileSolving("Score corruption analysis could not be generated "); break; case REPRODUCIBLE: case NON_REPRODUCIBLE: case PRODUCTION: break; default: Assertions.fail("Environment mode not covered: " + environmentMode); } }
Source:
public void saveAnswers(@Scope(OAuthScope.QUESTIONS_READ) final AccessToken accessToken, @QueryParam("account_question_id") final Long accountQuestionId, @Valid final List<Choice> choice) { LOGGER.debug("Saving answer for account id = {}", accessToken.accountId); Optional<Integer> questionIdOptional = choice.get(0).questionId; Integer questionId = 0; if (questionIdOptional.isPresent()) { questionId = questionIdOptional.get(); } this.questionProcessor.saveResponse(accessToken.accountId, questionId, accountQuestionId, choice); }

Target:
public void saveAnswers(@Scope(OAuthScope.QUESTIONS_READ) final AccessToken accessToken, @QueryParam("account_question_id") final Long accountQuestionId, @Valid final List<Choice> choice) { LOGGER.debug("Saving answer for account id = {}", accessToken.accountId); final Optional<Integer> questionIdOptional = choice.get(0).questionId; Integer questionId = 0; if (questionIdOptional.isPresent()) { questionId = questionIdOptional.get(); } this.questionProcessor.saveResponse(accessToken.accountId, questionId, accountQuestionId, choice); }
Source:
private String escapePlatformName(@NonNull String input) { final String toEscape = "platform_name"; return input.contains(toEscape) ? input.replaceAll(toEscape, getString(R.string.platform_name)) : input; }

Target:
private String escapePlatformName(@NonNull String input) { return input.replaceAll("platform_name", getString(R.string.platform_name)); }
Source:
protected SWTBotEditor openRepresentation(Session session, String representationDescriptionName, final String representationName, Class<? extends DRepresentation> expectedRepresentationClass, boolean disableSnapToGridOnThisEditor) { DRepresentation representation = getRepresentationWithName(session, representationDescriptionName, representationName); TestCase.assertTrue("This representation should be a " + expectedRepresentationClass.getSimpleName(), expectedRepresentationClass.isInstance(representation)); IEditorPart editorPart = DialectUIManager.INSTANCE.openEditor(session, representation, new NullProgressMonitor()); SWTBotUtils.waitAllUiEvents(); SWTBotEditor swtBotEditor = null; if (expectedRepresentationClass.equals(DDiagram.class)) { swtBotEditor = SWTBotSiriusHelper.getSiriusDiagramEditor(editorPart.getTitle()); if (disableSnapToGridOnThisEditor) { ((SWTBotSiriusDiagramEditor) swtBotEditor).disableSnapToGrid(); } } else { swtBotEditor = SWTBotSiriusHelper.getSiriusEditor(editorPart.getTitle()); } return swtBotEditor; }

Target:
protected SWTBotEditor openRepresentation(Session session, String representationDescriptionName, final String representationName, Class<? extends DRepresentation> expectedRepresentationClass, boolean disableSnapToGridOnThisEditor) { DRepresentation representation = getRepresentationWithName(session, representationDescriptionName, representationName); TestCase.assertTrue("This representation should be a " + expectedRepresentationClass.getSimpleName(), expectedRepresentationClass.isInstance(representation)); IEditorPart editorPart = DialectUIManager.INSTANCE.openEditor(session, representation, new NullProgressMonitor()); SWTBotUtils.waitAllUiEvents(); SWTBotEditor swtBotEditor = null; if (DDiagram.class.isAssignableFrom(expectedRepresentationClass)) { swtBotEditor = SWTBotSiriusHelper.getSiriusDiagramEditor(editorPart.getTitle()); if (disableSnapToGridOnThisEditor) { ((SWTBotSiriusDiagramEditor) swtBotEditor).disableSnapToGrid(); } } else { swtBotEditor = SWTBotSiriusHelper.getSiriusEditor(editorPart.getTitle()); } return swtBotEditor; }
Source:
public void setEvent(boolean freshEvent) { try { if (freshEvent) { event = fresh.getParent().getParent().getParent().getParent() .getName(); } else { event = stale.getParent().getParent().getParent().getParent() .getName(); } } catch (Exception e) { e.printStackTrace(); event = ""; } }

Target:
public void setEvent(boolean freshEvent) { TreeParent curElem = freshEvent ? fresh : stale; setEvent(curElem); }
Source:
public void rawBytesPostTest() throws InterruptedException { Random random = new Random(); ByteBuffer content = ByteBuffer.wrap(RestTestUtils.getRandomBytes(random.nextInt(128) + 128)); HttpRequest postRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/", Unpooled.wrappedBuffer(content)); HttpHeaders.setHeader(postRequest, RestUtils.Headers.SERVICE_ID, "rawBytesPostTest"); HttpHeaders.setHeader(postRequest, RestUtils.Headers.BLOB_SIZE, content.remaining()); postRequest = ReferenceCountUtil.retain(postRequest); try { ByteBuffer receivedContent = doPostTest(postRequest, null); compareContent(receivedContent, Collections.singletonList(content)); } finally { ReferenceCountUtil.release(postRequest); } final int NUM_CONTENTS = 5; postRequest = RestTestUtils.createRequest(HttpMethod.POST, "/", null); List<ByteBuffer> contents = new ArrayList<ByteBuffer>(NUM_CONTENTS); int blobSize = 0; for (int i = 0; i < NUM_CONTENTS; i++) { ByteBuffer buffer = ByteBuffer.wrap(RestTestUtils.getRandomBytes(random.nextInt(128) + 128)); blobSize += buffer.remaining(); contents.add(i, buffer); } HttpHeaders.setHeader(postRequest, RestUtils.Headers.SERVICE_ID, "rawBytesPostTest"); HttpHeaders.setHeader(postRequest, RestUtils.Headers.BLOB_SIZE, blobSize); ByteBuffer receivedContent = doPostTest(postRequest, contents); compareContent(receivedContent, contents); }

Target:
public void rawBytesPostTest() throws InterruptedException { Random random = new Random(); ByteBuffer content = ByteBuffer.wrap(RestTestUtils.getRandomBytes(random.nextInt(128) + 128)); HttpRequest postRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/", Unpooled.wrappedBuffer(content)); HttpHeaders.setHeader(postRequest, RestUtils.Headers.SERVICE_ID, "rawBytesPostTest"); HttpHeaders.setHeader(postRequest, RestUtils.Headers.BLOB_SIZE, content.remaining()); postRequest = ReferenceCountUtil.retain(postRequest); ByteBuffer receivedContent = doPostTest(postRequest, null); compareContent(receivedContent, Collections.singletonList(content)); final int NUM_CONTENTS = 5; postRequest = RestTestUtils.createRequest(HttpMethod.POST, "/", null); List<ByteBuffer> contents = new ArrayList<ByteBuffer>(NUM_CONTENTS); int blobSize = 0; for (int i = 0; i < NUM_CONTENTS; i++) { ByteBuffer buffer = ByteBuffer.wrap(RestTestUtils.getRandomBytes(random.nextInt(128) + 128)); blobSize += buffer.remaining(); contents.add(i, buffer); } HttpHeaders.setHeader(postRequest, RestUtils.Headers.SERVICE_ID, "rawBytesPostTest"); HttpHeaders.setHeader(postRequest, RestUtils.Headers.BLOB_SIZE, blobSize); receivedContent = doPostTest(postRequest, contents); compareContent(receivedContent, contents); }
Source:
private void setInstancePropertiesForQuery(Object instance, List<Field> fields, Map<String, Object> properties) throws ActionHandlerException { for (Field field : fields) { Object value = properties.get(field.getName()); if (value instanceof List) { if (((List) value).size() > 0) { setInstanceProperty(instance, field, value); } } else if (null != value) { setInstanceProperty(instance, field, value); } } }

Target:
private void setInstancePropertiesForQuery(Object instance, List<Field> fields, Map<String, Object> properties) throws ActionHandlerException { for (Field field : fields) { Object value = properties.get(field.getName()); if (value instanceof List && CollectionUtils.isNotEmpty((List) value)) { setInstanceProperty(instance, field, value); } else if (!(value instanceof List) && null != value) { setInstanceProperty(instance, field, value); } } }
Source:
public FilterSupportStatus isFilterSupported( FilterAdapterContext context, FilterList filter) { List<FilterSupportStatus> unsupportedSubfilters = new ArrayList<>(); collectUnsupportedStatuses(context, filter, unsupportedSubfilters); if (unsupportedSubfilters.size() == 0) { return FilterSupportStatus.SUPPORTED; } else { return FilterSupportStatus.newCompositeNotSupported(unsupportedSubfilters); } }

Target:
public FilterSupportStatus isFilterSupported( FilterAdapterContext context, FilterList filter) { List<FilterSupportStatus> unsupportedSubfilters = new ArrayList<>(); collectUnsupportedStatuses(context, filter, unsupportedSubfilters); if (!unsupportedSubfilters.isEmpty()) { return FilterSupportStatus.SUPPORTED; } else { return FilterSupportStatus.newCompositeNotSupported(unsupportedSubfilters); } }
Source:
public void testGetDocContent_guidDocId() throws Exception { adaptor.init(context); ByteArrayOutputStream baos = new ByteArrayOutputStream(); RecordingResponse response = new RecordingResponse(baos); adaptor.getDocContent( new MockRequest(new DocId("guid/{AAAAAAAA-0000-0000-0000-000000000004}")), response); assertEquals("text/plain", response.getContentType()); assertEquals("Hello from document {AAAAAAAA-0000-0000-0000-000000000004}", baos.toString("UTF-8")); }

Target:
public void testGetDocContent_guidDocId() throws Exception { adaptor.init(context); ByteArrayOutputStream baos = new ByteArrayOutputStream(); RecordingResponse response = new RecordingResponse(baos); adaptor.getDocContent( new MockRequest(newDocId("{AAAAAAAA-0000-0000-0000-000000000004}")), response); assertEquals("text/plain", response.getContentType()); assertEquals("Hello from document {AAAAAAAA-0000-0000-0000-000000000004}", baos.toString("UTF-8")); }
Source:
private Metacard formMapper(Map map) { LOGGER.debug("Starting form processing..."); String title = safeGet(map, "title", String.class); String description = safeGet(map, "description", String.class); String filterTemplateFile = safeGet(map, "filterTemplateFile", String.class); if (anyNull(title, description, filterTemplateFile)) { LOGGER.debug("Invalid entry in forms.json"); return null; } File xmlFile = configDirectory.toPath().resolve(filterTemplateFile).toFile(); if (!xmlFile.exists()) { LOGGER.debug("Filter XML file does not exist: {}", filterTemplateFile); return null; } String filterXml = getFileContent(xmlFile); if (filterXml == null) { LOGGER.debug("Error while reading filter XML file: {}", filterTemplateFile); return null; } QueryTemplateMetacardImpl metacard = new QueryTemplateMetacardImpl(title, description); metacard.setFormsFilter(filterXml); return metacard; }

Target:
private Metacard formMapper(Map map) { String title = safeGet(map, Core.TITLE, String.class); String description = safeGet(map, Core.DESCRIPTION, String.class); String filterTemplateFile = safeGet(map, "filterTemplateFile", String.class); if (anyNull(title, description, filterTemplateFile)) { return null; } File xmlFile = configDirectory.toPath().resolve(filterTemplateFile).toFile(); if (!xmlFile.exists()) { LOGGER.warn("Filter XML file does not exist: {}", filterTemplateFile); return null; } String filterXml = getFileContent(xmlFile); if (filterXml == null) { return null; } QueryTemplateMetacard metacard = new QueryTemplateMetacard(title, description); metacard.setFormsFilter(filterXml); if (TemplateTransformer.invalidFormTemplate(metacard)) { LOGGER.warn("System forms configuration for template '{}' had one or more problems", title); return null; } return metacard; }
Source:
private void processOrphanExclusivePIDs() { for (String orpahnPID : exclusivcePIDMap.getOrpahnPIDs()) { try { Configuration configuration = configAdmin.getConfiguration(orpahnPID, null); configuration.delete(); logger.debug("Deleting configuration for orphan pid {}", orpahnPID); } catch (IOException e) { logger.error("Error deleting configuration for orphan pid {}.", orpahnPID); } } }

Target:
private void processOrphanExclusivePIDs() { for (String orphanPID : exclusivePIDMap.getOrphanPIDs()) { try { Configuration configuration = configAdmin.getConfiguration(orphanPID, null); configuration.delete(); logger.debug("Deleting configuration for orphan pid {}", orphanPID); } catch (IOException e) { logger.error("Error deleting configuration for orphan pid {}.", orphanPID); } } }
Source:
public static Condition<ExecutionEvent> event(Condition<? super ExecutionEvent>... conditions) { return Assertions.allOf(conditions); }

Target:
public static Condition<ExecutionEvent> event(Condition<? super ExecutionEvent>... conditions) { return Assertions.<ExecutionEvent> allOf(conditions); }