auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public JoinUsingAnalysis(List<Integer> leftJoinFields, List<Integer> rightJoinFields, List<Integer> otherLeftFields, List<Integer> otherRightFields) { this.leftJoinFields = leftJoinFields; this.rightJoinFields = rightJoinFields; this.otherLeftFields = otherLeftFields; this.otherRightFields = otherRightFields; }

Target:
JoinUsingAnalysis(List<Integer> leftJoinFields, List<Integer> rightJoinFields, List<Integer> otherLeftFields, List<Integer> otherRightFields) { this.leftJoinFields = ImmutableList.copyOf(leftJoinFields); this.rightJoinFields = ImmutableList.copyOf(rightJoinFields); this.otherLeftFields = ImmutableList.copyOf(otherLeftFields); this.otherRightFields = ImmutableList.copyOf(otherRightFields); checkArgument(leftJoinFields.size() == rightJoinFields.size(), "Expected join fields for left and right to have the same size"); }
Source:
public AnnotationList getAnnotations(AnnotationRequestParameters parameters) throws MendeleyException { try { String url = getAnnotationsUrl(parameters); Procedure<AnnotationList> proc = new GetAnnotationsProcedure(url, authenticationManager); return proc.checkedRun(); } catch (UnsupportedEncodingException e) { throw new MendeleyException(e.getMessage()); } }

Target:
public AnnotationList getAnnotations(AnnotationRequestParameters parameters) throws MendeleyException { try { String url = getAnnotationsUrl(parameters); Procedure<AnnotationList> proc = new GetAnnotationsProcedure(url, authenticationManager); return proc.checkedRun(); } catch (UnsupportedEncodingException e) { throw new MendeleyException("Could not encode the URL for getting annotations", e); } }
Source:
public void validate(Object object, Errors errors) { if(object == null){ throw new IllegalArgumentException("The object parameter should not be null"); } if(!(object instanceof Condition)){ throw new IllegalArgumentException("The object parameter should be of type " + Condition.class); } Condition condition = (Condition) object; if(condition.getCondition() == null || (condition.getClinicalStatus().equals(ConditionClinicalStatus.INACTIVE) && condition.getOnsetDate().compareTo(condition.getEndDate()) > 0)){ errors.rejectValue("condition", "Condition.conditionShouldNotBeNull", "The condition is required"); } if(condition.getClinicalStatus() == null){ errors.rejectValue("clinicalStatus", "Condition.clinicalStatusShouldNotBeNull", "The clinical status is required"); } }

Target:
public void validate(Object object, Errors errors) { if(object == null){ throw new IllegalArgumentException("The object parameter should not be null"); } if(!(object instanceof Condition)){ throw new IllegalArgumentException("The object parameter should be of type " + Condition.class); } Condition condition = (Condition) object; if(condition.getCondition() == null){ errors.rejectValue("condition", "Condition.conditionShouldNotBeNull", "The condition is required"); } else if(condition.getClinicalStatus().equals(ConditionClinicalStatus.INACTIVE) && condition.getOnsetDate().compareTo(condition.getEndDate()) > 0){ errors.rejectValue("onsetDate","Condition.onsetDateShouldBeBeforeEndDate","Valid Onset Date is required"); } if(condition.getClinicalStatus() == null){ errors.rejectValue("clinicalStatus", "Condition.clinicalStatusShouldNotBeNull", "The clinical status is required"); } }
Source:
public T findByOcOID(String OCOID) { if(OCOID == null) { return null; } getSessionFactory().getStatistics().logSummary(); String query = "from " + getDomainClassName() + " do where do.oc_oid = :oc_oid"; Query q = getCurrentSession().createQuery(query); q.setParameter("oc_oid", OCOID); return (T) q.uniqueResult(); }

Target:
public T findByOcOID(String OCOID) { getSessionFactory().getStatistics().logSummary(); String query = "from " + getDomainClassName() + " do where do.oc_oid = :oc_oid"; Query q = getCurrentSession().createQuery(query); q.setParameter("oc_oid", OCOID); return (T) q.uniqueResult(); }
Source:
private void onDiscoverServicesResult(String deviceObjectPath, boolean result) { String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); if (result) { mBluetoothService.updateRemoteDevicePropertiesCache(address); } if (address != null) { mBluetoothService.sendUuidIntent(address); } mBluetoothService.makeServiceChannelCallbacks(address); }

Target:
private void onDiscoverServicesResult(String deviceObjectPath, boolean result) { String address = mBluetoothService.getAddressFromObjectPath(deviceObjectPath); if (address == null) return; if (result) { mBluetoothService.updateRemoteDevicePropertiesCache(address); } mBluetoothService.sendUuidIntent(address); mBluetoothService.makeServiceChannelCallbacks(address); }
Source:
public void updateStockPrice(String symbol, double newPrice) throws StockMarketExpection { if (getStockForSymbol(symbol) == null) { throw new StockMarketExpection("Stock not present (" + symbol + ")"); } if (newPrice < 0.0) { throw new StockMarketExpection( "Stock price cannot be set to a negative value (" + symbol + ", " + getStockForSymbol(symbol).getPrice() + ") -> " + newPrice + " X Not Allowed "); } Stock s = removeStockFromStockList(symbol); s.setPrice(newPrice); addStock(s); marketHistory.updatePriceHistory(symbol, newPrice); }

Target:
public void updateStockPrice(String symbol, double newPrice) throws StockMarketExpection { if (getStockForSymbol(symbol) == null) { throw new StockMarketExpection("Stock not present (" + symbol + ")"); } if (newPrice < 0.0) { throw new StockMarketExpection( "Stock price cannot be set to a negative value (" + symbol + ", " + getStockForSymbol(symbol).getPrice() + ") -> " + newPrice + " X Not Allowed "); } Stock stock = removeStockFromStockList(symbol); stock.setPrice(newPrice); addStock(stock); marketHistory.updatePriceHistory(symbol, newPrice); }
Source:
public void testSimpleDelimitedWithTabCharacter() throws Exception { FlatFileItemReader<Foo> reader = new FlatFileItemReaderBuilder<Foo>() .name("fooReader") .resource(getResource("1 2 3")) .delimited() .delimiter(DelimitedLineTokenizer.DELIMITER_TAB) .names(new String[] {"first", "second", "third"}) .targetType(Foo.class) .build(); reader.open(new ExecutionContext()); Foo item = reader.read(); assertEquals(1, item.getFirst()); assertEquals(2, item.getSecond()); assertEquals("3", item.getThird()); assertNull(reader.read()); }

