auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static CompilerDelegate getCompilerDelegate(final Context context) { CompilerDelegate compilerDelegate = context.get(compilerDelegateKey); if (compilerDelegate == null) { <START> return new CompilerDelegate() { <END> @Override public ModuleManager getModuleManager() { com.redhat.ceylon.compiler.typechecker.context.Context ceylonContext = getCeylonContextInstance(context); return new CompilerModuleManager(ceylonContext, context); } @Override public PhasedUnit getExternalSourcePhasedUnit( VirtualFile srcDir, VirtualFile file) { return null; } @Override public void typeCheck(java.util.List<PhasedUnit> listOfUnits) { for (PhasedUnit pu : listOfUnits) { pu.validateTree(); pu.scanDeclarations(); } for (PhasedUnit pu : listOfUnits) { pu.scanTypeDeclarations(); } for (PhasedUnit pu: listOfUnits) { pu.validateRefinement(); } for (PhasedUnit pu : listOfUnits) { pu.analyseTypes(); } for (PhasedUnit pu : listOfUnits) { pu.analyseFlow(); } UnknownTypeCollector utc = new UnknownTypeCollector(); for (PhasedUnit pu : listOfUnits) { pu.getCompilationUnit().visit(utc); } } @Override public void visitModules(PhasedUnits phasedUnits) { phasedUnits.visitModules(); } @Override public void prepareForTypeChecking(List<JCCompilationUnit> trees) { CeylonEnter.instance(context).prepareForTypeChecking(trees); } }; } return compilerDelegate; }</code><technical_language>This needs a toplevel class ;)</technical_language>

Target:
public static CompilerDelegate getCompilerDelegate(final Context context) { CompilerDelegate compilerDelegate = context.get(compilerDelegateKey); if (compilerDelegate == null) { return new CeyloncCompilerDelegate(context); } return compilerDelegate; }
Source:
<code>public void init(ExternalView externalView, IdealState idealState, Set<String> onlineSegments) { <START> onExternalViewChange(externalView, idealState, onlineSegments); <END> }</code><technical_language>refer PartitionSegmentPruner do batch read for init() single read for onExternalViewChange() external view change involves change for segment</technical_language>

Target:
public void init(ExternalView externalView, IdealState idealState, Set<String> onlineSegments) { int numSegments = onlineSegments.size(); List<String> segments = new ArrayList<>(numSegments); List<String> segmentZKMetadataPaths = new ArrayList<>(numSegments); for (String segment : segments) { segments.add(segment); segmentZKMetadataPaths.add(_segmentZKMetadataPathPrefix + segment); } List<ZNRecord> znRecords = _propertyStore.get(segmentZKMetadataPaths, null, AccessOption.PERSISTENT, false); for (int i = 0; i < numSegments; i++) { String segment = segments.get(i); Interval interval = extractIntervalFromSegmentZKMetaZNRecord(segment, znRecords.get(i)); _intervalMap.put(segment, interval); } _intervalTree = new IntervalTree<>(_intervalMap); }
Source:
<code>public String getRoleName(String role) { <START> return NLS.get("Permission." + role); <END> }</code><technical_language>s.a</technical_language>

Target:
public String getRoleName(String role) { return Permissions.getTranslatedPermission(role); }
Source:
<code>protected ITmfTreeColumnDataProvider getColumnDataProvider() { return () <START> -> { return ImmutableList.of( createColumn(Messages.AbstractSegmentStoreScatterView_Type, Comparator.comparing(TmfGenericTreeEntry::getName)), new TmfTreeColumnData(Messages.AbstractSegmentStoreScatterView_Legend)); }; <END> }</code><technical_language>remove curly braces</technical_language>

Target:
protected ITmfTreeColumnDataProvider getColumnDataProvider() { return () -> ImmutableList.of( createColumn(Messages.AbstractSegmentStoreScatterView_Type, Comparator.comparing(TmfGenericTreeEntry::getName)), new TmfTreeColumnData(Messages.AbstractSegmentStoreScatterView_Legend)); }
Source:
<code>public @ResponseBody PendingCertifiedProductResults getPendingCertifiedProducts() throws EntityRetrievalException, AccessDeniedException { <START> if(Util.isUserRoleAdmin()){ <END> throw new AccessDeniedException("Pending products may only be viewed by the ACB Administrators that manage them."); } List<CertificationBodyDTO> acbs = acbManager.getAllForUser(false); List<PendingCertifiedProductDTO> allProductDtos = new ArrayList<PendingCertifiedProductDTO>(); if (acbs != null) { for (CertificationBodyDTO acb : acbs) { try { List<PendingCertifiedProductDTO> pendingCpsByAcb = pcpManager .getPendingCertifiedProductsByAcb(acb.getId()); allProductDtos.addAll(pendingCpsByAcb); } catch (final AccessDeniedException denied) { LOGGER.warn("Access denied to pending certified products for acb " + acb.getName() + " and user " + Util.getUsername()); } } } List<PendingCertifiedProductDetails> result = new ArrayList<PendingCertifiedProductDetails>(); for (PendingCertifiedProductDTO product : allProductDtos) { PendingCertifiedProductDetails pcpDetails = new PendingCertifiedProductDetails(product); pcpManager.addAllVersionsToCmsCriterion(pcpDetails); pcpManager.addAllMeasuresToCertificationCriteria(pcpDetails); result.add(pcpDetails); } PendingCertifiedProductResults results = new PendingCertifiedProductResults(); results.getPendingCertifiedProducts().addAll(result); return results; }</code><technical_language>If is ROLE_ADMIN ROLE_ACB able Pending ACBs have. I this restrict viewing</technical_language>

