auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static boolean handleUserInput(final CrashManagerUserInput userInput, final CrashMetaData userProvidedMetaData, final CrashManagerListener listener, final WeakReference<Context> weakContext, final boolean ignoreDefaultHandler) { switch (userInput) { case CrashManagerUserInputDontSend: if (listener != null) { listener.onUserDeniedCrashes(); } deleteStackTraces(weakContext); registerHandler(weakContext, listener, ignoreDefaultHandler); return true; case CrashManagerUserInputSend: Context context = null; if (weakContext != null) { context = weakContext.get(); } if (context == null) { return false; } final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putBoolean(ALWAYS_SEND_KEY, true).commit(); sendCrashes(weakContext, listener, ignoreDefaultHandler, userProvidedMetaData); return true; case CrashManagerUserInputAlwaysSend: sendCrashes(weakContext, listener, ignoreDefaultHandler, userProvidedMetaData); return true; default: return false; } }

Target:
public static boolean handleUserInput(final CrashManagerUserInput userInput, final CrashMetaData userProvidedMetaData, final CrashManagerListener listener, final WeakReference<Context> weakContext, final boolean ignoreDefaultHandler) { switch (userInput) { case CrashManagerUserInputDontSend: if (listener != null) { listener.onUserDeniedCrashes(); } deleteStackTraces(weakContext); registerHandler(weakContext, listener, ignoreDefaultHandler); return true; case CrashManagerUserInputAlwaysSend: Context context = null; if (weakContext != null) { context = weakContext.get(); } if (context == null) { return false; } final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); prefs.edit().putBoolean(ALWAYS_SEND_KEY, true).commit(); sendCrashes(weakContext, listener, ignoreDefaultHandler, userProvidedMetaData); return true; case CrashManagerUserInputSend: sendCrashes(weakContext, listener, ignoreDefaultHandler, userProvidedMetaData); return true; default: return false; } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = this; generateAndStoreKey(); if (initCipher()) { mCryptoObject = new BiometricPrompt.CryptoObject(mCipher); } BiometricManager biometricManager = BiometricManager.from(this); switch (biometricManager.canAuthenticate()) { case BiometricManager.BIOMETRIC_SUCCESS: showBiometricPrompt(); break; default: authError(); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mActivity = this; generateAndStoreKey(); if (initCipher()) { mCryptoObject = new BiometricPrompt.CryptoObject(mCipher); } BiometricManager biometricManager = BiometricManager.from(this); if (biometricManager.canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS) { showBiometricPrompt(); } else { authError(); } }
Source:
public CellPointer(final int tableIndex, final int fieldIndex, final int row) { Preconditions.checkElementIndex(tableIndex, tables.length); Preconditions.checkElementIndex(fieldIndex, tables[tableIndex].numColumns()); Preconditions.checkArgument(row >= 0 && row <= tables[tableIndex].numTuples()); this.tableIndex = tableIndex; this.fieldIndex = fieldIndex; this.row = row; }

Target:
public CellPointer(final int tableIndex, final int fieldIndex, final int row) { Preconditions.checkElementIndex(tableIndex, tables.length, "tableIndex exceeds legal range."); Preconditions.checkElementIndex(fieldIndex, tables[tableIndex].numColumns(), "fieldIndex exceeds legal range."); Preconditions.checkState(row >= 0 && row <= tables[tableIndex].numTuples(), "row number exceeds legal range."); this.tableIndex = tableIndex; this.fieldIndex = fieldIndex; this.row = row; }
Source:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { PrometheusStatsCollector.createAndRegister(); HTTPServer server = new HTTPServer(HOST, PORT, true); IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true))); OpenCensusMetricExporterSpi ocSpi = new OpenCensusMetricExporterSpi(); ocSpi.setExportFilter(m -> !m.name().startsWith(FILTERED_PREFIX)); ocSpi.setPeriod(EXPORT_TIMEOUT); ocSpi.setSendConsistentId(true); ocSpi.setSendInstanceName(true); ocSpi.setSendNodeId(true); cfg.setMetricExporterSpi(ocSpi); return cfg; }

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true))); OpenCensusMetricExporterSpi ocSpi = new OpenCensusMetricExporterSpi(); ocSpi.setExportFilter(m -> !m.name().startsWith(FILTERED_PREFIX)); ocSpi.setPeriod(EXPORT_TIMEOUT); ocSpi.setSendConsistentId(true); ocSpi.setSendInstanceName(true); ocSpi.setSendNodeId(true); cfg.setMetricExporterSpi(ocSpi); return cfg; }
Source:
private void displayShowroomMaps() { enterLoadingState(); mapService.getMostPlayedMaps(TOP_ELEMENT_COUNT, 1).thenAccept(maps -> replaceSearchResult(maps, mostPlayedPane)) .thenCompose(aVoid -> mapService.getHighestRatedMaps(TOP_ELEMENT_COUNT, 1)).thenAccept(maps -> replaceSearchResult(maps, mostLikedPane)) .thenCompose(aVoid -> mapService.getNewestMaps(TOP_ELEMENT_COUNT, 1)).thenAccept(maps -> replaceSearchResult(maps, newestPane)) .thenCompose(aVoid -> mapService.getLadderMaps(TOP_ELEMENT_COUNT, 1).thenAccept(maps -> replaceSearchResult(maps, ladderPane))) .thenCompose(aVoid -> { Optional<Player> currentPlayer = playerService.getCurrentPlayer(); if (!currentPlayer.isPresent()) { throw new IllegalStateException("Current Player not set"); } return mapService.getOwnedMaps(currentPlayer.get().getId(), TOP_ELEMENT_COUNT, 1); }) .thenAccept(mapBeans -> { if (mapBeans.isEmpty()) { ownedPane.setVisible(false); ownedMoreButton.setVisible(false); ownedMoreLabel.setVisible(false); } replaceSearchResult(mapBeans, ownedPane); }) .thenRun(this::enterShowroomState) .exceptionally(throwable -> { logger.warn("Could not populate maps", throwable); return null; }); }