Target:
public void testSimpleDelimitedWithTabCharacter() throws Exception { FlatFileItemReader<Foo> reader = new FlatFileItemReaderBuilder<Foo>() .name("fooReader") .resource(getResource("1\t2\t3")) .delimited() .delimiter(DelimitedLineTokenizer.DELIMITER_TAB) .names(new String[] {"first", "second", "third"}) .targetType(Foo.class) .build(); reader.open(new ExecutionContext()); Foo item = reader.read(); assertEquals(1, item.getFirst()); assertEquals(2, item.getSecond()); assertEquals("3", item.getThird()); assertNull(reader.read()); }
Source:
private boolean isEntityBlacklisted(CreatureEntity creature) { if (isEntityTypeBlacklisted(creature.getType())) return true; if (!(creature instanceof AnimalEntity)) return true; if (creature instanceof IVampire) return true; return false; }

Target:
private boolean isEntityBlacklisted(CreatureEntity creature) { if (!(creature instanceof AnimalEntity)) return true; if (creature instanceof IVampire) return true; EntityType<?> type = creature.getType(); if (!(type.getClassification() == EntityClassification.MONSTER || type.getClassification() == EntityClassification.WATER_CREATURE)) return true; if (ModTags.Entities.VAMPIRE.contains(type)) return true; if (isConfigBlackListed(type.getRegistryName())) return true; return false; }
Source:
private void changePassword(User user, JsonObject json) { String password = JsonUtils.getString(json, "password"); if (Strings.isNullOrEmpty(password)) { throw BennuCoreDomainException.passwordIsEmpty(); } String passwordCheck = JsonUtils.getString(json, "passwordCheck"); if (!Objects.equals(password, passwordCheck)) { throw BennuCoreDomainException.passwordCheckDoesNotMatch(); } if (user.matchesPassword(password)) { throw BennuCoreDomainException.passwordIsTheSame(); } user.changePassword(password); }

Target:
private void changePassword(User user, JsonObject json) { String password = JsonUtils.getString(json, "password"); if (Strings.isNullOrEmpty(password)) { return; } String passwordCheck = JsonUtils.getString(json, "passwordCheck"); if (!Objects.equals(password, passwordCheck)) { throw BennuCoreDomainException.passwordCheckDoesNotMatch(); } if (user.matchesPassword(password)) { throw BennuCoreDomainException.passwordIsTheSame(); } user.changePassword(password); }
Source:
public Map<String, String> getTraceProperties() { Map<String, String> properties = new HashMap<>(); properties.putAll(fTrace.getEnvironment()); properties.put(Messages.CtfTmfTrace_UtcOffset, Long.toUnsignedString(fTrace.getOffset())); properties.put(Messages.CtfTmfTrace_HostID, getHostId()); return properties; }

Target:
public Map<String, String> getTraceProperties() { Map<String, String> properties = new HashMap<>(); properties.putAll(fTrace.getEnvironment()); properties.put(CLOCK_OFFSET, Long.toUnsignedString(fTrace.getOffset())); properties.put(Messages.CtfTmfTrace_HostID, getHostId()); return properties; }
Source:
public Iterable<DocumentRevsList> createTask(List<String> ids, Map<String, Collection<String>> revisions) { List<BulkGetRequest> requests = new ArrayList<BulkGetRequest>(); for (String id : ids) { if (id.isEmpty()) { logger.info("Found document with empty ID in change feed, skipping"); continue; } HashSet<String> possibleAncestors = new HashSet<String>(); for (String revId : revisions.get(id)) { List<String> thesePossibleAncestors = targetDb.getDbCore().getPossibleAncestorRevisionIDs(id, revId, 50); if (thesePossibleAncestors != null) { possibleAncestors.addAll(thesePossibleAncestors); } } requests.add(new BulkGetRequest( id, new ArrayList<String>(revisions.get(id)), new ArrayList<String>(possibleAncestors))); } if (bulkSupported) { return new GetRevisionTaskBulk(this.sourceDb, requests, config.pullAttachmentsInline); } else { return new GetRevisionTaskThreaded(this.sourceDb, requests, config.pullAttachmentsInline); } }

Target:
public Iterable<DocumentRevsList> createTask(List<String> ids, Map<String, Collection<String>> revisions) { List<BulkGetRequest> requests = new ArrayList<BulkGetRequest>(); for (String id : ids) { if (id.isEmpty()) { logger.info("Found document with empty ID in change feed, skipping"); continue; } HashSet<String> possibleAncestors = new HashSet<String>(); for (String revId : revisions.get(id)) { List<String> thesePossibleAncestors = targetDb.getDbCore().getPossibleAncestorRevisionIDs(id, revId, 50); if (thesePossibleAncestors != null) { possibleAncestors.addAll(thesePossibleAncestors); } } requests.add(new BulkGetRequest( id, new ArrayList<String>(revisions.get(id)), new ArrayList<String>(possibleAncestors))); } if (useBulkGet) { return new GetRevisionTaskBulk(this.sourceDb, requests, config.pullAttachmentsInline); } else { return new GetRevisionTaskThreaded(this.sourceDb, requests, config.pullAttachmentsInline); } }
Source:
public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof FormatterBuilder)) { return false; } FormatterBuilder<?> other = (FormatterBuilder<?>) o; return ((m_formatterName == null && other.m_formatterName == null) || m_formatterName.equals(other.m_formatterName)) && ((m_formatterProps == null && other.m_formatterProps == null) || m_formatterProps.equals(other.m_formatterProps)) && ((m_formatterFactory == null && other.m_formatterFactory == null) || m_formatterFactory.equals(other.m_formatterFactory)); }

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof FormatterBuilder)) { return false; } FormatterBuilder<?> other = (FormatterBuilder<?>) o; return ((m_formatterName == null && other.m_formatterName == null) || m_formatterName.equalsIgnoreCase(other.m_formatterName)) && ((m_formatterProps == null && other.m_formatterProps == null) || m_formatterProps.equals(other.m_formatterProps)) && ((m_formatterFactory == null && other.m_formatterFactory == null) || m_formatterFactory.equals(other.m_formatterFactory)); }
Source:
protected void init() { if (getVm() == null) { return; } super.init(); String vmClusterCpuName = getCluster().getCpuVerb(); if (getParameters().getCustomCpuName() != null && !getParameters().getCustomCpuName().equals( getVm().getCustomCpuName() != null ? getVm().getCustomCpuName() : vmClusterCpuName)) { getVm().setUseHostCpuFlags(false); getVm().setCustomCpuName(getParameters().getCustomCpuName()); } if (getParameters().getCustomEmulatedMachine() != null) { getVm().setEmulatedMachine(getParameters().getCustomEmulatedMachine()); } if (getParameters().getBootMenuEnabled() != null) { getVm().setBootMenuEnabled(getParameters().getBootMenuEnabled()); } if (getParameters().getSpiceFileTransferEnabled() != null) { getVm().setSpiceFileTransferEnabled(getParameters().getSpiceFileTransferEnabled()); } if (getParameters().getSpiceCopyPasteEnabled() != null) { getVm().setSpiceCopyPasteEnabled(getParameters().getSpiceCopyPasteEnabled()); } if (getParameters().getBootSequence() != null) { getVm().setBootSequence(getParameters().getBootSequence()); } getVm().setVolatileRun(getParameters().isVolatileRun()); getVm().setInitrdUrl(getParameters().getInitrdUrl()); getVm().setKernelUrl(getParameters().getKernelUrl()); getVm().setKernelParams(getParameters().getKernelParams()); getVm().setCustomProperties(getParameters().getCustomProperties()); getVm().setRunOnce(true); }