Target:
public @ResponseBody PendingCertifiedProductResults getPendingCertifiedProducts() throws EntityRetrievalException, AccessDeniedException { if(!Util.isUserRoleAcbAdmin()){ throw new AccessDeniedException(String .format(messageSource.getMessage( new DefaultMessageSourceResolvable("access.pendingCertifiedProducts"), LocaleContextHolder.getLocale()))); } List<CertificationBodyDTO> acbs = acbManager.getAllForUser(false); List<PendingCertifiedProductDTO> allProductDtos = new ArrayList<PendingCertifiedProductDTO>(); if (acbs != null) { for (CertificationBodyDTO acb : acbs) { try { List<PendingCertifiedProductDTO> pendingCpsByAcb = pcpManager .getPendingCertifiedProductsByAcb(acb.getId()); allProductDtos.addAll(pendingCpsByAcb); } catch (final AccessDeniedException denied) { LOGGER.warn("Access denied to pending certified products for acb " + acb.getName() + " and user " + Util.getUsername()); } } } List<PendingCertifiedProductDetails> result = new ArrayList<PendingCertifiedProductDetails>(); for (PendingCertifiedProductDTO product : allProductDtos) { PendingCertifiedProductDetails pcpDetails = new PendingCertifiedProductDetails(product); pcpManager.addAllVersionsToCmsCriterion(pcpDetails); pcpManager.addAllMeasuresToCertificationCriteria(pcpDetails); result.add(pcpDetails); } PendingCertifiedProductResults results = new PendingCertifiedProductResults(); results.getPendingCertifiedProducts().addAll(result); return results; }
Source:
<code>public boolean confirmStateTransfer(Address node, boolean statusOk) { synchronized (collector) { if (log.isDebugEnabled()) { <START> log.debugf("Remove %s from %s. Status=%s", node, collector, statusOk); <END> } if (this.statusOk && !statusOk) { this.statusOk = false; } return collector.remove(node) && collector.isEmpty(); } }</code><technical_language>I this trace only</technical_language>

Target:
public boolean confirmStateTransfer(Address node, boolean statusOk) { synchronized (collector) { if (log.isTraceEnabled()) { log.tracef("Remove %s from %s. Status=%s", node, collector, statusOk); } if (this.statusOk && !statusOk) { this.statusOk = false; } return collector.remove(node) && collector.isEmpty(); } }
Source:
<code>private void createAndExecuteConsumer(Subscription subscription) { logger.info("Creating consumer for {}", subscription.getId()); try { Consumer consumer = consumerFactory.createConsumer(subscription); logger.debug("Created consumer for {}", subscription.getId()); consumerHolder.add(subscription.getTopicName(), subscription.getName(), consumer); executor.execute(consumer); <START> logger.debug("Consumer for is created and executed ", subscription.getId()); <END> } catch (Exception ex) { logger.info("Failed to create consumer for subscription ", subscription.getId(), ex); } }</code><technical_language>*was created ;p</technical_language>

Target:
private void createAndExecuteConsumer(Subscription subscription) { logger.info("Creating consumer for {}", subscription.getId()); try { Consumer consumer = consumerFactory.createConsumer(subscription); logger.debug("Created consumer for {}", subscription.getId()); consumerHolder.add(subscription.getTopicName(), subscription.getName(), consumer); executor.execute(consumer); logger.debug("Consumer for was created and executed ", subscription.getId()); } catch (Exception ex) { logger.info("Failed to create consumer for subscription ", subscription.getId(), ex); } }
Source:
<code>public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); fetchImageTemplates(); if (imageTemplates != null) { for (DiskImage disk : imageTemplates) { if (disk.getQuotaId() != null && !Guid.Empty.equals(disk.getQuotaId())) { list.add(new QuotaStorageConsumptionParameter( disk.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, disk.getStorageIds().get(0), <START> (double) disk.getSizeInGigabytes() * disk.getStorageIds().size())); <END> } } } return list; }</code><technical_language>I understand this patch. create a QuotaStorageConsumptionParameter ID of storage domain, demand size domains</technical_language>

Target:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); fetchImageTemplates(); if (imageTemplates != null) { for (DiskImage disk : imageTemplates) { if (disk.getQuotaId() != null && !Guid.Empty.equals(disk.getQuotaId())) { for (Guid storageId : disk.getStorageIds()) { list.add(new QuotaStorageConsumptionParameter( disk.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, storageId, (double) disk.getSizeInGigabytes())); } } } } return list; }
Source:
<code>public boolean doSupportDynamicMemoryAllocation() { <START> return false; <END> }</code><technical_language>checked a running cluster: <LINK_0></technical_language>

Target:
public boolean doSupportDynamicMemoryAllocation() { return true; }
Source:
<code>public EventHubSharedAccessKeyCredential(String policyName, String sharedAccessKey, Duration tokenValidity) throws NoSuchAlgorithmException, InvalidKeyException { <START> if (ImplUtils.isNullOrEmpty(policyName)) { <END> throw new IllegalArgumentException("'policyName' cannot be null or empty"); } if (ImplUtils.isNullOrEmpty(sharedAccessKey)) { throw new IllegalArgumentException("'sharedAccessKey' cannot be null or empty."); } Objects.requireNonNull(tokenValidity); if (tokenValidity.isZero() || tokenValidity.isNegative()) { throw new IllegalArgumentException("'tokenTimeToLive' has to positive and in the order-of seconds"); } this.policyName = policyName; this.tokenValidity = tokenValidity; hmac = Mac.getInstance(HASH_ALGORITHM); final byte[] sasKeyBytes = sharedAccessKey.getBytes(UTF_8); final SecretKeySpec finalKey = new SecretKeySpec(sasKeyBytes, HASH_ALGORITHM); hmac.init(finalKey); }</code><technical_language>Throw NPE for null IllegalArgumentException for empty string</technical_language>

