auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testSetAndGetLocalTimeZone() { configuration.setString("table.local-time-zone", "Asia/Shanghai"); configByConfiguration.addConfiguration(configuration); configByMethod.setLocalTimeZone(ZoneId.of("Asia/Shanghai")); <START> assertEquals(Integer.valueOf(5000), configByMethod.getMaxGeneratedCodeLength()); assertEquals(Integer.valueOf(5000), configByConfiguration.getMaxGeneratedCodeLength()); <END> }</code><technical_language>assert time zone</technical_language>

Target:
public void testSetAndGetLocalTimeZone() { configuration.setString("table.local-time-zone", "Asia/Shanghai"); configByConfiguration.addConfiguration(configuration); configByMethod.setLocalTimeZone(ZoneId.of("Asia/Shanghai")); assertEquals(ZoneId.of("Asia/Shanghai"), configByMethod.getLocalTimeZone()); assertEquals(ZoneId.of("Asia/Shanghai"), configByConfiguration.getLocalTimeZone()); }
Source:
<code>protected CompletionStage<Void> flushHeaders() { CompletionStage<Void> ret = CompletableFuture.completedFuture(null); if (headersFlushed) return ret; headersFlushed = true; RuntimeDelegate delegate = RuntimeDelegate.getInstance(); for (String key : headers.keySet()) { List<Object> objs = headers.get(key); for (Object obj : objs) { String value; RuntimeDelegate.HeaderDelegate headerDelegate = delegate .createHeaderDelegate(obj.getClass()); if (headerDelegate != null) { value = headerDelegate.toString(obj); } else { value = obj.toString(); } <START> ret = stream.asyncWrite(key.getBytes()) <END> .thenCompose(v -> stream.asyncWrite(": ".getBytes())) .thenCompose(v -> stream.asyncWrite(value.getBytes())) .thenCompose(v -> stream.asyncWrite("\r\n".getBytes())); } } return ret.thenCompose(v -> stream.asyncWrite("\r\n".getBytes())); }</code><technical_language>This needs a charset</technical_language>

Target:
protected CompletionStage<Void> flushHeaders() { CompletionStage<Void> ret = CompletableFuture.completedFuture(null); if (headersFlushed) return ret; headersFlushed = true; RuntimeDelegate delegate = RuntimeDelegate.getInstance(); for (String key : headers.keySet()) { List<Object> objs = headers.get(key); for (Object obj : objs) { String value; RuntimeDelegate.HeaderDelegate headerDelegate = delegate .createHeaderDelegate(obj.getClass()); if (headerDelegate != null) { value = headerDelegate.toString(obj); } else { value = obj.toString(); } ret = stream.asyncWrite(key.getBytes(StandardCharsets.US_ASCII)) .thenCompose(v -> stream.asyncWrite(AbstractMultipartWriter.COLON_SPACE_BYTES)) .thenCompose(v -> stream.asyncWrite(value.getBytes(StandardCharsets.US_ASCII))) .thenCompose(v -> stream.asyncWrite(AbstractMultipartWriter.LINE_SEPARATOR_BYTES)); } } return ret.thenCompose(v -> stream.asyncWrite(AbstractMultipartWriter.LINE_SEPARATOR_BYTES)); }
Source:
<code>public void setUpOntology() throws ComponentLookupException, IOException, SolrServerException, CacheException { this.cache = mock(Cache.class); SolrOntologyServiceInitializer externalServicesAccess = this.mocker.getInstance(SolrOntologyServiceInitializer.class); when(externalServicesAccess.getCache()).thenReturn(this.cache); this.server = mock(SolrServer.class); when(externalServicesAccess.getServer()).thenReturn(this.server); this.ontologyService = this.mocker.getComponentUnderTest(); <START> this.ontologyServiceResult = this.ontologyService.reindex(null); <END> }</code><technical_language>This is painful... reindex ontology, this bomb EBI server useless requests, especially reindex times in a row. Plus, tests executed in parallel, messing index big time. mock ontology well, instead of downloading a remote host, a file:///... url, mock download part</technical_language>

Target:
public void setUpOntology() throws ComponentLookupException, IOException, SolrServerException, CacheException { this.cache = mock(Cache.class); SolrOntologyServiceInitializer externalServicesAccess = this.mocker.getInstance(SolrOntologyServiceInitializer.class); when(externalServicesAccess.getCache()).thenReturn(this.cache); this.server = mock(SolrServer.class); when(externalServicesAccess.getServer()).thenReturn(this.server); this.ontologyService = this.mocker.getComponentUnderTest(); }
Source:
<code>static boolean isFormatFlowed(String contentType) { <START> if (TEXT_PLAIN.equalsIgnoreCase(getHeaderParameter(contentType, null))) { <END> return HEADER_FORMAT_FLOWED.equalsIgnoreCase(getHeaderParameter(contentType, HEADER_PARAM_FORMAT)); } return false; }</code><technical_language>Extracting results of getHeaderParameter() calls local variables this easier read</technical_language>

Target:
static boolean isFormatFlowed(String contentType) { String mimeType = getHeaderParameter(contentType, null); if (isSameMimeType(TEXT_PLAIN, mimeType)) { String formatParameter = getHeaderParameter(contentType, HEADER_PARAM_FORMAT); return HEADER_FORMAT_FLOWED.equalsIgnoreCase(formatParameter); } return false; }
Source:
<code>private void processStatement(String lisFileName, VCastLisFileParser lisFileParser, int fileNum, int functionNum, VCastFunction function, VCastStatementCoverage statementCoverageItem, Map<String, JSONObject> discrepancies) { Integer functionNumber = function.getFindex(); Integer lineNumber = statementCoverageItem.getLine(); Pair<String, Boolean> lineData = null; Discrepancy newDiscrepancy = new Discrepancy(); try { lineData = lisFileParser.getSourceCodeForLine(functionNumber, lineNumber); } catch (OseeArgumentException ex) { <START> throw new OseeCoreException(ex, "Error(OseeArgumentException) parsing *.LIS file: [%s]. %s", <END> function.getName()); } catch (IOException ex) { throw new OseeCoreException(ex, "Error(IOException) parsing *.LIS file: [%s]. %s", function.getName()); } if (lineData != null) { newDiscrepancy.setText(lineData.getFirst().trim()); newDiscrepancy.setLocation(lineNumber); String id = String.valueOf(Lib.generateUuid()); newDiscrepancy.setId(id); discrepancies.put(id, new JSONObject(newDiscrepancy)); if (lineData.getSecond()) { String datId = generateDatId(fileNum, functionNum, lineNumber); datIdsCoveredByException.add(datId); } } }</code><technical_language>2 %s string passed</technical_language>