Target:
protected void init() { if (getVm() == null) { return; } super.init(); String vmClusterCpuName; if (getCluster().getCompatibilityVersion().equals(getVm().getCompatibilityVersion())) { vmClusterCpuName = getCluster().getCpuVerb(); } else { vmClusterCpuName = getCpuFlagsManagerHandler().getCpuId( getVm().getClusterCpuName(), getVm().getCompatibilityVersion()); } if (getParameters().getCustomCpuName() != null && !getParameters().getCustomCpuName().equals( getVm().getCustomCpuName() != null ? getVm().getCustomCpuName() : vmClusterCpuName)) { getVm().setUseHostCpuFlags(false); getVm().setCustomCpuName(getParameters().getCustomCpuName()); } if (getParameters().getCustomEmulatedMachine() != null) { getVm().setEmulatedMachine(getParameters().getCustomEmulatedMachine()); } if (getParameters().getBootMenuEnabled() != null) { getVm().setBootMenuEnabled(getParameters().getBootMenuEnabled()); } if (getParameters().getSpiceFileTransferEnabled() != null) { getVm().setSpiceFileTransferEnabled(getParameters().getSpiceFileTransferEnabled()); } if (getParameters().getSpiceCopyPasteEnabled() != null) { getVm().setSpiceCopyPasteEnabled(getParameters().getSpiceCopyPasteEnabled()); } if (getParameters().getBootSequence() != null) { getVm().setBootSequence(getParameters().getBootSequence()); } getVm().setVolatileRun(getParameters().isVolatileRun()); getVm().setInitrdUrl(getParameters().getInitrdUrl()); getVm().setKernelUrl(getParameters().getKernelUrl()); getVm().setKernelParams(getParameters().getKernelParams()); getVm().setCustomProperties(getParameters().getCustomProperties()); getVm().setRunOnce(true); }
Source:
public Snippet054NativeControlsInViewers(Shell shell) { int style = SWT.BORDER | SWT.FULL_SELECTION; final TableViewer viewer = new TableViewer(shell, style); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.getTable().setLayoutData( new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); TableViewerColumn column = createColumnFor(viewer, "Column 1"); column.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return element.toString(); } }); column = createColumnFor(viewer, "Column 2"); column.setLabelProvider(createCellLabelProvider()); MyModel[] model = createModel(10); viewer.setInput(model); viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); Button b = createButtonFor(shell, "Modify Input"); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { viewer.setInput(createModel((int) (Math.random() * 10))); } }); b = createButtonFor(shell, "Refresh"); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { viewer.refresh(); } }); }

Target:
public Snippet054NativeControlsInViewers(Shell shell) { final TableViewer viewer = new TableViewer(shell, SWT.BORDER | SWT.FULL_SELECTION); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.getTable().setLayoutData( new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); TableViewerColumn column = createColumnFor(viewer, "Column 1"); column.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return element.toString(); } }); column = createColumnFor(viewer, "Column 2"); column.setLabelProvider(createCellLabelProvider()); MyModel[] model = createModel(10); viewer.setInput(model); viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); Button b = createButtonFor(shell, "Modify Input"); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { viewer.setInput(createModel((int) (Math.random() * 10))); } }); b = createButtonFor(shell, "Refresh"); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { viewer.refresh(); } }); }
Source:
@Test public void testTimeFilter() throws SQLException { withJavaSqlDateTypes(connection -> { String sql = "select 'result'" + " from \"java_sql_date_types\""; Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery(sql + " where \"tm\" > TIME '18:29:33'"); assertTrue("Time is grater than the literal", resultSet.next()); statement = connection.createStatement(); resultSet = statement.executeQuery(sql + " where \"tm\" = TIME '18:29:34'"); assertTrue("Time equals to the literal", resultSet.next()); statement = connection.createStatement(); resultSet = statement.executeQuery(sql + " where \"tm\" > TIME '18:29:34'"); assertFalse("Time is not grater the literal", resultSet.next()); statement = connection.createStatement(); resultSet = statement.executeQuery(sql + " where \"tm\" between TIME '18:29:34' and TIME '18:29:35'"); assertTrue("Time is in between the literals", resultSet.next()); }); }

Target:
@Test public void testTimeFilter() throws SQLException { withJavaSqlDateTypes(connection -> { String sql = "select 'result'" + " from \"java_sql_date_types\""; Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery(sql + " where \"tm\" > TIME '18:29:33'"); assertTrue("java.sql.Time.valueOf(\"18:29:34\") > TIME '18:29:33'", resultSet.next()); statement = connection.createStatement(); resultSet = statement.executeQuery(sql + " where \"tm\" = TIME '18:29:34'"); assertTrue("java.sql.Time.valueOf(\"18:29:34\") = TIME '18:29:34'", resultSet.next()); statement = connection.createStatement(); resultSet = statement.executeQuery(sql + " where \"tm\" > TIME '18:29:34'"); assertFalse("java.sql.Time.valueOf(\"18:29:34\") > TIME '18:29:34'", resultSet.next()); statement = connection.createStatement(); resultSet = statement.executeQuery(sql + " where \"tm\" between TIME '18:29:34' and TIME '18:29:35'"); assertTrue("java.sql.Time.valueOf(\"18:29:34\")" + " between TIME '18:29:34' and TIME '18:29:35'", resultSet.next()); }); }
Source:
private void writeTextToFile(final File output, final String header, final List<String> textLines) throws IOException { try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(output), StandardCharsets.UTF_8))) { writer.write(header + "\n\n"); writer.write(StringUtils.join(textLines, "\n")); } }

