auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void invokeWithTimeoutWithNewExecutor(ITestNGMethod tm, Object instance, Object[] parameterValues, ITestResult testResult, IHookable hookable) throws InterruptedException, ThreadExecutionException { IExecutor exec = ThreadUtil.createExecutor(1, tm.getMethodName()); InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues, hookable, testResult); IFutureResult future = exec.submitRunnable(imr); exec.shutdown(); long realTimeOut = MethodHelper.calculateTimeOut(tm); boolean finished = exec.awaitTermination(realTimeOut); if (!finished) { exec.stopNow(); ThreadTimeoutException exception = new ThreadTimeoutException("Method " + tm.getQualifiedName() + "()" + " didn't finish within the time-out " + realTimeOut); testResult.setThrowable(exception); testResult.setStatus(ITestResult.FAILURE); } else { Utils.log("Invoker " + Thread.currentThread().hashCode(), 3, "Method " + tm.getMethodName() + " completed within the time-out " + tm.getTimeOut()); future.get(); testResult.setStatus(ITestResult.SUCCESS); } }

Target:
private static void invokeWithTimeoutWithNewExecutor(ITestNGMethod tm, Object instance, Object[] parameterValues, ITestResult testResult, IHookable hookable) throws InterruptedException, ThreadExecutionException { IExecutor exec = ThreadUtil.createExecutor(1, tm.getMethodName()); InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, parameterValues, hookable, testResult); IFutureResult future = exec.submitRunnable(imr); exec.shutdown(); long realTimeOut = MethodHelper.calculateTimeOut(tm); boolean finished = exec.awaitTermination(realTimeOut); if (!finished) { exec.stopNow(); ThreadTimeoutException exception = new ThreadTimeoutException("Method " + tm.getQualifiedName() + "()" + " didn't finish within the time-out " + realTimeOut); StackTraceElement[][] stacktraces = exec.getStackTraces(); if (stacktraces.length > 0) { exception.setStackTrace(stacktraces[0]); } testResult.setThrowable(exception); testResult.setStatus(ITestResult.FAILURE); } else { Utils.log("Invoker " + Thread.currentThread().hashCode(), 3, "Method " + tm.getMethodName() + " completed within the time-out " + tm.getTimeOut()); future.get(); testResult.setStatus(ITestResult.SUCCESS); } }
Source:
private Position attemptMasterRecovery() throws Exception { HeartbeatRowMap recoveredHeartbeat = null; MysqlPositionStore positionStore = this.context.getPositionStore(); RecoveryInfo recoveryInfo = positionStore.getRecoveryInfo(config); if ( recoveryInfo != null ) { Recovery masterRecovery = new Recovery( config.replicationMysql, config.databaseName, this.context.getReplicationConnectionPool(), this.context.getCaseSensitivity(), recoveryInfo ); recoveredHeartbeat = masterRecovery.recover(); if (recoveredHeartbeat != null) { MysqlSchemaStore oldServerSchemaStore = new MysqlSchemaStore( context, recoveryInfo.serverID, recoveryInfo.position, config.filter, false ); oldServerSchemaStore.clone(context.getServerID(), recoveredHeartbeat.getPosition()); return recoveredHeartbeat.getNextPosition(); } } return null; }

Target:
private Position attemptMasterRecovery() throws Exception { HeartbeatRowMap recoveredHeartbeat = null; MysqlPositionStore positionStore = this.context.getPositionStore(); RecoveryInfo recoveryInfo = positionStore.getRecoveryInfo(config); if ( recoveryInfo != null ) { Recovery masterRecovery = new Recovery( config.replicationMysql, config.databaseName, this.context.getReplicationConnectionPool(), this.context.getCaseSensitivity(), recoveryInfo ); recoveredHeartbeat = masterRecovery.recover(); if (recoveredHeartbeat != null) { MysqlSchemaStore oldServerSchemaStore = new MysqlSchemaStore( context.getMaxwellConnectionPool(), context.getReplicationConnectionPool(), context.getSchemaConnectionPool(), recoveryInfo.serverID, recoveryInfo.position, context.getCaseSensitivity(), config.filter, config.schemaChainMaxLength, false ); oldServerSchemaStore.clone(context.getServerID(), recoveredHeartbeat.getPosition()); return recoveredHeartbeat.getNextPosition(); } } return null; }
Source:
public void close() throws Exception { consumer.close(); }

Target:
public void close() { consumer.close(); }
Source:
Server pick() { ImmutableList<Server> currNodes = nodes; int index = roundRobinIndex.getAndIncrement(); if (currNodes.size() == 0) { return null; } index %= currNodes.size(); return currNodes.get(index); }

Target:
Server pick() { ImmutableList<Server> currNodes = nodes; if (currNodes.size() == 0) { return null; } return currNodes.get(getIndex(currNodes)); }
Source:
private String sign(final Long timestamp) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException { String stringToSign = timestamp + "\n" + dingtalkConfiguration.getSecret(); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(dingtalkConfiguration.getSecret().getBytes(StandardCharsets.UTF_8.name()), "HmacSHA256")); byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8.name())); return URLEncoder.encode(new String(Base64.getEncoder().encode(signData)), StandardCharsets.UTF_8.name()); }

Target:
private String sign(final Long timestamp) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException { String stringToSign = timestamp + "\n" + dingtalkConfiguration.getSecret(); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(new SecretKeySpec(dingtalkConfiguration.getSecret().getBytes(StandardCharsets.UTF_8), "HmacSHA256")); byte[] signData = mac.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8)); return URLEncoder.encode(new String(Base64.getEncoder().encode(signData)), StandardCharsets.UTF_8.name()); }
Source:
public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) { CommandResponse response = initializeResponse(); if (zkServer instanceof LeaderZooKeeperServer) { Leader leader = ((LeaderZooKeeperServer) zkServer).getLeader(); response.put("synced_observers", leader.getObservingLearners().size()); response.put("observers", leader.getObservingLearnersInfo()); } else if (zkServer instanceof FollowerZooKeeperServer) { Follower follower = ((FollowerZooKeeperServer) zkServer).getFollower(); Integer syncedObservers = follower.getSyncedObserverSize(); if (syncedObservers != null) { response.put("synced_observers", syncedObservers); response.put("observers", follower.getSyncedObserversInfo()); } } else { response.put("synced_observers", 0); response.put("observers", null); } return response; }

