auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void testSerialiseRepeatableGroupForm() throws IOException { Survey form1 = new Survey(); form1.setKey(KeyFactory.createKey("Survey", 17L)); form1.setName("This is a form"); form1.setVersion(12.0); QuestionGroup qg = new QuestionGroup(); <START> qg.setKey(KeyFactory.createKey("Survey", 18L)); <END> qg.setSurveyId(17L); qg.setName("This is a group"); qg.setOrder(1); qg.setRepeatable(true); TreeMap<Integer, QuestionGroup> gm = new TreeMap<>(); gm.put(1, qg); form1.setQuestionGroupMap(gm); TreeMap<Integer, Question> qm = new TreeMap<>(); qg.setQuestionMap(qm); int questionCount = qm.size(); SurveyGroup survey = new SurveyGroup(); survey.setCode("Name of containing survey"); survey.setKey(KeyFactory.createKey("SurveyGroup", 123L)); form1.setSurveyGroupId(survey.getKey().getId()); XmlForm form = new XmlForm(form1, survey); assertNotEquals(null, form); assertNotEquals(null, form.getQuestionGroup()); XmlQuestionGroup xqg = form.getQuestionGroup().get(0); assertNotEquals(null, xqg); assertNotEquals(null, xqg.getQuestion()); assertEquals(questionCount, xqg.getQuestion().size()); assertTrue(xqg.getRepeatable()); String xml = PublishedForm.generate(form); assertEquals(EXPECTED_REPEATABLE_XML, xml); SurveyDto dto = PublishedForm.parse(xml, true).toDto(); assertNotEquals(null, dto); assertEquals(17L, dto.getKeyId()); assertEquals("This is a form", dto.getName()); assertEquals("12.0", dto.getVersion()); assertEquals("This is a form", dto.getName()); }</code><technical_language>suggestion qg.setKey(KeyFactory.createKey("QuestionGroup", 18L));</technical_language>

Target:
void testSerialiseRepeatableGroupForm() throws IOException { Survey form1 = new Survey(); form1.setKey(KeyFactory.createKey("Survey", 17L)); form1.setName("This is a form"); form1.setVersion(12.0); QuestionGroup qg = new QuestionGroup(); qg.setKey(KeyFactory.createKey("QuestionGroup", 18L)); qg.setSurveyId(17L); qg.setName("This is a group"); qg.setOrder(1); qg.setRepeatable(true); TreeMap<Integer, QuestionGroup> gm = new TreeMap<>(); gm.put(1, qg); form1.setQuestionGroupMap(gm); TreeMap<Integer, Question> qm = new TreeMap<>(); qg.setQuestionMap(qm); int questionCount = qm.size(); SurveyGroup survey = new SurveyGroup(); survey.setCode("Name of containing survey"); survey.setKey(KeyFactory.createKey("SurveyGroup", 123L)); form1.setSurveyGroupId(survey.getKey().getId()); XmlForm form = new XmlForm(form1, survey); assertNotEquals(null, form); assertNotEquals(null, form.getQuestionGroup()); XmlQuestionGroup xqg = form.getQuestionGroup().get(0); assertNotEquals(null, xqg); assertNotEquals(null, xqg.getQuestion()); assertEquals(questionCount, xqg.getQuestion().size()); assertTrue(xqg.getRepeatable()); String xml = PublishedForm.generate(form); assertEquals(EXPECTED_REPEATABLE_XML, xml); SurveyDto dto = PublishedForm.parse(xml, true).toDto(); assertNotEquals(null, dto); assertEquals(17L, dto.getKeyId()); assertEquals("This is a form", dto.getName()); assertEquals("12.0", dto.getVersion()); assertEquals("This is a form", dto.getName()); }
Source:
<code>public static boolean[] hexDigitToBinary(final char hexDigit) { switch (hexDigit) { case '0': return FFFF.clone(); case '1': return TFFF.clone(); case '2': return FTFF.clone(); case '3': return TTFF.clone(); case '4': return FFTF.clone(); case '5': return TFTF.clone(); case '6': return FTTF.clone(); case '7': return TTTF.clone(); case '8': return FFFT.clone(); case '9': return TFFT.clone(); case 'a':// fall through case 'A': return FTFT.clone(); case 'b':// fall through case 'B': return TTFT.clone(); case 'c':// fall through case 'C': return FFTT.clone(); case 'd':// fall through case 'D': return TFTT.clone(); case 'e':// fall through case 'E': return FTTT.clone(); case 'f':// fall through case 'F': return TTTT.clone(); default: <START> throw IllegalArgumentExceptions.format("Cannot interpret '%s' as a hexadecimal digit", hexDigit); <END> } }</code><technical_language>%d</technical_language>

Target:
public static boolean[] hexDigitToBinary(final char hexDigit) { switch (hexDigit) { case '0': return FFFF.clone(); case '1': return TFFF.clone(); case '2': return FTFF.clone(); case '3': return TTFF.clone(); case '4': return FFTF.clone(); case '5': return TFTF.clone(); case '6': return FTTF.clone(); case '7': return TTTF.clone(); case '8': return FFFT.clone(); case '9': return TFFT.clone(); case 'a':// fall through case 'A': return FTFT.clone(); case 'b':// fall through case 'B': return TTFT.clone(); case 'c':// fall through case 'C': return FFTT.clone(); case 'd':// fall through case 'D': return TFTT.clone(); case 'e':// fall through case 'E': return FTTT.clone(); case 'f':// fall through case 'F': return TTTT.clone(); default: throw IllegalArgumentExceptions.format("Cannot interpret '%d' as a hexadecimal digit", hexDigit); } }
Source:
<code>public void testStart() { Date date1 = new Date(2000, 01, 01); Date date2 = new Date(1995, 01, 01); ExpenseClaim claim1 = new ExpenseClaim(null, null, date1, null, null); ExpenseClaim claim2 = new ExpenseClaim(null, null, date2, null, null); ListModel<ExpenseClaim> listmodel = new ListModel<ExpenseClaim>("claims.dat", getContext()); listmodel.add(claim1); listmodel.add(claim2); List<ExpenseClaim> claims = listmodel.getItems(); Intent data = getStartDateAscendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); <START> assertNotNull(data); <END> assertEquals(claims.get(0), claim1); data = getStartDateDescendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertEquals(claims.get(1).getStartDate(),claim2.getStartDate()); data = getCreationDateDescendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); data = getCreationDateAscendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); }</code><technical_language>This check result of data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT) is null, data (since is clear data null)</technical_language>

