auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setup() throws SQLException { prop = new Properties(); conn = DriverManager.getConnection(getUrl(), prop); conn.setAutoCommit(true); conn.createStatement().execute("CREATE TABLE IF NOT EXISTS test.us_population (\n" + " state CHAR(2) NOT NULL,\n" + " city VARCHAR NOT NULL,\n" + " population BIGINT,\n" + " CONSTRAINT my_pk PRIMARY KEY (state, city)) " + tableDDLOptions); if(isViewIndex) { conn.createStatement().execute("CREATE VIEW IF NOT EXISTS test.us_population_gv" + "(city_area INTEGER, avg_fam_size INTEGER) AS " + "SELECT * FROM test.us_population WHERE state = 'CA'"); conn.createStatement().execute("CREATE INDEX IF NOT EXISTS us_population_gv_gi ON " + "test.us_population_gv (city_area) INCLUDE (population)"); conn.createStatement().execute("CREATE INDEX IF NOT EXISTS us_population_gv_gi_2 ON " + "test.us_population_gv (avg_fam_size) INCLUDE (population)"); phoenixObjectName = "test.us_population_gv"; indexesName = "us_population_gv_gi, us_population_gv_gi_2"; } else { conn.createStatement().execute("CREATE INDEX IF NOT EXISTS us_population_gi ON " + "test.us_population (population)"); conn.createStatement().execute("CREATE INDEX IF NOT EXISTS us_population_gi_2 ON " + "test.us_population (state, population)"); phoenixObjectName = "test.us_population"; indexesName = "us_population_gi, us_population_gi_2"; } }

Target:
public void setup() throws SQLException { prop = new Properties(); conn = DriverManager.getConnection(getUrl(), prop); conn.setAutoCommit(true); String schemaName = "S_"+generateUniqueName(); String indexNameOne = "I_"+generateUniqueName(); String indexNameTwo = "I_"+generateUniqueName(); String tableName = "T_"+generateUniqueName(); String viewName = "V_"+generateUniqueName(); String fullViewName = SchemaUtil.getQualifiedTableName(schemaName, viewName); String fullTableName = SchemaUtil.getQualifiedTableName(schemaName, tableName); conn.createStatement().execute("CREATE TABLE IF NOT EXISTS " + fullTableName + " (\n" + " state CHAR(2) NOT NULL,\n" + " city VARCHAR NOT NULL,\n" + " population BIGINT,\n" + " CONSTRAINT my_pk PRIMARY KEY (state, city)) " + tableDDLOptions); if(isViewIndex) { conn.createStatement().execute("CREATE VIEW IF NOT EXISTS " + fullViewName + " (city_area INTEGER, avg_fam_size INTEGER) AS " + "SELECT * FROM "+fullTableName+" WHERE state = 'CA'"); conn.createStatement().execute("CREATE INDEX IF NOT EXISTS " + indexNameOne + " ON " + fullViewName+" (city_area) INCLUDE (population)"); conn.createStatement().execute("CREATE INDEX IF NOT EXISTS " + indexNameTwo + " ON " + fullViewName+" (avg_fam_size) INCLUDE (population)"); phoenixObjectName = fullViewName; } else { conn.createStatement().execute("CREATE INDEX IF NOT EXISTS " + indexNameOne + " ON " + fullTableName+" (population)"); conn.createStatement().execute("CREATE INDEX IF NOT EXISTS " + indexNameTwo + " ON " + fullTableName+" (state, population)"); phoenixObjectName = fullTableName; } fullIndexNameOne = SchemaUtil.getQualifiedTableName(schemaName, indexNameOne); fullIndexNameTwo = SchemaUtil.getQualifiedTableName(schemaName, indexNameTwo); indexNames = indexNameOne +", "+indexNameTwo; }
Source:
protected boolean validate() { if (getParameters() == null || getParameters().getAgent() == null || getParameters().getAgent().getId() == null) { return failValidation(EngineMessage.VDS_REMOVE_FENCE_AGENT_ID_REQUIRED); } if (getVds().isPmEnabled()) { List<FenceAgent> fenceAgents = fenceAgentDao.getFenceAgentsForHost(getVdsId()); if (fenceAgents.size() == 1) { return failValidation(EngineMessage.VDS_REMOVE_LAST_FENCE_AGENT_PM_ENABLED); } } return super.validate(); }

Target:
protected boolean validate() { if (getParameters() == null || getParameters().getAgent() == null || getParameters().getAgent().getId() == null) { return failValidation(EngineMessage.VDS_REMOVE_FENCE_AGENT_ID_REQUIRED); } VDS host = getVds(); if (host != null && host.isPmEnabled()) { List<FenceAgent> fenceAgents = fenceAgentDao.getFenceAgentsForHost(getVdsId()); if (fenceAgents.size() == 1) { return failValidation(EngineMessage.VDS_REMOVE_LAST_FENCE_AGENT_PM_ENABLED); } } return super.validate(); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { final Intent intent = getIntent(); final String url = intent.getStringExtra(Intent.EXTRA_TEXT); switch (item.getItemId()) { case R.id.open: Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); break; case R.id.copy_link: copyLink(url); break; case R.id.download: downloadImage(url); default: return super.onOptionsItemSelected(item); } return true; }

Target:
public boolean onOptionsItemSelected(MenuItem item) { final Intent intent = getIntent(); final String url = intent.getStringExtra(Intent.EXTRA_TEXT); switch (item.getItemId()) { case R.id.open: Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); break; case R.id.copy_link: copyLink(url); break; case R.id.download: if (ActivityCompat.checkSelfPermission(PhotoViewActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { allowPermission(); } else { downloadImage(url); } break; default: return super.onOptionsItemSelected(item); } return true; }
Source:
private boolean mustCheckPasswordValidity() { return Framework.getProperty(VALIDATE_PASSWORD_PARAM,"false").equals("true"); }

Target:
private boolean mustCheckPasswordValidity() { return Boolean.parseBoolean(Framework.getProperty(VALIDATE_PASSWORD_PARAM,"false")); }
Source:
private AdvancedViatraQueryEngine createEngine() { boolean wildcardMode = ViatraQueryGUIPlugin.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.WILDCARD_MODE); boolean dynamicEMFMode = ViatraQueryGUIPlugin.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.DYNAMIC_EMF_MODE); try { BaseIndexOptions options = new BaseIndexOptions(dynamicEMFMode, wildcardMode); QueryScope scope = new EMFScope(key.getNotifier(), options); Map<QueryHintOption, Object> mappings = new HashMap<QueryHintOption, Object>(); mappings.put(ReteHintOptions.deleteRederiveEvaluation, true); QueryEvaluationHint evaluationHint = new QueryEvaluationHint(mappings, new ReteBackendFactory()); ViatraQueryEngineOptions engineOptions = ViatraQueryEngineOptions.defineOptions().withDefaultHint(evaluationHint).build(); AdvancedViatraQueryEngine engine = AdvancedViatraQueryEngine.createUnmanagedEngine(scope); return engine; } catch (ViatraQueryException e) { logger.log(new Status(IStatus.ERROR, ViatraQueryGUIPlugin.PLUGIN_ID, "Could not retrieve ViatraQueryEngine for " + key.getNotifier(), e)); return null; } }