Target:
public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) { CommandResponse response = initializeResponse(); if (zkServer instanceof LeaderZooKeeperServer) { Leader leader = ((LeaderZooKeeperServer) zkServer).getLeader(); response.put("synced_observers", leader.getObservingLearners().size()); response.put("observers", leader.getObservingLearnersInfo()); return response; } else if (zkServer instanceof FollowerZooKeeperServer) { Follower follower = ((FollowerZooKeeperServer) zkServer).getFollower(); Integer syncedObservers = follower.getSyncedObserverSize(); if (syncedObservers != null) { response.put("synced_observers", syncedObservers); response.put("observers", follower.getSyncedObserversInfo()); return response; } } response.put("synced_observers", 0); response.put("observers", Collections.emptySet()); return response; }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getImportImagesCommand()) { importImages(); } else if (command.getName().equals("Cancel")) { cancel(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (getImportImagesCommand().equals(command)) { importImages(); } else if (command.getName().equals("Cancel")) { cancel(); } }
Source:
public static String tissuePiece(long count) { return pluralize(count, "tissue piece", "tissue peices"); }

Target:
public static String tissuePiece(long count) { return pluralize(count, "tissue piece", "tissue pieces"); }
Source:
public Court GetCourtById(Long courtId){ Court court = courtDAO.getByCourtId(courtId); return court; }

Target:
public Court GetCourtById(Long courtId){ return courtDAO.getByCourtId(courtId); }
Source:
private void validate(final String certInput, final String keyInput, final String password, final String chainInput) { Certificate cert; PrivateKey key; List<Certificate> chain = null; try { cert = parseCertificate(certInput); key = parsePrivateKey(keyInput); if (chainInput != null) { chain = CertificateHelper.parseChain(chainInput); } } catch (final IOException | CertificateException e) { throw new IllegalArgumentException("Parsing certificate/key failed: " + e.getMessage(), e); } validateCert(cert, chainInput != null ? true : false); validateKeys(cert.getPublicKey(), key); if (chainInput != null) { validateChain(chain, cert); } }

Target:
private void validate(final String certInput, final String keyInput, final String password, final String chainInput) { try { List<Certificate> chain = null; final Certificate cert = parseCertificate(certInput); final PrivateKey key = parsePrivateKey(keyInput); if (chainInput != null) { chain = CertificateHelper.parseChain(chainInput); } validateCert(cert); validateKeys(cert.getPublicKey(), key); if (chainInput != null) { validateChain(chain, cert); } } catch (final IOException | CertificateException e) { throw new IllegalStateException("Parsing certificate/key failed: " + e.getMessage(), e); } }
Source:
private Aggregator[] getAggregators (byte[] data) throws IOException { DataInputStream input = null; try { input = new DataInputStream(new ByteArrayInputStream(data)); int keyLength = WritableUtils.readVInt(input); byte[] keyBytes = new byte[keyLength]; input.readFully(keyBytes, 0, keyLength); ImmutableBytesPtr key = new ImmutableBytesPtr(keyBytes, 0, keyLength); int valueLength = WritableUtils.readVInt(input); byte[] valueBytes = new byte[valueLength]; input.readFully(valueBytes, 0, valueLength); KeyValue keyValue = KeyValueUtil.newKeyValue( key.get(),key.getOffset(), key.getLength(), QueryConstants.SINGLE_COLUMN_FAMILY, QueryConstants.SINGLE_COLUMN, QueryConstants.AGG_TIMESTAMP, valueBytes, 0, valueBytes.length); SingleKeyValueTuple skv = new SingleKeyValueTuple(keyValue); clientAggregators.reset( aggregators ); clientAggregators.aggregate( aggregators, skv ); Aggregator[] sAggs = serverAggregators.newAggregators(); for(int i = 0; i < sAggs.length; i++) { sAggs[i].init( aggregators[i] ); } return sAggs; } finally { Closeables.closeQuietly(input); } }

Target:
private Aggregator[] getAggregators(byte[] data) throws IOException { DataInputStream input = null; try { input = new DataInputStream(new ByteArrayInputStream(data)); int keyLength = WritableUtils.readVInt(input); byte[] keyBytes = new byte[keyLength]; input.readFully(keyBytes, 0, keyLength); ImmutableBytesPtr ptr = new ImmutableBytesPtr(keyBytes, 0, keyLength); int valueLength = WritableUtils.readVInt(input); byte[] valueBytes = new byte[valueLength]; input.readFully(valueBytes, 0, valueLength); KeyValue keyValue = KeyValueUtil.newKeyValue(ptr.get(), ptr.getOffset(), ptr.getLength(), QueryConstants.SINGLE_COLUMN_FAMILY, QueryConstants.SINGLE_COLUMN, QueryConstants.AGG_TIMESTAMP, valueBytes, 0, valueBytes.length); Tuple result = new SingleKeyValueTuple(keyValue); TupleUtil.getAggregateValue(result, ptr); KeyValueSchema schema = aggregators.getValueSchema(); ValueBitSet tempValueSet = ValueBitSet.newInstance(schema); tempValueSet.clear(); tempValueSet.or(ptr); int i = 0, maxOffset = ptr.getOffset() + ptr.getLength(); SingleAggregateFunction[] funcArray = aggregators.getFunctions(); Aggregator[] sAggs = new Aggregator[funcArray.length]; Boolean hasValue; schema.iterator(ptr); while ((hasValue = schema.next(ptr, i, maxOffset, tempValueSet)) != null) { SingleAggregateFunction func = funcArray[i]; sAggs[i++] = hasValue ? func.newServerAggregator(conf, ptr) : func.newServerAggregator(conf); } return sAggs; } finally { Closeables.closeQuietly(input); } }
Source:
public void processRightData(final MistDataEvent event) { final long timestamp = event.getTimestamp(); if (recentRightTimestamp > timestamp) { throw new RuntimeException("The upstream events should be ordered by timestamp."); } else if (recentRightWatermark.getTimestamp() > timestamp){ throw new RuntimeException("The watermark should guarantee that " + "all events having less timestamp than it are arrived already."); } recentRightTimestamp = timestamp; rightUpstreamQueue.add(event); final long leftWatermarkTimestamp = recentLeftWatermark.getTimestamp(); final long rightWatermarkTimestamp = recentRightWatermark.getTimestamp(); final long minimumWatermark = getMinimumWatermark(leftWatermarkTimestamp, rightWatermarkTimestamp); drainUntilTimestamp(minimumWatermark); emitWatermarkUntilTimestamp(leftWatermarkTimestamp, rightWatermarkTimestamp, minimumWatermark); }

Target:
public void processRightData(final MistDataEvent event) { final long timestamp = event.getTimestamp(); if (recentRightTimestamp > timestamp) { throw new RuntimeException("The upstream events should be ordered by timestamp."); } else if (recentRightWatermark.getTimestamp() > timestamp){ throw new RuntimeException("The watermark should guarantee that " + "all events having less timestamp than it are arrived already."); } recentRightTimestamp = timestamp; rightUpstreamQueue.add(event); drainUntilMinimumWatermark(); }
Source:
void verifyGroovyResourceClasspathExecution() { try { val resource = new ClassPathResource("ScriptingUtilsTestGroovyScript.groovy"); val result = ScriptingUtils.executeGroovyScript(resource, "process", String.class, "casuser"); assertEquals("casuser", result); } catch (final Exception e) { throw new AssertionError(e.getMessage(), e); } }

Target:
public void verifyGroovyResourceClasspathExecution() { val resource = new ClassPathResource("ScriptingUtilsTestGroovyScript.groovy"); val result = ScriptingUtils.executeGroovyScript(resource, "process", String.class, "casuser"); assertEquals("casuser", result); }
Source:
public void verify_partitioned_buckets_in_download_presigned_urls() throws Exception { AmazonServiceException firstException = new AmazonServiceException("Didn't find Object Id in bucket"); firstException.setStatusCode(HttpStatus.NOT_FOUND.value()); int bucketPoolSize = 32; int bucketKeySize = 2; ReflectionTestUtils.setField(service, "bucketPoolSize", bucketPoolSize); ReflectionTestUtils.setField(service, "bucketKeySize", bucketKeySize); ObjectURLGenerator urlGen = new AmazonURLGenerator(); ReflectionTestUtils.setField(urlGen, "s3Client", ObjectDownloadServiceStubFactory.createS3ClientForRadosGW(endpointUrl)); ReflectionTestUtils.setField(service, "urlGenerator", urlGen); when(s3Client.getObject(Mockito.any())).thenThrow(firstException); List<Part> parts = ObjectDownloadServiceStubFactory.createParts(5); ObjectSpecification os = ObjectDownloadServiceStubFactory.createObjectSpecification(objectId, ObjectKeys.getObjectKey(dataDir, objectId), 104857600); os.setParts(parts); os.setRelocated(false); ObjectDownloadService sut = spy(service); doReturn(os).when(sut).getSpecification(objectId); val objSpec = sut.download(objectId, 0, 104857600, false); Part p = objSpec.getParts().get(0); URL url = new URL(p.getUrl()); String path = url.getPath(); if (path.startsWith("/")) { path = path.substring(1, path.length() - 1); } String bucket = Splitter.on('/').trimResults().omitEmptyStrings().split(path).iterator().next(); assertTrue((dataBucketName.length() < bucket.length()) && (bucket.startsWith(dataBucketName))); Pattern pattern = Pattern.compile(".+\\.\\d+$"); assertTrue(pattern.matcher(bucket).matches()); System.out.println(); }

Target:
public void verify_partitioned_buckets_in_download_presigned_urls() throws Exception { val firstException = new AmazonServiceException("Didn't find Object Id in bucket"); firstException.setStatusCode(HttpStatus.NOT_FOUND.value()); int bucketPoolSize = 32; int bucketKeySize = 2; namingService.setBucketPoolSize(bucketPoolSize); namingService.setBucketKeySize(bucketKeySize); val urlGen = new AmazonURLGenerator(); ReflectionTestUtils.setField(urlGen, "s3Client", ObjectDownloadServiceStubFactory.createS3ClientForRadosGW(endpointUrl)); ReflectionTestUtils.setField(service, "urlGenerator", urlGen); when(s3Client.getObject(Mockito.any())).thenThrow(firstException); val parts = ObjectDownloadServiceStubFactory.createParts(5); val os = ObjectDownloadServiceStubFactory.createObjectSpecification(objectId, ObjectKeys.getObjectKey(dataDir, objectId), 104857600); os.setParts(parts); os.setRelocated(false); val sut = spy(service); doReturn(os).when(sut).getSpecification(objectId); val objSpec = sut.download(objectId, 0, 104857600, false); val p = objSpec.getParts().get(0); val url = new URL(p.getUrl()); String path = url.getPath(); if (path.startsWith("/")) { path = path.substring(1, path.length() - 1); } val bucket = Splitter.on('/').trimResults().omitEmptyStrings().split(path).iterator().next(); assertTrue((objectBucketName.length() < bucket.length()) && (bucket.startsWith(objectBucketName))); val pattern = Pattern.compile(".+\\.\\d+$"); assertTrue(pattern.matcher(bucket).matches()); System.out.println(); }
Source:
private void writeMetadata() { csvAppender("# METADATA:"); for (String m : metadata) { csvAppender(m); } for (String a : attributeMetadata) { csvAppender(a); } csvAppender(fNEW_LINE); }

Target:
private void writeMetadata() { csvAppender("# METADATA:"); for (String m : metadata) { csvAppender(m); } for (String a : attributeMetadata) { csvAppender(a); } csvAppender(NEW_LINE); }
Source:
public int getItemCount() { if (isPlaying) { return Math.max(tactCount, MINIMUM_TACT_COUNT) + PLUS_BUTTON_ON_END + 1; } return Math.max(tactCount, MINIMUM_TACT_COUNT) + PLUS_BUTTON_ON_END; }

Target:
public int getItemCount() { if (isPlaying) { return Math.max(tactCount, MINIMUM_TACT_COUNT) + EMPTY_VIEW_COUNT_ON_END; } return Math.max(tactCount, MINIMUM_TACT_COUNT) + PLUS_BUTTON_ON_END; }
Source:
private static Object createDependency(Class<?> clazz) { if (clazz == TaskExecutor.class) { return Globals.TASK_EXECUTOR; } else if (clazz == PreferencesService.class) { return Globals.prefs; } else if (clazz == KeyBindingRepository.class) { return Globals.getKeyPrefs(); } else if (clazz == JournalAbbreviationLoader.class) { return Globals.journalAbbreviationLoader; } else if (clazz == StateManager.class) { return Globals.stateManager; } else if (clazz == FileUpdateMonitor.class) { return Globals.getFileUpdateMonitor(); } else if (clazz == ProtectedTermsLoader.class) { return Globals.protectedTermsLoader; } else if (clazz == ClipBoardManager.class) { return Globals.clipboardManager; } else if (clazz == UndoManager.class) { return Globals.undoManager; } else { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException ex) { LOGGER.error("Cannot instantiate dependency: " + clazz, ex); return null; } } }

