auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void update(DocumentReference documentReference, Map<String, String> parameters) { try { XWikiContext context = xcontextProvider.get(); XWiki wiki = context.getWiki(); XWikiDocument document = wiki.getDocument(documentReference, context); boolean save = false; String title = parameters.get("title"); if (title != null && !title.equals(document.getTitle())) { document.setTitle(title); save = true; } if (!parentChildConfiguration.isParentChildMechanismEnabled()) { DocumentReference hierarchicalParent = getHierarchicalParent(documentReference); if (!hierarchicalParent.equals(document.getParentReference())) { document.setParentReference(hierarchicalParent.getLocalDocumentReference()); save = true; } } if (save) { wiki.saveDocument(document, "Update document after refactoring.", true, context); this.logger.info("Document has been updated.", documentReference); } } catch (Exception e) { this.logger.error("Failed to update the document after refactoring.", documentReference, e); } }

Target:
public void update(DocumentReference documentReference, Map<String, String> parameters) { try { XWikiContext context = xcontextProvider.get(); XWiki wiki = context.getWiki(); XWikiDocument document = wiki.getDocument(documentReference, context); boolean save = false; String title = parameters.get("title"); if (title != null && !title.equals(document.getTitle())) { document.setTitle(title); save = true; } if (!parentChildConfiguration.isParentChildMechanismEnabled()) { DocumentReference hierarchicalParent = getHierarchicalParent(documentReference); String hierarchicalParentSerialized = this.compactEntityReferenceSerializer .serialize(hierarchicalParent, documentReference); EntityReference relativeHierarchicalReference = this.relativeStringEntityReferenceResolver .resolve(hierarchicalParentSerialized, EntityType.DOCUMENT); EntityReference newDocumentParentRef = document.getRelativeParentReference(); if (!relativeHierarchicalReference.equals(newDocumentParentRef)) { document.setParentReference(relativeHierarchicalReference); save = true; } } if (save) { wiki.saveDocument(document, "Update document after refactoring.", true, context); this.logger.info("Document has been updated.", documentReference); } } catch (Exception e) { this.logger.error("Failed to update the document after refactoring.", documentReference, e); } }
Source:
public void testSortedPositionLinks() { JoinFilterFunction filterFunction = (leftAddress, rightPosition, rightPage) -> BIGINT.getLong(TEST_PAGE.getBlock(0), leftAddress) > 4; PositionLinks.FactoryBuilder factoryBuilder = buildSortedPositionLinks(); PositionLinks positionLinks = factoryBuilder.build().create(ImmutableList.of(filterFunction)); assertEquals(positionLinks.start(0, 0, TEST_PAGE), 5); assertEquals(positionLinks.next(5, 0, TEST_PAGE), 6); assertEquals(positionLinks.next(6, 0, TEST_PAGE), -1); assertEquals(positionLinks.start(10, 0, TEST_PAGE), 10); assertEquals(positionLinks.next(10, 0, TEST_PAGE), 11); assertEquals(positionLinks.next(11, 0, TEST_PAGE), 12); assertEquals(positionLinks.next(12, 0, TEST_PAGE), -1); }

Target:
public void testSortedPositionLinks() { JoinFilterFunction filterFunction = (leftAddress, rightPosition, rightPage) -> BIGINT.getLong(TEST_PAGE.getBlock(0), leftAddress) > 4; PositionLinks.FactoryBuilder factoryBuilder = buildSortedPositionLinks(); PositionLinks positionLinks = factoryBuilder.build().create(ImmutableList.of(filterFunction)); assertEquals(positionLinks.start(0, 0, TEST_PAGE), 5); assertEquals(positionLinks.next(5, 0, TEST_PAGE), 6); assertEquals(positionLinks.next(6, 0, TEST_PAGE), -1); assertEquals(positionLinks.start(7, 0, TEST_PAGE), 7); assertEquals(positionLinks.next(7, 0, TEST_PAGE), -1); assertEquals(positionLinks.start(8, 0, TEST_PAGE), 8); assertEquals(positionLinks.next(8, 0, TEST_PAGE), -1); assertEquals(positionLinks.start(9, 0, TEST_PAGE), 9); assertEquals(positionLinks.next(9, 0, TEST_PAGE), -1); assertEquals(positionLinks.start(10, 0, TEST_PAGE), 10); assertEquals(positionLinks.next(10, 0, TEST_PAGE), 11); assertEquals(positionLinks.next(11, 0, TEST_PAGE), 12); assertEquals(positionLinks.next(12, 0, TEST_PAGE), -1); assertEquals(positionLinks.start(13, 0, TEST_PAGE), 13); assertEquals(positionLinks.next(13, 0, TEST_PAGE), -1); }
Source:
private void lineLengthViolation(int lineNumber, int lineLength, int lengthLimit, Rules rule, String msg) { String lengthVersusLimit = " (" + lineLength + "/" + lengthLimit + ")"; Location location; if (rule == Rules.MAX_LINE_LENGTH) { location = new Location(lineNumber, lengthLimit + 1); } else { location = new Location(lineNumber, lengthLimit); } this.printer.error(rule, Messages.LINE + msg + lengthVersusLimit, location); }

Target:
private void lineLengthViolation(int lineNumber, int lineLength, int lengthLimit, Rules rule, String msg) { String lengthVersusLimit = " (" + lineLength + "/" + lengthLimit + ")"; Location location = new Location(lineNumber, lengthLimit + 1); this.printer.error(rule, Messages.LINE + msg + lengthVersusLimit, location); }
Source:
public <K, V> RemoteCache<K, V> getCache(boolean forceReturnValue) { return remoteCacheManager.getCache(); }

Target:
public <K, V> RemoteCache<K, V> getCache(boolean forceReturnValue) { return this.remoteCacheManager.getCache(); }
Source:
public void testExceptionPropagation() throws Exception { try (Ignite srv = startGrid("server")) { try (Ignite client = startGrid("client", getConfiguration("client").setClientMode(true))) { try { client.services().deployClusterSingleton("my-service", new ServiceImpl()); fail("Deployment exception has been expected."); } catch (ServiceDeploymentException ex) { assertTrue(ex.getSuppressed()[0].getMessage().contains("ServiceImpl init exception")); return; } fail("<LINK_0>"); } } }