Target:
public void testStart() throws InterruptedException { Date date1 = new Date(2000, 01, 01); Date date2 = new Date(1995, 01, 01); ExpenseClaim claim1 = new ExpenseClaim(null, null, date1, null, null, null); Thread.sleep(2000); ExpenseClaim claim2 = new ExpenseClaim(null, null, date2, null, null, null); ListModel<ExpenseClaim> listmodel = new ListModel<ExpenseClaim>("claims_test.dat", getContext()); listmodel.removeAll(); listmodel.add(claim1); listmodel.add(claim2); List<ExpenseClaim> claims = listmodel.getItems(); Intent data = getStartDateAscendingIntent(); Comparator<ExpenseClaim> comparator = (Comparator<ExpenseClaim>)data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT); listmodel.setComparator(comparator); assertNotNull(comparator); assertEquals(claims.get(0),claim2); data = getStartDateDescendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertEquals(claims.get(0),claim1); data = getCreationDateDescendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertEquals(claims.get(0),claim2); data = getCreationDateAscendingIntent(); listmodel.setComparator((Comparator<ExpenseClaim>) data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT)); assertEquals(claims.get(0),claim1); }
Source:
<code><START> public String getReleaseStage() { <END> try { int appFlags = appContext.getPackageManager().getApplicationInfo(packageName, 0).flags; if((appFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { return "development"; } } catch (PackageManager.NameNotFoundException e) { Logger.warn("Could not get releaseStage"); } return "production"; }</code><technical_language>this return config.releaseStage if isnt null? feels weird for code in Diagnostics</technical_language>

Target:
public String getReleaseStage() { if(config.releaseStage != null) { return config.releaseStage; } else { return guessedReleaseStage; } }
Source:
<code><START> private InputStream getResource(String resource) throws IOException { <END> File resourceFile = new File(resource); if (resourceFile.exists() && !resourceFile.isFile()) { throw new IOException(String.format("%s is not a file. ", resourceFile.getAbsolutePath())); } InputStream is = resourceFile.exists() ? new FileInputStream(resourceFile) : Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); if (is == null) { throw new IOException(String.format("Not found resource: %s", resource)); } return is; }</code><technical_language>Consider this class <LINK_0> instead of this method</technical_language>

Target:
private InputStream getResource(String resource) throws IOException { File resourceFile = new File(resource); if (resourceFile.exists() && !resourceFile.isFile()) { throw new IOException(String.format("%s is not a file. ", resourceFile.getAbsolutePath())); } InputStream is = resourceFile.exists() ? new FileInputStream(resourceFile) : Resources.getResource(resource).openStream(); if (is == null) { throw new IOException(String.format("Not found resource: %s", resource)); } return is; }
Source:
<code>public void onPromoteComplete( @Observes final PromoteCompleteEvent event ) { if ( !eventAuditConfig.isEnabled() ) { return; } <START> FileGroupingEvent fileGroupingEvent = new FileGroupingEvent( FileGroupingEventType.BY_PATH_PROMOTION ); <END> transformFileGroupingEvent( event, fileGroupingEvent ); eventPublisher.publishFileGroupingEvent( fileGroupingEvent ); }</code><technical_language>if this is a by-group promotion, means group membership altered content copied / moved? need a condition skip publishing event in case</technical_language>

Target:
public void onPromoteComplete( @Observes final PromoteCompleteEvent event ) { if ( !eventAuditConfig.isEnabled() ) { return; } if ( event instanceof PathsPromoteCompleteEvent ) { FileGroupingEvent fileGroupingEvent = new FileGroupingEvent( FileGroupingEventType.BY_PATH_PROMOTION ); transformFileGroupingEvent( event, fileGroupingEvent ); eventPublisher.publishFileGroupingEvent( fileGroupingEvent ); } else { logger.trace( "Unsupported grouping event: {}", event.getClass() ); return; } }
Source:
<code>protected ChronicleLogAppender(File basePath, int size, String retentionDuration) { if (size == 0) { if (!exists(basePath)) { String msg = "Cannot open Chronicle Queues, invalid path: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } this.nbQueues = findNbQueues(basePath); } else { if (exists(basePath)) { String msg = "Cannot create Chronicle Queues, already exists: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } if (!basePath.exists() && !basePath.mkdirs()) { String msg = "Cannot create Chronicle Queues in: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } this.nbQueues = size; } this.name = basePath.getName(); this.basePath = basePath; if (retentionDuration != null) { retentionNbCycles = Integer.valueOf(retentionDuration.substring(0, retentionDuration.length() - 1)); } RollCycle rollCycle = getRollCycle(retentionDuration); queues = new ArrayList<>(this.nbQueues); <START> log.debug(String.format("%s chronicle queue: %s, path: %s, size: %d", <END> (size == 0) ? "Opening" : "Creating", name, basePath, nbQueues)); for (int i = 0; i < nbQueues; i++) { File path = new File(basePath, String.format("%s%02d", QUEUE_PREFIX, i)); ChronicleQueue queue = SingleChronicleQueueBuilder.binary(path) .rollCycle(rollCycle) .storeFileListener(this) .build(); queues.add(queue); if (!queue.file().exists() && !queue.file().mkdirs()) { log.error("Fail to create directory: " + queue.file().getAbsolutePath()); } } }</code><technical_language>isDebugEnabled</technical_language>

Target:
protected ChronicleLogAppender(File basePath, int size, String retentionDuration) { if (size == 0) { if (!exists(basePath)) { String msg = "Cannot open Chronicle Queues, invalid path: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } this.nbQueues = findNbQueues(basePath); } else { if (exists(basePath)) { String msg = "Cannot create Chronicle Queues, already exists: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } if (!basePath.exists() && !basePath.mkdirs()) { String msg = "Cannot create Chronicle Queues in: " + basePath; log.error(msg); throw new IllegalArgumentException(msg); } this.nbQueues = size; } this.name = basePath.getName(); this.basePath = basePath; if (retentionDuration != null) { retentionNbCycles = Integer.parseInt(retentionDuration.substring(0, retentionDuration.length() - 1)); } RollCycle rollCycle = getRollCycle(retentionDuration); queues = new ArrayList<>(this.nbQueues); if (log.isDebugEnabled()) { log.debug(String.format("%s chronicle queue: %s, path: %s, size: %d", (size == 0) ? "Opening" : "Creating", name, basePath, nbQueues)); } for (int i = 0; i < nbQueues; i++) { File path = new File(basePath, String.format("%s%02d", QUEUE_PREFIX, i)); ChronicleQueue queue = SingleChronicleQueueBuilder.binary(path) .rollCycle(rollCycle) .storeFileListener(this) .build(); queues.add(queue); try { Files.createDirectories(queue.file().toPath()); } catch (IOException e) { throw new IllegalArgumentException("Cannot create directory: " + queue.file().getAbsolutePath(), e); } } }
Source:
<code>private Optional<WindowPane<K, Object>> onTriggerFired( TriggerKey<K> triggerKey, MessageCollector collector, TaskCoordinator coordinator) { LOG.trace("Trigger key fired." , triggerKey); TriggerImplHandler wrapper = triggers.get(triggerKey); <START> WindowKey<K> windowKey = triggerKey.getKey(); <END> long timestamp = Long.parseLong(windowKey.getPaneId()); List<Object> existingState = getValues(windowKey); if (existingState == null || existingState.size() == 0) { LOG.trace("No state found for triggerKey: {}", triggerKey); return Optional.empty(); } Object windowVal = window.getFoldLeftFunction() == null ? existingState : existingState.get(0); WindowPane<K, Object> paneOutput = computePaneOutput(triggerKey, windowVal); if (window.getAccumulationMode() == AccumulationMode.DISCARDING) { LOG.trace("Clearing state for trigger key: {}", triggerKey); timeSeriesDb.remove(windowKey.getKey(), timestamp); } if (triggerKey.getType() == FiringType.DEFAULT) { LOG.trace("Default trigger fired. Canceling triggers for {}", triggerKey); cancelTrigger(triggerKey, true); cancelTrigger(new TriggerKey(FiringType.EARLY, triggerKey.getKey()), true); timeSeriesDb.remove(windowKey.getKey(), timestamp); } if (triggerKey.getType() == FiringType.EARLY && !wrapper.isRepeating()) { cancelTrigger(triggerKey, false); } return Optional.of(paneOutput); }</code><technical_language>This WindowKey class usage is pretty confusing. care emit pane (i.e. in computePaneOutput). Also, a TimestampedValue (where == key) in implementation. refactor do that</technical_language>

Target:
private Optional<WindowPane<K, Object>> onTriggerFired(TriggerKey<K> triggerKey, MessageCollector collector, TaskCoordinator coordinator) { LOG.trace("Trigger key fired." , triggerKey); TriggerImplHandler wrapper = triggers.get(triggerKey); long timestamp = triggerKey.getTimestamp(); K key = triggerKey.getKey(); List<Object> existingState = getValues(key, timestamp); if (existingState == null || existingState.size() == 0) { LOG.trace("No state found for triggerKey: {}", triggerKey); return Optional.empty(); } Object windowVal = window.getFoldLeftFunction() == null ? existingState : existingState.get(0); WindowPane<K, Object> paneOutput = computePaneOutput(triggerKey, windowVal); if (window.getAccumulationMode() == AccumulationMode.DISCARDING) { LOG.trace("Clearing state for trigger key: {}", triggerKey); timeSeriesStore.remove(key, timestamp); } if (triggerKey.getType() == FiringType.DEFAULT) { LOG.trace("Default trigger fired. Canceling triggers for {}", triggerKey); cancelTrigger(triggerKey, true); cancelTrigger(new TriggerKey(FiringType.EARLY, triggerKey.getKey(), triggerKey.getTimestamp()), true); timeSeriesStore.remove(key, timestamp); } if (triggerKey.getType() == FiringType.EARLY && !wrapper.isRepeating()) { cancelTrigger(triggerKey, false); } return Optional.of(paneOutput); }
Source:
<code>private void initCreateTxt() { createTxt = new NpTextBox(); createTxt.setVisibleLength(50); createTxt.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { <START> doCreateProject(); <END> } } }); createTxt.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { createButton.setEnabled(!createTxt.getText().trim().isEmpty()); } }); }</code><technical_language>doCreateProject() called if !createTxt.getText().trim().isEmpty() if createButton.isEnabled()? empty project name results error, I nice try project creation if project name specified</technical_language>