Target:
private static Object createDependency(Class<?> clazz) { if (clazz == DialogService.class) { return JabRefGUI.getMainFrame().getDialogService(); } else if (clazz == TaskExecutor.class) { return Globals.TASK_EXECUTOR; } else if (clazz == PreferencesService.class) { return Globals.prefs; } else if (clazz == KeyBindingRepository.class) { return Globals.getKeyPrefs(); } else if (clazz == JournalAbbreviationLoader.class) { return Globals.journalAbbreviationLoader; } else if (clazz == StateManager.class) { return Globals.stateManager; } else if (clazz == FileUpdateMonitor.class) { return Globals.getFileUpdateMonitor(); } else if (clazz == ProtectedTermsLoader.class) { return Globals.protectedTermsLoader; } else if (clazz == ClipBoardManager.class) { return Globals.clipboardManager; } else if (clazz == UndoManager.class) { return Globals.undoManager; } else { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException ex) { LOGGER.error("Cannot instantiate dependency: " + clazz, ex); return null; } } }
Source:
public void ShouldBindView_WhenCreated() throws Exception { assertThat(activity.languageSpinner).isNotNull(); assertThat(activity.countrySpinner).isNotNull(); assertThat(activity.ageTextView).isNotNull(); assertThat(activity.genderSpinner).isNotNull(); assertThat(activity.startButton).isNotNull(); }