Target:
public void testExceptionPropagation() throws Exception { try (IgniteEx srv = startGrid("server")) { try (Ignite client = startGrid("client", getConfiguration("client").setClientMode(true))) { final String srvcName = "my-service"; try { client.services().deployClusterSingleton(srvcName, new ServiceImpl()); fail("Deployment exception has been expected."); } catch (ServiceDeploymentException ex) { String errMsg = ex.getSuppressed()[0].getMessage(); assertTrue(errMsg.contains(srv.cluster().localNode().id().toString())); assertTrue(errMsg.contains(srvcName)); Throwable cause = ex.getSuppressed()[0].getCause(); assertTrue(cause.getMessage().contains("ServiceImpl init exception")); } } } }
Source:
public synchronized void flush() throws IOException { checkFlushException(); for (int i = 0; i <= executionOptions.getMaxRetries(); i++) { try { attemptFlush(); batchCount = 0; break; } catch (SQLException e) { LOG.error("JDBC executeBatch error, retry times = {}", i, e); if (i >= executionOptions.getMaxRetries()) { throw new IOException(e); } try { connection = connectionProvider.reestablishConnection(); jdbcStatementExecutor.closeStatements(); jdbcStatementExecutor.prepareStatements(connection); } catch (Exception excpetion) { LOG.error("JDBC connection is not valid, and reestablish connection failed.", excpetion); throw new IOException("Reestablish JDBC connection failed", excpetion); } try { Thread.sleep(1000 * i); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new IOException("unable to flush; interrupted while doing another attempt", e); } } } }

Target:
public synchronized void flush() throws IOException { checkFlushException(); for (int i = 0; i <= executionOptions.getMaxRetries(); i++) { try { attemptFlush(); batchCount = 0; break; } catch (SQLException e) { LOG.error("JDBC executeBatch error, retry times = {}", i, e); if (i >= executionOptions.getMaxRetries()) { throw new IOException(e); } try { if (!connectionProvider.isConnectionValid()){ connection = connectionProvider.reestablishConnection(); jdbcStatementExecutor.closeStatements(); jdbcStatementExecutor.prepareStatements(connection); } } catch (Exception excpetion) { LOG.error("JDBC connection is not valid, and reestablish connection failed.", excpetion); throw new IOException("Reestablish JDBC connection failed", excpetion); } try { Thread.sleep(1000 * i); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new IOException("unable to flush; interrupted while doing another attempt", e); } } } }
Source:
public static UserGroup getUserGroupFromLiferayUser(com.liferay.portal.model.User user) { try { List<String> roleNames = user.getRoles().stream() .map(Role::getName) .collect(Collectors.toList()); if (roleNames.contains(PortalConstants.ROLENAME_SW360_ADMIN)) { return UserGroup.SW360_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_CLEARING_ADMIN)) { return UserGroup.CLEARING_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_ECC_ADMIN)) { return UserGroup.ECC_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_SECURITY_ADMIN)) { return UserGroup.SECURITY_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_ADMIN)) { return UserGroup.ADMIN; } } catch (SystemException e) { log.error("Problem retrieving UserGroup", e); } return UserGroup.USER; }

Target:
public static UserGroup getUserGroupFromLiferayUser(com.liferay.portal.model.User user) { try { List<String> roleNames = user.getRoles().stream() .map(Role::getName) .collect(Collectors.toList()); if (roleNames.contains(PortalConstants.ROLENAME_ADMIN)) { return UserGroup.ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_SW360_ADMIN)) { return UserGroup.SW360_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_CLEARING_ADMIN)) { return UserGroup.CLEARING_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_ECC_ADMIN)) { return UserGroup.ECC_ADMIN; } else if (roleNames.contains(PortalConstants.ROLENAME_SECURITY_ADMIN)) { return UserGroup.SECURITY_ADMIN; } } catch (SystemException e) { log.error("Problem retrieving UserGroup", e); } return UserGroup.USER; }
Source:
private String ensureTrailingSlashPresent(String path) { if (path == "") { path = "/"; } else if (!path.substring(path.length() - 1).equals("/")) { path += "/"; } return path; }

Target:
private String ensureTrailingSlashPresent(String path) { if (!path.endsWith(PATH_SEPARATOR)) { path = path + PATH_SEPARATOR; } return path; }
Source:
public double getRate() { try { return getRateSafely(); } catch (Exception e) { LogKitten.ex(e); return 0; } }

Target:
public double getRate() { try { return getRateSafely(); } catch (InvalidSensorException e) { LogKitten.ex(e); return 0; } }
Source:
public PartitionedOutputOperator( OperatorContext operatorContext, List<Type> sourceTypes, Function<Page, Page> pagePreprocessor, PartitionFunction partitionFunction, List<Integer> partitionChannels, List<Optional<NullableValue>> partitionConstants, boolean replicatesAnyRow, OptionalInt nullChannel, OutputBuffer outputBuffer, PagesSerdeFactory serdeFactory, DataSize maxMemory) { this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.pagePreprocessor = requireNonNull(pagePreprocessor, "pagePreprocessor is null"); this.partitionFunction = new PagePartitioner( partitionFunction, partitionChannels, partitionConstants, replicatesAnyRow, nullChannel, outputBuffer, serdeFactory, sourceTypes, maxMemory); operatorContext.setInfoSupplier(this::getInfo); this.systemMemoryContext = operatorContext.newLocalSystemMemoryContext(); this.systemMemoryContext.setBytes(this.partitionFunction.getSizeInBytes()); }

Target:
public PartitionedOutputOperator( OperatorContext operatorContext, List<Type> sourceTypes, Function<Page, Page> pagePreprocessor, PartitionFunction partitionFunction, List<Integer> partitionChannels, List<Optional<NullableValue>> partitionConstants, boolean replicatesAnyRow, OptionalInt nullChannel, OutputBuffer outputBuffer, PagesSerdeFactory serdeFactory, DataSize maxMemory) { this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.pagePreprocessor = requireNonNull(pagePreprocessor, "pagePreprocessor is null"); this.partitionFunction = new PagePartitioner( partitionFunction, partitionChannels, partitionConstants, replicatesAnyRow, nullChannel, outputBuffer, serdeFactory, sourceTypes, maxMemory); operatorContext.setInfoSupplier(this::getInfo); this.systemMemoryContext = operatorContext.newLocalSystemMemoryContext(); this.partitionsInitialRetainedSize = this.partitionFunction.getRetainedSizeInBytes(); this.systemMemoryContext.setBytes(partitionsInitialRetainedSize); }
Source:
public Map<TaskId, Long> taskOffsetSums() { if (taskOffsetSumsCache == null) { taskOffsetSumsCache = new HashMap<>(); if (data.version() >= MIN_VERSION_OFFSET_SUM_SUBSCRIPTION) { for (final TaskOffsetSum topicGroup : data.taskOffsetSums()) { for (final PartitionToOffsetSum partitionOffsetSum : topicGroup.partitionToOffsetSum()) { taskOffsetSumsCache.put(new TaskId(topicGroup.topicGroupId(), partitionOffsetSum.partition()), partitionOffsetSum.offsetSum()); } } } else { for (final TaskId task : prevTasks()) { taskOffsetSumsCache.put(task, Task.LATEST_OFFSET); } for (final TaskId task : standbyTasks()) { taskOffsetSumsCache.put(task, 0L); } } } return taskOffsetSumsCache; }