Target:
private void displayShowroomMaps() { enterLoadingState(); mapService.getMostPlayedMaps(TOP_ELEMENT_COUNT, 1).thenAccept(maps -> replaceSearchResult(maps, mostPlayedPane)) .thenCompose(aVoid -> mapService.getHighestRatedMaps(TOP_ELEMENT_COUNT, 1)).thenAccept(maps -> replaceSearchResult(maps, mostLikedPane)) .thenCompose(aVoid -> mapService.getNewestMaps(TOP_ELEMENT_COUNT, 1)).thenAccept(maps -> replaceSearchResult(maps, newestPane)) .thenCompose(aVoid -> mapService.getLadderMaps(TOP_ELEMENT_COUNT, 1).thenAccept(maps -> replaceSearchResult(maps, ladderPane))) .thenCompose(aVoid -> { Player player = playerService.getCurrentPlayer() .orElseThrow(() -> new IllegalStateException("Current player not set")); return mapService.getOwnedMaps(player.getId(), TOP_ELEMENT_COUNT, 1); }) .thenAccept(mapBeans -> { if (mapBeans.isEmpty()) { ownedPane.setVisible(false); ownedMoreButton.setVisible(false); ownedMoreLabel.setVisible(false); } replaceSearchResult(mapBeans, ownedPane); }) .thenRun(this::enterShowroomState) .exceptionally(throwable -> { logger.warn("Could not populate maps", throwable); return null; }); }
Source:
public void close(C connection) throws MuleException { if (!closed.get()) { closed.set(true); delegate.close(connection); } }

Target:
public void close(C connection) throws MuleException { if (closed.compareAndSet(false, true)) { delegate.close(connection); } }
Source:
public static SimpleFeatureCollection getFeatures(String endPoint, String user, String pass, String typeName, ReferencedEnvelope bbox, CoordinateReferenceSystem crs, int maxFeatures, Filter filter) { Map<String, String> query = getQueryParams(typeName, bbox, crs, maxFeatures, filter); query.put("OUTPUTFORMAT", "application/json"); byte[] response = getResponse(endPoint, user, pass, query); try { return parseGeoJSON(new ByteArrayInputStream(response), crs); } catch (Exception e) { if (!isOutputFormatInvalid(new ByteArrayInputStream(response))) { throw new ServiceRuntimeException("Unable to get features"); } LOG.debug(e, "Failed to parse GeoJSON response"); } query.remove("OUTPUTFORMAT"); response = getResponse(endPoint, user, pass, query); try { return OSKARI_GML.decodeFeatureCollection(new ByteArrayInputStream(response), user, pass); } catch (Exception e) { throw new ServiceRuntimeException("Unable to get features"); } }

Target:
public static SimpleFeatureCollection getFeatures(String endPoint, String user, String pass, String typeName, ReferencedEnvelope bbox, CoordinateReferenceSystem crs, int maxFeatures, Filter filter) { Map<String, String> query = getQueryParams(typeName, bbox, crs, maxFeatures, filter); query.put("OUTPUTFORMAT", "application/json"); byte[] response = getResponse(endPoint, user, pass, query); try { return parseGeoJSON(new ByteArrayInputStream(response), crs); } catch (IOException e) { if (!isOutputFormatInvalid(new ByteArrayInputStream(response))) { throw new ServiceRuntimeException("Unable to parse GeoJSON", e); } } query.remove("OUTPUTFORMAT"); response = getResponse(endPoint, user, pass, query); try { return OSKARI_GML.decodeFeatureCollection(new ByteArrayInputStream(response), user, pass); } catch (Exception e) { throw new ServiceRuntimeException("Unable to parse GML", e); } }
Source:
private void determineSendTimeout() { Map<String, Object> props = this.kafkaTemplate.getProducerFactory().getConfigurationProperties(); Object dt = props.get(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG); if (dt == null) { dt = ProducerConfig.configDef().defaultValues().get(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG); } if (dt instanceof Long) { this.sendTimeoutExpression = new ValueExpression<>(((Long) dt) + TIMEOUT_BUFFER); } else if (dt instanceof Integer) { this.sendTimeoutExpression = new ValueExpression<>(Long.valueOf((Integer) dt) + TIMEOUT_BUFFER); } else if (dt instanceof String) { this.sendTimeoutExpression = new ValueExpression<>(Long.parseLong((String) dt) + TIMEOUT_BUFFER); } }

Target:
private void determineSendTimeout() { Map<String, Object> props = this.kafkaTemplate.getProducerFactory().getConfigurationProperties(); Object dt = props.get(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG); if (dt == null) { dt = ProducerConfig.configDef().defaultValues().get(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG); } if (dt instanceof Long) { setSendTimeout(((Long) dt) + TIMEOUT_BUFFER); } else if (dt instanceof Integer) { setSendTimeout(Long.valueOf((Integer) dt) + TIMEOUT_BUFFER); } else if (dt instanceof String) { setSendTimeout(Long.parseLong((String) dt) + TIMEOUT_BUFFER); } }
Source:
private static ImmutableWorkerInfo selectFromEligibleWorkers(final Map<String, ImmutableWorkerInfo> eligibleWorkers) { final TreeSet<ImmutableWorkerInfo> sortedWorkers = Sets.newTreeSet( Comparator.comparing(ImmutableWorkerInfo::getAvailableCapacity).reversed() ); sortedWorkers.addAll(eligibleWorkers.values()); return Iterables.getFirst(sortedWorkers, null); }

Target:
private static ImmutableWorkerInfo selectFromEligibleWorkers(final Map<String, ImmutableWorkerInfo> eligibleWorkers) { return eligibleWorkers.values().stream().max( Comparator.comparing(ImmutableWorkerInfo::getAvailableCapacity) ).orElse(null); }
Source:
public void visitExpressionStatement(ExpressionStatementTree tree) { super.visitExpressionStatement(tree); ExpressionTree expression = tree.expression(); if (expression.is(Tree.Kind.NEW_CLASS) && ((AbstractTypedTree) expression).isTypeSet() && ((JavaType) expression.symbolType()).isTagged(JavaType.DEFERRED)) { JavaType parametrizedTypeWithObject = resolve.parametrizedTypeWithObject((ParametrizedTypeJavaType) getType(((NewClassTree) expression).identifier())); setInferedType(parametrizedTypeWithObject, (DeferredType) expression.symbolType()); } }

