auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static File urlToFile(URL url) { if (!"file".equals(url.getProtocol())) { return null; } String string = url.toString(); if (url.getQuery() != null) { string = string.substring(0, string.indexOf("?")); } if (string.contains("+")) { string = string.replace("+", "%2B"); } try { string = URLDecoder.decode(string, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Could not decode the URL to UTF-8 format", e); } String path3; String simplePrefix = "file:/"; String standardPrefix = "file://"; if (IS_WINDOWS_OS && string.startsWith(standardPrefix)) { path3 = string.substring(standardPrefix.length() - 2); File f = new File(path3); if (!f.exists()) { path3 = path3.substring(2, path3.length()); } } else if (string.startsWith(standardPrefix)) { path3 = string.substring(standardPrefix.length()); } else if (string.startsWith(simplePrefix)) { path3 = string.substring(simplePrefix.length() - 1); } else { String auth = url.getAuthority(); String path2 = url.getPath(); try { path2 = URLDecoder.decode(path2, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Could not decode the URL to UTF-8 format", e); } if (auth != null && !auth.equals("")) { path3 = " } else { path3 = path2; } } return new File(path3); }

Target:
public static File urlToFile(URL url) { if (!"file".equals(url.getProtocol())) { return null; } String string = url.toString(); if (url.getQuery() != null) { string = string.substring(0, string.indexOf("?")); } if (string.contains("+")) { string = string.replace("+", "%2B"); } try { string = URLDecoder.decode(string, java.nio.charset.StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("UTF-8 encoding not supported", e); } String path3; String simplePrefix = "file:/"; String standardPrefix = "file://"; if (IS_WINDOWS_OS && string.startsWith(standardPrefix)) { path3 = string.substring(standardPrefix.length() - 2); File f = new File(path3); if (!f.exists()) { path3 = path3.substring(2, path3.length()); } } else if (string.startsWith(standardPrefix)) { path3 = string.substring(standardPrefix.length()); } else if (string.startsWith(simplePrefix)) { path3 = string.substring(simplePrefix.length() - 1); } else { String auth = url.getAuthority(); String path2 = url.getPath(); try { path2 = URLDecoder.decode(path2, java.nio.charset.StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("UTF-8 encoding not supported", e); } if (auth != null && !auth.equals("")) { path3 = " } else { path3 = path2; } } return new File(path3); }
Source:
public static InternalCompletableFuture newCompletedFuture(Object result) { InternalCompletableFuture future = new InternalCompletableFuture(); future.complete(result); return future; }

Target:
public static <V> InternalCompletableFuture<V> newCompletedFuture(Object result) { InternalCompletableFuture future = new InternalCompletableFuture(); future.complete(result); return future; }
Source:
public void validateSectionsAndTeams(List<StudentAttributes> studentList, String courseId) throws EntityDoesNotExistException, EnrollException { List<StudentAttributes> mergedList = getMergedList(studentList, courseId); if (mergedList.size() < 2) { return; } String errorMessage = new StringBuilder() .append(getSectionInvalidityInfo(mergedList)) .append(getTeamInvalidityInfo(mergedList)) .toString(); if (!errorMessage.isEmpty()) { throw new EnrollException(errorMessage); } }

Target:
public void validateSectionsAndTeams(List<StudentAttributes> studentList, String courseId) throws EntityDoesNotExistException, EnrollException { List<StudentAttributes> mergedList = getMergedList(studentList, courseId); if (mergedList.size() < 2) { return; } String errorMessage = getSectionInvalidityInfo(mergedList) + getTeamInvalidityInfo(mergedList); if (!errorMessage.isEmpty()) { throw new EnrollException(errorMessage); } }
Source:
public void validateField(String name, Object o) { if (o == null) { throw new IllegalArgumentException("Field " + name + " must be set."); } HashMap<String, Exception> validatorExceptions = new HashMap<>(); Set<String> selectedValidators = new HashSet<>(); for (Class<?> vv : subValidators) { Object valueValidator; try { valueValidator = vv.getConstructor().newInstance(); } catch (Exception ex) { throw new IllegalArgumentException(vv.getName() + " instantiation failure", ex); } if (valueValidator instanceof Validator) { try { ((Validator) valueValidator).validateField(name + " " + vv.getSimpleName() + " value", o); selectedValidators.add(vv.getName()); } catch (Exception ex) { validatorExceptions.put(vv.getName(), ex); } } else { String err = String.format("validator: %s cannot be used in CustomExactlyOneOfValidators to validate values. " + "Individual entry validators must a instance of Validator class", vv.getName()); LOG.warn(err); } } if (selectedValidators.isEmpty()) { String parseErrs = String.join(";\n\t", validatorExceptions.entrySet().stream() .map(e -> String.format("%s:%s", e.getKey(), e.getValue())).collect(Collectors.toList())); String err = String.format("Field %s must be one of %s; parse errors are \n\t%s", name, String.join(", ", validatorClassNames), parseErrs); throw new IllegalArgumentException(err); } if (selectedValidators.size() > 1) { throw new IllegalArgumentException("Field " + name + " must match exactly one of " + String.join(", ", selectedValidators)); } }

Target:
public void validateField(String name, Object o) { if (o == null) { return; } HashMap<String, Exception> validatorExceptions = new HashMap<>(); Set<String> selectedValidators = new HashSet<>(); for (Class<?> vv : subValidators) { Object valueValidator; try { valueValidator = vv.getConstructor().newInstance(); } catch (Exception ex) { throw new IllegalArgumentException(vv.getName() + " instantiation failure", ex); } if (valueValidator instanceof Validator) { try { ((Validator) valueValidator).validateField(name + " " + vv.getSimpleName() + " value", o); selectedValidators.add(vv.getName()); } catch (Exception ex) { validatorExceptions.put(vv.getName(), ex); } } else { String err = String.format("validator: %s cannot be used in CustomExactlyOneOfValidators to validate values. " + "Individual entry validators must a instance of Validator class", vv.getName()); LOG.warn(err); } } if (selectedValidators.isEmpty()) { String parseErrs = String.join(";\n\t", validatorExceptions.entrySet().stream() .map(e -> String.format("%s:%s", e.getKey(), e.getValue())).collect(Collectors.toList())); String err = String.format("Field %s must be one of %s; parse errors are \n\t%s", name, String.join(", ", validatorClassNames), parseErrs); throw new IllegalArgumentException(err); } if (selectedValidators.size() > 1) { throw new IllegalArgumentException("Field " + name + " must match exactly one of " + String.join(", ", selectedValidators)); } }
Source:
public static void check( final PsiElement erroredElement, final HaxeTypeTag tag, final HaxeVarInit initExpression, boolean requireConstant, final AnnotationHolder holder ) { final ResultHolder type1 = HaxeTypeResolver.getTypeFromTypeTag(tag, erroredElement); ResultHolder t2 = HaxeTypeResolver.getPsiElementType(initExpression); ResultHolder aeExpr = HaxeAbstractEnumUtil.getStaticMemberExpression(initExpression.getExpression()); if(aeExpr != null) { t2 = aeExpr; } final ResultHolder type2 = t2; final HaxeDocumentModel document = HaxeDocumentModel.fromElement(tag); if (!type1.canAssign(type2)) { Annotation annotation = holder.createErrorAnnotation(erroredElement, "Incompatible type " + type1 + " can't be assigned from " + type2); annotation.registerFix(new HaxeFixer("Change type") { @Override public void run() { document.replaceElementText(tag, ":" + type2.toStringWithoutConstant()); } }); annotation.registerFix(new HaxeFixer("Remove init") { @Override public void run() { document.replaceElementText(initExpression, "", StripSpaces.BEFORE); } }); } else if (requireConstant && type2.getType().getConstant() == null) { holder.createErrorAnnotation(erroredElement, "Parameter default type should be constant but was " + type2); } }

Target:
public static void check( final PsiElement erroredElement, final HaxeTypeTag tag, final HaxeVarInit initExpression, boolean requireConstant, final AnnotationHolder holder ) { final ResultHolder type1 = HaxeTypeResolver.getTypeFromTypeTag(tag, erroredElement); final ResultHolder type2 = getTypeFromVarInit(initExpression); final HaxeDocumentModel document = HaxeDocumentModel.fromElement(tag); if (!type1.canAssign(type2)) { Annotation annotation = holder.createErrorAnnotation(erroredElement, "Incompatible type " + type1 + " can't be assigned from " + type2); annotation.registerFix(new HaxeFixer("Change type") { @Override public void run() { document.replaceElementText(tag, ":" + type2.toStringWithoutConstant()); } }); annotation.registerFix(new HaxeFixer("Remove init") { @Override public void run() { document.replaceElementText(initExpression, "", StripSpaces.BEFORE); } }); } else if (requireConstant && type2.getType().getConstant() == null) { holder.createErrorAnnotation(erroredElement, "Parameter default type should be constant but was " + type2); } }
Source:
public List<SeriesInfoDto> findByMichelNumber(String michelNumberCode, String lang) { Validate.isTrue(michelNumberCode != null, "Michel number code must be non null"); Validate.isTrue(!michelNumberCode.trim().isEmpty(), "Michel number code must be non empty"); List<Integer> seriesIds = seriesDao.findSeriesIdsByMichelNumberCode(michelNumberCode); return seriesIds.isEmpty() ? Collections.emptyList() : seriesDao.findByIdsAsSeriesInfo(seriesIds, lang); }

Target:
public List<SeriesInfoDto> findByMichelNumber(String michelNumberCode, String lang) { Validate.isTrue(michelNumberCode != null, "Michel number code must be non null"); Validate.isTrue(!michelNumberCode.trim().isEmpty(), "Michel number code must be non empty"); List<Integer> seriesIds = seriesDao.findSeriesIdsByMichelNumberCode(michelNumberCode); if (seriesIds.isEmpty()) { return Collections.emptyList(); } return seriesDao.findByIdsAsSeriesInfo(seriesIds, lang); }
Source:
protected void writeApplicabilityScope(IRequirement[][] capabilities) { start(APPLICABILITY_SCOPE); for (IRequirement[] capabilitie : capabilities) { start(APPLY_ON); writeRequirements(Arrays.asList(capabilitie)); end(APPLY_ON); } end(APPLICABILITY_SCOPE); }

Target:
protected void writeApplicabilityScope(IRequirement[][] capabilities) { start(APPLICABILITY_SCOPE); for (IRequirement[] capability : capabilities) { start(APPLY_ON); writeRequirements(Arrays.asList(capability)); end(APPLY_ON); } end(APPLICABILITY_SCOPE); }
Source:
private static List<? extends IPAddress> getDhcpRouters(String interfaceName, IPAddress address) { List<IPAddress> routers = null; if (address != null) { DhcpClientLeases dhcpClientLeases = DhcpClientLeases.getInstance(); try { routers = dhcpClientLeases.getDhcpGateways(interfaceName, address); } catch (KuraException e) { logger.error("Error getting DHCP DNS servers", e); } } if (routers == null) { routers = new ArrayList<>(); } return routers; }

Target:
private List<? extends IPAddress> getDhcpRouters(String interfaceName, IPAddress address) { List<IPAddress> routers = null; if (address != null) { DhcpClientLeases dhcpClientLeases = getDhcpClientLeases(); try { routers = dhcpClientLeases.getDhcpGateways(interfaceName, address); } catch (KuraException e) { logger.error("Error getting DHCP DNS servers", e); } } if (routers == null) { routers = new ArrayList<>(); } return routers; }
Source:
protected void sleepJobInfo(JobInfo info) { if (isInfrastructureJob(info.getJob())) return; GroupInfo group = info.getGroupInfo(); if (group != null) { sleepGroup(group,info); } Object[] listenersArray = listeners.getListeners(); for (Object element : listenersArray) { IJobProgressManagerListener listener = (IJobProgressManagerListener) element; if (isNeverDisplaying(info.getJob(), listener.showsDebug())) continue; if (listener.showsDebug()) listener.refreshJobInfo(info); else listener.removeJob(info); } }

Target:
protected void sleepJobInfo(JobInfo info) { if (isInfrastructureJob(info.getJob())) return; GroupInfo group = info.getGroupInfo(); if (group != null) { sleepGroup(group,info); } for (Object element : listeners.getListeners()) { IJobProgressManagerListener listener = (IJobProgressManagerListener) element; if (isNeverDisplaying(info.getJob(), listener.showsDebug())) continue; if (listener.showsDebug()) listener.refreshJobInfo(info); else listener.removeJob(info); } }
Source:
private boolean isPartitionRequired(int opid, List<KafkaConsumer.KafkaMeterStats> kstats) { long t = System.currentTimeMillis(); if (kstats.size() > 0) { logger.debug("Checking offset updates for offset manager"); updateOffsets(kstats); } if (t - lastCheckTime < repartitionCheckInterval) { return false; } if(repartitionInterval < 0){ return false; } if(t - lastRepartitionTime < repartitionInterval) { return false; } kafkaStatsHolder.put(opid, kstats); if (kafkaStatsHolder.size() != currentPartitionInfo.size() || currentPartitionInfo.size() == 0) { return false; } try { { Set<KafkaPartition> existingIds = new HashSet<KafkaPartition>(); for (PartitionInfo pio : currentPartitionInfo) { existingIds.addAll(pio.kpids); } Map<String, List<PartitionMetadata>> partitionsMeta = KafkaMetadataUtil.getPartitionsForTopic(consumer.brokers, consumer.getTopic()); if(partitionsMeta == null){ return false; } for (Map.Entry<String, List<PartitionMetadata>> en : partitionsMeta.entrySet()) { if(en.getValue() == null){ continue; } for (PartitionMetadata pm : en.getValue()) { KafkaPartition pa = new KafkaPartition(en.getKey(), consumer.topic, pm.partitionId()); if(!existingIds.contains(pa)){ newWaitingPartition.add(pa); } } } if (newWaitingPartition.size() != 0) { lastRepartitionTime = t; return true; } } if (strategy == PartitionStrategy.ONE_TO_ONE) { return false; } if (!isPartitionBasedOnLoad) { return false; } boolean b = breakHardConstraint(kstats) || breakSoftConstraint(); return b; } finally { lastCheckTime = System.currentTimeMillis(); } }

Target:
private boolean isPartitionRequired(int opid, List<KafkaConsumer.KafkaMeterStats> kstats) { long t = System.currentTimeMillis(); if (kstats.size() > 0) { logger.debug("Checking offset updates for offset manager"); updateOffsets(kstats); } if (t - lastCheckTime < repartitionCheckInterval) { return false; } if(repartitionInterval < 0){ return false; } if(t - lastRepartitionTime < repartitionInterval) { return false; } kafkaStatsHolder.put(opid, kstats); if (kafkaStatsHolder.size() != currentPartitionInfo.size() || currentPartitionInfo.size() == 0) { return false; } try { { Set<KafkaPartition> existingIds = new HashSet<KafkaPartition>(); for (PartitionInfo pio : currentPartitionInfo) { existingIds.addAll(pio.kpids); } Map<String, List<PartitionMetadata>> partitionsMeta = KafkaMetadataUtil.getPartitionsForTopic(consumer.brokers, consumer.getTopic()); if(partitionsMeta == null){ return false; } for (Map.Entry<String, List<PartitionMetadata>> en : partitionsMeta.entrySet()) { if(en.getValue() == null){ continue; } for (PartitionMetadata pm : en.getValue()) { KafkaPartition pa = new KafkaPartition(en.getKey(), consumer.topic, pm.partitionId()); if(!existingIds.contains(pa)){ newWaitingPartition.add(pa); } } } if (newWaitingPartition.size() != 0) { lastRepartitionTime = t; return true; } } return false; } finally { lastCheckTime = System.currentTimeMillis(); } }
Source:
public void doTransactionScan(DB db) { int keynum = nextKeynum(); String startk = null; String comparable = null; if(startkeyname.equals("true")) { keynum = nextKeynum(); startk = buildKeyName(keynum); } else startk = "false"; int len = scanlength.nextValue().intValue(); HashSet<String> fields = null; if(is_filter.equals("true")) { String compOperation = doCompareOperation(); if (comparevalue.equals("false")) { keynum = nextKeynum(); comparable = buildKeyName(keynum); } else comparable = comparevalue; fields = new HashSet<>(); fields.add("isFilter#true:"+compOperation+":"+comparable); } else { if (!readallfields) { String fieldname = fieldnames.get(fieldchooser.nextValue().intValue()); fields = new HashSet<String>(); fields.add(fieldname); } } db.scan(table, startkeyname, len, fields, new Vector<HashMap<String, ByteIterator>>()); }

Target:
public void doTransactionScan(DB db) { int keynum = nextKeynum(); String startk = null; String comparable = null; if(startkeyname != null) { keynum = nextKeynum(); startk = buildKeyName(keynum); } else startk = "false"; int len = scanlength.nextValue().intValue(); HashSet<String> fields = null; if(is_filter != null) { String compOperation = doCompareOperation(); if (comparevalue == null) { keynum = nextKeynum(); comparable = buildKeyName(keynum); } else comparable = comparevalue; fields = new HashSet<>(); fields.add("isFilter#true:"+compOperation+":"+comparable); } else { if (!readallfields) { String fieldname = fieldnames.get(fieldchooser.nextValue().intValue()); fields = new HashSet<String>(); fields.add(fieldname); } } db.scan(table, startk, len, fields, new Vector<HashMap<String, ByteIterator>>()); }
Source:
public void createNetworkSecurityGroup() throws InterruptedException { NetworkSecurityGroup nsg = createGroup(); server.enqueue(jsonResponse("/networksecuritygroupcreate.json").setResponseCode(200)); final NetworkSecurityGroupApi nsgApi = api.getNetworkSecurityGroupApi(resourcegroup); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/networkSecurityGroups/%s?%s", subscriptionid, resourcegroup, DEFAULT_NSG_NAME, apiVersion); NetworkSecurityGroup result = nsgApi.createOrUpdate(DEFAULT_NSG_NAME, "westus", null, nsg.properties()); assertSent(server, "PUT", path); assertEquals(result.name(), DEFAULT_NSG_NAME); assertEquals(result.location(), "westus"); assertEquals(result.properties().securityRules().size(), 1); assertEquals(result.properties().securityRules().get(0).properties().protocol(), Protocol.Tcp); }

Target:
public void createNetworkSecurityGroup() throws InterruptedException { NetworkSecurityGroup nsg = createGroup(); server.enqueue(jsonResponse("/networksecuritygroupcreate.json").setResponseCode(200)); final NetworkSecurityGroupApi nsgApi = api.getNetworkSecurityGroupApi(resourcegroup); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/networkSecurityGroups/%s?%s", subscriptionid, resourcegroup, DEFAULT_NSG_NAME, apiVersion); String json = String.format("{\"location\":\"%s\",\"properties\":%s}", "westus", new Gson().toJson(nsg.properties())); NetworkSecurityGroup result = nsgApi.createOrUpdate(DEFAULT_NSG_NAME, "westus", null, nsg.properties()); assertSent(server, "PUT", path, json); assertEquals(result.name(), DEFAULT_NSG_NAME); assertEquals(result.location(), "westus"); assertEquals(result.properties().securityRules().size(), 1); assertEquals(result.properties().securityRules().get(0).properties().protocol(), Protocol.Tcp); }
Source:
public WebSocketPanelSender() { connectedProxies = new HashMap<>(); closedProxies= new HashMap<>(); this.webSocketReopenSend = webSocketReopenSend; }

Target:
public WebSocketPanelSender() { connectedProxies = new HashMap<>(); closedProxies= new HashMap<>(); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ServiceV3AuthsPostRequest)) return false; ServiceV3AuthsPostRequest that = (ServiceV3AuthsPostRequest) o; return Objects.equals(getUsername(), that.getUsername()) && Objects.equals(getPolicy(), that.getPolicy()) && Objects.equals(getContext(), that.getContext()) && Objects.equals(getTitle(), that.getTitle()) && Objects.equals(ttl, that.ttl); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ServiceV3AuthsPostRequest)) return false; ServiceV3AuthsPostRequest that = (ServiceV3AuthsPostRequest) o; return Objects.equals(getUsername(), that.getUsername()) && Objects.equals(getPolicy(), that.getPolicy()) && Objects.equals(getContext(), that.getContext()) && Objects.equals(getTitle(), that.getTitle()) && Objects.equals(getTTL(), that.getTTL()); }
Source:
public boolean isValid(TreeReference ref, QueryContext context) { if(ref == null) { return false; } else { ModelQuerySet set = context.getQueryCache(QuerySetCache.class).getModelQuerySet(CurrentModelQuerySet.CURRENT_QUERY_SET_ID); if (set == null) { return false; } return true; } }

Target:
public boolean isValid(TreeReference ref, QueryContext context) { if(ref == null) { return false; } else { ModelQuerySet set = context.getQueryCache(QuerySetCache.class).getModelQuerySet(CurrentModelQuerySet.CURRENT_QUERY_SET_ID); return set != null; } }
Source:
public TokenAuthenticationFilterTest() throws IOException, ServletException { filterChain = mock(FilterChain.class); doAnswer(invocationOnMock -> { capturedContext.set(SecurityContextHolder.getContext()); return null; }).when(filterChain).doFilter(any(), any()); response = mock(HttpServletResponse.class); request = mock(HttpServletRequest.class); filter = new TokenAuthenticationFilter(DigestUtils.sha256Hex("myToken"), "X_TALEND_TOKEN", "AUTH1, AUTH2"); }

Target:
public TokenAuthenticationFilterTest() throws IOException, ServletException { filterChain = mock(FilterChain.class); doAnswer(invocationOnMock -> { capturedAuthentication.set(SecurityContextHolder.getContext().getAuthentication()); return null; }).when(filterChain).doFilter(any(), any()); response = mock(HttpServletResponse.class); request = mock(HttpServletRequest.class); when(request.getServletPath()).thenReturn("/actuator/prometheus"); final RequestMatcher requestMatcher = new AntPathRequestMatcher("/actuator/**"); filter = new TokenAuthenticationFilter("myToken", requestMatcher); }
Source:
private void initCommandExecutor() { if (!cmdExecutorInitialized) { synchronized(LOCK) { if (!cmdExecutorInitialized) { for (CommandEntity cmdEntity : coco.getCommandsWithCallBackEnabled()) { switch(cmdEntity.getCommandStatus()) { case ACTIVE_SYNC: case NOT_STARTED: coco.retrieveCommand(cmdEntity.getId()).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; default: if (!cmdEntity.isCallBackNotified()) { addToCallBackMap(cmdEntity); } break; } } cmdExecutorInitialized = true; } } } }

Target:
private void initCommandExecutor() { if (!cmdExecutorInitialized) { for (CommandEntity cmdEntity : coco.getCommandsWithCallBackEnabled()) { switch(cmdEntity.getCommandStatus()) { case ACTIVE_SYNC: case NOT_STARTED: coco.retrieveCommand(cmdEntity.getId()).setCommandStatus(CommandStatus.FAILED_RESTARTED); break; default: if (!cmdEntity.isCallBackNotified()) { addToCallBackMap(cmdEntity); } break; } } cmdExecutorInitialized = true; } }
Source:
private static void parseEndpointElement(final ConfigurationXMLStreamReader reader, final EndpointBuilder builder) throws ConfigXMLParseException { final int attributeCount = reader.getAttributeCount(); int readTimeout = -1; int writeTimeout = -1; boolean tcpKeepAlive = false; boolean setTcpKeepAlive = false; int heartbeatInterval = -1; for (int i = 0; i < attributeCount; i++) { checkAttributeNamespace(reader, i); switch (reader.getAttributeLocalName(i)) { case "name": { builder.setEndpointName(reader.getAttributeValueResolved(i)); break; } case "read-timeout": { readTimeout = reader.getIntAttributeValueResolved(i, 0, Integer.MAX_VALUE); break; } case "write-timeout": { writeTimeout = reader.getIntAttributeValueResolved(i, 0, Integer.MAX_VALUE); break; } case "tcp-keepalive": { setTcpKeepAlive = true; tcpKeepAlive = reader.getBooleanAttributeValueResolved(i); break; } case "heartbeat-interval": { heartbeatInterval = reader.getIntAttributeValueResolved(i, 0, Integer.MAX_VALUE); break; } default: { throw reader.unexpectedAttribute(i); } } } OptionMap.Builder optionMapBuilder = OptionMap.builder(); if (readTimeout != -1L) { optionMapBuilder.set(Options.READ_TIMEOUT, readTimeout); } if (writeTimeout != -1L) { optionMapBuilder.set(Options.WRITE_TIMEOUT, writeTimeout); } if (setTcpKeepAlive) { optionMapBuilder.set(Options.KEEP_ALIVE, tcpKeepAlive); } if (heartbeatInterval != -1) { optionMapBuilder.set(RemotingOptions.HEARTBEAT_INTERVAL, heartbeatInterval); } builder.buildDefaultConnectionsOptionMap(optionMapBuilder.getMap()); while (reader.hasNext()) { switch (reader.nextTag()) { case START_ELEMENT: { checkElementNamespace(reader); switch (reader.getLocalName()) { case "providers": { parseProvidersElement(reader, builder); break; } case "connections": { parseConnectionsElement(reader, builder); break; } default: throw reader.unexpectedElement(); } break; } case END_ELEMENT: { return; } } } throw reader.unexpectedDocumentEnd(); }

Target:
private static void parseEndpointElement(final ConfigurationXMLStreamReader reader, final EndpointBuilder builder) throws ConfigXMLParseException { if( reader.hasNamespace()) { switch (reader.getNamespaceURI()) { case NS_REMOTING_5_0:{ parseEndpointElement50(reader, builder); break; } case NS_REMOTING_5_1: { parseEndpointElement51(reader, builder); break; } default: { throw reader.unexpectedElement(); } } while (reader.hasNext()) { switch (reader.nextTag()) { case START_ELEMENT: { checkElementNamespace(reader); switch (reader.getLocalName()) { case "providers": { parseProvidersElement(reader, builder); break; } case "connections": { parseConnectionsElement(reader, builder); break; } default: throw reader.unexpectedElement(); } break; } case END_ELEMENT: { return; } } } throw reader.unexpectedDocumentEnd(); } else { throw reader.unexpectedDocumentEnd(); } }
Source:
private void decodeBigInteger(int value) throws Exception { boolean done = false; while (!done) { long lowBits = 0; while (value > 0 && !done) { int b = value & 0xFF; if (b == 0) { done = true; if (lowBits == 0) { } } else if (b != 0xFF) { if (value == 1) { int digit = (b >>> 4) & 0x0F; lowBits = lowBits * 10 + digit; } } value++; } lowBits = -lowBits; } }

Target:
private void decodeBigInteger(int value) throws Exception { long lowBits = 0; while (value > 0) { int b = value & 1; if (b == 0) { if (lowBits == 0) { } } else { lowBits += b; } } lowBits = -lowBits; }
Source:
public void establishTopology(String containerName, String cacheName, long timeout, String... nodes) throws InterruptedException { Set<String> expectedMembers = Stream.of(nodes).sorted().collect(Collectors.toSet()); Cache<?, ?> cache = findCache(containerName, cacheName); if (cache == null) { throw new IllegalStateException(String.format("Cache %s.%s not found", containerName, cacheName)); } cache.addListener(this); try { synchronized (this) { DistributionManager dist = cache.getAdvancedCache().getDistributionManager(); LocalizedCacheTopology topology = dist.getCacheTopology(); Set<String> members = getMembers(topology); long start = System.currentTimeMillis(); long now = start; long endTime = start + timeout; while (!expectedMembers.equals(members)) { logger.debugf("%s != %s, waiting for a topology change event. Current topology id = %d", expectedMembers, members, topology.getTopologyId()); this.wait(endTime - now); now = System.currentTimeMillis(); if (now >= endTime) { throw new InterruptedException(String.format("Cache %s/%s failed to establish view %s within %d ms. Current view is: %s", containerName, cacheName, expectedMembers, timeout, members)); } topology = dist.getCacheTopology(); members = getMembers(topology); } logger.debugf("Cache %s/%s successfully established view %s within %d ms. Topology id = %d", containerName, cacheName, expectedMembers, now - start, topology.getTopologyId()); } } finally { cache.removeListener(this); } }

Target:
public void establishTopology(String containerName, String cacheName, long timeout, String... nodes) throws InterruptedException { Set<String> expectedMembers = Stream.of(nodes).sorted().collect(Collectors.toSet()); Cache<?, ?> cache = findCache(containerName, cacheName); if (cache == null) { throw new IllegalStateException(String.format("Cache %s.%s not found", containerName, cacheName)); } cache.addListener(this); try { synchronized (this) { DistributionManager dist = cache.getAdvancedCache().getDistributionManager(); LocalizedCacheTopology topology = dist.getCacheTopology(); Set<String> members = getMembers(topology); long start = System.currentTimeMillis(); long now = start; long endTime = start + timeout; while (!expectedMembers.equals(members)) { logger.infof("%s != %s, waiting for a topology change event. Current topology id = %d", expectedMembers, members, topology.getTopologyId()); this.wait(endTime - now); now = System.currentTimeMillis(); if (now >= endTime) { throw new InterruptedException(String.format("Cache %s/%s failed to establish view %s within %d ms. Current view is: %s", containerName, cacheName, expectedMembers, timeout, members)); } topology = dist.getCacheTopology(); members = getMembers(topology); } logger.infof("Cache %s/%s successfully established view %s within %d ms. Topology id = %d", containerName, cacheName, expectedMembers, now - start, topology.getTopologyId()); } } finally { cache.removeListener(this); } }
Source:
public boolean hasNext() { if (delegate.hasNext()) { if (limit >= totalItems + returnOneIfNextRowIsNew()) { return true; } } return false; }

Target:
public boolean hasNext() { if (delegate.hasNext()) { if (limit >= totalItemsWithNextEntry()) { return true; } } return false; }
Source:
public HttpResponse execute(HttpUriRequest request) throws IOException { HttpClientContext clientContext = HttpClientContext.create(); if(clientContext.getAttribute(ORIGINAL_HOST_CONTEXT_PARAM) == null) { clientContext.setAttribute(ORIGINAL_HOST_CONTEXT_PARAM, request.getURI().getHost()); } if (StringUtils.isNotEmpty(accessToken)) { clientContext.setUserToken(accessToken); } return httpClient.execute(request, clientContext); }

Target:
public HttpResponse execute(HttpUriRequest request) throws IOException { HttpClientContext clientContext = HttpClientContext.create(); if (clientContext.getAttribute(PreemptiveAuthInterceptor.ORIGINAL_HOST_CONTEXT_PARAM) == null) { clientContext.setAttribute(PreemptiveAuthInterceptor.ORIGINAL_HOST_CONTEXT_PARAM, request.getURI().getHost()); } if (StringUtils.isNotEmpty(accessToken)) { clientContext.setUserToken(accessToken); } return httpClient.execute(request, clientContext); }
Source:
public void deleteCollectionDefaultItemReadGroupForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); String itemGroupString = "ITEM"; int defaultItemRead = Constants.DEFAULT_ITEM_READ; Group role = createDefaultReadGroup(itemGroupString, defaultItemRead); context.restoreAuthSystemState(); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(delete("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isForbidden()); }

Target:
public void deleteCollectionDefaultItemReadGroupForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); String itemGroupString = "ITEM"; int defaultItemRead = Constants.DEFAULT_ITEM_READ; Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead); context.restoreAuthSystemState(); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(delete("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isForbidden()); token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/itemReadGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(role.getID(), role.getName()))); }
Source:
public void scanFile(JavaFileScannerContext context) { super.context = context; if (isRegularExpression) { try { searchPattern = Pattern.compile(headerFormat, Pattern.DOTALL); } catch (RuntimeException e) { throw new IllegalArgumentException("[" + getClass().getSimpleName() + "] Unable to compile the regular expression: " + headerFormat, e); } } else { expectedLines = headerFormat.split("(?:\r)?\n|\r"); } visitFile(context.getFile()); }

Target:
public void scanFile(JavaFileScannerContext context) { super.context = context; if (isRegularExpression) { if (searchPattern == null) { try { searchPattern = Pattern.compile(headerFormat, Pattern.DOTALL); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("[" + getClass().getSimpleName() + "] Unable to compile the regular expression: " + headerFormat, e); } } } else { expectedLines = headerFormat.split("(?:\r)?\n|\r"); } visitFile(context.getFile()); }
Source:
public void testCreateQueryObservesDelete() { getMockContentResolver().insert(TABLE, values("key1", "val1")); subscription = db.createQuery(TABLE, null, null, null, null, false).subscribe(o); o.assertCursor().hasRow("key1", "val1").isExhausted(); getMockContentResolver().delete(TABLE, null, null); o.assertCursor().isExhausted(); }

Target:
public void testCreateQueryObservesDelete() { contentResolver.insert(TABLE, values("key1", "val1")); subscription = db.createQuery(TABLE, null, null, null, null, false).subscribe(o); o.assertCursor().hasRow("key1", "val1").isExhausted(); contentResolver.delete(TABLE, null, null); o.assertCursor().isExhausted(); }
Source:
public SourceDto buildDevfileSource(GithubUrl githubUrl) { return newDto(SourceDto.class) .withLocation(githubUrl.repositoryLocation()) .withType("github") .withBranch(githubUrl.getBranch()); }

Target:
public SourceDto buildDevfileSource(GithubUrl githubUrl) { return newDto(SourceDto.class) .withLocation(githubUrl.repositoryLocation()) .withType("github") .withBranch(githubUrl.getBranch()) .withSparseCheckoutDir(githubUrl.getSubfolder()); }
Source:
public void shutdown() { if (mode == LaunchMode.LOCAL) { ((LocalMode.Controller)this.appIdentifier).shutdown(); } else { try { YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(app.getConf()); yarnClient.start(); yarnClient.killApplication((ApplicationId)this.appIdentifier); yarnClient.stop(); } catch (YarnException e) { e.printStackTrace(); LOG.error("FAILED TO SHUTDOWN PYTHON STREAMING APPLICATION "); LOG.error("Encountered Exception " + e.getMessage()); } catch (IOException e) { LOG.error("FAILED TO SHUTDOWN PYTHON STREAMING APPLICATION "); LOG.error("Encountered Exception " + e.getMessage()); } } }

Target:
public void shutdown() { if (mode == LaunchMode.LOCAL) { ((LocalMode.Controller)this.appIdentifier).shutdown(); } else { try { YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(app.getConf()); yarnClient.start(); yarnClient.killApplication((ApplicationId)this.appIdentifier); yarnClient.stop(); } catch (YarnException e) { e.printStackTrace(); LOG.error("FAILED TO SHUTDOWN PYTHON STREAMING APPLICATION "); LOG.error("Encountered Exception {}" + e.getMessage()); } catch (IOException e) { LOG.error("FAILED TO SHUTDOWN PYTHON STREAMING APPLICATION "); LOG.error("Encountered Exception " + e.getMessage()); } } }
Source:
private String replaceWildCardLikeChars(String operand) { return operand.replace("%",""); }

Target:
private String replaceWildCardLikeChars(String operand) { return operand.replaceAll("%", ".*"); }
Source:
public @NonNull ArrayList<Object[]> getAdjustedTemplateChanges() { ArrayList<Object[]> changes = getTemplateChanges(); ArrayList<Object[]> adjustedChanges = new ArrayList<>(); for (int i = 0; i < changes.size(); i++) { Object[] change = changes.get(i); Object[] adjustedChange = {change[0], change[1]}; switch ((ChangeType)adjustedChange[1]) { case ADD: adjustedChange[0] = TemporaryModel.isChangePendingAdd(this, i); Timber.d("getAdjustedTemplateChanges() change %s ordinal adjusted from %s to %s", i, change[0], adjustedChange[0]); break; case DELETE: default: } adjustedChanges.add(adjustedChange); } return adjustedChanges; }

Target:
public @NonNull ArrayList<Object[]> getAdjustedTemplateChanges() { ArrayList<Object[]> changes = getTemplateChanges(); ArrayList<Object[]> adjustedChanges = new ArrayList<>(); for (int i = 0; i < changes.size(); i++) { Object[] change = changes.get(i); Object[] adjustedChange = {change[0], change[1]}; switch ((ChangeType)adjustedChange[1]) { case ADD: adjustedChange[0] = TemporaryModel.getAdjustedAddOrdinalAtChangeIndex(this, i); Timber.d("getAdjustedTemplateChanges() change %s ordinal adjusted from %s to %s", i, change[0], adjustedChange[0]); break; case DELETE: default: } adjustedChanges.add(adjustedChange); } return adjustedChanges; }
Source:
protected void onStop() { super.onStop(); lifecycleSubject.onNext(LifecycleEvent.STOP); }

Target:
protected void onStop() { lifecycleSubject.onNext(LifecycleEvent.STOP); super.onStop(); }
Source:
public WebServer(String serviceName, InetSocketAddress address) { Preconditions.checkNotNull(serviceName, "Service name cannot be null"); Preconditions.checkNotNull(address, "Server address cannot be null"); mAddress = address; mServiceName = serviceName; QueuedThreadPool threadPool = new QueuedThreadPool(); int webThreadCount = ServerConfiguration.getInt(PropertyKey.WEB_THREADS); threadPool.setMinThreads(webThreadCount * 2 + 1); threadPool.setMaxThreads(webThreadCount * 2 + 100); mServer = new Server(threadPool); mServerConnector = new ServerConnector(mServer); mServerConnector.setPort(mAddress.getPort()); mServerConnector.setHost(mAddress.getAddress().getHostAddress()); mServerConnector.setReuseAddress(true); mServer.addConnector(mServerConnector); try { mServerConnector.open(); } catch (IOException e) { throw new RuntimeException( String.format("Failed to listen on address %s for web server %s", mAddress, mServiceName), e); } System.setProperty("org.apache.jasper.compiler.disablejsr199", "false"); mServletContextHandler = new ServletContextHandler(ServletContextHandler.SECURITY); mServletContextHandler.setContextPath(AlluxioURI.SEPARATOR); mSecurityHandler = (ConstraintSecurityHandler) mServletContextHandler.getSecurityHandler(); for (String s :DISABLED_METHODS.split(",")) { disableHandler(s); } HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] {mServletContextHandler, new DefaultHandler()}); mServer.setHandler(handlers); }

Target:
public WebServer(String serviceName, InetSocketAddress address) { Preconditions.checkNotNull(serviceName, "Service name cannot be null"); Preconditions.checkNotNull(address, "Server address cannot be null"); mAddress = address; mServiceName = serviceName; QueuedThreadPool threadPool = new QueuedThreadPool(); int webThreadCount = ServerConfiguration.getInt(PropertyKey.WEB_THREADS); threadPool.setMinThreads(webThreadCount * 2 + 1); threadPool.setMaxThreads(webThreadCount * 2 + 100); mServer = new Server(threadPool); mServerConnector = new ServerConnector(mServer); mServerConnector.setPort(mAddress.getPort()); mServerConnector.setHost(mAddress.getAddress().getHostAddress()); mServerConnector.setReuseAddress(true); mServer.addConnector(mServerConnector); try { mServerConnector.open(); } catch (IOException e) { throw new RuntimeException( String.format("Failed to listen on address %s for web server %s", mAddress, mServiceName), e); } System.setProperty("org.apache.jasper.compiler.disablejsr199", "false"); mServletContextHandler = new ServletContextHandler(ServletContextHandler.SECURITY | ServletContextHandler.NO_SESSIONS); mServletContextHandler.setContextPath(AlluxioURI.SEPARATOR); mSecurityHandler = (ConstraintSecurityHandler) mServletContextHandler.getSecurityHandler(); for (String s : DISABLED_METHODS.split(",")) { disableMethod(s); } HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] {mServletContextHandler, new DefaultHandler()}); mServer.setHandler(handlers); }
Source:
protected void updateConfiguration() { Configuration configuration = getConfig(); int universeId = MIN_UNIVERSE_ID; if (configuration.get(CONFIG_UNIVERSE) != null) { universeId = Util.coerceToRange(((BigDecimal) configuration.get(CONFIG_UNIVERSE)).intValue(), MIN_UNIVERSE_ID, MAX_UNIVERSE_ID, logger, "universeId"); } if (universe == null) { universe = new Universe(universeId); } else if (universe.getUniverseId() != universeId) { universe.rename(universeId); } packetTemplate.setUniverse(universe.getUniverseId()); receiverNodes.clear(); if (configuration.get(CONFIG_ADDRESS) == null) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Could not initialize sender (address not set) in ArtNet Bridge " + this.thing.getUID()); uninstallScheduler(); logger.error("remote address not set for {}", this.thing.getUID()); return; } else { receiverNodes = IpNode.fromString((String) configuration.get(CONFIG_ADDRESS), ArtnetNode.DEFAULT_PORT); logger.debug("using unicast mode to for {}", receiverNodes.toString(), this.thing.getUID()); } if (configuration.get(CONFIG_LOCAL_ADDRESS) != null) { senderNode = new IpNode((String) configuration.get(CONFIG_LOCAL_ADDRESS)); } logger.debug("originating address is for {}", senderNode, this.thing.getUID()); if (configuration.get(CONFIG_REFRESH_MODE) != null) { refreshAlways = (((String) configuration.get(CONFIG_REFRESH_MODE)).equals("always")); } logger.debug("refresh mode set to always: {}", refreshAlways); super.updateConfiguration(); updateStatus(ThingStatus.ONLINE); logger.debug("updated configuration for ArtNet bridge {}", this.thing.getUID()); }

Target:
protected void updateConfiguration() { Configuration configuration = getConfig(); setUniverse(configuration.get(CONFIG_UNIVERSE), MIN_UNIVERSE_ID, MAX_UNIVERSE_ID); packetTemplate.setUniverse(universe.getUniverseId()); receiverNodes.clear(); if (configuration.get(CONFIG_ADDRESS) == null) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Could not initialize sender (address not set)"); uninstallScheduler(); logger.debug("remote address not set for {}", this.thing.getUID()); return; } else { try { receiverNodes = IpNode.fromString((String) configuration.get(CONFIG_ADDRESS), ArtnetNode.DEFAULT_PORT); logger.debug("using unicast mode to for {}", receiverNodes.toString(), this.thing.getUID()); } catch (IllegalArgumentException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage()); return; } } if (configuration.get(CONFIG_LOCAL_ADDRESS) != null) { senderNode = new IpNode((String) configuration.get(CONFIG_LOCAL_ADDRESS)); } logger.debug("originating address is for {}", senderNode, this.thing.getUID()); if (configuration.get(CONFIG_REFRESH_MODE) != null) { refreshAlways = (((String) configuration.get(CONFIG_REFRESH_MODE)).equals("always")); } logger.debug("refresh mode set to always: {}", refreshAlways); super.updateConfiguration(); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE); logger.debug("updated configuration for ArtNet bridge {}", this.thing.getUID()); }
Source:
public static Collection<Object[]> data() throws IOException { MiniDFSTest.setupFS(); Object[][] data = new Object[][] { { Formats.AVRO, getDFS(), CompressionFormat.Snappy }, { Formats.AVRO, getDFS(), CompressionFormat.Deflate}, { Formats.AVRO, getDFS(), CompressionFormat.Bzip2}, { Formats.AVRO, getFS(), CompressionFormat.Snappy}, { Formats.AVRO, getFS(), CompressionFormat.Deflate}, { Formats.AVRO, getFS(), CompressionFormat.Bzip2}, { Formats.PARQUET, getDFS(), CompressionFormat.Snappy }, { Formats.PARQUET, getDFS(), CompressionFormat.Deflate }, { Formats.PARQUET, getFS(), CompressionFormat.Snappy }, { Formats.PARQUET, getFS(), CompressionFormat.Deflate } }; return Arrays.asList(data); }

Target:
public static Collection<Object[]> data() throws IOException { MiniDFSTest.setupFS(); Object[][] data = new Object[][] { { Formats.AVRO, getDFS(), CompressionType.Snappy }, { Formats.AVRO, getDFS(), CompressionType.Deflate}, { Formats.AVRO, getDFS(), CompressionType.Bzip2}, { Formats.AVRO, getFS(), CompressionType.Snappy}, { Formats.AVRO, getFS(), CompressionType.Deflate}, { Formats.AVRO, getFS(), CompressionType.Bzip2}, { Formats.PARQUET, getDFS(), CompressionType.Snappy }, { Formats.PARQUET, getDFS(), CompressionType.Deflate }, { Formats.PARQUET, getFS(), CompressionType.Snappy }, { Formats.PARQUET, getFS(), CompressionType.Deflate } }; return Arrays.asList(data); }
Source:
private Payload getNextPayload() { try { if (offset >= input.size()) { return null; } ByteSource byteSource = input.slice(offset, readLen); long byteSourceSize = byteSource.size(); Payload nextPayload = new ByteSourcePayload(byteSource); ContentMetadata cm = metaData.toBuilder() .contentLength(byteSourceSize) .contentMD5((HashCode) null) .build(); nextPayload.setContentMetadata(BaseMutableContentMetadata.fromContentMetadata(cm)); offset += byteSourceSize; return nextPayload; } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
private Payload getNextPayload() { ByteSource byteSource; long byteSourceSize; try { if (offset >= input.size()) { return null; } byteSource = input.slice(offset, readLen); byteSourceSize = byteSource.size(); } catch (IOException e) { throw Throwables.propagate(e); } Payload nextPayload = new ByteSourcePayload(byteSource); ContentMetadata cm = metaData.toBuilder() .contentLength(byteSourceSize) .contentMD5((HashCode) null) .build(); nextPayload.setContentMetadata(BaseMutableContentMetadata.fromContentMetadata(cm)); offset += byteSourceSize; return nextPayload; }
Source:
public static LiteralExpression newConstant(Object value, PDataType type, Integer maxLength, Integer scale, ColumnModifier columnModifier) throws SQLException { if (value == null) { if (type == null) { return NULL_EXPRESSION; } return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } PDataType actualType = PDataType.fromLiteral(value); if (!actualType.isCoercibleTo(type, value)) { throw new TypeMismatchException(type, actualType, value.toString()); } value = type.toObject(value, actualType); try { byte[] b = type.toBytes(value, columnModifier); if (type == PDataType.CHAR && maxLength != null && b.length < maxLength) { b = Arrays.copyOf(b, maxLength); } if (b.length == 0) { return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } return new LiteralExpression(value, type, b, maxLength, scale, columnModifier); } catch (IllegalDataException e) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.ILLEGAL_DATA).setRootCause(e).build().buildException(); } }

Target:
public static LiteralExpression newConstant(Object value, PDataType type, Integer maxLength, Integer scale, ColumnModifier columnModifier) throws SQLException { if (value == null) { if (type == null) { return NULL_EXPRESSION; } return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } PDataType actualType = PDataType.fromLiteral(value); if (!actualType.isCoercibleTo(type, value)) { throw new TypeMismatchException(type, actualType, value.toString()); } value = type.toObject(value, actualType); try { byte[] b = type.toBytes(value, columnModifier); if (type == PDataType.CHAR && maxLength != null && b.length != maxLength) { b = SchemaUtil.padChar(b, maxLength); } if (b.length == 0) { return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } return new LiteralExpression(value, type, b, maxLength, scale, columnModifier); } catch (IllegalDataException e) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.ILLEGAL_DATA).setRootCause(e).build().buildException(); } }
Source:
public EncryptedURL encryptURL(String url) { while (url.length() % 50 != 0) url = url + " "; byte[] nonce = rootKey.createNonce(); byte[] cipherText = rootKey.encrypt(url.getBytes(), nonce); Base64.Encoder encoder = Base64.getEncoder(); return new EncryptedURL(encoder.encodeToString(nonce), encoder.encodeToString(cipherText)); }

Target:
public EncryptedURL encryptURL(String url) { while (url.length() % EncryptedURL.PAD_TO_SIZE != 0) url = url + " "; byte[] nonce = rootKey.createNonce(); byte[] cipherText = rootKey.encrypt(url.getBytes(), nonce); Base64.Encoder encoder = Base64.getEncoder(); return new EncryptedURL(encoder.encodeToString(nonce), encoder.encodeToString(cipherText)); }