Target:
Map<TaskId, Long> taskOffsetSums() { if (taskOffsetSumsCache == null) { taskOffsetSumsCache = new HashMap<>(); if (data.version() >= MIN_VERSION_OFFSET_SUM_SUBSCRIPTION) { for (final TaskOffsetSum taskOffsetSum : data.taskOffsetSums()) { for (final PartitionToOffsetSum partitionOffsetSum : taskOffsetSum.partitionToOffsetSum()) { taskOffsetSumsCache.put( new TaskId(taskOffsetSum.topicGroupId(), partitionOffsetSum.partition()), partitionOffsetSum.offsetSum() ); } } } else { prevTasks().forEach(taskId -> taskOffsetSumsCache.put(taskId, Task.LATEST_OFFSET)); standbyTasks().forEach(taskId -> taskOffsetSumsCache.put(taskId, UNKNOWN_OFFSET_SUM)); } } return taskOffsetSumsCache; }
Source:
public void should_create_error_message() { String message = factory.create(new TestDescription("Test"), new StandardRepresentation()); assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <12.0>%n" + "to be close to:%n" + " <10.0>%n" + "by less than <10.0> percent but difference was <20.0> percent.%n" + "(a difference of exactly <10.0> being considered valid)")); }

Target:
public void should_create_error_message() { String message = factory.create(new TestDescription("Test"), new StandardRepresentation()); assertThat(message).isEqualTo(String.format("[Test] %n" + "Expecting:%n" + " <12.0>%n" + "to be close to:%n" + " <10.0>%n" + "by less than <10.0>%% but difference was <20.0>%%.%n" + "(a difference of exactly <10.0> being considered valid)")); }
Source:
private void handlePendingScenario(ITmfEvent event, boolean isInputValid) { if (fConsuming && isEventConsumed()) { return; } if ((fInitialStateId.equals(TmfXmlState.INITIAL_STATE_ID) || isInputValid) && fPendingScenario != null) { @NonNull TmfXmlScenario scenario = fPendingScenario; handleScenario(scenario, event); if (!scenario.isPending()) { addActiveScenario(scenario); fPendingScenario = null; } } }

Target:
private void handlePendingScenario(ITmfEvent event, boolean isInputValid) { if (fConsuming && isEventConsumed()) { return; } TmfXmlScenario scenario = fPendingScenario; if ((fInitialStateId.equals(TmfXmlState.INITIAL_STATE_ID) || isInputValid) && scenario != null) { handleScenario(scenario, event); if (!scenario.isPending()) { addActiveScenario(scenario); fPendingScenario = null; } } }
Source:
public void get_default_profile() { dbTester.prepareDbUnit(getClass(), "shared.xml"); QualityProfileDto java = underTest.selectDefaultProfile(dbTester.getSession(), organization, "java"); assertThat(java).isNotNull(); assertThat(java.getKey()).isEqualTo("java_sonar_way"); assertThat(underTest.selectDefaultProfile(dbTester.getSession(), organization, "js")).isNull(); }

Target:
public void get_default_profile() { dbTester.prepareDbUnit(getClass(), "shared.xml"); QualityProfileDto java = underTest.selectDefaultProfile(dbTester.getSession(), organization, "java"); assertThat(java).isNotNull(); assertThat(java.getKey()).isEqualTo("java_sonar_way"); assertThat(underTest.selectDefaultProfile(dbTester.getSession(), dbTester.organizations().insert(), "java")).isNull(); assertThat(underTest.selectDefaultProfile(dbTester.getSession(), organization, "js")).isNull(); }
Source:
public static Resource getResultResource(final JavaSparkContext sparkContext, final SparkJobContext sparkJobContext) { final HdfsHelper hdfsHelper = new HdfsHelper(sparkContext); final String resultPath; if (Strings.isNullOrEmpty(sparkJobContext.getResultPath())) { resultPath = DEFAULT_RESULT_PATH + '/' + generateResultFilename(sparkJobContext); } else { if (hdfsHelper.isDirectory(sparkJobContext.getResultPath())) { if (sparkJobContext.getResultPath().endsWith("/")) { resultPath = sparkJobContext.getResultPath() + generateResultFilename(sparkJobContext); } else { resultPath = sparkJobContext.getResultPath() + '/' + generateResultFilename(sparkJobContext); } } else { resultPath = sparkJobContext.getResultPath(); } } return hdfsHelper.getResourceToUse(resultPath); }

Target:
public static Resource getResultResource(final JavaSparkContext sparkContext, final SparkJobContext sparkJobContext) { final HdfsHelper hdfsHelper = new HdfsHelper(sparkContext); URI resultPath = sparkJobContext.getResultPath(); if (resultPath == null) { resultPath = URI.create(DEFAULT_RESULT_PATH + '/' + generateResultFilename(sparkJobContext)); } else { if (hdfsHelper.isDirectory(resultPath)) { if (resultPath.toString().endsWith("/")) { resultPath = URI.create(resultPath.toString() + generateResultFilename(sparkJobContext)); } else { resultPath = URI.create(resultPath.toString() + '/' + generateResultFilename(sparkJobContext)); } } else { resultPath = sparkJobContext.getResultPath(); } } return hdfsHelper.getResourceToUse(resultPath); }
Source:
public SecretKeySpec getRandomKey() throws GeneralSecurityException { KeyGenerator keyGen = null; try { keyGen = KeyGenerator.getInstance("AES"); keyGen.init(config.kmsRandomKeySizeInBits); SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, "AES"); } catch (NoSuchAlgorithmException e) { throw new GeneralSecurityException("NoSuchAlgorithmException thrown while generating random key", e); } }

