auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<String> getResourcesFromFile(String resourceNameType, Path filePath) { List<String> resourceNames = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(filePath.toString()))) { StringBuilder builder = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { builder.append(line); } JSONObject jsonObject = new JSONObject(builder.toString()); if (jsonObject.has(resourceNameType)) { try { JSONArray resources = jsonObject.getJSONArray(resourceNameType); for (int i = 0; i < resources.length(); i++) { String resource = resources.getString(i); resourceNames.add(resource); LOG.info("Get '{}' JSON array '{}' element from resource file with: '{}'.", resourceNameType, i, resource); } } catch (JSONException e) { String resource = jsonObject.getString(resourceNameType); resourceNames.add(resource); LOG.info("Get '{}' JSON object from resource file with: '{}'.", resourceNameType, resource); } } else { LOG.error("Cannot find '{}' in resource file '{}'.", resourceNameType, filePath.getFileName()); } return resourceNames; } catch (JSONException e) { LOG.warn("Cannot get '{}' key, because of: {}", resourceNameType, e.getMessage(), e); return resourceNames; } catch (FileNotFoundException e) { LOG.warn("'{}' file not found, because of: {}", filePath, e.getMessage(), e); return resourceNames; } catch (IOException e) { LOG.warn("Reading '{}' file throws exception: {}", filePath, e.getMessage(), e); return resourceNames; } }

Target:
private List<String> getResourcesFromFile(String resourceNameType, Path filePath) { List<String> resourceNames = new ArrayList<>(); try { String resourcesFromFile = Files.readString(filePath); JSONObject jsonObject = new JSONObject(resourcesFromFile); if (jsonObject.has(resourceNameType)) { try { JSONArray resources = jsonObject.getJSONArray(resourceNameType); for (int i = 0; i < resources.length(); i++) { String resource = resources.getString(i); resourceNames.add(resource); LOG.info("Get '{}' JSON array '{}' element from resource file with: '{}'.", resourceNameType, i, resource); } } catch (JSONException e) { String resource = jsonObject.getString(resourceNameType); resourceNames.add(resource); LOG.info("Get '{}' JSON object from resource file with: '{}'.", resourceNameType, resource); } } else { LOG.error("Cannot find '{}' in resource file '{}'.", resourceNameType, filePath.getFileName()); } return resourceNames; } catch (JSONException e) { LOG.warn("Cannot get '{}' key, because of: {}", resourceNameType, e.getMessage(), e); return resourceNames; } catch (FileNotFoundException e) { LOG.warn("'{}' file not found, because of: {}", filePath, e.getMessage(), e); return resourceNames; } catch (IOException e) { LOG.warn("Reading '{}' file throws exception: {}", filePath, e.getMessage(), e); return resourceNames; } }
Source:
public void test_changelog_with_merge_commit_and_first_parent() throws Exception { w.init(); w.commitEmpty("init"); w.git.branch("branch-1"); w.git.checkout("branch-1"); w.touch("file-1", "content-1"); w.git.add("file-1"); w.git.commit("commit-1"); String commitSha1 = w.git.revParse("HEAD").name(); w.git.checkout("master"); String mergeMessage = "Merge message to be tested."; w.git.merge().setMessage(mergeMessage).setGitPluginFastForwardMode(MergeCommand.GitPluginFastForwardMode.NO_FF).setRevisionToMerge(w.git.getHeadRev(w.repoPath(), "branch-1")).execute(); if (w.git instanceof CliGitAPIImpl) { StringWriter writer = new StringWriter(); w.git.changelog().firstParent().to(writer).execute(); assertThat(writer.toString(),isEmptyString()); } }

Target:
public void test_changelog_with_merge_commit_and_first_parent() throws Exception { w.init(); w.commitEmpty("init"); w.git.branch("branch-1"); w.git.checkout("branch-1"); w.touch("file-1", "content-1"); w.git.add("file-1"); w.git.commit("commit-1"); String commitSha1 = w.git.revParse("HEAD").name(); w.git.checkout("master"); String mergeMessage = "Merge message to be tested."; w.git.merge().setMessage(mergeMessage).setGitPluginFastForwardMode(MergeCommand.GitPluginFastForwardMode.NO_FF).setRevisionToMerge(w.git.getHeadRev(w.repoPath(), "branch-1")).execute(); StringWriter writer = new StringWriter(); w.git.changelog().firstParent().to(writer).execute(); assertThat(writer.toString(),isEmptyString()); }
Source:
public void testMexParsingWs2005() throws Exception { StringBuilder sb = new StringBuilder(); try (BufferedReader br = new BufferedReader(new FileReader( (this.getClass().getResource( TestConfiguration.AAD_MEX_2005_RESPONSE_FILE).getFile())))) { String line = br.readLine(); while (line != null) { sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); } } BindingPolicy endpoint = MexParser.getWsTrustEndpointFromMexResponse(sb .toString()); Assert.assertEquals(endpoint.getUrl(),"<LINK_0>"); }

Target:
public void testMexParsingWs2005() throws Exception { StringBuilder sb = new StringBuilder(); try (BufferedReader br = new BufferedReader(new FileReader( this.getClass().getResource( TestConfiguration.AAD_MEX_2005_RESPONSE_FILE).getFile()))) { String line = br.readLine(); while (line != null) { sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); } } BindingPolicy endpoint = MexParser.getWsTrustEndpointFromMexResponse(sb .toString()); Assert.assertEquals(endpoint.getUrl(),"<LINK_0>"); }
Source:
public ExecutorFactory(Configuration configuration) { this.executor = new LocalExecutor(); if (configuration != null) { if (configuration.getExecution().getMode().equalsIgnoreCase("local")) { this.executor = new LocalExecutor(); } else if (configuration.getExecution().getMode().equalsIgnoreCase("sge")) { this.executor = new SGEExecutor(configuration); System.out.println("SGE not ready"); } else if (configuration.getExecution().getMode().equalsIgnoreCase("azure")) { this.executor = new AzureBatchExecutor(configuration); } } }