Target:
public EventHubSharedAccessKeyCredential(String policyName, String sharedAccessKey, Duration tokenValidity) throws NoSuchAlgorithmException, InvalidKeyException { Objects.requireNonNull(sharedAccessKey, "'sharedAccessKey' cannot be null."); this.policyName = Objects.requireNonNull(policyName, "'sharedAccessKey' cannot be null."); this.tokenValidity = Objects.requireNonNull(tokenValidity, "'tokenValidity' cannot be null."); if (policyName.isEmpty()) { throw new IllegalArgumentException("'policyName' cannot be an empty string."); } else if (sharedAccessKey.isEmpty()) { throw new IllegalArgumentException("'sharedAccessKey' cannot be an empty string."); } else if (tokenValidity.isZero() || tokenValidity.isNegative()) { throw new IllegalArgumentException("'tokenTimeToLive' has to positive and in the order-of seconds"); } hmac = Mac.getInstance(HASH_ALGORITHM); final byte[] sasKeyBytes = sharedAccessKey.getBytes(UTF_8); final SecretKeySpec finalKey = new SecretKeySpec(sasKeyBytes, HASH_ALGORITHM); hmac.init(finalKey); }
Source:
<code>protected void implReset() { super.implReset(); <START> if (iconv_tPointer != 0) { <END> IconvProvider.release(iconv_tPointer); iconv_tPointer = 0; } }</code><technical_language>Code smell: duplicate code</technical_language>

Target:
protected void implReset() { super.implReset(); this.release(); }
Source:
<code>public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException { PrintStream logger = listener.getLogger(); final JCloudsSlave slave = (JCloudsSlave) computer.getNode(); final String[] addresses = getConnectionAddresses(slave.getNodeMetaData(), logger); String host = addresses[0]; if ("0.0.0.0".equals(host)) { logger.println("Invalid host 0.0.0.0, your host is most likely waiting for an ip address."); throw new IOException("goto sleep"); } LOGGER.info("Launching host: " + host); if (slave.getSlaveType() == JCloudsCloud.SlaveType.SSH) { JCloudsCloud cloud = JCloudsCloud.getByName(slave.getCloudName()); int sshLaunchDelay = cloud.getSshLaunchDelay(); if (sshLaunchDelay > 0) { try { LOGGER.info(String.format("Delaying launch for %s milliseconds", sshLaunchDelay)); Thread.sleep(sshLaunchDelay); } catch (InterruptedException ex) { <START> Thread.currentThread().interrupt(); <END> } } SSHLauncher launcher = new SSHLauncher(host, 22, slave.getCredentialsId(), slave.getJvmOptions(), null, "", "", Integer.valueOf(0), null, null); launcher.launch(computer, listener); } else if (slave.getSlaveType() == JCloudsCloud.SlaveType.JNLP) { JNLPLauncher launcher = new JNLPLauncher(); launcher.launch(computer, listener); } else { throw new IOException(MessageFormat.format("Unknown slave type: {0}", slave.getSlaveType())); } }</code><technical_language>Is use-case launching thread is interrupted? If is not, I recommend propagate exception up</technical_language>

Target:
public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException { PrintStream logger = listener.getLogger(); final JCloudsSlave slave = (JCloudsSlave) computer.getNode(); final String[] addresses = getConnectionAddresses(slave.getNodeMetaData(), logger); String host = addresses[0]; if ("0.0.0.0".equals(host)) { logger.println("Invalid host 0.0.0.0, your host is most likely waiting for an ip address."); throw new IOException("goto sleep"); } LOGGER.info("Launching host: " + host); if (slave.getSlaveType() == JCloudsCloud.SlaveType.SSH) { JCloudsCloud cloud = JCloudsCloud.getByName(slave.getCloudName()); int sshLaunchDelay = cloud.getSshLaunchDelay(); if (sshLaunchDelay > 0) { LOGGER.info(String.format("Delaying launch for %s milliseconds", sshLaunchDelay)); Thread.sleep(sshLaunchDelay); } SSHLauncher launcher = new SSHLauncher(host, 22, slave.getCredentialsId(), slave.getJvmOptions(), null, "", "", Integer.valueOf(0), null, null); launcher.launch(computer, listener); } else if (slave.getSlaveType() == JCloudsCloud.SlaveType.JNLP) { JNLPLauncher launcher = new JNLPLauncher(); launcher.launch(computer, listener); } else { throw new IOException(MessageFormat.format("Unknown slave type: {0}", slave.getSlaveType())); } }
Source:
<code><START> public List<CommunicationDetails> getById(String tenantId, String id) { <END> List<CommunicationDetails> ret = new ArrayList<>(); if (multipleConsumers.containsKey(id)) { ret.addAll(multipleConsumers.get(id)); } CommunicationDetails singleConsumer = this.singleConsumer.get(id); if (singleConsumer != null) { ret.add(singleConsumer); } return ret; }</code><technical_language>Is this tests? all? If this code is used, intention it, throw UnsupportedOperationException</technical_language>

Target:
public List<CommunicationDetails> getById(String tenantId, String id) { throw new UnsupportedOperationException(); }
Source:
<code><START> private Repository createMockRepository() { <END> return new Repository() { @Override public String[] getDescriptorKeys() { return new String[0]; } @Override public boolean isStandardDescriptor(String s) { return false; } @Override public boolean isSingleValueDescriptor(String s) { return false; } @Override public Value getDescriptorValue(String s) { return null; } @Override public Value[] getDescriptorValues(String s) { return new Value[0]; } @Override public String getDescriptor(String s) { return null; } @Override public Session login(Credentials credentials, String s) throws LoginException, NoSuchWorkspaceException, RepositoryException { return new MockRepositorySession(); } @Override public Session login(Credentials credentials) throws LoginException, RepositoryException { return null; } @Override public Session login(String s) throws LoginException, NoSuchWorkspaceException, RepositoryException { return null; } @Override public Session login() throws LoginException, RepositoryException { return null; } }; }</code><technical_language>easier Mockito here? is a reason for this test</technical_language>

Target:
private Repository createMockRepository() throws RepositoryException { Repository myRepository = Mockito.mock(Repository.class); when(myRepository.login(anyObject(), anyString())).thenAnswer(inv -> createNewMockSession()); return myRepository; }
Source:
<code>public String getStateTypeName(ITimeGraphEntry entry) { <START> return "Thread"; END> }</code><technical_language>constant</technical_language>

