auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void logAPICall(final String transactionType, final Account account, final UUID paymentMethodId, @Nullable final UUID paymentId, @Nullable final UUID transactionId, @Nullable final BigDecimal amount, @Nullable final Currency currency, @Nullable final String paymentExternalKey, @Nullable final String paymentTransactionExternalKey) { if (log.isInfoEnabled()) { final StringBuilder logLine = new StringBuilder(); logLine.append("PaymentApi : ") .append(transactionType) .append(", account = ") .append(account.getId()); if (paymentMethodId != null) { logLine.append(", paymentMethodId = ") .append(paymentMethodId); } if (paymentExternalKey != null) { logLine.append(", paymentExternalKey = ") .append(paymentExternalKey); } if (paymentTransactionExternalKey != null) { logLine.append(", paymentTransactionExternalKey = ") .append(paymentTransactionExternalKey); } if (paymentId != null) { logLine.append(", paymentId = ") .append(paymentId); } if (transactionId != null) { logLine.append(", transactionId = ") .append(transactionId); } if (amount != null) { logLine.append(", amount = ") .append(amount); } if (currency != null) { logLine.append(", currency = ") .append(currency); } final String requestId = Request.getPerThreadRequestData() != null ? Request.getPerThreadRequestData().getRequestId() : null; if (requestId != null) { logLine.append(", requestId = ") .append(requestId); } log.info(logLine.toString()); } }

Target:
protected void logAPICall(final String transactionType, final Account account, final UUID paymentMethodId, @Nullable final UUID paymentId, @Nullable final UUID transactionId, @Nullable final BigDecimal amount, @Nullable final Currency currency, @Nullable final String paymentExternalKey, @Nullable final String paymentTransactionExternalKey) { if (log.isInfoEnabled()) { final StringBuilder logLine = new StringBuilder(); logLine.append("PaymentApi : ") .append(transactionType) .append(", account = ") .append(account.getId()); if (paymentMethodId != null) { logLine.append(", paymentMethodId = ") .append(paymentMethodId); } if (paymentExternalKey != null) { logLine.append(", paymentExternalKey = ") .append(paymentExternalKey); } if (paymentTransactionExternalKey != null) { logLine.append(", paymentTransactionExternalKey = ") .append(paymentTransactionExternalKey); } if (paymentId != null) { logLine.append(", paymentId = ") .append(paymentId); } if (transactionId != null) { logLine.append(", transactionId = ") .append(transactionId); } if (amount != null) { logLine.append(", amount = ") .append(amount); } if (currency != null) { logLine.append(", currency = ") .append(currency); } log.info(logLine.toString()); } }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { MDC.put(REQUEST_ID, UUIDGenerator.generate()); String loginName = StringUtils.isNotEmpty(LoginUserInfo.getLoginName()) ? LoginUserInfo.getLoginName() : ANONYMOUS; MDC.put(USER_ID, loginName); chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { MDC.put(REQUEST_ID, UUIDGenerator.generate()); String loginName = StringUtils.isNotEmpty(LoginUserInfo.getLoginName()) ? LoginUserInfo.getLoginName() : ANONYMOUS; MDC.put(USER_ID, loginName); chain.doFilter(request, response); } finally { MDC.remove(REQUEST_ID); MDC.remove(USER_ID); } }
Source:
private Address addNewAddressToAddressMap(int id, String host, int initialPort) { synchronized (addressMap) { while (true) { final Address newAddress = createAddress(host, initialPort++); if (!addressMap.containsValue(newAddress)) { addressMap.put(id, newAddress); return newAddress; } } } }

Target:
private Address addNewAddressToAddressMap(int id, String host, int initialPort) { synchronized (addressMap) { while (true) { int newPort = initialPort++; if (newPort > MAX_PORT_NUMBER) { throw new IllegalArgumentException( "Exhausted available port range. Try lowering the initial port in " + getClass().getSimpleName() + ": " + newPort); } final Address newAddress = createAddressOrNull(host, newPort); if (!addressMap.containsValue(newAddress)) { addressMap.put(id, newAddress); return newAddress; } } } }
Source:
public void onMessage(Message message) { try { log.infof("onMessage received message: %s '%s'", message, ((TextMessage) message).getText()); final Destination replyTo = message.getJMSReplyTo(); if (replyTo == null) { throw new RuntimeException("ReplyTo info in message was not specified" + " and bean does not know where to reply to"); } TxTestUtil.enlistTestXAResource(tm.getTransaction()); TxTestUtil.addSynchronization(tm.getTransaction()); try ( JMSContext context = factory.createContext() ) { context.createProducer() .setJMSCorrelationID(message.getJMSMessageID()) .send(replyTo, REPLY_PREFIX + ((TextMessage) message).getText()); } } catch (Exception e) { throw new RuntimeException("onMessage method execution failed", e); } }

Target:
public void onMessage(Message message) { try { log.tracef("onMessage received message: %s '%s'", message, ((TextMessage) message).getText()); final Destination replyTo = message.getJMSReplyTo(); if (replyTo == null) { throw new RuntimeException("ReplyTo info in message was not specified" + " and bean does not know where to reply to"); } TxTestUtil.enlistTestXAResource(tm.getTransaction()); TxTestUtil.addSynchronization(tm.getTransaction()); try ( JMSContext context = factory.createContext() ) { context.createProducer() .setJMSCorrelationID(message.getJMSMessageID()) .send(replyTo, REPLY_PREFIX + ((TextMessage) message).getText()); } } catch (Exception e) { throw new RuntimeException("onMessage method execution failed", e); } }
Source:
protected String[] getCommandArgs() { return new String[]{ "--no-color", "--except=terminating-semicolon", "--", inputFile.getPath() }; }

Target:
protected String[] getCommandArgs() { return new String[]{ "--only=function-whitespace" }; }
Source:
protected String constructUrlForConnection(String queryString) { return "".equals(queryString) ? getJdbcUrl() : getJdbcUrl() + QUERY_PARAM_SEPARATOR + queryString.substring(1); }