Target:
public void visitExpressionStatement(ExpressionStatementTree tree) { super.visitExpressionStatement(tree); ExpressionTree expression = tree.expression(); if (((JavaType) expression.symbolType()).isTagged(JavaType.DEFERRED) && expression.is(Tree.Kind.NEW_CLASS)) { JavaType parametrizedTypeWithObject = resolve.parametrizedTypeWithErasure((ParametrizedTypeJavaType) getType(((NewClassTree) expression).identifier())); setInferedType(parametrizedTypeWithObject, (DeferredType) expression.symbolType()); } }
Source:
public KerberosTicketValidation validateTicket(byte[] token) throws BadCredentialsException { try { return Subject.doAs(this.serviceSubject, new KerberosValidateAction(token)); } catch (PrivilegedActionException e) { throw new BadCredentialsException("Kerberos validation not successful", e); } }

Target:
public KerberosTicketValidation validateTicket(byte[] token) throws BadCredentialsException { init(); try { return Subject.doAs(this.serviceSubject, new KerberosValidateAction(token)); } catch (PrivilegedActionException e) { throw new BadCredentialsException("Kerberos validation not successful", e); } }
Source:
public ApnsConsumer() { final Properties props = new Properties(); props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, resolveKafkaService()); props.put(ConsumerConfig.GROUP_ID_CONFIG, "apns-agents-ocp22"); props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, GenericDeserializer.class); consumer = new KafkaConsumer(props); sender = new PushyApnsSender(); }

Target:
public ApnsConsumer() { final Properties props = new Properties(); props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, resolveKafkaService()); props.put(ConsumerConfig.GROUP_ID_CONFIG, KAFKA_APNS_CONSUMER_GROUP); props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, GenericDeserializer.class); consumer = new KafkaConsumer(props); sender = new PushyApnsSender(); }
Source:
public void unsubscribe() { State oldState; State newState; do { oldState = state.get(); if (oldState.isUnsubscribed) { return; } else { newState = oldState.unsubscribe(); } } while (!state.compareAndSet(oldState, newState)); oldState.subscription.unsubscribe(); }

Target:
public void unsubscribe() { State oldState; State newState; final AtomicReference<State> localState = this.state; do { oldState = localState.get(); if (oldState.isUnsubscribed) { return; } else { newState = oldState.unsubscribe(); } } while (!localState.compareAndSet(oldState, newState)); oldState.subscription.unsubscribe(); }
Source:
public Collection<DiagramElement> getNodeDownStreams(Node pNode) { assert pNode!=null; Set<DiagramElement> downstreamElements = new HashSet<>(); if(isInConstructorCall(pNode)) { Optional<Edge> constructorEdge = getConstructorEdge(pNode); if(constructorEdge.isPresent()) { downstreamElements.addAll(getEdgeDownStreams(constructorEdge.get())); } } else if(isImplicitParameterNodeInConstructorCall(pNode)) { Optional<Edge> constructorEdge = getConstructorEdge(getFirstChild(pNode)); if(constructorEdge.isPresent()) { downstreamElements.addAll(getEdgeDownStreams(constructorEdge.get())); } } else if(pNode.getClass() == CallNode.class) { for(Edge edge: getCalls(pNode)) { downstreamElements.addAll(getEdgeDownStreams(edge)); } } else if (pNode.getClass() == ImplicitParameterNode.class) { downstreamElements.addAll(pNode.getChildren()); for(Node child: pNode.getChildren()) { for(Edge edge: getCalls(child)) { downstreamElements.addAll(getEdgeDownStreams(edge)); } } } return downstreamElements; }

Target:
public Collection<DiagramElement> getNodeDownStreams(Node pNode) { assert pNode!=null; Set<DiagramElement> downstreamElements = new HashSet<>(); if(isConstructorExecution(pNode)) { Optional<Edge> constructorEdge = getConstructorEdge(pNode); if(constructorEdge.isPresent()) { downstreamElements.addAll(getEdgeDownStreams(constructorEdge.get())); } } else if(isConstructedObject(pNode)) { Optional<Edge> constructorEdge = getConstructorEdge(getFirstChild(pNode)); if(constructorEdge.isPresent()) { downstreamElements.addAll(getEdgeDownStreams(constructorEdge.get())); } } else if(pNode.getClass() == CallNode.class) { for(Edge edge: getCalls(pNode)) { downstreamElements.addAll(getEdgeDownStreams(edge)); } } else if (pNode.getClass() == ImplicitParameterNode.class) { downstreamElements.addAll(pNode.getChildren()); for(Node child: pNode.getChildren()) { for(Edge edge: getCalls(child)) { downstreamElements.addAll(getEdgeDownStreams(edge)); } } } return downstreamElements; }
Source:
public MessageStream apply(HttpResponse response) { if (response.getStatusCode() == 204) { return new Messages(ImmutableSet.<Message> of(), ImmutableSet.<Link> of()); } MessagesWithHref messagesWithHref = json.apply(response); List<Message> messages = Lists.newArrayList(); for (MessageWithHref messageWithHref: messagesWithHref) { Message message = messageWithHref.toBuilder().id(getMessageId(messageWithHref.getId())).build(); messages.add(message); } return new Messages(messages, messagesWithHref.getLinks()); }