Target:
private void processStatement(String lisFileName, VCastLisFileParser lisFileParser, int fileNum, int functionNum, VCastFunction function, VCastStatementCoverage statementCoverageItem, Map<String, JSONObject> discrepancies) { Integer functionNumber = function.getFindex(); Integer lineNumber = statementCoverageItem.getLine(); Pair<String, Boolean> lineData = null; Discrepancy newDiscrepancy = new Discrepancy(); try { lineData = lisFileParser.getSourceCodeForLine(functionNumber, lineNumber); } catch (Exception ex) { throw new OseeCoreException(ex, "Error parsing LIS file: [%s], on function [%s]", lisFileName, function.getName()); } if (lineData != null) { newDiscrepancy.setText(lineData.getFirst().trim()); newDiscrepancy.setLocation(lineNumber); String id = String.valueOf(Lib.generateUuid()); newDiscrepancy.setId(id); discrepancies.put(id, new JSONObject(newDiscrepancy)); if (lineData.getSecond()) { String datId = generateDatId(fileNum, functionNum, lineNumber); datIdsCoveredByException.add(datId); } } }
Source:
<code><START> protected boolean executeAnalysis(final IProgressMonitor monitor) { <END> String directory = TmfTraceManager.getSupplementaryFileDir(getTrace()); final File htFile = new File(directory + getSsFileName()); final ITmfStateProvider htInput = getStateProvider(); if (htInput == null) { return false; } try { fStateSystem = TmfStateSystemFactory.newFullHistory(htFile, htInput, true); } catch (TmfTraceException e) { return false; } return true; }</code><technical_language>if executeAnalysis() is called (can happen?), check if fStateSystem is null, if not, ignore subsequent calls? wondering, super familiar analysis framework ;)</technical_language>

Target:
protected boolean executeAnalysis(final IProgressMonitor monitor) { final ITmfStateProvider htInput = createStateProvider(); if (htInput == null) { return false; } try { StateSystemBackend backend = getBackend(); switch (backend) { case FULL: case PARTIAL: String directory = TmfTraceManager.getSupplementaryFileDir(getTrace()); final File htFile = new File(directory + getSsFileName()); if (backend.equals(StateSystemBackend.FULL)) { fStateSystem = TmfStateSystemFactory.newFullHistory(htFile, htInput, true); } else { fStateSystem = TmfStateSystemFactory.newPartialHistory(htFile, htInput, true); } break; case INMEM: fStateSystem = TmfStateSystemFactory.newInMemHistory(htInput, true); break; case NULL: fStateSystem = TmfStateSystemFactory.newNullHistory(htInput); break; default: break; } } catch (TmfTraceException e) { return false; } return true; }
Source:
<code>public void visitClassDeclaration(ClassDeclarationTree tree) { Symbol classSymbol = createSymbol(tree.name(), Symbol.Kind.CLASS); enterScope(tree); classScope = currentScope; scopeBySymbol.put(classSymbol, classScope); scan(tree.name()); <START> NamespaceNameTree superClass = tree.superClass(); <END> if(superClass != null) { scan(superClass.namespaces()); Symbol superClassSymbol = resolveSymbol(superClass.name()); classScope.superClassScope = scopeBySymbol.get(superClassSymbol); } scan(tree.superInterfaces()); createMemberSymbols(tree); scan(tree.members()); classScope = null; leaveScope(); }</code><technical_language>resolve a superclass is in a namespace? e.g.: namespace NS1; class A namespace NS2; class A extends \NS1\A {}</technical_language>

Target:
public void visitClassDeclaration(ClassDeclarationTree tree) { Symbol classSymbol = createSymbol(tree.name(), Symbol.Kind.CLASS); enterScope(tree); classScope = currentScope; scan(tree.name()); NamespaceNameTree superClass = tree.superClass(); if(superClass != null) { scan(superClass.namespaces()); Symbol superClassSymbol = resolveSymbol(superClass.name()); classScope.superClassScope = scopeBySymbol.get(superClassSymbol); } scopeBySymbol.put(classSymbol, classScope); scan(tree.superInterfaces()); createMemberSymbols(tree); scan(tree.members()); classScope = null; leaveScope(); }
Source:
<code>protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE); localSession = designerPerspective.openSessionFromFile(sessionAirdResource); <START> diagram = localSession.getLocalSessionBrowser().perCategory().selectViewpoint("Design").selectRepresentation("Entities").selectDiagramInstance("aaaa package entities").open(); <END> editor = diagram.getEditor(); }</code><technical_language>Prefer API open a representation (faster more reliable): editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), "Entities", "aaaa package entities", DDiagram.class);</technical_language>

Target:
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE); localSession = designerPerspective.openSessionFromFile(sessionAirdResource); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), "Entities", "aaaa package entities", DDiagram.class); DialectEditor dialectEditor = (DialectEditor) editor.getReference().getEditor(false); diagram = dialectEditor.getRepresentation(); }
Source:
<code>public void agentLoads() throws IOException, InterruptedException { final String buildDirectory = (String) System.getProperties().get("buildDirectory"); final String finalName = (String) System.getProperties().get("finalName"); <START> final int port = 1234; <END> final String config = getClass().getClassLoader().getResource("test.yml").getFile(); final String javaagent = "-javaagent:" + buildDirectory + "/" + finalName + ".jar=" + port + ":" + config; final String javaHome = System.getenv("JAVA_HOME"); final String java; if (javaHome != null && javaHome.equals("")) { java = javaHome + "/bin/java"; } else { java = "java"; } final Process app = new ProcessBuilder() .command(java, javaagent, "-cp", buildClasspath(), "io.prometheus.jmx.TestApplication") .start(); app.getInputStream().read(); InputStream stream = new URL("http://localhost:" + port + "/metrics").openStream(); BufferedReader contents = new BufferedReader(new InputStreamReader(stream)); boolean found = false; while (!found) { String line = contents.readLine(); if (line == null) { break; } if (line.contains("jmx_scrape_duration_seconds")) { found = true; } } assertThat("Expected metric not found", found); app.getOutputStream().write('\n'); app.getOutputStream().flush(); final int exitcode = app.waitFor(); int len; byte[] buffer = new byte[100]; while ((len = app.getErrorStream().read(buffer)) != -1) { System.out.write(buffer, 0, len); } assertThat("Application did not exit cleanly", exitcode == 0); }</code><technical_language><LINK_0></technical_language>