Target:
public SecretKeySpec getRandomKey() throws GeneralSecurityException { SecretKey secretKey = keyGen.generateKey(); byte[] encoded = secretKey.getEncoded(); return new SecretKeySpec(encoded, keyGenAlgo); }
Source:
private synchronized OkHttpClient getClient(long timeoutMs) { if (client == null) { client = new OkHttpClient.Builder() .callTimeout(timeoutMs, TimeUnit.MILLISECONDS) .followRedirects(true) .addInterceptor(new Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { Request request = chain.request(); if (RealmLog.getLevel() <= LogLevel.DEBUG) { StringBuilder sb = new StringBuilder(request.method()); sb.append(' '); sb.append(request.url()); sb.append('\n'); sb.append(request.headers()); if (request.body() != null) { Buffer buffer = new Buffer(); request.body().writeTo(buffer); String obfuscatedOutput = loginInfoObfuscator.obfuscate(request.url().pathSegments(), buffer.readString(UTF8)); sb.append(obfuscatedOutput); } RealmLog.debug("HTTP Request = \n%s", sb); } return chain.proceed(request); } }) .connectionPool(new ConnectionPool(5, 5, TimeUnit.SECONDS)) .build(); } return client; }

Target:
private synchronized OkHttpClient getClient(long timeoutMs) { if (client == null) { client = new OkHttpClient.Builder() .callTimeout(timeoutMs, TimeUnit.MILLISECONDS) .followRedirects(true) .addInterceptor(new LoggingInterceptor(httpLogObfuscator)) .connectionPool(new ConnectionPool(5, 5, TimeUnit.SECONDS)) .build(); } return client; }
Source:
private synchronized void waitToCatchUp(int batchThreshold, int timeOutThresholdInMS) { int counter = 0; while(this.getBatchesSent() - this.getBatchesResponded() > batchThreshold && counter < timeOutThresholdInMS) { try { Thread.yield(); Thread.sleep(1); timeOutThresholdInMS++; } catch(InterruptedException ie) { } } }

Target:
private synchronized void waitToCatchUp(int batchThreshold, int timeOutThresholdInMS) { int counter = 0; while(this.getBatchesSent() - this.getBatchesResponded() > batchThreshold && counter < timeOutThresholdInMS) { try { Thread.yield(); Thread.sleep(1); counter++; } catch(InterruptedException ie) { } } }
Source:
private String getLine(int line) { try { return lines().get(line - 1); } catch (Exception ex) { System.out.println("error! could not get line " + line); return ""; } }

Target:
private String getLine(int line) { try { return lines().get(line - 1); } catch (IndexOutOfBoundsException ex) { return ""; } }
Source:
private void putApnsClientForVariantID(final String variantID, final ApnsClient apnsClient) { final ApnsClient client = apnsClientExpiringMap.putIfAbsent(variantID, apnsClient); if (client != null) { logger.warn("duplicate connection in pool, shutting it down"); tearDownApnsHttp2Connection(client); } }

Target:
private void putApnsClientForVariantID(final String variantID, final ApnsClient apnsClient) { final ApnsClient client = apnsClientExpiringMap.putIfAbsent(variantID, apnsClient); if (client != null) { logger.warn("duplicate connection in pool, immediately shutting down the new connection"); tearDownApnsHttp2Connection(apnsClient); } }
Source:
protected ThreadPoolExecutor createSingleThreadExecutor(ThreadFactory factory) { BlockingQueue<Runnable> queue; if (enableBusyWait) { queue = new BlockingMpscQueue<>(10000); } else { queue = new LinkedBlockingQueue<>(); } return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, queue, factory); }

Target:
protected ThreadPoolExecutor createSingleThreadExecutor(ThreadFactory factory) { BlockingQueue<Runnable> queue; if (enableBusyWait) { queue = new BlockingMpscQueue<>(maxTasksInQueue > 0 ? maxTasksInQueue : DEFAULT_MAX_ARRAY_QUEUE_SIZE); } else { queue = new LinkedBlockingQueue<>(); } return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, queue, factory); }
Source:
public void run() { int numTimeouts = checkPendingTimeouts(); if (!pendingData.isEmpty() || !pendingEvents.isEmpty() || numTimeouts > 0) { Collection<Data> newData = getAndClearPendingData(); Collection<Event> newEvents = getAndClearPendingEvents(); log.debug("Executing rules engine on " + newData.size() + " datums, " + newEvents.size() + " events and " + numTimeouts +" dampening timeouts."); try { if (newData.isEmpty() && newEvents.isEmpty()) { rules.fireNoData(); } else { if (!newData.isEmpty()) { rules.addData(newData); newData.clear(); } if (!newEvents.isEmpty()) { rules.addEvents(newEvents); newEvents.clear(); } } rules.fire(); alertsService.addAlerts(alerts); alerts.clear(); alertsService.persistEvents(events); events.clear(); handleDisabledTriggers(); handleAutoResolvedTriggers(); } catch (Exception e) { e.printStackTrace(); log.debug("Error on rules processing: " + e); msgLog.errorProcessingRules(e.getMessage()); } finally { alerts.clear(); events.clear(); } } }

Target:
public void run() { int numTimeouts = checkPendingTimeouts(); if (!pendingData.isEmpty() || !pendingEvents.isEmpty() || numTimeouts > 0) { Collection<Data> newData = getAndClearPendingData(); Collection<Event> newEvents = getAndClearPendingEvents(); if (log.isDebugEnabled()) { log.debug("Executing rules engine on " + newData.size() + " datums, " + newEvents.size() + " events and " + numTimeouts +" dampening timeouts."); } try { if (newData.isEmpty() && newEvents.isEmpty()) { rules.fireNoData(); } else { if (!newData.isEmpty()) { rules.addData(newData); newData.clear(); } if (!newEvents.isEmpty()) { rules.addEvents(newEvents); newEvents.clear(); } } rules.fire(); alertsService.addAlerts(alerts); alerts.clear(); alertsService.persistEvents(events); if (distributed) { partitionManager.notifyEvents(events); } events.clear(); handleDisabledTriggers(); handleAutoResolvedTriggers(); } catch (Exception e) { e.printStackTrace(); if (log.isDebugEnabled()) { log.debug("Error on rules processing: " + e); } msgLog.errorProcessingRules(e.getMessage()); } finally { alerts.clear(); events.clear(); } } }
Source:
public void testRemoteProxyCreationDelegatesToClientEventually() { final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client); assertEquals(0, clientInstanceImpl.getProxyManager().getLocalDistributedObjects().size()); server.getMap("map"); assertTrueEventually(new AssertTask() { @Override public void run() { assertEquals(1, clientInstanceImpl.getProxyManager().getLocalDistributedObjects().size()); } }); }

