auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public AggregateFunction getAggregateFunction() { if (_function instanceof AggregateFunction) return (AggregateFunction) _function; <START> else <END> return null; }</code><technical_language>missing some brackets comply normal code style</technical_language>

Target:
public AggregateFunction getAggregateFunction() { if (_function instanceof AggregateFunction) { return (AggregateFunction) _function; } else { return null; } }
Source:
<code>private void removeEverythingPastCancelEvent(final List<SubscriptionBaseEvent> inputEvents) { final SubscriptionBaseEvent cancellationEvent = Iterables.tryFind(inputEvents, new Predicate<SubscriptionBaseEvent>() { @Override public boolean apply(final SubscriptionBaseEvent input) { return input.getType() == EventType.API_USER && ((ApiEvent) input).getApiEventType() == ApiEventType.CANCEL; } }).orNull(); if (cancellationEvent == null) { return; } final Iterator<SubscriptionBaseEvent> it = inputEvents.iterator(); while (it.hasNext()) { final SubscriptionBaseEvent input = it.next(); if (!input.isActive()) { continue; } if (input.getId().compareTo(cancellationEvent.getId()) == 0) { } else if (input.getType() == EventType.API_USER && (((ApiEvent) input).getApiEventType() == ApiEventType.TRANSFER || ((ApiEvent) input).getApiEventType() == ApiEventType.CREATE)) { } else if (input.getType() == EventType.API_USER && (((ApiEvent) input).getApiEventType() == ApiEventType.CANCEL) && !((ApiEvent) input).isFromDisk()) { it.remove(); } else if (input.getEffectiveDate().compareTo(cancellationEvent.getEffectiveDate()) >= 0) { <START> it.remove(); <END> } } }</code><technical_language>step thinking i have: Assumptions: events ordered Comparator -- fixed. 1. event CREATE TRANSFER => Delete strictly this. 2. hit CANCEL, delete equals this date. Note of ordering, this account case a !isFromDisk CANCEL event in stream deleted this logic. remove events stream --maybe worth logging a WARN this represent data issues i think</technical_language>

Target:
private void removeEverythingPastCancelEvent(final List<SubscriptionBaseEvent> inputEvents) { final SubscriptionBaseEvent cancellationEvent = Iterables.tryFind(inputEvents, new Predicate<SubscriptionBaseEvent>() { @Override public boolean apply(final SubscriptionBaseEvent input) { return input.getType() == EventType.API_USER && ((ApiEvent) input).getApiEventType() == ApiEventType.CANCEL; } }).orNull(); if (cancellationEvent == null) { return; } final Iterator<SubscriptionBaseEvent> it = inputEvents.iterator(); while (it.hasNext()) { final SubscriptionBaseEvent input = it.next(); if (!input.isActive()) { continue; } if (input.getId().compareTo(cancellationEvent.getId()) == 0) { } else if (input.getType() == EventType.API_USER && (((ApiEvent) input).getApiEventType() == ApiEventType.TRANSFER || ((ApiEvent) input).getApiEventType() == ApiEventType.CREATE)) { } else if (input.getEffectiveDate().compareTo(cancellationEvent.getEffectiveDate()) >= 0) { it.remove(); } } }
Source:
<code>private ActionCol52 getLinkedActionColumn(final String factType, final String fieldName, final GuidedDecisionTable52 model, final BRLRuleModel helper) { if (factType == null || fieldName == null) { return null; } for (ActionCol52 ac : model.getActionCols()) { if (ac instanceof ActionInsertFactCol52) { final ActionInsertFactCol52 aif = (ActionInsertFactCol52) ac; if (factType.equals(aif.getFactType()) && fieldName.equals(aif.getFactField())) { return ac; } } else if (ac instanceof ActionSetFieldCol52) { final ActionSetFieldCol52 asf = (ActionSetFieldCol52) ac; final String binding = asf.getBoundName(); final String asfFactType = helper.getLHSBindingType(binding); if (factType.equals(asfFactType) && fieldName.equals(asf.getFactField())) { return ac; } } else if (ac instanceof BRLActionColumn) { final BRLActionColumn fragment = (BRLActionColumn) ac; if (hasTemplateKeys(fragment)) { <START> for (BRLActionVariableColumn var : fragment.getChildColumns()) { <END> if (factType.equals(var.getFactType()) && fieldName.equals(var.getFactField())) { return var; } } } else { final Map<String, List<String>> rhsTypeFields = rhsTypeFieldsExtractor.extract(model, fragment.getDefinition()); if (rhsTypeFields.containsKey(factType)) { for (String field : rhsTypeFields.get(factType)) { if (field.equals(fieldName)) { return fragment.getChildColumns().get(0); } } } } } } return null; }</code><technical_language>I this branch is covered tests</technical_language>

Target:
private ActionCol52 getLinkedActionColumn(final String factType, final String fieldName, final GuidedDecisionTable52 model, final BRLRuleModel helper) { if (factType == null || fieldName == null) { return null; } for (ActionCol52 ac : model.getActionCols()) { if (ac instanceof ActionInsertFactCol52) { final ActionInsertFactCol52 aif = (ActionInsertFactCol52) ac; if (factType.equals(aif.getFactType()) && fieldName.equals(aif.getFactField())) { return ac; } } else if (ac instanceof ActionSetFieldCol52) { final ActionSetFieldCol52 asf = (ActionSetFieldCol52) ac; final String binding = asf.getBoundName(); final String asfFactType = helper.getLHSBindingType(binding); if (factType.equals(asfFactType) && fieldName.equals(asf.getFactField())) { return ac; } } else if (ac instanceof BRLActionColumn) { final BRLActionColumn fragment = (BRLActionColumn) ac; if (hasTemplateKeys(fragment)) { return getLinkedTemplateKeyColumn(fragment, factType, fieldName); } else { return getLinkedDefinitionColumn(model, fragment, factType, fieldName); } } } return null; }
Source:
<code>public DownloadDetailsDTO registerDownload(DownloadRequestParams requestParams, String ip, DownloadDetailsDTO.DownloadType type) { afterInitialisation(); DownloadDetailsDTO dd = new DownloadDetailsDTO(requestParams, ip, type); <START> persistentQueueDAO.addDownloadToQueue(dd); <END> currentDownloads.add(dd); return dd; }</code><technical_language>Is addDownloadToQueue required here? addDownloadToQueue adds requests offlineDownloadList. This duplicates online requests offline making run twice</technical_language>