Target:
public void agentLoads() throws IOException, InterruptedException { final String buildDirectory = (String) System.getProperties().get("buildDirectory"); final String finalName = (String) System.getProperties().get("finalName"); final int port = Integer.parseInt((String) System.getProperties().get("it.port")); final String config = getClass().getClassLoader().getResource("test.yml").getFile(); final String javaagent = "-javaagent:" + buildDirectory + "/" + finalName + ".jar=" + port + ":" + config; final String javaHome = System.getenv("JAVA_HOME"); final String java; if (javaHome != null && javaHome.equals("")) { java = javaHome + "/bin/java"; } else { java = "java"; } final Process app = new ProcessBuilder() .command(java, javaagent, "-cp", buildClasspath(), "io.prometheus.jmx.TestApplication") .start(); try { app.getInputStream().read(); InputStream stream = new URL("http://localhost:" + port + "/metrics").openStream(); BufferedReader contents = new BufferedReader(new InputStreamReader(stream)); boolean found = false; while (!found) { String line = contents.readLine(); if (line == null) { break; } if (line.contains("jmx_scrape_duration_seconds")) { found = true; } } assertThat("Expected metric not found", found); app.getOutputStream().write('\n'); try { app.getOutputStream().flush(); } catch (IOException ignored) { } } finally { final int exitcode = app.waitFor(); int len; byte[] buffer = new byte[100]; while ((len = app.getErrorStream().read(buffer)) != -1) { System.out.write(buffer, 0, len); } assertThat("Application did not exit cleanly", exitcode == 0); } }
Source:
<code>private void addTextAsNewTag(ActionEvent event) { String inputText = inputTextField.getText(); if (StringUtil.isNotBlank(inputText)) { T newTag = stringConverter.fromString(inputText); <START> if ((newTag != null) && !tags.contains(newTag)&&(tags.isEmpty()||this.allowsMultiple)) { <END> tags.add(newTag); inputTextField.clear(); } } }</code><technical_language>Please add spaces &&</technical_language>

Target:
private void addTextAsNewTag(ActionEvent event) { String inputText = inputTextField.getText(); if (StringUtil.isNotBlank(inputText)) { T newTag = stringConverter.fromString(inputText); if ((newTag != null) && !tags.contains(newTag) && (tags.isEmpty() || this.properties.contains(FieldProperty.MULTIPLE_ENTRY_LINK))) { tags.add(newTag); inputTextField.clear(); } } }
Source:
<code>public void persistCommand(VdcActionType parentCommand, boolean enableCallback) { <START> persistCommand(parentCommand, getContext(), enableCallback, false); <END> }</code><technical_language>in line 2298 passed default is callbackTriggeredByEvent(),</technical_language>

Target:
public void persistCommand(VdcActionType parentCommand, boolean enableCallback) { persistCommand(parentCommand, getContext(), enableCallback, callbackTriggeredByEvent()); }
Source:
<code>private void edit(String key, String value) throws IOException { <START> Requester requester = root.retrieve().method("POST"); <END> if (!key.equals("name")) requester.with("name", name); requester.with(key, value).method("PATCH").withUrlPath(getApiTailUrl("")).to(); }</code><technical_language>redundant method("POST")</technical_language>

Target:
private void edit(String key, String value) throws IOException { Requester requester = root.createRequest(); if (!key.equals("name")) requester.with("name", name); requester.with(key, value).method("PATCH").withUrlPath(getApiTailUrl("")).send(); }
Source:
<code>public static OnmsTopologyPort create(OnmsTopologyVertex vertex, Integer index) throws OnmsTopologyException { if (vertex == null) { <START> throw new OnmsTopologyException("Canno create port, vertex is null"); <END> } if (index != null) { return new OnmsTopologyPort(vertex.getId()+":"+index,vertex,index); } return new OnmsTopologyPort(vertex.getId()+":-1",vertex,-1); }</code><technical_language>typo</technical_language>

Target:
public static OnmsTopologyPort create(OnmsTopologyVertex vertex, Integer index) throws OnmsTopologyException { if (vertex == null) { throw new OnmsTopologyException("Cannot create port, vertex is null"); } if (index != null) { return new OnmsTopologyPort(vertex.getId()+":"+index,vertex,index); } return new OnmsTopologyPort(vertex.getId()+":-1",vertex,-1); }
Source:
<code>protected void executeCommand() { VDSReturnValue vdsReturnaValue = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); setSucceeded(vdsReturnaValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError() .getMessage()); return; } GlusterAsyncTask asyncTask = getGlusterVolume().getAsyncTask(); List<Step> steps = DbFacade.getInstance().getStepDao().getStepsByExternalId(asyncTask.getTaskId()); for (Step step : steps) { <START> step.markStepEnded(JobExecutionStatus.ABORTED); <END> endStepJob(step); clearVolumeTaskAndReleaseLock(); } getReturnValue().setActionReturnValue(vdsReturnaValue); }</code><technical_language>Please update step description</technical_language>