Target:
private static void writeTextToFile(final File output, final String header, final List<String> textLines) throws IOException { try (Writer writer = Files.newBufferedWriter(output.toPath())) { writer.write(header + "\n\n"); writer.write(String.join("\n", textLines)); } }
Source:
public void testGroupInfo() throws IOException, OrmException { ReviewDb db = reviewDbProvider.open(); try { AccountGroup adminGroup = db.accountGroups().get(new AccountGroup.Id(1)); Reader r = session.get("/groups/?q=" + adminGroup.getName()); @SuppressWarnings("serial") Map<String, GroupInfo> result = (new Gson()).fromJson(r, new TypeToken<Map<String, GroupInfo>>() {}.getType()); GroupInfo adminGroupInfo = result.get(adminGroup.getName()); assertEquals(adminGroup.getGroupUUID().get(), adminGroupInfo.id); assertEquals(Integer.valueOf(adminGroup.getId().get()), adminGroupInfo.group_id); assertEquals("#/admin/groups/uuid-" + adminGroup.getGroupUUID().get(), adminGroupInfo.url); assertEquals(adminGroup.isVisibleToAll(), toBoolean(adminGroupInfo.options.visible_to_all)); assertEquals(adminGroup.getDescription(), adminGroupInfo.description); assertEquals(adminGroup.getOwnerGroupUUID().get(), adminGroupInfo.owner_id); if (adminGroupInfo.name != null) { assertEquals(adminGroup.getName(), adminGroupInfo.name); } } finally { db.close(); } }

Target:
public void testGroupInfo() throws IOException, OrmException { AccountGroup adminGroup = groupCache.get(new AccountGroup.NameKey("Administrators")); Reader r = session.get("/groups/?q=" + adminGroup.getName()); @SuppressWarnings("serial") Map<String, GroupInfo> result = (new Gson()).fromJson(r, new TypeToken<Map<String, GroupInfo>>() {}.getType()); GroupInfo adminGroupInfo = result.get(adminGroup.getName()); assertEquals(adminGroup.getGroupUUID().get(), adminGroupInfo.id); assertEquals(Integer.valueOf(adminGroup.getId().get()), adminGroupInfo.group_id); assertEquals("#/admin/groups/uuid-" + adminGroup.getGroupUUID().get(), adminGroupInfo.url); assertEquals(adminGroup.isVisibleToAll(), toBoolean(adminGroupInfo.options.visible_to_all)); assertEquals(adminGroup.getDescription(), adminGroupInfo.description); assertEquals(adminGroup.getOwnerGroupUUID().get(), adminGroupInfo.owner_id); if (adminGroupInfo.name != null) { assertEquals(adminGroup.getName(), adminGroupInfo.name); } }
Source:
private JobProgressUpdate progressUpdateLog(boolean isProgressLogRequested, Operation operation) { if (isProgressLogRequested && canProvideProgressLog()) { if (OperationType.EXECUTE_STATEMENT.equals(operation.getType())) { SessionState sessionState = operation.getParentSession().getSessionState(); try { while (sessionState.progressMonitor() == null && !operation.isFinished()) { Thread.sleep(100L); } } catch (InterruptedException e) { LOG.warn("Error while getting progress update", e); } if (sessionState.progressMonitor() != null) { return new JobProgressUpdate(sessionState.progressMonitor()); } } } return new JobProgressUpdate(ProgressMonitor.NULL); }

Target:
private JobProgressUpdate progressUpdateLog(boolean isProgressLogRequested, Operation operation) { if (isProgressLogRequested && canProvideProgressLog()) { if (OperationType.EXECUTE_STATEMENT.equals(operation.getType())) { SessionState sessionState = operation.getParentSession().getSessionState(); try { while (sessionState.getProgressMonitor() == null && !operation.isFinished()) { Thread.sleep(10L); } } catch (InterruptedException e) { LOG.warn("Error while getting progress update", e); } if (sessionState.getProgressMonitor() != null) { return new JobProgressUpdate(sessionState.getProgressMonitor()); } } } return new JobProgressUpdate(ProgressMonitor.NULL); }
Source:
private int compressDirectBuf() throws IOException { if (uncompressedDirectBufLen == 0) { return 0; } else { uncompressedDirectBuf.limit(uncompressedDirectBufLen).position(0); int size = Snappy.compress((ByteBuffer) uncompressedDirectBuf, (ByteBuffer) compressedDirectBuf); uncompressedDirectBufLen = 0; uncompressedDirectBuf.limit(uncompressedDirectBuf.capacity()).position(0); return size; } }

Target:
private int compressDirectBuf() throws IOException { if (uncompressedDirectBufLen == 0) { return 0; } else { uncompressedDirectBuf.limit(uncompressedDirectBufLen).position(0); int size = Snappy.compress((ByteBuffer) uncompressedDirectBuf, (ByteBuffer) compressedDirectBuf); uncompressedDirectBufLen = 0; return size; } }
Source:
private LinuxStyles() { ImmutableMap.Builder<String, LinuxStyle> builder = new Builder<>(); builder.put("UNKNOWN", new LinuxStyle(new RGB(100, 100, 100), 33)); builder.put("WAIT_UNKNOWN", new LinuxStyle(new RGB(200, 200, 200), 50)); builder.put("WAIT_BLOCKED", new LinuxStyle(new RGB(200, 200, 0), 50)); builder.put("WAIT_FOR_CPU", new LinuxStyle(new RGB(200, 100, 0), 50)); builder.put("IDLE", new LinuxStyle(new RGB(200, 200, 200), 66)); builder.put("USERMODE", new LinuxStyle(new RGB(0, 200, 0), 100)); builder.put("SYSCALL", new LinuxStyle(new RGB(0, 0, 200), 100)); LinuxStyle irqStyle = new LinuxStyle(new RGB(200, 0, 100), 75); builder.put("INTERRUPTED", irqStyle); builder.put("IRQ", irqStyle); builder.put("IRQ_ACTIVE", irqStyle); builder.put("SOFT_IRQ_RAISED", new LinuxStyle(new RGB(200, 200, 0), 50)); LinuxStyle softIrqStyle = new LinuxStyle(new RGB(200, 150, 100), 75); builder.put("SOFT_IRQ", softIrqStyle); builder.put("SOFT_IRQ_ACTIVE", softIrqStyle); fRegistry = builder.build(); }