Target:
private AdvancedViatraQueryEngine createEngine() { boolean wildcardMode = ViatraQueryGUIPlugin.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.WILDCARD_MODE); boolean dynamicEMFMode = ViatraQueryGUIPlugin.getDefault().getPreferenceStore() .getBoolean(PreferenceConstants.DYNAMIC_EMF_MODE); try { BaseIndexOptions options = new BaseIndexOptions(dynamicEMFMode, wildcardMode); QueryScope scope = new EMFScope(key.getNotifier(), options); AdvancedViatraQueryEngine engine = AdvancedViatraQueryEngine.createUnmanagedEngine(scope); return engine; } catch (ViatraQueryException e) { logger.log(new Status(IStatus.ERROR, ViatraQueryGUIPlugin.PLUGIN_ID, "Could not retrieve ViatraQueryEngine for " + key.getNotifier(), e)); return null; } }
Source:
private Object evalShaHandleReloadScript(MethodContext context, List<String> keys, List<String> argv) { try { return jedis.evalsha(context.getSha1(), keys, argv); } catch (JedisDataException e) { if (e.getMessage().contains("NOSCRIPT")) { final String sha2 = jedis.scriptLoad(context.getLuaContext().getRenderedLuaString()); if (!sha2.equals(context.getSha1())) { throw new IllegalStateException("sha should match but they did not"); } return jedis.evalsha(context.getSha1(), keys, argv); } else { throw e; } } }

Target:
private Object evalShaHandleReloadScript(MethodContext context, List<String> keys, List<String> argv) { try { return jedis.evalsha(context.getSha1(), keys, argv); } catch (JedisDataException e) { if (e.getMessage() != null && e.getMessage().contains("NOSCRIPT")) { final String newSha = jedis.scriptLoad(context.getLuaContext().getRenderedLuaString()); if (!newSha.equals(context.getSha1())) { throw new IllegalStateException("sha should match but they did not"); } return jedis.evalsha(context.getSha1(), keys, argv); } else { throw e; } } }
Source:
public Map<String, String> getTimeBoundaryForTable(String table) throws Exception { final String url = String.format(TIME_BOUNDARY_API_TEMPLATE, getBrokerHost(table), table); String responseBody = sendHttpGet(url); JSONObject resp = JSONObject.parseObject(responseBody); Map<String, String> timeBoundary = new HashMap<>(); if (resp.containsKey("timeColumnName")) { timeBoundary.put("timeColumnName", resp.getString("timeColumnName")); } if (resp.containsKey("timeColumnValue")) { timeBoundary.put("timeColumnValue", resp.getString("timeColumnValue")); } return timeBoundary; }

Target:
public Map<String, String> getTimeBoundaryForTable(String table) throws Exception { final String url = String.format(TIME_BOUNDARY_API_TEMPLATE, getBrokerHost(table), table); String responseBody = sendHttpGet(url); JSONObject response = JSONObject.parseObject(responseBody); ImmutableMap.Builder<String, String> timeBoundaryBuilder = ImmutableMap.builder(); if (response.containsKey(TIME_COLUMN_NAME)) { timeBoundaryBuilder.put(TIME_COLUMN_NAME, response.getString(TIME_COLUMN_NAME)); } if (response.containsKey(TIME_COLUMN_VALUE)) { timeBoundaryBuilder.put(TIME_COLUMN_VALUE, response.getString(TIME_COLUMN_VALUE)); } return timeBoundaryBuilder.build(); }
Source:
public GetRevisionTaskThreaded(CouchDB sourceDb, List<BulkGetRequest> requests, boolean pullAttachmentsInline) { Preconditions.checkNotNull(sourceDb, "sourceDb cannot be null"); Preconditions.checkNotNull(requests, "requests cannot be null"); for (BulkGetRequest request : requests) { Preconditions.checkNotNull(request.id, "id cannot be null"); Preconditions.checkNotNull(request.revs, "revs cannot be null"); } this.sourceDb = sourceDb; this.requests.addAll(requests); this.pullAttachmentsInline = pullAttachmentsInline; this.completionService = new QueuingExecutorCompletionService<BulkGetRequest, DocumentRevsList>(executorService, this.requests, threads + 1) { @Override public DocumentRevsList executeRequest(BulkGetRequest request) { Thread.currentThread().setName("GetRevisionThread: "+GetRevisionTaskThreaded.this.sourceDb.getIdentifier()); return new DocumentRevsList(GetRevisionTaskThreaded.this.sourceDb.getRevisions (request.id, request.revs, request.atts_since, GetRevisionTaskThreaded.this.pullAttachmentsInline)); } }; }

Target:
public GetRevisionTaskThreaded(CouchDB sourceDb, List<BulkGetRequest> requests, boolean pullAttachmentsInline) { Preconditions.checkNotNull(sourceDb, "sourceDb cannot be null"); Preconditions.checkNotNull(requests, "requests cannot be null"); for (BulkGetRequest request : requests) { Preconditions.checkNotNull(request.id, "id cannot be null"); Preconditions.checkNotNull(request.revs, "revs cannot be null"); } this.sourceDb = sourceDb; this.requests.addAll(requests); this.pullAttachmentsInline = pullAttachmentsInline; this.completionService = new QueuingExecutorCompletionService<BulkGetRequest, DocumentRevsList>(executorService, this.requests, threads + 1) { @Override public DocumentRevsList executeRequest(BulkGetRequest request) { try { Thread.currentThread().setName("GetRevisionThread: " + GetRevisionTaskThreaded.this.sourceDb.getIdentifier()); } catch (SecurityException e){ logger.log(Level.WARNING, "Could not rename pull strategy pool thread", e); } return new DocumentRevsList(GetRevisionTaskThreaded.this.sourceDb.getRevisions (request.id, request.revs, request.atts_since, GetRevisionTaskThreaded.this.pullAttachmentsInline)); } }; }
Source:
private static Stream<Arguments> sameStateRepositories() { Set<Repository<?, ?>> repositories = ImmutableSet.of(new ProjectAggregateRepository(), new ProjectProjectionRepo(), new ProjectCreationRepository()); Set<Repository<?, ?>> sameStateRepositories = ImmutableSet.of(new AnotherProjectAggregateRepository(), new FinishedProjectProjectionRepo(), new ProjectRemovalRepository()); Set<List<Repository<?, ?>>> cartesianProduct = Sets.cartesianProduct(repositories, sameStateRepositories); Stream.Builder<Arguments> builder = Stream.builder(); for (List<Repository<?, ?>> list : cartesianProduct) { Repository<?, ?> firstRepo = list.get(0); Repository<?, ?> secondRepo = list.get(1); RepositoryPair pair = new RepositoryPair(firstRepo, secondRepo); builder.add(Arguments.of(pair)); } return builder.build(); }

