auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public JExpression generateReader(JBlock body, JVar parcelParam, ASTType type, JClass returnJClassRef, JDefinedClass parcelableClass, JVar identity, JVar readIdentityMap) { ASTType componentType = type.getGenericArgumentTypes().get(0); ReadWriteGenerator generator = generators.getGenerator(componentType); JExpression readExpression = generator.generateReader(body, parcelParam, componentType, generationUtil.ref(componentType), parcelableClass, identity, readIdentityMap); JClass mutableLiveDataType = generationUtil.ref(TYPE); JVar outputVar = body.decl(mutableLiveDataType, namer.generateName(mutableLiveDataType)); body.assign(outputVar, JExpr._new(generationUtil.ref(TYPE))); body.invoke(outputVar, "setValue").arg(readExpression); return outputVar; }

Target:
public JExpression generateReader(JBlock body, JVar parcelParam, ASTType type, JClass returnJClassRef, JDefinedClass parcelableClass, JVar identity, JVar readIdentityMap) { ASTType componentType = type.getGenericArgumentTypes().get(0); ReadWriteGenerator generator = generators.getGenerator(componentType); JExpression readExpression = generator.generateReader(body, parcelParam, componentType, generationUtil.ref(componentType), parcelableClass, identity, readIdentityMap); JClass mutableLiveDataType = generationUtil.ref(TYPE); JVar outputVar = body.decl(mutableLiveDataType, namer.generateName(mutableLiveDataType)); body.assign(outputVar, JExpr._new(mutableLiveDataType)); body.invoke(outputVar, "setValue").arg(readExpression); return outputVar; }
Source:
public DarkClusterConfigMap getDarkClusterConfigMap(String clusterName) throws ServiceUnavailableException { FutureCallback<DarkClusterConfigMap> clusterCountFutureCallback = new FutureCallback<>(); _state.listenToCluster(clusterName, (type, name) -> { ClusterProperties clusterProperties = _state.getClusterProperties(clusterName).getProperty(); if (clusterProperties != null) { clusterCountFutureCallback.onSuccess(clusterProperties.getDarkClusters()); } else { clusterCountFutureCallback.onSuccess(new DarkClusterConfigMap()); } }); try { return clusterCountFutureCallback.get(_timeout, _unit); } catch (ExecutionException | TimeoutException | IllegalStateException | InterruptedException e ) { die("ClusterInfo", "PEGA_1018, unable to retrieve dark cluster info for cluster: " + clusterName + ", exception: " + e); return new DarkClusterConfigMap(); } }

Target:
public DarkClusterConfigMap getDarkClusterConfigMap(String clusterName) throws ServiceUnavailableException { FutureCallback<DarkClusterConfigMap> darkClusterConfigMapFutureCallback = new FutureCallback<>(); _state.listenToCluster(clusterName, (type, name) -> { ClusterProperties clusterProperties = _state.getClusterProperties(clusterName).getProperty(); DarkClusterConfigMap darkClusterConfigMap = clusterProperties != null ? clusterProperties.getDarkClusters() : new DarkClusterConfigMap(); darkClusterConfigMapFutureCallback.onSuccess(darkClusterConfigMap); }); try { return darkClusterConfigMapFutureCallback.get(_timeout, _unit); } catch (ExecutionException | TimeoutException | IllegalStateException | InterruptedException e ) { die("ClusterInfo", "PEGA_1018, unable to retrieve dark cluster info for cluster: " + clusterName + ", exception: " + e); return new DarkClusterConfigMap(); } }
Source:
public void testPublishWithNullMessage() { byte[] testBytes = {}; String testString = "Test"; when(urlService.inputStreamToByteArray(inputStream)).thenReturn(testBytes); when(facebookService.publishToFacebook(any(byte[].class), any(String.class), any(String.class), any(String.class), any(String.class))).thenReturn(testString); Response response = resource.publish(key, "Test", inputStream, contentDisposition, "photo", null, "Test"); String result = (String) response.getEntity(); assertEquals(response.getStatusInfo(), Response.Status.OK); assertEquals(result, "Test"); }

Target:
public void testPublishWithNullMessage() { byte[] testBytes = {}; when(urlService.inputStreamToByteArray(inputStream)).thenReturn(testBytes); when(facebookService.publishToFacebook(any(byte[].class), any(String.class), any(String.class), any(String.class), any(String.class))).thenReturn("Test"); Response response = resource.publish(key, "Test", inputStream, contentDisposition, "photo", null, "Test"); String result = (String) response.getEntity(); assertEquals(response.getStatusInfo(), Response.Status.OK); assertEquals(result, "Test"); }
Source:
public static void oneTimeSetup() { sessionFactory = new SessionFactory(baseConfiguration, "org.neo4j.ogm.persistence.relationships.direct.aa."); }

Target:
public static void oneTimeSetup() { sessionFactory = new SessionFactory(baseConfiguration, "org.neo4j.ogm.persistence.relationships.direct.aa"); }
Source:
private void configureChannelPipelineHandlers() { this.httpClient = this.httpClient.tcpConfiguration(tcpClient -> { if (this.httpClientConfig.getProxy() != null) { tcpClient = tcpClient.proxy(typeSpec -> typeSpec.type(ProxyProvider.Proxy.HTTP).address(this.httpClientConfig.getProxy())); } tcpClient = tcpClient.secure(sslContextSpec -> sslContextSpec.sslContext(this.httpClientConfig.getConfigs().getSslContext())); if (LoggerFactory.getLogger(REACTOR_NETWORK_LOG_CATEGORY).isTraceEnabled()) { tcpClient = tcpClient.wiretap(REACTOR_NETWORK_LOG_CATEGORY, LogLevel.INFO); } tcpClient = tcpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 30 * 1000); return tcpClient; }); }

Target:
private void configureChannelPipelineHandlers() { this.httpClient = this.httpClient.tcpConfiguration(tcpClient -> { if (this.httpClientConfig.getProxy() != null) { tcpClient = tcpClient.proxy(typeSpec -> typeSpec.type(ProxyProvider.Proxy.HTTP).address(this.httpClientConfig.getProxy())); } tcpClient = tcpClient.secure(sslContextSpec -> sslContextSpec.sslContext(this.httpClientConfig.getConfigs().getSslContext())); if (LoggerFactory.getLogger(REACTOR_NETWORK_LOG_CATEGORY).isTraceEnabled()) { tcpClient = tcpClient.wiretap(REACTOR_NETWORK_LOG_CATEGORY, LogLevel.INFO); } tcpClient = tcpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, httpClientConfig.getConfigs().getConnectionAcquireTimeoutInMillis()); return tcpClient; }); }
Source:
protected Cause createUpstreamCause(Run<?, ?> build) { if(Jenkins.getInstance().getPlugin("promoted-builds") != null) { if(build instanceof Promotion) { Promotion promotion = (Promotion)build; return new UpstreamCause((Run<?,?>)promotion.getTarget()); } } return new UpstreamCause((Run) build); }