Target:
private LinuxStyles() { ImmutableMap.Builder<String, LinuxStyle> builder = new Builder<>(); builder.put("UNKNOWN", new LinuxStyle(Messages.LinuxStyles_unknown, new RGB(100, 100, 100), 0.33f)); builder.put("WAIT_UNKNOWN", new LinuxStyle(Messages.LinuxStyles_wait, new RGB(200, 200, 200), 0.50f)); builder.put("WAIT_BLOCKED", new LinuxStyle(Messages.LinuxStyles_waitBlocked, new RGB(200, 200, 0), 0.50f)); builder.put("WAIT_FOR_CPU", new LinuxStyle(Messages.LinuxStyles_waitForCPU, new RGB(200, 100, 0), 0.50f)); builder.put("IDLE", new LinuxStyle(Messages.LinuxStyles_idle, new RGB(200, 200, 200), 0.66f)); builder.put("USERMODE", new LinuxStyle(Messages.LinuxStyles_usermode, new RGB(0, 200, 0), 1.00f)); builder.put("SYSCALL", new LinuxStyle(Messages.LinuxStyles_systemCall, new RGB(0, 0, 200), 1.00f)); builder.put("INTERRUPTED", new LinuxStyle(Messages.LinuxStyles_Interrupt, new RGB(200, 0, 100), 0.75f)); builder.put("IRQ", new LinuxStyle(Messages.LinuxStyles_Interrupt, new RGB(200, 0, 100), 0.75f)); builder.put("IRQ_ACTIVE", new LinuxStyle(Messages.LinuxStyles_Interrupt, new RGB(200, 0, 100), 0.75f)); builder.put("SOFT_IRQ_RAISED", new LinuxStyle(Messages.LinuxStyles_softIrqRaised, new RGB(200, 200, 0), 1.00f)); builder.put("SOFT_IRQ", new LinuxStyle(Messages.LinuxStyles_softrq, new RGB(200, 150, 100), 1.00f)); builder.put("SOFT_IRQ_ACTIVE", new LinuxStyle(Messages.LinuxStyles_softrq, new RGB(200, 150, 100), 1.00f)); fRegistry = builder.build(); }
Source:
private void processCheckpoint(StreamAddressSpace streamAddressSpace, Function<ILogData, BackpointerOp> filter, NavigableSet<Long> queue) { List<Long> checkpointAddresses = new ArrayList<>(); streamAddressSpace.getAddressMap().forEach(checkpointAddresses::add); Collections.reverse(checkpointAddresses); Iterable<List<Long>> batches = Iterables.partition(checkpointAddresses, runtime.getParameters().getCheckpointReadBatchSize()); boolean checkpointResolved = false; for (List<Long> batch : batches) { if (checkpointResolved) { break; } try { List<ILogData> entries = readAll(batch); for (ILogData data : entries) { checkpointResolved = filterCheckpointEntry(data, filter, queue); if (checkpointResolved) { break; } } } catch (TrimmedException te) { long lastReadAddress = Address.NON_ADDRESS; try { for (long address : batch) { lastReadAddress = address; ILogData data = read(address); checkpointResolved = filterCheckpointEntry(data, filter, queue); if (checkpointResolved) { break; } } } catch (TrimmedException ste) { if (options.ignoreTrimmed) { log.warn("processCheckpoint[{}]: Ignoring trimmed exception for address[{}]," + " stream[{}]", this, lastReadAddress, id); } else { throw ste; } } } } }

Target:
private void processCheckpoint(StreamAddressSpace streamAddressSpace, Function<ILogData, BackpointerOp> filter, NavigableSet<Long> queue) { List<Long> checkpointAddresses = new ArrayList<>(); streamAddressSpace.getAddressMap().forEach(checkpointAddresses::add); checkpointAddresses.sort(null); Collections.reverse(checkpointAddresses); Iterable<List<Long>> batches = Iterables.partition(checkpointAddresses, runtime.getParameters().getCheckpointReadBatchSize()); boolean checkpointResolved = false; for (List<Long> batch : batches) { if (checkpointResolved) { break; } try { List<ILogData> entries = readAll(batch); for (ILogData data : entries) { checkpointResolved = filterCheckpointEntry(data, filter, queue); if (checkpointResolved) { break; } } } catch (TrimmedException te) { checkpointResolved = processCheckpointBatchByEntry(batch, filter, queue); } } }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); for (int i = 0 ; i < sortParameters.size(); i++) { sb.append(sortParameters.get(i).toString()); if (i < sortParameters.size() - 1) sb.append(";"); } return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); int paddedSize = sortParameters.size() - 1; for (int i = 0 ; i < sortParameters.size(); i++) { sb.append(sortParameters.get(i).toString()); if (i < paddedSize) { sb.append(";"); } } return sb.toString(); }
Source:
public static String parseProcess(String processField, Map<String, Object> fieldsMap) { @Nullable JsonObject root = G_SON.fromJson(processField, JsonObject.class); String name = String.valueOf(optString(root, IOpenTracingConstants.SERVICE_NAME)); if (name == "null") { return ""; } JsonArray tags = optJSONArray(root, IOpenTracingConstants.TAGS); if (tags != null) { for (int i = 0; i < tags.size(); i++) { String key = Objects.requireNonNull(tags.get(i).getAsJsonObject().get("key").getAsString()); JsonElement element = Objects.requireNonNull(tags.get(i).getAsJsonObject().get("value")); String value = String.valueOf(element.isJsonPrimitive() ? element.getAsJsonPrimitive().getAsString() : element.toString()); fieldsMap.put(IOpenTracingConstants.PROCESS_TAGS + "/" + key, value); } } fieldsMap.put(IOpenTracingConstants.PROCESS_ID, name); return name; }