Target:
public MessageStream apply(HttpResponse response) { if (response.getStatusCode() == 204) { return new Messages(ImmutableSet.<Message> of(), ImmutableSet.<Link> of()); } MessagesWithHref messagesWithHref = json.apply(response); Iterable<Message> messages = Iterables.transform(messagesWithHref, TO_MESSAGE); return new Messages(messages, messagesWithHref.getLinks()); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ArbitraryGranularitySpec that = (ArbitraryGranularitySpec) o; if (!intervals.equals(that.intervals)) { return false; } if (!rollup.equals(that.rollup)) { return false; } if (!timezone.equals(that.timezone)) { return false; } return !(queryGranularity != null ? !queryGranularity.equals(that.queryGranularity) : that.queryGranularity != null); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ArbitraryGranularitySpec that = (ArbitraryGranularitySpec) o; if (!intervals.equals(that.intervals)) { return false; } if (!rollup.equals(that.rollup)) { return false; } if (timezone != null ? !timezone.equals(that.timezone): that.timezone != null) { return false; } return !(queryGranularity != null ? !queryGranularity.equals(that.queryGranularity) : that.queryGranularity != null); }
Source:
protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.integration.redis.inbound.RedisInboundChannelAdapter"); String connectionFactory = element.getAttribute("connection-factory"); if (!StringUtils.hasText(connectionFactory)) { connectionFactory = "redisConnectionFactory"; } builder.addConstructorArgReference(connectionFactory); builder.addPropertyReference("outputChannel", channelName); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "topics"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converter"); if (element.hasAttribute("serializer")) { String serializer = element.getAttribute("serializer"); if (StringUtils.hasText(serializer)) { builder.addPropertyReference("serializer", serializer); } else { builder.addPropertyValue("serializer", null); } } return builder.getBeanDefinition(); }

Target:
protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(RedisInboundChannelAdapter.class); String connectionFactory = element.getAttribute("connection-factory"); if (!StringUtils.hasText(connectionFactory)) { connectionFactory = "redisConnectionFactory"; } builder.addConstructorArgReference(connectionFactory); builder.addPropertyReference("outputChannel", channelName); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "topics"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "error-channel"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "message-converter"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "serializer", true); return builder.getBeanDefinition(); }
Source:
public ListenableFuture<Map<Cell, Value>> getAsync(TableReference tableRef, Map<Cell, Long> timestampByCell) { try (CloseableTrace trace = startLocalTrace("getAsync({}, cells)", LoggingArgs.safeTableOrPlaceholder(tableRef), timestampByCell.size())) { return delegate().getAsync(tableRef, timestampByCell); } }

Target:
public ListenableFuture<Map<Cell, Value>> getAsync(TableReference tableRef, Map<Cell, Long> timestampByCell) { DetachedSpan detachedSpan = DetachedSpan.start(String.format("getAsync(%s, %s cells)", LoggingArgs.safeTableOrPlaceholder(tableRef), timestampByCell.size())); ListenableFuture<Map<Cell, Value>> future = delegate().getAsync(tableRef, timestampByCell); return attachDetachedSpanCompletion(detachedSpan, future, tracingExecutorService); }
Source:
public static void initialize(Path logFileFolder) { String timestamp = TIMESTAMP_FORMAT.format(new Date()); loggingPath = logFileFolder.resolve(timestamp).normalize(); String pathString = loggingPath.toString(); System.setProperty(LOG_FILE_FOLDER, pathString); try { deleteLogFiles(logFileFolder, ((int) Duration.ofDays(5).getSeconds())); } catch (IOException e) { e.printStackTrace(); } }

Target:
public static void initialize(Path logFileFolder) { String timestamp = TIMESTAMP_FORMAT.format(new Date()); loggingPath = logFileFolder.resolve(timestamp).normalize(); String pathString = loggingPath.toString(); System.setProperty(LOG_FILE_FOLDER, pathString); try { deleteLogFiles(logFileFolder, Duration.ofDays(5).getSeconds()); } catch (IOException e) { e.printStackTrace(); } }
Source:
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); for (Tracer tracer : tracers) { local = tracer.start(methodName, local); if (databaseId != null) { tracer.setAttribute(TracerProvider.DB_INSTANCE, databaseId, local); } tracer.setAttribute(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME, local); tracer.setAttribute(TracerProvider.DB_TYPE, DB_TYPE_VALUE, local); tracer.setAttribute(TracerProvider.DB_URL, endpoint, local); tracer.setAttribute(TracerProvider.DB_STATEMENT, methodName, local); } return local; }

Target:
public Context startSpan(String methodName, String databaseId, String endpoint, Context context) { Context local = Objects.requireNonNull(context, "'context' cannot be null."); local = local.addData(AZ_TRACING_NAMESPACE_KEY, RESOURCE_PROVIDER_NAME); local = tracer.start(methodName, local); if (databaseId != null) { tracer.setAttribute(TracerProvider.DB_INSTANCE, databaseId, local); } tracer.setAttribute(TracerProvider.DB_TYPE, DB_TYPE_VALUE, local); tracer.setAttribute(TracerProvider.DB_URL, endpoint, local); tracer.setAttribute(TracerProvider.DB_STATEMENT, methodName, local); return local; }
Source:
public static void register(TableFunctionModule module) { module.register(NAME, new BaseFunctionResolver( FuncParams.builder().withIndependentVarArgs(ANY_ARRAY).build()) { @Override public FunctionImplementation getForTypes(List<DataType> dataTypes) throws IllegalArgumentException { DataType returnType; if (dataTypes.size() == 1) { var dataType = dataTypes.get(0); if (isArray(dataType)) { returnType = ((ArrayType) dataType).innerType(); } else { returnType = dataTypes.get(0); } } else { returnType = ObjectType.untyped(); } return new ValuesTableFunctionImplementation( new FunctionInfo(new FunctionIdent(NAME, dataTypes), returnType, FunctionInfo.Type.TABLE)); } }); }