Target:
protected String constructUrlForConnection(String queryString) { String baseUrl = getJdbcUrl(); if ("".equals(queryString)) { return baseUrl; } if (!queryString.startsWith("?")) { throw new IllegalArgumentException("The '?' character must be included"); } return baseUrl.contains("?") ? baseUrl + QUERY_PARAM_SEPARATOR + queryString.substring(1) : baseUrl + queryString; }
Source:
private boolean modify(String processId, Predicate<Process> checker, Consumer<Process> modifier) { Process process = fetchProcess(processId).orElse(null); if (process == null) { return false; } int retries = 5; while (retries-- > 0) { if (!checker.test(process)) { return false; } modifier.accept(process); try { elastic.tryUpdate(process); process1stLevelCache.put(processId, process); process2ndLevelCache.put(processId, process); return true; } catch (OptimisticLockException e) { Wait.randomMillis(250, 500); } } Log.BACKGROUND.WARN("Failed to update process %s after 5 attempts. Skipping update...", processId); return false; }

Target:
private boolean modify(String processId, Predicate<Process> checker, Consumer<Process> modifier) { Process process = process1stLevelCache.get(processId); if (process == null) { process = elastic.find(Process.class, processId).orElse(null); } if (process == null) { return false; } int retries = 5; while (retries-- > 0) { if (!checker.test(process)) { return false; } modifier.accept(process); try { elastic.tryUpdate(process); process1stLevelCache.put(processId, process); process2ndLevelCache.put(processId, process); return true; } catch (OptimisticLockException e) { Wait.randomMillis(250, 500); } } Log.BACKGROUND.WARN("Failed to update process %s after 5 attempts. Skipping update...", processId); return false; }
Source:
protected void assertModuleRequest(String moduleName, boolean remove) { Message<?> next = tapChannel.receive(0); assertNotNull(next); String payload = (String) next.getPayload(); assertTrue(payload, payload.contains("\"module\":\"" + moduleName + "\"")); assertTrue(payload, payload.contains("\"remove\":" + (remove ? "true" : "false"))); }

Target:
protected void assertModuleRequest(String moduleName, boolean remove) { Message<?> next = tapChannel.receive(0); assertNotNull(next); String payload = (String) next.getPayload(); assertTrue(String.format("payload %s does not contain the expected module name %s", payload, moduleName), payload.contains("\"module\":\"" + moduleName + "\"")); assertTrue(String.format("payload %s does not contain the expected remove: value", payload), payload.contains("\"remove\":" + (remove ? "true" : "false"))); }
Source:
public IngressServerExposer( ExternalServiceExposureStrategy serviceExposureStrategy, @Named("infra.kubernetes.ingress.annotations") Map<String, String> annotations, @Nullable @Named("che.infra.kubernetes.ingress.labels") String labelsProperty, @Nullable @Named("che.infra.kubernetes.ingress.path_transform") String pathTransformFmt) { this.serviceExposureStrategy = serviceExposureStrategy; this.ingressAnnotations = annotations; this.pathTransformFmt = pathTransformFmt == null ? PATH_TRANSFORM_PATH_CATCH : pathTransformFmt; this.labels = labelsProperty != null ? Splitter.on(",").withKeyValueSeparator("=").split(labelsProperty) : new HashMap<>(); }

Target:
public IngressServerExposer( ExternalServiceExposureStrategy serviceExposureStrategy, @Named("infra.kubernetes.ingress.annotations") Map<String, String> annotations, @Nullable @Named("che.infra.kubernetes.ingress.labels") String labelsProperty, @Nullable @Named("che.infra.kubernetes.ingress.path_transform") String pathTransformFmt) { this.serviceExposureStrategy = serviceExposureStrategy; this.ingressAnnotations = annotations; this.pathTransformFmt = pathTransformFmt == null ? PATH_TRANSFORM_PATH_CATCH : pathTransformFmt; this.labels = labelsProperty != null ? Splitter.on(",").withKeyValueSeparator("=").split(labelsProperty) : emptyMap(); }
Source:
public void testEndOfStreamWithMultipleTasks() throws Exception { CountDownLatch task0ProcessedMessagesLatch = new CountDownLatch(1); CountDownLatch task1ProcessedMessagesLatch = new CountDownLatch(1); SystemConsumers consumerMultiplexer = mock(SystemConsumers.class); when(consumerMultiplexer.pollIntervalMs()).thenReturn(10); OffsetManager offsetManager = mock(OffsetManager.class); TestTask task0 = spy(createTestTask(true, true, false, task0ProcessedMessagesLatch, 0, taskName0, ssp0, offsetManager)); TestTask task1 = spy(createTestTask(true, true, false, task1ProcessedMessagesLatch, 0, taskName1, ssp1, offsetManager)); Map<TaskName, RunLoopTask> tasks = new HashMap<>(); tasks.put(taskName0, task0); tasks.put(taskName1, task1); int maxMessagesInFlight = 1; RunLoop runLoop = new RunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, maxIdleMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)) .thenReturn(envelope0) .thenReturn(envelope1) .thenReturn(ssp0EndOfStream) .thenReturn(ssp1EndOfStream) .thenReturn(null); runLoop.run(); task0ProcessedMessagesLatch.await(); task1ProcessedMessagesLatch.await(); verify(task0, times(1)).endOfStream(any()); verify(task1, times(1)).endOfStream(any()); assertEquals(1, task0.processed); assertEquals(1, task0.completed.get()); assertEquals(1, task1.processed); assertEquals(1, task1.completed.get()); assertEquals(4L, containerMetrics.envelopes().getCount()); assertEquals(2L, containerMetrics.processes().getCount()); }

Target:
public void testEndOfStreamWithMultipleTasks() { SystemConsumers consumerMultiplexer = mock(SystemConsumers.class); RunLoopTask task0 = getMockRunLoopTask(taskName0, ssp0); RunLoopTask task1 = getMockRunLoopTask(taskName1, ssp1); Map<TaskName, RunLoopTask> tasks = new HashMap<>(); tasks.put(taskName0, task0); tasks.put(taskName1, task1); int maxMessagesInFlight = 1; RunLoop runLoop = new RunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, maxIdleMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)) .thenReturn(envelope00) .thenReturn(envelope11) .thenReturn(ssp0EndOfStream) .thenReturn(ssp1EndOfStream) .thenReturn(null); runLoop.run(); verify(task0).process(eq(envelope00), any(), any()); verify(task0).endOfStream(any()); verify(task1).process(eq(envelope11), any(), any()); verify(task1).endOfStream(any()); assertEquals(4L, containerMetrics.envelopes().getCount()); }
Source:
public ArrayInterface setArray(int index, Array value) { return setObject(index, value); }