Target:
public void testRemoteProxyCreationDelegatesToClientEventually() { final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client); assertEquals(0, clientInstanceImpl.getProxyManager().getLocalDistributedObjects().size()); client2.getMap("map"); assertTrueEventually(new AssertTask() { @Override public void run() { assertEquals(1, clientInstanceImpl.getProxyManager().getLocalDistributedObjects().size()); } }); }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!children.get(0).evaluate(tuple, ptr)) { if (logger.isDebugEnabled()) { logger.debug("->> left value is null"); } return false; } PhoenixJson source =(PhoenixJson) PJson.INSTANCE.toObject(ptr, children.get(0).getSortOrder()); if (!children.get(1).evaluate(tuple, ptr)) { if (logger.isDebugEnabled()) { logger.debug("->> right value is null"); } return false; } String key = (String) PVarchar.INSTANCE.toObject(ptr, children.get(1).getSortOrder()); PhoenixJson jsonValue=source.getValue(key); if(jsonValue!=null) { ptr.set(jsonValue.toBytes()); return true; } return false; }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!children.get(0).evaluate(tuple, ptr)) { return false; } PhoenixJson source =(PhoenixJson) PJson.INSTANCE.toObject(ptr, children.get(0).getSortOrder()); if (!children.get(1).evaluate(tuple, ptr)) { return false; } String key = (String) PVarchar.INSTANCE.toObject(ptr, children.get(1).getSortOrder()); PhoenixJson jsonValue=source.getValue(key); if(jsonValue!=null) { ptr.set(jsonValue.toBytes()); return true; } return false; }
Source:
public void paintControl(PaintEvent e) { GC gc = e.gc; Rectangle bounds; if (plotArea == null) { bounds = gc.getClipping(); } else { bounds = plotArea.getBounds(); } double[][] series = this.getPieSeriesArray(); if (series.length == 0) { return; } int width = (bounds.width - bounds.x) / series.length; int x = bounds.x; for (double s[] : series) { drawPieChart(e, s, new Rectangle(x, bounds.y, width, bounds.height)); x += width; } }

Target:
public void paintControl(PaintEvent e) { GC gc = e.gc; Rectangle bounds; if (plotArea == null) { bounds = gc.getClipping(); } else { bounds = plotArea.getBounds(); } double[][] series = this.getPieSeriesArray(); if (series.length == 0) { Rectangle allBounds = chart.getBounds(); Font font = new Font(Display.getDefault(), "Arial", 15, SWT.BOLD); gc.setForeground(BLACK); gc.setFont(font); String text = "No data"; Point textSize = e.gc.textExtent(text); gc.drawText(text, (allBounds.width - textSize.x) / 2, (allBounds.height - textSize.y) / 2); font.dispose(); return; } int width = (bounds.width - bounds.x) / series.length; int x = bounds.x; for (int i = 0; i < series.length; i++) { double[] s = series[i]; drawPieChart(e, i, s, new Rectangle(x, bounds.y, width, bounds.height)); x += width; } }
Source:
public Map<String, Object> createUser(final UserDetailDto user) { LOG.debug(user.toString()); final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), UserServiceImpl.USER_NAME); final HashMap<String, Object> mapResponse = new HashMap<String, Object>(); mapResponse.put("id", String.valueOf(0)); userValidator.validate(user, errors, true); if (errors.hasErrors()) { LOG.debug("UserValidator returns errors"); translateErrorToMap(errors, mapResponse); return mapResponse; } final UserDto userdto = translateUserDetailsDtoToUserDto(user); userdto.setPassword(passwordEncoder.encode(userdto.getUsername())); try { final Integer newUserId = this.workbenchDataManager.createUser(userdto); mapResponse.put("id", String.valueOf(newUserId)); } catch (MiddlewareQueryException e) { LOG.info("Error on workbenchDataManager.addNewUser " + e.getMessage()); } return mapResponse; }

Target:
public Map<String, Object> createUser(final UserDetailDto user) { LOG.debug(user.toString()); final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), UserServiceImpl.USER_NAME); final HashMap<String, Object> mapResponse = new HashMap<String, Object>(); mapResponse.put("id", String.valueOf(0)); userValidator.validate(user, errors, true); if (errors.hasErrors()) { LOG.debug("UserValidator returns errors"); translateErrorToMap(errors, mapResponse); } else { final UserDto userdto = translateUserDetailsDtoToUserDto(user); userdto.setPassword(passwordEncoder.encode(userdto.getUsername())); try { final Integer newUserId = this.workbenchDataManager.createUser(userdto); mapResponse.put("id", String.valueOf(newUserId)); } catch (MiddlewareQueryException e) { LOG.info("Error on workbenchDataManager.createUser " + e.getMessage()); errors.rejectValue(UserValidator.USER_ID, UserValidator.DATABASE_ERROR); translateErrorToMap(errors, mapResponse); } } return mapResponse; }
Source:
private void downloadFullTexts(Map<BibEntry, Optional<URL>> downloads, BibDatabaseContext databaseContext) { for (Map.Entry<BibEntry, Optional<URL>> download : downloads.entrySet()) { BibEntry entry = download.getKey(); Optional<URL> result = download.getValue(); if (result.isPresent()) { Optional<Path> dir = databaseContext.getFirstExistingFileDir(Globals.prefs.getFilePreferences()); if (dir.isEmpty()) { dialogService.showErrorDialogAndWait(Localization.lang("Directory not found"), Localization.lang("Main file directory not set!\n") + Localization.lang("Check the Preferences (Linked files)") + Localization.lang(" or the Library properties.")); return; } addLinkedFileFromURL(databaseContext, result.get(), entry, dir.get()); } else { dialogService.notify(Localization.lang("No full text document found for entry %0.", entry.getCitationKey().orElse(Localization.lang("undefined")))); } } }