Target:
public static void register(TableFunctionModule module) { module.register(NAME, new BaseFunctionResolver( FuncParams.builder().withIndependentVarArgs(ANY_ARRAY).build()) { @Override public FunctionImplementation getForTypes(List<DataType> dataTypes) throws IllegalArgumentException { DataType returnType; if (dataTypes.size() == 1) { var dataType = dataTypes.get(0); if (isArray(dataType)) { returnType = ((ArrayType) dataType).innerType(); } else { throw new IllegalArgumentException( "Function argument must have an array data type, but was '" + dataType + "'"); } } else { returnType = ObjectType.untyped(); } return new ValuesTableFunctionImplementation( new FunctionInfo(new FunctionIdent(NAME, dataTypes), returnType, FunctionInfo.Type.TABLE)); } }); }
Source:
private void addDiskMapping() { addStorageDomainMapForCopiedTemplateDisk(); unregisteredDisksDao.removeUnregisteredDisk(getImage().getId(), getParameters().getStorageDomainId()); setSucceeded(true); }

Target:
private void addDiskMapping() { executeInNewTransaction(() -> { addStorageDomainMapForCopiedTemplateDisk(); unregisteredDisksDao.removeUnregisteredDisk(getImage().getId(), getParameters().getStorageDomainId()); incrementDbGenerationForRelatedEntities(); return null; }); setSucceeded(true); }
Source:
public HttpResponse doBuild(@QueryParameter TimeDuration delay) { checkPermission(BUILD); if (!isBuildable()) { throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(getFullName() + " cannot be indexed")); } scheduleBuild2(delay == null ? 0 : delay.getTime(), new CauseAction(new Cause.UserIdCause())); return HttpResponses.forwardToPreviousPage(); }

Target:
public HttpResponse doBuild(@QueryParameter TimeDuration delay) { checkPermission(BUILD); if (!isBuildable()) { throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(getFullName() + " cannot be recomputed")); } scheduleBuild2(delay == null ? 0 : delay.getTime(), new CauseAction(new Cause.UserIdCause())); return HttpResponses.forwardToPreviousPage(); }
Source:
public static void copy(File src, File dst) throws IOException { if(src.isDirectory()){ String[] srcChildren = src.list(); if (srcChildren == null) { srcChildren = new String[0]; } for (String srcChildPathName : srcChildren) { File srcChild = new File(src, srcChildPathName); File dstChild = new File(dst, srcChildPathName); copy(srcChild, dstChild); } } else transferData(src, dst); }

Target:
public static void copy(File src, File dst) throws IOException { if(src.isDirectory()){ String[] srcChildren = src.list(); if (srcChildren == null) { throw new IOException("Content from directory '" + src.getAbsolutePath() + "' can not be listed."); } for (String srcChildPathName : srcChildren) { File srcChild = new File(src, srcChildPathName); File dstChild = new File(dst, srcChildPathName); copy(srcChild, dstChild); } } else transferData(src, dst); }
Source:
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) { NonNullList<ItemStack> remainders = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); for (int index = 0; index < remainders.size(); index++) { ItemStack itemStack = inv.getStackInSlot(index); if (!itemStack.isEmpty()) { Ingredient ingredient = input.get(index); if (ingredient instanceof FluidIngredient) { ItemStack container = itemStack.copy(); container.setCount(1); IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(container); if (fluidHandler != null) { FluidStack checking = fluidHandler.drain(((FluidIngredient)ingredient).getFluidStack(), true); if (checking == null) { fluidHandler.drain(Integer.MAX_VALUE, true); } itemStack = fluidHandler.getContainer(); } } else { itemStack = ForgeHooks.getContainerItem(itemStack); } remainders.set(index, itemStack); } } return remainders; }

Target:
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) { NonNullList<ItemStack> remainders = NonNullList.withSize(inv.getSizeInventory(), ItemStack.EMPTY); for (int index = 0; index < remainders.size(); index++) { ItemStack itemStack = inv.getStackInSlot(index); if (!itemStack.isEmpty()) { Ingredient ingredient = input.get(index); if (ingredient instanceof ICustomContainerCallback) { itemStack = ((ICustomContainerCallback)ingredient).getContainer(itemStack); } else { itemStack = ForgeHooks.getContainerItem(itemStack); } remainders.set(index, itemStack); } } return remainders; }
Source:
private X509Certificate[] getCerts(SSLSessionInfo session) { try { Certificate[] javaCerts = session.getPeerCertificates(); if (javaCerts == null) { return null; } int x509Certs = 0; for (Certificate javaCert : javaCerts) { if (javaCert instanceof X509Certificate) { ++x509Certs; } } if (x509Certs == 0) { return null; } if (x509Certs == javaCerts.length) { return (X509Certificate[]) javaCerts; } X509Certificate[] results = new X509Certificate[x509Certs]; for (int i = 0; i < x509Certs; i++) { results[i] = (X509Certificate) javaCerts[i]; } return results; } catch (Exception e) { return null; } }

Target:
private X509Certificate[] getCerts(SSLSessionInfo session) { try { Certificate[] javaCerts = session.getPeerCertificates(); if (javaCerts == null) { return null; } int x509Certs = 0; for (Certificate javaCert : javaCerts) { if (javaCert instanceof X509Certificate) { ++x509Certs; } } if (x509Certs == 0) { return null; } int resultIndex = 0; X509Certificate[] results = new X509Certificate[x509Certs]; for (Certificate certificate : javaCerts) { if (certificate instanceof X509Certificate) { results[resultIndex++] = (X509Certificate) certificate; } } return results; } catch (Exception e) { return null; } }
Source:
private boolean swiftUpload(final Connection conn, final SwiftTO swift, final String container, final String ldir, final String lfilename, final Boolean isISCSI, final int wait) { List<String> params = getSwiftParams(swift, container, ldir, lfilename, isISCSI); try { String result = hypervisorResource.callHostPluginAsync(conn, "swiftxenserver", "swift", wait, params.toArray(new String[params.size()])); return "true".equals(result); } catch (final Exception e) { s_logger.warn("swift upload failed due to " + e.toString(), e); } return false; }