Target:
public DownloadDetailsDTO registerDownload(DownloadRequestParams requestParams, String ip, DownloadDetailsDTO.DownloadType type) { afterInitialisation(); DownloadDetailsDTO dd = new DownloadDetailsDTO(requestParams, ip, type); currentDownloads.add(dd); return dd; }
Source:
<code>public void deleteSilentAfterExtract() { if (!saveDownloadedFiles) { try { <START> if (!Files.deleteIfExists(downloadZipFile)) { <END> logger.error("Could not delete downloaded ZIP file '{}'!", downloadZipFile); } } catch (IOException e) { logger.error("Could not delete downloaded ZIP file '{}'!", downloadZipFile, e); } } }</code><technical_language>I side effect if-condition (nothing wrong technically here). please revert this form a temporary variable before. In addition, code indeleteSilentAfterExtract deleteSilentAfterCancel is identical. introduce a new private method private void deleteSilent(Path file)</technical_language>

Target:
public void deleteSilentAfterExtract() { if (!saveDownloadedFiles) { FileUtils.deleteFileSilently(downloadZipFile); } }
Source:
<code>public void returnsProperResponseCodeOnNoContentLength() throws Exception { final Socket socket = Mockito.mock(Socket.class); Mockito.when(socket.getInputStream()).thenReturn( new ByteArrayInputStream(Joiner.on("\r\n").join( "POST / HTTP/1.1", "Host: localhost", "", "hi" <START> ).getBytes() <END> ) ); Mockito.when(socket.getLocalAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getLocalPort()).thenReturn(0); Mockito.when(socket.getInetAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getPort()).thenReturn(0); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); Mockito.when(socket.getOutputStream()).thenReturn(baos); new BkReuse(new BkBasic(new TkText("411 Test"))).accept(socket); MatcherAssert.assertThat( baos.toString(), Matchers.containsString("HTTP/1.1 411 Length Required") ); }</code><technical_language>@prondzyn too, a charset here, getBytes("UTF-8")</technical_language>

Target:
public void returnsProperResponseCodeOnNoContentLength() throws Exception { final Socket socket = Mockito.mock(Socket.class); Mockito.when(socket.getInputStream()).thenReturn( new ByteArrayInputStream( Joiner.on("\r\n").join( "POST / HTTP/1.1", "Host: localhost", "", "hi" ).getBytes("UTF-8") ) ); Mockito.when(socket.getLocalAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getLocalPort()).thenReturn(0); Mockito.when(socket.getInetAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getPort()).thenReturn(0); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); Mockito.when(socket.getOutputStream()).thenReturn(baos); new BkReuse(new BkBasic(new TkText("411 Test"))).accept(socket); MatcherAssert.assertThat( baos.toString(), Matchers.containsString("HTTP/1.1 411 Length Required") ); }
Source:
<code>private synchronized void initRelationship() { if (relationship != null) { return; } <START> String identifiedRelationship = null; <END> if (containingClassInfo.relationshipFields().contains(this)) { if (annotations != null && annotations.has(Relationship.class)) { identifiedRelationship = annotations.get(Relationship.class).get(Relationship.TYPE, RelationshipUtils.inferRelationshipType(getName())); } else { identifiedRelationship = RelationshipUtils.inferRelationshipType(getName()); } } relationship = Optional.ofNullable(identifiedRelationship); }</code><technical_language>Please rename this identifiedRelationshipType</technical_language>

Target:
private Optional<String> initRelationship() { if (this.containingClassInfo.relationshipFields().contains(this)) { if (annotations != null) { AnnotationInfo relationshipAnnotation = annotations.get(Relationship.class); if (relationshipAnnotation != null) { return Optional.of(relationshipAnnotation .get(Relationship.TYPE, RelationshipUtils.inferRelationshipType(getName()))); } } return Optional.of(RelationshipUtils.inferRelationshipType(getName())); } return Optional.empty(); }
Source:
<code>private List<Entity> generateEntities(String extensionName, HttpServletRequest request) throws FalconException, IOException { Properties properties = new Properties(); properties.load(request.getInputStream()); <START> LOG.info("properties: " + properties.toString()); <END> List<Entity> entities = extension.getEntities(extensionName, properties); LOG.info("generated " + entities.size() + " entities"); for (Entity entity : entities) { String tags = entity.getTags(); if (StringUtils.isEmpty(tags)) { setEntityTags(entity, TAG_PREFIX_EXTENSION_NAME + extensionName + "," + TAG_PREFIX_EXTENSION_JOB + properties.getProperty(ExtensionProperties.JOB_NAME.getName())); } else { if (tags.indexOf(TAG_PREFIX_EXTENSION_NAME) != -1) { throw new FalconException("Generated extention entity " + entity.getName() + " should not contain tag prefix " + TAG_PREFIX_EXTENSION_NAME); } if (tags.indexOf(TAG_PREFIX_EXTENSION_JOB) != -1) { throw new FalconException("Generated extention entity " + entity.getName() + " should not contain tag prefix " + TAG_PREFIX_EXTENSION_JOB); } setEntityTags(entity, tags + "," + TAG_PREFIX_EXTENSION_NAME + extensionName + "," + TAG_PREFIX_EXTENSION_JOB + properties.getProperty(ExtensionProperties.JOB_NAME.getName())); } } return entities; }</code><technical_language>I info level logs. important debug reduce amount of logging</technical_language>