Target:
protected void executeCommand() { VDSReturnValue vdsReturnaValue = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); setSucceeded(vdsReturnaValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError() .getMessage()); return; } GlusterAsyncTask asyncTask = getGlusterVolume().getAsyncTask(); Step step = DbFacade.getInstance().getStepDao().getStepsByExternalId(asyncTask.getTaskId()).get(0); step.markStepEnded(JobExecutionStatus.ABORTED); step.setDescription("Rebalancing operation Aborted by the user"); endStepJob(step); clearVolumeTaskAndReleaseLock(); getReturnValue().setActionReturnValue(vdsReturnaValue); }
Source:
<code>public void handleRow(int index, Values row) { if (row.length() == 0) { return; } if (!dictionary.hasMappings()) { dictionary.determineMappingFromHeadings(row, false); process.log(ProcessLog.info().withMessage(dictionary.getMappingAsString())); } else { <START> Watch w = Watch.start(); <END> try { Context ctx = filterEmptyValues(dictionary.load(row, false)); if (!isEmptyContext(ctx)) { handleRow(index, ctx); } } catch (HandledException e) { process.handle(Exceptions.createHandled() .to(Log.BACKGROUND) .withNLSKey("LineBasedJob.errorInRow") .set("row", index) .set("message", e.getMessage()) .handle()); } catch (Exception e) { process.handle(Exceptions.handle() .to(Log.BACKGROUND) .error(e) .withNLSKey("LineBasedJob.failureInRow") .set("row", index) .handle()); } finally { process.addTiming(NLS.get("LineBasedJob.row"), w.elapsedMillis()); } } }</code><technical_language>suggestion Watch watch = Watch.start();</technical_language>