Target:
private static Stream<Arguments> sameStateRepositories() { Set<Repository<?, ?>> repositories = ImmutableSet.of(new ProjectAggregateRepository(), new ProjectProjectionRepo(), new ProjectCreationRepository()); Set<Repository<?, ?>> sameStateRepositories = ImmutableSet.of(new AnotherProjectAggregateRepository(), new FinishedProjectProjectionRepo(), new ProjectRemovalRepository()); Set<List<Repository<?, ?>>> cartesianProduct = Sets.cartesianProduct(repositories, sameStateRepositories); Stream<Arguments> result = cartesianProduct.stream() .map(repos -> Arguments.of(repos.get(0), repos.get(1))); return result; }
Source:
public boolean registerAidGroupForService(int userId, ComponentName service, AidGroup aidGroup) throws RemoteException { NfcPermissions.validateUserId(userId); NfcPermissions.enforceUserPermissions(mContext); if (!isServiceRegistered(userId, service)) { return false; } if (mServiceCache.registerAidGroupForService(userId, Binder.getCallingUid(), service, aidGroup)) { notifyPreferredPaymentChanged(); return true; } else return false; }

Target:
public boolean registerAidGroupForService(int userId, ComponentName service, AidGroup aidGroup) throws RemoteException { NfcPermissions.validateUserId(userId); NfcPermissions.enforceUserPermissions(mContext); if (!isServiceRegistered(userId, service)) { return false; } if (!mServiceCache.registerAidGroupForService(userId, Binder.getCallingUid(), service, aidGroup)) { return false; } NfcService.getInstance().onPreferredPaymentChanged( NfcAdapter.PREFERRED_PAYMENT_UPDATED); return true; }
Source:
public void testOpenShiftConnection() { OpenShiftExplorerView osExplorer = new OpenShiftExplorerView(); osExplorer.open(); try { OpenShift2Connection connection = osExplorer.getOpenShift2Connection(OPENSHIFT_USER_NAME); connection.refresh(); try { new WaitUntil(new ShellWithTextIsAvailable("Problem occurred"), TimePeriod.getCustom(30)); fail("Problem dialog occured when refreshing OpenShift connection"); } catch (WaitTimeoutExpiredException ex) { } try { treeViewerHandler.getTreeItem(connection.getTreeItem(), "OpenShift sample project"); } catch (JFaceLayerException ex) { fail("Could not find deployed sample OpenShift project"); } } catch (RedDeerException ex) { fail("Could not open OpenShift connection for " + OPENSHIFT_USER_NAME + " ended with exception: " + ex.getMessage()); } }

Target:
public void testOpenShiftConnection() { startServerAdapter(); OpenShiftExplorerView osExplorer = new OpenShiftExplorerView(); osExplorer.open(); try { OpenShift3Connection connection = osExplorer.getOpenShift3Connection(OPENSHIFT_SERVER, OPENSHIFT_USER_NAME); connection.refresh(); try { new WaitUntil(new ShellWithTextIsAvailable("Problem occurred"), TimePeriod.getCustom(30)); fail("Problem dialog occured when refreshing OpenShift connection"); } catch (WaitTimeoutExpiredException ex) { } try { treeViewerHandler.getTreeItem(connection.getTreeItem(), "OpenShift sample project"); } catch (JFaceLayerException ex) { fail("Could not find deployed sample OpenShift project"); } } catch (RedDeerException ex) { fail("Could not open OpenShift connection for " + OPENSHIFT_USER_NAME + " ended with exception: " + ex.getMessage()); } }
Source:
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("topic") .withDescription("topic to post to") .hasArg() .withArgName("<topic>") .withType(String.class) .create("t")); options.addOption(OptionBuilder.withLongOpt("messages") .withDescription("number of messages per producer to post") .hasArg() .withArgName("<num_messages>") .withType(Number.class) .create("m")); options.addOption(OptionBuilder.withLongOpt("producers") .withDescription("number of producer threads") .hasArg() .withArgName("<num_producer_threads>") .withType(Number.class) .create("p")); options.addOption(OptionBuilder.withLongOpt("type") .withDescription("type of producer") .hasArg() .withArgName("<type>") .withType(String.class) .create("type")); CommandLineParser parser = new GnuParser(); return parser.parse(options, args); }