Target:
public void ShouldBindView_WhenCreated() { assertThat(activity.languageSpinner).isNotNull(); assertThat(activity.countrySpinner).isNotNull(); assertThat(activity.ageTextView).isNotNull(); assertThat(activity.genderSpinner).isNotNull(); assertThat(activity.startButton).isNotNull(); }
Source:
private void glusterHostAdd(Guid targetClusterId) { if (getClusterUtils().hasMultipleServers(targetClusterId)) { String hostName = (getVds().gethost_name().isEmpty()) ? getVds().getManagmentIp() : getVds().gethost_name(); VDSReturnValue returnValue = runVdsCommand( VDSCommandType.GlusterHostAdd, new GlusterHostAddVDSParameters(getClusterUtils().getUpServer(targetClusterId).getId(), hostName)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); errorType = AuditLogType.GLUSTER_HOST_ADD_FAILED; return; } } }

Target:
private void glusterHostAdd(Guid targetClusterId) { String hostName = (getVds().gethost_name().isEmpty()) ? getVds().getManagmentIp() : getVds().gethost_name(); VDSReturnValue returnValue = runVdsCommand( VDSCommandType.GlusterHostAdd, new GlusterHostAddVDSParameters(getClusterUtils().getUpServer(targetClusterId).getId(), hostName)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_HOST_ADD_FAILED; return; } }
Source:
public @ResponseBody DeferredResult<RelationshipChanges> getRelationshipChanges( @ApiParam(value="The classification identifier") @PathVariable(value="classificationId") final String classificationId, @ApiParam(value="Expansion parameters") @RequestParam(value="expand", required=false) final String expand, @ApiParam(value="The search key") @RequestParam(value="searchAfter", required=false) final String searchAfter, @ApiParam(value="The maximum number of items to return") @RequestParam(value="limit", defaultValue="50", required=false) final int limit) { final String expandWithRelationship; if (Strings.isNullOrEmpty(expand)) { expandWithRelationship = "relationship()"; } else if (expand.contains("relationsip")) { expandWithRelationship = expand; } else { expandWithRelationship = String.format("%s, relationship()", expand); } return DeferredResults.wrap(ClassificationRequests.prepareSearchRelationshipChange() .filterByClassificationId(classificationId) .setExpand(expandWithRelationship) .setSearchAfter(searchAfter) .setLimit(limit) .build(SnomedDatastoreActivator.REPOSITORY_UUID) .execute(bus)); }

Target:
public @ResponseBody DeferredResult<RelationshipChanges> getRelationshipChanges( @ApiParam(value="The classification identifier") @PathVariable(value="classificationId") final String classificationId, @ApiParam(value="Expansion parameters") @RequestParam(value="expand", required=false) final String expand, @ApiParam(value="The search key") @RequestParam(value="searchAfter", required=false) final String searchAfter, @ApiParam(value="The maximum number of items to return") @RequestParam(value="limit", defaultValue="50", required=false) final int limit) { final String expandWithRelationship; if (Strings.isNullOrEmpty(expand)) { expandWithRelationship = "relationship()"; } else { expandWithRelationship = String.format("relationship(expand(%s))", expand); } return DeferredResults.wrap(ClassificationRequests.prepareSearchRelationshipChange() .filterByClassificationId(classificationId) .setExpand(expandWithRelationship) .setSearchAfter(searchAfter) .setLimit(limit) .build(SnomedDatastoreActivator.REPOSITORY_UUID) .execute(bus)); }
Source:
private Map<Integer, IndicatorValue> parseJSON(String response) throws JSONException { Map<Integer, IndicatorValue> indicatorMap = new HashMap<>(); JSONArray responseArray = new JSONArray(response); for (int i = 0; i < responseArray.length(); i++) { JSONObject valueRow = responseArray.getJSONObject(i); Double doubleValue = valueRow.optDouble("value"); if (Double.NaN != doubleValue) { IndicatorValue indicatorValue = new IndicatorValueFloat(doubleValue); Integer id = Integer.valueOf(valueRow.getString("region")); indicatorMap.put(id, indicatorValue); } } return indicatorMap; }