Target:
public static String parseProcess(String processField, Map<String, Object> fieldsMap) { @Nullable JsonObject root = G_SON.fromJson(processField, JsonObject.class); String name = String.valueOf(optString(root, IOpenTracingConstants.SERVICE_NAME)); if (name == "null") { return ""; } JsonArray tags = optJSONArray(root, IOpenTracingConstants.TAGS); if (tags != null) { for (int i = 0; i < tags.size(); i++) { String key = Objects.requireNonNull(tags.get(i).getAsJsonObject().get("key").getAsString()); JsonElement element = Objects.requireNonNull(tags.get(i).getAsJsonObject().get("value")); String value = String.valueOf(element.isJsonPrimitive() ? element.getAsJsonPrimitive().getAsString() : element.toString()); fieldsMap.put(IOpenTracingConstants.PROCESS_TAGS + '/' + key, value); } } fieldsMap.put(IOpenTracingConstants.PROCESS_ID, name); return name; }
Source:
private BulkFormat<RowData, ? super HiveSourceSplit> createBulkFormatForSplit(HiveSourceSplit split) { if (!useMapRedReader && useParquetVectorizedRead(split.getHiveTablePartition())) { return ParquetColumnarRowInputFormat.createPartitionedFormat( jobConfWrapper.conf(), (RowType) producedDataType.getLogicalType(), partitionKeys, jobConfWrapper.conf().get(HiveConf.ConfVars.DEFAULTPARTITIONNAME.varname, HiveConf.ConfVars.DEFAULTPARTITIONNAME.defaultStrVal), (PartitionValueConverter) (colName, valStr, type) -> split.getHiveTablePartition().getPartitionSpec().get(colName), DEFAULT_SIZE, hiveVersion.startsWith("3"), false ); } else { return new HiveMapRedBulkFormat(); } }

Target:
private BulkFormat<RowData, ? super HiveSourceSplit> createBulkFormatForSplit(HiveSourceSplit split) { if (!useMapRedReader && useParquetVectorizedRead(split.getHiveTablePartition())) { PartitionFieldExtractor<HiveSourceSplit> extractor = (PartitionFieldExtractor<HiveSourceSplit>) (split1, fieldName, fieldType) -> split1.getHiveTablePartition().getPartitionSpec().get(fieldName); return ParquetColumnarRowInputFormat.createPartitionedFormat( jobConfWrapper.conf(), producedRowType, partitionKeys, extractor, DEFAULT_SIZE, hiveVersion.startsWith("3"), false ); } else { return new HiveMapRedBulkFormat(); } }
Source:
public void importDCTerms(String xmlToParse, DatasetVersion datasetVersion, DatasetFieldServiceBean datasetFieldSvc, MetadataBlockServiceBean blockService, SettingsServiceBean settingsService) { DatasetDTO datasetDTO = this.initializeDataset(); try { Map fileMap = mapDCTerms(xmlToParse, datasetDTO); Gson gson = new Gson(); String json = gson.toJson(datasetDTO.getDatasetVersion()); JsonReader jsonReader = Json.createReader(new StringReader(json)); JsonObject obj = jsonReader.readObject(); DatasetVersion dv = new JsonParser(datasetFieldSvc, blockService, settingsService).parseDatasetVersion(obj, datasetVersion); } catch (XMLStreamException | JsonParseException e) { e.printStackTrace(); } }

Target:
public void importDCTerms(String xmlToParse, DatasetVersion datasetVersion, DatasetFieldServiceBean datasetFieldSvc, MetadataBlockServiceBean blockService, SettingsServiceBean settingsService) { DatasetDTO datasetDTO = this.initializeDataset(); try { Map<String, String> fileMap = mapDCTerms(xmlToParse, datasetDTO); Gson gson = new Gson(); String json = gson.toJson(datasetDTO.getDatasetVersion()); JsonReader jsonReader = Json.createReader(new StringReader(json)); JsonObject obj = jsonReader.readObject(); DatasetVersion dv = new JsonParser(datasetFieldSvc, blockService, settingsService).parseDatasetVersion(obj, datasetVersion); } catch (XMLStreamException | JsonParseException e) { e.printStackTrace(); } }
Source:
public void testCompleteFailure() throws InterruptedException, TimeoutException { MutateRowsRequest request = createRequest(2); final RetryingMutateRowsOperation underTest = createOperation(request); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) { invocation.getArgumentAt(1, ClientCall.Listener.class) .onClose(io.grpc.Status.DEADLINE_EXCEEDED, new Metadata()); return null; } }).when(mutateRows).start(any(MutateRowsRequest.class), any(ClientCall.Listener.class), any(Metadata.class), any(ClientCall.class)); try { underTest.getAsyncResult().get(1, TimeUnit.MINUTES); Assert.fail("Expecting a DEADLINE_EXCEEDED exception"); } catch (ExecutionException e) { e.printStackTrace(); Assert.assertEquals(io.grpc.Status.DEADLINE_EXCEEDED.getCode(), io.grpc.Status.fromThrowable(e).getCode()); } clock.assertTimeWithinExpectations( TimeUnit.MILLISECONDS.toNanos(RETRY_OPTIONS.getMaxElapsedBackoffMillis())); }

Target:
public void testCompleteFailure() throws InterruptedException, TimeoutException { MutateRowsRequest request = createRequest(2); final RetryingMutateRowsOperation underTest = createOperation(request); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) { invocation.getArgumentAt(1, ClientCall.Listener.class) .onClose(io.grpc.Status.DEADLINE_EXCEEDED, new Metadata()); return null; } }).when(mutateRows).start(any(MutateRowsRequest.class), any(ClientCall.Listener.class), any(Metadata.class), any(ClientCall.class)); try { underTest.getAsyncResult().get(1, TimeUnit.MINUTES); Assert.fail("Expecting a DEADLINE_EXCEEDED exception"); } catch (ExecutionException e) { Assert.assertEquals(io.grpc.Status.DEADLINE_EXCEEDED.getCode(), io.grpc.Status.fromThrowable(e).getCode()); } clock.assertTimeWithinExpectations( TimeUnit.MILLISECONDS.toNanos(RETRY_OPTIONS.getMaxElapsedBackoffMillis())); }
Source:
public void failTasksForWorker(long workerId) { synchronized (mPlanInfo) { List<Long> taskIds = mWorkerIdToTaskIds.get(workerId); if (taskIds == null) { return; } boolean statusChanged = false; for (Long taskId : taskIds) { TaskInfo taskInfo = mPlanInfo.getTaskInfo(taskId); if (taskInfo.getStatus().isFinished()) { return; } if (!mPlanInfo.getStatus().isFinished()) { taskInfo.setStatus(Status.FAILED); taskInfo.setErrorMessage("Job worker was lost before the task could complete"); statusChanged = true; } } if (statusChanged) { updateStatus(); } } }