Target:
public Array setArray(int index, Array value) { return setObject(index, value); }
Source:
private groovy.lang.Script getParsedScript() { if (groovyShell == null) { groovyShell = new GroovyShell(); } if (parsedScript == null) { parsedScript = new ThreadLocal<>(); } groovy.lang.Script script = parsedScript.get(); if (script == null) { script = groovyShell.parse(expression); parsedScript.set(script); } return script; }

Target:
private groovy.lang.Script getParsedScript() { if (parsedScript == null) { synchronized (this) { parsedScript = new ThreadLocal<groovy.lang.Script>() { @Override protected groovy.lang.Script initialValue() { return new GroovyShell().parse(expression); } }; } } return parsedScript.get(); }
Source:
private Event.Type getEventType(Class<? extends Annotation> annotation) { if (annotation == CacheEntryActivated.class) return Event.Type.CACHE_ENTRY_ACTIVATED; if (annotation == CacheEntryCreated.class) return Event.Type.CACHE_ENTRY_CREATED; if (annotation == CacheEntryInvalidated.class) return Event.Type.CACHE_ENTRY_INVALIDATED; if (annotation == CacheEntryLoaded.class) return Event.Type.CACHE_ENTRY_LOADED; if (annotation == CacheEntryModified.class) return Event.Type.CACHE_ENTRY_MODIFIED; if (annotation == CacheEntryPassivated.class) return Event.Type.CACHE_ENTRY_PASSIVATED; if (annotation == CacheEntryRemoved.class) return Event.Type.CACHE_ENTRY_REMOVED; if (annotation == CacheEntryVisited.class) return Event.Type.CACHE_ENTRY_VISITED; if (annotation == CacheEntryEvicted.class) return Event.Type.CACHE_ENTRY_EVICTED; return null; }

Target:
private Event.Type getEventType(Class<? extends Annotation> annotation) { if (annotation == CacheEntryCreated.class) return Event.Type.CACHE_ENTRY_CREATED; if (annotation == CacheEntryModified.class) return Event.Type.CACHE_ENTRY_MODIFIED; if (annotation == CacheEntryRemoved.class) return Event.Type.CACHE_ENTRY_REMOVED; if (annotation == CacheEntryActivated.class) return Event.Type.CACHE_ENTRY_ACTIVATED; if (annotation == CacheEntryInvalidated.class) return Event.Type.CACHE_ENTRY_INVALIDATED; if (annotation == CacheEntryLoaded.class) return Event.Type.CACHE_ENTRY_LOADED; if (annotation == CacheEntryPassivated.class) return Event.Type.CACHE_ENTRY_PASSIVATED; if (annotation == CacheEntryVisited.class) return Event.Type.CACHE_ENTRY_VISITED; if (annotation == CacheEntriesEvicted.class) return Event.Type.CACHE_ENTRY_EVICTED; if (annotation == CacheEntryEvicted.class) return Event.Type.CACHE_ENTRY_EVICTED; return null; }
Source:
private Response createErrorResponse(String errorId, LockEntry lockEntry) { String message = String.format("Error %s: Check and set failed. ", errorId) + (lockEntry == null ? "" : "Lock was already open. "); return Response .status(Response.Status.CONFLICT) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of( "exceptionClass", CheckAndSetException.class.getName(), "message", message, "code", Response.Status.CONFLICT.getStatusCode())) .build(); }

Target:
private Response createErrorResponse(String errorId, LockEntry lockEntry) { String message = String.format("Error %s: Check and set failed. ", errorId) + (lockEntry == null ? "Please contact the AtlasDB team. " : lockEntry); return Response .status(Response.Status.CONFLICT) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of( "exceptionClass", CheckAndSetException.class.getName(), "message", message, "code", Response.Status.CONFLICT.getStatusCode())) .build(); }
Source:
public void testLabelSelector() { LabelSelector selector = repo.getKieServerCMLabelSelector(client); assertNotNull(selector); boolean foundAppNameLabel = false; for (LabelSelectorRequirement selReq : selector.getMatchExpressions()) { if (selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_APP_NAME) { foundAppNameLabel = true; assertEquals("In", selReq.getOperator()); assertTrue(selReq.getValues().contains(TEST_APP_NAME)); } if (selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_NAME) { assertEquals("In", selReq.getOperator()); assertTrue(selReq.getValues().contains(KieServerStateCloudRepository.CFG_MAP_LABEL_VALUE_USED)); assertTrue(selReq.getValues().contains(KieServerStateCloudRepository.CFG_MAP_LABEL_VALUE_IMMUTABLE)); } } assertTrue(foundAppNameLabel); System.setProperty(KieServerStateCloudRepository.CFG_KIE_CONTROLLER_OCP_GLOBAL_DISCOVERY_ENABLED, "true"); assertTrue(repo.getKieServerCMLabelSelector(client).getMatchExpressions().stream().noneMatch( selReq -> selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_APP_NAME)); System.clearProperty(KieServerStateCloudRepository.CFG_KIE_CONTROLLER_OCP_GLOBAL_DISCOVERY_ENABLED); }