Target:
private void initCreateTxt() { createTxt = new NpTextBox(); createTxt.setVisibleLength(50); createTxt.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (!createTxt.getText().trim().isEmpty() && event.getCharCode() == KeyCodes.KEY_ENTER) { doCreateProject(); } } }); createTxt.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { createButton.setEnabled(!createTxt.getText().trim().isEmpty()); } }); }
Source:
<code>public static void main(String[] args) throws Exception { printHello(); Parameters param = getParameters(args); if (param.isStream()) { StatusListener listener = new StatusListener() { @Override public void onException(Exception e) { } @Override public void onStatus(Status status) { printStatus(status, param.isHideRetwitts()); try { sleep(PAUSE); } catch (InterruptedException e) { System.out.println(e.getMessage()); } } @Override public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) { } @Override public void onTrackLimitationNotice(int i) { } @Override public void onScrubGeo(long l, long l1) { } @Override public void onStallWarning(StallWarning stallWarning) { } }; try { stream(param, listener); } catch (TwitterException e) { System.out.println(e.getMessage()); stream(param, listener); } catch (Exception e) { <START> System.out.println(e.getMessage()); <END> System.exit(-1); } } else { try { search(param); } catch (TwitterException e) { System.out.println(e.getMessage()); search(param); } catch (Exception e) { System.out.println(e.getMessage()); System.exit(-1); } } }</code><technical_language>System.err</technical_language>