Target:
protected Cause createUpstreamCause(Run<?, ?> build) { if(Jenkins.getInstance().getPlugin("promoted-builds") != null) { if(build instanceof Promotion) { Promotion promotion = (Promotion)build; return new UpstreamCause((Run<?,?>)promotion.getTarget()); } } return new UpstreamCause(build); }
Source:
private void postToGoogleAnalytics(int position) { String fragmentName = viewPagerAdapter.getItem(position).getClass().getSimpleName(); googleAnalytics(fragmentName); }

Target:
private void postToGoogleAnalytics(int position) { String fragmentName = viewPagerAdapter.getItem(position).getClass().getSimpleName(); GoogleAnalytics.post(this, fragmentName); }
Source:
public Predicate<ChangeData> file(String file) throws QueryParseException { if (allowFileRegex) { if (file.startsWith("^")) { return new RegexFilePredicate(args.dbProvider, args.patchListCache, file); } else { throw new IllegalArgumentException(); } } else { if (file.startsWith("^")) { throw error("regular expression not permitted here: file:" + file); } if (args.indexManager == ChangeIndex.Manager.DISABLED) { throw error("secondary index support is disabled, please enable it first"); } return new EqualsFilePredicate(args.dbProvider, args.patchListCache, file); } }

Target:
public Predicate<ChangeData> file(String file) throws QueryParseException { if (allowFileRegex) { if (file.startsWith("^")) { return new RegexFilePredicate(args.dbProvider, args.patchListCache, file); } else { throw new IllegalArgumentException(); } } else { if (file.startsWith("^")) { throw error("regular expression not permitted here: file:" + file); } if (args.indexManager == ChangeIndex.Manager.DISABLED) { throw error("supplied query is using secondary index while it is disabled"); } return new EqualsFilePredicate(args.dbProvider, args.patchListCache, file); } }
Source:
protected static DefaultConfiguration createRootConfig(Configuration config) { final DefaultConfiguration dc = new DefaultConfiguration(ROOT_MODULE_NAME); if (config != null) { dc.addChild(config); } return dc; }

Target:
protected static DefaultConfiguration createRootConfig(Configuration config) { final DefaultConfiguration dc = new DefaultConfiguration(ROOT_MODULE_NAME); dc.addChild(config); return dc; }
Source:
private void readFully(ZipFileEntry entry, long position, byte[] buffer, int bufferOffset, int bufferLength) throws IOException { long offset = entry.getLocalHeaderOffset(); byte[] fileHeader = new byte[LocalFileHeader.FIXED_DATA_SIZE]; dataInputSource.readFully(offset, fileHeader); offset += fileHeader.length; if (!ZipUtil.arrayStartsWith(fileHeader, ZipUtil.intToLittleEndian(LocalFileHeader.SIGNATURE))) { throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format("The file '%s' is not a correctly formatted zip file: Expected a File Header at file offset %d, but was not present.", entry.getName())); } int nameLength = ZipUtil.getUnsignedShort(fileHeader, LocalFileHeader.FILENAME_LENGTH_OFFSET); int extraFieldLength = ZipUtil.getUnsignedShort(fileHeader, LocalFileHeader.EXTRA_FIELD_LENGTH_OFFSET); offset += (nameLength + extraFieldLength); int compressedSize = (int) entry.getCompressedSize(); byte[] compressedData = new byte[compressedSize]; dataInputSource.readFully(offset, compressedData); InflaterInputStream inflaterInputStream = new InflaterInputStream(new ByteArrayInputStream(compressedData), new Inflater(true)); try { inflaterInputStream.skip(position); int size = chunkedRead(inflaterInputStream, buffer, bufferOffset, bufferLength); checkState(size == bufferLength); } catch (IOException e) { throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format("Malformed zip file: %s", entry.getName())); } }

Target:
private void readFully(ZipFileEntry entry, long position, byte[] buffer, int bufferOffset, int bufferLength) throws IOException { long offset = entry.getLocalHeaderOffset(); byte[] fileHeader = new byte[LOCAL_HEADER_FIXED_DATA_SIZE]; dataInputSource.readFully(offset, fileHeader); offset += fileHeader.length; if (!ZipUtil.arrayStartsWith(fileHeader, ZipUtil.intToLittleEndian(LOCAL_HEADER_SIGNATURE))) { throw new PrestoException( DRUID_SEGMENT_LOAD_ERROR, format("The file '%s' is not a correctly formatted zip file: Expected a File Header at offset %d, but not present.", entry.getName(), offset)); } int nameLength = ZipUtil.getUnsignedShort(fileHeader, LOCAL_HEADER_FILENAME_LENGTH_OFFSET); int extraFieldLength = ZipUtil.getUnsignedShort(fileHeader, LOCAL_HEADER_EXTRA_FIELD_LENGTH_OFFSET); offset += (nameLength + extraFieldLength); int compressedSize = (int) entry.getCompressedSize(); byte[] compressedData = new byte[compressedSize]; dataInputSource.readFully(offset, compressedData); InflaterInputStream inflaterInputStream = new InflaterInputStream(new ByteArrayInputStream(compressedData), new Inflater(true)); try { inflaterInputStream.skip(position); int size = chunkedRead(inflaterInputStream, buffer, bufferOffset, bufferLength); checkState(size == bufferLength); } catch (IOException e) { throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, format("Malformed zip file: %s", entry.getName())); } }
Source:
private void initUniqueOutcomeEventsSentSets() { attributedUniqueOutcomeEventsSentSet = OSUtils.newConcurrentSet(); unattributedUniqueOutcomeEventsSentSet = OSUtils.newConcurrentSet(); Set<String> tempAttributedUniqueOutcomeEventsSentSet = OneSignalPrefs.getStringSet( OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_OS_UNIQUE_OUTCOME_EVENTS_SENT, null ); if (tempAttributedUniqueOutcomeEventsSentSet != null) attributedUniqueOutcomeEventsSentSet.addAll(tempAttributedUniqueOutcomeEventsSentSet); }