Target:
public void failTasksForWorker(long workerId) { synchronized (mPlanInfo) { if (mPlanInfo.getStatus().isFinished()) { return; } List<Long> taskIds = mWorkerIdToTaskIds.get(workerId); if (taskIds == null) { return; } boolean statusChanged = false; for (Long taskId : taskIds) { TaskInfo taskInfo = mPlanInfo.getTaskInfo(taskId); if (taskInfo == null || taskInfo.getStatus().isFinished()) { continue; } taskInfo.setStatus(Status.FAILED); taskInfo.setErrorMessage("Job worker was lost before the task could complete"); statusChanged = true; } if (statusChanged) { updateStatus(); } } }
Source:
protected void unmapSecondaryIndexes(K key, V value) { if (value == null) { log.trace("Attempting to build an index with a null value, skipping."); return; } try { for (Index<K, V, ? extends Comparable> index : indexSpec) { String indexName = index.getName().get(); Map<Comparable, Map<K, V>> secondaryIndex = secondaryIndexes.get(indexName); for (Comparable indexKey : index.getMultiValueIndexFunction().apply(key, value)) { Map<K, V> slot = secondaryIndex.get(indexKey); if (slot != null) { slot.remove(key, value); } } } } catch (Exception e) { log.error("Received an exception while computing the index. " + "This is most likely an issue with the client's indexing function. {}", e); clearIndex(); throw e; } }

Target:
protected void unmapSecondaryIndexes(K key, V value) { if (value == null) { log.warn("Attempting to build an index with a null value, skipping."); return; } try { for (Index<K, V, ? extends Comparable> index : indexSpec) { String indexName = index.getName().get(); Map<Comparable, Map<K, V>> secondaryIndex = secondaryIndexes.get(indexName); for (Comparable indexKey : index.getMultiValueIndexFunction().apply(key, value)) { Map<K, V> slot = secondaryIndex.get(indexKey); if (slot != null) { slot.remove(key, value); } } } } catch (Exception e) { log.error("Received an exception while computing the index. " + "This is most likely an issue with the client's indexing function. {}", e); clearIndex(); throw e; } }
Source:
public String sitemap() { List<String> urls = new ArrayList<>(); addToolPaths(urls); addBioWorkflowPaths(urls); addOrganizationAndCollectionPaths(urls); Collections.sort(urls); return String.join(System.lineSeparator(), urls); }

Target:
public String sitemap() { List<String> urls = new ArrayList<>(); urls.addAll(getToolPaths()); urls.addAll(getBioWorkflowPaths()); urls.addAll(getOrganizationAndCollectionPaths()); Collections.sort(urls); return String.join(System.lineSeparator(), urls); }
Source:
public void next() { if (currentStation != null) new GetRealLinkAndPlayTask(itsContext, currentStation, itsBinder).execute(); }

Target:
public void next() { RadioDroidApp radioDroidApp = (RadioDroidApp) getApplication(); DataRadioStation station = radioDroidApp.getFavouriteManager().getNextById(currentStation.StationUuid); if (station != null) { Utils.Play(radioDroidApp, station, itsContext, false); } }
Source:
public InetSocketAddress getRMHAAddress(String rmId) { String propName = YarnConfiguration.RM_ADDRESS + "." + rmId; String rmAddress = conf.get(propName); if (rmAddress == null) { propName = RM_HOSTNAME_PREFIX + rmId; rmAddress = conf.get(propName); } return NetUtils.createSocketAddr(rmAddress, YarnConfiguration.DEFAULT_RM_PORT, propName); }

Target:
public InetSocketAddress getRMHAAddress(String rmId) { YarnConfiguration yarnConf; if (conf instanceof YarnConfiguration) { yarnConf = (YarnConfiguration)conf; } else { yarnConf = new YarnConfiguration(conf); } yarnConf.set(ConfigUtils.RM_HA_ID, rmId); InetSocketAddress socketAddr = yarnConf.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); yarnConf.unset(ConfigUtils.RM_HA_ID); return socketAddr; }
Source:
private static IconCompat getIcon(@NonNull Context context, final String url, int width, int height, @DrawableRes int defaultIcon) { Bitmap bitmap = null; try { final OkHttpClient client = new OkHttpClient(); final Request request = new Request.Builder() .url(url) .get() .build(); final Response response = client.newCall(request).execute(); if (response.isSuccessful()) { final InputStream inputStream = response.body().byteStream(); bitmap = BitmapFactory.decodeStream(inputStream); final Bitmap thumb = ThumbnailUtils.extractThumbnail(bitmap, width, height); final IconCompat icon = IconCompat.createWithBitmap(createCircleBitmap(thumb)); thumb.recycle(); return icon; } else { return IconCompat.createWithResource(context, defaultIcon); } } catch (Exception e) { return IconCompat.createWithResource(context, defaultIcon); } finally { if (bitmap != null) { bitmap.recycle(); } } }

Target:
private static IconCompat getIcon(@NonNull Context context, final String url, int width, int height, @DrawableRes int defaultIcon) { Bitmap bitmap = ImageLoader.getInstance().loadImageSync(url, new ImageSize(width, height), ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS); return bitmap != null ? IconCompat.createWithBitmap(createCircleBitmap(bitmap, true)) : IconCompat.createWithResource(context, defaultIcon); }
Source:
protected void updateInspect(MenuItem inspect) { boolean visible = mFeatures.isInspectorEnabled(); inspect.setVisible(visible); inspect.setEnabled(visible && mState.stack.peek() != null && mModel.doc != null); }