Target:
private void downloadFullTexts(Map<BibEntry, Optional<URL>> downloads, BibDatabaseContext databaseContext) { for (Map.Entry<BibEntry, Optional<URL>> download : downloads.entrySet()) { BibEntry entry = download.getKey(); Optional<URL> result = download.getValue(); if (result.isPresent()) { Optional<Path> dir = databaseContext.getFirstExistingFileDir(Globals.prefs.getFilePreferences()); if (dir.isEmpty()) { dialogService.showErrorDialogAndWait(Localization.lang("Directory not found"), (Localization.lang("Main file directory not set. Check the preferences (linked files) or the library properties."))); return; } addLinkedFileFromURL(databaseContext, result.get(), entry, dir.get()); } else { dialogService.notify(Localization.lang("No full text document found for entry %0.", entry.getCitationKey().orElse(Localization.lang("undefined")))); } } }
Source:
public void onOrganizationalUnitRemoved(@Observes final AfterDeleteOrganizationalUnitEvent removedOrganizationalUnitEvent) { if (isLibraryPerspectiveOpen() && isSpaceActive(removedOrganizationalUnitEvent)) { projectContext.getActiveOrganizationalUnit() .filter(active -> active.equals(removedOrganizationalUnitEvent.getOrganizationalUnit())) .ifPresent(active -> goToOrganizationalUnits()); } }

Target:
public void onOrganizationalUnitRemoved(@Observes final AfterDeleteOrganizationalUnitEvent removedOrganizationalUnitEvent) { if (isLibraryPerspectiveOpen()) { projectContext.getActiveOrganizationalUnit() .filter(active -> active.equals(removedOrganizationalUnitEvent.getOrganizationalUnit())) .ifPresent(active -> this.goToOrganizationalUnits()); } }
Source:
public void checkDecisionServerSecureMultiContainerHttpClient() throws Exception { String HOST = "https://" + System.getenv("SECURE_KIE_APP_SERVICE_HOST") + ":" + System.getenv("SECURE_KIE_APP_SERVICE_PORT"); String URI = "/kie-server/services/rest/server/containers"; HttpResponse response = genericResponse(HOST, URI); Assert.assertEquals(200, response.getResponseCode()); String output = response.getResponseBodyAsString(); JAXBContext jaxbContent = JAXBContext.newInstance(ServiceResponse.class); Unmarshaller unmarshaller = jaxbContent.createUnmarshaller(); ServiceResponse serviceResponse = (ServiceResponse) unmarshaller.unmarshal(new StringReader(output)); KieContainerResourceList kieContainers = (KieContainerResourceList) serviceResponse.getResult(); Assert.assertEquals(2, kieContainers.getContainers().size()); kieContainers.getContainers().stream().forEach(container -> { String containerAliasToID = new SumCoder.MD5().encode(container.getResolvedReleaseId().getArtifactId() + "=" + container.getReleaseId()); if (!containerAliasToID.equals(container.getContainerId())){ containerAliasToID = new SumCoder.MD5().encode("AnotherContainer=" + container.getReleaseId()); } Assert.assertEquals(container.getContainerId(), containerAliasToID); Assert.assertEquals(org.kie.server.api.model.KieContainerStatus.STARTED, container.getStatus()); }); }

Target:
public void checkDecisionServerSecureMultiContainerHttpClient() { String HOST = "https://" + System.getenv("SECURE_KIE_APP_SERVICE_HOST") + ":" + System.getenv("SECURE_KIE_APP_SERVICE_PORT"); String URI = "/kie-server/services/rest/server/containers"; HttpResponse response = genericResponse(HOST, URI); Assert.assertEquals(200, response.getResponseCode()); String output = null; try { output = response.getResponseBodyAsString(); JAXBContext jaxbContent = JAXBContext.newInstance(ServiceResponse.class); Unmarshaller unmarshaller = jaxbContent.createUnmarshaller(); ServiceResponse serviceResponse = (ServiceResponse) unmarshaller.unmarshal(new StringReader(output)); KieContainerResourceList kieContainers = (KieContainerResourceList) serviceResponse.getResult(); Assert.assertEquals(2, kieContainers.getContainers().size()); for (KieContainerResource container : kieContainers.getContainers()) { String containerAliasToID = new SumCoder.MD5().encode(container.getResolvedReleaseId().getArtifactId() + "=" + container.getReleaseId()); if (!containerAliasToID.equals(container.getContainerId())) { containerAliasToID = new SumCoder.MD5().encode("AnotherContainer=" + container.getReleaseId()); } Assert.assertEquals(container.getContainerId(), containerAliasToID); Assert.assertEquals(org.kie.server.api.model.KieContainerStatus.STARTED, container.getStatus()); } } catch (IOException e) { e.printStackTrace(); } catch (JAXBException e) { e.printStackTrace(); } }
Source:
private <T>Comparator<T> reverseComparator(final Comparator<T> comparator) { return new Comparator<T>() { @Override public int compare(T t1, T t2) { return -comparator.compare(t1, t2); } }; }