Target:
private void initUniqueOutcomeEventsSentSets() { if (unattributedUniqueOutcomeEventsSentSet == null) unattributedUniqueOutcomeEventsSentSet = OSUtils.newConcurrentSet(); attributedUniqueOutcomeEventsSentSet = OSUtils.newConcurrentSet(); Set<String> tempAttributedUniqueOutcomeEventsSentSet = OneSignalPrefs.getStringSet( OneSignalPrefs.PREFS_ONESIGNAL, OneSignalPrefs.PREFS_OS_UNIQUE_OUTCOME_EVENTS_SENT, null ); if (tempAttributedUniqueOutcomeEventsSentSet != null) attributedUniqueOutcomeEventsSentSet.addAll(tempAttributedUniqueOutcomeEventsSentSet); }
Source:
public void failFastContextInitialized(ServletContextEvent event) { ApplicationRouteRegistry registry = ApplicationRouteRegistry .getInstance(new VaadinServletContext( event.getServletContext())); Stream<Class<? extends Component>> hasErrorComponents = findBySuperType( getErrorParameterPackages(), HasErrorParameter.class) .filter(Component.class::isAssignableFrom) .filter(clazz -> clazz != RouteNotFoundError.class) .map(clazz -> (Class<? extends Component>) clazz); final Set<Class<? extends Component>> errorComponents = hasErrorComponents.collect(Collectors.toSet()); if (errorComponents.stream().noneMatch(RouteNotFoundError.class::isAssignableFrom)) { errorComponents.add(SpringRouteNotFoundError.class); } registry.setErrorNavigationTargets(errorComponents); }

Target:
public void failFastContextInitialized(ServletContextEvent event) { ApplicationRouteRegistry registry = ApplicationRouteRegistry .getInstance(new VaadinServletContext( event.getServletContext())); Set<Class<? extends Component>> errorComponents = findBySuperType( getErrorParameterPackages(), HasErrorParameter.class) .filter(Component.class::isAssignableFrom) .filter(clazz -> clazz != RouteNotFoundError.class) .map(clazz -> (Class<? extends Component>) clazz) .collect(Collectors.toSet()); if (errorComponents.stream().noneMatch(RouteNotFoundError.class::isAssignableFrom)) { errorComponents.add(SpringRouteNotFoundError.class); } registry.setErrorNavigationTargets(errorComponents); }
Source:
public void repeatedProcessBatchDoesNotBreakOnItsOwnSuccessfulWrites() { KeyAlreadyExistsException originalException = new KeyAlreadyExistsException( "boo", ImmutableList.of(ENCODING_STRATEGY.encodeStartTimestampAsCell(3L)), ImmutableList.of(ENCODING_STRATEGY.encodeStartTimestampAsCell(2L))); KeyAlreadyExistsException newExistingKeyException = new KeyAlreadyExistsException( "boo", ImmutableList.of(ENCODING_STRATEGY.encodeStartTimestampAsCell(2L))); doThrow(originalException) .doThrow(newExistingKeyException) .doNothing() .when(mockTransactionService) .putUnlessExistsMultiple(anyMap()); TestTransactionBatchElement elementNotExisting = TestTransactionBatchElement.of(2L, 200L); TestTransactionBatchElement elementAlreadyExisting = TestTransactionBatchElement.of(3L, 300L); WriteBatchingTransactionService.processBatch(mockTransactionService, ImmutableList.of( elementNotExisting, elementAlreadyExisting)); verify(mockTransactionService).putUnlessExistsMultiple(ImmutableMap.of(2L, 200L, 3L, 300L)); assertThatThrownBy(() -> elementAlreadyExisting.result().get()).hasCause(originalException); assertThatCode(() -> elementNotExisting.result().get()).doesNotThrowAnyException(); verify(mockTransactionService, atLeastOnce()).getEncodingStrategy(); }

Target:
public void repeatedProcessBatchDoesNotBreakOnItsOwnSuccessfulWrites() { List<Cell> failed = ImmutableList.of(ENCODING_STRATEGY.encodeStartTimestampAsCell(3L)); List<Cell> succeeded = ImmutableList.of(ENCODING_STRATEGY.encodeStartTimestampAsCell(2L)); KeyAlreadyExistsException originalException = new KeyAlreadyExistsException("boo", failed, succeeded); doThrow(originalException) .doNothing() .when(mockTransactionService) .putUnlessExistsMultiple(anyMap()); TestTransactionBatchElement elementNotExisting = TestTransactionBatchElement.of(2L, 200L); TestTransactionBatchElement elementAlreadyExisting = TestTransactionBatchElement.of(3L, 300L); TestTransactionBatchElement elementToRetry = TestTransactionBatchElement.of(4L, 400L); WriteBatchingTransactionService.processBatch(mockTransactionService, ImmutableList.of( elementNotExisting, elementAlreadyExisting, elementToRetry)); verify(mockTransactionService).putUnlessExistsMultiple(ImmutableMap.of(2L, 200L, 3L, 300L, 4L, 400L)); verify(mockTransactionService).putUnlessExistsMultiple(ImmutableMap.of(4L, 400L)); assertThatThrownBy(() -> elementAlreadyExisting.result().get()).hasCause(originalException); assertThatCode(() -> elementNotExisting.result().get()).doesNotThrowAnyException(); assertThatCode(() -> elementToRetry.result().get()).doesNotThrowAnyException(); verify(mockTransactionService, atLeastOnce()).getEncodingStrategy(); }
Source:
protected List<Character> getConfiguredLenientGroupingSeparators() { return CollectionUtility.arrayList('’', '\'', '´'); }

Target:
protected Set<Character> getConfiguredLenientGroupingSeparators() { return CollectionUtility.hashSet( '\'', '´', '`', '’', "\u00B7".charAt(0), "\u0020".charAt(0), "\u2009".charAt(0), "\u202F".charAt(0) ); }
Source:
public void testNettyClientConnectRetryMultipleThread() throws Exception { NettyTestUtil.NettyServerAndClient serverAndClient = createNettyServerAndClient(); UnstableNettyClient unstableNettyClient = new UnstableNettyClient(serverAndClient.client(), 2); PartitionRequestClientFactory factory = new PartitionRequestClientFactory(unstableNettyClient, 2); ConnectionID serverAddress = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), serverAndClient.server().getConfig().getServerPort()), 0); ExecutorService threadPoolExecutor = Executors.newFixedThreadPool(10); List<Future<NettyPartitionRequestClient>> futures = new ArrayList<>(); for (int i = 0; i < 10; i++) { Future<NettyPartitionRequestClient> future = threadPoolExecutor.submit(new Callable<NettyPartitionRequestClient>() { @Override public NettyPartitionRequestClient call() { NettyPartitionRequestClient client = null; try { client = factory.createPartitionRequestClient(serverAddress); } catch (Exception e) { System.out.println(e.getMessage()); fail(); } return client; } }); futures.add(future); } futures.forEach(runnableFuture -> { NettyPartitionRequestClient client = null; try { client = runnableFuture.get(); System.out.println("Result = " + client == null ? "null" : client.toString()); assertNotNull(client); } catch (Exception e) { System.out.println(e.getMessage()); fail(); } }); threadPoolExecutor.shutdown(); serverAndClient.client().shutdown(); serverAndClient.server().shutdown(); }