Target:
private List<Entity> generateEntities(String extensionName, HttpServletRequest request) throws FalconException, IOException { Properties properties = new Properties(); properties.load(request.getInputStream()); List<Entity> entities = extension.getEntities(extensionName, properties); for (Entity entity : entities) { String tags = entity.getTags(); if (StringUtils.isEmpty(tags)) { setEntityTags(entity, TAG_PREFIX_EXTENSION_NAME + extensionName + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_JOB + properties.getProperty(ExtensionProperties.JOB_NAME.getName())); } else { if (tags.indexOf(TAG_PREFIX_EXTENSION_NAME) != -1) { throw new FalconException("Generated extention entity " + entity.getName() + " should not contain tag prefix " + TAG_PREFIX_EXTENSION_NAME); } if (tags.indexOf(TAG_PREFIX_EXTENSION_JOB) != -1) { throw new FalconException("Generated extention entity " + entity.getName() + " should not contain tag prefix " + TAG_PREFIX_EXTENSION_JOB); } setEntityTags(entity, tags + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_NAME + extensionName + TAG_SEPARATOR + TAG_PREFIX_EXTENSION_JOB + properties.getProperty(ExtensionProperties.JOB_NAME.getName())); } } return entities; }
Source:
<code>private IResourceVariant fetchVariant(IResource resource, IProgressMonitor monitor) throws TeamException { GitSynchronizeData gsd = gsds.getData(resource.getProject()); if (gsd == null) return null; Repository repo = gsd.getRepository(); String path = getPath(resource, repo); RevCommit revCommit = getRevCommit(gsd); if (revCommit == null) return null; if (path.length() == 0) return handleRepositoryRoot(resource, repo, revCommit); try { if (monitor.isCanceled()) { throw new OperationCanceledException(); <START> } <END> TreeWalk tw = initializeTreeWalk(repo, path); int nth = tw.addTree(revCommit.getTree()); if (resource.getType() == IResource.FILE) { tw.setRecursive(true); if (tw.next() && !tw.getObjectId(nth).equals(zeroId())) return new GitBlobResourceVariant(repo, tw.getObjectId(nth), path); } else { while (tw.next() && !path.equals(tw.getPathString())) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } if (tw.isSubtree()) tw.enterSubtree(); } ObjectId objectId = tw.getObjectId(nth); if (!objectId.equals(zeroId())) return new GitFolderResourceVariant(repo, objectId, path); } } catch (IOException e) { throw new TeamException( NLS.bind( CoreText.GitResourceVariantTree_couldNotFindResourceVariant, resource), e); } return null; }</code><technical_language>prefer single statement if's brackets</technical_language>

Target:
private IResourceVariant fetchVariant(IResource resource, IProgressMonitor monitor) throws TeamException { if (resource == null) return null; GitSynchronizeData gsd = gsds.getData(resource.getProject()); if (gsd == null) return null; Repository repo = gsd.getRepository(); String path = getPath(resource, repo); RevCommit revCommit = getRevCommit(gsd); if (revCommit == null) return null; if (path.length() == 0) return handleRepositoryRoot(resource, repo, revCommit); try { if (monitor.isCanceled()) throw new OperationCanceledException(); TreeWalk tw = initializeTreeWalk(repo, path); int nth = tw.addTree(revCommit.getTree()); if (resource.getType() == IResource.FILE) { tw.setRecursive(true); if (tw.next() && !tw.getObjectId(nth).equals(zeroId())) return new GitBlobResourceVariant(repo, tw.getObjectId(nth), path); } else { while (tw.next() && !path.equals(tw.getPathString())) { if (monitor.isCanceled()) throw new OperationCanceledException(); if (tw.isSubtree()) tw.enterSubtree(); } ObjectId objectId = tw.getObjectId(nth); if (!objectId.equals(zeroId())) return new GitFolderResourceVariant(repo, objectId, path); } } catch (IOException e) { throw new TeamException( NLS.bind( CoreText.GitResourceVariantTree_couldNotFindResourceVariant, resource), e); } return null; }
Source:
<code>public int registerCallback(CordovaPlugin receiver, int requestCode) { <START> int mappedId = this.currentCallbackId++; <END> callbacks.put(mappedId, new Pair<CordovaPlugin, Integer>(receiver, requestCode)); return mappedId; }</code><technical_language>this called concurrently? If so, consider java.util.concurrent.atomic.AtomicInteger</technical_language>

Target:
public synchronized int registerCallback(CordovaPlugin receiver, int requestCode) { int mappedId = this.currentCallbackId++; callbacks.put(mappedId, new Pair<CordovaPlugin, Integer>(receiver, requestCode)); return mappedId; }
Source:
<code>public void onNewRShinyApp() { dependencyManager_.withShiny("Creating Shiny applications", new Command() { @Override public void execute() { <START> server_.getWorkingDirectory(new ServerRequestCallback<String>() <END> { @Override public void onResponseReceived(String workingDir) { NewShinyWebApplication widget = new NewShinyWebApplication( "New Shiny Web Application", workingDir, new OperationWithInput<NewShinyWebApplication.Result>() { @Override public void execute(Result input) { doNewRShinyApp(input); } }); widget.showModal(); } @Override public void onError(ServerError error) { Debug.logError(error); } }); } }); }</code><technical_language>discussed WorkbenchContext for this</technical_language>

Target:
public void onNewRShinyApp() { dependencyManager_.withShiny("Creating Shiny applications", new Command() { @Override public void execute() { NewShinyWebApplication widget = new NewShinyWebApplication( "New Shiny Web Application", new OperationWithInput<NewShinyWebApplication.Result>() { @Override public void execute(Result input) { doNewRShinyApp(input); } }); widget.showModal(); } }); }
Source:
<code>public void stateTransition(Status from, Status to) { switch (to) { case AVAILABLE: managementRegistry.register(this); messageConsumer.accept(new DefaultMessage( timeSource.getTimeSource().getTimeMillis(), new ContextualNotification( configuration.getContext(), EhcacheNotification.CACHE_MANAGER_AVAILABLE.name()))); break; case MAINTENANCE: messageConsumer.accept(new DefaultMessage( <START> timeSource.getTimeSource().getTimeMillis(), <END> new ContextualNotification( configuration.getContext(), EhcacheNotification.CACHE_MANAGER_MAINTENANCE.name()))); break; case UNINITIALIZED: messageConsumer.accept(new DefaultMessage( timeSource.getTimeSource().getTimeMillis(), new ContextualNotification( configuration.getContext(), EhcacheNotification.CACHE_MANAGER_CLOSED.name()))); cacheManagerProviderService.getCacheManager().deregisterListener(this); break; } }</code><technical_language>services get stuff? store TimeSource CacheManager directly, no</technical_language>