Target:
private static <T>Comparator<T> reverseComparator(final Comparator<T> comparator) { return new Comparator<T>() { @Override public int compare(T t1, T t2) { return -comparator.compare(t1, t2); } }; }
Source:
protected void onMethodInvocationFound(MethodInvocationTree mit) { if (!mit.methodSelect().is(Tree.Kind.MEMBER_SELECT)) { return; } ExpressionTree firstOperand = ExpressionUtils.skipParentheses(((MemberSelectExpressionTree) mit.methodSelect()).expression()); ExpressionTree secondOperand = ExpressionUtils.skipParentheses(mit.arguments().get(0)); boolean firstOperandNonCompliant = useClassGetNameMethod(firstOperand); boolean secondOperandNonCompliant = useClassGetNameMethod(secondOperand); if (firstOperandNonCompliant && secondOperandNonCompliant) { reportIssue(mit, "Use \"isAssignableFrom\" instead."); } else if (firstOperandNonCompliant && secondOperand.is(Tree.Kind.STRING_LITERAL)) { reportIssue(mit, "Use an \"instanceof\" comparison instead."); } else if (secondOperandNonCompliant && firstOperand.is(Tree.Kind.STRING_LITERAL)) { reportIssue(mit, "Use an \"instanceof\" comparison instead."); } }

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { if (!mit.methodSelect().is(Tree.Kind.MEMBER_SELECT)) { return; } ExpressionTree firstOperand = ExpressionUtils.skipParentheses(((MemberSelectExpressionTree) mit.methodSelect()).expression()); ExpressionTree secondOperand = ExpressionUtils.skipParentheses(mit.arguments().get(0)); boolean firstOpIsClassGetNameMethod = useClassGetNameMethod(firstOperand); boolean secondOpIsClassGetNameMethod = useClassGetNameMethod(secondOperand); if (firstOpIsClassGetNameMethod && secondOpIsClassGetNameMethod) { reportIssue(mit, "Use \"isAssignableFrom\" instead."); } else if ((firstOpIsClassGetNameMethod && secondOperand.is(Tree.Kind.STRING_LITERAL)) || (secondOpIsClassGetNameMethod && firstOperand.is(Tree.Kind.STRING_LITERAL))) { reportIssue(mit, "Use an \"instanceof\" comparison instead."); } }
Source:
private Optional<DRepresentation> getRepresentationInternal(boolean loadOnDemand) { ResourceDescriptor resourceDescriptor = repDescriptor.getRepPath(); Resource resource = repDescriptor.eResource(); Optional<URI> uri = Optional.ofNullable(resourceDescriptor).map(desc -> desc.getResourceURI()); if (uri.isPresent()) { URI repResourceURI = uri.get().trimFragment(); Optional<Resource> representationResource = Optional.ofNullable(resource) .map(rsr -> rsr.getResourceSet()) .filter(resourceSet -> !loadOnDemand || resourceSet.getURIConverter().exists(repResourceURI, new HashMap<>())) .map(resourceSet -> { Resource res = null; try { res = resourceSet.getResource(repResourceURI, loadOnDemand); } catch (Exception e) { } return res; }); String repId = uri.get().fragment(); if (representationResource.isPresent() && repId != null) { return representationResource.get().getContents().stream().filter(DRepresentation.class::isInstance).map(DRepresentation.class::cast) .filter(dRepresentation -> repId.equals(dRepresentation.getUid())).findFirst(); } } return Optional.empty(); }

Target:
private Optional<DRepresentation> getRepresentationInternal(boolean loadOnDemand) { ResourceDescriptor resourceDescriptor = repDescriptor.getRepPath(); Resource resource = repDescriptor.eResource(); Optional<URI> uri = Optional.ofNullable(resourceDescriptor).map(desc -> desc.getResourceURI()); if (uri.isPresent()) { URI repResourceURI = uri.get().trimFragment(); Optional<Resource> representationResource = Optional.ofNullable(resource) .map(rsr -> rsr.getResourceSet()) .filter(resourceSet -> !loadOnDemand || resourceSet.getURIConverter().exists(repResourceURI, new HashMap<>())) .map(resourceSet -> { Resource res = null; try { res = resourceSet.getResource(repResourceURI, loadOnDemand); } catch (RuntimeException e) { } return res; }); String repId = uri.get().fragment(); if (representationResource.isPresent() && repId != null) { return representationResource.get().getContents().stream().filter(DRepresentation.class::isInstance).map(DRepresentation.class::cast) .filter(dRepresentation -> repId.equals(dRepresentation.getUid())).findFirst(); } } return Optional.empty(); }
Source:
public void getAllProvidersByType(AsyncQuery<List<Provider<?>>> aQuery, ProviderType providerType) { aQuery.converterCallback = new ListConverter<>(); Frontend.getInstance().runQuery(QueryType.GetAllProviders, new GetAllProvidersParameters(providerType), aQuery); }

Target:
public void getAllProvidersByType(AsyncQuery<List<Provider<?>>> aQuery, ProviderType providerType) { getAllProvidersByTypes(aQuery, providerType); }
Source:
private ImmutableSortedMap<String, ImmutableSet<String>> readMap(final String mapPath) { String fileContent; String actualPath = mapPath; if (Strings.isNullOrEmpty(mapPath)) { actualPath = this.getClass().getClassLoader().getResource("defaultWitheListMap.json").getFile(); LOGGER.warn("using default whiteList map located at [%s]", actualPath); } try { fileContent = Files.asCharSource(new File(actualPath), Charset.forName("UTF-8")).read(); return mapper.reader(new TypeReference<ImmutableSortedMap<String, ImmutableSet<String>>>() { }).readValue(fileContent); } catch (IOException e) { throw new ISE(e, "Got an exception while parsing file [%s]", actualPath); } }

Target:
private ImmutableSortedMap<String, ImmutableSet<String>> readMap(final String mapPath) { String fileContent; String actualPath = mapPath; if (Strings.isNullOrEmpty(mapPath)) { actualPath = this.getClass().getClassLoader().getResource("defaultWhiteListMap.json").getFile(); LOGGER.warn("using default whiteList map located at [%s]", actualPath); } try { fileContent = Files.asCharSource(new File(actualPath), Charset.forName("UTF-8")).read(); return mapper.reader(new TypeReference<ImmutableSortedMap<String, ImmutableSet<String>>>() { }).readValue(fileContent); } catch (IOException e) { throw new ISE(e, "Got an exception while parsing file [%s]", actualPath); } }
Source:
private void startGeoActivity() { Context context = getContext(); Intent intent = new Intent(context, GeoPointActivity.class); if (stringAnswer != null && !stringAnswer.isEmpty()) { intent.putExtra(LOCATION, GeoWidgetUtils.getLocationParamsFromStringAnswer(stringAnswer)); } intent.putExtra(READ_ONLY, readOnly); intent.putExtra(DRAGGABLE_ONLY, false); intent.putExtra(ACCURACY_THRESHOLD, accuracyThreshold); ((Activity) context).startActivityForResult(intent, RequestCodes.LOCATION_CAPTURE); }

Target:
private void startGeoActivity() { Context context = getContext(); Intent intent = new Intent(context, GeoPointActivity.class); if (stringAnswer != null && !stringAnswer.isEmpty()) { intent.putExtra(LOCATION, GeoWidgetUtils.getLocationParamsFromStringAnswer(stringAnswer)); } intent.putExtra(ACCURACY_THRESHOLD, accuracyThreshold); ((Activity) context).startActivityForResult(intent, RequestCodes.LOCATION_CAPTURE); }
Source:
private Map<Integer, Map<Integer, List<HiveBloomFilter>>> readBloomFilterIndexes(Map<StreamId, Stream> streams, Map<StreamId, OrcInputStream> streamsData) throws IOException { Map<Integer, Map<Integer, List<HiveBloomFilter>>> bloomFilters = new HashMap<>(); for (Entry<StreamId, Stream> entry : streams.entrySet()) { Stream stream = entry.getValue(); if (stream.getStreamKind() == BLOOM_FILTER) { OrcInputStream inputStream = streamsData.get(entry.getKey()); Map<Integer, List<HiveBloomFilter>> bloomFiltersForColumn = bloomFilters.getOrDefault(stream.getColumn(), new HashMap<>()); bloomFiltersForColumn.put(stream.getSequence(), metadataReader.readBloomFilterIndexes(inputStream)); bloomFilters.put(stream.getColumn(), bloomFiltersForColumn); } } return ImmutableMap.copyOf(bloomFilters); }