Target:
private boolean swiftUpload(final Connection conn, final SwiftTO swift, final String container, final String ldir, final String lfilename, final Boolean isISCSI, final int wait) { List<String> params = getSwiftParams(swift, container, ldir, lfilename, isISCSI); try { String result = hypervisorResource.callHostPluginAsync(conn, "swiftxenserver", "swift", wait, params.toArray(new String[params.size()])); return BooleanUtils.toBoolean(result); } catch (final Exception e) { s_logger.warn("swift upload failed due to " + e.toString(), e); } return false; }
Source:
public SetPersistentViewCommand(TransactionalEditingDomain domain, View view) { super(domain, "CreateStereotypePropertyView"); this.view = view; }

Target:
public SetPersistentViewCommand(TransactionalEditingDomain domain, View view) { super(domain, LABEL_COMMAND); this.view = view; }
Source:
public void test() throws Exception { FileSystem fs = FileSystem.get(CachedConfiguration.getInstance()); Path srcPath = new Path(System.getProperty("user.dir") + "/target/TestIterators-tests.jar"); Path dstPath = new Path(CONTEXT_DIR + "/Test.jar"); fs.copyFromLocalFile(srcPath, dstPath); UtilWaitThread.sleep(5000); try { Connector c = getConnector(); c.instanceOperations().setProperty(CONTEXT_PROPERTY, CONTEXT_CLASSPATH); String tableName = getUniqueNames(1)[0]; c.tableOperations().create(tableName); BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig()); for (int i = 0; i < ITERATIONS; i++) { Mutation m = new Mutation("row" + i); m.put("cf", "col1", "Test"); bw.addMutation(m); } bw.close(); scanCheck(c, tableName, null, null, "Test"); batchCheck(c, tableName, null, null, "Test"); IteratorSetting cfg = new IteratorSetting(1, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator"); try { scanCheck(c, tableName, cfg, null, "tseT"); fail("This should have failed because context was not set"); } catch (Exception e) { } try { batchCheck(c, tableName, cfg, null, "tseT"); fail("This should have failed because context was not set"); } catch (Exception e) { } scanCheck(c, tableName, cfg, CONTEXT, "tseT"); batchCheck(c, tableName, cfg, CONTEXT, "tseT"); } finally { fs.delete(dstPath, true); } }

Target:
public void test() throws Exception { Path baseDir = new Path(System.getProperty("user.dir")); Path targetDir = new Path(baseDir, "target"); Path jarPath = new Path(targetDir, "TestIterators-tests.jar"); Path dstPath = new Path(CONTEXT_DIR + "/Test.jar"); fs.copyFromLocalFile(jarPath, dstPath); UtilWaitThread.sleep(WAIT); try { Connector c = getConnector(); c.instanceOperations().setProperty(CONTEXT_PROPERTY, CONTEXT_CLASSPATH); String tableName = getUniqueNames(1)[0]; c.tableOperations().create(tableName); BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig()); for (int i = 0; i < ITERATIONS; i++) { Mutation m = new Mutation("row" + i); m.put("cf", "col1", "Test"); bw.addMutation(m); } bw.close(); scanCheck(c, tableName, null, null, "Test"); batchCheck(c, tableName, null, null, "Test"); IteratorSetting cfg = new IteratorSetting(21, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator"); try { scanCheck(c, tableName, cfg, null, "tseT"); fail("This should have failed because context was not set"); } catch (Exception e) { } try { batchCheck(c, tableName, cfg, null, "tseT"); fail("This should have failed because context was not set"); } catch (Exception e) { } scanCheck(c, tableName, cfg, CONTEXT, "tseT"); batchCheck(c, tableName, cfg, CONTEXT, "tseT"); } finally { fs.delete(dstPath, true); } }
Source:
private DataloadProcess postProcess(DataloadProcess process, File processData, URI postUri) { File tempFile = createTempFile("process", ".zip"); try (FileOutputStream output = new FileOutputStream(tempFile)) { ZipUtils.zip(processData, output); } catch (IOException e) { throw new GoodDataException("Unable to zip process data", e); } Object processToSend; HttpMethod method = HttpMethod.POST; if (tempFile.length() > MAX_MULTIPART_SIZE) { try { process.setPath(dataStoreService.getUri(tempFile.getName()).getPath()); dataStoreService.upload(tempFile.getName(), new FileInputStream(tempFile)); processToSend = process; if (DataloadProcess.TEMPLATE.matches(postUri.toString())) { method = HttpMethod.PUT; } } catch (FileNotFoundException e) { throw new GoodDataException("Unable to access zipped process data", e); } } else { final MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>(2); parts.add("process", process); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MEDIA_TYPE_ZIP); parts.add("data", new HttpEntity<>(new FileSystemResource(tempFile), headers)); processToSend = parts; } try { return restTemplate.exchange(postUri, method, new HttpEntity<>(processToSend), DataloadProcess.class).getBody(); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to post dataload process.", e); } finally { deleteTempFile(tempFile); } }

Target:
private DataloadProcess postProcess(DataloadProcess process, File processData, URI postUri) { File tempFile = createTempFile("process", ".zip"); try (FileOutputStream output = new FileOutputStream(tempFile)) { ZipUtils.zip(processData, output); } catch (IOException e) { throw new GoodDataException("Unable to zip process data", e); } Object processToSend; HttpMethod method = HttpMethod.POST; if (tempFile.length() > MAX_MULTIPART_SIZE) { try { process.setPath(dataStoreService.getUri(tempFile.getName()).getPath()); dataStoreService.upload(tempFile.getName(), new FileInputStream(tempFile)); processToSend = process; if (DataloadProcess.TEMPLATE.matches(postUri.toString())) { method = HttpMethod.PUT; } } catch (FileNotFoundException e) { throw new GoodDataException("Unable to access zipped process data at " + tempFile.getAbsolutePath(), e); } } else { final MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>(2); parts.add("process", process); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MEDIA_TYPE_ZIP); parts.add("data", new HttpEntity<>(new FileSystemResource(tempFile), headers)); processToSend = parts; } try { return restTemplate.exchange(postUri, method, new HttpEntity<>(processToSend), DataloadProcess.class).getBody(); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to post dataload process.", e); } finally { deleteTempFile(tempFile); } }
Source:
public void close() { }

Target:
public void close() { cursor.close(); }
Source:
public void run(final IProgressMonitor monitor) throws CoreException { List<URI> externalResourcesURI = resourceManager.getExternalResources(); List<Resource> resourcesToRemove = new ArrayList<Resource>(externalResourcesURI.size()); for (URI uri : externalResourcesURI) { Resource resource = modelSet.getResource(uri, false); if (null != resource) { try { if (modelSet.shouldSave(resource)) { resource.save(null); } resourcesToRemove.add(resource); } catch (IOException e) { Activator.log.error("There was an error during save.", e); } } } modelSet.getResources().removeAll(resourcesToRemove); resourceManager.clear(); }

Target:
public void run(final IProgressMonitor monitor) throws CoreException { List<URI> externalResourcesURI = resourceManager.getExternalResources(); List<Resource> resourcesToRemove = new ArrayList<Resource>(externalResourcesURI.size()); MultiStatus saveStatus = null; for (URI uri : externalResourcesURI) { Resource resource = modelSet.getResource(uri, false); if (null != resource) { try { if (modelSet.shouldSave(resource)) { resource.save(null); } } catch (IOException e) { if (null == saveStatus) { saveStatus = new MultiStatus(Activator.PLUGIN_ID, SWT.ERROR, "Some resources could not be saved", null); } saveStatus.add(new Status(SWT.ERROR, Activator.PLUGIN_ID, "The resource " + uri.toString() + " could not be saved", e)); } finally { resource.unload(); resourcesToRemove.add(resource); } } } modelSet.getResources().removeAll(resourcesToRemove); resourceManager.clear(); if (null != saveStatus) { throw new CoreException(saveStatus); } }
Source:
@Override protected void beforeTest() throws Exception { startGridsMultiThreaded(GRID_CNT - 2); client = true; Ignite grid = startClientGrid(GRID_CNT - 2); grid.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration()); grid = startClientGrid(GRID_CNT - 1); grid.cache(DEFAULT_CACHE_NAME); }

Target:
@Override protected void beforeTest() throws Exception { startGridsMultiThreaded(GRID_CNT - 2); Ignite grid = startClientGrid(GRID_CNT - 2); grid.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration()); grid = startClientGrid(GRID_CNT - 1); grid.cache(DEFAULT_CACHE_NAME); }
Source:
public Collection<Prefab> listPrefabs(Class<? extends Component> comp) { Collection<Prefab> prefabs = Sets.newHashSet(); prefabs.addAll(assetManager.getLoadedAssets(Prefab.class).stream().filter(p -> p.getComponent(comp) != null).collect(Collectors.toList())); return prefabs; }

Target:
public Collection<Prefab> listPrefabs(Class<? extends Component> comp) { return assetManager.getLoadedAssets(Prefab.class).stream().filter(p -> p.getComponent(comp) != null) .collect(Collectors.toCollection(HashSet::new)); }
Source:
public static FullTextExpression index(@NonNull String name) { if(name == null) { throw new IllegalArgumentException("name is null"); } return new FullTextExpression(name); }

Target:
public static FullTextExpression index(@NonNull String name) { if (name == null) { throw new IllegalArgumentException("name is null."); } return new FullTextExpression(name); }
Source:
public void removeBlock(long sessionId, long blockId, BlockStoreLocation location) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException { LOG.debug("removeBlock: sessionId={}, blockId={}, location={}", sessionId, blockId, location); long lockId = mLockManager.tryLockBlock(sessionId, blockId, BlockLockType.WRITE, REMOVE_BLOCK_TIMEOUT_MS, TimeUnit.MILLISECONDS); if (lockId == BlockLockManager.INVALID_LOCK_ID) { throw new IOException(String.format("Can not acquire lock for block %d", blockId)); } BlockMeta blockMeta; try (LockResource r = new LockResource(mMetadataReadLock)) { if (mMetaManager.hasTempBlockMeta(blockId)) { throw new InvalidWorkerStateException(ExceptionMessage.REMOVE_UNCOMMITTED_BLOCK, blockId); } blockMeta = mMetaManager.getBlockMeta(blockId); if (!blockMeta.getBlockLocation().belongsTo(location)) { throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_NOT_FOUND_AT_LOCATION, blockId, location); } } catch (Exception e) { mLockManager.unlockBlock(lockId); throw e; } try (LockResource r = new LockResource(mMetadataWriteLock)) { removeBlockInternal(blockMeta); } finally { mLockManager.unlockBlock(lockId); } for (BlockStoreEventListener listener : mBlockStoreEventListeners) { synchronized (listener) { listener.onRemoveBlockByClient(sessionId, blockId); listener.onRemoveBlock(sessionId, blockId, blockMeta.getBlockLocation()); } } }

Target:
public void removeBlock(long sessionId, long blockId, BlockStoreLocation location) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException { LOG.debug("removeBlock: sessionId={}, blockId={}, location={}", sessionId, blockId, location); long lockId = mLockManager.tryLockBlock(sessionId, blockId, BlockLockType.WRITE, REMOVE_BLOCK_TIMEOUT_MS, TimeUnit.MILLISECONDS); if (lockId == BlockLockManager.INVALID_LOCK_ID) { throw new IOException( String.format("Can not acquire lock to remove block %d for session %d after %d ms", blockId, sessionId, REMOVE_BLOCK_TIMEOUT_MS)); } BlockMeta blockMeta; try (LockResource r = new LockResource(mMetadataReadLock)) { if (mMetaManager.hasTempBlockMeta(blockId)) { throw new InvalidWorkerStateException(ExceptionMessage.REMOVE_UNCOMMITTED_BLOCK, blockId); } blockMeta = mMetaManager.getBlockMeta(blockId); if (!blockMeta.getBlockLocation().belongsTo(location)) { throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_NOT_FOUND_AT_LOCATION, blockId, location); } } catch (Exception e) { mLockManager.unlockBlock(lockId); throw e; } try (LockResource r = new LockResource(mMetadataWriteLock)) { removeBlockInternal(blockMeta); } finally { mLockManager.unlockBlock(lockId); } for (BlockStoreEventListener listener : mBlockStoreEventListeners) { synchronized (listener) { listener.onRemoveBlockByClient(sessionId, blockId); listener.onRemoveBlock(sessionId, blockId, blockMeta.getBlockLocation()); } } }
Source:
protected void configure(StateMachineExecutor executor) { executor.register(PutCommand.class, this::put); executor.register(GetQuery.class, this::get); executor.register(DeleteCommand.class, this::delete); }

Target:
protected void configure(StateMachineExecutor executor) { executor.register(PutCommand.class, this::put); executor.register(GetCommand.class, this::get); executor.register(DeleteCommand.class, this::delete); }
Source:
public void committed(long epoch, Layout layout, boolean force) throws WrongEpochException { CompletableFuture<Boolean>[] commitList = layout.getLayoutServers().stream() .map(x -> { CompletableFuture<Boolean> cf = new CompletableFuture<>(); try { if (force) { cf = getRuntimeLayout(layout).getLayoutClient(x).force(layout); } else { cf = getRuntimeLayout(layout).getLayoutClient(x).committed(epoch, layout); } } catch (NetworkException e) { cf.completeExceptionally(e); } return cf; }) .toArray(CompletableFuture[]::new); int timeouts = 0; int responses = 0; for (CompletableFuture cf : commitList) { try { CFUtils.getUninterruptibly(cf, WrongEpochException.class, TimeoutException.class, NetworkException.class); responses++; } catch (WrongEpochException e) { if (!force) { throw e; } log.warn("committed: Error while force committing", e); } catch (TimeoutException | NetworkException e) { log.warn("committed: Error while committing", e); timeouts++; } } log.info("committed: Successful requests={}, responses={}, timeouts={}", commitList.length, responses, timeouts); }

Target:
public void committed(long epoch, Layout layout, boolean force) throws WrongEpochException { CompletableFuture<Boolean>[] commitList = layout.getLayoutServers().stream() .map(x -> { CompletableFuture<Boolean> cf = new CompletableFuture<>(); try { if (force) { cf = getRuntimeLayout(layout).getLayoutClient(x).force(layout); } else { cf = getRuntimeLayout(layout).getLayoutClient(x).committed(epoch, layout); } } catch (NetworkException e) { cf.completeExceptionally(e); } return cf; }) .toArray(CompletableFuture[]::new); int responses = 0; for (CompletableFuture cf : commitList) { try { CFUtils.getUninterruptibly(cf, WrongEpochException.class, TimeoutException.class, NetworkException.class, NoBootstrapException.class); responses++; } catch (WrongEpochException e) { if (!force) { throw e; } log.warn("committed: encountered exception", e); } catch (NoBootstrapException | TimeoutException | NetworkException e) { log.warn("committed: encountered exception", e); } } log.debug("committed: Successful requests={}, responses={}", commitList.length, responses); }
Source:
public boolean releaseDomainSpecificVirtualRanges(final long domainId) { final List<DomainVlanMapVO> maps = _domainVlanMapDao.listDomainVlanMapsByDomain(domainId); if (maps != null && !maps.isEmpty()) { try { Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(final TransactionStatus status) { for (DomainVlanMapVO map : maps) { if (!releasePublicIpRange(map.getVlanDbId(), _accountMgr.getSystemUser().getId(), _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM))) { throw new CloudRuntimeException("Failed to release domain specific virtual ip ranges for domain id=" + domainId); } } } }); } catch (final CloudRuntimeException e) { s_logger.error(e); return false; } } else { s_logger.trace("Domain id=" + domainId + " has no domain specific virtual ip ranges, nothing to release"); } return true; }