Target:
public static void main(String[] args) throws Exception { printHello(); Parameters param = getParameters(args); if (param.isStream()) { StatusListener listener = new StatusListener() { @Override public void onException(Exception e) { } @Override public void onStatus(Status status) { printStatus(status, param.isHideRetwitts()); try { sleep(PAUSE); } catch (InterruptedException e) { System.out.println(e.getMessage()); } } @Override public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) { } @Override public void onTrackLimitationNotice(int i) { } @Override public void onScrubGeo(long l, long l1) { } @Override public void onStallWarning(StallWarning stallWarning) { } }; try { stream(param, listener); } catch (TwitterException e) { System.err.println(e.getMessage()); stream(param, listener); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(-1); } } else { try { search(param); } catch (TwitterException e) { System.err.println(e.getMessage()); search(param); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(-1); } } }
Source:
<code>protected boolean delete(XWikiContext context) throws XWikiException { XWiki xwiki = context.getWiki(); XWikiRequest request = context.getRequest(); XWikiResponse response = context.getResponse(); XWikiDocument doc = context.getDoc(); String sindex = request.getParameter(RECYCLED_DOCUMENT_ID_PARAM); String emptyBin = request.getParameter(EMPTY_RECYCLE_BIN); String skipRecycleBinParam = request.getParameter(SKIP_RECYCLE_BIN_PARAM); boolean skipRecycleBin; if (skipRecycleBinParam == null) { skipRecycleBin = false; } else { <START> skipRecycleBin = Boolean.parseBoolean(skipRecycleBinParam); <END> } if ("true".equals(emptyBin)) { return deleteAllFromRecycleBin(context); } else if (sindex != null && xwiki.hasRecycleBin(context)) { deleteFromRecycleBin(Long.parseLong(sindex), context); return true; } else if (doc.isNew()) { sendRedirect(response, Utils.getRedirect("view", context)); return true; } else { return deleteToRecycleBin(context, skipRecycleBin); } }</code><technical_language>Boolean.parseBoolean(null) returning false</technical_language>

Target:
protected boolean delete(XWikiContext context) throws XWikiException { XWiki xwiki = context.getWiki(); XWikiRequest request = context.getRequest(); XWikiResponse response = context.getResponse(); XWikiDocument doc = context.getDoc(); String sindex = request.getParameter(RECYCLED_DOCUMENT_ID_PARAM); String emptyBin = request.getParameter(EMPTY_RECYCLE_BIN); if ("true".equals(emptyBin)) { return deleteAllFromRecycleBin(context); } else if (sindex != null && xwiki.hasRecycleBin(context)) { deleteFromRecycleBin(Long.parseLong(sindex), context); return true; } else if (doc.isNew()) { sendRedirect(response, Utils.getRedirect("view", context)); return true; } else { boolean skipRecycleBin = Boolean.parseBoolean(request.getParameter(SKIP_RECYCLE_BIN_PARAM)); return deleteToRecycleBin(context, skipRecycleBin); } }
Source:
<code><START> public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options) { <END> return queryDatabasesInternal(new SqlQuerySpec(query), options); }</code><technical_language>Cosmos changes</technical_language>

Target:
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options) { if (options == null) { options = new CosmosQueryRequestOptions(); } return queryDatabasesInternal(new SqlQuerySpec(query), options); }
Source:
<code>private void resolveBundles0(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) { if (developmentMode) Arrays.sort(bundles); Collection<String> processedFragments = new HashSet<>(bundles.length); for (ResolverBundle bundle : bundles) { attachFragment(bundle, processedFragments); } List<ResolverBundle> cycle = new ArrayList<>(1); for (ResolverBundle bundle : bundles) { if (DEBUG) { ResolverImpl.log("** RESOLVING " + bundle + " **"); } cycle.clear(); resolveBundle(bundle, cycle); checkCycle(cycle); } if (unresolvedBundles.size() > 0) { ResolverBundle[] unresolved = unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]); for (ResolverBundle <START> unresolved1 : <END> unresolved) { resolveFragment(unresolved1); } } checkUsesConstraints(bundles, platformProperties); checkComposites(bundles, platformProperties); }</code><technical_language>rename toResolve</technical_language>

Target:
private void resolveBundles0(ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) { if (developmentMode) Arrays.sort(bundles); Collection<String> processedFragments = new HashSet<>(bundles.length); for (ResolverBundle bundle : bundles) { attachFragment(bundle, processedFragments); } List<ResolverBundle> cycle = new ArrayList<>(1); for (ResolverBundle bundle : bundles) { if (DEBUG) { ResolverImpl.log("** RESOLVING " + bundle + " **"); } cycle.clear(); resolveBundle(bundle, cycle); checkCycle(cycle); } if (unresolvedBundles.size() > 0) { ResolverBundle[] unresolved = unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]); for (ResolverBundle toResolve : unresolved) { resolveFragment(toResolve); } } checkUsesConstraints(bundles, platformProperties); checkComposites(bundles, platformProperties); }
Source:
<code>public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); Map<String, String> parameters = getSuite().getParameters(); for (Map.Entry<String, String> parameter : parameters.entrySet()) { result.put(parameter.getKey(), parameter.getValue()); } <START> for (Map.Entry<String, String> entry : m_parameters.entrySet()) { <END> result.put(entry.getKey(), entry.getValue()); } return result; }</code><technical_language>Replacing 2 loops java result.putAll(getSuite().getParameters()); result.putAll(m_parameters); a approach for me</technical_language>

Target:
public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); result.putAll(getSuite().getParameters()); result.putAll(m_parameters); return result; }
Source:
<code>protected synchronized void stopExecutionHereButKeepTheServerRunning() { Instant start = Instant.now(); while (!Thread.currentThread().isInterrupted()) { try { Instant end = Instant.now(); Duration timeElapsed = Duration.between(start, end); System.out.println(String.format("Server listening for %d minutes on port %d", timeElapsed.toMinutes(), getPort())); <START> wait(60000); <END> } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } }</code><technical_language>Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MINUTES) skip try/catch</technical_language>