Target:
public void handleRow(int index, Values row) { if (row.length() == 0) { return; } if (!dictionary.hasMappings()) { dictionary.determineMappingFromHeadings(row, false); process.log(ProcessLog.info().withMessage(dictionary.getMappingAsString())); } else { Watch watch = Watch.start(); try { Context context = filterEmptyValues(dictionary.load(row, false)); if (!isEmptyContext(context)) { handleRow(index, context); } } catch (HandledException e) { process.handle(Exceptions.createHandled() .to(Log.BACKGROUND) .withNLSKey("LineBasedJob.errorInRow") .set("row", index) .set("message", e.getMessage()) .handle()); } catch (Exception e) { process.handle(Exceptions.handle() .to(Log.BACKGROUND) .error(e) .withNLSKey("LineBasedJob.failureInRow") .set("row", index) .handle()); } finally { process.addTiming(NLS.get("LineBasedJob.row"), watch.elapsedMillis()); } } }
Source:
<code><START> PluginConfig withInheritance(ProjectState.Factory projectStateFactory) { <END> if (projectConfig == null) { return this; } ProjectState state = projectStateFactory.create(projectConfig); ProjectState parent = Iterables.getFirst(state.parents(), null); if (parent != null) { PluginConfig parentPluginConfig = parent.getConfig().getPluginConfig(pluginName) .withInheritance(projectStateFactory); Set<String> allNames = cfg.getNames(PLUGIN, pluginName); cfg = new Config(cfg); for (String name : parentPluginConfig.cfg.getNames(PLUGIN, pluginName)) { if (!allNames.contains(name)) { cfg.setStringList(PLUGIN, pluginName, name, Arrays .asList(parentPluginConfig.cfg.getStringList(PLUGIN, pluginName, name))); } } } return this; }</code><technical_language>I I prefer this for implementation: List<ProjectState> tree = Lists.newArrayList( projectStateFactory.create(projectConfig).tree()); Collections.reverse(tree); Config c = new Config(); copy(c, tree.get(0)); for (int i = 1; i < tree.size(); i++) { c = new Config(c); copy(c, tree.get(i)); } cfg = c; private void copy(Config dst, ProjectState state) { Config src = state.getConfig(); for (String name : src.getNames(PLUGIN, pluginName)) { dst.setStringList(PLUGIN, pluginName, Arrays.asList( src.getStringList(PLUGIN, pluginName, name)); } } standard Git JGit inheritance rules apply. For single variables child overrides parent. For getStringList() values presented, in inheritance order child parents All-Projects last. I convinced otherwise</technical_language>

Target:
PluginConfig withInheritance(ProjectState.Factory projectStateFactory) { if (projectConfig == null) { return this; } List<ProjectState> tree = Lists.newArrayList(projectStateFactory.create(projectConfig).tree()); Collections.reverse(tree); Config c = new Config(); copy(c, tree.get(0)); for (int i = 1; i < tree.size(); i++) { c = new Config(c); copy(c, tree.get(i)); } cfg = c; return this; }
Source:
<code>public MessageMonitor<? super EventMessage<?>> registerEventProcessor(String name, Function<Message<?>, Iterable<Tag>> tagsBuilder) { MessageTimerMonitor messageTimerMonitor = MessageTimerMonitor.buildMonitor(name, registry, tagsBuilder); <START> EventProcessorLatencyMonitor eventProcessorLatencyMonitor = EventProcessorLatencyMonitor.buildMonitor(name, <END> registry); CapacityMonitor capacityMonitor = CapacityMonitor.buildMonitor(name, registry, tagsBuilder); MessageCountingMonitor messageCountingMonitor = MessageCountingMonitor.buildMonitor(name, registry, tagsBuilder); List<MessageMonitor<? super EventMessage<?>>> monitors = new ArrayList<>(); monitors.add(messageTimerMonitor); monitors.add(eventProcessorLatencyMonitor); monitors.add(capacityMonitor); monitors.add(messageCountingMonitor); return new MultiMessageMonitor<>(monitors); }</code><technical_language>reasons providing tagsBuilder EventProcessorLatencyMonitor#buildMonitor method</technical_language>

Target:
public MessageMonitor<? super EventMessage<?>> registerEventProcessor(String name, Function<Message<?>, Iterable<Tag>> tagsBuilder) { MessageTimerMonitor messageTimerMonitor = MessageTimerMonitor.buildMonitor(name, registry, tagsBuilder); EventProcessorLatencyMonitor eventProcessorLatencyMonitor = EventProcessorLatencyMonitor.buildMonitor(name, registry, tagsBuilder); CapacityMonitor capacityMonitor = CapacityMonitor.buildMonitor(name, registry, tagsBuilder); MessageCountingMonitor messageCountingMonitor = MessageCountingMonitor.buildMonitor(name, registry, tagsBuilder); List<MessageMonitor<? super EventMessage<?>>> monitors = new ArrayList<>(); monitors.add(messageTimerMonitor); monitors.add(eventProcessorLatencyMonitor); monitors.add(capacityMonitor); monitors.add(messageCountingMonitor); return new MultiMessageMonitor<>(monitors); }
Source:
<code>private void createLongAccessor() { accessors.put(Long.class, new Accessor<Long>() { @Override public Long get(String key, Long defaultValue) { <START> return preferences.getLong(key, (defaultValue == null) ? 0L : defaultValue); <END> } @Override public void put(String key, Long value) { editor.putLong(key, value).apply(); } }); }</code><technical_language>issue above</technical_language>

Target:
private void createLongAccessor() { accessors.put(Long.class, new Accessor<Long>() { @Override public Long get(String key) { return preferences.getLong(key, 0L); } @Override public void put(String key, Long value) { editor.putLong(key, value).apply(); } }); }
Source:
<code>public void constructor_accessAndRefreshTokenNull_throws() { try { new UserCredentials(CLIENT_ID, CLIENT_SECRET, null, null); fail("Should not be able to refresh without refresh token."); } catch (Exception expected) { } <START> } <END></code><technical_language>Do access version of junit supports @Test(expected=Exception)</technical_language>

Target:
public void constructor_accessAndRefreshTokenNull_throws() { new UserCredentials(CLIENT_ID, CLIENT_SECRET, null, null); }
Source:
<code>public void handleMembersViewEvent(int memberListVersion, Collection<MemberInfo> memberInfos) { if (logger.isFinestEnabled()) { MemberListSnapshot snapshot = createSnapshot(memberListVersion, memberInfos); logger.finest("Handling new snapshot with membership version: " + memberListVersion + ", membersString " + membersString(snapshot)); } MemberListSnapshot clusterViewSnapshot = memberListSnapshot.get(); if (clusterViewSnapshot == EMPTY_SNAPSHOT) { synchronized (clusterViewLock) { clusterViewSnapshot = memberListSnapshot.get(); if (clusterViewSnapshot == EMPTY_SNAPSHOT) { applyInitialState(memberListVersion, memberInfos); initialListFetchedLatch.countDown(); return; } } } List<MembershipEvent> events = emptyList(); if (memberListVersion >= clusterViewSnapshot.version) { synchronized (clusterViewLock) { <START> clusterViewSnapshot = memberListSnapshot.get(); <END> if (memberListVersion >= clusterViewSnapshot.version) { Set<Member> prevMembers = clusterViewSnapshot.memberSet; MemberListSnapshot snapshot = createSnapshot(memberListVersion, memberInfos); memberListSnapshot.set(snapshot); Set<Member> currentMembers = snapshot.memberSet; events = detectMembershipEvents(prevMembers, currentMembers); } } } fireEvents(events); }</code><technical_language>double checked locking usage: clusterViewSnapshot volatile</technical_language>

Target:
public void handleMembersViewEvent(int memberListVersion, Collection<MemberInfo> memberInfos) { if (logger.isFinestEnabled()) { MemberListSnapshot snapshot = createSnapshot(memberListVersion, memberInfos); logger.finest("Handling new snapshot with membership version: " + memberListVersion + ", membersString " + membersString(snapshot)); } MemberListSnapshot clusterViewSnapshot = memberListSnapshot.get(); if (clusterViewSnapshot == EMPTY_SNAPSHOT) { synchronized (clusterViewLock) { clusterViewSnapshot = memberListSnapshot.get(); if (clusterViewSnapshot == EMPTY_SNAPSHOT) { applyInitialState(memberListVersion, memberInfos); initialListFetchedLatch.countDown(); return; } } } List<MembershipEvent> events = emptyList(); if (memberListVersion >= clusterViewSnapshot.version) { synchronized (clusterViewLock) { clusterViewSnapshot = memberListSnapshot.get(); if (memberListVersion >= clusterViewSnapshot.version) { Collection<Member> prevMembers = clusterViewSnapshot.members.values(); MemberListSnapshot snapshot = createSnapshot(memberListVersion, memberInfos); memberListSnapshot.set(snapshot); Set<Member> currentMembers = toUnmodifiableHasSet(snapshot.members.values()); events = detectMembershipEvents(prevMembers, currentMembers); } } } fireEvents(events); }
Source:
<code>public void changeDifferentFieldOneAfterAnother() { Realm realm = looperThread.realm; AllTypes allTypes = realm.where(AllTypes.class).findFirst(); final AtomicBoolean stringChanged = new AtomicBoolean(false); final AtomicBoolean longChanged = new AtomicBoolean(false); final AtomicBoolean floatChanged = new AtomicBoolean(false); allTypes.addChangeListener(new RealmObjectChangeListener<RealmModel>() { @Override public void onChange(RealmModel object, ObjectChangeSet changeSet) { assertEquals(1, changeSet.getChangedFields().length); if (changeSet.isFieldChanged(AllTypes.FIELD_STRING)) { assertFalse(stringChanged.get()); stringChanged.set(true); } else if (changeSet.isFieldChanged(AllTypes.FIELD_LONG)) { assertFalse(longChanged.get()); longChanged.set(true); } else if (changeSet.isFieldChanged(AllTypes.FIELD_FLOAT)) { assertFalse(floatChanged.get()); floatChanged.set(true); <START> looperThread.testComplete(); <END> } else { fail(); } } }); realm.beginTransaction(); allTypes.setColumnString("42"); realm.commitTransaction(); realm.beginTransaction(); allTypes.setColumnLong(42); realm.commitTransaction(); realm.beginTransaction(); allTypes.setColumnFloat(42.0f); realm.commitTransaction(); }</code><technical_language>check if longChanged stringChanged is true</technical_language>

Target:
public void changeDifferentFieldOneAfterAnother() { Realm realm = looperThread.realm; AllTypes allTypes = realm.where(AllTypes.class).findFirst(); final AtomicBoolean stringChanged = new AtomicBoolean(false); final AtomicBoolean longChanged = new AtomicBoolean(false); final AtomicBoolean floatChanged = new AtomicBoolean(false); allTypes.addChangeListener(new RealmObjectChangeListener<RealmModel>() { @Override public void onChange(RealmModel object, ObjectChangeSet changeSet) { assertEquals(1, changeSet.getChangedFields().length); if (changeSet.isFieldChanged(AllTypes.FIELD_STRING)) { assertFalse(stringChanged.get()); stringChanged.set(true); } else if (changeSet.isFieldChanged(AllTypes.FIELD_LONG)) { assertFalse(longChanged.get()); longChanged.set(true); } else if (changeSet.isFieldChanged(AllTypes.FIELD_FLOAT)) { assertTrue(stringChanged.get()); assertTrue(longChanged.get()); assertFalse(floatChanged.get()); floatChanged.set(true); looperThread.testComplete(); } else { fail(); } } }); realm.beginTransaction(); allTypes.setColumnString("42"); realm.commitTransaction(); realm.beginTransaction(); allTypes.setColumnLong(42); realm.commitTransaction(); realm.beginTransaction(); allTypes.setColumnFloat(42.0f); realm.commitTransaction(); }
Source:
<code>public void writeExternal(PofWriter pofWriter) throws IOException { pofWriter.writeInt(0, index); <START> pofWriter.writeObject(1, asc); <END> }</code><technical_language>I guess writing object reading int work well... moreover: <LINK_0>,%20boolean)</technical_language>