Target:
public ExecutorFactory(Configuration configuration) { String mode = StringUtils.isEmpty(configuration.getExecution().getMode()) ? "local" : configuration.getExecution().getMode().toLowerCase(); switch (mode) { case "local": this.executor = new LocalExecutor(); break; case "sge": this.executor = new SGEExecutor(configuration); break; case "azure": this.executor = new AzureBatchExecutor(configuration); break; default: throw new UnsupportedOperationException("nonsoupported execution mode { " + mode + " }, accepted modes are : local, sge, azure"); } }
Source:
public static <T extends Number> T subtract(final T ... values) { if (values.length == 0) return null; T result = values[0]; for (int i = 1; i < values.length; i++) { if (result instanceof java.math.BigDecimal) { result = add(result, (T) java.math.BigDecimal.valueOf(values[i].longValue() * -1)); } else if (result instanceof java.math.BigInteger) { result = add(result, (T) java.math.BigInteger.valueOf(values[i].longValue() * -1)); } else if (result instanceof Byte) { result = add(result, (T) Byte.valueOf((byte) (values[i].byteValue() * -1))); } else if (result instanceof Double) { result = add(result, (T) Double.valueOf(values[i].doubleValue() * -1)); } else if (result instanceof Float) { result = add(result, (T) Float.valueOf(values[i].floatValue() * -1)); } else if (result instanceof Integer) { result = add(result, (T) Integer.valueOf(values[i].intValue() * -1)); } else if (result instanceof Long) { result = add(result, (T) Long.valueOf(values[i].longValue() * -1)); } else if (result instanceof Short) { result = add(result, (T) Short.valueOf((short) (values[i].shortValue() * -1))); } } return result; }

Target:
public static <T extends Number> T subtract(final T ... values) { if (values.length == 0) { return null; } T result = values[0]; for (int i = 1; i < values.length; i++) { if (result instanceof java.math.BigDecimal) { java.math.BigDecimal value = (java.math.BigDecimal) values[i]; result = add(result, (T) value.negate()); } else if (result instanceof java.math.BigInteger) { java.math.BigInteger value = (java.math.BigInteger) values[i]; result = add(result, (T) value.negate()); } else if (result instanceof Byte) { result = add(result, (T) Byte.valueOf((byte) (values[i].byteValue() * -1))); } else if (result instanceof Double) { result = add(result, (T) Double.valueOf(values[i].doubleValue() * -1)); } else if (result instanceof Float) { result = add(result, (T) Float.valueOf(values[i].floatValue() * -1)); } else if (result instanceof Integer) { result = add(result, (T) Integer.valueOf(values[i].intValue() * -1)); } else if (result instanceof Long) { result = add(result, (T) Long.valueOf(values[i].longValue() * -1)); } else if (result instanceof Short) { result = add(result, (T) Short.valueOf((short) (values[i].shortValue() * -1))); } } return result; }
Source:
public THttpTransport(CloseableHttpClient httpClient, String url, int requestSizeLimit, int responseSizeLimit) { this.httpClient = httpClient; this.url = url; this.requestSizeLimit = requestSizeLimit; this.responseSizeLimit = responseSizeLimit; this.frameBuffer = new ArrayBlockingQueue<>(FRAME_BUFFER_SIZE); this.requestBuffer = new ByteArrayOutputStream(); }

Target:
private THttpTransport(CloseableHttpClient httpClient, String url, int requestSizeLimit, int responseSizeLimit) { this.httpClient = httpClient; this.url = url; this.requestSizeLimit = requestSizeLimit; this.responseSizeLimit = responseSizeLimit; this.frameBuffer = new ArrayBlockingQueue<>(FRAME_BUFFER_SIZE); this.requestBuffer = new ByteArrayOutputStream(); }
Source:
public Config[] createGmosConfig(GmosParameters gmosParams, int numExp) { Config[] conf = createCommonConfig(numExp); for (Config step : conf) { System.out.println("SIte: " + gmosParams.site().displayName); if (gmosParams.site().displayName.equals("Gemini North")) { step.putItem(InstInstrumentKey, "GMOS-N"); } else if (gmosParams.site().displayName.equals("Gemini South")) { step.putItem(InstInstrumentKey, "GMOS-S"); } else { throw new Error("invalid site"); } step.putItem(FPUKey, (gmosParams.fpMask().displayValue())); step.putItem(AmpReadModeKey, (gmosParams.ampReadMode())); step.putItem(DetectorManufacturerKey, (gmosParams.ccdType())); step.putItem(BuiltinROIKey, (gmosParams.builtinROI())); step.putItem(DisperserKey, (gmosParams.grating().displayValue())); GmosCommonType.Binning xbin = GmosCommonType.Binning.getBinningByValue(gmosParams.spectralBinning()); GmosCommonType.Binning ybin = GmosCommonType.Binning.getBinningByValue(gmosParams.spatialBinning()); step.putItem(CcdXBinning, xbin); step.putItem(CcdYBinning, ybin); step.putItem(AmpGain, (gmosParams.ampGain())); if (gmosParams.ccdType().displayValue().equals("E2V")) { step.putItem(AmpCount, GmosCommonType.AmpCount.SIX); } else { step.putItem(AmpCount, GmosCommonType.AmpCount.TWELVE); } } return conf; }

Target:
public ConfigCreatorResult createGmosConfig(GmosParameters gmosParams, int numExp) { ConfigCreatorResult result = createCommonConfig(numExp); for (Config step : result.getConfig()) { if (gmosParams.site().equals(Site.GN)) { step.putItem(InstInstrumentKey, SPComponentType.INSTRUMENT_GMOS); } else if (gmosParams.site().equals(Site.GS)) { step.putItem(InstInstrumentKey, SPComponentType.INSTRUMENT_GMOSSOUTH); } else { throw new Error("Invalid site"); } step.putItem(FPUKey, (gmosParams.fpMask())); step.putItem(AmpReadModeKey, (gmosParams.ampReadMode())); step.putItem(DetectorManufacturerKey, (gmosParams.ccdType())); step.putItem(BuiltinROIKey, (gmosParams.builtinROI())); step.putItem(DisperserKey, (gmosParams.grating())); GmosCommonType.Binning xbin = GmosCommonType.Binning.getBinningByValue(gmosParams.spectralBinning()); GmosCommonType.Binning ybin = GmosCommonType.Binning.getBinningByValue(gmosParams.spatialBinning()); step.putItem(CcdXBinning, xbin); step.putItem(CcdYBinning, ybin); step.putItem(AmpGain, (gmosParams.ampGain())); if (gmosParams.ccdType().equals(GmosCommonType.DetectorManufacturer.E2V)) { step.putItem(AmpCount, GmosCommonType.AmpCount.SIX); } else if (gmosParams.ccdType().equals(GmosCommonType.DetectorManufacturer.HAMAMATSU)){ step.putItem(AmpCount, GmosCommonType.AmpCount.TWELVE); } else { throw new Error("Invalid detector type"); } } return result; }
Source:
public PlanNode visitApply(ApplyNode node, RewriteContext<Void> context) { List<PlanNode> sources = recursionStrategy.process(node, context); checkState(sources.size() == 2, "Apply node expects two sources only, but got: %s", sources.size()); return new ApplyNode( planNodeIdAllocationStrategy.getId(node), sources.get(0), sources.get(1), mapAndDistinct(node.getSubqueryAssignments()), mapAndDistinct(node.getCorrelation())); }