Target:
private static CommandLine parseArgs(String[] args) throws ParseException { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("topic") .withDescription("topic to post to") .hasArg() .withArgName("<topic>") .withType(String.class) .create("t")); options.addOption(OptionBuilder.withLongOpt("messages") .withDescription("number of messages per producer to post") .hasArg() .withArgName("<num_messages>") .withType(Number.class) .create("m")); options.addOption(OptionBuilder.withLongOpt("producers") .withDescription("number of producer threads") .hasArg() .withArgName("<num_producer_threads>") .withType(Number.class) .create("p")); options.addOption(OptionBuilder.withLongOpt("type") .withDescription("type of producer - [json, binary]") .hasArg() .withArgName("<type>") .withType(String.class) .create("type")); CommandLineParser parser = new GnuParser(); return parser.parse(options, args); }
Source:
public Observable<ArrayList<DepictedItem>> getParentQIDs(String qid) throws IOException { String queryString = FileUtils.readFromResource("/queries/parentclasses_query.rq"); String query = queryString. replace("${QID}", qid) .replace("${LANG}", "\""+Locale.getDefault().getLanguage()+"\""); Timber.e(query); HttpUrl.Builder urlBuilder = HttpUrl .parse(sparqlQueryUrl) .newBuilder() .addQueryParameter("query", query) .addQueryParameter("format", "json"); Request request = new Request.Builder() .url(urlBuilder.build()) .build(); return Observable.fromCallable(() -> { Response response = okHttpClient.newCall(request).execute(); try { String json = response.body().string(); JSONObject jsonObject = new JSONObject(json); ArrayList<DepictedItem> subItems = new ArrayList<>(); JSONObject results = (JSONObject) jsonObject.get("results"); JSONArray bindings = (JSONArray) results.get("bindings"); for (int i = 0; i < bindings.length(); i++) { Timber.e(bindings.get(i).getClass().toString()); JSONObject object = (JSONObject) bindings.get(i); JSONObject parentClassLabel = (JSONObject) object.get("parentClassLabel"); if (parentClassLabel.get("value") != null) { String labelString = parentClassLabel.getString("value"); JSONObject parentClass = (JSONObject) object.get("parentClass"); if (parentClass.get("value") != null) { String entityId = parentClass.getString("value"); entityId = entityId.substring(entityId.lastIndexOf("/") + 1); subItems.add(new DepictedItem(labelString, "", "", false, entityId)); } } } return subItems; } catch (Exception e) { return new ArrayList<DepictedItem>(); } }).doOnError(throwable -> { Timber.e("line578"+throwable.toString()); }); }

Target:
public Observable<List<DepictedItem>> getParentQIDs(String qid) throws IOException { return depictedItemsFrom(sparqlQuery(qid, "/queries/parentclasses_query.rq")); }
Source:
private void attachPreviewHandler() { detachPreviewHandler(); preview_ = Event.addNativePreviewHandler(new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent preview) { if (preview.getTypeInt() == Event.ONMOUSEMOVE) { NativeEvent event = preview.getNativeEvent(); coordinates_ = new MouseCoordinates( event.getClientX(), event.getClientY()); } else if (preview.getTypeInt() == Event.ONKEYDOWN) { coordinates_ = null; } timer_.schedule(DELAY_MS); } }); }

Target:
private void attachPreviewHandler() { detachPreviewHandler(); preview_ = Event.addNativePreviewHandler(new NativePreviewHandler() { @Override public void onPreviewNativeEvent(NativePreviewEvent preview) { if (preview.getTypeInt() == Event.ONMOUSEMOVE) { NativeEvent event = preview.getNativeEvent(); coordinates_ = new MouseCoordinates( event.getClientX(), event.getClientY()); ready_ = true; } else if (preview.getTypeInt() == Event.ONKEYDOWN) { coordinates_ = null; ready_ = true; if (preview.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) suppressed_ = true; } } }); }
Source:
public PacketCubeBlockChange(Cube cube, TShortCollection localAddresses) { this.cubePos = cube.getCoords(); this.localAddresses = localAddresses.toArray(); this.blockStates = new IBlockState[localAddresses.size()]; int i = localAddresses.size() - 1; TIntSet xzAddresses = new TIntHashSet(); for (; i >= 0; i--) { int localAddress = this.localAddresses[i]; int x = AddressTools.getLocalX(localAddress); int y = AddressTools.getLocalY(localAddress); int z = AddressTools.getLocalZ(localAddress); this.blockStates[i] = cube.getBlockState(x, y, z); xzAddresses.add(x | z << 4); } this.heightValues = new int[xzAddresses.size()]; i = 0; TIntIterator it = xzAddresses.iterator(); while (it.hasNext()) { int v = it.next(); int height = cube.getColumn().getOpacityIndex().getTopBlockY(blockToLocal(v), blockToCube(v)); v |= height << 8; heightValues[i] = v; i++; } }

Target:
public PacketCubeBlockChange(Cube cube, TShortCollection localAddresses) { this.cubePos = cube.getCoords(); this.localAddresses = localAddresses.toArray(); this.blockStates = new IBlockState[localAddresses.size()]; int i = localAddresses.size() - 1; TIntSet xzAddresses = new TIntHashSet(); for (; i >= 0; i--) { int localAddress = this.localAddresses[i]; int x = AddressTools.getLocalX(localAddress); int y = AddressTools.getLocalY(localAddress); int z = AddressTools.getLocalZ(localAddress); this.blockStates[i] = cube.getBlockState(x, y, z); xzAddresses.add(AddressTools.getLocalAddress(x, z)); } this.heightValues = new int[xzAddresses.size()]; i = 0; TIntIterator it = xzAddresses.iterator(); while (it.hasNext()) { int v = it.next(); int height = cube.getColumn().getOpacityIndex().getTopBlockY(blockToLocal(v), blockToCube(v)); v |= height << 8; heightValues[i] = v; i++; } }
Source:
public void remoteInit() { try { exchangeMetaData = ((CoinbeneMarketDataService) marketDataService).getMetadata(); } catch (IOException e) { LOG.error("Retrieving MetaData for Coinbene failed", e); } }

Target:
public void remoteInit() throws IOException, ExchangeException { exchangeMetaData = ((CoinbeneMarketDataService) marketDataService).getMetadata(); }
Source:
private void putInternal(K key, V value, EntityTag eTag) { if (service.isRunning()) { try { String target = buildUrl(service.cacheName, key); Invocation put = null; if (eTag != null) { put = service.getHttpClient().target(target).request().accept(service.getContentType()) .header("If-Match", eTag.getValue()) .buildPut(Entity.entity(encodeObject(value), service.getContentType())); } else { put = service.getHttpClient().target(target).request().accept(service.getContentType()) .buildPut(Entity.entity(encodeObject(value), service.getContentType())); } Response response = put.invoke(); int status = response.getStatus(); String reason = response.getStatusInfo().getReasonPhrase(); response.close(); if (status != Status.OK.getStatusCode() && status != Status.CREATED.getStatusCode() && status != Status.NO_CONTENT.getStatusCode()) { throw new RuntimeException("RESTEasyHTTPOperations.put::Unexpected HttpStatus: " + status + " " + reason + " for request " + target); } } catch (IOException e) { throw new RuntimeException(e); } } }