Target:
public void testLabelSelector() { LabelSelector selector = repo.getKieServerCMLabelSelector(client); assertNotNull(selector); boolean foundAppNameLabel = false; for (LabelSelectorRequirement selReq : selector.getMatchExpressions()) { if (selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_APP_NAME) { foundAppNameLabel = true; assertEquals("In", selReq.getOperator()); assertTrue(selReq.getValues().contains(TEST_APP_NAME)); } if (selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_NAME) { assertEquals("In", selReq.getOperator()); assertTrue(selReq.getValues().contains(KieServerStateCloudRepository.CFG_MAP_LABEL_VALUE_USED)); assertTrue(selReq.getValues().contains(KieServerStateCloudRepository.CFG_MAP_LABEL_VALUE_IMMUTABLE)); } } assertTrue(foundAppNameLabel); System.setProperty(KieServerControllerConstants.KIE_CONTROLLER_OCP_GLOBAL_DISCOVERY_ENABLED, "true"); assertTrue(repo.getKieServerCMLabelSelector(client).getMatchExpressions().stream().noneMatch( selReq -> selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_APP_NAME)); }
Source:
protected void activate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Activating GoogleConnectorServiceComponent"); } try { GoogleProvisioningConnectorFactory googleProvisioningConnectorFactory = new GoogleProvisioningConnectorFactory(); context.getBundleContext().registerService(AbstractProvisioningConnectorFactory.class.getName(), googleProvisioningConnectorFactory, null); if (log.isDebugEnabled()) { log.debug("Google Identity Provisioning Connector bundle is activated"); } } catch (Exception e) { log.error(" Error while activating Google Identity Provisioning Connector ", e); } }

Target:
protected void activate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Activating GoogleConnectorServiceComponent"); } try { GoogleProvisioningConnectorFactory googleProvisioningConnectorFactory = new GoogleProvisioningConnectorFactory(); context.getBundleContext().registerService(AbstractProvisioningConnectorFactory.class.getName(), googleProvisioningConnectorFactory, null); if (log.isDebugEnabled()) { log.debug("Google Identity Provisioning Connector bundle is activated"); } } catch (Throwable e) { log.error("Error while activating Google Identity Provisioning Connector", e); } }
Source:
private void sendResultsEmail(PaymentWorksEmailableReportData reportData, File reportFile) { LOG.info("sendResultsEmail: entered"); String body = readReportFileToString(reportData, reportFile); String subject = buildEmailSubject(reportData); if (StringUtils.isNotBlank(getToAddress()) && StringUtils.isNotBlank(getFromAddress()) && StringUtils.isNotBlank(body) && StringUtils.isNotBlank(subject)) { getPaymentWorksReportEmailService().sendEmail(getToAddress(), getFromAddress(), subject, body); LOG.info("sendResultsEmail: Email was sent for batch job results report. toAddress = " + getToAddress() + " fromAddress = " + getFromAddress() + " subject = '" + subject + "'"); } else { LOG.error("sendResultsEmail: Could not email batch job results report " + reportData.retrieveReportName() + " because " + ((StringUtils.isBlank(getToAddress())) ? "toAddress is blank. " : "") + ((StringUtils.isBlank(getFromAddress())) ? "fromAddress is blank. " : "") + ((StringUtils.isBlank(subject)) ? "subject is blank. " : "") + ((StringUtils.isBlank(body)) ? "body is blank. " : "")); } }

Target:
private void sendResultsEmail(PaymentWorksEmailableReportData reportData, File reportFile) { LOG.info("sendResultsEmail: Preparing to send email for batch job results report " + reportData.retrieveReportName()); String body = readReportFileToString(reportData, reportFile); String subject = buildEmailSubject(reportData); getPaymentWorksReportEmailService().sendEmail(getToAddress(), getFromAddress(), subject, body); LOG.info("sendResultsEmail: Email was sent for batch job results report. toAddress = " + getToAddress() + " fromAddress = " + getFromAddress() + " subject = '" + subject + "'."); }
Source:
public void testProcessScheduledMessageSuccess() { final ResponseMessageResultType result = ResponseMessageResultType.OK; final ProtocolResponseMessage message = new ProtocolResponseMessage.Builder() .deviceMessageMetadata(DEVICE_MESSAGE_DATA).domain(DOMAIN).domainVersion(DOMAIN_VERSION).result(result) .dataObject(DATA_OBJECT).scheduled(true).build(); final ScheduledTask scheduledTask = new ScheduledTask(DEVICE_MESSAGE_DATA, DOMAIN, DOMAIN, DATA_OBJECT, SCHEDULED_TIME); scheduledTask.setPending(); when(this.scheduledTaskRepository.findByCorrelationUid(anyString())).thenReturn(scheduledTask); this.deviceResponseMessageService.processMessage(message); verify(this.domainResponseMessageSender, times(1)).send(message); verify(this.scheduledTaskRepository, times(1)).delete(scheduledTask); }

Target:
public void testProcessScheduledMessageSuccess() { final ProtocolResponseMessage message = new ProtocolResponseMessage.Builder() .deviceMessageMetadata(DEVICE_MESSAGE_DATA).domain(DOMAIN).domainVersion(DOMAIN_VERSION) .result(ResponseMessageResultType.OK).dataObject(DATA_OBJECT).scheduled(true).build(); final ScheduledTask scheduledTask = new ScheduledTask(DEVICE_MESSAGE_DATA, DOMAIN, DOMAIN, DATA_OBJECT, SCHEDULED_TIME); scheduledTask.setPending(); when(this.scheduledTaskRepository.findByCorrelationUid(anyString())).thenReturn(scheduledTask); this.deviceResponseMessageService.processMessage(message); verify(this.domainResponseMessageSender).send(message); verify(this.scheduledTaskRepository).delete(scheduledTask); }
Source:
public void testConfigureClientBuilder() { configurator.configureDefaults(props); configurator.configureClientBuilder(config, builder); List<Object> actual = captor.getAllValues(); assertTrue(actual.size() > 8); Iterator<Object> iterator = actual.iterator(); assertEquals(GenericResponseExceptionMapper.class, iterator.next().getClass()); assertEquals(JacksonJaxbJsonProvider.class, iterator.next().getClass()); assertEquals(JsonParseExceptionMapper.class, iterator.next()); assertEquals(JsonMappingExceptionMapper.class, iterator.next()); assertEquals(OAuthJSONProvider.class, iterator.next().getClass()); assertEquals(OAuthContextProvider.class, iterator.next().getClass()); assertEquals(LoggingFeature.class, iterator.next().getClass()); assertEquals(GZIPFeature.class, iterator.next().getClass()); verify(builder).property("a", "1"); verify(builder).property("b", "2"); verify(builder).property("c", "3"); }