Target:
private Map<Integer, IndicatorValue> parseJSON(String response) throws JSONException { Map<Integer, IndicatorValue> indicatorMap = new HashMap<>(); JSONArray responseArray = new JSONArray(response); for (int i = 0; i < responseArray.length(); i++) { JSONObject valueRow = responseArray.getJSONObject(i); Double doubleValue = valueRow.optDouble("value"); int sotkaRegionId = valueRow.optInt("region", -1); if (sotkaRegionId != -1 && Double.NaN != doubleValue) { indicatorMap.put(sotkaRegionId, new IndicatorValueFloat(doubleValue)); } } return indicatorMap; }
Source:
protected void createConnection() { DockerExplorerView dockerView = new DockerExplorerView(); dockerView.open(); String dockerMachineName = System.getProperty(SYSPROP_DOCKER_MACHINE_NAME); String dockerServerURI = System.getProperty(SYSPROP_DOCKER_SERVER_URI); String unixSocket = System.getProperty(SYSPROP_UNIX_SOCKET); if (!StringUtils.isBlank(dockerMachineName)) { dockerView.createDockerConnectionSearch(dockerMachineName); this.connection = getConnectionByName(dockerMachineName); } else if (!StringUtils.isEmpty(dockerServerURI)) { dockerView.createDockerConnection(AuthenticationMethod.TCP_CONNECTION, dockerServerURI, null, dockerServerURI); this.connection = getConnectionByHost(dockerServerURI); } else if (!StringUtils.isEmpty(unixSocket)) { dockerView.createDockerConnection(AuthenticationMethod.UNIX_SOCKET, unixSocket, null, unixSocket); this.connection = getConnectionByHost(dockerServerURI); } else { fail("Cannot create a docker connection. " + "Neither " + SYSPROP_DOCKER_MACHINE_NAME + " nor " + SYSPROP_DOCKER_SERVER_URI + " nor " + SYSPROP_UNIX_SOCKET + " were defined."); } if (connection == null) { fail("Could not create connection to server " + getServer()); } connection.enableConnection(); }

Target:
protected DockerConnection createConnection() { DockerExplorerView dockerView = new DockerExplorerView(); dockerView.open(); String dockerMachineName = System.getProperty(SYSPROP_DOCKER_MACHINE_NAME); String dockerServerURI = System.getProperty(SYSPROP_DOCKER_SERVER_URI); String unixSocket = System.getProperty(SYSPROP_UNIX_SOCKET); if (!StringUtils.isBlank(dockerMachineName)) { dockerView.createDockerConnectionSearch(dockerMachineName); this.connection = getConnectionByName(dockerMachineName); } else if (!StringUtils.isEmpty(dockerServerURI)) { dockerView.createDockerConnection(AuthenticationMethod.TCP_CONNECTION, dockerServerURI, null, dockerServerURI); this.connection = getConnectionByHost(dockerServerURI); } else if (!StringUtils.isEmpty(unixSocket)) { dockerView.createDockerConnection(AuthenticationMethod.UNIX_SOCKET, unixSocket, null, unixSocket); this.connection = getConnectionByHost(unixSocket); } else { fail("Cannot create a docker connection. " + "Neither " + SYSPROP_DOCKER_MACHINE_NAME + " nor " + SYSPROP_DOCKER_SERVER_URI + " nor " + SYSPROP_UNIX_SOCKET + " were defined."); } connection.enableConnection(); return connection; }
Source:
public void setRelay(Command command, String number) { if (command instanceof OnOffType) { if( ((OnOffType) command) == OnOffType.ON) { HttpUtil.executeUrl(GET, createURL() + "/" + XML_PATH + "?" + SUFFIX_PASSWORD + getPassword() + "&" + SUFFIX_RELAY + number + "=" + "1", this.timeOut); } else { HttpUtil.executeUrl(GET, createURL() + "/" + XML_PATH + "?" + SUFFIX_PASSWORD + getPassword() + "&" + SUFFIX_RELAY + number + "=" + "0", this.timeOut); } } else { logger.error("Unsupported command type"); } }

Target:
public void setRelay(Command command, String number) { if (command instanceof OnOffType) { if( ((OnOffType) command) == OnOffType.ON) { String URL = createURL() + "/" + XML_PATH + "?" + SUFFIX_PASSWORD + getPassword() + "&" + SUFFIX_RELAY + number + "=" + "1"; HttpUtil.executeUrl(GET, URL, this.timeOut); } else { String URL = createURL() + "/" + XML_PATH + "?" + SUFFIX_PASSWORD + getPassword() + "&" + SUFFIX_RELAY + number + "=" + "0"; HttpUtil.executeUrl(GET, URL, this.timeOut); } } else { logger.error("Unsupported command type"); } }
Source:
public void customize() { Networking.checkPortsValid(MutableMap.of("amqpPort", getAmqpPort())); copyTemplate(entity.getConfig(RabbitBroker.CONFIG_TEMPLATE_URL), getConfigPath() + ".config"); ScriptHelper scriptHelper = newScript(CUSTOMIZING); scriptHelper.body.append( format("cp -R %s/* .", getExpandedInstallDir()) ); if (entity.getConfig(RabbitBroker.ENABLE_MANAGEMENT_PLUGIN)) { scriptHelper.body.append( "./sbin/rabbitmq-plugins enable rabbitmq_management" ); } scriptHelper.execute(); }

Target:
public void customize() { Networking.checkPortsValid(MutableMap.of("amqpPort", getAmqpPort())); ScriptHelper scriptHelper = newScript(CUSTOMIZING); scriptHelper.body.append( format("cp -R %s/* .", getExpandedInstallDir()) ); if (Boolean.TRUE.equals(entity.getConfig(RabbitBroker.ENABLE_MANAGEMENT_PLUGIN))) { scriptHelper.body.append( "./sbin/rabbitmq-plugins enable rabbitmq_management" ); } scriptHelper.failOnNonZeroResultCode(); scriptHelper.execute(); copyTemplate(entity.getConfig(RabbitBroker.CONFIG_TEMPLATE_URL), getConfigPath() + ".config"); }
Source:
private boolean areLeafNodes(CascadeNodeDao dao, Long cascadeResourceId, List<CascadeNode> nodes) { if (nodes.size() == 0) { return true; } else { CascadeNode firstNode = nodes.get(0); List<CascadeNode> childNodes = dao.listCascadeNodesByResourceAndParentId( cascadeResourceId, firstNode.getKey().getId()); return childNodes.size() == 0; } }

Target:
private boolean areLeafNodes(CascadeNodeDao dao, Long cascadeResourceId, List<CascadeNode> nodes) { CascadeNode firstNode = nodes.get(0); List<CascadeNode> childNodes = dao.listCascadeNodesByResourceAndParentId( cascadeResourceId, firstNode.getKey().getId()); return childNodes.size() == 0; }
Source:
private RecordCursor initFunctionsAndCursor(SqlExecutionContext executionContext, RecordCursor baseCursor) { long maxInMemoryRows = executionContext.getCairoSecurityContext().getMaxInMemoryRows(); if (maxInMemoryRows >= 0 && baseCursor.size() >= 0 && baseCursor.size() > maxInMemoryRows) { baseCursor.close(); throw LimitOverflowException.instance(maxInMemoryRows); } map.setMaxSize(maxInMemoryRows); cursor.of(baseCursor); for (int i = 0, m = recordFunctions.size(); i < m; i++) { recordFunctions.getQuick(i).init(cursor, executionContext); } return cursor; }