Target:
public void writeExternal(PofWriter pofWriter) throws IOException { pofWriter.writeInt(0, index); pofWriter.writeBoolean(1, asc); }
Source:
<code>public static void run( Map<String, Object> params, OutputStream out ) throws Exception { CallParameters parameters = new CallParameters(); for ( String key : params.keySet() ) { String value = params.get( key ).toString(); parameters.put( key, value ); } IPluginCall pluginCall = getPluginCall(); String response = pluginCall != null <START> ? pluginCall.call( parameters.getParameters() ) <END> : "No valid InterPluginCall available"; PluginIOUtils.writeOutAndFlush( out, response ); }</code><technical_language>a log InterPluginCall is valid return. I sending error message is for this case</technical_language>

Target:
public static void run( Map<String, Object> params, OutputStream out ) throws Exception { IPluginCall cdeRenderer = getCdeRenderer(); if ( cdeRenderer == null ) { logger.error( "No InterPluginCall found for CDE Renderer." ); return; } CallParameters parameters = new CallParameters(); for ( String key : params.keySet() ) { String value = params.get( key ).toString(); parameters.put( key, value ); } String response = cdeRenderer.call( parameters.getParameters() ); PluginIOUtils.writeOutAndFlush( out, response ); }
Source:
<code>public Tuple2<List<T>, List<T>> splitAt(Predicate<? super T> predicate) { <START> Tuple2<List<T>, List<T>> t = splitByPredicateFirstRound(this, predicate); <END> return Tuple.of(t._1.reverse(), t._2); }</code><technical_language>If possible, generally please values final. is of main rules achieve functional programs</technical_language>

Target:
public Tuple2<List<T>, List<T>> splitAt(Predicate<? super T> predicate) { final Tuple2<List<T>, List<T>> t = splitByPredicateReversed(this, predicate); if (t._2.isEmpty()) { return Tuple.of(this, empty()); } else { return Tuple.of(t._1.reverse(), t._2); } }
Source:
<code>public DockerCheApiInternalEnvVarProvider( @Named("che.infra.docker.master_api_endpoint") String apiEndpoint) { <START> String apiEndpointEnvVar = System.getenv(CHE_API_INTERNAL_VARIABLE); <END> if (Strings.isNullOrEmpty(apiEndpoint) && !Strings.isNullOrEmpty(apiEndpointEnvVar)) { apiEndpoint = apiEndpointEnvVar; } apiEnvVar = Pair.of(CHE_API_INTERNAL_VARIABLE, apiEndpoint); }</code><technical_language>I removed. If a user wants customize this is able CHE_INFRA_DOCKER_MASTER__API__ENDPOINT environment variable</technical_language>

Target:
public DockerCheApiInternalEnvVarProvider( @Named("che.infra.docker.master_api_endpoint") String apiEndpoint) { String apiEndpointEnvVar = System.getenv(CHE_API_VARIABLE); if (Strings.isNullOrEmpty(apiEndpoint) && !Strings.isNullOrEmpty(apiEndpointEnvVar)) { apiEndpoint = apiEndpointEnvVar; } apiEnvVar = Pair.of(CHE_API_INTERNAL_VARIABLE, apiEndpoint); }
Source:
<code>private ScanResult getScanResultFromInputStream(InvocationOnMock invocation) { InputStream scannedInputStream = invocation.getArgument(0); String scannedContents; try { scannedContents = IOUtils.toString(scannedInputStream); } catch (IOException e) { throw new RuntimeException(e); } ScanResult result = Mockito.mock(ScanResult.class); if (StringUtils.equals(scannedContents, GOOD_FILE_CONTENTS)) { Mockito.when(result.getStatus()).thenReturn(ScanResult.Status.PASSED); } else { Mockito.when(result.getStatus()).thenReturn(ScanResult.Status.FAILED); <START> } <END> return result; }</code><technical_language>Scan results ERROR status. worth testing in this test class well</technical_language>

Target:
private ScanResult getScanResultFromInputStream(InvocationOnMock invocation) { InputStream scannedInputStream = invocation.getArgument(0); String scannedContents; try { scannedContents = IOUtils.toString(scannedInputStream); } catch (IOException e) { throw new RuntimeException(e); } ScanResult result = Mockito.mock(ScanResult.class); if (StringUtils.equals(scannedContents, GOOD_FILE_CONTENTS)) { Mockito.when(result.getStatus()).thenReturn(ScanResult.Status.PASSED); } else if (StringUtils.equals(scannedContents, VIRUS_FILE_CONTENTS)) { Mockito.when(result.getStatus()).thenReturn(ScanResult.Status.FAILED); } else { Mockito.when(result.getStatus()).thenReturn(ScanResult.Status.ERROR); } return result; }
Source:
<code>public List<Suggestion> getSuggestedNames(String queryString, int maxResults) throws GeoEntryQueryException { SolrQuery solrQuery = new SolrQuery(); solrQuery.setRequestHandler("/suggest"); solrQuery.setParam(SUGGEST_Q, ClientUtils.escapeQueryChars(queryString)); solrQuery.setParam(SUGGEST_DICT, SUGGEST_PLACE_KEY); solrQuery.setParam("suggest.count", Integer.toString(Math.min(maxResults, MAX_RESULTS))); QueryResponse response; try { response = client.query(solrQuery); } catch (SolrServerException | IOException e) { <START> LOGGER.debug("Something went wrong when querying", e); <END> throw new GeoEntryQueryException("Error while querying", e); } return Optional.ofNullable(response) .map(QueryResponse::getSuggesterResponse) .map(SuggesterResponse::getSuggestions) .map(suggestionsPerDict -> suggestionsPerDict.get(SUGGEST_PLACE_KEY)) .orElse(Collections.emptyList()) .stream() .map(suggestion -> new SuggestionImpl(suggestion.getPayload(), suggestion.getTerm())) .collect(Collectors.toList()); }</code><technical_language>log throw here</technical_language>