Target:
public String getStateTypeName(ITimeGraphEntry entry) { return Messages.CallStackPresentationProvider_Thread; }
Source:
<code>public void onOpenReply(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus, RCClient.ErrorCodes status, String text) { RCLogger.i(TAG, "onOpenReply(): id: " + jobId + ", connectivityStatus: " + connectivityStatus + ", status: " + status + ", text: " + text); cachedConnectivityStatus = connectivityStatus; if (status != RCClient.ErrorCodes.SUCCESS) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, status.ordinal(), text); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(status)); } return; } <START> boolean registerForPushAvailable = false; <END> if (mStorageManagerPreferences != null) { if (allPushRegisterDataAvailable()) { new FcmConfigurationHandler(mStorageManagerPreferences, this).registerForPush(); registerForPushAvailable = true; } } if (!registerForPushAvailable) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, RCClient.ErrorCodes.ERROR_MESSAGE_PUSH_PARAMETERS_MISSING.ordinal(), RCClient.errorText(RCClient.ErrorCodes.ERROR_MESSAGE_PUSH_PARAMETERS_MISSING)); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(RCClient.ErrorCodes.ERROR_MESSAGE_PUSH_PARAMETERS_MISSING)); } release(); } }</code><technical_language>start signaling processing push configuration time, minimize time wait init? discuss potentially in tomorrow's call if sense plan</technical_language>

Target:
public void onOpenReply(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus, RCClient.ErrorCodes status, String text) { RCLogger.i(TAG, "onOpenReply(): id: " + jobId + ", connectivityStatus: " + connectivityStatus + ", status: " + status + ", text: " + text); cachedConnectivityStatus = connectivityStatus; if (status != RCClient.ErrorCodes.SUCCESS) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, status.ordinal(), text); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(status)); } return; } boolean registerForPushAvailable = false; if (storageManagerPreferences != null) { if (allPushRegisterDataAvailable()) { new FcmConfigurationHandler(storageManagerPreferences, this).registerForPush(); registerForPushAvailable = true; } } if (!registerForPushAvailable) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, RCClient.ErrorCodes.ERROR_DEVICE_PUSH_PARAMETERS_MISSING.ordinal(), RCClient.errorText(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_PARAMETERS_MISSING)); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_PARAMETERS_MISSING)); } release(); } }
Source:
<code>private Map<String, List<VDS>> getFailedLuns(Map<String, List<Pair<VDS, Integer>>> lunToVds) { Map<String, List<VDS>> failedVds = new HashMap<>(); for (Map.Entry<String, List<Pair<VDS, Integer>>> entry : lunToVds.entrySet()) { List<VDS> vdsList = new ArrayList<>(); Integer size = -1; boolean failed = false; for (Pair<VDS, Integer> vdsSizePair : entry.getValue()) { vdsList.add(vdsSizePair.getFirst()); if (size == -1) { size = vdsSizePair.getSecond(); } else { <START> if (!size.equals(vdsSizePair.getSecond())) { <END> failed = true; } } } if (failed) { failedVds.put(entry.getKey(), vdsList); } } return failedVds; }</code><technical_language>/s/else/elseif</technical_language>

Target:
private Map<String, List<VDS>> getFailedLuns(Map<String, List<Pair<VDS, Integer>>> lunToVds) { Map<String, List<VDS>> failedVds = new HashMap<>(); for (Map.Entry<String, List<Pair<VDS, Integer>>> entry : lunToVds.entrySet()) { List<VDS> vdsList = new ArrayList<>(); Integer size = -1; boolean failed = false; for (Pair<VDS, Integer> vdsSizePair : entry.getValue()) { vdsList.add(vdsSizePair.getFirst()); if (size == -1) { size = vdsSizePair.getSecond(); } else if (!size.equals(vdsSizePair.getSecond())) { failed = true; } } if (failed) { failedVds.put(entry.getKey(), vdsList); } } return failedVds; }
Source:
<code>public void handle(HttpExchange exchange) throws IOException { LOG.debug("'{}'", exchange.getRequestURI()); final String path = exchange.getRequestURI().getPath(); try { <START> try { <END> if (path.equals("/")) { String addr = new Interpolator(cfg).interpolate(config.remoteServer()); LOG.debug("Redirecting to '{}'", addr); writeRedirectResponse(exchange, addr); } else { String parts[] = path.substring(1).split("/"); String controller = parts[0]; List<String> p = new ArrayList<>(); for (int i = 1; i < parts.length; i++) { p.add(parts[i]); } Object response = resources.get().invoke(controller, p); exchange.getResponseHeaders().set("Access-Control-Allow-Origin", config.accessControlAllowOrigin()); writeJsonResponse(exchange, 200, response); } } catch (NotFoundException e) { StaticResource resource = provider.getResource(path).get(); if (resource.isValid()) { writeFileResponse(exchange, 200, resource.getData(), resource.getMimeType()); } else { LOG.debug("'{}' Not Found", path); writeFileResponse(exchange, 404, "not found".getBytes(), null); } } } catch (Exception e) { LOG.error("Error processing request '" + path + "'", e); writeErrorResponse(exchange, e); } }</code><technical_language>nested try instead catches a single try more specific NotFoundException coming first</technical_language>

Target:
public void handle(HttpExchange exchange) throws IOException { LOG.debug("'{}'", exchange.getRequestURI()); exchange.getResponseHeaders().set("Server", "KaryonAdmin"); exchange.getResponseHeaders().set("Access-Control-Allow-Origin", config.accessControlAllowOrigin()); final String path = exchange.getRequestURI().getPath(); try { try { if (path.equals("/")) { String addr = new Interpolator(cfg).interpolate(config.remoteServer()); LOG.debug("Redirecting to '{}'", addr); writeRedirectResponse(exchange, addr); } else { String parts[] = path.substring(1).split("/"); String controller = parts[0]; List<String> p = new ArrayList<>(); for (int i = 1; i < parts.length; i++) { p.add(parts[i]); } Object response = resources.get().invoke(controller, p); exchange.getResponseHeaders().set("Access-Control-Allow-Origin", config.accessControlAllowOrigin()); writeJsonResponse(exchange, 200, response); } } catch (NotFoundException e) { Optional<StaticResource> resource = provider.getResource(path).get(); if (resource.isPresent()) { writeFileResponse(exchange, 200, resource.get().getData(), resource.get().getMimeType()); } else { fallback.handle(exchange); } } } catch (Exception e) { LOG.error("Error processing request '" + path + "'", e); writeErrorResponse(exchange, e); } }
Source:
<code>protected Constraint frontLoad(ConstraintFactory constraintFactory) { <START> return constraintFactory.from(ExaminationConstraintConfiguration.class) <END> .join(Exam.class, filtering((config, exam) -> exam.isTopicFrontLoadLarge() && exam.isPeriodFrontLoadLast())) .penalize("Front load", HardSoftScore.ONE_SOFT, (config, exam) -> config.getFrontLoadPenalty()); }</code><technical_language>of from/join ExaminationConstraintConfiguration theoretically removable converted penalizeConfigurable()</technical_language>