Target:
private void putInternal(K key, V value, EntityTag eTag) { if (service.isRunning()) { Response response = null; try { String target = buildUrl(service.cacheName, key); Builder putBuilder = service.getHttpClient().target(target).request().accept(service.getContentType()); if (eTag != null) { putBuilder = putBuilder.header(HttpHeaders.IF_MATCH, eTag.getValue()); } response = putBuilder.buildPut(Entity.entity(encodeObject(value), service.getContentType())).invoke(); int status = response.getStatus(); String reason = response.getStatusInfo().getReasonPhrase(); response.close(); if (status != Status.OK.getStatusCode() && status != Status.CREATED.getStatusCode() && status != Status.NO_CONTENT.getStatusCode()) { throw new RuntimeException("RESTEasyHTTPOperations.put::Unexpected HttpStatus: " + status + " " + reason + " for request " + target); } } catch (IOException e) { throw new RuntimeException(e); } finally { if (response != null) { response.close(); } } } }
Source:
public LogPage log(LogRequest logRequest) throws GitException { LogCommand logCommand = getGit().log(); String sFilePath = null; try { setRevisionRange(logCommand, logRequest); setPaging(logCommand, logRequest); if (logRequest != null) { sFilePath = logRequest.getFilePath(); if (sFilePath != null && !sFilePath.isEmpty()) { logCommand.addPath(sFilePath); } } Iterator<RevCommit> revIterator = logCommand.call().iterator(); List<Revision> commits = new ArrayList<Revision>(); while (revIterator.hasNext()) { RevCommit commit = revIterator.next(); Revision revision = getRevision(commit, sFilePath); commits.add(revision); } return new LogPage(commits); } catch (GitAPIException | IOException exception) { String errorMessage = exception.getMessage(); LOG.error("Failed to retrieve log. ", errorMessage); if (ERROR_LOG_NO_HEAD_EXISTS.equals(errorMessage)) { throw new GitException(errorMessage, ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED); }else{ throw new GitException(exception); } } }

Target:
public LogPage log(LogRequest logRequest) throws GitException { LogCommand logCommand = getGit().log(); String filePath = null; try { setRevisionRange(logCommand, logRequest); setPaging(logCommand, logRequest); if (logRequest != null) { logRequest.getFileFilter().forEach(logCommand::addPath); filePath = logRequest.getFilePath(); if (!isNullOrEmpty(filePath)) { logCommand.addPath(filePath); } } Iterator<RevCommit> revIterator = logCommand.call().iterator(); List<Revision> commits = new ArrayList<>(); while (revIterator.hasNext()) { RevCommit commit = revIterator.next(); Revision revision = getRevision(commit, filePath); commits.add(revision); } return new LogPage(commits); } catch (GitAPIException | IOException exception) { String errorMessage = exception.getMessage(); if (ERROR_LOG_NO_HEAD_EXISTS.equals(errorMessage)) { throw new GitException(errorMessage, ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED); } else { LOG.error("Failed to retrieve log. ", exception); throw new GitException(exception); } } }
Source:
public static void main(String[] args) { LOGGER.info("---------------------"); LOGGER.info("KEY VAULT - SECRETS"); LOGGER.info("IDENTITY - CREDENTIAL"); LOGGER.info("---------------------"); String authorityHostAlias = System.getenv("AZURE_CLOUD"); String authorityHost = AUTHORITY_HOST_MAP.getOrDefault( authorityHostAlias, KnownAuthorityHosts.AZURE_CLOUD); secretClient = new SecretClientBuilder() .vaultUrl(System.getenv("AZURE_PROJECT_URL")) .credential( new DefaultAzureCredentialBuilder() .authorityHost(authorityHost) .build() ).buildClient(); try { setSecret(); getSecret(); } finally { deleteSecret(); } }

Target:
public static void main(String[] args) { LOGGER.info("---------------------"); LOGGER.info("KEY VAULT - SECRETS"); LOGGER.info("IDENTITY - CREDENTIAL"); LOGGER.info("---------------------"); String azureCloud = System.getenv("AZURE_CLOUD"); String authorityHost = AUTHORITY_HOST_MAP.getOrDefault( azureCloud, KnownAuthorityHosts.AZURE_CLOUD); secretClient = new SecretClientBuilder() .vaultUrl(System.getenv("AZURE_PROJECT_URL")) .credential( new DefaultAzureCredentialBuilder() .authorityHost(authorityHost) .build() ).buildClient(); try { setSecret(); getSecret(); } finally { deleteSecret(); } }
Source:
public void setTemporalOps(TemporalOperatorsType temporalOperators) { temporalOps = new ConcurrentHashMap<TEMPORAL_OPERATORS, TemporalOperatorType>( new EnumMap<TEMPORAL_OPERATORS, TemporalOperatorType>(TEMPORAL_OPERATORS.class)); for (TemporalOperatorType temporalOp : temporalOperators.getTemporalOperator()) { LOGGER.debug("Adding key [temporalOp Name: {}]", temporalOp.getName()); temporalOps.put(TEMPORAL_OPERATORS.valueOf(temporalOp.getName()), temporalOp); if (LOGGER.isDebugEnabled()) { LOGGER.debug("temporalOps Map: {}", temporalOps.toString()); } } }

Target:
public void setTemporalOps(TemporalOperatorsType temporalOperators) { temporalOps = new ConcurrentHashMap<TEMPORAL_OPERATORS, TemporalOperatorType>( new EnumMap<TEMPORAL_OPERATORS, TemporalOperatorType>(TEMPORAL_OPERATORS.class)); for (TemporalOperatorType temporalOp : temporalOperators.getTemporalOperator()) { LOGGER.debug("Adding key [temporalOp Name: {}]", temporalOp.getName()); temporalOps.put(TEMPORAL_OPERATORS.valueOf(temporalOp.getName()), temporalOp); LOGGER.debug("temporalOps Map: {}", temporalOps); } }
Source:
public void generateChunk(CoreChunk chunk, Region chunkRegion) { BaseFacet baseFacet = chunkRegion.getFacet(BaseFacet.class); for (Entry<BaseVector3i, Base> entry : baseFacet.getWorldEntries().entrySet()) { Vector3i centerBasePosition = new Vector3i(entry.getKey()); int extent = entry.getValue().getExtent(); centerBasePosition.add(0, extent, 0); Vector3i min = new Vector3i(centerBasePosition.x() - extent + 2, centerBasePosition.y() - extent, centerBasePosition.z() - extent); Vector3i max = new Vector3i(centerBasePosition.x() + extent - 2, centerBasePosition.y() - extent, centerBasePosition.z() + extent); Region3i walls = Region3i.createFromMinMax(min, max); for (Vector3i newBlockPosition : walls) { if (chunkRegion.getRegion().encompasses(newBlockPosition)) { chunk.setBlock(ChunkMath.calcBlockPos(newBlockPosition), stone); } if (centerBasePosition.x > 0){ if (chunkRegion.getRegion().encompasses(centerBasePosition)) { chunk.setBlock(ChunkMath.calcBlockPos(centerBasePosition.x(), centerBasePosition.y() - extent + 1, centerBasePosition.z() + 2), redFlag); } } if (centerBasePosition.x < 0){ if (chunkRegion.getRegion().encompasses(centerBasePosition)) { chunk.setBlock(ChunkMath.calcBlockPos(centerBasePosition.x(), centerBasePosition.y() - extent + 1, centerBasePosition.z() + 2), blackFlag); } } } } }