Target:
public void testNettyClientConnectRetryMultipleThread() throws Exception { NettyTestUtil.NettyServerAndClient serverAndClient = createNettyServerAndClient(); UnstableNettyClient unstableNettyClient = new UnstableNettyClient(serverAndClient.client(), 2); PartitionRequestClientFactory factory = new PartitionRequestClientFactory(unstableNettyClient, 2); ConnectionID serverAddress = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), serverAndClient.server().getConfig().getServerPort()), 0); ExecutorService threadPoolExecutor = Executors.newFixedThreadPool(10); List<Future<NettyPartitionRequestClient>> futures = new ArrayList<>(); for (int i = 0; i < 10; i++) { Future<NettyPartitionRequestClient> future = threadPoolExecutor.submit(new Callable<NettyPartitionRequestClient>() { @Override public NettyPartitionRequestClient call() { NettyPartitionRequestClient client = null; try { client = factory.createPartitionRequestClient(serverAddress); } catch (Exception e) { fail(e.getMessage()); } return client; } }); futures.add(future); } futures.forEach(runnableFuture -> { NettyPartitionRequestClient client = null; try { client = runnableFuture.get(); assertNotNull(client); } catch (Exception e) { System.out.println(e.getMessage()); fail(); } }); threadPoolExecutor.shutdown(); serverAndClient.client().shutdown(); serverAndClient.server().shutdown(); }
Source:
private void removeBucketAndResort(String bucketName) { final HashSet<String> names = new HashSet<>(); if (!buckets.isEmpty()) { final Iterator<QueueBucket> iterator = buckets.iterator(); QueueBucket prev = null; boolean isSorted = true; while (iterator.hasNext()) { QueueBucket b = iterator.next(); if (!names.add(b.getName())) { logger.error("Bucket " + b.getName() + " already existed in the list, removing"); isSorted = false; iterator.remove(); } else if (b.getName().equals(bucketName)) { iterator.remove(); if (!isSorted) break; } else { if (prev != null) { final int compare = comparator.compare(prev, b); isSorted = isSorted && compare <= 0; } prev = b; } } if (!isSorted) { logger.warn("Re-sorting buckets list"); resort(); } } names.clear(); }

Target:
private void removeBucketAndResort(String bucketName) { final HashSet<String> names = new HashSet<>(); if (!buckets.isEmpty()) { final Iterator<QueueBucket> iterator = buckets.iterator(); QueueBucket prev = null; boolean isSorted = true; while (iterator.hasNext()) { QueueBucket b = iterator.next(); if (!names.add(b.getName())) { logger.error("Bucket " + b.getName() + " already existed in the list, removing"); isSorted = false; iterator.remove(); } else if (b.getName().equals(bucketName)) { iterator.remove(); } else { if (prev != null) { final int compare = comparator.compare(prev, b); isSorted = isSorted && compare <= 0; } prev = b; } } logger.warn("Re-sorting buckets list"); resort(); } }
Source:
public void verifyNoDomainForMemoryWhenDomainIsNotDataDomain() { for (StorageDomainType storageDomainType : StorageDomainType.values()) { if (!storageDomainType.isDataDomain()) { validStorageDomain.setStorageDomainType(storageDomainType); verifyNoDomainForMemory(Arrays.asList(validStorageDomain)); } } }

Target:
public void verifyNoDomainForMemoryWhenDomainIsNotDataDomain() { for (StorageDomainType storageDomainType : StorageDomainType.values()) { if (!storageDomainType.isDataDomain()) { validStorageDomain.setStorageDomainType(storageDomainType); verifyNoDomainForMemory(Collections.singletonList(validStorageDomain)); } } }
Source:
public long update() { session.getUser().checkAdmin(); Database db = session.getDatabase(); if (getSchema().resolveTableOrView(session, tableName) != null) { if (ifNotExists) { return 0; } throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, tableName); } int id = getObjectId(); TableLink table = getSchema().createTableLink(id, tableName, driver, url, user, password, originalSchema, originalTable, emitUpdates, force); table.setTemporary(temporary); table.setGlobalTemporary(globalTemporary); table.setComment(comment); table.setReadOnly(readOnly); if(fetchSize!=null){ table.setFetchSize(fetchSize.getValue(session).getInt()); } if (temporary && !globalTemporary) { session.addLocalTempTable(table); } else { db.addSchemaObject(session, table); } return 0; }

Target:
public long update() { session.getUser().checkAdmin(); Database db = session.getDatabase(); if (getSchema().resolveTableOrView(session, tableName) != null) { if (ifNotExists) { return 0; } throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, tableName); } int id = getObjectId(); TableLink table = getSchema().createTableLink(id, tableName, driver, url, user, password, originalSchema, originalTable, emitUpdates, force); table.setTemporary(temporary); table.setGlobalTemporary(globalTemporary); table.setComment(comment); table.setReadOnly(readOnly); if (fetchSize > 0) { table.setFetchSize(fetchSize); } if (temporary && !globalTemporary) { session.addLocalTempTable(table); } else { db.addSchemaObject(session, table); } return 0; }
Source:
public void finishMocking() { Mockito.framework().removeListener(listener); listener.testFinished(new TestFinishedEvent() { public Throwable getFailure() { return null; } public Object getTestClassInstance() { return testClassInstances.get(0); } public String getTestMethodName() { return null; } }); Mockito.validateMockitoUsage(); }

Target:
public void finishMocking() { finishMocking(null); }
Source:
public static Block ipSubnetRange(@SqlType(StandardTypes.IPPREFIX) Slice value) { validateIpPrefixAndGetBytes(value); BlockBuilder blockBuilder = IPADDRESS.createBlockBuilder(null, 2); IPADDRESS.writeSlice(blockBuilder, ipSubnetMin(value)); IPADDRESS.writeSlice(blockBuilder, ipSubnetMax(value)); return blockBuilder.build(); }