Target:
protected Constraint frontLoad(ConstraintFactory constraintFactory) { return constraintFactory.from(Exam.class) .filter(exam -> exam.isTopicFrontLoadLarge() && exam.isPeriodFrontLoadLast()) .penalizeConfigurable("frontLoad"); }
Source:
<code>public void setUp() throws Exception { config = new Configuration("some-api-key"); <START> config.setDelivery(new Delivery() { <END> @Override public void deliver(SessionTrackingPayload payload, Configuration config) throws DeliveryFailureException { } @Override public void deliver(Report report, Configuration config) throws DeliveryFailureException { } }); client = new Client(InstrumentationRegistry.getContext(), config); client.disableExceptionHandler(); observer = new BugsnagTestObserver(); client.addObserver(observer); }</code><technical_language>BugsnagTestUtils.generateDelivery() create a no-op implementation of this</technical_language>

Target:
public void setUp() throws Exception { config = new Configuration("some-api-key"); config.setDelivery(BugsnagTestUtils.generateDelivery()); client = new Client(InstrumentationRegistry.getContext(), config); client.disableExceptionHandler(); observer = new BugsnagTestObserver(); client.addObserver(observer); }
Source:
<code>public WUCreateResponseWrapper WUCreate(WUCreateRequestWrapper params) throws Exception { <START> if (platformVersion.major==6) { <END> return new WUCreateResponseWrapper(this.version6WorkunitsServiceSoapProxy.WUCreate(params.getRawVersion6())); } else if (platformVersion.major==7) { return new WUCreateResponseWrapper(this.version7WorkunitsServiceSoapProxy.WUCreate(params.getRaw())); } else { throw new NotImplementedException("Can only handle cluster versions 6 and 7, not version " + String.valueOf(platformVersion.major)); } }</code><technical_language>a direct mapping WsWorkunits WSDL version Platform build version, I completely accidental... actual mapping hpcc build version wsworkunits wsdl version: 5.0.0 -> 1.51 5.2.0 -> 1.54 5.4.0 -> 1.56 5.6.0 -> 1.56 6.0.0 -> 1.58 6.2.0 -> 1.62 6.4.0 -> 1.69 7.0.0 -> 1.73 7.2.0 -> 1.73 100% accurate, determine soapproxy version based a plat version.major minor range. Also, request adding a get clientversion method esp services in 7.2 timeframe</technical_language>

Target:
public WUCreateResponseWrapper WUCreate(WUCreateRequestWrapper params) throws Exception { if (useVersion1_62()) { return new WUCreateResponseWrapper(this.getVersion1_62WorkunitsServiceSoapProxy().WUCreate()); } else if (useVersion1_69()) { return new WUCreateResponseWrapper(this.getVersion1_69WorkunitsServiceSoapProxy().WUCreate(params.getRawVersion1_69())); } else if (useVersion1_58()) { return new WUCreateResponseWrapper(this.getVersion1_58WorkunitsServiceSoapProxy().WUCreate()); } else if (useVersion1_73()) { return new WUCreateResponseWrapper(this.getVersion1_73WorkunitsServiceSoapProxy().WUCreate(params.getRaw())); } else { throw new UnsupportedOperationException("Can only handle cluster versions 6 and 7, not version " + String.valueOf(platformVersion.major)); } }
Source:
<code>public static boolean isApgInstalled(Context context) { Intent intent = new Intent("org.openintents.openpgp.IOpenPgpService"); intent.setPackage(PACKAGE_NAME_APG); <START> List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(intent, 0); <END> return !resInfo.isEmpty(); }</code><technical_language>queryIntentServices() return null</technical_language>

Target:
public static boolean isApgInstalled(Context context) { Intent intent = new Intent("org.openintents.openpgp.IOpenPgpService"); intent.setPackage(PACKAGE_NAME_APG); List<ResolveInfo> resInfo = context.getPackageManager().queryIntentServices(intent, 0); return resInfo != null && !resInfo.isEmpty(); }
Source:
<code><START> public DocumentMovedEvent(DocumentReference documentReference) <END> { this(documentReference, null); }</code><technical_language>clear if this is source target</technical_language>

Target:
public DocumentMovedEvent(DocumentReference documentReference) { super(documentReference); }
Source:
<code>public RouterConfig(JsonNode node, String source, boolean logUnusedParams) { NodeAdapter adapter = new NodeAdapter(node, source); this.rawJson = node; this.requestLogFile = adapter.asText("requestLogFile", null); this.streetRoutingTimeoutSeconds = adapter.asDouble( "streetRoutingTimeout", DEFAULT_STREET_ROUTING_TIMEOUT ); this.transitConfig = new TransitRoutingConfig(adapter.path("transit")); this.routingRequestDefaults = mapRoutingRequest(adapter.path("routingDefaults")); <START> this.updaterConfig = new UpdaterConfig(adapter.asRawNode("updaters")); <END> if(logUnusedParams) { adapter.logAllUnusedParameters(LOG); } }</code><technical_language>path method, asRawNode()and pass in 2 arguments (if need access JsonNode). I explain below</technical_language>