Target:
public void stateTransition(Status from, Status to) { switch (to) { case AVAILABLE: managementRegistry.register(this); messageConsumer.accept(new DefaultMessage( timeSource.getTimeMillis(), new ContextualNotification( configuration.getContext(), EhcacheNotification.CACHE_MANAGER_AVAILABLE.name()))); break; case MAINTENANCE: messageConsumer.accept(new DefaultMessage( timeSource.getTimeMillis(), new ContextualNotification( configuration.getContext(), EhcacheNotification.CACHE_MANAGER_MAINTENANCE.name()))); break; case UNINITIALIZED: messageConsumer.accept(new DefaultMessage( timeSource.getTimeMillis(), new ContextualNotification( configuration.getContext(), EhcacheNotification.CACHE_MANAGER_CLOSED.name()))); cacheManager.deregisterListener(this); break; default: throw new AssertionError(to); } }
Source:
<code>private void addWorkPackageCriteria() { if (isWorkPackageSpecified()) { ArtifactId workPackArt = atsApi.getQueryService().getArtifactOrSentinel(workPackageId); if (isColorTeamMatch(workPackArt)) { <START> if (workPackArt.isValid()) <END> { queryAnd(AtsAttributeTypes.WorkPackageReference, workPackArt.getIdString()); } } } }</code><technical_language>this "isColorTeamMatch"? For example, line #755</technical_language>

Target:
private void addWorkPackageCriteria() { if (isWorkPackageSpecified()) { ArtifactId workPackArt = atsApi.getQueryService().getArtifactOrSentinel(workPackageId); if (workPackArt.isValid()) { if (isColorTeamMatch(workPackArt)) { queryAnd(AtsAttributeTypes.WorkPackageReference, workPackArt.getIdString()); } } } }
Source:
<code><START> public boolean isDeprecated() { <END> UpdateSite.Plugin info = getInfo(); return info != null && Arrays.asList(info.categories).contains("deprecated"); }</code><technical_language>Needs @since TODO</technical_language>

Target:
public boolean isDeprecated() { return !getDeprecations().isEmpty(); }
Source:
<code>Mono<DecryptResult> decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, Context context) { Objects.requireNonNull(algorithm, "Encryption algorithm cannot be null."); Objects.requireNonNull(cipherText, "Cipher text content to be decrypted cannot be null."); boolean keyAvailableLocally = ensureValidKeyAvailable(); if (!keyAvailableLocally) { return cryptographyServiceClient.decrypt(algorithm, cipherText, context); } if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.DECRYPT)) { return Mono.error(new UnsupportedOperationException(String.format("Decrypt Operation is not allowed for " <START> + "key with id %s", key.getKeyId()))); <END> } return localKeyCryptographyClient.decryptAsync(algorithm, cipherText, context, key); }</code><technical_language>UnsupportedOperationException wrapped logger.logAsError()</technical_language>

Target:
Mono<DecryptResult> decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, Context context) { Objects.requireNonNull(algorithm, "Encryption algorithm cannot be null."); Objects.requireNonNull(cipherText, "Cipher text content to be decrypted cannot be null."); boolean keyAvailableLocally = ensureValidKeyAvailable(); if (!keyAvailableLocally) { return cryptographyServiceClient.decrypt(algorithm, cipherText, context); } if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.DECRYPT)) { return Mono.error(logger.logExceptionAsError(new UnsupportedOperationException(String.format("Decrypt Operation is not allowed for " + "key with id %s", key.getId())))); } return localKeyCryptographyClient.decryptAsync(algorithm, cipherText, context, key); }
Source:
<code>public BulkReceiveLibraryBackend(LibraryDto dto, Integer quantity, Project project, SampleClass aliquotClass, String defaultSciName) throws IOException { super("libraryReceipt", LibraryDto.class, "Libraries", dto, quantity); <START> if (isDetailedSampleEnabled() && aliquotClass == null) throw new NotFoundException("Aliquot class cannot be null"); <END> this.project = project; this.aliquotClass = aliquotClass; this.defaultSciName = defaultSciName; }</code><technical_language>Invalid parameter</technical_language>

Target:
public BulkReceiveLibraryBackend(LibraryDto dto, Integer quantity, Project project, SampleClass aliquotClass, String defaultSciName) throws IOException { super("libraryReceipt", LibraryDto.class, "Libraries", dto, quantity); if (isDetailedSampleEnabled() && aliquotClass == null) throw new InvalidParameterException("Aliquot class cannot be null"); this.project = project; this.aliquotClass = aliquotClass; this.defaultSciName = defaultSciName; }
Source:
<code>protected void setActiveHandler(WorkbenchDocksHandler handler) { <START> if (activeHandler != null && activeHandler.equals(handler) && !activeHandler.shouldRefreshDocks()) { <END> return; } activeHandler = handler; if (activeHandler.shouldDisableDocks()) { uberfireDocks.hide(UberfireDockPosition.EAST, authoringPerspectiveIdentifier); } else { if (activeDocks != null) { uberfireDocks.remove(activeDocks); } Collection<UberfireDock> docks = activeHandler.provideDocks(authoringPerspectiveIdentifier); activeDocks = docks.toArray(new UberfireDock[docks.size()]); uberfireDocks.add(activeDocks); uberfireDocks.show(UberfireDockPosition.EAST, authoringPerspectiveIdentifier); } }</code><technical_language>simplified Objects.equals(activeHandler, handler)</technical_language>

Target:
protected void setActiveHandler(WorkbenchDocksHandler handler) { if (Objects.equals(activeHandler, handler) && !activeHandler.shouldRefreshDocks()) { return; } activeHandler = handler; if (activeHandler.shouldDisableDocks()) { uberfireDocks.hide(UberfireDockPosition.EAST, authoringPerspectiveIdentifier); } else { if (activeDocks != null) { uberfireDocks.remove(activeDocks); } Collection<UberfireDock> docks = activeHandler.provideDocks(authoringPerspectiveIdentifier); activeDocks = docks.toArray(new UberfireDock[docks.size()]); uberfireDocks.add(activeDocks); uberfireDocks.show(UberfireDockPosition.EAST, authoringPerspectiveIdentifier); } }
Source:
<code>public void handle(Event event, Map postedEvent) { if (!shouldSendEvent(event)) { log.info( "Webhook ping received from github {}", kv( "hook_id", event.content.get("hook_id"), kv( "repository", ((Map<String, Object>) event.content.get("repository")).get("full_name")) .toString())); return; } GithubWebhookEvent githubWebhookEvent = objectMapper.convertValue(postedEvent, GithubWebhookEvent.class); event.content.put("hash", githubWebhookEvent.after); if (githubWebhookEvent.ref == null && githubWebhookEvent.pull_request.head.ref == null) { event.content.put("branch", ""); } else if (githubWebhookEvent.ref == null) { event.content.put("branch", githubWebhookEvent.pull_request.head.ref); } else { event.content.put("branch", githubWebhookEvent.ref.replace("refs/heads/", "")); } <START> event.content.put("repoProject", githubWebhookEvent.repository.owner.login); <END> event.content.put("slug", githubWebhookEvent.repository.name); }</code><technical_language>this change affect line</technical_language>