Target:
private Map<StreamId, List<HiveBloomFilter>> readBloomFilterIndexes(Map<StreamId, Stream> streams, Map<StreamId, OrcInputStream> streamsData) throws IOException { ImmutableMap.Builder<StreamId, List<HiveBloomFilter>> bloomFilters = ImmutableMap.builder(); for (Entry<StreamId, Stream> entry : streams.entrySet()) { Stream stream = entry.getValue(); if (stream.getStreamKind() == BLOOM_FILTER) { OrcInputStream inputStream = streamsData.get(entry.getKey()); bloomFilters.put(entry.getKey(), metadataReader.readBloomFilterIndexes(inputStream)); } } return bloomFilters.build(); }
Source:
public void run() { long start = System.currentTimeMillis(); boolean done = false; while(running.get() && !done) { try { Connection conn = getConnection(url); conn.setAutoCommit(false); PreparedStatement ps = conn.prepareStatement( "SELECT * FROM test WHERE entity_id = ? FOR UPDATE"); ps.setString(1, "1"); ResultSet rs = ps.executeQuery(); assertTrue(rs.next()); assertTrue(rs.getInt(2) == 100); conn.commit(); long now = System.currentTimeMillis(); if (now - start > 1000*60) done = true; } catch (SQLException e1) { e1.printStackTrace(); } } }

Target:
public void run() { long start = System.currentTimeMillis(); boolean done = false; Connection conn = null; while(running.get() && !done) { try { conn = getConnection(getTestName() + url); conn.setAutoCommit(false); PreparedStatement ps = conn.prepareStatement( "SELECT * FROM testmvccmultithreaded2 WHERE entity_id = ? FOR UPDATE"); ps.setString(1, "1"); ResultSet rs = ps.executeQuery(); assertTrue(rs.next()); assertTrue(rs.getInt(2) == 100); conn.commit(); long now = System.currentTimeMillis(); if (now - start > 1000*60) done = true; } catch (JdbcSQLException e1) { if (e1.getErrorCode() != ErrorCode.DUPLICATE_KEY_1) e1.printStackTrace(); } catch (SQLException e2) { e2.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (SQLException e1) { e1.printStackTrace(); } } }
Source:
public DataSegment push(final File indexFilesDir, final DataSegment segment) throws IOException { log.info("Uploading [%s] to Azure.", indexFilesDir); final int version = SegmentUtils.getVersionFromDir(indexFilesDir); final File zipOutFile = File.createTempFile("index", ".zip"); final long size = CompressionUtils.zip(indexFilesDir, zipOutFile); final File descriptorFile = createSegmentDescriptorFile(jsonMapper, segment); final Map<String, String> azurePaths = getAzurePaths(segment); try { return AzureUtils.retryAzureOperation( new Callable<DataSegment>() { @Override public DataSegment call() throws Exception { return uploadDataSegment(segment, version, size, zipOutFile, descriptorFile, azurePaths); } }, config.getMaxTries() ); } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public DataSegment push(final File indexFilesDir, final DataSegment segment) throws IOException { log.info("Uploading [%s] to Azure.", indexFilesDir); final int version = SegmentUtils.getVersionFromDir(indexFilesDir); File zipOutFile = null; File descriptorFile = null; try { final File outFile = zipOutFile = File.createTempFile("index", ".zip"); final long size = CompressionUtils.zip(indexFilesDir, zipOutFile); final File descFile = descriptorFile = createSegmentDescriptorFile(jsonMapper, segment); final Map<String, String> azurePaths = getAzurePaths(segment); return AzureUtils.retryAzureOperation( new Callable<DataSegment>() { @Override public DataSegment call() throws Exception { return uploadDataSegment(segment, version, size, outFile, descFile, azurePaths); } }, config.getMaxTries() ); } catch (Exception e) { throw Throwables.propagate(e); } finally { if (zipOutFile != null) { log.info("Deleting zipped index File[%s]", zipOutFile); zipOutFile.delete(); } if (descriptorFile != null) { log.info("Deleting descriptor file[%s]", descriptorFile); descriptorFile.delete(); } } }
Source:
public void testIntegerCollection() { assertImageEqualsCollection( imgByte, FlatCollections.integerCollection( imgByte ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgInt, FlatCollections.integerCollection( imgInt ), ( e, a ) -> e.get() == a ); assertImageEqualsCollection( imgLong, FlatCollections.integerCollection( imgLong ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgShort, FlatCollections.integerCollection( imgShort ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgBig, FlatCollections.integerCollection( imgBig ), ( e, a ) -> e.getInteger() == a ); }

Target:
public void testIntegerCollection() { assertImageEqualsCollection( imgByte, FlatCollections.integerCollection( imgByte ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgInt, FlatCollections.integerCollection( imgInt ), ( e, a ) -> e.get() == a ); assertImageEqualsCollection( imgLong, FlatCollections.integerCollection( imgLong ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgShort, FlatCollections.integerCollection( imgShort ), ( e, a ) -> e.getInteger() == a ); assertImageEqualsCollection( imgUnsignedLong, FlatCollections.integerCollection( imgUnsignedLong ), ( e, a ) -> e.getInteger() == a ); }
Source:
public static Cluster open(final String configurationFile) throws Exception { File file = new File(configurationFile); if (!file.exists()) { ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); URL resource = currentClassLoader.getResource(configurationFile); file = new File(resource.getFile()); if (!file.exists()) { throw new IllegalArgumentException(String.format("Configuration file at %s does not exist", configurationFile)); } } return build(file).create(); }

Target:
public static Cluster open(final String configurationFile) throws Exception { final File systemFile = new File(configurationFile); if (!systemFile.exists()) { final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); final URL resource = currentClassLoader.getResource(configurationFile); final File resourceFile = new File(resource.getFile()); if (!resourceFile.exists()) { throw new IllegalArgumentException(String.format("Configuration file at %s does not exist", configurationFile)); } return build(resourceFile).create(); } return build(systemFile).create(); }