Target:
public RouterConfig(JsonNode node, String source, boolean logUnusedParams) { NodeAdapter adapter = new NodeAdapter(node, source); this.rawJson = node; this.requestLogFile = adapter.asText("requestLogFile", null); this.streetRoutingTimeoutSeconds = adapter.asDouble( "streetRoutingTimeout", DEFAULT_STREET_ROUTING_TIMEOUT ); this.transitConfig = new TransitRoutingConfig(adapter.path("transit")); this.routingRequestDefaults = mapRoutingRequest(adapter.path("routingDefaults")); this.updaterConfig = new UpdaterConfig(adapter.path("updaters")); if(logUnusedParams) { adapter.logAllUnusedParameters(LOG); } }
Source:
<code>private String getFilter(String databaseName, String tableName, List<ColumnProto> partitionColumns , String json) throws TajoException { Expr[] exprs = null; if (json != null && !json.isEmpty()) { Expr algebra = JsonHelper.fromJson(json, Expr.class); exprs = AlgebraicUtil.toConjunctiveNormalFormArray(algebra); } PartitionFilterAlgebraVisitor visitor = new PartitionFilterAlgebraVisitor(); visitor.setIsHiveCatalog(true); Expr[] filters = AlgebraicUtil.getAccumulatedFiltersByExpr(databaseName + "." + tableName, partitionColumns, exprs); StringBuffer sb = new StringBuffer(); Column target; int addedFilter = 0; String result; for (int i = 0; i < partitionColumns.size(); i++) { target = new Column(partitionColumns.get(i)); if (!(filters[i] instanceof IsNullPredicate)) { visitor.setColumn(target); visitor.visit(null, new Stack<Expr>(), filters[i]); result = visitor.getResult(); <START> if (result.length() > 0) { <END> if (addedFilter > 0) { sb.append(" AND "); } sb.append(" ( ").append(result).append(" ) "); addedFilter++; } } } return sb.toString(); }</code><technical_language>result zero-length? handle this situation</technical_language>

Target:
private String getFilter(String databaseName, String tableName, List<ColumnProto> partitionColumns , String json) throws TajoException { Expr[] exprs = null; if (json != null && !json.isEmpty()) { Expr algebra = JsonHelper.fromJson(json, Expr.class); exprs = AlgebraicUtil.toConjunctiveNormalFormArray(algebra); } PartitionFilterAlgebraVisitor visitor = new PartitionFilterAlgebraVisitor(); visitor.setIsHiveCatalog(true); Expr[] filters = AlgebraicUtil.getRearrangedCNFExpressions(databaseName + "." + tableName, partitionColumns, exprs); StringBuffer sb = new StringBuffer(); Column target; String result; for (int i = 0; i < partitionColumns.size(); i++) { target = new Column(partitionColumns.get(i)); if (!(filters[i] instanceof IsNullPredicate)) { visitor.setColumn(target); visitor.visit(null, new Stack<Expr>(), filters[i]); result = visitor.getResult(); if (result.length() > 0) { if (sb.length() > 0) { sb.append(" AND "); } sb.append(" ( ").append(result).append(" ) "); } else { throw new TajoInternalError("Filter does not exist : " + filters[i].toJson()); } } } return sb.toString(); }
Source:
<code>public ModelAndView showSearchResults( PortletRequest request, @RequestParam(value = "query") String query, @RequestParam(value = "queryId") String queryId) { final Map<String, Object> model = new HashMap<>(); model.put("query", query); if (isRestSearch(request)) { return new ModelAndView("/jsp/Search/searchRest", model); } ConcurrentMap<String, List<Tuple<SearchResult, String>>> results = new ConcurrentHashMap<>(); final PortalSearchResults portalSearchResults = this.getPortalSearchResults(request, queryId); if (portalSearchResults != null) { results = portalSearchResults.getResults(); } <START> results.forEach( <END> (key, value) -> { value.sort(Comparator.comparingInt(tuple -> tuple.first.getRank())); }); model.put("results", results); model.put("defaultTabKey", this.defaultTabKey); model.put("tabKeys", this.tabKeys); final boolean isMobile = isMobile(request); String viewName = isMobile ? "/jsp/Search/mobileSearch" : "/jsp/Search/search"; return new ModelAndView(viewName, model); }</code><technical_language>art: <LINK_0></technical_language>

Target:
public ModelAndView showSearchResults( PortletRequest request, @RequestParam(value = "query") String query, @RequestParam(value = "queryId") String queryId) { final Map<String, Object> model = new HashMap<>(); model.put("query", query); if (isRestSearch(request)) { return new ModelAndView("/jsp/Search/searchRest", model); } ConcurrentMap<String, List<Tuple<SearchResult, String>>> results = new ConcurrentHashMap<>(); final PortalSearchResults portalSearchResults = this.getPortalSearchResults(request, queryId); if (portalSearchResults != null) { results = portalSearchResults.getResults(); } results.forEach( (key, value) -> { value.sort(Comparator.comparingInt(tuple -> tuple.first.getRank())); }); logger.debug("Search results for query '{}' are: {}", query, results); model.put("results", results); model.put("defaultTabKey", this.defaultTabKey); model.put("tabKeys", this.tabKeys); final boolean isMobile = isMobile(request); String viewName = isMobile ? "/jsp/Search/mobileSearch" : "/jsp/Search/search"; return new ModelAndView(viewName, model); }
Source:
<code>public String getPresentableText(HaxeMethodContext context) { StringBuilder result = new StringBuilder(getName()); if (hasConstructor()) { result .append("(") .append(getPresentableParameterList(constructorParameters)) .append((")")); <START> } else if (isAbstract) { <END> result .append(":") .append(getResultType().toString()); } return result.toString(); }</code><technical_language>I mutually exclusive. manual shows here: <LINK_0></technical_language>