Target:
private RecordCursor initFunctionsAndCursor(SqlExecutionContext executionContext, RecordCursor baseCursor) { long maxInMemoryRows = executionContext.getCairoSecurityContext().getMaxInMemoryRows(); if (maxInMemoryRows > baseCursor.size()) { map.setMaxSize(maxInMemoryRows); cursor.of(baseCursor); for (int i = 0, m = recordFunctions.size(); i < m; i++) { recordFunctions.getQuick(i).init(cursor, executionContext); } return cursor; } baseCursor.close(); throw LimitOverflowException.instance(maxInMemoryRows); }
Source:
public void visitToken(DetailAST ast) { if (isOperatorNode(ast)) { if (option == WrapOption.NL && TokenUtil.areOnSameLine(ast, getLeftNode(ast)) && !TokenUtil.areOnSameLine(ast, getRightNode(ast))) { log(ast, MSG_LINE_NEW, ast.getText()); } else if (option == WrapOption.EOL && !TokenUtil.areOnSameLine(ast, getLeftNode(ast))) { log(ast, MSG_LINE_PREVIOUS, ast.getText()); } } }

Target:
public void visitToken(DetailAST ast) { if (isTargetNode(ast)) { if (option == WrapOption.NL && isNewLineModeViolation(ast)) { log(ast, MSG_LINE_NEW, ast.getText()); } else if (option == WrapOption.EOL && isEndOfLineModeViolation(ast)) { log(ast, MSG_LINE_PREVIOUS, ast.getText()); } } }
Source:
public void delete(String workspaceId) throws InfrastructureException { String projectName; try { projectName = evalNamespaceName(workspaceId, EnvironmentContext.getCurrent().getSubject()); } catch (NotFoundException | ServerException | ConflictException | ValidationException e) { throw new InfrastructureException( format("Failed to evaluate the project name to use for workspace %s.", workspaceId), e); } OpenShiftProject osProject = doCreateProject(workspaceId, projectName); osProject.delete(); }

Target:
public void delete(String workspaceId) throws InfrastructureException { String projectName; try { projectName = evalNamespaceName(workspaceId, EnvironmentContext.getCurrent().getSubject()); } catch (NotFoundException | ServerException | ConflictException | ValidationException e) { throw new InfrastructureException( format( "Failed to evaluate the project name to use for workspace %s." + " The error message was: %s", workspaceId, e.getMessage()), e); } OpenShiftProject osProject = doCreateProject(workspaceId, projectName); osProject.delete(); }
Source:
public synchronized int getCheckpointSize() { if (fCheckpointSize == -1) { TmfCheckpoint c = new TmfCheckpoint(TmfTimestamp.ZERO, new TmfLongLocation(0L), 0); ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE); b.clear(); c.serialize(b); fCheckpointSize = b.position(); } return fCheckpointSize; }

Target:
public int getCheckpointSize() { synchronized (getClass()) { if (fCheckpointSize == -1) { TmfCheckpoint c = new TmfCheckpoint(TmfTimestamp.ZERO, new TmfLongLocation(0L), 0); ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE); b.clear(); c.serialize(b); fCheckpointSize = b.position(); } } return fCheckpointSize; }
Source:
public void testMediatorFactory() { OMElement mediatorElement = SynapseConfigUtils.stringToOM(mediatorXml); CacheMediatorFactory factory = new CacheMediatorFactory(); CacheMediator mediator = (CacheMediator) factory.createSpecificMediator(mediatorElement, new Properties()); assertFalse(mediator.isCollector()); assertEquals(mediator.getTimeout(), 60); assertEquals(mediator.getProtocolType(), "HTTP"); assertTrue(Arrays.equals(mediator.getHTTPMethodsToCache(), new String[]{"POST", "GET"})); assertTrue(Arrays.equals(mediator.getHeadersToExcludeInHash(), new String[]{"ab", "abc"})); assertEquals(mediator.getResponseCodes(), "2|5[0-9][0-9]"); assertEquals(mediator.getDigestGenerator().getClass().getName(), "org.wso2.carbon.mediator.cache.digest.HttpRequestHashGenerator"); assertEquals(mediator.getInMemoryCacheSize(), 20); }

Target:
public void testMediatorFactory() { OMElement mediatorElement = SynapseConfigUtils.stringToOM(mediatorXml); CacheMediatorFactory factory = new CacheMediatorFactory(); CacheMediator mediator = (CacheMediator) factory.createSpecificMediator(mediatorElement, new Properties()); assertFalse("Incorrect value for the collector", mediator.isCollector()); assertEquals("Incorrect value for the timeout", mediator.getTimeout(), 60); assertEquals("Incorrect value for the protocol type", mediator.getProtocolType(), "HTTP"); assertTrue("Incorrect value for the httpMethodsToCache", Arrays.equals(mediator.getHTTPMethodsToCache(), new String[]{"POST", "GET"})); assertTrue("Incorrect value for the headersToExcludeInHash",Arrays.equals(mediator.getHeadersToExcludeInHash(), new String[]{"ab", "abc"})); assertEquals("Incorrect value for the for the responsecodes",mediator.getResponseCodes(), "2|5[0-9][0-9]"); assertEquals("Incorrect value for the hashGenerator",mediator.getDigestGenerator().getClass().getName(), "org.wso2.carbon.mediator.cache.digest.HttpRequestHashGenerator"); assertEquals("Incorrect value for the maxSize",mediator.getInMemoryCacheSize(), 20); }
Source:
public boolean containsKey(K key) { if (service.isRunning()) { return get(key) != null; } return false; }

Target:
public boolean containsKey(K key) { if (service.isRunning()) { String target = buildUrl(service.cacheName, key); Response response = null; response = service.getHttpClient().target(target).request().build(HttpMethod.HEAD).invoke(); if (response.getStatus() == Status.OK.getStatusCode()) { return true; } if (response.getStatus() == Status.NOT_FOUND.getStatusCode()) { return false; } throw new RuntimeException("RESTEasyHTTPOperations.containsKey::Unexpected HttpStatus: " + response.getStatus() + " " + response.getStatusInfo().getReasonPhrase() + " for request " + target); } return false; }
Source:
public @NotNull SubPeer setPreference(Connection.Direction direction) { if (direction == null) { throw new NullPointerException("`direction` cannot be null"); } this.direction = direction; return this; }