Target:
public static Block ipSubnetRange(@SqlType(StandardTypes.IPPREFIX) Slice value) { BlockBuilder blockBuilder = IPADDRESS.createBlockBuilder(null, 2); IPADDRESS.writeSlice(blockBuilder, ipSubnetMin(value)); IPADDRESS.writeSlice(blockBuilder, ipSubnetMax(value)); return blockBuilder.build(); }
Source:
static Object[] createLine(final double... points) { final MultiPath head = new MultiPath() .M(0, 0) .L(0, 0) .L(0, 0) .Z() .setFillAlpha(0) .setStrokeAlpha(0); final MultiPath tail = new MultiPath() .M(DECORATOR_WIDTH, DECORATOR_HEIGHT) .L(0, DECORATOR_HEIGHT) .L(DECORATOR_WIDTH / 2, 0) .Z() .setFillColor(ColorName.BLACK) .setFillAlpha(1); final OrthogonalPolyLine line = new OrthogonalPolyLine(Point2DArray.fromArrayOfDouble(points)); line.setCornerRadius(5); line.setDraggable(true); line.setSelectionStrokeOffset(SELECTION_OFFSET); line.setHeadOffset(head.getBoundingBox().getHeight()); line.setTailOffset(tail.getBoundingBox().getHeight()); final MultiPathDecorator headDecorator = new MultiPathDecorator(head); final MultiPathDecorator tailDecorator = new MultiPathDecorator(tail); return new Object[]{line, headDecorator, tailDecorator}; }

Target:
static Object[] createLine(final double... points) { final MultiPath head = new MultiPath(); final MultiPath tail = new MultiPath() .M(DECORATOR_WIDTH, DECORATOR_HEIGHT) .L(0, DECORATOR_HEIGHT) .L(DECORATOR_WIDTH / 2, 0) .Z() .setFillColor(ColorName.BLACK) .setFillAlpha(1); final OrthogonalPolyLine line = new OrthogonalPolyLine(Point2DArray.fromArrayOfDouble(points)); line.setCornerRadius(5); line.setDraggable(true); line.setSelectionStrokeOffset(SELECTION_OFFSET); line.setHeadOffset(head.getBoundingBox().getHeight()); line.setTailOffset(tail.getBoundingBox().getHeight()); final MultiPathDecorator headDecorator = new MultiPathDecorator(head); final MultiPathDecorator tailDecorator = new MultiPathDecorator(tail); return new Object[]{line, headDecorator, tailDecorator}; }
Source:
public static Optional<BackgroundCompactor> createAndRun(TransactionManager transactionManager, KeyValueService keyValueService, LockService lockService, Supplier<Boolean> inSafeHours) { if (!keyValueService.shouldManuallyCompact()) { return Optional.empty(); } BackgroundCompactor backgroundCompactor = new BackgroundCompactor(transactionManager, keyValueService, lockService, inSafeHours); backgroundCompactor.runInBackground(); return Optional.of(backgroundCompactor); }

Target:
public static Optional<BackgroundCompactor> createAndRun(TransactionManager transactionManager, KeyValueService keyValueService, LockService lockService, Supplier<Boolean> inSafeHours) { if (!keyValueService.shouldTriggerCompactions()) { return Optional.empty(); } BackgroundCompactor backgroundCompactor = new BackgroundCompactor(transactionManager, keyValueService, lockService, inSafeHours); backgroundCompactor.runInBackground(); return Optional.of(backgroundCompactor); }
Source:
public void testNotFound() { assertCodeMakes( GET, URI.create("<LINK_1>"), NOT_FOUND.getStatusCode(), "Not Found", "<itemNotFound code=\"NOT_FOUND.getStatusCode()\" xmlns=\"<LINK_0>\">\n <message>Object not Found</message>\n</itemNotFound>", ResourceNotFoundException.class, "loadbalancers 2000 not found"); }

Target:
public void testNotFound() { assertCodeMakes( GET, URI.create("<LINK_1>"), NOT_FOUND.getStatusCode(), "Not Found", "<itemNotFound code=\"404\" xmlns=\"<LINK_0>\">\n <message>Object not Found</message>\n</itemNotFound>", ResourceNotFoundException.class, "loadbalancers 2000 not found"); }
Source:
public void sendReminderNotification(String label) { String NOTIFICATION_TITLE = label + " " + "\u23f0"; String NOTIFICATION_TEXT = context.getString(R.string.reminders_notification_text); Intent intent = new Intent(context, AddGlucoseActivity.class); intent.putExtra("glucose_reminder_notification", true); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); Notification.Builder notificationBuilder; notificationBuilder = new Notification.Builder(context) .setContentTitle(NOTIFICATION_TITLE) .setContentText(NOTIFICATION_TEXT) .setAutoCancel(true) .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) .setVibrate(new long[]{1000, 1000}) .setContentIntent(pendingIntent) .setSmallIcon(R.drawable.ic_stat_glucosio); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { notificationBuilder.setColor(context.getColor(R.color.glucosio_pink)); } Notification notification = notificationBuilder.build(); NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context); notificationManagerCompat.notify(NOTIFICATION_ID, notification); }

Target:
public void sendReminderNotification(String label) { String notificationTitle = label + " " + "\u23f0"; String[] arrayString = context.getResources().getStringArray(R.array.reminder_title_array); String notificationText = arrayString[generateRandomNumber(0, 1)]; Intent intent = new Intent(context, AddGlucoseActivity.class); intent.putExtra("glucose_reminder_notification", true); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); Notification.Builder notificationBuilder; notificationBuilder = new Notification.Builder(context) .setContentTitle(notificationTitle) .setContentText(notificationText) .setAutoCancel(true) .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) .setVibrate(new long[]{1000, 1000}) .setContentIntent(pendingIntent) .setSmallIcon(R.drawable.ic_stat_glucosio); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { notificationBuilder.setColor(context.getColor(R.color.glucosio_pink)); } Notification notification = notificationBuilder.build(); NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(context); notificationManagerCompat.notify(NOTIFICATION_ID, notification); }
Source:
public void insertTableValuesAnalyzePipeline() throws SemanticException { boolean isPartitionStats = conf.getBoolVar(ConfVars.HIVE_STATS_COLLECT_PART_LEVEL_STATS) && tbl.isPartitioned(); if (isPartitionStats) { partSpec = new HashMap<>(); List<String> partKeys = Utilities.getColumnNamesFromFieldSchema(tbl.getPartitionKeys()); for (String partKey : partKeys) { partSpec.put(partKey, null); } } List<String> colNames = Utilities.getColumnNamesFromFieldSchema(tbl.getCols()); List<String> colTypes = ColumnStatsSemanticAnalyzer.getColumnTypes(tbl, colNames); String command = ColumnStatsSemanticAnalyzer.genRewrittenQuery( tbl, colNames, colTypes, conf, partSpec, isPartitionStats, true); insertAnalyzePipeline(command, true); }