Target:
public boolean releaseDomainSpecificVirtualRanges(final long domainId) { final List<DomainVlanMapVO> maps = _domainVlanMapDao.listDomainVlanMapsByDomain(domainId); if (CollectionUtils.isNotEmpty(maps)) { try { Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(final TransactionStatus status) { for (DomainVlanMapVO map : maps) { if (!releasePublicIpRange(map.getVlanDbId(), _accountMgr.getSystemUser().getId(), _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM))) { throw new CloudRuntimeException("Failed to release domain specific virtual ip ranges for domain id=" + domainId); } } } }); } catch (final CloudRuntimeException e) { s_logger.error(e); return false; } } else { s_logger.trace("Domain id=" + domainId + " has no domain specific virtual ip ranges, nothing to release"); } return true; }
Source:
private InetSocketAddress resolve(InetSocketAddress address) { try { String curHostString = address.getHostString(); List<InetAddress> resolvedAddresses = new ArrayList<>(Arrays.asList(this.resolver.getAllByName(curHostString))); if (resolvedAddresses.isEmpty()) { return address; } Collections.shuffle(resolvedAddresses); return new InetSocketAddress(resolvedAddresses.get(0), address.getPort()); } catch (UnknownHostException e) { return address; } }

Target:
private InetSocketAddress resolve(InetSocketAddress address) { try { String curHostString = address.getHostString(); List<InetAddress> resolvedAddresses = new ArrayList<>(Arrays.asList(this.resolver.getAllByName(curHostString))); if (resolvedAddresses.isEmpty()) { return address; } Collections.shuffle(resolvedAddresses); return new InetSocketAddress(resolvedAddresses.get(0), address.getPort()); } catch (UnknownHostException e) { LOG.error("Unable to resolve address: {}", address.toString(), e); return address; } }
Source:
public void hasSameValues_checkingAgainstSameInstanceOfAllergy_shouldInterpretAsSameValues() { Allergy allergy = allergy(); allergy.hasSameValues(allergy()); }

Target:
public void hasSameValues_checkingAgainstSameInstanceOfAllergy_shouldInterpretAsSameValues() { Allergy allergy = allergy(); assertThat(allergy.hasSameValues(allergy()),is(true)); }