Target:
public @NotNull SubPeer setPreference(Connection.Direction direction) { this.direction = direction; return this; }
Source:
public JmsOperations createInOutTemplate(JmsEndpoint endpoint, boolean pubSubDomain, String destination, long requestTimeout) { JmsOperations answer = createInOnlyTemplate(endpoint, pubSubDomain, destination); if (answer instanceof JmsTemplate && requestTimeout > 0) { JmsTemplate jmsTemplate = (JmsTemplate) answer; jmsTemplate.setExplicitQosEnabled(true); long ttl = timeToLive > 0 ? timeToLive : requestTimeout; if (ttl > 0 && !isDisableTimeToLive()) { jmsTemplate.setTimeToLive(ttl); } if (acknowledgementMode >= 0) { jmsTemplate.setSessionAcknowledgeMode(acknowledgementMode); } else if (acknowledgementModeName != null) { jmsTemplate.setSessionAcknowledgeModeName(acknowledgementModeName); } else { jmsTemplate.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE); } jmsTemplate.setDeliveryDelay(deliveryDelay); } return answer; }

Target:
public JmsOperations createInOutTemplate(JmsEndpoint endpoint, boolean pubSubDomain, String destination, long requestTimeout) { JmsOperations answer = createInOnlyTemplate(endpoint, pubSubDomain, destination); if (answer instanceof JmsTemplate && requestTimeout > 0) { JmsTemplate jmsTemplate = (JmsTemplate) answer; jmsTemplate.setExplicitQosEnabled(true); long ttl = timeToLive > 0 ? timeToLive : requestTimeout; if (ttl > 0 && !isDisableTimeToLive()) { jmsTemplate.setTimeToLive(ttl); } if (acknowledgementMode >= 0) { jmsTemplate.setSessionAcknowledgeMode(acknowledgementMode); } else if (acknowledgementModeName != null) { jmsTemplate.setSessionAcknowledgeModeName(acknowledgementModeName); } else { jmsTemplate.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE); } } return answer; }
Source:
private void refreshVdsStats() { if (Config.<Boolean> getValue(ConfigValues.DebugTimerLogging)) { log.debugFormat("vdsManager::refreshVdsStats entered, vds = {0} : {1}", _vds.getId(), _vds.getName()); } fetchHostInterfaces(); GetStatsVDSCommand<VdsIdAndVdsVDSCommandParametersBase> vdsBrokerCommand = new GetStatsVDSCommand<VdsIdAndVdsVDSCommandParametersBase>(new VdsIdAndVdsVDSCommandParametersBase(_vds)); vdsBrokerCommand.execute(); getVdsEventListener().updateSchedulingStats(_vds); if (!vdsBrokerCommand.getVDSReturnValue().getSucceeded() && vdsBrokerCommand.getVDSReturnValue().getExceptionObject() != null) { VDSNetworkException ex = (VDSNetworkException) ((vdsBrokerCommand.getVDSReturnValue().getExceptionObject() instanceof VDSNetworkException) ? vdsBrokerCommand .getVDSReturnValue().getExceptionObject() : null); if (ex != null) { if (_vdsManager.handleNetworkException(ex, _vds)) { _saveVdsDynamic = true; } log.errorFormat("vds::refreshVdsStats Failed getVdsStats, vds = {0} : {1}, error = {2}", _vds.getId(), _vds.getName(), ExceptionUtils.getMessage(ex)); } else { log.errorFormat("vds::refreshVdsStats Failed getVdsStats, vds = {0} : {1}, error = {2}", _vds.getId(), _vds.getName(), vdsBrokerCommand.getVDSReturnValue().getExceptionString()); } throw vdsBrokerCommand.getVDSReturnValue().getExceptionObject(); } _saveVdsDynamic = true; _saveVdsStatistics = true; alertIfLowDiskSpaceOnHost(); checkVdsInterfaces(); if (Config.<Boolean> getValue(ConfigValues.DebugTimerLogging)) { log.debugFormat("vds::refreshVdsStats\n{0}", toString()); } }

Target:
public void refreshVdsStats() { if (Config.<Boolean> getValue(ConfigValues.DebugTimerLogging)) { log.debugFormat("vdsManager::refreshVdsStats entered, vds = {0} : {1}", _vds.getId(), _vds.getName()); } fetchHostInterfaces(); GetStatsVDSCommand<VdsIdAndVdsVDSCommandParametersBase> vdsBrokerCommand = new GetStatsVDSCommand<VdsIdAndVdsVDSCommandParametersBase>(new VdsIdAndVdsVDSCommandParametersBase(_vds)); vdsBrokerCommand.execute(); getVdsEventListener().updateSchedulingStats(_vds); if (!vdsBrokerCommand.getVDSReturnValue().getSucceeded() && vdsBrokerCommand.getVDSReturnValue().getExceptionObject() != null) { VDSNetworkException ex = (VDSNetworkException) ((vdsBrokerCommand.getVDSReturnValue().getExceptionObject() instanceof VDSNetworkException) ? vdsBrokerCommand .getVDSReturnValue().getExceptionObject() : null); if (ex != null) { if (_vdsManager.handleNetworkException(ex, _vds)) { _saveVdsDynamic = true; } log.errorFormat("vds::refreshVdsStats Failed getVdsStats, vds = {0} : {1}, error = {2}", _vds.getId(), _vds.getName(), ExceptionUtils.getMessage(ex)); } else { log.errorFormat("vds::refreshVdsStats Failed getVdsStats, vds = {0} : {1}, error = {2}", _vds.getId(), _vds.getName(), vdsBrokerCommand.getVDSReturnValue().getExceptionString()); } throw vdsBrokerCommand.getVDSReturnValue().getExceptionObject(); } _saveVdsDynamic = true; _saveVdsStatistics = true; alertIfLowDiskSpaceOnHost(); checkVdsInterfaces(); if (Config.<Boolean> getValue(ConfigValues.DebugTimerLogging)) { log.debugFormat("vds::refreshVdsStats\n{0}", toString()); } }
Source:
public static void sortDetailedCoursesByCourseId(List<CourseDetailsBundle> courses) { courses.sort(Comparator.comparing((CourseDetailsBundle obj) -> obj.course.getId())); }