Target:
protected synchronized void stopExecutionHereButKeepTheServerRunning() { Instant start = Instant.now(); while (true) { Duration timeElapsed = Duration.between(start, Instant.now()); System.out.println(String.format("Server listening for %d minutes on port %d", timeElapsed.toMinutes(), getPort())); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MINUTES); } }
Source:
<code>private GroupByVisitor buildVisitor(String aggregateAttribute, String aggregateVisitor, String[] groupByAttributes) { GroupByVisitorBuilder visitorBuilder = new GroupByVisitorBuilder() .withAggregateAttribute(aggregateAttribute, buildingType) .withAggregateVisitor(aggregateVisitor); for (String groupByAttribute : groupByAttributes) { visitorBuilder.withGroupByAttribute(groupByAttribute, buildingType); } GroupByVisitor visitor = visitorBuilder.build(); <START> return visitor; <END> }</code><technical_language>visitor variable is need simply be: return visitorBuilder.build();</technical_language>

Target:
private GroupByVisitor buildVisitor(String aggregateAttribute, String aggregateVisitor, String[] groupByAttributes) { GroupByVisitorBuilder visitorBuilder = new GroupByVisitorBuilder() .withAggregateAttribute(aggregateAttribute, buildingType) .withAggregateVisitor(aggregateVisitor); for (String groupByAttribute : groupByAttributes) { visitorBuilder.withGroupByAttribute(groupByAttribute, buildingType); } return visitorBuilder.build(); }
Source:
<code><START> Timeframe getTimeframe() { return this.timeframe; } <END></code><technical_language>Suggestion: public? final harm in exposing them. (FWIW I do generally err side of exposing publicly, in this specific case I OK.)</technical_language>

Target:
public Timeframe getTimeframe() { return this.timeframe; }
Source:
<code><START> private synchronized void loadFrom(final File store) { <END> if (store.length() != 0L) { try ( final RandomAccessFile file = new RandomAccessFile(store, "r"); final FileChannel channel = file.getChannel(); final FileLock lock = channel.lock(0L, Long.MAX_VALUE, true); final ObjectInputStream deserialize = new ObjectInputStream(new FileInputStream(store)) ) { this.index.clear(); this.index.putAll((Map<URI, String>) deserialize.readObject()); } catch (final IOException | ClassNotFoundException ex) { throw new IllegalStateException(ex); } } }</code><technical_language>@leonard84 FileBackedIndex thread safe need declare synchronized **every public method access (read write) object state** (index storage) fields. Otherwise, access state fields thread 1 visible thread 2. 2 operations (such this.index.put this.save()) atomic observed other thread. Huge source of races :(</technical_language>

Target:
private void loadFrom(final File store) { if (store.length() != 0L) { try ( final RandomAccessFile file = new RandomAccessFile(store, "r"); final FileChannel channel = file.getChannel(); final FileLock lock = channel.lock(0L, Long.MAX_VALUE, true); final ObjectInputStream deserialize = new ObjectInputStream(new FileInputStream(store)) ) { this.index.clear(); this.index.putAll((Map<URI, String>) deserialize.readObject()); } catch (final IOException | ClassNotFoundException ex) { throw new IllegalStateException(ex); } } }
Source:
<code>private double getAccrued(DayCount dayCount, Calendar calendar, ZonedDateTime valuationDate, AnnuityDefinition<? extends CouponDefinition> annuity, ZonedDateTimeDoubleTimeSeries indexTimeSeries) { double res = 0.0; CouponDefinition[] payments = annuity.getPayments(); for (CouponDefinition payment : payments) { <START> if (payment.getAccrualStartDate().isBefore(valuationDate) && !payment.getPaymentDate().isBefore(valuationDate)) { <END> double rate; if (payment instanceof CouponIborDefinition) { CouponIborDefinition casted = (CouponIborDefinition) payment; CouponFixed coupon = (CouponFixed) casted.toDerivative(valuationDate, indexTimeSeries); rate = coupon.getFixedRate(); } else if (payment instanceof CouponFixedDefinition) { rate = 1.0; } else { throw new IllegalArgumentException("This annuity type is not supported"); } res += getAccrued(dayCount, calendar, valuationDate, payment) * rate; } } return res; }</code><technical_language>comparison done LocalDate ZonedDateTime, avoid jumps day. Also, doc, payment valuation time included. condition paymentDate.toLocalDate.isAfter(valuationDate.toLocalDate)</technical_language>

Target:
private double getAccrued(DayCount dayCount, Calendar calendar, ZonedDateTime valuationDate, AnnuityDefinition<? extends CouponDefinition> annuity, ZonedDateTimeDoubleTimeSeries indexTimeSeries) { LocalDate date = valuationDate.toLocalDate(); double res = 0.0; CouponDefinition[] payments = annuity.getPayments(); for (CouponDefinition payment : payments) { if (payment.getAccrualStartDate().toLocalDate().isBefore(date) && !payment.getPaymentDate().toLocalDate().isBefore(date)) { double rate; if (payment instanceof CouponIborDefinition) { CouponIborDefinition casted = (CouponIborDefinition) payment; Coupon coupon = casted.toDerivative(valuationDate, indexTimeSeries); ArgumentChecker.isTrue(coupon instanceof CouponFixed, "index should be fixed before accrual starts for standard vanilla swap"); CouponFixed couponFixed = (CouponFixed) coupon; rate = couponFixed.getFixedRate(); } else if (payment instanceof CouponFixedDefinition) { rate = 1.0; } else { throw new IllegalArgumentException("This annuity type is not supported"); } res += getAccrued(dayCount, calendar, valuationDate, payment) * rate; } } return res; }
Source:
<code>public boolean areRelated(Object object1, IRelationTypeSide relationType, Object object2) { boolean related = false; Artifact useArt1 = getArtifact(object1); Artifact useArt2 = getArtifact(object2); <START> if (useArt1 != null & useArt2 != null) { <END> related = useArt1.isRelated(relationType, useArt2); } return related; }</code><technical_language>bitwise operation intended here</technical_language>

Target:
public boolean areRelated(Object object1, IRelationTypeSide relationType, Object object2) { boolean related = false; Artifact useArt1 = getArtifact(object1); Artifact useArt2 = getArtifact(object2); if (useArt1 != null && useArt2 != null) { related = useArt1.isRelated(relationType, useArt2); } return related; }
Source:
<code>private <K, V> void assertContainsOnlyKeys(AssertionInfo info, Map<K, V> actual, String placeholderForErrorMessages, K... keys) { assertNotNull(info, actual); <START> failIfNull(keys, ErrorMessages.keysToLookForIsNull(placeholderForErrorMessages)); <END> if (actual.isEmpty() && keys.length == 0) { return; } failIfEmpty(keys, ErrorMessages.keysToLookForIsEmpty(placeholderForErrorMessages)); Set<K> notFound = new LinkedHashSet<>(); Set<K> notExpected = new LinkedHashSet<>(); compareActualMapAndExpectedKeys(actual, keys, notExpected, notFound); if (!notFound.isEmpty() || !notExpected.isEmpty()) throw failures.failure(info, shouldContainOnlyKeys(actual, keys, notFound, notExpected)); }</code><technical_language>static import keysToLookForIsNull for readability</technical_language>

Target:
private <K, V> void assertContainsOnlyKeys(AssertionInfo info, Map<K, V> actual, String placeholderForErrorMessages, K... keys) { assertNotNull(info, actual); failIfNull(keys, keysToLookForIsNull(placeholderForErrorMessages)); if (actual.isEmpty() && keys.length == 0) { return; } failIfEmpty(keys, keysToLookForIsEmpty(placeholderForErrorMessages)); Set<K> notFound = new LinkedHashSet<>(); Set<K> notExpected = new LinkedHashSet<>(); compareActualMapAndExpectedKeys(actual, keys, notExpected, notFound); if (!notFound.isEmpty() || !notExpected.isEmpty()) throw failures.failure(info, shouldContainOnlyKeys(actual, keys, notFound, notExpected)); }
Source:
<code>private void handleWifiP2pAction(Intent intent) { if (mConfig.isWifiP2pLegacyTetheringMode()) return; final WifiP2pInfo p2pInfo = (WifiP2pInfo) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO); final WifiP2pGroup group = (WifiP2pGroup) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_GROUP); if (VDBG) { Log.d(TAG, "WifiP2pAction: P2pInfo: " + p2pInfo + " Group: " + group); } synchronized (Tethering.this.mPublicSync) { <START> if (p2pInfo != null && group != null && group.isGroupOwner() && !TextUtils.isEmpty(group.getInterface())) { if (!TextUtils.isEmpty(mWifiP2pTetherInterface)) { if (mWifiP2pTetherInterface.equals(group.getInterface())) { return; } else { mLog.w("P2P tethered interface " + mWifiP2pTetherInterface + "is different from current interface " + group.getInterface() + ", re-tether it"); disableWifiP2pIpServingLocked(mWifiP2pTetherInterface); } } <END> mWifiP2pTetherInterface = group.getInterface(); enableWifiIpServingLocked(mWifiP2pTetherInterface, IFACE_IP_MODE_LOCAL_ONLY); } else if (group == null && !TextUtils.isEmpty(mWifiP2pTetherInterface)) { disableWifiP2pIpServingLocked(mWifiP2pTetherInterface); mWifiP2pTetherInterface = null; } } }</code><technical_language>nit: I fine for logic, avoid nested IF. is friendly for reader easy lose some case</technical_language>