Target:
public void insertTableValuesAnalyzePipeline() throws SemanticException { boolean isPartitionStats = conf.getBoolVar(ConfVars.HIVE_STATS_COLLECT_PART_LEVEL_STATS) && tbl.isPartitioned(); if (isPartitionStats) { partSpec = new HashMap<>(); List<String> partKeys = Utilities.getColumnNamesFromFieldSchema(tbl.getPartitionKeys()); for (String partKey : partKeys) { partSpec.put(partKey, null); } } String command = ColumnStatsSemanticAnalyzer.genRewrittenQuery( tbl, conf, partSpec, isPartitionStats, true); insertAnalyzePipeline(command, true); }
Source:
public Optional<SessionInfo> getSessionInfo(final String sessionId, final String dc) { WebTarget target = webTarget; if (dc != null) { target = target.queryParam("dc", dc); } target = addParams(target.path("info").path(sessionId), QueryOptions.BLANK); List<SessionInfo> sessionInfo = Arrays.asList(target .request().accept(MediaType.APPLICATION_JSON_TYPE).get(SessionInfo[].class)); return sessionInfo != null && sessionInfo.isEmpty() ? Optional.<SessionInfo>absent() : Optional.of(sessionInfo.get(0)); }

Target:
public Optional<SessionInfo> getSessionInfo(final String sessionId, final String dc) { WebTarget target = webTarget; if (dc != null) { target = target.queryParam("dc", dc); } target = addParams(target.path("info").path(sessionId), QueryOptions.BLANK); List<SessionInfo> sessionInfo = target .request().accept(MediaType.APPLICATION_JSON_TYPE) .get(SESSION_INFO_LIST_TYPE); return sessionInfo != null && sessionInfo.isEmpty() ? Optional.<SessionInfo>absent() : Optional.of(sessionInfo.get(0)); }
Source:
public void testMetacardMappers() { transformer.setMetacardMappers(Collections.singletonList(mockMetacardMapper())); InputStream inputStream = new BufferedInputStream(getClass().getResourceAsStream("/FeatureMember.xml")); Optional<Metacard> metacardOptional = transformer.apply(inputStream, mockWfsMetadata()); assertThat(metacardOptional.isPresent(), equalTo(true)); assertThat(metacardOptional.get().getAttribute("title"), notNullValue()); }

Target:
public void testMetacardMappers() throws IOException { transformer.setMetacardMappers(Collections.singletonList(mockMetacardMapper())); try (InputStream inputStream = new BufferedInputStream(getClass().getResourceAsStream("/FeatureMember.xml"))) { Optional<Metacard> metacardOptional = transformer.apply(inputStream, mockWfsMetadata()); assertThat(metacardOptional.isPresent(), equalTo(true)); assertThat(metacardOptional.get().getAttribute("title"), notNullValue()); } }
Source:
public void setClosed(boolean closed) { if (closed && !isClosed()) { builder.endBlock(); builder.characters("\n"); builder.endBlock(); } super.setClosed(closed); }

Target:
public void setClosed(boolean closed) { if (closed && !isClosed()) { builder.endBlock(); builder.endBlock(); } super.setClosed(closed); }
Source:
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() { Map<String, Map<String, PropertyMapping>> ret = new HashMap<>(); Map<String, PropertyMapping> attrs = new LinkedHashMap<>(); if (maxLen >= 0) { val maxLen = PropertyMapping.builder() .propertyNames(new String[]{"maxLen"}) .tfAttrName("maxlen") .build(); attrs.put("maxLen", maxLen); } ret.put(tensorflowName(), attrs); return ret; }

Target:
public Map<String, Map<String, PropertyMapping>> mappingsForFunction() { Map<String, Map<String, PropertyMapping>> ret = new HashMap<>(); Map<String, PropertyMapping> attrs = new LinkedHashMap<>(); if (is_static_maxlen) { val maxLen = PropertyMapping.builder() .propertyNames(new String[]{"maxLen"}) .tfAttrName("maxlen") .build(); attrs.put("maxLen", maxLen); } ret.put(tensorflowName(), attrs); return ret; }
Source:
public int hashCode() { int result = Objects.hashCode(memory); result = 31 * result + Objects.hashCode(vcores); return result; }

Target:
public int hashCode() { int result = Integer.hashCode(memory); result = 31 * result + Integer.hashCode(vcores); return result; }
Source:
public void shouldSaveAConceptNumericWithAllowDecimalValue() throws Exception { Concept c = Context.getConceptService().getConcept(22); ConceptNumeric cn = new ConceptNumeric(c); cn.addDescription(new ConceptDescription("some description", Context.getLocale())); Context.getConceptService().saveConcept(cn); Assert.assertFalse(Context.getConceptService().getConceptNumeric(22).getAllowDecimal()); cn.setAllowDecimal(true); Context.getConceptService().saveConcept(cn); Assert.assertTrue(Context.getConceptService().getConceptNumeric(22).getAllowDecimal()); }