Target:
public static void sortDetailedCoursesByCourseId(List<CourseDetailsBundle> courses) { courses.sort(Comparator.comparing(obj -> obj.course.getId())); }
Source:
public void removeAll() { HashSet<String> allHandles = getAllHandlesFromIndex(); for (String handle : allHandles) { removeByHandle(handle); } }

Target:
public void removeAll() { Set<String> allHandlesFromStore = getAllHandlesFromIndex(); for (String handle : allHandlesFromStore) { removeByHandle(handle); } }
Source:
public static String normalizeBranchName(String name, boolean trim) { if (trim) { name = name.trim(); } return name.replaceAll("\\s+([_:-])\\s+", "$1") .replaceAll(":", "-") .replaceAll("\\s+", "_") .replaceAll("_{2,}", "_") .replaceAll("^_", "") .replaceAll("[^\\w-]", ""); }

Target:
public static String normalizeBranchName(String name, boolean trim) { String result = name; if (trim) { result = name.trim(); } return result.replaceAll("\\s+([_:-])\\s+", "$1") .replaceAll(":", "-") .replaceAll("\\s+", "_") .replaceAll("_{2,}", "_") .replaceAll("^_", "") .replaceAll("[^\\w-]", ""); }
Source:
private void testCompatibleShuffleModeWithBufferTimeout(ShuffleMode shuffleMode) { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStream<Integer> sourceDataStream = env.fromElements(1, 2, 3); sourceDataStream.getTransformation().setBufferTimeout(100); PartitionTransformation<Integer> transformation = new PartitionTransformation<>( sourceDataStream.getTransformation(), new RebalancePartitioner<>(), shuffleMode); DataStream<Integer> partitionStream = new DataStream<>(env, transformation); partitionStream.map(value -> value).print(); StreamingJobGraphGenerator.createJobGraph(env.getStreamGraph()); }

Target:
private void testCompatibleShuffleModeWithBufferTimeout(ShuffleMode shuffleMode) { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setBufferTimeout(100); DataStream<Integer> sourceDataStream = env.fromElements(1, 2, 3); PartitionTransformation<Integer> transformation = new PartitionTransformation<>( sourceDataStream.getTransformation(), new RebalancePartitioner<>(), shuffleMode); DataStream<Integer> partitionStream = new DataStream<>(env, transformation); partitionStream.map(value -> value).print(); StreamingJobGraphGenerator.createJobGraph(env.getStreamGraph()); }
Source:
private boolean isValidDomain(double minx, double maxx, double miny, double maxy) { final int width = (int) (maxx - minx); final int height = (int) (maxy - miny); if (abs(width) == 0 || height == 0) { return false; } return true; }

Target:
private boolean isValidDomain(double minx, double maxx, double miny, double maxy) { final int width = (int) (maxx - minx); final int height = (int) (maxy - miny); return width > 0 && height > 0; }
Source:
private void setGetBlobResponseHeaders(BlobInfo blobInfo, GetBlobOptions options, RestResponseChannel restResponseChannel) throws RestServiceException { BlobProperties blobProperties = blobInfo.getBlobProperties(); restResponseChannel.setHeader(RestUtils.Headers.BLOB_SIZE, blobProperties.getBlobSize()); restResponseChannel.setHeader(RestUtils.Headers.ACCEPT_RANGES, RestUtils.BYTE_RANGE_UNITS); long contentLength = blobProperties.getBlobSize(); if (options.getRange() != null) { Pair<String, Long> rangeAndLength = RestUtils.buildContentRangeAndLength(options.getRange(), contentLength, options.resolveRangeOnEmptyBlob()); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_RANGE, rangeAndLength.getFirst()); contentLength = rangeAndLength.getSecond(); } if (contentLength < frontendConfig.chunkedGetResponseThresholdInBytes) { restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, contentLength); } if (blobProperties.getContentType() != null) { restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, blobProperties.getContentType()); if (blobProperties.getContentType().equals("text/html")) { restResponseChannel.setHeader("Content-Disposition", "attachment"); } } if (blobProperties.getContentEncoding() != null) { restResponseChannel.setHeader(Headers.AMBRY_CONTENT_ENCODING, blobProperties.getContentEncoding()); } if (blobProperties.getFilename() != null) { restResponseChannel.setHeader(Headers.AMBRY_FILENAME, blobProperties.getFilename()); } }

Target:
private void setGetBlobResponseHeaders(BlobInfo blobInfo, GetBlobOptions options, RestResponseChannel restResponseChannel) throws RestServiceException { BlobProperties blobProperties = blobInfo.getBlobProperties(); restResponseChannel.setHeader(RestUtils.Headers.BLOB_SIZE, blobProperties.getBlobSize()); restResponseChannel.setHeader(RestUtils.Headers.ACCEPT_RANGES, RestUtils.BYTE_RANGE_UNITS); long contentLength = blobProperties.getBlobSize(); if (options.getRange() != null) { Pair<String, Long> rangeAndLength = RestUtils.buildContentRangeAndLength(options.getRange(), contentLength, options.resolveRangeOnEmptyBlob()); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_RANGE, rangeAndLength.getFirst()); contentLength = rangeAndLength.getSecond(); } if (contentLength < frontendConfig.chunkedGetResponseThresholdInBytes) { restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, contentLength); } if (blobProperties.getContentType() != null) { restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, blobProperties.getContentType()); if (blobProperties.getContentType().equals("text/html")) { restResponseChannel.setHeader("Content-Disposition", "attachment"); } } if (blobProperties.getContentEncoding() != null) { restResponseChannel.setHeader(Headers.CONTENT_ENCODING, blobProperties.getContentEncoding()); } }
Source:
public List<HashMap<String,Object>> getLoggedEvents(@RequestParam String site, @RequestParam long since) { return CircularQueueLogAppender.loggerQueue().getLoggedEvents(site, since); }

Target:
public List<Map<String,Object>> getLoggedEvents(@RequestParam String site, @RequestParam long since) { return CircularQueueLogAppender.loggerQueue().getLoggedEvents(site, since); }
Source:
public String getEndTimeInIso8601Format() { return TimeHelper.convertAndFormatDateToIso8601Utc(endTime, timeZone); }

Target:
public String getEndTimeInIso8601Format() { Date endTimeInUtc = TimeHelper.convertLocalDateToUtc(endTime, timeZone); return TimeHelper.formatDateToIso8601Utc(endTimeInUtc); }