Target:
private void handleWifiP2pAction(Intent intent) { if (mConfig.isWifiP2pLegacyTetheringMode()) return; final WifiP2pInfo p2pInfo = (WifiP2pInfo) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_INFO); final WifiP2pGroup group = (WifiP2pGroup) intent.getParcelableExtra(WifiP2pManager.EXTRA_WIFI_P2P_GROUP); if (VDBG) { Log.d(TAG, "WifiP2pAction: P2pInfo: " + p2pInfo + " Group: " + group); } synchronized (Tethering.this.mPublicSync) { if (p2pInfo == null || !p2pInfo.groupFormed) { disableWifiP2pIpServingLockedIfNeeded(mWifiP2pTetherInterface); mWifiP2pTetherInterface = null; return; } if (!isGroupOwner(group)) return; if (group.getInterface().equals(mWifiP2pTetherInterface)) return; if (!TextUtils.isEmpty(mWifiP2pTetherInterface)) { mLog.w("P2P tethered interface " + mWifiP2pTetherInterface + "is different from current interface " + group.getInterface() + ", re-tether it"); disableWifiP2pIpServingLockedIfNeeded(mWifiP2pTetherInterface); } mWifiP2pTetherInterface = group.getInterface(); enableWifiIpServingLocked(mWifiP2pTetherInterface, IFACE_IP_MODE_LOCAL_ONLY); } }
Source:
<code>public int read(byte[] b, int off, int len) throws IOException { if (len == 0) { return 0; } <START> if (mPosition == mStatus.getLength()) { END> return -1; } int bytesRead = 0; while (bytesRead < len && mPosition < mStatus.getLength()) { long currentPage = mPosition / mPageSize; int currentPageOffset = (int) (mPosition % mPageSize); int bytesLeftInPage = (int) Math.min(mPageSize - currentPageOffset, len - bytesRead); PageId pageId = new PageId(mStatus.getFileId(), currentPage); try (ReadableByteChannel cachedData = mCacheManager.get(pageId, currentPageOffset)) { if (cachedData != null) { ByteBuffer buf = ByteBuffer.wrap(b); buf.position(off + bytesRead); buf.limit(off + bytesRead + bytesLeftInPage); while (buf.position() != buf.limit()) { if (cachedData.read(buf) == -1) { break; } } Preconditions.checkState(buf.position() == buf.limit()); bytesRead += bytesLeftInPage; mPosition += bytesLeftInPage; } else { byte[] page = readExternalPage(mPosition); if (page.length > 0) { mCacheManager.put(pageId, page); System.arraycopy(page, currentPageOffset, b, off + bytesRead, bytesLeftInPage); bytesRead += bytesLeftInPage; mPosition += bytesLeftInPage; } } } } Preconditions.checkState(bytesRead == len || (bytesRead < len && remaining() == 0), "Invalid number of bytes read"); return bytesRead; }</code><technical_language>mPosition >= mStatus.getLength()</technical_language>