Target:
public void generateChunk(CoreChunk chunk, Region chunkRegion) { BaseFacet baseFacet = chunkRegion.getFacet(BaseFacet.class); for (Base base : baseFacet.getBases()) { Region3i baseRegion = base.getArea(); Region3i flagRegion = base.getFlagArea(); for (Vector3i baseBlockPosition : baseRegion) { if (chunkRegion.getRegion().encompasses(baseBlockPosition)) { chunk.setBlock(ChunkMath.calcBlockPos(baseBlockPosition), stone); } } for (Vector3i flagPosition : flagRegion) { if (chunkRegion.getRegion().encompasses(flagPosition) && flagPosition.x > 0) { chunk.setBlock(ChunkMath.calcBlockPos(flagPosition), redFlag); } else if (chunkRegion.getRegion().encompasses(flagPosition)) { chunk.setBlock(ChunkMath.calcBlockPos(flagPosition), blackFlag); } } } }
Source:
public ByteBuf getAndRelease() { if (released.compareAndSet(false, true)) { try { return buffer.retainedDuplicate(); } finally { buffer.release(); } } else { throw new IllegalStateException("Payload already released"); } }

Target:
public ByteBuf getAndRelease() { if (buffer == null) { return null; } else { try { return buffer.retainedDuplicate(); } finally { buffer.release(); buffer = null; } } }
Source:
public void testIncludeSameReport() throws Exception { FreeStyleProject p = j.createFreeStyleProject("include_job"); final String reportDir = "autogen"; p.getBuildersList().add(new TestBuilder() { public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { FilePath ws = build.getWorkspace().child(reportDir); ws.child("tab1.html").write("hello", "UTF-8"); ws.child("tab2.html").write("hello", "UTF-8"); ws.child("dummy.html").write("hello", "UTF-8"); return true; } }); HtmlPublisherTarget target1 = new HtmlPublisherTarget("tab1", reportDir, "tab1.html", true, true, false, true); target1.setIncludes(HtmlPublisherTarget.INCLUDE_ALL_PATTERN); HtmlPublisherTarget target2 = new HtmlPublisherTarget("tab1", reportDir, "tab1.html", true, true, false, true); String includes = "tab2.html"; target2.setIncludes(includes); assertEquals(includes, target2.getIncludes()); HtmlPublisherTarget[] l = { target1, target2 }; p.getPublishersList().add(new HtmlPublisher(Arrays.asList(l))); AbstractBuild build = j.buildAndAssertSuccess(p); Assert.assertEquals(build.getActions(HtmlPublisherTarget.HTMLBuildAction.class).size(), 1); }

Target:
public void testIncludeSameReport() throws Exception { FreeStyleProject p = j.createFreeStyleProject("include_job"); final String reportDir = "autogen"; p.getBuildersList().add(new TestBuilder() { public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { FilePath ws = build.getWorkspace().child(reportDir); ws.child("tab1.html").write("hello", "UTF-8"); ws.child("tab2.html").write("hello", "UTF-8"); ws.child("dummy.html").write("hello", "UTF-8"); return true; } }); HtmlPublisherTarget target1 = new HtmlPublisherTarget("tab1", reportDir, "tab1.html", true, true, false); target1.setOnlyCreateReportWithDifferentName(true); target1.setIncludes(HtmlPublisherTarget.INCLUDE_ALL_PATTERN); HtmlPublisherTarget target2 = new HtmlPublisherTarget("tab1", reportDir, "tab1.html", true, true, false); target2.setOnlyCreateReportWithDifferentName(true); String includes = "tab2.html"; target2.setIncludes(includes); assertEquals(includes, target2.getIncludes()); HtmlPublisherTarget[] l = { target1, target2 }; p.getPublishersList().add(new HtmlPublisher(Arrays.asList(l))); AbstractBuild build = j.buildAndAssertSuccess(p); Assert.assertEquals(build.getActions(HtmlPublisherTarget.HTMLBuildAction.class).size(), 1); }
Source:
public void showProjectWithNonRegisteredProject() throws Exception { CommandStatus initStatus = main("init", "-c", config.toString(), projectDir.toString()); assertThat(initStatus.code(), is(0)); copyResource("acceptance/basic.dig", projectDir.resolve("basic.dig")); { CommandStatus pushStatus = main( "push", "--project", projectDir.toString(), "foo", "-c", config.toString(), "-e", server.endpoint()); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); } { CommandStatus pushStatus = main( "push", "--project", projectDir.toString(), "bar", "-c", config.toString(), "-e", server.endpoint()); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); } CommandStatus showProjectStatus = main("projects","not_exist_project", "-c", config.toString(), "-e", server.endpoint()); assertThat(showProjectStatus.errUtf8(), showProjectStatus.code(), is(0)); assertThat(showProjectStatus.outUtf8(), containsString(" Not found")); }

Target:
public void showProjectWithNonRegisteredProject() throws Exception { CommandStatus initStatus = main("init", "-c", config.toString(), projectDir.toString()); assertThat(initStatus.code(), is(0)); copyResource("acceptance/basic.dig", projectDir.resolve("basic.dig")); { CommandStatus pushStatus = main( "push", "--project", projectDir.toString(), "foo", "-c", config.toString(), "-e", server.endpoint()); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); } { CommandStatus pushStatus = main( "push", "--project", projectDir.toString(), "bar", "-c", config.toString(), "-e", server.endpoint()); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); } CommandStatus showProjectStatus = main("projects","not_exist_project", "-c", config.toString(), "-e", server.endpoint()); assertThat(showProjectStatus.errUtf8(), showProjectStatus.code(), is(1)); assertThat(showProjectStatus.errUtf8(), containsString("does not exist.")); }
Source:
private void updateActionAvailability() { ArrayList<StorageDomainDR> domainDRs = getSelectedItems() != null ? Linq.<StorageDomainDR> cast(getSelectedItems()) : new ArrayList<StorageDomainDR>(); getNewCommand().setIsExecutionAllowed(true); getEditCommand().setIsExecutionAllowed(domainDRs.size() == 1); }