Target:
public void handle(Event event, Map postedEvent) { if (!shouldSendEvent(event)) { log.info( "Webhook ping received from github {}", kv( "hook_id", event.content.get("hook_id"), kv( "repository", ((Map<String, Object>) event.content.get("repository")).get("full_name")) .toString())); return; } GithubWebhookEvent webhookEvent = null; String githubEvent = ""; if (event.content.containsKey("pull_request")) { webhookEvent = objectMapper.convertValue(event.content, GithubPullRequestEvent.class); githubEvent = "pull_request"; } else { webhookEvent = objectMapper.convertValue(event.content, GithubPushEvent.class); githubEvent = "push"; } String fullRepoName = webhookEvent.getFullRepoName(event, postedEvent); Map<String, String> results = new HashMap<>(); results.put("repoProject", webhookEvent.getRepoProject(event, postedEvent)); results.put("slug", webhookEvent.getSlug(event, postedEvent)); results.put("hash", webhookEvent.getHash(event, postedEvent)); results.put("branch", webhookEvent.getBranch(event, postedEvent)); event.content.putAll(results); log.info( "Github Webhook event received: {}", kv("githubEvent", githubEvent), kv("repository", fullRepoName), kv("project", results.get("repoProject")), kv("slug", results.get("slug")), kv("branch", results.get("branch")), kv("hash", results.get("hash"))); }
Source:
<code>private boolean isVmMigrationValid(Cluster cluster, VM candidateVm) { List<Guid> vdsBlackList = candidateVm.getRunOnVds() == null ? Collections.emptyList() : Arrays.asList(candidateVm.getRunOnVds()); boolean canMove = schedulingManager.canSchedule(cluster, candidateVm, vdsBlackList, Collections.emptyList(), new ArrayList<>()); if (canMove) { log.debug("VM is a viable candidate for <START> solving affinity group <END> violation situation.", candidateVm.getId()); return true; } log.debug("VM is NOT a viable candidate for solving affinity group violation situation.", candidateVm.getId()); return false; }</code><technical_language>Missing "the"</technical_language>

Target:
private boolean isVmMigrationValid(Cluster cluster, VM candidateVm) { List<Guid> vdsBlackList = candidateVm.getRunOnVds() == null ? Collections.emptyList() : Arrays.asList(candidateVm.getRunOnVds()); boolean canMove = schedulingManager.canSchedule(cluster, candidateVm, vdsBlackList, Collections.emptyList(), new ArrayList<>()); if (canMove) { log.debug("VM is a viable candidate for solving the affinity group violation situation.", candidateVm.getId()); return true; } log.debug("VM is NOT a viable candidate for solving the affinity group violation situation.", candidateVm.getId()); return false; }
Source:
<code><START> public void verifyImage() throws ProtocolAdapterException, ImageTransferException { <END> final MethodResultCode verified = this.imageTransferCosem.callMethod(Method.IMAGE_VERIFY.getValue(), DataObject.newInteger8Data((byte) 0)); if (verified == null) { throw new ProtocolAdapterException(EXCEPTION_MSG_IMAGE_VERIFY_NOT_CALLED); } if (verified == MethodResultCode.OTHER_REASON) { if (this.imageIsVerified()) { return; } final int status = this.getImageTransferStatus(); throw new ImageTransferException(EXCEPTION_MSG_IMAGE_NOT_VERIFIED + status); } if (verified == MethodResultCode.TEMPORARY_FAILURE) { final Future<Integer> newStatus = EXECUTOR_SERVICE.submit(new ImageTransferStatusChangeWatcher( ImageTransferStatus.VERIFICATION_INITIATED, properties.getVerificationStatusCheckInterval(), properties.verificationStatusCheckTimeout)); int status; try { status = newStatus.get(); } catch (InterruptedException | ExecutionException e) { throw new ProtocolAdapterException("", e); } if (status == ImageTransferStatus.VERIFICATION_FAILED.getValue()) { throw new ImageTransferException(EXCEPTION_MSG_IMAGE_NOT_VERIFIED); } return; } }</code><technical_language>I live this Jenkins issue exceptions. If clean enough throw ProtocolAdapterException ImageTransferException extend ProtocolAdapterException consider refactoring this</technical_language>

Target:
public void verifyImage() throws ProtocolAdapterException, ImageTransferException { this.connector.getDlmsMessageListener().setDescription( "ImageTransfer call image_verify " + ", call method: " + JdlmsObjectToStringUtil.describeMethod(this.imageTransferCosem.createMethodParameter( Method.IMAGE_VERIFY, DataObject.newInteger8Data((byte) 0)))); final MethodResultCode verified = this.imageTransferCosem.callMethod(Method.IMAGE_VERIFY, DataObject.newInteger8Data((byte) 0)); if (verified == null) { throw new ProtocolAdapterException(EXCEPTION_MSG_IMAGE_VERIFY_NOT_CALLED); } if (verified == MethodResultCode.SUCCESS) { return; } if (verified == MethodResultCode.TEMPORARY_FAILURE) { this.waitForImageVerification(); } if (this.imageIsVerified()) { return; } final int status = this.getImageTransferStatus(); throw new ImageTransferException(EXCEPTION_MSG_IMAGE_NOT_VERIFIED + status); }
Source:
<code>public <T> Mono<T> traceEnabledPublisher(Mono<T> resultPublisher, Context context, String spanName, String databaseId, String endpoint, Function<T, Integer> statusCodeFunc) { final AtomicReference<Context> parentContext = new AtomicReference<>(Context.NONE); Optional<Object> callDepth = context.getData(COSMOS_CALL_DEPTH); final boolean isNestedCall = callDepth.isPresent(); return resultPublisher .doOnSubscribe(ignoredValue -> { if (!isNestedCall) { parentContext.set(this.startSpan(spanName, databaseId, endpoint, context)); } }).doOnSuccess(response -> { if (!isNestedCall) { this.endSpan(parentContext.get(), Signal.complete(), statusCodeFunc.apply(response)); } }).doOnError(throwable -> { if (!isNestedCall) { <START> this.endSpan(parentContext.get(), Signal.error(throwable), 0); <END> } }); }</code><technical_language>sending 0? 0 special meaning? if 0 a constant</technical_language>