Target:
public int read(byte[] b, int off, int len) throws IOException { Preconditions.checkArgument(len >= 0, "length should be non-negative"); Preconditions.checkArgument(off >= 0, "offset should be non-negative"); if (len == 0) { return 0; } if (mPosition >= mStatus.getLength()) { return -1; } int bytesRead = 0; while (bytesRead < len && mPosition < mStatus.getLength()) { long currentPage = mPosition / mPageSize; int currentPageOffset = (int) (mPosition % mPageSize); int bytesLeftInPage = (int) Math.min(mPageSize - currentPageOffset, len - bytesRead); PageId pageId = new PageId(mStatus.getFileId(), currentPage); try (ReadableByteChannel cachedData = mCacheManager.get(pageId, currentPageOffset)) { if (cachedData != null) { ByteBuffer buf = ByteBuffer.wrap(b); buf.position(off + bytesRead); buf.limit(off + bytesRead + bytesLeftInPage); while (buf.position() != buf.limit()) { if (cachedData.read(buf) == -1) { break; } } Preconditions.checkState(buf.position() == buf.limit()); bytesRead += bytesLeftInPage; mPosition += bytesLeftInPage; } else { byte[] page = readExternalPage(mPosition); if (page.length > 0) { mCacheManager.put(pageId, page); System.arraycopy(page, currentPageOffset, b, off + bytesRead, bytesLeftInPage); bytesRead += bytesLeftInPage; mPosition += bytesLeftInPage; } } } } Preconditions.checkState(bytesRead == len || (bytesRead < len && remaining() == 0), "Invalid number of bytes read - " + "bytes to read = %d, actual bytes read = %d, bytes remains in file %d", len, bytesRead, remaining()); return bytesRead; }
Source:
<code>public static TimeLockAgent create( MetricsManager metricsManager, TimeLockInstallConfiguration install, Supplier<TimeLockRuntimeConfiguration> runtime, UserAgent userAgent, int threadPoolSize, long blockingTimeoutMs, Consumer<Object> registrar, Optional<Consumer<UndertowService>> undertowRegistrar) { ExecutorService executor = createSharedExecutor(metricsManager); PaxosResources paxosResources = PaxosResourcesFactory.create( ImmutableTimelockPaxosInstallationContext.of(install, userAgent), metricsManager, Suppliers.compose(TimeLockRuntimeConfiguration::paxos, runtime::get), executor); TimeLockAgent agent = new TimeLockAgent( metricsManager, install, runtime, undertowRegistrar, threadPoolSize, blockingTimeoutMs, registrar, paxosResources, userAgent); <START> agent.createAndRegisterResources(paxosResources.leadershipContextFactory().sqliteDataSource()); <END> return agent; }</code><technical_language>if create inject</technical_language>

Target:
public static TimeLockAgent create( MetricsManager metricsManager, TimeLockInstallConfiguration install, Supplier<TimeLockRuntimeConfiguration> runtime, UserAgent userAgent, int threadPoolSize, long blockingTimeoutMs, Consumer<Object> registrar, Optional<Consumer<UndertowService>> undertowRegistrar) { ExecutorService executor = createSharedExecutor(metricsManager); PaxosResourcesFactory.TimelockPaxosInstallationContext installationContext = ImmutableTimelockPaxosInstallationContext.of(install, userAgent); PaxosResources paxosResources = PaxosResourcesFactory.create( installationContext, metricsManager, Suppliers.compose(TimeLockRuntimeConfiguration::paxos, runtime::get), executor); TimeLockAgent agent = new TimeLockAgent( metricsManager, install, runtime, undertowRegistrar, threadPoolSize, blockingTimeoutMs, registrar, paxosResources, userAgent, installationContext.sqliteDataSource()); agent.createAndRegisterResources(); return agent; }
Source:
<code>public void stop() throws LifeCycleStopException { if (!state.compareAndSet(State.STARTED, State.STOPPING)) { return; } Thread thread = shutdownHook.getAndSet(null); if (thread != null) { try { Runtime.getRuntime().removeShutdownHook(thread); } catch (IllegalStateException ignored) { } } log.info("Life cycle stopping..."); List<Object> reversedInstances = new ArrayList<>(managedInstances); Collections.reverse(reversedInstances); LifeCycleStopException stopException = null; for (Object obj : reversedInstances) { log.debug("Stopping %s", obj.getClass().getName()); LifeCycleMethods methods = methodsMap.get(obj.getClass()); for (Method preDestroy : methods.methodsFor(PreDestroy.class)) { log.debug("\t%s()", preDestroy.getName()); try { preDestroy.invoke(obj); } catch (Exception e) { Throwable t = (e instanceof InvocationTargetException) ? ((InvocationTargetException) e).getTargetException() : e; <START> log.error("Exception in PreDestroy method %s::%s()", obj.getClass().getName(), preDestroy.getName(), t); <END> if (stopException == null) { stopException = new LifeCycleStopException(); } stopException.addSuppressed(t); } } } state.set(State.STOPPED); if (stopException != null) { throw stopException; } log.info("Life cycle stopped."); }</code><technical_language>Is t logged? (fmt string 2 %ss only) If intent log stacktrace in full, t param... I a good idea, t propagated eventually</technical_language>

Target:
public void stop() throws LifeCycleStopException { AtomicBoolean failure = new AtomicBoolean(false); stop((klass, method, exception) -> { failure.set(true); log.error(exception, "Exception in PreDestroy method %s::%s()", klass.getName(), method.getName()); }); if (failure.get()) { throw new LifeCycleStopException(); } }
Source:
<code>private Grouping determineGrouping(String delimiter) { if (delimiter.isEmpty()) return Grouping.NONE; <START> return delimiter.equals(EXCLUSIVE_DELIMITER) ? Grouping.EXCLUSIVE : Grouping.NON_EXCLUSIVE; <END> }</code><technical_language>Assumes possibilities, check for it. a switch a default: assert false</technical_language>