Target:
public void testConfigureClientBuilder() { configurator.configureDefaults(props); configurator.configureClientBuilder(config, builder); verify(builder, times(10)).register(captor.capture()); List<Object> actual = captor.getAllValues(); assertTrue(actual.size() > 10); Iterator<Object> iterator = actual.iterator(); assertEquals(GenericResponseExceptionMapper.class, iterator.next().getClass()); assertEquals(JacksonJaxbJsonProvider.class, iterator.next().getClass()); assertEquals(JsonParseExceptionMapper.class, iterator.next()); assertEquals(JsonMappingExceptionMapper.class, iterator.next()); assertEquals(OAuthJSONProvider.class, iterator.next().getClass()); assertEquals(OAuthContextProvider.class, iterator.next().getClass()); assertEquals(LoggingFeature.class, iterator.next().getClass()); assertEquals(GZIPFeature.class, iterator.next().getClass()); verify(builder).property("a", "1"); verify(builder).property("b", "2"); verify(builder).property("c", "3"); }
Source:
public boolean handleSelection() { try { if (FoundInVersionColumnUI.promptFoundInVersion((TeamWorkFlowArtifact) getArtifact(), VersionReleaseType.UnReleased, VersionLockedType.UnLocked, getRelation())) { notifyXModifiedListeners(); refresh(); return true; } return false; } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } return false; }

Target:
public boolean handleSelection() { try { if (FoundInVersionColumnUI.promptFoundInVersion((TeamWorkFlowArtifact) getArtifact(), getRelation())) { notifyXModifiedListeners(); refresh(); return true; } return false; } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } return false; }
Source:
public boolean isLargeAttribute(PerunSession sess, AttributeDefinition attribute) { return (attribute.getType().equals(LinkedHashMap.class.getName()) || attribute.getType().equals("java.lang.LargeString") || attribute.getType().equals("java.util.LargeArrayList")); }

Target:
public boolean isLargeAttribute(PerunSession sess, AttributeDefinition attribute) { return (attribute.getType().equals(LinkedHashMap.class.getName()) || attribute.getType().equals(BeansUtils.largeStringClassName) || attribute.getType().equals(BeansUtils.largeArrayListClassName)); }
Source:
public Block copyRegion(int positionOffset, int length) { int positionCount = getPositionCount(); if (positionOffset < 0 || length < 0 || positionOffset + length > positionCount) { throw new IndexOutOfBoundsException("Invalid position " + positionOffset + " in block with " + positionCount + " positions"); } int[] newOffsets = Arrays.copyOfRange(offsets, positionOffset, positionOffset + length + 1); for (int i = 0; i < newOffsets.length; i++) { newOffsets[i] -= offsets[positionOffset]; } boolean[] newValueIsNull = Arrays.copyOfRange(valueIsNull, positionOffset, positionOffset + length); Slice slice = sliceOutput.slice().slice(offsets[positionOffset], newOffsets[length]); if (!slice.isCompact()) { slice = Slices.copyOf(slice); } return new VariableWidthBlock(length, slice, newOffsets, newValueIsNull); }

Target:
public Block copyRegion(int positionOffset, int length) { int positionCount = getPositionCount(); if (positionOffset < 0 || length < 0 || positionOffset + length > positionCount) { throw new IndexOutOfBoundsException("Invalid position " + positionOffset + " in block with " + positionCount + " positions"); } int[] newOffsets = compactOffsets(offsets, positionOffset, length); boolean[] newValueIsNull = compactArray(valueIsNull, positionOffset, length); Slice slice = compactSlice(sliceOutput.getUnderlyingSlice(), offsets[positionOffset], newOffsets[length]); return new VariableWidthBlock(length, slice, newOffsets, newValueIsNull); }
Source:
public void testServiceLoadBalancerWithNoIP() throws Exception { final String hostName = "test-host-name"; mockRestServiceWithLB(hostName, ""); final Optional<Endpoint> resultEndpoint = flinkKubeClient.getRestEndpoint(CLUSTER_ID).get(); assertTrue(resultEndpoint.isPresent()); assertEquals(hostName, resultEndpoint.get().getAddress()); assertEquals(REST_PORT, resultEndpoint.get().getPort()); }

Target:
public void testServiceLoadBalancerWithNoIP() { final String hostName = "test-host-name"; mockExpectedServiceFromServerSide(buildExternalServiceWithLoadBalancer(hostName, "")); final Optional<Endpoint> resultEndpoint = flinkKubeClient.getRestEndpoint(CLUSTER_ID); assertThat(resultEndpoint.isPresent(), is(true)); assertThat(resultEndpoint.get().getAddress(), is(hostName)); assertThat(resultEndpoint.get().getPort(), is(REST_PORT)); }
Source:
public static String artToString(Art art) { switch (art) { case KEBAB: return "Kebab"; case AZTEC: return "Aztec"; case ALBAN: return "Alban"; case AZTEC2: return "Aztec2"; case BOMB: return "Bomb"; case PLANT: return "Plant"; case WASTELAND: return "Wasteland"; case WANDERER: return "Wanderer"; case GRAHAM: return "Graham"; case POOL: return "Pool"; case COURBET: return "Courbet"; case SUNSET: return "Sunset"; case SEA: return "Sea"; case CREEBET: return "Creebet"; case MATCH: return "Match"; case BUST: return "Bust"; case STAGE: return "Stage"; case VOID: return "Void"; case SKULL_AND_ROSES: return "SkullAndRoses"; case WITHER: return "Wither"; case FIGHTERS: return "Fighters"; case SKELETON: return "Skeleton"; case DONKEYKONG: return "DonkeyKong"; case POINTER: return "Pointer"; case PIGSCENE: return "Pigscene"; case BURNINGSKULL: return "BurningSkull"; default: return "Kebab"; } }