Target:
public <T> Mono<T> traceEnabledPublisher(Mono<T> resultPublisher, Context context, String spanName, String databaseId, String endpoint, Function<T, Integer> statusCodeFunc) { final AtomicReference<Context> parentContext = new AtomicReference<>(Context.NONE); Optional<Object> callDepth = context.getData(COSMOS_CALL_DEPTH); final boolean isNestedCall = callDepth.isPresent(); return resultPublisher .doOnSubscribe(ignoredValue -> { if (!isNestedCall) { parentContext.set(this.startSpan(spanName, databaseId, endpoint, context)); } }).doOnSuccess(response -> { if (!isNestedCall) { this.endSpan(parentContext.get(), Signal.complete(), statusCodeFunc.apply(response)); } }).doOnError(throwable -> { if (!isNestedCall) { this.endSpan(parentContext.get(), Signal.error(throwable), ERROR_CODE); } }); }
Source:
<code>private static void constructGroupsMembershipTree(ExtMap entity, ExtKey key, Map<String, ExtMap> groupsCache) { List<ExtMap> groups = new ArrayList<>(); for (ExtMap memberOf : entity.get(key, Collections.<ExtMap> emptyList())) { groups.add(groupsCache.get(memberOf.get(GroupRecord.ID))); } entity.put(key, groups); for (ExtMap group: groups) { constructGroupsMembershipTree(group, GroupRecord.GROUPS, groupsCache); <START> } <END> }</code><technical_language>do this in top loop? iterate groups, no</technical_language>

Target:
private static void constructGroupsMembershipTree(ExtMap entity, ExtKey key, Map<String, ExtMap> groupsCache) { List<ExtMap> groups = new ArrayList<>(); for (ExtMap memberOf : entity.get(key, Collections.<ExtMap> emptyList())) { constructGroupsMembershipTree(memberOf, GroupRecord.GROUPS, groupsCache); groups.add(groupsCache.get(memberOf.get(GroupRecord.ID))); } }
Source:
<code>public void testPreferIpV4StackDifferentValues() throws Exception { System.setProperty(PREFER_IPV4, "true"); IgniteEx g = startGrid(0); assertEquals("true", g.cluster().localNode().attribute(PREFER_IPV4)); checkIsClientFlag(g); <START> g = startClientGrid(1); <END> assertEquals("true", g.cluster().localNode().attribute(PREFER_IPV4)); checkIsClientFlag(g); System.setProperty(PREFER_IPV4, "false"); g = startGrid(2); checkIsClientFlag(g); }</code><technical_language>Check other tests in this class. Replace startGrid(1); startClientGrid(1);</technical_language>

Target:
public void testPreferIpV4StackDifferentValues() throws Exception { System.setProperty(PREFER_IPV4, "true"); for (int i = 0; i < 2; i++) { Ignite g = i == 1 ? startClientGrid(i) : startGrid(i); assert "true".equals(g.cluster().localNode().attribute(PREFER_IPV4)); checkIsClientFlag((IgniteEx) g); } System.setProperty(PREFER_IPV4, "false"); IgniteEx g = startGrid(2); checkIsClientFlag(g); }
Source:
<code>public ASTNode visit(Cell cell, Void _) throws ParseFailedException { String sort = context.cellSorts.get(cell.getLabel()); if (cell.getLabel().equals("k") && cell.getEllipses() != Ellipses.NONE) sort = KSorts.K; if (sort == null) { <START> if (cell.getLabel().equals("k")) <END> sort = "K"; else if (cell.getLabel().equals("T")) sort = "Bag"; else if (cell.getLabel().equals("generatedTop")) sort = "Bag"; else if (cell.getLabel().equals("freshCounter")) sort = "K"; else if (cell.getLabel().equals(MetaK.Constants.pathCondition)) sort = "K"; } if (sort != null) { cell.setContents((Term) preferStrict(sort, cell.getContents())); } else { String msg = "Cell '" + cell.getLabel() + "' was not declared in a configuration."; throw new ParseFailedException(new KException(ExceptionType.ERROR, KExceptionGroup.COMPILER, msg, getName(), cell.getFilename(), cell.getLocation())); } return super.visit(cell, _); }</code><technical_language>okay, this is scary. please explain this instead of ensure correct sort information is inferred in context for cells</technical_language>

Target:
public ASTNode visit(Cell cell, Void _) throws ParseFailedException { Sort sort = context.getCellSort(cell); if (sort != null) { cell.setContents((Term) preferStrict(sort, cell.getContents())); } else { String msg = "Cell '" + cell.getLabel() + "' was not declared in a configuration."; throw new ParseFailedException(new KException(ExceptionType.ERROR, KExceptionGroup.COMPILER, msg, getName(), cell.getFilename(), cell.getLocation())); } return super.visit(cell, _); }
Source:
<code>public Iterator<DataSegment> getPublishedSegments() { if (isCacheEnabled) { Preconditions.checkState( <START> lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS), <END> "hold on, still syncing published segments" ); return publishedSegments.keySet().iterator(); } else { return getMetadataSegments( coordinatorDruidLeaderClient, jsonMapper, responseHandler, segmentWatcherConfig.getWatchedDataSources() ); } }</code><technical_language>Suggest changing this precondition check message "lifecycle start completed", lifecycle starting necessarily cache is ready (the initial poll() failed). adjust this class publishedSegments map is initially null, initialize successful getMetadataSegments() call in poll(). Then, in this method, add a check for "map != null" "hold on, syncing published segments" message if check fails</technical_language>

Target:
public Iterator<DataSegment> getPublishedSegments() { if (isCacheEnabled) { Preconditions.checkState( lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS) && cachePopulated.get(), "hold on, still syncing published segments" ); return publishedSegments.keySet().iterator(); } else { return getMetadataSegments( coordinatorDruidLeaderClient, jsonMapper, responseHandler, segmentWatcherConfig.getWatchedDataSources() ); } }
Source:
<code>public void testEmailWith64CharacterLocalPartIsValid() { <START> for (int num = 1; num < 64; num++) { <END> isValidEmail( stringOfLength( num ) + "@foo.com" ); } }</code><technical_language>missing 64 here. <= better</technical_language>