Target:
public PlanNode visitApply(ApplyNode node, RewriteContext<Void> context) { List<PlanNode> sources = recursionStrategy.process(node, context); checkState(sources.size() == 2, "Apply node expects two sources only, but got: %s", sources.size()); return new ApplyNode( planNodeIdGenerationStrategy.getPlanNodeId(node), sources.get(0), sources.get(1), mapAndDistinct(node.getSubqueryAssignments()), mapAndDistinct(node.getCorrelation()), node.getOriginSubquery()); }
Source:
public void copyRightToLeft(Diff target, Monitor monitor) { if (target.getState() == MERGED) { return; } if (target.getSource() == RIGHT) { for (Diff diff : target.getRefines()) { getMergerDelegate(diff).copyRightToLeft(diff, monitor); } } if (target.getState() == MERGED) { return; } if (target.getSource() == RIGHT && target.getKind() != DELETE) { super.copyRightToLeft(target, monitor); } else if (target.getSource() == LEFT && target.getKind() == DELETE) { super.copyRightToLeft(target, monitor); } else { target.setState(MERGED); for (Diff refiningDiff : target.getRefinedBy()) { refiningDiff.setState(MERGED); } } }

Target:
public void copyRightToLeft(Diff target, Monitor monitor) { if (target.getState() == MERGED) { return; } if (target.getSource() == RIGHT && target.getKind() != DELETE) { super.copyRightToLeft(target, monitor); } else if (target.getSource() == LEFT && target.getKind() == DELETE) { super.copyRightToLeft(target, monitor); } else { target.setState(MERGED); for (Diff refiningDiff : target.getRefinedBy()) { refiningDiff.setState(MERGED); } } }
Source:
GHReleaseUpdater(GHRelease base) { this.base = base; this.builder = base.root.retrieve().method("POST"); }

Target:
GHReleaseUpdater(GHRelease base) { this.base = base; this.builder = base.root.createRequest(); }
Source:
private String splitAppendedTenantDomain(String issuer) throws UserStoreException, IdentityException { if (issuer.contains("@")) { String tenantDomain = issuer.substring(issuer.lastIndexOf('@') + 1); issuer = issuer.substring(0, issuer.lastIndexOf('@')); if (StringUtils.isNotEmpty(tenantDomain) && StringUtils.isNotEmpty(issuer)) { SAMLSSOUtil.setTenantDomainInThreadLocal(tenantDomain); if (log.isDebugEnabled()) { log.debug("Tenant Domain :" + " " + tenantDomain + " " + "&" + " " + "Issuer name :" + issuer + " " + "has being spilt"); } } } return issuer; }

Target:
private String splitAppendedTenantDomain(String issuer) throws UserStoreException, IdentityException { if (issuer.contains("@")) { String tenantDomain = issuer.substring(issuer.lastIndexOf('@') + 1); issuer = issuer.substring(0, issuer.lastIndexOf('@')); if (StringUtils.isNotBlank(tenantDomain) && StringUtils.isNotBlank(issuer)) { SAMLSSOUtil.setTenantDomainInThreadLocal(tenantDomain); if (log.isDebugEnabled()) { log.debug("Tenant Domain :" + " " + tenantDomain + " " + "&" + " " + "Issuer name :" + issuer + " " + "has being spilt"); } } } return issuer; }
Source:
public Reader restoreReader(Configuration config, FileSourceSplit split) throws IOException { Reader reader = new Reader(config, split); reader.seek(split.getReaderPosition().get().getRecordsAfterOffset()); return null; }

Target:
public Reader restoreReader(Configuration config, FileSourceSplit split) throws IOException { Reader reader = new Reader(config, split); reader.seek(split.getReaderPosition().get().getRecordsAfterOffset()); return reader; }
Source:
public Response installInterpreter(@NotNull String message) { logger.info("Install interpreter: {}", message); InterpreterInstallationRequest request = gson .fromJson(message, InterpreterInstallationRequest.class); try { interpreterService.installInterpreter(request); } catch (Throwable t) { return new JsonResponse<>(Status.INTERNAL_SERVER_ERROR, t.getMessage()).build(); } return new JsonResponse<>(Status.OK).build(); }

Target:
public Response installInterpreter(@NotNull String message) { logger.info("Install interpreter: {}", message); InterpreterInstallationRequest request = InterpreterInstallationRequest.fromJson(message); try { interpreterService.installInterpreter( request, new ServiceCallback() { @Override public void onStart(String message) { Message m = new Message(OP.INTERPRETER_INSTALL_STARTED); Map<String, Object> data = Maps.newHashMap(); data.put("result", "Starting"); data.put("message", message); m.data = data; notebookServer.broadcast(m); } @Override public void onSuccess(String message) { Message m = new Message(OP.INTERPRETER_INSTALL_RESULT); Map<String, Object> data = Maps.newHashMap(); data.put("result", "Succeed"); data.put("message", message); m.data = data; notebookServer.broadcast(m); } @Override public void onFailure(String message) { Message m = new Message(OP.INTERPRETER_INSTALL_RESULT); Map<String, Object> data = Maps.newHashMap(); data.put("result", "Failed"); data.put("message", message); m.data = data; notebookServer.broadcast(m); } }); } catch (Throwable t) { return new JsonResponse<>(Status.INTERNAL_SERVER_ERROR, t.getMessage()).build(); } return new JsonResponse<>(Status.OK).build(); }
Source:
private IASTTranslationUnit getAST() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; IWorkbenchPage page = window.getActivePage(); if (page == null) return null; IEditorPart editor = page.getActiveEditor(); if (editor == null) return null; IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager(); ITranslationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); if (unit == null) return null; try { IASTTranslationUnit ast = unit.getAST(null, ITranslationUnit.AST_SKIP_ALL_HEADERS); return ast; } catch (CModelException e) { CUIPlugin.log(e); } catch (CoreException e) { CUIPlugin.log(e); } return null; }