Target:
public String getPresentableText(HaxeMethodContext context) { StringBuilder result = new StringBuilder(getName()); if (hasConstructor()) { result .append("(") .append(getPresentableParameterList((HaxeEnumValueDeclaration)getBasePsi())) .append((")")); } if (hasReturnType) { result .append(":") .append(getResultType().toString()); } return result.toString(); }
Source:
<code>public String call() { StringWriter bos = new StringWriter(); PrintWriter pw = new PrintWriter(bos); try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { pw.println("-----------"); NetworkInterface ni = networkInterfaces.nextElement(); pw.println(" * Name " + ni.getDisplayName()); byte[] hardwareAddress = ni.getHardwareAddress(); <START> if (hardwareAddress == null || hardwareAddress.length == 0) <END> continue; pw.println(" ** Hardware Address - " + Util.toHexString(hardwareAddress)); pw.println(" ** Index - " + ni.getIndex()); pw.println(" ** Inet Address - " + ni.getInetAddresses()); pw.println(" ** MTU - " + ni.getMTU()); pw.println(" ** Is Up - " + ni.isUp()); pw.println(" ** Is Virtual - " + ni.isVirtual()); pw.println(" ** Is Loopback - " + ni.isLoopback()); pw.println(" ** Is Point to Point - " + ni.isPointToPoint()); pw.println(" ** Supports multicast - " + ni.supportsMulticast()); if (ni.getParent() != null) { pw.println(" ** Child of - " + ni.getParent().getDisplayName()); } } } catch (SocketException e) { e.printStackTrace(pw); } finally { pw.flush(); } return bos.toString(); }</code><technical_language>jenkins bound loopback I break dump hardware address (or dump special)</technical_language>

Target:
public String call() { StringBuilder bos = new StringBuilder(); try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { bos.append("-----------\n"); NetworkInterface ni = networkInterfaces.nextElement(); bos.append(" * Name ").append(ni.getDisplayName()).append("\n"); byte[] hardwareAddress = ni.getHardwareAddress(); if (hardwareAddress != null && hardwareAddress.length != 0) bos.append(" ** Hardware Address - ").append(Util.toHexString(hardwareAddress)).append("\n"); bos.append(" ** Index - ").append(ni.getIndex()).append("\n"); Enumeration<InetAddress> inetAddresses = ni.getInetAddresses(); while (inetAddresses.hasMoreElements()) { InetAddress inetAddress = inetAddresses.nextElement(); bos.append(" ** InetAddress - ").append(inetAddress).append("\n"); } bos.append(" ** MTU - ").append(ni.getMTU()).append("\n"); bos.append(" ** Is Up - ").append(ni.isUp()).append("\n"); bos.append(" ** Is Virtual - ").append(ni.isVirtual()).append("\n"); bos.append(" ** Is Loopback - ").append(ni.isLoopback()).append("\n"); bos.append(" ** Is Point to Point - ").append(ni.isPointToPoint()).append("\n"); bos.append(" ** Supports multicast - ").append(ni.supportsMulticast()).append("\n"); if (ni.getParent() != null) { bos.append(" ** Child of - ").append(ni.getParent().getDisplayName()).append("\n"); } } } catch (SocketException e) { bos.append(e.getMessage()); } return bos.toString(); }
Source:
<code>private Optional<File> getReport(Configuration settings, FileSystem fs, String reportPathPropertyKey, String msg) { Optional<String> reportPathProp = settings.get(reportPathPropertyKey); if (reportPathProp.isPresent()) { <START> if (!settings.hasKey(REPORT_PATHS_PROPERTY)) { <END> addAnalysisWarning("Property '%s' is deprecated. '%s' should be used instead (JaCoCo XML format).", reportPathPropertyKey, JACOCO_XML_PROPERTY); } String reportPathProperty = reportPathProp.get(); File report = fs.resolvePath(reportPathProperty); if (!report.isFile()) { LOG.info(msg, reportPathProperty); } else { return Optional.of(report); } } return Optional.empty(); }</code><technical_language>I move deprecation logic warnAboutDeprecatedProperties</technical_language>

Target:
private static Optional<File> getReport(Configuration settings, FileSystem fs, String reportPathPropertyKey, String msg) { Optional<String> reportPathProp = settings.get(reportPathPropertyKey); if (reportPathProp.isPresent()) { String reportPathProperty = reportPathProp.get(); File report = fs.resolvePath(reportPathProperty); if (!report.isFile()) { LOG.info(msg, reportPathProperty); } else { return Optional.of(report); } } return Optional.empty(); }
Source:
<code>private void convertTypeAlias() { Map<String, FileModule> fileMap = modulePrePass.getFileMap(); <START> for (String typeName : typesToRename.keySet()) { <END> String filename = typesToFilename.get(typeName); FileModule module = fileMap.get(filename); if (module == null) { modulePrePass.AddFileMap(filename); } module.importedNamespacesToSymbols.put(typeName, typesToRename.get(typeName)); } }</code><technical_language>prefer entrySet() for (Entry<String, FileModule> entry : typesToRename.entrySet())</technical_language>

Target:
private void convertTypeAlias() { Map<String, FileModule> fileMap = modulePrepass.getFileMap(); for (Entry<String, String> entry : typesToRename.entrySet()) { String oldTypeName = entry.getKey(); String newTypeName = entry.getValue(); String filename = typesToFilename.get(oldTypeName); FileModule module = fileMap.get(filename); module.importedNamespacesToSymbols.put(oldTypeName, newTypeName); } }
Source:
<code>private boolean checkType(TypeDefinition instanceType, String givenType) { <START> givenType += "Type"; <END> return instanceType.getName().getLocalPart().equals(givenType); }</code><technical_language>ways compare type, based type expression: 1. Check for equality fully qualified type name (including namespace information) 2. If namespace is provided in expression, check for equality type's display name 3. Check for equality fully qualified XML element names (including namespace information)</technical_language>