Target:
private Grouping determineGrouping(String delimiter) { switch (delimiter) { case EXCLUSIVE_DELIMITER: return Grouping.EXCLUSIVE; case NONEXCLUSIVE_DELIMITER: return Grouping.NON_EXCLUSIVE; case "": return Grouping.NONE; default: assert false : "Unsupported delimiter found"; return Grouping.NONE; } }
Source:
<code>private String getTextValue(Element element, String tagName) { NodeList nodes = element.getElementsByTagName(tagName); Element nodeElement = (Element) nodes.item(0); NodeList nodeList = nodeElement.getChildNodes(); <START> return nodeList.item(0).getNodeValue().trim(); <END> }</code><technical_language>return element.getElementByTagName(tagName).item(0).getChildNodes().item(0).getNodeValue.trim(); long for standard text node extraction..</technical_language>

Target:
private String getTextValue(Element element, String tagName) { return element.getElementsByTagName(tagName).item(0).getChildNodes().item(0).getNodeValue().trim(); }
Source:
<code>public void changeWorkingSolution(ScoreDirector<TestdataSolution> scoreDirector) { TestdataSolution solution = scoreDirector.getWorkingSolution(); TestdataValue firstValue = solution.getValueList().get(0); for (TestdataEntity entity : solution.getEntityList()) { scoreDirector.beforeVariableChanged(entity, "value"); entity.setValue(firstValue); scoreDirector.afterVariableChanged(entity, "value"); } scoreDirector.triggerVariableListeners(); Score<?> score = scoreDirector.calculateScore(); if (!score.isSolutionInitialized()) { throw new IllegalStateException( <START> "The solution [" + TestdataEntity.class.getSimpleName() <END> + "] was not fully initialized by CustomSolverPhase: " + this.getClass().getCanonicalName()); } }</code><technical_language>( ) quote parameters in exception messages</technical_language>

Target:
public void changeWorkingSolution(ScoreDirector<TestdataSolution> scoreDirector) { TestdataSolution solution = scoreDirector.getWorkingSolution(); TestdataValue firstValue = solution.getValueList().get(0); for (TestdataEntity entity : solution.getEntityList()) { scoreDirector.beforeVariableChanged(entity, "value"); entity.setValue(firstValue); scoreDirector.afterVariableChanged(entity, "value"); } scoreDirector.triggerVariableListeners(); Score<?> score = scoreDirector.calculateScore(); if (!score.isSolutionInitialized()) { throw new IllegalStateException("The solution (" + TestdataEntity.class.getSimpleName() + ") was not fully initialized by CustomSolverPhase: (" + this.getClass().getCanonicalName() + ")"); } }
Source:
<code>public String toQuadKey() { char[] quadKey = new char[this.zoomLevel]; for (int i = this.zoomLevel; i > 0; i--) { char digit = '0'; int mask = 1 << (i - 1); if ((this.x & mask) != 0) { digit++; } if ((this.y & mask) != 0) { <START> digit++; <END> digit++; } quadKey[this.zoomLevel - i] = digit; } return String.valueOf(quadKey); }</code><technical_language>digit += 2</technical_language>

Target:
public String toQuadKey() { char[] quadKey = new char[this.zoomLevel]; for (int i = this.zoomLevel; i > 0; i--) { char digit = '0'; int mask = 1 << (i - 1); if ((this.x & mask) != 0) { digit++; } if ((this.y & mask) != 0) { digit += 2; } quadKey[this.zoomLevel - i] = digit; } return String.valueOf(quadKey); }
Source:
<code>public void objectToString() { Object[] nums = {4, "hello", true, 0.01}; OffsetDateTime time = OffsetDateTime.parse("2017-01-02T01:02:03Z"); Assert.assertEquals("[4, hello, true, 0.01]", StringUtils.toString(nums)); <START> Assert.assertEquals("", StringUtils.toString(null)); <END> Assert.assertEquals("2017-01-02T01:02:03Z", StringUtils.toString(time)); }</code><technical_language>this test Array is empty, i.e []? Instead of a String is empty, ""? Also, I wondering multi-dimensional arrays is kinda point of deepToString... If array contains other arrays elements, string representation contains contents on. <LINK_0></technical_language>

Target:
public void objectToString() { Object nullObject = null; Object[] emptyArray = {}; Object[] objArray = {4, "hello", true, 0.01}; Object[][] multiArray = {{"OpenRefine", 12}, {13, 4.6}, {"data", "mining"}}; OffsetDateTime time = OffsetDateTime.parse("2017-01-02T01:02:03Z"); Assert.assertEquals("", StringUtils.toString(nullObject)); Assert.assertEquals("[]", StringUtils.toString(emptyArray)); Assert.assertEquals("[4, hello, true, 0.01]", StringUtils.toString(objArray)); Assert.assertEquals("[[OpenRefine, 12], [13, 4.6], [data, mining]]", StringUtils.toString(multiArray)); Assert.assertEquals("2017-01-02T01:02:03Z", StringUtils.toString(time)); }
Source:
<code>public void testValidateUuidBothFormats() { uuidGenerator.setUseHyphens(true); assertThat(uuidGenerator.validateUuid(UUID.randomUUID().toString()), is(true)); <START> uuidGenerator.setUseHyphens(true); <END> assertThat(uuidGenerator.validateUuid(UUID.randomUUID().toString()), is(false)); }</code><technical_language>expect this false</technical_language>

Target:
public void testValidateUuidBothFormats() { uuidGenerator.setUseHyphens(false); assertThat(uuidGenerator.validateUuid(UUID.randomUUID().toString()), is(false)); uuidGenerator.setUseHyphens(true); assertThat(uuidGenerator.validateUuid(UUID.randomUUID().toString()), is(true)); }
Source:
<code>protected void configure() { <START> bind(CapabilityDefinition.class).annotatedWith( <END> Exports.named(DeleteProjectCapability.DELETE_PROJECT_CAPABILITY)).to( DeleteProjectCapability.class); }</code><technical_language>nit: try break . ( so: bind(...) .annotatedWith(...) .to(...)</technical_language>

Target:
protected void configure() { bind(CapabilityDefinition.class) .annotatedWith(Exports.named(DELETE_PROJECT)) .to(DeleteProjectCapability.class); }