Target:
public void testEmailWith64CharacterLocalPartIsValid() { for (int num = 1; num <= 64; num++) { isValidEmail( stringOfLength( num ) + "@foo.com" ); } }
Source:
<code>private void checkObjectCollision(PackedObjectInfo obj) throws IOException { ObjectTypeAndSize info = openDatabase(obj, new ObjectTypeAndSize()); final byte[] readBuffer = buffer(); final byte[] curBuffer = new byte[readBuffer.length]; long sz = info.size; try (ObjectStream cur = readCurs.open(obj, info.type).openStream()) { if (cur.getSize() != sz) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } try (InputStream pck = inflate(Source.DATABASE, sz)) { while (0 < sz) { int n = (int) Math.min(readBuffer.length, sz); IO.readFully(cur, curBuffer, 0, n); IO.readFully(pck, readBuffer, 0, n); for (int i = 0; i < n; i++) { if (curBuffer[i] != readBuffer[i]) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } } sz -= n; } } <START> stats.increaseNumBytesDuplicated(sz); <END> stats.incrementObjectsDuplicated(); } catch (MissingObjectException notLocal) { } }</code><technical_language>Hm, sz 0 here</technical_language>

Target:
private void checkObjectCollision(PackedObjectInfo obj) throws IOException { ObjectTypeAndSize info = openDatabase(obj, new ObjectTypeAndSize()); final byte[] readBuffer = buffer(); final byte[] curBuffer = new byte[readBuffer.length]; long sz = info.size; long szForRecord = sz; try (ObjectStream cur = readCurs.open(obj, info.type).openStream()) { if (cur.getSize() != sz) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } try (InputStream pck = inflate(Source.DATABASE, sz)) { while (0 < sz) { int n = (int) Math.min(readBuffer.length, sz); IO.readFully(cur, curBuffer, 0, n); IO.readFully(pck, readBuffer, 0, n); for (int i = 0; i < n; i++) { if (curBuffer[i] != readBuffer[i]) { throw new IOException(MessageFormat.format( JGitText.get().collisionOn, obj.name())); } } sz -= n; } } stats.increaseNumBytesDuplicated(szForRecord); stats.incrementObjectsDuplicated(); } catch (MissingObjectException notLocal) { } }
Source:
<code>public @Nullable CtfTmfCallsite getCallsite(String eventName) { <START> if (fTrace != null) { <END> CTFCallsite callsite = fTrace.getCallsite(eventName); if (callsite != null) { return new CtfTmfCallsite(callsite); } } return null; }</code><technical_language>This is thread safe. a local variable, method synchronized (the dispose(), getNext(), etc...). problem happen getHostId(), getCallSite(String, long), getEnvironment(), etc... needs a class-wide review of of fTrace</technical_language>

Target:
public @Nullable CtfTmfCallsite getCallsite(String eventName) { CTFTrace trace = fTrace; if (trace != null) { CTFCallsite callsite = trace.getCallsite(eventName); if (callsite != null) { return new CtfTmfCallsite(callsite); } } return null; }
Source:
<code>private void validateKdcServers(String ldapSecurityAuthentication, String domainName) throws ManageDomainsResult { KDCLocator locator = new KDCLocator(); DnsSRVResult result = null; boolean foundServers = true; try { result = locator.getKdc(DnsSRVLocator.TCP, domainName); <START> if (result.getNumOfValidAddresses() == 0) { <END> result = locator.getKdc(DnsSRVLocator.UDP,domainName); if (result.getNumOfValidAddresses() == 0) { foundServers =false; } } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate KDC servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_KDC_SERVERS_FOR_DOMAIN, domainName); } }</code><technical_language>this result in NPE. instead check - if ((result == null) && (result.getNumOfValidAddresses() == 0)) {</technical_language>

Target:
private void validateKdcServers(String ldapSecurityAuthentication, String domainName) throws ManageDomainsResult { KDCLocator locator = new KDCLocator(); DnsSRVResult result = null; boolean foundServers = true; try { result = locator.getKdc(DnsSRVLocator.TCP, domainName); if (result == null || result.getNumOfValidAddresses() == 0) { result = locator.getKdc(DnsSRVLocator.UDP,domainName); if (result.getNumOfValidAddresses() == 0) { foundServers =false; } } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate KDC servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_KDC_SERVERS_FOR_DOMAIN, domainName); } }
Source:
<code>private void onAppComesFromBackground(Activity activity) { AppLog.i(T.UTILS, "App comes from background"); ConnectionChangeReceiver.setEnabled(WordPress.this, true); AnalyticsUtils.refreshMetadata(); mApplicationOpenedDate = new Date(); AnalyticsTracker.track(AnalyticsTracker.Stat.APPLICATION_OPENED); if (NetworkUtils.isNetworkAvailable(mContext)) { if (AccountHelper.isSignedInWordPressDotCom()) { <START> if (activity.getIntent().hasExtra(NotificationsListFragment.NOTE_ID_EXTRA)) { <END> NotificationsUpdateService.startService(getContext(), getNoteIdFromNoteDetailActivityIntent(activity.getIntent())); } else { NotificationsUpdateService.startService(getContext()); } NotificationsPendingDraftsService.checkPrefsAndStartService(getContext()); } updatePushNotificationTokenIfNotLimited(); sUpdateWordPressComBlogList.runIfNotLimited(); sUpdateCurrentBlogOption.runIfNotLimited(); } sDeleteExpiredStats.runIfNotLimited(); }</code><technical_language>Is a null Intent here</technical_language>

Target:
private void onAppComesFromBackground(Activity activity) { AppLog.i(T.UTILS, "App comes from background"); ConnectionChangeReceiver.setEnabled(WordPress.this, true); AnalyticsUtils.refreshMetadata(); mApplicationOpenedDate = new Date(); AnalyticsTracker.track(AnalyticsTracker.Stat.APPLICATION_OPENED); if (NetworkUtils.isNetworkAvailable(mContext)) { if (AccountHelper.isSignedInWordPressDotCom()) { Intent intent = activity.getIntent(); if (intent != null && intent.hasExtra(NotificationsListFragment.NOTE_ID_EXTRA)) { NotificationsUpdateService.startService(getContext(), getNoteIdFromNoteDetailActivityIntent(activity.getIntent())); } else { NotificationsUpdateService.startService(getContext()); } NotificationsPendingDraftsService.checkPrefsAndStartService(getContext()); } updatePushNotificationTokenIfNotLimited(); sUpdateWordPressComBlogList.runIfNotLimited(); sUpdateCurrentBlogOption.runIfNotLimited(); } sDeleteExpiredStats.runIfNotLimited(); }
Source:
<code>private void updateOverCommitPercent() { if (getAvailableDiskSize() == null || getAvailableDiskSize() == 0) { setStorageDomainOverCommitPercent(0); } else { <START> setStorageDomainOverCommitPercent((int)((getCommittedDiskSize() <END> - getActualImagesSize()) * 100 / getAvailableDiskSize())); } }</code><technical_language>casting int is redundant now.</technical_language>