Target:
private boolean checkType(TypeDefinition instanceType, String givenType) { QName qNameOfGivenType = QName.valueOf(givenType); if (instanceType.getName().equals(qNameOfGivenType)) return true; if (instanceType.getDisplayName().equals(givenType)) return true; for (XmlElement element : instanceType.getConstraint(XmlElements.class).getElements()) { if (element.getName().equals(qNameOfGivenType)) return true; } return false; }
Source:
<code>public static void addDiskToVm(BaseDisk disk, Guid vmId) { DbFacade.getInstance().getBaseDiskDao().save(disk); VmDeviceUtils.addManagedDevice(new VmDeviceId(disk.getId(), vmId), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false, <START> ""); <END> }</code><technical_language>please remove alias setting (should encapsulated in addManagedDevice</technical_language>

Target:
public static void addDiskToVm(BaseDisk disk, Guid vmId) { DbFacade.getInstance().getBaseDiskDao().save(disk); VmDeviceUtils.addManagedDevice(new VmDeviceId(disk.getId(), vmId), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false); }
Source:
<code>private boolean isValidPosition(Vector3i position) { if (position == null) { return false; } Block targetBlock = worldProvider.getBlock(position); <START> Block belowBlock = worldProvider.getBlock(new Vector3i(position).addY(-1)); <END> return (targetBlock == airBlock && !belowBlock.isPenetrable()); }</code><technical_language>wish avoid creation of a new Vector3i sheer number of created modules is biggest drain</technical_language>

Target:
private boolean isValidPosition(Vector3i position) { if (position == null) { return false; } Block targetBlock = worldProvider.getBlock(position); position.addY(-1); Block belowBlock = worldProvider.getBlock(position); position.addY(1); return (targetBlock == airBlock && !belowBlock.isPenetrable()); }
Source:
<code>public void versioningTest() { given() .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(greaterThan(30))); given() .header("ApiVersion", "") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(greaterThan(30))); given() .header("ApiVersion", "1.0") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(1)) .body("data.attributes.name", hasItem("book")) .body("data.attributes.dbConnectionName", hasItem("")); given() .header("ApiVersion", "2.0") .accept("application/vnd.api+json") .get("/table") .then() <START> .statusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR); <END> }</code><technical_language>I want throw a 500 error here. This some kind of 4XX</technical_language>

Target:
public void versioningTest() { given() .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(greaterThan(30))); given() .header("ApiVersion", "") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(greaterThan(30))); given() .header("ApiVersion", "1.0") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_OK) .body("data", hasSize(1)) .body("data.attributes.name", hasItem("book")) .body("data.attributes.dbConnectionName", hasItem("")); given() .header("ApiVersion", "2.0") .accept("application/vnd.api+json") .get("/table") .then() .statusCode(HttpStatus.SC_BAD_REQUEST) .body("errors.detail", hasItem("API version 2.0 not found")); }
Source:
<code>public void validate(IValidator validatorManager, IProject rootProject, Collection<IRegion> dirtyRegions, IValidationContext helper, IReporter reporter, EditorValidationContext validationContext, IProjectValidationContext projectContext, IFile file) { init(rootProject, null, projectContext, validatorManager, reporter); setAsYouTypeValidation(true); asYouTypeTimestamp++; this.document = validationContext.getDocument(); if(dirtyRegions.size() == 1) { IRegion region = dirtyRegions.iterator().next(); try { String s = document.get(region.getOffset(), region.getLength()); if(s.indexOf(PageContextFactory.EL_START_1) < 0 && s.indexOf(PageContextFactory.EL_START_2) < 0) { return; } } catch (BadLocationException e) { <START> e.printStackTrace(); <END> } } ELContext elContext = PageContextFactory.createPageContext(this.document, false); if(elContext!=null) { elContext.setDirty(true); for (IRegion region : dirtyRegions) { Collection<ELReference> regionReferences = elContext.getELReferences(region); for (ELReference elReference : regionReferences) { validateEL(elReference, true, elContext); } disableProblemAnnotations(region, reporter); } if(reporter instanceof ITypedReporter) { ((ITypedReporter)reporter).addTypeForRegion(getProblemType()); } } }</code><technical_language>Log instead of printStackTrace() please</technical_language>

Target:
public void validate(IValidator validatorManager, IProject rootProject, Collection<IRegion> dirtyRegions, IValidationContext helper, IReporter reporter, EditorValidationContext validationContext, IProjectValidationContext projectContext, IFile file) { init(rootProject, null, projectContext, validatorManager, reporter); setAsYouTypeValidation(true); asYouTypeTimestamp++; this.document = validationContext.getDocument(); if(dirtyRegions.size() == 1) { IRegion region = dirtyRegions.iterator().next(); try { String s = document.get(region.getOffset(), region.getLength()); if(s.indexOf(PageContextFactory.EL_START_1) < 0 && s.indexOf(PageContextFactory.EL_START_2) < 0) { return; } } catch (BadLocationException e) { WebKbPlugin.getDefault().logError(e); } } ELContext elContext = PageContextFactory.createPageContext(this.document, false); if(elContext!=null) { elContext.setDirty(true); for (IRegion region : dirtyRegions) { Collection<ELReference> regionReferences = elContext.getELReferences(region); for (ELReference elReference : regionReferences) { validateEL(elReference, true, elContext); } disableProblemAnnotations(region, reporter); } if(reporter instanceof ITypedReporter) { ((ITypedReporter)reporter).addTypeForRegion(getProblemType()); } } }
Source:
<code><START> public void checkAttributeSyntax(PerunSessionImpl perunSession, Member member, Group group, Attribute attribute) throws WrongAttributeValueException { <END> String membershipExpTime = (String) attribute.getValue(); if(membershipExpTime == null) return; Date testDate; try { testDate = BeansUtils.getDateFormatterWithoutTime().parse(membershipExpTime); } catch (ParseException ex) { throw new WrongAttributeValueException(attribute, "Date parsing failed", ex); } if (!BeansUtils.getDateFormatterWithoutTime().format(testDate).equals(membershipExpTime)) { throw new WrongAttributeValueException(attribute, "Wrong format yyyy-MM-dd expected."); } }</code><technical_language>Please change lines of code (String) attribute.getValue() attribute.valueAsString(). for other types</technical_language>

Target:
public void checkAttributeSyntax(PerunSessionImpl perunSession, Member member, Group group, Attribute attribute) throws WrongAttributeValueException { String membershipExpTime = attribute.valueAsString(); if(membershipExpTime == null) return; Date testDate; try { testDate = BeansUtils.getDateFormatterWithoutTime().parse(membershipExpTime); } catch (ParseException ex) { throw new WrongAttributeValueException(attribute, "Date parsing failed", ex); } if (!BeansUtils.getDateFormatterWithoutTime().format(testDate).equals(membershipExpTime)) { throw new WrongAttributeValueException(attribute, "Wrong format yyyy-MM-dd expected."); } }