Target:
public void shouldSaveAConceptNumericWithAllowDecimalValue() throws Exception { Concept c = Context.getConceptService().getConcept(22); ConceptNumeric cn = new ConceptNumeric(c); cn.addDescription(new ConceptDescription("some description", null)); Context.getConceptService().saveConcept(cn); Assert.assertFalse(Context.getConceptService().getConceptNumeric(22).getAllowDecimal()); cn.setAllowDecimal(true); Context.getConceptService().saveConcept(cn); Assert.assertTrue(Context.getConceptService().getConceptNumeric(22).getAllowDecimal()); }
Source:
public void testNonTightHtmlTagIntolerantCheck() throws Exception { NonTightHtmlTagIntolerantCheck.visitJavadocTokenMethodCallCount = 0; final DefaultConfiguration checkConfig = createModuleConfig(NonTightHtmlTagIntolerantCheck.class); checkConfig.addAttribute("violateExecutionOnNonTightHtml", "true"); final String[] expected = { "6: " + getCheckMessage(MSG_UNCLOSED_HTML, "p"), "13: " + getCheckMessage(MSG_UNCLOSED_HTML, "p"), "16: " + getCheckMessage(MSG_UNCLOSED_HTML, "li"), "21: " + getCheckMessage(MSG_UNCLOSED_HTML, "p"), "27: " + getCheckMessage(MSG_UNCLOSED_HTML, "tr"), "34: " + getCheckMessage(MSG_UNCLOSED_HTML, "li"), "40: " + getCheckMessage(MSG_UNCLOSED_HTML, "th"), "54: " + getCheckMessage(MSG_UNCLOSED_HTML, "li"), "71: " + getCheckMessage(MSG_UNCLOSED_HTML, "p"), "76: " + getCheckMessage(MSG_UNCLOSED_HTML, "p"), "85: " + getCheckMessage(MSG_UNCLOSED_HTML, "td"), "90: " + getCheckMessage(MSG_UNCLOSED_HTML, "html"), "97: " + getCheckMessage(MSG_UNCLOSED_HTML, "thead"), "124: " + getCheckMessage(MSG_UNCLOSED_HTML, "p"), }; verify(checkConfig, getPath("InputAbstractJavadocNonTightHtmlTags.java"), expected); Assert.assertEquals("Please ensure that method 'visitJavadocToken' is not called " + "more than thrice.", 3, NonTightHtmlTagIntolerantCheck.visitJavadocTokenMethodCallCount); }

Target:
public void testNonTightHtmlTagIntolerantCheck() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NonTightHtmlTagIntolerantCheck.class); checkConfig.addAttribute("violateExecutionOnNonTightHtml", "true"); final String[] expected = { "6: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), "13: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), "16: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "li"), "21: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), "27: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "tr"), "34: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "li"), "54: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "li"), "71: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), "80: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "tr"), "124: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), }; verify(checkConfig, getPath("InputAbstractJavadocNonTightHtmlTags.java"), expected); }
Source:
public CompareDiagramPostProcessor() { super(null, null); }

Target:
public CompareDiagramPostProcessor() { super(Pattern.compile("<LINK_0>\\d.\\d.\\d/notation"), null); }
Source:
public void testCloneBareRepositoryDefaultDirectory() throws IOException, URISyntaxException, JGitInternalException, GitAPIException { CloneCommand command = Git.cloneRepository(); command.setURI(fileUri()); command.setBare(true); command.verifyDirectories(new URIish(fileUri())); File directory = command.getDirectory(); assertEquals(git.getRepository().getWorkTree().getName() + Constants.DOT_GIT_EXT, directory.getName()); }

Target:
public void testCloneBareRepositoryDefaultDirectory() throws IOException, URISyntaxException, JGitInternalException, GitAPIException { CloneCommand command = Git.cloneRepository().setURI(fileUri()).setBare(true); command.verifyDirectories(new URIish(fileUri())); File directory = command.getDirectory(); assertEquals(git.getRepository().getWorkTree().getName() + Constants.DOT_GIT_EXT, directory.getName()); }
Source:
public boolean initializeUnityAds(Activity activity, String gameId) { if (!UnityAds.isSupported()) { Log.w(UnityAdapter.TAG, "The current device is not supported by Unity Ads."); return false; } if (UnityAds.isInitialized()) { return true; } MediationMetaData mediationMetaData = new MediationMetaData(activity); mediationMetaData.setName("AdMob"); mediationMetaData.setVersion(UnityAds.getVersion()); mediationMetaData.set("adapter_version", BuildConfig.VERSION_NAME); mediationMetaData.commit(); UnitySingletonListener listener = unitySingletonInstance.getUnitySingletonListenerInstance(); UnityAds.initialize(activity, gameId, listener, false, true); return true; }

Target:
public boolean initializeUnityAds(Activity activity, String gameId) { if (!UnityAds.isSupported()) { Log.w(UnityAdapter.TAG, "The current device is not supported by Unity Ads."); return false; } if (UnityAds.isInitialized()) { return true; } MediationMetaData mediationMetaData = new MediationMetaData(activity); mediationMetaData.setName("AdMob"); mediationMetaData.setVersion(MobileAds.getVersionString()); mediationMetaData.set("adapter_version", BuildConfig.VERSION_NAME); mediationMetaData.commit(); UnitySingletonListener listener = unitySingletonInstance.getUnitySingletonListenerInstance(); UnityAds.initialize(activity, gameId, listener, false, true); return true; }
Source:
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException { Query<Boolean> connectQuery = new Query<Boolean>() { @Override public void execute(final DataRequestMonitor<Boolean> rm) { connect(new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), rm) { @Override @ConfinedToDsfExecutor("fExecutor") protected void handleCompleted() { if (isSuccess()) { setData(rm.getData()); } rm.done(); updateEnablement(); } }); } }; try { fExecutor.execute(connectQuery); connectQuery.get(); } catch (InterruptedException e) { } catch (ExecutionException e) { } catch (CancellationException e) { } catch (RejectedExecutionException e) { } }

Target:
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException { Query<Boolean> connectQuery = new Query<Boolean>() { @Override public void execute(final DataRequestMonitor<Boolean> rm) { connect(new DataRequestMonitor<Boolean>(ImmediateExecutor.getInstance(), rm) { @Override @ConfinedToDsfExecutor("fExecutor") protected void handleCompleted() { super.handleCompleted(); updateEnablement(); } }); } }; try { fExecutor.execute(connectQuery); connectQuery.get(); } catch (InterruptedException e) { } catch (ExecutionException e) { } catch (CancellationException e) { } catch (RejectedExecutionException e) { } }
Source:
private void updateTypeElementFromATM( AnnotatedTypeMirror newATM, AnnotatedTypeMirror curATM, AnnotatedTypeFactory atf, ATypeElement typeToUpdate, int idx, TypeUseLocation defLoc) { if (idx == 1) { Set<Annotation> annosToRemove = getSupportedAnnosInSet(typeToUpdate.tlAnnotationsHere, atf); typeToUpdate.tlAnnotationsHere.removeAll(annosToRemove); basetypes.put(typeToUpdate.description.toString(), newATM.getUnderlyingType()); } if (curATM.getExplicitAnnotations().isEmpty()) { for (AnnotationMirror am : newATM.getAnnotations()) { addAnnotationsToATypeElement( newATM, typeToUpdate, defLoc, am, curATM.hasEffectiveAnnotation(am)); } } else if (curATM.getKind() == TypeKind.TYPEVAR) { for (AnnotationMirror am : newATM.getAnnotations()) { if (curATM.getAnnotationInHierarchy(am) != null) { break; } addAnnotationsToATypeElement( newATM, typeToUpdate, defLoc, am, curATM.hasEffectiveAnnotation(am)); } } if (newATM.getKind() == TypeKind.ARRAY && curATM.getKind() == TypeKind.ARRAY) { AnnotatedArrayType newAAT = (AnnotatedArrayType) newATM; AnnotatedArrayType oldAAT = (AnnotatedArrayType) curATM; updateTypeElementFromATM( newAAT.getComponentType(), oldAAT.getComponentType(), atf, typeToUpdate.innerTypes.getVivify( new InnerTypeLocation( TypeAnnotationPosition.getTypePathFromBinary( Collections.nCopies(2 * idx, 0)))), idx + 1, defLoc); } }