Target:
public static String artToString(Art art) { switch (art) { case SKULL_AND_ROSES: return "SkullAndRoses"; case DONKEYKONG: return "DonkeyKong"; case BURNINGSKULL: return "BurningSkull"; default: return CapitalizeEnum.capitalizeEnum(art); } }
Source:
public static TopologyInfo getTopologyInfo(String name, String asUser, Map<String, Object> topoConf) { try (NimbusClient client = NimbusClient.getConfiguredClientAs(topoConf, asUser)) { return client.getClient().getTopologyInfoByName(name); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public static TopologyInfo getTopologyInfo(String name, String asUser, Map<String, Object> topoConf) { try (NimbusClient client = NimbusClient.getConfiguredClientAs(topoConf, asUser)) { return client.getClient().getTopologyInfoByName(name); } catch (NotAliveException notAliveException) { return null; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
protected Election createElectionAlgorithm(int electionAlgorithm){ Election le=null; switch (electionAlgorithm) { case 0: assert false : "Leader election algorithm type 0 is not supported anymore."; break; case 1: le = new AuthFastLeaderElection(this); break; case 2: le = new AuthFastLeaderElection(this, true); break; case 3: qcm = new QuorumCnxManager(this); QuorumCnxManager.Listener listener = qcm.listener; if(listener != null){ listener.start(); FastLeaderElection fle = new FastLeaderElection(this, qcm); fle.start(); le = fle; } else { LOG.error("Null listener when initializing cnx manager"); } break; default: assert false; } return le; }

Target:
protected Election createElectionAlgorithm(int electionAlgorithm){ Election le=null; switch (electionAlgorithm) { case 1: le = new AuthFastLeaderElection(this); break; case 2: le = new AuthFastLeaderElection(this, true); break; case 3: qcm = new QuorumCnxManager(this); QuorumCnxManager.Listener listener = qcm.listener; if(listener != null){ listener.start(); FastLeaderElection fle = new FastLeaderElection(this, qcm); fle.start(); le = fle; } else { LOG.error("Null listener when initializing cnx manager"); } break; default: assert false; } return le; }
Source:
private boolean isChildOfOrEqualToAnyFolder(IResource resource) { for (IPackageFragmentRoot fPackageFragmentRoot : fPackageFragmentRoots) { IResource fragmentRootResource= fPackageFragmentRoot.getResource(); if (fragmentRootResource.equals(resource) || ParentChecker.isDescendantOf(resource, fragmentRootResource)) return true; } return false; }

Target:
private boolean isChildOfOrEqualToAnyFolder(IResource resource) { for (IPackageFragmentRoot root : fPackageFragmentRoots) { IResource fragmentRootResource= root.getResource(); if (fragmentRootResource.equals(resource) || ParentChecker.isDescendantOf(resource, fragmentRootResource)) return true; } return false; }
Source:
public boolean isForNewerJava() { try { return minimumJavaVersion != null && new VersionNumber(minimumJavaVersion).isNewerThan( new VersionNumber(System.getProperty("java.specification.version"))); } catch (NumberFormatException nfe) { logBadMinJavaVersion("'minimumJavaVersion' was specified for plugin ''{0}'' but unparseable (received {1})", this.name, minimumJavaVersion); return false; } }

Target:
public boolean isForNewerJava() { try { final VersionNumber currentRuntimeJavaVersion = JavaUtils.getCurrentJavaRuntimeVersionNumber(); return minimumJavaVersion != null && new VersionNumber(minimumJavaVersion).isNewerThan( currentRuntimeJavaVersion); } catch (NumberFormatException nfe) { logBadMinJavaVersion(); return false; } }
Source:
public static SphereClient createObjectTestDouble(final Function<HttpRequestIntent, Object> function) { return new SphereClient() { @Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); } @Override public void close() { } @Override public String toString() { return "SphereClientObjectTestDouble"; } @Override public SphereApiConfig getConfig() { return null; } }; }

Target:
public static SphereClient createObjectTestDouble(final Function<HttpRequestIntent, Object> function) { return new SphereClient() { @Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); } @Override public void close() { } @Override public String toString() { return "SphereClientObjectTestDouble"; } @Override public SphereApiConfig getConfig() { return sphereApiConfig; } }; }
Source:
private String getTagId(Document document, String tagName) throws DocumentParserException { Node node = document.getElementsByTagName(tagName).item(0); if (node == null) { return null; } NamedNodeMap nodeAttributeMap = node.getAttributes(); Node idNode = nodeAttributeMap.getNamedItem("id"); if(idNode == null) { throw new DocumentParserException("Please provide a " + tagName + " id as a part of the XML"); } return idNode.getNodeValue(); }

Target:
private String getTagId(Document document, String tagName) throws DocumentParserException { Node node = document.getElementsByTagName(tagName).item(0); if (node == null) { return null; } NamedNodeMap nodeAttributeMap = node.getAttributes(); Node idNode = nodeAttributeMap.getNamedItem("id"); if(idNode == null) { throw new DocumentParserException("Please provide an id attribute for tag: " + tagName); } return idNode.getNodeValue(); }
Source:
public void apply(InternalEnvironment internalEnvironment, Collection<CheService> cheServices) throws InfrastructureException { KubernetesEnvironment kubernetesEnvironment = (KubernetesEnvironment) internalEnvironment; if (cheServices.isEmpty()) { return; } Map<String, Pod> pods = ((KubernetesEnvironment) internalEnvironment).getPods(); if (pods.size() != 1) { throw new InfrastructureException( "Can't apply Workspace.Next configuration to a workspace with multiple pods"); } Pod pod = pods.values().iterator().next(); for (CheService cheService : cheServices) { for (Container container : cheService.getSpec().getContainers()) { io.fabric8.kubernetes.api.model.Container k8sContainer = addContainer( pod, container.getImage(), container.getEnv(), container.getResources()); String machineName = Names.machineName(pod, k8sContainer); InternalMachineConfig machineConfig = addMachine(kubernetesEnvironment, machineName, container.getServers(), container.getVolumes()); normalizeMemory(k8sContainer, machineConfig); } } }