Target:
public List<Suggestion> getSuggestedNames(String queryString, int maxResults) throws GeoEntryQueryException { SolrQuery solrQuery = new SolrQuery(); solrQuery.setRequestHandler(GAZETTEER_REQUEST_HANDLER); solrQuery.setParam(SUGGEST_Q_KEY, ClientUtils.escapeQueryChars(queryString)); solrQuery.setParam(SUGGEST_DICT_KEY, SUGGEST_DICT); solrQuery.setParam(SUGGEST_COUNT_KEY, Integer.toString(Math.min(maxResults, MAX_RESULTS))); QueryResponse response; try { response = client.query(solrQuery); } catch (SolrServerException | IOException e) { throw new GeoEntryQueryException("Error while querying", e); } return Optional.ofNullable(response) .map(QueryResponse::getSuggesterResponse) .map(SuggesterResponse::getSuggestions) .map(suggestionsPerDict -> suggestionsPerDict.get(SUGGEST_DICT)) .orElse(Collections.emptyList()) .stream() .map(suggestion -> new SuggestionImpl(suggestion.getPayload(), suggestion.getTerm())) .collect(Collectors.toList()); }
Source:
<code>private static boolean isRequiredInterfaceDown(Map<String, Network> networksByName, List<VdsNetworkInterface> interfaces, VdsNetworkInterface iface) { if (iface.getNetworkName() != null && <START> !isBaseInterfaceUp(iface, interfaces) <END> && networksByName.containsKey(iface.getNetworkName())) { Network net = networksByName.get(iface.getNetworkName()); if (net.getCluster().getStatus() == NetworkStatus.OPERATIONAL && net.getCluster().isRequired()) { return true; } } return false; }</code><technical_language>change isBaseInterfaceUp->isBaseInterfaceDown, please update condition accordingly</technical_language>

Target:
private static boolean isRequiredInterfaceDown(Map<String, Network> networksByName, List<VdsNetworkInterface> interfaces, VdsNetworkInterface iface) { if (iface.getNetworkName() != null && isBaseInterfaceDown(iface, interfaces)) { Network net = networksByName.get(iface.getNetworkName()); if (net != null && net.getCluster().getStatus() == NetworkStatus.OPERATIONAL && net.getCluster().isRequired()) { return true; } } return false; }
Source:
<code>public void checkNavigateToFileFunctionWithFilesFromHiddenFolders() { projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.selectItem(PROJECT_NAME); menu.runCommand( TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); askDialog.acceptDialogWithText( "Do you want to initialize the local repository " + PROJECT_NAME + "?"); loader.waitOnClosed(); git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); menu.runCommand( TestMenuCommandsConstants.Assistant.ASSISTANT, TestMenuCommandsConstants.Assistant.NAVIGATE_TO_FILE); navigateToFile.waitFormToOpen(); loader.waitOnClosed(); navigateToFile.typeSymbolInFileNameField("H"); loader.waitOnClosed(); navigateToFile.waitFileNamePopUp(); <START> Assert.assertFalse(navigateToFile.waitListOfFilesNames(FILE_H_SYMBOL)); <END> navigateToFile.closeNavigateToFileForm(); navigateToFile.waitFormToClose(); }</code><technical_language>Please, static import get rid of Assert. simplify code</technical_language>