Target:
private void updateTypeElementFromATM( AnnotatedTypeMirror newATM, AnnotatedTypeMirror curATM, AnnotatedTypeFactory atf, ATypeElement typeToUpdate, int idx, TypeUseLocation defLoc) { if (idx == 1) { Set<Annotation> annosToRemove = getSupportedAnnosInSet(typeToUpdate.tlAnnotationsHere, atf); typeToUpdate.tlAnnotationsHere.removeAll(annosToRemove); } if (curATM.getExplicitAnnotations().isEmpty()) { for (AnnotationMirror am : newATM.getAnnotations()) { addAnnotationsToATypeElement( newATM, typeToUpdate, defLoc, am, curATM.hasEffectiveAnnotation(am)); } } else if (curATM.getKind() == TypeKind.TYPEVAR) { for (AnnotationMirror am : newATM.getAnnotations()) { if (curATM.getAnnotationInHierarchy(am) != null) { break; } addAnnotationsToATypeElement( newATM, typeToUpdate, defLoc, am, curATM.hasEffectiveAnnotation(am)); } } if (newATM.getKind() == TypeKind.ARRAY && curATM.getKind() == TypeKind.ARRAY) { AnnotatedArrayType newAAT = (AnnotatedArrayType) newATM; AnnotatedArrayType oldAAT = (AnnotatedArrayType) curATM; updateTypeElementFromATM( newAAT.getComponentType(), oldAAT.getComponentType(), atf, typeToUpdate.innerTypes.getVivify( new InnerTypeLocation( TypeAnnotationPosition.getTypePathFromBinary( Collections.nCopies(2 * idx, 0)))), idx + 1, defLoc); } }
Source:
private static void descend(Method method, Object model, List<Class<?>> seen, int level) throws Exception { Class<?> type = method.getParameterTypes()[0]; Object child; if (type.getName().equals(XML_GREGORIAN_CALENDAR)) { child = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar(1111, 10, 29)); } else { child = type.newInstance(); } method.invoke(model, child); if ((level == 1 || unseen(method, seen)) && (!XMLGregorianCalendar.class.isAssignableFrom(child.getClass()))) { populate(child, child.getClass(), seen, ++level); } }

Target:
private static void descend(Method method, Object model, List<Class<?>> seen, int level) throws Exception { Class<?> type = method.getParameterTypes()[0]; Object child = type.newInstance(); method.invoke(model, child); if (level == 1 || unseen(method, seen)) { populate(child, child.getClass(), seen, ++level); } }
Source:
private Map<String, Object> getMinionConf() throws ConfigurationException { if (_configFileName != null) { return PinotConfigUtils.readConfigFromFile(_configFileName); } return PinotConfigUtils.generateMinionConf(_minionPort); }

Target:
private Map<String, Object> getMinionConf() throws ConfigurationException, SocketException, UnknownHostException { if (_configFileName != null) { return PinotConfigUtils.readConfigFromFile(_configFileName); } return PinotConfigUtils.generateMinionConf(_minionHost, _minionPort); }
Source:
public JettyRunner(Server server, final LifecycleManager manager) { this.server = server; LOG.info("Jetty server starting"); try { server.start(); int port = -1; for (Connector connector : server.getConnectors()) { if (connector.getName().equals(PLAINTEXT_CONNECTOR_NAME)) { port = ((ServerConnector)connector).getLocalPort(); break; } } this.port = port; LOG.info("Jetty server on port started", port); } catch (Exception e) { try { server.stop(); } catch (Exception e2) { } throw new ProvisionException("Jetty server failed to start", e); } }

Target:
public JettyRunner(Server server, final LifecycleManager manager) { this.server = server; LOG.info("Jetty server starting"); try { server.start(); int port = -1; for (Connector connector : server.getConnectors()) { if (connector.getName().equals(UNENCRYPTED_CONNECTOR_NAME)) { port = ((ServerConnector)connector).getLocalPort(); break; } } this.port = port; LOG.info("Jetty server on port started", port); } catch (Exception e) { try { server.stop(); } catch (Exception e2) { } throw new ProvisionException("Jetty server failed to start", e); } }
Source:
private VdcReturnValueBase restoreCinderDisk(CinderDisk cinderDisk, ImagesContainterParametersBase params) { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RestoreFromCinderSnapshot, params, cloneContextAndDetachFromParent(), new SubjectEntity(VdcObjectType.Storage, cinderDisk.getStorageIds().get(0))); try { return future.get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } return null; }

Target:
private VdcReturnValueBase restoreCinderDisk(CinderDisk cinderDisk, ImagesContainterParametersBase params) { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RestoreFromCinderSnapshot, params, cloneContextAndDetachFromParent(), new SubjectEntity(VdcObjectType.Storage, cinderDisk.getStorageIds().get(0))); try { return future.get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); log.error("Error restoring snapshot"); } return null; }
Source:
public void onNext(Event event) { if (operation == null || operation.isInProgress()) { operation = projectionRepository.startBulkWrite(Durations.ofSeconds(40)); } projectionRepository.internalDispatch(event); operation.checkExpiration(); }

Target:
public void onNext(Event event) { if (projectionRepository.status != Status.CATCHING_UP) { log().info("The catch-up is completing due to an overtime. Skipping event {}.", event); return; } if (projectionRepository.isBulkWriteRequired()) { if (!projectionRepository.isBulkWriteInProgress()) { operation = projectionRepository.startBulkWrite(projectionRepository.catchUpMaxDuration); } operation.checkExpiration(); if (!operation.isInProgress()) { return; } } projectionRepository.internalDispatch(event); }