Target:
private void updateActionAvailability() { ArrayList<StorageDomainDR> domainDRs = getSelectedItems() != null ? Linq.<StorageDomainDR> cast(getSelectedItems()) : new ArrayList<StorageDomainDR>(); getEditCommand().setIsExecutionAllowed(domainDRs.size() == 1); }
Source:
public void sendSynchronous(final SimpleFieldSet params, final Bucket bucket) throws FCPCallFailedException { final Lock lock = new ReentrantLock(); final Condition condition = lock.newCondition(); lock.lock(); try { class Runner implements Runnable { volatile boolean finished = false; Throwable throwable = null; @Override public void run() { lock.lock(); try { target.onReply(pluginname, identifier, params, bucket); } catch (Throwable t) { throwable = t; } finally { finished = true; condition.signal(); lock.unlock(); } } }; final Runner runner = new Runner(); node.executor.execute(runner, "FCPPlugin reply runner for " + pluginname); while(!runner.finished) condition.awaitUninterruptibly(); if(runner.throwable != null) throw new FCPCallFailedException(runner.throwable); } finally { lock.unlock(); } }

Target:
public void sendSynchronous(final SimpleFieldSet params, final Bucket bucket) throws FCPCallFailedException { final Lock lock = new ReentrantLock(); final Condition condition = lock.newCondition(); lock.lock(); try { class Runner implements Runnable { volatile boolean finished = false; Throwable throwable = null; @Override public void run() { lock.lock(); try { target.onReply(pluginname, clientSideIdentifier, params, bucket); } catch (Throwable t) { throwable = t; } finally { finished = true; condition.signal(); lock.unlock(); } } }; final Runner runner = new Runner(); node.executor.execute(runner, "FCPPlugin reply runner for " + pluginname); while(!runner.finished) condition.awaitUninterruptibly(); if(runner.throwable != null) throw new FCPCallFailedException(runner.throwable); } finally { lock.unlock(); } }
Source:
private void checkAuthorisationForResourceAreValid(final Resource resource) throws UnableProcessException, ServiceTemporarilyUnavailableException, ForbiddenOperationException { checkAuthAttributesAreValid(resource.getAuthorization()); try { authorizationService.areAllAuthorizationsForResourceValid(resource); } catch (OperationOnResourceNotPermitedException e) { throw new ForbiddenOperationException(e.getMessage()); } catch (AuthorizationInvalidException e) { throw new UnableProcessException(e.getMessage()); } catch (PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }

Target:
private void checkAuthorisationForResourceAreValid(final Resource resource) throws UnableProcessException, ServiceTemporarilyUnavailableException, ForbiddenOperationException { try { authorizationService.isAuthorizationForResourceValid(resource); } catch (OperationOnResourceNotPermittedException e) { throw new ForbiddenOperationException(e.getMessage()); } catch (AuthorizationInvalidException e) { throw new UnprocessableEntityException(e.getMessage()); } catch (PluginException e) { throw new ServiceTemporarilyUnavailableException("Error calling authorization plugin", e); } }
Source:
public void testDualAlarmState() throws Exception { AlarmPersisterImpl persisterImpl = (AlarmPersisterImpl)m_alarmd.getPersister(); persisterImpl.setLegacyAlarmState(true); final MockNode node = m_mockNetwork.getNode(1); assertEmptyAlarmTable(); String dbname = m_database.getTestDatabase(); System.out.println(dbname); sendNodeDownEvent(node); Callable<Integer> numAlarmsCallable = getNumAlarmsCallable(); await().atMost(10, SECONDS).until(numAlarmsCallable, equalTo(1)); sendNodeUpEvent(node); numAlarmsCallable = getNumAlarmsCallable(); await().atMost(10, SECONDS).until(numAlarmsCallable, equalTo(2)); Thread.sleep(1000); assertThat(m_alarmDao.findAll().stream().filter(a -> !a.isArchived() && OnmsSeverity.CLEARED.equals(a.getSeverity())).count(), equalTo(1L)); assertThat(m_alarmDao.findAll().stream().filter(a -> !a.isArchived() && OnmsSeverity.NORMAL.equals(a.getSeverity())).count(), equalTo(1L)); }

Target:
public void testDualAlarmState() throws Exception { AlarmPersisterImpl persisterImpl = (AlarmPersisterImpl)m_alarmd.getPersister(); persisterImpl.setLegacyAlarmState(true); final MockNode node = m_mockNetwork.getNode(1); assertEmptyAlarmTable(); sendNodeDownEvent(node); Callable<Integer> numAlarmsCallable = getNumAlarmsCallable(); await().atMost(10, SECONDS).until(numAlarmsCallable, equalTo(1)); sendNodeUpEvent(node); numAlarmsCallable = getNumAlarmsCallable(); await().atMost(10, SECONDS).until(numAlarmsCallable, equalTo(2)); await().atMost(10, SECONDS).until(() -> m_alarmDao.findAll().stream().filter(a -> !a.isArchived() && OnmsSeverity.CLEARED.equals(a.getSeverity())).count(), equalTo(1L)); assertThat(m_alarmDao.findAll().stream().filter(a -> !a.isArchived() && OnmsSeverity.NORMAL.equals(a.getSeverity())).count(), equalTo(1L)); }
Source:
public void deleteRow(EntityId entityId, long upToTimestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete row while KijiTableWriter %s is in state %s.", this, state); final DeleteRequest delete = new DeleteRequest( Bytes.toBytes(mTable.getName()), entityId.getHBaseRowKey(), upToTimestamp); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }

Target:
public void deleteRow(EntityId entityId, long upToTimestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete row while KijiTableWriter %s is in state %s.", this, state); final DeleteRequest delete = new DeleteRequest( mTableName, entityId.getHBaseRowKey(), upToTimestamp); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }
Source:
private static int getJVMPort(final ConfigParser parser, final int nodeId) throws ConfigFileException { String[] args; if (nodeId == MyriaConstants.MASTER_ID) { args = getRequired(parser, "master", nodeId + "").split(":"); } else { args = getRequired(parser, "workers", nodeId + "").split(":"); } if (args.length <= 5) { return 0; } return Integer.parseInt(args[5]); }

Target:
private static int getJVMPort(final ConfigParser parser, final int nodeId) throws ConfigFileException { String[] args; if (nodeId == MyriaConstants.MASTER_ID) { args = getRequired(parser, "master", nodeId + "").split(":"); } else { args = getRequired(parser, "workers", nodeId + "").split(":"); } if (args.length <= 5 || args[5].equals("")) { return 0; } return Integer.parseInt(args[5]); }
Source:
public Stream<BytesHandle> getParamValues() { return Stream.of(NodeConverter.copyToBytesHandle(paramValues)); }

Target:
public Stream<BufferableHandle> getParamValues() { return Stream.of(paramValues); }
Source:
protected void compile(String scriptSource) { engineBindings.unlock(); engineBindings.clear(); engineBindings.put(ScriptEngine.FILENAME, absolutePath); engineBindings.put(ModuleFunction.NAME, JsFunctionsImpl.getModuleFunction(componentPath, engine)); try { engine.eval(scriptSource); } catch (ScriptException e) { throw new UUFException("An error occurred while evaluating the JavaScript file '" + absolutePath + "'.", e); } Set<String> keySet = ((ScriptObjectMirror) engineBindings.get("nashorn.global")).keySet(); if (keySet.contains(FUNCTION_ON_GET)) { isOnGetFound = true; } if (keySet.contains(FUNCTION_ON_POST)) { isOnPostFound = true; } if (!isOnGetFound && !isOnPostFound) { throw new UUFException("'onGet' and 'onPost' functions not found. Please implement at least on of them."); } engineBindings.remove(ModuleFunction.NAME); engineBindings.put(CallOSGiServiceFunction.NAME, JsFunctionsImpl.getCallOsgiServiceFunction()); engineBindings.put(GetOSGiServicesFunction.NAME, JsFunctionsImpl.getGetOsgiServicesFunction()); engineBindings.put(CallMicroServiceFunction.NAME, JsFunctionsImpl.getCallMicroServiceFunction()); engineBindings.put(SendErrorFunction.NAME, JsFunctionsImpl.getSendErrorFunction()); engineBindings.put(SendRedirectFunction.NAME, JsFunctionsImpl.getSendRedirectFunction()); engineBindings.put(LoggerObject.NAME, JsFunctionsImpl.getLoggerObject(relativePath)); engineBindings.lock(); }

Target:
protected void compile(String scriptSource) { engineBindings.unlock(); engineBindings.clear(); engineBindings.put(ScriptEngine.FILENAME, absolutePath); engineBindings.put(ModuleFunction.NAME, JsFunctionsImpl.getModuleFunction(componentPath, engine)); try { engine.eval(scriptSource); } catch (ScriptException e) { throw new UUFException("An error occurred while evaluating the JavaScript file '" + absolutePath + "'.", e); } Set<String> availableFunctions = ((ScriptObjectMirror) engineBindings.get("nashorn.global")).keySet(); if (availableFunctions.contains(FUNCTION_ON_GET)) { hasOnGetFunction = true; } if (availableFunctions.contains(FUNCTION_ON_POST)) { hasOnPostFunction = true; } if (!hasOnGetFunction && !hasOnPostFunction) { throw new UUFException( "Either '" + FUNCTION_ON_GET + "' or '" + FUNCTION_ON_POST + "' cannot be found in " + "JavaScript file '" + absolutePath + "'. Please implement at least one of them."); } engineBindings.remove(ModuleFunction.NAME); engineBindings.put(CallOSGiServiceFunction.NAME, JsFunctionsImpl.getCallOsgiServiceFunction()); engineBindings.put(GetOSGiServicesFunction.NAME, JsFunctionsImpl.getGetOsgiServicesFunction()); engineBindings.put(CallMicroServiceFunction.NAME, JsFunctionsImpl.getCallMicroServiceFunction()); engineBindings.put(SendErrorFunction.NAME, JsFunctionsImpl.getSendErrorFunction()); engineBindings.put(SendRedirectFunction.NAME, JsFunctionsImpl.getSendRedirectFunction()); engineBindings.put(LoggerObject.NAME, JsFunctionsImpl.getLoggerObject(relativePath)); engineBindings.lock(); }
Source:
protected void downloadSingleFile(final CloudFile cloudFile) throws WAStorageException { final DownloadServiceData serviceData = getServiceData(); try { println("Downloading file:" + cloudFile.getUri().toString()); final FilePath destFile = destinationFilePath(cloudFile.getName()); final long startTime = System.currentTimeMillis(); try (OutputStream fos = destFile.write()) { cloudFile.download(fos, null, new FileRequestOptions(), Utils.updateUserAgent()); } final long endTime = System.currentTimeMillis(); println(String.format( "blob %s is downloaded to %s in %s", cloudFile.getName(), destFile.getParent(), getTime(endTime - startTime))); if (serviceData.isDeleteFromAzureAfterDownload()) { cloudFile.deleteIfExists(); println("cloud file " + cloudFile.getName() + " is deleted from Azure."); } } catch (Exception e) { throw new WAStorageException(e.getMessage(), e.getCause()); } }

Target:
protected void downloadSingleFile(final CloudFile cloudFile) throws WAStorageException { final DownloadServiceData serviceData = getServiceData(); try { println("Downloading file:" + cloudFile.getUri().toString()); final FilePath destFile = destinationFilePath(cloudFile.getName()); final long startTime = System.currentTimeMillis(); try (OutputStream fos = destFile.write()) { cloudFile.download(fos, null, new FileRequestOptions(), Utils.updateUserAgent()); } final long endTime = System.currentTimeMillis(); println(String.format( "blob %s is downloaded to %s in %s", cloudFile.getName(), destFile.getParent(), getTime(endTime - startTime))); if (serviceData.isDeleteFromAzureAfterDownload()) { cloudFile.deleteIfExists(); println("cloud file " + cloudFile.getName() + " is deleted from Azure."); } } catch (Exception e) { throw new WAStorageException(e.getMessage(), e); } }
Source:
private Properties loadProperties(String configurationFileName) { final Properties props = new Properties(); final File propertyFile = new File(StringUtils.strip(configurationFileName)); log.info("Loading {}", propertyFile.getAbsolutePath()); try { props.load(new FileInputStream(propertyFile)); } catch (IOException e) { throw new ReviewException("IO exception when reading JSLint configuration file.", e); } return props; }

Target:
private Properties loadProperties(String configurationFileName) { final Properties props = new Properties(); try (FileReader fileReader = new FileReader(configurationFileName)) { log.info("Loading {}", configurationFileName); props.load(fileReader); } catch (IOException e) { log.error("Load JSLint properties operation failed", e); throw new ReviewException("IO exception when reading JSLint configuration file.", e); } return props; }