Target:
public void checkNavigateToFileFunctionWithFilesFromHiddenFolders() { projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(PROJECT_NAME); projectExplorer.selectItem(PROJECT_NAME); menu.runCommand( TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.INITIALIZE_REPOSITORY); askDialog.acceptDialogWithText( "Do you want to initialize the local repository " + PROJECT_NAME + "?"); loader.waitOnClosed(); git.waitGitStatusBarWithMess(TestGitConstants.GIT_INITIALIZED_SUCCESS); menu.runCommand( TestMenuCommandsConstants.Assistant.ASSISTANT, TestMenuCommandsConstants.Assistant.NAVIGATE_TO_FILE); navigateToFile.waitFormToOpen(); navigateToFile.typeSymbolInFileNameField("H"); loader.waitOnClosed(); navigateToFile.waitFileNamePopUp(); assertFalse(navigateToFile.isFilenameSuggested("HEAD (/NavigateFile/.git)")); navigateToFile.closeNavigateToFileForm(); navigateToFile.waitFormToClose(); }
Source:
<code>protected void now(IUser teleportee, ITarget target, TeleportCause cause) throws Exception { cancel(false); teleportee.setLastLocation(); Location loc = target.getLocation(); <START> UserTeleportEvent event = new UserTeleportEvent(teleportee, cause); <END> Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; } if (LocationUtil.isBlockUnsafeForUser(teleportee, loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) { if (ess.getSettings().isTeleportSafetyEnabled()) { if (ess.getSettings().isForceDisableTeleportSafety()) { PaperLib.teleportAsync(teleportee.getBase(), loc, cause); } else { PaperLib.teleportAsync(teleportee.getBase(), LocationUtil.getSafeDestination(ess, teleportee, loc), cause); } } else { throw new Exception(tl("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } } else { if (ess.getSettings().isForceDisableTeleportSafety()) { PaperLib.teleportAsync(teleportee.getBase(), loc, cause); } else { if (ess.getSettings().isTeleportToCenterLocation()) { loc = LocationUtil.getRoundedDestination(loc); } PaperLib.teleportAsync(teleportee.getBase(), loc, cause); } } }</code><technical_language>useful pass in location player is teleporting to. if event is cancelled, teleportee's location is overridden anyways</technical_language>

Target:
protected void now(IUser teleportee, ITarget target, TeleportCause cause) throws Exception { cancel(false); Location loc = target.getLocation(); UserTeleportEvent event = new UserTeleportEvent(teleportee, cause, loc); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return; } teleportee.setLastLocation(); if (LocationUtil.isBlockUnsafeForUser(teleportee, loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) { if (ess.getSettings().isTeleportSafetyEnabled()) { if (ess.getSettings().isForceDisableTeleportSafety()) { PaperLib.teleportAsync(teleportee.getBase(), loc, cause); } else { PaperLib.teleportAsync(teleportee.getBase(), LocationUtil.getSafeDestination(ess, teleportee, loc), cause); } } else { throw new Exception(tl("unsafeTeleportDestination", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } } else { if (ess.getSettings().isForceDisableTeleportSafety()) { PaperLib.teleportAsync(teleportee.getBase(), loc, cause); } else { if (ess.getSettings().isTeleportToCenterLocation()) { loc = LocationUtil.getRoundedDestination(loc); } PaperLib.teleportAsync(teleportee.getBase(), loc, cause); } } }
Source:
<code>private void setPropertiesFromModel(PomInformation pomInformation, Model model) { Properties propertiesFromModel = model.getProperties(); if (model.getVersion() != null) { <START> propertiesFromModel.put("project.version", model.getVersion()); <END> } pomInformation.setProperties(propertiesFromModel); }</code><technical_language>earlier question, I work for ${project.version} hardcoding it. I assuming other maven variables work however</technical_language>

Target:
private void setPropertiesFromModel(PomInformation pomInformation, Model model) { Properties propertiesFromModel = model.getProperties(); if (model.getVersion() != null) { propertiesFromModel.put("project.version", model.getVersion()); } if (model.getArtifactId() != null) { propertiesFromModel.put("project.artifactId", model.getArtifactId()); } if (model.getGroupId() != null) { propertiesFromModel.put("project.groupId", model.getGroupId()); } pomInformation.setProperties(propertiesFromModel); }
Source:
<code>protected void setupLabel(TextView label) { switch (mLoginListener.getLoginMode()) { case WPCOM_LOGIN_DEEPLINK: label.setText(R.string.login_log_in_for_deeplink); break; case FULL: label.setText(R.string.enter_email_wordpress_com); break; case JETPACK_STATS: label.setText(R.string.stats_sign_in_jetpack_different_com_account); break; case WPCOM_REAUTHENTICATE: label.setText(R.string.auth_required); break; } if (mLoginListener.getLoginMode() == LoginMode.JETPACK_STATS) { label.setText(R.string.stats_sign_in_jetpack_different_com_account); <START> } else if (mLoginListener.getLoginMode() == LoginMode.JETPACK_STATS) { <END> } else { label.setText(R.string.enter_email_wordpress_com); } }</code><technical_language>This else if statement body is empty condition is identical preceding if statement removed</technical_language>

Target:
protected void setupLabel(TextView label) { switch (mLoginListener.getLoginMode()) { case WPCOM_LOGIN_DEEPLINK: label.setText(R.string.login_log_in_for_deeplink); break; case FULL: label.setText(R.string.enter_email_wordpress_com); break; case JETPACK_STATS: label.setText(R.string.stats_sign_in_jetpack_different_com_account); break; case WPCOM_REAUTHENTICATE: label.setText(R.string.auth_required); break; } }
Source:
<code>public void itCanCreateTokens() throws Exception { MultivaluedMap<String, String> params = new MultivaluedMapImpl(); params.put("application", Collections.singletonList("app")); params.put("deviceId", Collections.singletonList("device")); params.put("permission", Collections.singletonList("rw")); ClientResponse response = getResponse(RequestType.POST, "/token", null, params, null, null); <START> assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); <END> String tokenId = response.getEntity(String.class); assertFalse(tokenId.isEmpty()); List<JsonNode> tokens = getTokens(); assertEquals(1, tokens.size()); JsonNode token = tokens.get(0); assertEquals("app", token.get("application").getTextValue()); assertEquals("device", token.get("deviceId").getTextValue()); assertEquals("rw", token.get("permission").getTextValue()); assertFalse(token.get("creationDate").getTextValue().isEmpty()); assertFalse(token.get("username").getTextValue().isEmpty()); response = getResponse(RequestType.POST, "/token"); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus()); }</code><technical_language>POST returns 201 creating a token (and 200 created token)</technical_language>

Target:
public void itCanCreateTokens() throws Exception { MultivaluedMap<String, String> params = new MultivaluedMapImpl(); params.put("application", Collections.singletonList("app")); params.put("deviceId", Collections.singletonList("device")); params.put("permission", Collections.singletonList("rw")); ClientResponse response = getResponse(RequestType.POST, "/token", null, params, null, null); assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); String tokenId = response.getEntity(String.class); assertFalse(tokenId.isEmpty()); List<JsonNode> tokens = getTokens(); assertEquals(1, tokens.size()); JsonNode token = tokens.get(0); assertEquals("app", token.get("application").getTextValue()); assertEquals("device", token.get("deviceId").getTextValue()); assertEquals("rw", token.get("permission").getTextValue()); assertFalse(token.get("creationDate").getTextValue().isEmpty()); assertFalse(token.get("username").getTextValue().isEmpty()); }
Source:
<code>private void removeProjectedGeometryGraphic() { if ((mMapView.getGraphicsOverlays().size() > 0) && (projectedGraphic != null)) { if (mMapView.getGraphicsOverlays().get(0).getGraphics().size() == 2) { mMapView.getGraphicsOverlays().get(0).getGraphics().remove(projectedGraphic); projectedGraphic = null; } } <START> return; <END> }</code><technical_language>Unnecessary return</technical_language>

Target:
private void removeProjectedGeometryGraphic() { if ((mMapView.getGraphicsOverlays().size() > 0) && (mProjectedGraphic != null)) { if (mMapView.getGraphicsOverlays().get(0).getGraphics().size() == 2) { mMapView.getGraphicsOverlays().get(0).getGraphics().remove(mProjectedGraphic); mProjectedGraphic = null; } } }