Target:
private IASTTranslationUnit getAST() { if (fTranslationUnit != null) return fTranslationUnit; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; IWorkbenchPage page = window.getActivePage(); if (page == null) return null; IEditorPart editor = page.getActiveEditor(); if (editor == null) return null; IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager(); ITranslationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); if (unit == null) return null; try { fTranslationUnit = unit.getAST(null, ITranslationUnit.AST_SKIP_ALL_HEADERS); return fTranslationUnit; } catch (CoreException e) { CUIPlugin.log(e); } return null; }
Source:
private void loadGeodatabaseSymbolDictionary() { Geodatabase geodatabase = new Geodatabase(Environment.getExternalStorageDirectory() + "/ArcGIS/samples/Dictionary/militaryoverlay.geodatabase"); geodatabase.loadAsync(); DictionarySymbolStyle symbolDictionary = new DictionarySymbolStyle("mil2525d", Environment.getExternalStorageDirectory() + "/ArcGIS/samples/Dictionary/mil2525d.stylx"); symbolDictionary.loadAsync(); geodatabase.addDoneLoadingListener(() -> { if (geodatabase.getLoadStatus() == LoadStatus.LOADED) { for (GeodatabaseFeatureTable table : geodatabase.getGeodatabaseFeatureTables()) { FeatureLayer featureLayer = new FeatureLayer(table); featureLayer.loadAsync(); featureLayer.setMinScale(1000000); mMapView.getMap().getOperationalLayers().add(featureLayer); DictionaryRenderer dictionaryRenderer = new DictionaryRenderer(symbolDictionary); featureLayer.setRenderer(dictionaryRenderer); featureLayer.addDoneLoadingListener(() -> { if (featureLayer.getLoadStatus() == LoadStatus.LOADED) { mMapView.setViewpointGeometryAsync(featureLayer.getFullExtent()); } else { String error = "Feature Layer Failed to Load!"; Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); } } else { String error = "Geodatabase Failed to Load!"; Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); }

Target:
private void loadGeodatabaseSymbolDictionary() { Geodatabase geodatabase = new Geodatabase( Environment.getExternalStorageDirectory() + getString(R.string.militaryoverlay_geodatabase)); geodatabase.loadAsync(); DictionarySymbolStyle symbolDictionary = new DictionarySymbolStyle("mil2525d", Environment.getExternalStorageDirectory() + getString(R.string.mil2525d_stylx)); symbolDictionary.loadAsync(); geodatabase.addDoneLoadingListener(() -> { if (geodatabase.getLoadStatus() == LoadStatus.LOADED) { for (GeodatabaseFeatureTable table : geodatabase.getGeodatabaseFeatureTables()) { FeatureLayer featureLayer = new FeatureLayer(table); featureLayer.loadAsync(); featureLayer.setMinScale(1000000); mMapView.getMap().getOperationalLayers().add(featureLayer); DictionaryRenderer dictionaryRenderer = new DictionaryRenderer(symbolDictionary); featureLayer.setRenderer(dictionaryRenderer); featureLayer.addDoneLoadingListener(() -> { if (featureLayer.getLoadStatus() == LoadStatus.LOADED) { mMapView.setViewpointGeometryAsync(featureLayer.getFullExtent()); } else { String error = "Feature Layer Failed to Load: " + featureLayer.getLoadError().getMessage(); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); } } else { String error = "Geodatabase Failed to Load: " + geodatabase.getLoadError().getMessage(); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); }
Source:
public OperationFuture<LoadBalancerPool> update( LoadBalancerPool loadBalancerPool, List<LoadBalancerNodeMetadata> nodesList ) { LoadBalancer loadBalancer = loadBalancerPool.getLoadBalancer(); loadBalancerNodeClient.update( fetchDataCenterId(loadBalancer.getDataCenter()), fetchLoadBalancerId(loadBalancer), fetchLoadBalancerPoolId(loadBalancerPool), nodesList ); return new OperationFuture<>( loadBalancerPool, new NoWaitingJobFuture() ); }

Target:
public OperationFuture<LoadBalancerPool> update( LoadBalancerPool loadBalancerPool, List<LoadBalancerNodeMetadata> nodesList ) { LoadBalancerPoolMetadata loadBalancerPoolMetadata = loadBalancerPoolService.findByRef( loadBalancerPool ); loadBalancerNodeClient.update( loadBalancerPoolMetadata.getDataCenterId(), loadBalancerPoolMetadata.getLoadBalancerId(), loadBalancerPoolMetadata.getId(), nodesList ); return new OperationFuture<>( loadBalancerPool, new NoWaitingJobFuture() ); }
Source:
public void clusterShouldNotElectNewLeader() throws Exception { int leaderId = 0; clusterRule.withInstanceCoreParam( CausalClusteringSettings.refuse_to_be_leader, ( x ) -> { if ( x == leaderId ) { return "false"; } else { return "true"; } } ); Cluster cluster = clusterRule.createCluster(); cluster.start(); cluster.awaitLeader(); cluster.coreTx( ( db, tx ) -> { Node node = db.createNode( label( "boo" ) ); node.setProperty( "foobar", "baz_bat" ); tx.success(); } ); cluster.removeCoreMemberWithMemberId( leaderId ); try { cluster.awaitLeader(10, SECONDS); fail( "Should not have elected a leader" ); } catch ( TimeoutException ex ) { } }

Target:
public void clusterShouldNotElectNewLeader() throws Exception { int leaderId = 0; clusterRule.withInstanceCoreParam( CausalClusteringSettings.refuse_to_be_leader, ( x ) -> { if ( x == leaderId ) { return "false"; } else { return "true"; } } ); Cluster cluster = clusterRule.createCluster(); cluster.start(); assertEquals( leaderId, cluster.awaitLeader().serverId() ); cluster.coreTx( ( db, tx ) -> { Node node = db.createNode( label( "boo" ) ); node.setProperty( "foobar", "baz_bat" ); tx.success(); } ); cluster.removeCoreMemberWithMemberId( leaderId ); try { cluster.awaitLeader(10, SECONDS); fail( "Should not have elected a leader" ); } catch ( TimeoutException ex ) { } }
Source:
public void addMoodToMessage(Message message, Mood mood) { addMoodToMessage(message, mood, null); }

Target:
public static void addMoodToMessage(Message message, Mood mood) { addMoodToMessage(message, mood, null); }
Source:
public SearchResult searchByCenter(@NonNull final Geopoint center) { return new SearchResult(); }

Target:
public SearchResult searchByCenter(@NonNull final Geopoint center) { try { return new SearchResult(SuApi.searchByCenter(center, 20, this)); } catch (final SuApi.NotAuthorizedException e) { return new SearchResult(StatusCode.NOT_LOGGED_IN); } catch (final SuApi.ConnectionErrorException e) { return new SearchResult(StatusCode.CONNECTION_FAILED_SU); } catch (final Exception e) { Log.e("SuConnector.searchByCenter failed: ", e); return new SearchResult(StatusCode.UNKNOWN_ERROR); } }
Source:
private short[] mergeShortHashes(SparseHll other) { short[] result = new short[numberOfHashes + other.numberOfHashes]; int leftIndex = 0; int rightIndex = 0; int index = 0; while (leftIndex < numberOfHashes && rightIndex < other.numberOfHashes) { int left = shortHashes[leftIndex] & 0xFFFF; int right = other.shortHashes[rightIndex] & 0xFFFF; if (left < right) { result[index++] = shortHashes[leftIndex++]; } else if (left > right) { result[index++] = other.shortHashes[rightIndex++]; } else { result[index] = shortHashes[leftIndex]; index++; leftIndex++; rightIndex++; } } while (leftIndex < numberOfHashes) { result[index++] = shortHashes[leftIndex++]; } while (rightIndex < other.numberOfHashes) { result[index++] = other.shortHashes[rightIndex++]; } return Arrays.copyOf(result, index); }

Target:
private short[] mergeShortHashes(SparseHll other) { short[] result = new short[numberOfHashes + other.numberOfHashes]; int leftIndex = 0; int rightIndex = 0; int index = 0; while (leftIndex < numberOfHashes && rightIndex < other.numberOfHashes) { int left = shortHashes[leftIndex] & 0xFFFF; int right = other.shortHashes[rightIndex] & 0xFFFF; if (left < right) { result[index++] = shortHashes[leftIndex++]; } else if (left > right) { result[index++] = other.shortHashes[rightIndex++]; } else { result[index++] = shortHashes[leftIndex]; leftIndex++; rightIndex++; } } while (leftIndex < numberOfHashes) { result[index++] = shortHashes[leftIndex++]; } while (rightIndex < other.numberOfHashes) { result[index++] = other.shortHashes[rightIndex++]; } return Arrays.copyOf(result, index); }
Source:
public AggregationBuilder addAggregation(Symbol output, Expression expression, List<Type> inputTypes, Optional<Symbol> mask) { checkArgument(expression instanceof FunctionCall); FunctionCall aggregation = (FunctionCall) expression; Signature signature = metadata.getFunctionRegistry().resolveFunction(aggregation.getName(), TypeSignatureProvider.fromTypes(inputTypes)); return addAggregation(output, new Aggregation(aggregation, signature, mask)); }

Target:
private AggregationBuilder addAggregation(Symbol output, Expression expression, List<Type> inputTypes, Optional<Symbol> mask) { checkArgument(expression instanceof FunctionCall); FunctionCall aggregation = (FunctionCall) expression; Signature signature = metadata.getFunctionRegistry().resolveFunction(aggregation.getName(), TypeSignatureProvider.fromTypes(inputTypes)); return addAggregation(output, new Aggregation(aggregation, signature, mask)); }
Source:
public static List<String> getNationalities() { List<String> nationalities = new ArrayList<>(); for (String nationality : NATIONALITIES) { nationalities.add(nationality); } return nationalities; }

Target:
public static List<String> getNationalities() { return Arrays.asList(NATIONALITIES); }
Source:
protected KieContainer getKieContainer(Path path) { KieModule kieModule = moduleService.resolveModule(path); KieContainer kieContainer = buildInfoService.getBuildInfo(kieModule).getKieContainer(); if (kieContainer == null) { throw new IllegalArgumentException("Impossible to retrieve KieContainer, please fix compilation errors of " + "the project and then build it again."); } return kieContainer; }

Target:
protected KieContainer getKieContainer(Path path) { KieModule kieModule = moduleService.resolveModule(path); KieContainer kieContainer = buildInfoService.getBuildInfo(kieModule).getKieContainer(); if (kieContainer == null) { throw new IllegalArgumentException("Retrieving KieContainer has failed. Fix all compilation errors within the " + "project and build the project again."); } return kieContainer; }
Source:
public int getAuditerMessagesCount(PerunSession perunSession) throws InternalErrorException, PrivilegeException { if (!AuthzResolver.isAuthorized(perunSession, Role.PERUNADMIN)) { throw new PrivilegeException(perunSession, "getAuditerMessagesCount"); } return getAuditMessagesManagerBl().getAuditerMessagesCount(perunSession); }

Target:
public int getAuditerMessagesCount(PerunSession perunSession) throws InternalErrorException { return getAuditMessagesManagerBl().getAuditerMessagesCount(perunSession); }
Source:
public MBeanNamespaceManager(String baseName) { this.baseNamespace = baseName; }

Target:
private MBeanNamespaceManager(String baseName) { requireNonNull(baseName, "baseName is null"); this.baseNamespace = baseName; }
Source:
protected void updateMipmapLevel(int level, long endTime) { try { List<ITmfStateInterval> lowerIntervals = intervals.get(level - 1); if (lowerIntervals.size() == 0) { return; } long startTime = lowerIntervals.get(0).getStartTime(); ITmfStateValue value = computeMipmapValue(lowerIntervals, startTime, endTime); lowerIntervals.clear(); int levelQuark = ss.getQuarkRelativeAndAdd(mipmapQuark, String.valueOf(level)); if (!checkLevelExists(level)) { addLevelQuark(levelQuark); ss.updateOngoingState(TmfStateValue.newValueInt(level), mipmapQuark); intervals.add(new ArrayList<ITmfStateInterval>(getMipmapResolution())); } ITmfStateInterval interval = new TmfStateInterval(startTime, endTime, levelQuark, value); intervals.get(level).add(interval); ss.modifyAttribute(startTime, value, levelQuark); } catch (StateValueTypeException e) { Activator.logError("TmfMipmapFeature : Bad state value type", e); } catch (AttributeNotFoundException e) { Activator.logError("TmfMipmapFeature : Attribute not found", e); } catch (TimeRangeException e) { Activator.logError("TmfMipmapFeature : bad state value type", e); } }

Target:
protected void updateMipmapLevel(int level, long endTime) { try { List<ITmfStateInterval> lowerIntervals = intervals.get(level - 1); if (lowerIntervals.size() == 0) { return; } long startTime = lowerIntervals.get(0).getStartTime(); ITmfStateValue value = computeMipmapValue(lowerIntervals, startTime, endTime); lowerIntervals.clear(); int levelQuark = ss.getQuarkRelativeAndAdd(mipmapQuark, String.valueOf(level)); if (!checkLevelExists(level)) { addLevelQuark(levelQuark); ss.updateOngoingState(TmfStateValue.newValueInt(level), mipmapQuark); intervals.add(new ArrayList<ITmfStateInterval>(getMipmapResolution())); } ITmfStateInterval interval = new TmfStateInterval(startTime, endTime, levelQuark, value); intervals.get(level).add(interval); ss.modifyAttribute(startTime, value, levelQuark); } catch (StateValueTypeException e) { Activator.logError("TmfMipmapFeature : Bad state value type", e); } catch (AttributeNotFoundException e) { Activator.logError("TmfMipmapFeature : Attribute not found", e); } catch (TimeRangeException e) { Activator.logError("TmfMipmapFeature : Time stamp is out of range", e); } }
Source:
private int getItemIndex(T item) { Objects.requireNonNull(item, "item cannot be null"); final Object itemIdentifier = getDataProvider().getId(item); Objects.requireNonNull(itemIdentifier, "Identity Provider should not return null"); AtomicInteger index = new AtomicInteger(-1); if (!getItems().peek(t -> index.incrementAndGet()) .filter(t -> itemIdentifier.equals(getDataProvider() .getId(t))).findFirst().isPresent()) { return -1; } return index.get(); }

Target:
private int getItemIndex(T item) { ListDataProvider<T> dataProvider = getDataProvider(); return getItemIndex(item, dataProvider::getId); }
Source:
protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) { String name = getSecondaryIdName(); return new ScriptedXYTreeViewer(Objects.requireNonNull(parent), name); }

Target:
protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) { return new ScriptedXYTreeViewer(Objects.requireNonNull(parent), getViewSite().getSecondaryId().replace(ScriptedXYView.COLON, ":")); }
Source:
private void flushIndexBuffer() throws IOException { if (indexBuffer.position() > 0) { indexBuffer.flip(); indexFileChannel.write(indexBuffer); } }

Target:
private void flushIndexBuffer() throws IOException { indexBuffer.flip(); if (indexBuffer.limit() > 0) { BufferReaderWriterUtil.writeBuffer(indexFileChannel, indexBuffer); } }
Source:
public static boolean isIdentificationResponse(Intent intent) { return intent.hasExtra("identification"); }

Target:
public static boolean isIdentificationResponse(Intent intent) { return intent.hasExtra(IDENTIFICATION_KEY); }
Source:
Collection<Slice> writeDeltaDeleteFile(BitSet rowsToDelete) { if (rowsToDelete.isEmpty()) { return ImmutableList.of(); } List<Long> columnIds = new ArrayList<>(); List<Type> columnTypes = new ArrayList<>(); columnIds.add(0L); columnTypes.add(BIGINT); if (oldDeltaDeleteShardUuid.isPresent()) { mergeRowsToDelete(rowsToDelete, oldDeltaDeleteShardUuid.get()); } if (rowsToDelete.cardinality() == getRowCount(oldShardUuid)) { return shardDeleteDelta(oldShardUuid, oldDeltaDeleteShardUuid, Optional.empty()); } BlockBuilder blockBuilder = new LongArrayBlockBuilder(null, rowsToDelete.size()); for (int i = rowsToDelete.nextSetBit(0); i >= 0; i = rowsToDelete.nextSetBit(i + 1)) { blockBuilder.writeLong(i); } Block blockToDelete = blockBuilder.build(); StoragePageSink pageSink = orcStorageManager.createStoragePageSink(transactionId, bucketNumber, columnIds, columnTypes, true); pageSink.appendPages(ImmutableList.of(new Page(blockToDelete))); List<ShardInfo> shardInfos = getFutureValue(pageSink.commit()); ShardInfo newDeltaDeleteShard = Iterables.getOnlyElement(shardInfos); return shardDeleteDelta(oldShardUuid, oldDeltaDeleteShardUuid, Optional.of(newDeltaDeleteShard)); }

Target:
Collection<Slice> writeDeltaDeleteFile(BitSet rowsToDelete) { if (rowsToDelete.isEmpty()) { return ImmutableList.of(); } List<Long> columnIds = new ArrayList<>(); List<Type> columnTypes = new ArrayList<>(); columnIds.add(0L); columnTypes.add(BIGINT); oldDeltaDeleteShardUuid.ifPresent(oldDeltaDeleteShardUuid -> mergeToRowsToDelete(rowsToDelete, oldDeltaDeleteShardUuid)); if (rowsToDelete.cardinality() == getRowCount(oldShardUuid)) { return shardDeleteDelta(oldShardUuid, oldDeltaDeleteShardUuid, Optional.empty()); } BlockBuilder blockBuilder = new LongArrayBlockBuilder(null, rowsToDelete.size()); for (int i = rowsToDelete.nextSetBit(0); i >= 0; i = rowsToDelete.nextSetBit(i + 1)) { blockBuilder.writeLong(i); } Block blockToDelete = blockBuilder.build(); StoragePageSink pageSink = orcStorageManager.createStoragePageSink(fileSystemContext, transactionId, bucketNumber, columnIds, columnTypes, true); pageSink.appendPages(ImmutableList.of(new Page(blockToDelete))); List<ShardInfo> shardInfos = getFutureValue(pageSink.commit()); ShardInfo newDeltaDeleteShard = Iterables.getOnlyElement(shardInfos); return shardDeleteDelta(oldShardUuid, oldDeltaDeleteShardUuid, Optional.of(newDeltaDeleteShard)); }
Source:
public static String getStateString(Bundle bundle) { final int state = bundle.getState(); return String.format("%s/%x", JsonBundle.getSimpleState(state), state); }

Target:
public static String getStateString(Bundle bundle) { return JsonBundle.getStateString(bundle.getState()); }
Source:
HelixAccountService(HelixPropertyStore<ZNRecord> helixStore, AccountServiceMetrics accountServiceMetrics, Notifier<String> notifier) { if (helixStore == null || accountServiceMetrics == null || notifier == null) { throw new IllegalArgumentException("helixStore or accountServiceMetrics or notifier cannot be null"); } this.helixStore = helixStore; this.accountServiceMetrics = accountServiceMetrics; this.notifier = notifier; listener = (topic, message) -> { checkOpen(); logger.trace("Start to process message={} for topic={}", message, topic); boolean noException = true; try { switch (message) { case FULL_ACCOUNT_METADATA_CHANGE_MESSAGE: readFullAccountAndUpdateCache(FULL_ACCOUNT_METADATA_PATH, false); break; default: logger.error("Could not understand message={} for topic={}", message, topic); accountServiceMetrics.unRecognizedMessageErrorCount.inc(); } } catch (Exception e) { noException = false; logger.error("Exception occurred when processing message={} for topic={}.", message, topic, e); accountServiceMetrics.processFullAccountMessageErrorCount.inc(); } if (noException) { logger.trace("Completed processing message={} for topic={}", message, topic); } }; notifier.subscribe(ACCOUNT_METADATA_CHANGE_TOPIC, listener); readFullAccountAndUpdateCache(FULL_ACCOUNT_METADATA_PATH, true); isOpen = true; }

Target:
HelixAccountService(HelixPropertyStore<ZNRecord> helixStore, AccountServiceMetrics accountServiceMetrics, Notifier<String> notifier) { this.helixStore = Objects.requireNonNull(helixStore, "helixStore cannot be null"); this.accountServiceMetrics = Objects.requireNonNull(accountServiceMetrics, "accountServiceMetrics cannot be null"); this.notifier = Objects.requireNonNull(notifier, "notifier cannot be null"); listener = (topic, message) -> { checkOpen(); logger.trace("Start to process message={} for topic={}", message, topic); try { switch (message) { case FULL_ACCOUNT_METADATA_CHANGE_MESSAGE: logger.trace("Start processing message={} for topic={}", message, topic); readFullAccountAndUpdateCache(FULL_ACCOUNT_METADATA_PATH); logger.trace("Completed processing message={} for topic={}", message, topic); break; default: accountServiceMetrics.unRecognizedMessageErrorCount.inc(); throw new RuntimeException("Could not understand message=" + message + " for topic=" + topic); } } catch (Exception e) { logger.error("Exception occurred when processing message={} for topic={}.", message, topic, e); accountServiceMetrics.remoteDataCorruptionErrorCount.inc(); accountServiceMetrics.fetchRemoteAccountErrorCount.inc(); } }; notifier.subscribe(ACCOUNT_METADATA_CHANGE_TOPIC, listener); try { readFullAccountAndUpdateCache(FULL_ACCOUNT_METADATA_PATH); } catch (Exception e) { logger.error("Exception occurred when fetching remote account data", e); accountServiceMetrics.fetchRemoteAccountErrorCount.inc(); } isOpen = true; }
Source:
private String getStartedBy(final Run run) { final Cause.UserIdCause cause = (Cause.UserIdCause) run.getCause(Cause.UserIdCause.class); final String startedBy; if (cause != null) { startedBy = cause.getUserId(); } else { startedBy = null; } return startedBy == null ? "" : startedBy; }

Target:
private String getStartedBy(final Run run) { final Cause.UserIdCause cause = (Cause.UserIdCause) run.getCause(Cause.UserIdCause.class); String startedBy = ""; if (cause != null && cause.getUserId() != null) { startedBy = cause.getUserId(); } return startedBy; }
Source:
public static void handleRequest(RestRequestInfo restRequestInfo, AdminMetrics adminMetrics) throws RestServiceException { RestResponseHandler responseHandler = restRequestInfo.getRestResponseHandler(); if (restRequestInfo.isFirstPart()) { logger.trace("Handling echo - {}", restRequestInfo.getRestRequestMetadata().getUri()); adminMetrics.echoRate.mark(); long startTime = System.currentTimeMillis(); String echoStr = echo(restRequestInfo.getRestRequestMetadata(), adminMetrics).toString(); responseHandler.setContentType("application/json"); responseHandler.addToResponseBody(echoStr.getBytes(), true); responseHandler.flush(); adminMetrics.echoTimeInMs.update(System.currentTimeMillis() - startTime); } else if (restRequestInfo.getRestRequestContent().isLast()) { responseHandler.onRequestComplete(null, false); logger.trace("Finished handling echo - {}", restRequestInfo.getRestRequestMetadata().getUri()); } }

Target:
public static void handleRequest(RestRequestInfo restRequestInfo, AdminMetrics adminMetrics) throws RestServiceException { RestResponseHandler responseHandler = restRequestInfo.getRestResponseHandler(); if (restRequestInfo.isFirstPart()) { logger.trace("Handling echo - {}", restRequestInfo.getRestRequestMetadata().getUri()); adminMetrics.echoRate.mark(); long startTime = System.currentTimeMillis(); try { String echoStr = echo(restRequestInfo.getRestRequestMetadata(), adminMetrics).toString(); responseHandler.setContentType("application/json"); responseHandler.addToResponseBody(echoStr.getBytes(), true); responseHandler.flush(); logger.trace("Sent echo response for request {}", restRequestInfo.getRestRequestMetadata().getUri()); } finally { long processingTime = System.currentTimeMillis() - startTime; logger.trace("Processing echo response for request took ms", restRequestInfo.getRestRequestMetadata().getUri(), processingTime); adminMetrics.echoProcessingTimeInMs.update(processingTime); } } else if (restRequestInfo.getRestRequestContent().isLast()) { responseHandler.onRequestComplete(null, false); logger.trace("Echo request complete", restRequestInfo.getRestRequestMetadata().getUri()); } }
Source:
ValueHolder<V> getAndFault(K key) throws StoreAccessException; ValueHolder<V> computeIfAbsentAndFault(K key, Function<? super K, ? extends V> mappingFunction) throws StoreAccessException; boolean flush(K key, ValueHolder<V> valueHolder); void setInvalidationValve(InvalidationValve<K> valve); interface InvalidationValve<K> { void invalidateAll() throws StoreAccessException; }

Target:
ValueHolder<V> getAndFault(K key) throws StoreAccessException; ValueHolder<V> computeIfAbsentAndFault(K key, Function<? super K, ? extends V> mappingFunction) throws StoreAccessException; boolean flush(K key, ValueHolder<V> valueHolder); void setInvalidationValve(InvalidationValve valve); interface InvalidationValve { void invalidateAll() throws StoreAccessException; }
Source:
public Function<Class<?>, NamedEntityProjection> visitRelationship(CoreParser.RelationshipContext ctx) { return (parentClass) -> { String entityName = ctx.term().getText(); Class<?> entityClass = getEntityClass(parentClass, entityName); FilterExpression filter = scope.getExpressionForRelation(parentClass, entityName).orElse(null); Sorting sorting = SortingImpl.getDefaultEmptyInstance(); if (scope.getQueryParams().isPresent()) { sorting = SortingImpl.parseQueryParams(scope.getQueryParams().get(), entityClass, dictionary); } return NamedEntityProjection.builder() .name(entityName) .projection(EntityProjection.builder() .filterExpression(filter) .sorting(sorting) .pagination(scope.getPagination()) .type(entityClass) .build() ).build(); }; }

Target:
public Function<Class<?>, NamedEntityProjection> visitRelationship(CoreParser.RelationshipContext ctx) { return (parentClass) -> { String entityName = ctx.term().getText(); Class<?> entityClass = getEntityClass(parentClass, entityName); FilterExpression filter = scope.getExpressionForRelation(parentClass, entityName).orElse(null); Sorting sorting = SortingImpl.parseQueryParams(scope.getQueryParams(), entityClass, dictionary); Pagination pagination = PaginationImpl.parseQueryParams(entityClass, scope.getQueryParams(), scope.getElideSettings()); return NamedEntityProjection.builder() .name(entityName) .projection(EntityProjection.builder() .filterExpression(filter) .sorting(sorting) .pagination(pagination) .type(entityClass) .build() ).build(); }; }
Source:
private void cacheParents(CloneSourceProvider repositoryImport, Collection<RepositoryServerInfo> repositoryServerInfos) { for (RepositoryServerInfo info : repositoryServerInfos) { parents.put(info, repositoryImport); } }

Target:
private void cacheParents(CloneSourceProvider repositoryImport, Collection<RepositoryServerInfo> repositoryServerInfos) { for (RepositoryServerInfo info : repositoryServerInfos) parents.put(info, repositoryImport); }
Source:
protected String buildAccountingFieldsKeyForAtmCashAdvance(ConcurStandardAccountingExtractDetailLine detailLine) { return String.format(ACCOUNTING_FIELDS_KEY_FORMAT, collectorHelper.getPrepaidOffsetChartCode(), collectorHelper.getPrepaidOffsetAccountNumber(), collectorHelper.getDashOnlyPropertyValue(KFSPropertyConstants.SUB_ACCOUNT_NUMBER), collectorHelper.getPrepaidOffsetObjectCode(), collectorHelper.getDashOnlyPropertyValue(KFSPropertyConstants.SUB_OBJECT_CODE), defaultToDashesIfBlank(detailLine.getReportProjectCode(), KFSPropertyConstants.PROJECT_CODE), StringUtils.defaultIfBlank(detailLine.getReportOrgRefId(), StringUtils.EMPTY)); }

Target:
protected String buildAccountingFieldsKeyForAtmCashAdvance(ConcurStandardAccountingExtractDetailLine detailLine) { return buildAccountingFieldsKey( collectorHelper.getPrepaidOffsetChartCode(), collectorHelper.getPrepaidOffsetAccountNumber(), collectorHelper.getDashOnlyPropertyValue(KFSPropertyConstants.SUB_ACCOUNT_NUMBER), collectorHelper.getPrepaidOffsetObjectCode(), collectorHelper.getDashOnlyPropertyValue(KFSPropertyConstants.SUB_OBJECT_CODE), defaultToDashesIfBlank(detailLine.getReportProjectCode(), KFSPropertyConstants.PROJECT_CODE), StringUtils.defaultIfBlank(detailLine.getReportOrgRefId(), StringUtils.EMPTY)); }
Source:
public Collection<ClassDiagramPattern> getPatternsList() { Collection<ClassDiagramPattern> newPatternList = new ArrayList<ClassDiagramPattern>(); newPatternList.add(new ClassDiagramPattern("pattern.class.diagram", "ClassDiagramPatternProvider", "this is a ClassDiagramPatternProvider", "images/classDiagramPattern.png")); return newPatternList; }

Target:
public Collection<IPatternProvider> getPatternsList() { Collection<IPatternProvider> newPatternList = new ArrayList<IPatternProvider>(); ClassDiagramPattern pattern = new ClassDiagramPattern(); pattern.setPatternCommand(new InitializerCommand(resourceSet, selection)); newPatternList.add(pattern); return newPatternList; }
Source:
public void customExpanderListParam() throws Exception { server.enqueue(new MockResponse()); TestInterface api = new TestInterfaceBuilder().target("http://localhost:" + server.getPort()); api.expandList(Arrays.asList(new Date(1234l))); assertThat(server.takeRequest()) .hasPath("/?date=1234"); }

Target:
public void customExpanderListParam() throws Exception { server.enqueue(new MockResponse()); TestInterface api = new TestInterfaceBuilder().target("http://localhost:" + server.getPort()); api.expandList(Arrays.asList(new Date(1234l), new Date(12345l))); assertThat(server.takeRequest()) .hasPath("/?date=1234&date=12345"); }
Source:
private void stopRunningThread(long endTime) { if (!shtThread.isAlive()) { return; } try { HTInterval[] pill = new HTInterval[] { new HTInterval(-1, endTime, -1, TmfStateValue.nullValue()) }; if (index != STORAGE_SIZE) { intervalQueue.put(temp); } intervalQueue.put(pill); shtThread.join(); } catch (TimeRangeException e) { Activator.getDefault().logError("Error closing state system", e); } catch (InterruptedException e) { Activator.getDefault().logError("State system interrupted", e); } }

Target:
private void stopRunningThread(long endTime) { if (!shtThread.isAlive()) { return; } try { Collection<HTInterval> pill = Collections.singletonList(new HTInterval(-1, endTime, -1, TmfStateValue.nullValue())); if (!fInterval.isEmpty()) { intervalQueue.put(fInterval); } intervalQueue.put(pill); shtThread.join(); } catch (TimeRangeException e) { Activator.getDefault().logError("Error closing state system", e); } catch (InterruptedException e) { Activator.getDefault().logError("State system interrupted", e); } }
Source:
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { switch (oldVersion) { case DB_VERSION_PRE_EVENT_SERVER: db.execSQL("ALTER TABLE " + Tables.HOSTS + " ADD COLUMN " + MediaContract.HostsColumns.USE_EVENT_SERVER + " INTEGER DEFAULT 1;"); db.execSQL("ALTER TABLE " + Tables.HOSTS + " ADD COLUMN " + MediaContract.HostsColumns.EVENT_SERVER_PORT + " INTEGER DEFAULT " + HostInfo.DEFAULT_EVENT_SERVER_PORT + ";"); case DB_VERSION_PRE_SONGS_NO_ALBUM: db.execSQL("ALTER TABLE " + Tables.SONGS + " ADD COLUMN "+ MediaContract.SongsColumns.ARTISTID + " INTEGER DEFAULT 0;"); } }

Target:
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { switch (oldVersion) { case DB_VERSION_PRE_EVENT_SERVER: db.execSQL("ALTER TABLE " + Tables.HOSTS + " ADD COLUMN " + MediaContract.HostsColumns.USE_EVENT_SERVER + " INTEGER DEFAULT 1;"); db.execSQL("ALTER TABLE " + Tables.HOSTS + " ADD COLUMN " + MediaContract.HostsColumns.EVENT_SERVER_PORT + " INTEGER DEFAULT " + HostInfo.DEFAULT_EVENT_SERVER_PORT + ";"); case DB_VERSION_PRE_SONG_ARTISTS: createSongArtistsTable(db); } }