Target:
private void updateOverCommitPercent() { if (getAvailableDiskSize() == null || getAvailableDiskSize() == 0) { setStorageDomainOverCommitPercent(0); } else { setStorageDomainOverCommitPercent(((getCommittedDiskSize() - getActualImagesSize()) * 100 / getAvailableDiskSize())); } }
Source:
<code>private List<OwnerProductShare> findProductSharesByOwner(Owner owner, boolean isRecipient, boolean activeOnly, Collection<String> productIds) { <START> <END> String jpql = "FROM OwnerProductShare ps WHERE "; if (CollectionUtils.isNotEmpty(productIds)) { jpql += "ps.productId in (:product_ids) AND "; } if (isRecipient) { jpql += "ps.recipientOwner.id = :owner_id "; } else { jpql += "ps.sharingOwner.id = :owner_id "; } if (activeOnly) { jpql += "AND ps.active = true"; } TypedQuery<OwnerProductShare> query = getEntityManager() .createQuery(jpql, OwnerProductShare.class) .setParameter("owner_id", owner.getId()); if (CollectionUtils.isNotEmpty(productIds)) { query.setParameter("product_ids", productIds); } return query.getResultList(); }</code><technical_language>I a great idea meaning of method call hinge a boolean this. a findProductSharesGivenToOwner a findProductSharesMadeByOwner encapsulate difference java if (isRecipient) { jpql += "ps.recipientOwner.id = :owner_id "; } else { jpql += "ps.sharingOwner.id = :owner_id "; } Otherwise, a constant guessing game a developer is reading code back</technical_language>

Target:
private List<OwnerProductShare> findProductSharesByOwner(Owner owner, boolean isRecipient, boolean activeOnly, Collection<String> productIds) { String jpql = "FROM OwnerProductShare ps WHERE "; if (CollectionUtils.isNotEmpty(productIds)) { jpql += "ps.productId in (:product_ids) AND "; } if (isRecipient) { jpql += "ps.recipientOwner.id = :owner_id "; } else { jpql += "ps.sharingOwner.id = :owner_id "; } if (activeOnly) { jpql += "AND ps.active = true"; } TypedQuery<OwnerProductShare> query = getEntityManager() .createQuery(jpql, OwnerProductShare.class) .setParameter("owner_id", owner.getId()); List<OwnerProductShare> shares = new LinkedList<OwnerProductShare>(); if (CollectionUtils.isNotEmpty(productIds)) { for (List<String> block : Iterables.partition(productIds, getInBlockSize())) { query.setParameter("product_ids", block); shares.addAll(query.getResultList()); } } else { shares.addAll(query.getResultList()); } return shares; }
Source:
<code>public void indexCreateFailure() throws Exception { ElasticWriter writer = createElasticWriter(); <START> when(mockClient.execute(Matchers.isA(IndicesExists.class))).thenReturn(jestResultFalse); <END> when(jestResultFalse.getErrorMessage()).thenReturn("Unknown error creating index in elastic"); writer.setJestClient(mockClient); writer.start(); writer.stop(); Mockito.verify(mockClient, atLeast(2)).execute(Matchers.<Action<JestResult>>any()); }</code><technical_language>missing a mock for call jestClient.execute()</technical_language>

Target:
public void indexCreateFailure() throws Exception { when(mockClient.execute(Matchers.isA(IndicesExists.class))).thenReturn(jestResultFalse); when(mockClient.execute(Matchers.isA(PutMapping.class))).thenReturn(jestResultFalse); when(jestResultFalse.getErrorMessage()).thenReturn("Unknown error creating index in elastic"); writer.start(); }
Source:
<code>private void autoRegisterAuthorityFromInputReader() { try { DCInputsReader dcInputsReader = new DCInputsReader(); <START> for (DCInputSet dcinputSet : dcInputsReader.getAllInputs(Integer.MAX_VALUE, 0)) { <END> DCInput[] dcinputs = dcinputSet.getFields(); for (DCInput dcinput : dcinputs) { if (StringUtils.isNotBlank(dcinput.getPairsType()) || StringUtils.isNotBlank(dcinput.getVocabulary())) { String authorityName = dcinput.getPairsType(); if(StringUtils.isBlank(authorityName)) { authorityName = dcinput.getVocabulary(); } if (!StringUtils.equals(dcinput.getInputType(), "qualdrop_value")) { String fieldKey = makeFieldKey(dcinput.getSchema(), dcinput.getElement(), dcinput.getQualifier()); controlled.put(fieldKey, true); isAuthorityRequired.put(fieldKey, true); } } } } } catch (DCInputsReaderException e) { throw new IllegalStateException(e.getMessage(), e); } }</code><technical_language>Again, I move this logic DCInputsReader DCInputAuthority classes focused submission form config</technical_language>

Target:
private void autoRegisterAuthorityFromInputReader() { try { DCInputsReader dcInputsReader = new DCInputsReader(); for (DCInputSet dcinputSet : dcInputsReader.getAllInputs(Integer.MAX_VALUE, 0)) { DCInput[] dcinputs = dcinputSet.getFields(); for (DCInput dcinput : dcinputs) { if (StringUtils.isNotBlank(dcinput.getPairsType()) || StringUtils.isNotBlank(dcinput.getVocabulary())) { String authorityName = dcinput.getPairsType(); if(StringUtils.isBlank(authorityName)) { authorityName = dcinput.getVocabulary(); } if (!StringUtils.equals(dcinput.getInputType(), "qualdrop_value")) { String fieldKey = makeFieldKey(dcinput.getSchema(), dcinput.getElement(), dcinput.getQualifier()); boolean req = ConfigurationManager.getBooleanProperty("authority.required."+fieldKey, false); controlled.put(fieldKey, true); isAuthorityRequired.put(fieldKey, req); } } } } } catch (DCInputsReaderException e) { throw new IllegalStateException(e.getMessage(), e); } }