Target:
public void apply(InternalEnvironment internalEnvironment, Collection<CheService> cheServices) throws InfrastructureException { if (cheServices.isEmpty()) { return; } KubernetesEnvironment kubernetesEnvironment = (KubernetesEnvironment) internalEnvironment; Map<String, Pod> pods = kubernetesEnvironment.getPods(); if (pods.size() != 1) { throw new InfrastructureException( "Workspace.Next configuration can be applied to a workspace with one pod only"); } Pod pod = pods.values().iterator().next(); for (CheService cheService : cheServices) { for (Container container : cheService.getSpec().getContainers()) { io.fabric8.kubernetes.api.model.Container k8sContainer = addContainer(pod, container.getImage(), container.getEnv(), container.getResources()); String machineName = Names.machineName(pod, k8sContainer); InternalMachineConfig machineConfig = addMachine( kubernetesEnvironment, machineName, container.getServers(), container.getVolumes()); normalizeMemory(k8sContainer, machineConfig); } } }
Source:
private static void validateExtraHosts(final List<String> extraHosts) { if (extraHosts != null) { for (final String extraHost : extraHosts) { checkArgument(extraHost.contains(":"), String.format("extra host arg '%s' must contain a ':'", extraHost)); } } }

Target:
private static void validateExtraHosts(final List<String> extraHosts) { if (extraHosts != null) { for (final String extraHost : extraHosts) { checkArgument(extraHost.contains(":"), "extra host arg '%s' must contain a ':'", extraHost); } } }
Source:
private static UUID setUuidOnProperties(Path savesRoot, WorldProperties properties) { checkNotNull(properties); UUID uuid; if (properties.getUniqueId() == null || properties.getUniqueId().equals (UUID.fromString("00000000-0000-0000-0000-000000000000"))) { final Path uidPath = savesRoot.resolve(properties.getWorldName()).resolve("uid.dat"); if (!Files.exists(uidPath)) { uuid = UUID.randomUUID(); } else { DataInputStream dis; try { dis = new DataInputStream(Files.newInputStream(uidPath)); uuid = new UUID(dis.readLong(), dis.readLong()); } catch (IOException e) { SpongeImpl.getLogger().error("World folder has an existing Bukkit unique identifier for it but we encountered issues " + "parsing the file. We will have to use a new unique id. Please report this to Sponge ASAP.", properties.getWorldName(), e); uuid = UUID.randomUUID(); } } } else { uuid = properties.getUniqueId(); } ((IMixinWorldInfo) properties).setUUID(uuid); return uuid; }

Target:
private static UUID setUuidOnProperties(Path savesRoot, WorldProperties properties) { checkNotNull(properties); UUID uuid; if (properties.getUniqueId() == null || properties.getUniqueId().equals (UUID.fromString("00000000-0000-0000-0000-000000000000"))) { final Path uidPath = savesRoot.resolve(properties.getWorldName()).resolve("uid.dat"); if (!Files.exists(uidPath)) { uuid = UUID.randomUUID(); } else { try(final DataInputStream dis = new DataInputStream(Files.newInputStream(uidPath))) { uuid = new UUID(dis.readLong(), dis.readLong()); } catch (IOException e) { SpongeImpl.getLogger().error("World folder has an existing Bukkit unique identifier for it but we encountered issues parsing " + "the file. We will have to use a new unique id. Please report this to Sponge ASAP.", properties.getWorldName(), e); uuid = UUID.randomUUID(); } } } else { uuid = properties.getUniqueId(); } ((IMixinWorldInfo) properties).setUUID(uuid); return uuid; }
Source:
public String toString() { StringBuilder sb = new StringBuilder("ColumnMetadata{"); sb.append("name='").append(name).append('\''); sb.append(", type=").append(type); if (comment != null) { sb.append(", comment='").append(comment).append('\''); } if (extraInfo != null) { sb.append(", extraInfo='").append(extraInfo).append('\''); } if (hidden) { sb.append(", hidden"); } if (!properties.isEmpty()) { sb.append(", properties=").append(properties); } sb.append(", nullable=").append(nullable); sb.append('}'); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder("ColumnMetadata{"); sb.append("name='").append(name).append('\''); sb.append(", type=").append(type); sb.append(", ").append(nullable ? "nullable" : "nonnull"); if (comment != null) { sb.append(", comment='").append(comment).append('\''); } if (extraInfo != null) { sb.append(", extraInfo='").append(extraInfo).append('\''); } if (hidden) { sb.append(", hidden"); } if (!properties.isEmpty()) { sb.append(", properties=").append(properties); } sb.append('}'); return sb.toString(); }
Source:
public void testTransformXDRToCheckPolicy() throws Exception { XDREventType eventA = new XDREventType(); assertionType.setMessageId(MESSAGE_ID); slotType1.setName("$XDSDocumentEntryPatientId"); valueListType.getValue().add("1111.4444^^^&amp;26.489.22&amp;ISO"); slotType1.setValueList(valueListType); pnt.setFullName("Minh"); assertionType.setPersonName(pnt); rsl.getSlot().add(slotType1); sor.setId("100"); sor.setRequestSlotList(rsl); ProvideAndRegisterDocumentSetRequestType prdsrt = new ProvideAndRegisterDocumentSetRequestType(); Document doc = new Document(); doc.setId("223"); prdsrt.getDocument().add(doc); prdsrt.setSubmitObjectsRequest(sor); sor.setRegistryObjectList(rolt); XDRMessageType xmt = new XDRMessageType(); eventA.setMessage(xmt); xmt.setAssertion(assertionType); xmt.setProvideAndRegisterDocumentSetRequest(prdsrt); RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); SubjectType subject = subjHelp.subjectFactory(hct, assertionType); request.getSubject().add(subject); assertionType.setHomeCommunity(hct); assertionType.setSSN("170112756"); eventA.setSendingHomeCommunity(hct); String direction = "inbound"; eventA.setDirection(direction); eventA.getMessage().setAssertion(assertionType); CheckPolicyRequestType result = xdrTransformHelper.transformXDRToCheckPolicy(eventA); verifycheckPolicy_Request(result, direction); }