Target:
protected void updateInspect(MenuItem inspect) { boolean visible = mFeatures.isInspectorEnabled(); inspect.setVisible(visible); inspect.setEnabled(visible && mDirDetails.canInspectDirectory()); }
Source:
public void test_create_table_with_check_fail_on_update() { execute("create table t (id integer primary key, qty integer constraint check_1 check (qty > 0))"); execute("insert into t(id, qty) values(0, 1)"); refresh(); execute("select id, qty from t order by id"); assertEquals(1, response.rowCount()); assertEquals(printedTable(response.rows()), "0| 1\n"); execute("update t set qty = 1 where id = 0 returning id, qty"); assertEquals(1, response.rowCount()); assertEquals(printedTable(response.rows()), "0| 1\n"); expectedException.expectMessage(containsString("Failed CONSTRAINT check_1 CHECK (\"qty\" > 0) and values")); execute("update t set qty = -1 where id = 0"); }

Target:
public void test_create_table_with_check_fail_on_update() { execute("create table t (id integer primary key, qty integer constraint check_1 check (qty > 0))"); execute("insert into t(id, qty) values(0, 1)"); refresh(); execute("select id, qty from t order by id"); assertEquals(printedTable(response.rows()), "0| 1\n"); execute("update t set qty = 1 where id = 0 returning id, qty"); assertEquals(printedTable(response.rows()), "0| 1\n"); expectedException.expectMessage(containsString("Failed CONSTRAINT check_1 CHECK (\"qty\" > 0) and values")); execute("update t set qty = -1 where id = 0"); }
Source:
public void onMissingGamePathEvent(MissingGamePathEvent event) { List<Action> actions = Collections.singletonList( new Action(i18n.get("missingGamePath.locate"), chooseEvent -> eventBus.post(new GameDirectoryChooseEvent())) ); String message = i18n.get("missingGamePath.notification"); notificationService.addNotification(new ImmediateNotification(message, message, Severity.WARN, actions)); }

Target:
public void onMissingGamePathEvent(MissingGamePathEvent event) { List<Action> actions = Collections.singletonList( new Action(i18n.get("missingGamePath.locate"), chooseEvent -> eventBus.post(new GameDirectoryChooseEvent())) ); String notificationText = i18n.get("missingGamePath.notification"); if (event.isImmediateUserActionRequired()) { notificationService.addNotification(new ImmediateNotification(notificationText, notificationText, Severity.WARN, actions)); } else { notificationService.addNotification(new PersistentNotification(notificationText, Severity.WARN, actions)); } }
Source:
public boolean isAbstract() { return typeElement != null && typeElement.getKind().isClass() && typeElement.getModifiers().contains( Modifier.ABSTRACT ); }

Target:
public boolean isAbstract() { return typeElement != null && typeElement.getModifiers().contains( Modifier.ABSTRACT ); }
Source:
public String getPageTitleFromUri(String uriPath, String uriQuery) { String normPath = normalizeUriPath(uriPath); boolean pathWiki = ((normPath.contains("/wiki/") && (! normPath.contains("index."))) || normPath.contains("/w/index.php/")); String titleQueryParam = null; String pageQueryParam = null; uriQuery = (uriQuery == null) ? "" : uriQuery; uriQuery = (uriQuery.startsWith("?")) ? uriQuery.substring(1): uriQuery; final String[] pairs = uriQuery.split("&"); for (String pair : pairs) { final int idx = pair.indexOf("="); final String key = idx > 0 ? pair.substring(0, idx) : pair; if ((key.equals("title") && (titleQueryParam == null))) titleQueryParam = idx > 0 && pair.length() > idx + 1 ? pair.substring(idx + 1).replace("+", "_") : null; if ((key.equals("page")) && (pageQueryParam == null)) pageQueryParam = idx > 0 && pair.length() > idx + 1 ? pair.substring(idx + 1).replace("+", "_") : null; if ((titleQueryParam != null) && (pageQueryParam != null)) break; } String pageTitle = UNKNOWN_PAGE_TITLE_VALUE; if (pathWiki) if (titleQueryParam != null) pageTitle = titleQueryParam; else pageTitle = getPageTitleFromPath(normPath); else if (titleQueryParam != null) pageTitle = titleQueryParam; else if (pageQueryParam != null) pageTitle = pageQueryParam; else if (! normPath.contains("index.")) pageTitle = getPageTitleFromPath(normPath); return PercentDecoder.decode(pageTitle); }

Target:
public String getPageTitleFromUri(String uriPath, String uriQuery) { String normPath = normalizeUriPath(uriPath); boolean pathWiki = ((normPath.contains("/wiki/") && (! normPath.contains("index."))) || normPath.contains("/w/index.php/")); String titleQueryParam = null; String pageQueryParam = null; uriQuery = (uriQuery == null) ? "" : uriQuery; uriQuery = (uriQuery.startsWith("?")) ? uriQuery.substring(1): uriQuery; final String[] pairs = uriQuery.split("&"); for (String pair : pairs) { final int idx = pair.indexOf("="); final String key = idx > 0 ? pair.substring(0, idx) : pair; if ((key.equals("title") && (titleQueryParam == null))) titleQueryParam = idx > 0 && pair.length() > idx + 1 ? pair.substring(idx + 1).replace("+", "_") : null; if ((key.equals("page")) && (pageQueryParam == null)) pageQueryParam = idx > 0 && pair.length() > idx + 1 ? pair.substring(idx + 1).replace("+", "_") : null; if ((titleQueryParam != null) && (pageQueryParam != null)) break; } String pageTitle = UNKNOWN_PAGE_TITLE_VALUE; if (titleQueryParam != null) pageTitle = titleQueryParam; else if (pathWiki) pageTitle = getPageTitleFromPath(normPath); else if (pageQueryParam != null) pageTitle = pageQueryParam; else if (! normPath.contains("index.")) pageTitle = getPageTitleFromPath(normPath); return PercentDecoder.decode(pageTitle); }
Source:
public void shouldShowUser() { when(userDao.find(user.getLogin())).thenReturn(user); controller.show(user); assertEquals(user, result.included().get("user")); }

Target:
public void shouldShowUser() { when(userDao.find(user.getLogin())).thenReturn(user); controller.show(user); assertThat((User) result.included().get("user"), is(user)); }
Source:
protected Warning createWarning(final Matcher matcher) { final String fileName = matcher.group(1); final String lineNumber = matcher.group(2); final String category = matcher.group(3); final String message = matcher.group(4); return createWarning(fileName, Integer.parseInt(lineNumber), category, message); }

Target:
protected Warning createWarning(final Matcher matcher) { final String fileName = matcher.group(1); final String lineNumber = matcher.group(2); final String category = matcher.group(3); final String message = matcher.group(4); return createWarning(fileName, getLineNumber(lineNumber), category, message); }