Target:
public void testTransformXDRToCheckPolicy() throws Exception { XDREventType eventA = new XDREventType(); assertionType.setMessageId(MESSAGE_ID); pnt.setFullName("Minh"); assertionType.setPersonName(pnt); rsl.getSlot().add(slotType1); sor.setId("100"); sor.setRequestSlotList(rsl); ProvideAndRegisterDocumentSetRequestType prdsrt = new ProvideAndRegisterDocumentSetRequestType(); Document doc = new Document(); doc.setId("223"); prdsrt.getDocument().add(doc); prdsrt.setSubmitObjectsRequest(sor); sor.setRegistryObjectList(rolt); XDRMessageType xmt = new XDRMessageType(); eventA.setMessage(xmt); xmt.setAssertion(assertionType); xmt.setProvideAndRegisterDocumentSetRequest(prdsrt); RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); SubjectType subject = subjHelp.subjectFactory(hct, assertionType); request.getSubject().add(subject); assertionType.setHomeCommunity(hct); assertionType.setSSN("170112756"); eventA.setSendingHomeCommunity(hct); String direction = "inbound"; eventA.setDirection(direction); eventA.getMessage().setAssertion(assertionType); CheckPolicyRequestType result = xdrTransformHelper.transformXDRToCheckPolicy(eventA); verifycheckPolicy_Request(result); }
Source:
public <T, V> Set<Argument<T>> createArguments(ArgumentHolder<? extends ArgumentType<T>> type, V value) { Set<Argument<T>> set = Sets.newLinkedHashSet(); if (type instanceof SpongeArgumentHolder.SpongeVector3) { Set<Function<V, T>> extractors = ((SpongeArgumentHolder.SpongeVector3<V, T>) (Object) type).extractFunctions(); Set<? extends ArgumentType<T>> types = type.getTypes(); Iterator<Function<V, T>> extIter = extractors.iterator(); Iterator<? extends ArgumentType<T>> typeIter = types.iterator(); for (; extIter.hasNext() && typeIter.hasNext();) { Function<V, T> extractor = extIter.next(); ArgumentType<T> subtype = typeIter.next(); set.add(createArgument(subtype, extractor.apply(value))); } } return set; }

Target:
public <T, V> Set<Argument<T>> createArguments(ArgumentHolder<? extends ArgumentType<T>> type, V value) { Set<Argument<T>> set = Sets.newLinkedHashSet(); if (type instanceof SpongeArgumentHolder.SpongeVector3) { Set<Function<V, T>> extractors = ((SpongeArgumentHolder.SpongeVector3<V, T>) (Object) type).extractFunctions(); Set<? extends ArgumentType<T>> types = type.getTypes(); Iterator<Function<V, T>> extIter = extractors.iterator(); Iterator<? extends ArgumentType<T>> typeIter = types.iterator(); while (extIter.hasNext() && typeIter.hasNext()) { Function<V, T> extractor = extIter.next(); ArgumentType<T> subtype = typeIter.next(); set.add(createArgument(subtype, extractor.apply(value))); } } return set; }
Source:
private void fillLocalPullDown(IMenuManager manager) { for (ASTView.ASTLevelToggle fASTVersionToggleAction : fASTVersionToggleActions) { manager.add(fASTVersionToggleAction); } manager.add(new Separator()); manager.add(fCreateBindingsAction); manager.add(fStatementsRecoveryAction); manager.add(fBindingsRecoveryAction); manager.add(fIgnoreMethodBodiesAction); manager.add(new Separator()); for (ASTView.ASTInputKindAction fASTInputKindAction : fASTInputKindActions) { manager.add(fASTInputKindAction); } manager.add(new Separator()); manager.add(fFindDeclaringNodeAction); manager.add(fParseBindingFromKeyAction); manager.add(fParseBindingFromElementAction); manager.add(new Separator()); manager.add(fFilterNonRelevantAction); manager.add(fLinkWithEditor); }

Target:
private void fillLocalPullDown(IMenuManager manager) { for (ASTView.ASTLevelToggle action : fASTVersionToggleActions) { manager.add(action); } manager.add(new Separator()); manager.add(fCreateBindingsAction); manager.add(fStatementsRecoveryAction); manager.add(fBindingsRecoveryAction); manager.add(fIgnoreMethodBodiesAction); manager.add(new Separator()); for (ASTView.ASTInputKindAction action : fASTInputKindActions) { manager.add(action); } manager.add(new Separator()); manager.add(fFindDeclaringNodeAction); manager.add(fParseBindingFromKeyAction); manager.add(fParseBindingFromElementAction); manager.add(new Separator()); manager.add(fFilterNonRelevantAction); manager.add(fLinkWithEditor); }
Source:
public ResponseEntity putStringPattern(@PathVariable("tenant") final String tenant, @PathVariable("name") final String name, @RequestBody final StringPatternModel stringPatternModel) { final StringPattern stringPattern; switch (stringPatternModel.getPatternType()) { case STRING: stringPattern = new SimpleStringPattern(name, stringPatternModel.getPattern()); break; case REGEX: stringPattern = new RegexStringPattern(name, stringPatternModel.getPattern(), false); break; case REGEX_MATCH_ENTIRE_STRING: stringPattern = new RegexStringPattern(name, stringPatternModel.getPattern(), true); break; default: throw new IllegalArgumentException("No such string pattern type"); } final TenantContext context = _contextFactory.getContext(tenant); _referenceDataDao.removeStringPattern(context, name); _referenceDataDao.addStringPattern(context, stringPattern); return ResponseEntity.created(ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUri()).build(); }

Target:
public ResponseEntity<Void> putStringPattern(@PathVariable("tenant") final String tenant, @PathVariable("name") final String name, @RequestBody final StringPatternModel stringPatternModel) { final StringPattern stringPattern; switch (stringPatternModel.getPatternType()) { case STRING: stringPattern = new SimpleStringPattern(name, stringPatternModel.getPattern()); break; case REGEX: stringPattern = new RegexStringPattern(name, stringPatternModel.getPattern(), false); break; case REGEX_MATCH_ENTIRE_STRING: stringPattern = new RegexStringPattern(name, stringPatternModel.getPattern(), true); break; default: throw new IllegalArgumentException("No such string pattern type, " + stringPatternModel.getPatternType()); } final TenantContext context = _contextFactory.getContext(tenant); _referenceDataDao.removeStringPattern(context, name); _referenceDataDao.addStringPattern(context, stringPattern); return ResponseEntity.created(ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUri()).build(); }