auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testAddingNewFormat() { settings.put("citation.prioritized_types", "WAV, Adobe PDF, Microsoft Word, RTF, Postscript"); when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext"); when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword"); when(bitstreamFormat3.getMIMEType()).thenReturn("audio/x-wav"); when(bitstream1.getSize()).thenReturn(new Long(100)); when(bitstream2.getSize()).thenReturn(new Long(200)); when(bitstream3.getSize()).thenReturn(new Long(300)); List<Bitstream> toSort = bundle.getBitstreams(); Collections.sort(toSort, new GoogleBitstreamComparator(context, settings)); assertEquals("bitstream3", toSort.get(0).getName()); assertEquals("bitstream2", toSort.get(1).getName()); assertEquals("bitstream1", toSort.get(2).getName()); }

Target:
public void testAddingNewFormat() { settings.put("citation.prioritized_types", "WAV, Adobe PDF, Microsoft Word, RTF, Postscript"); when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext"); when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword"); when(bitstreamFormat3.getMIMEType()).thenReturn("audio/x-wav"); when(bitstream1.getSize()).thenReturn(new Long(300)); when(bitstream2.getSize()).thenReturn(new Long(200)); when(bitstream3.getSize()).thenReturn(new Long(100)); List<Bitstream> toSort = bundle.getBitstreams(); Collections.sort(toSort, new GoogleBitstreamComparator(context, settings)); assertEquals("bitstream3 has the type with the highest priority (thus ignoring its size) and should come first", "bitstream3", toSort.get(0).getName()); assertEquals("bitstream2 has a type with a priority higher than bitstream1 (size is ignored) and should come second", "bitstream2", toSort.get(1).getName()); assertEquals("bitstream1 has a type with the lowest priority in this bundle eventhough it is the largest bitstream and should come last", "bitstream1", toSort.get(2).getName()); }
Source:
protected void configureServlets() { bind(HttpPluginServlet.class); serve("/plugins/*").with(HttpPluginServlet.class); filter("/a/*").through(RequireIdentifiedUserFilter.class); serveRegex("^/(?:a/)?plugins/(.*)?$").with(HttpPluginServlet.class); bind(StartPluginListener.class) .annotatedWith(UniqueAnnotations.create()) .to(HttpPluginServlet.class); bind(ReloadPluginListener.class) .annotatedWith(UniqueAnnotations.create()) .to(HttpPluginServlet.class); bind(ModuleGenerator.class) .to(HttpAutoRegisterModuleGenerator.class); install(new CacheModule() { @Override protected void configure() { cache(PLUGIN_RESOURCES, ResourceKey.class, Resource.class) .maximumWeight(2 << 20) .weigher(ResourceWeigher.class); } }); }

Target:
protected void configureServlets() { bind(HttpPluginServlet.class); serve("/plugins/*").with(HttpPluginServlet.class); serveRegex("^/(?:a/)?plugins/(.*)?$").with(HttpPluginServlet.class); bind(StartPluginListener.class) .annotatedWith(UniqueAnnotations.create()) .to(HttpPluginServlet.class); bind(ReloadPluginListener.class) .annotatedWith(UniqueAnnotations.create()) .to(HttpPluginServlet.class); bind(ModuleGenerator.class) .to(HttpAutoRegisterModuleGenerator.class); install(new CacheModule() { @Override protected void configure() { cache(PLUGIN_RESOURCES, ResourceKey.class, Resource.class) .maximumWeight(2 << 20) .weigher(ResourceWeigher.class); } }); }
Source:
public List<Integer> queryMonthlyMetrics(String targetType, String targetId, String name, LocalDate from, LocalDate to) { List<Integer> result = new ArrayList<>(); LocalDate date = from; while (!date.isAfter(to)) { result.add(queryMetric(getMonthlyMetricType(), targetType, targetId, name, date.getYear(), date.getMonthValue(), null)); date = date.plusMonths(1); } return result; }

Target:
public List<Integer> queryMonthlyMetrics(String targetType, String targetId, String name, LocalDate from, LocalDate to) { List<Integer> result = new ArrayList<>(); LocalDate date = from; AtomicInteger limit = new AtomicInteger(MAX_MONTHLY_METRICS); while (!date.isAfter(to) && limit.decrementAndGet() > 0) { result.add(queryMetric(getMonthlyMetricType(), targetType, targetId, name, date.getYear(), date.getMonthValue(), null)); date = date.plusMonths(1); } return result; }
Source:
public void onStart() { super.onStart(); ((AlertDialog) getDialog()).getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { submit(getEnteredEmail()); } }); }

Target:
public void onStart() { super.onStart(); ((AlertDialog) getDialog()).getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { submit(editText.getText().toString().trim()); } }); }
Source:
public void changeDiffPreferences(final AccountDiffPreference diffPref, AsyncCallback<VoidResult> callback) { run(callback, new Action<VoidResult>(){ public VoidResult run(ReviewDb db) throws OrmException, Failure, NoSuchProjectException, NoSuchGroupException { Id accountId = getAccountId(); diffPref.setAccountId(accountId); final AccountDiffPreference p = db.accountDiffPreferences().get(accountId); if (p == null) { db.accountDiffPreferences().insert(Collections.singleton(diffPref)); } else { db.accountDiffPreferences().update(Collections.singleton(diffPref)); } return VoidResult.INSTANCE; } }); }

Target:
public void changeDiffPreferences(final AccountDiffPreference diffPref, AsyncCallback<VoidResult> callback) { run(callback, new Action<VoidResult>(){ public VoidResult run(ReviewDb db) throws OrmException { Account.Id accountId = getAccountId(); if (!diffPref.getAccountId().equals(getAccountId())) { throw new IllegalArgumentException("diffPref.getAccountId() " + diffPref.getAccountId() + " doesn't match" + "the accountId of the signed in user " + getAccountId()); } db.accountDiffPreferences().upsert(Collections.singleton(diffPref)); return VoidResult.INSTANCE; } }); }
Source:
void setUpPatchSetNav(JsArray<RevisionInfo> list, DiffInfo.FileMeta meta) { InlineHyperlink baseLink = null; InlineHyperlink selectedLink = null; if (sideA) { baseLink = createLink(PatchUtil.C.patchBase(), null); linkPanel.add(baseLink); } if (meta == null) { emptyFile = true; } for (int i = 0; i < list.length(); i++) { RevisionInfo r = list.get(i); InlineHyperlink link = createLink( String.valueOf(r._number()), new PatchSet.Id(changeId, r._number())); linkPanel.add(link); if (revision != null && r._number() == revision.get()) { selectedLink = link; } } if (selectedLink != null) { selectedLink.setStyleName(style.selected()); } else if (sideA) { baseLink.setStyleName(style.selected()); } Anchor downloadLink = createDownloadLink(); if (downloadLink != null) { linkPanel.add(downloadLink); } }

Target:
void setUpPatchSetNav(JsArray<RevisionInfo> list, DiffInfo.FileMeta meta) { InlineHyperlink baseLink = null; InlineHyperlink selectedLink = null; if (sideA) { baseLink = createLink(PatchUtil.C.patchBase(), null); linkPanel.add(baseLink); } for (int i = 0; i < list.length(); i++) { RevisionInfo r = list.get(i); InlineHyperlink link = createLink( String.valueOf(r._number()), new PatchSet.Id(changeId, r._number())); linkPanel.add(link); if (revision != null && r._number() == revision.get()) { selectedLink = link; } } if (selectedLink != null) { selectedLink.setStyleName(style.selected()); } else if (sideA) { baseLink.setStyleName(style.selected()); } if (meta != null && !Patch.COMMIT_MSG.equals(path)) { linkPanel.add(createDownloadLink()); } }
Source:
private File consumeFileUpload(Representation entity) { File uploadedFile = null; final DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(UPLOAD_THRESHOLD); final RestletFileUpload fileUploadUtil = new RestletFileUpload(factory); try { final RepresentationContext context = new RepresentationContext(entity); final FileItemIterator iterator = fileUploadUtil.getItemIterator(context); while (iterator.hasNext()) { final FileItemStream fis = iterator.next(); if (UPLOAD_FILE_KEY.equals(fis.getFieldName())) { uploadedFile = File.createTempFile(UUID.randomUUID().toString(), ".tmp"); uploadedFile.deleteOnExit(); try (FileOutputStream fos = new FileOutputStream(uploadedFile)) { ByteUtils.write(fis.openStream(), fos); fos.flush(); } break; } } } catch (FileUploadException | IOException ex) { throw new RuntimeException("Failed to upload and process file", ex); } return uploadedFile; }

Target:
private File consumeFileUpload(Representation entity) { File uploadedFile = null; final DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(UPLOAD_THRESHOLD); final RestletFileUpload fileUploadUtil = new RestletFileUpload(factory); try { final RepresentationContext context = new RepresentationContext(entity); final FileItemIterator iterator = fileUploadUtil.getItemIterator(context); while (iterator.hasNext()) { final FileItemStream fis = iterator.next(); if (UPLOAD_FILE_KEY.equals(fis.getFieldName())) { Preconditions.checkState(uploadedFile == null, FILE_UPLOAD_ERROR_TMPL, UPLOAD_FILE_KEY); uploadedFile = File.createTempFile("geogig-" + UPLOAD_FILE_KEY + "-", ".tmp"); uploadedFile.deleteOnExit(); try (FileOutputStream fos = new FileOutputStream(uploadedFile)) { ByteUtils.write(fis.openStream(), fos); fos.flush(); } } } Preconditions.checkNotNull(uploadedFile, FILE_UPLOAD_ERROR_TMPL, UPLOAD_FILE_KEY); } catch (Exception ex) { if (uploadedFile != null) { uploadedFile.delete(); } uploadedFile = null; } return uploadedFile; }
Source:
public boolean filter(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { System.out.println(""); MDC.put("X-Request-Id", UUID.randomUUID().toString()); return true; }

Target:
public boolean filter(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { MDC.put("X-Request-Id", UUID.randomUUID().toString()); return true; }
Source:
private void testColumnStats(String schema, TpchTable<?> table, TpchColumn<?> column, Constraint<ColumnHandle> constraint, ColumnStatistics expected) { TpchTableHandle tableHandle = tpchMetadata.getTableHandle(session, new SchemaTableName(schema, table.getTableName())); TableStatistics tableStatistics = tpchMetadata.getTableStatistics(session, tableHandle, constraint); ColumnHandle columnHandle = tpchMetadata.getColumnHandles(session, tableHandle).get(column.getSimplifiedColumnName()); ColumnStatistics actual = tableStatistics.getColumnStatistics().get(columnHandle); EstimateAssertion estimateAssertion = new EstimateAssertion(TOLERANCE); estimateAssertion.assertClose( actual.getOnlyRangeColumnStatistics().getDistinctValuesCount(), expected.getOnlyRangeColumnStatistics().getDistinctValuesCount(), "distinctValuesCount"); estimateAssertion.assertClose( actual.getOnlyRangeColumnStatistics().getDataSize(), expected.getOnlyRangeColumnStatistics().getDataSize(), "dataSize"); estimateAssertion.assertClose( actual.getNullsFraction(), expected.getNullsFraction(), "nullsFraction"); estimateAssertion.assertClose( actual.getOnlyRangeColumnStatistics().getLowValue(), expected.getOnlyRangeColumnStatistics().getLowValue(), "lowValue"); estimateAssertion.assertClose( actual.getOnlyRangeColumnStatistics().getHighValue(), expected.getOnlyRangeColumnStatistics().getHighValue(), "highValue"); }

Target:
private void testColumnStats(String schema, TpchTable<?> table, TpchColumn<?> column, Constraint<ColumnHandle> constraint, ColumnStatistics expected) { TpchTableHandle tableHandle = tpchMetadata.getTableHandle(session, new SchemaTableName(schema, table.getTableName())); TableStatistics tableStatistics = tpchMetadata.getTableStatistics(session, tableHandle, constraint); ColumnHandle columnHandle = tpchMetadata.getColumnHandles(session, tableHandle).get(column.getSimplifiedColumnName()); ColumnStatistics actual = tableStatistics.getColumnStatistics().get(columnHandle); EstimateAssertion estimateAssertion = new EstimateAssertion(TOLERANCE); RangeColumnStatistics actualRange = actual.getOnlyRangeColumnStatistics(); RangeColumnStatistics expectedRange = expected.getOnlyRangeColumnStatistics(); estimateAssertion.assertClose(actualRange.getDistinctValuesCount(), expectedRange.getDistinctValuesCount(), "distinctValuesCount"); estimateAssertion.assertClose(actualRange.getDataSize(), expectedRange.getDataSize(), "dataSize"); estimateAssertion.assertClose(actual.getNullsFraction(), expected.getNullsFraction(), "nullsFraction"); estimateAssertion.assertClose(actualRange.getLowValue(), expectedRange.getLowValue(), "lowValue"); estimateAssertion.assertClose(actualRange.getHighValue(), expectedRange.getHighValue(), "highValue"); }
Source:
public void testTextPlainException() { Exception decode = decode(MediaType.TEXT_PLAIN, 42, "errorbody"); assertThat(decode, is(instanceOf(RuntimeException.class))); assertThat(decode.getMessage(), is("Error 42. Reason: reason. Body:\nerrorbody")); }

Target:
public void testTextPlainException() { Exception decode = decode(MediaType.TEXT_PLAIN, STATUS_42, "errorbody"); assertThat(decode, is(instanceOf(RuntimeException.class))); assertThat(decode.getMessage(), is("Error 42. Reason: reason. Body:\nerrorbody")); }
Source:
public int getOffset(int x, int y, int[] trailing) { checkLayout(); NSAutoreleasePool pool = null; if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); try { computeRuns(); if (trailing != null && trailing.length < 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); int length = text.length(); if (length == 0) return 0; NSPoint pt = new NSPoint(); pt.x = x; pt.y = y; double partialFraction = new double [1]; long glyphIndex = layoutManager.glyphIndexForPoint(pt, textContainer, partialFraction); long charOffset = layoutManager.characterIndexForGlyphAtIndex(glyphIndex); if (textStorage.string().characterAtIndex(charOffset) == '\n') charOffset--; int offset = (int) charOffset; offset = Math.min(untranslateOffset(offset), length - 1); if (trailing != null) { trailing[0] = Math.round((float) partialFraction[0]); if (partialFraction[0] >= 0.5) { char ch = text.charAt(offset); if (0xD800 <= ch && ch <= 0xDBFF) { if (offset + 1 < length) { ch = text.charAt(offset + 1); if (0xDC00 <= ch && ch <= 0xDFFF) { trailing[0]++; } } } } } return offset; } finally { if (pool != null) pool.release(); } }

Target:
public int getOffset(int x, int y, int[] trailing) { checkLayout(); NSAutoreleasePool pool = null; if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); try { computeRuns(); if (trailing != null && trailing.length < 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); int length = text.length(); if (length == 0) return 0; NSPoint pt = new NSPoint(); pt.x = x; pt.y = y - getVerticalIndent(); double partialFraction = new double [1]; long glyphIndex = layoutManager.glyphIndexForPoint(pt, textContainer, partialFraction); long charOffset = layoutManager.characterIndexForGlyphAtIndex(glyphIndex); if (textStorage.string().characterAtIndex(charOffset) == '\n') charOffset--; int offset = (int) charOffset; offset = Math.min(untranslateOffset(offset), length - 1); if (trailing != null) { trailing[0] = Math.round((float) partialFraction[0]); if (partialFraction[0] >= 0.5) { char ch = text.charAt(offset); if (0xD800 <= ch && ch <= 0xDBFF) { if (offset + 1 < length) { ch = text.charAt(offset + 1); if (0xDC00 <= ch && ch <= 0xDFFF) { trailing[0]++; } } } } } return offset; } finally { if (pool != null) pool.release(); } }
Source:
public void init() throws IndyLifecycleException { if ( System.getProperty( FORKJOINPOOL_COMMON_PARALLELISM ) == null ) { if ( config.getForkJoinPoolCommonParallelism() > 0 ) { String value = new Integer( config.getForkJoinPoolCommonParallelism() ).toString(); System.setProperty( FORKJOINPOOL_COMMON_PARALLELISM, value ); logger.info( "Set {}={}", FORKJOINPOOL_COMMON_PARALLELISM, value ); } } }

Target:
public void init() throws IndyLifecycleException { Integer commonPoolSize = null; if ( System.getProperty( FORKJOINPOOL_COMMON_PARALLELISM ) != null ) { commonPoolSize = Integer.parseInt( System.getProperty( FORKJOINPOOL_COMMON_PARALLELISM ) ); } else if ( config.getForkJoinPoolCommonParallelism() > 0 ) { commonPoolSize = config.getForkJoinPoolCommonParallelism(); System.setProperty( FORKJOINPOOL_COMMON_PARALLELISM, commonPoolSize.toString() ); } if ( commonPoolSize != null ) { logger.info( "Set {}={}", FORKJOINPOOL_COMMON_PARALLELISM, commonPoolSize ); } }
Source:
void updateChain(DataInputStream din, DataOutputStream dout) throws Exception { String username = CoreNodeUtils.deserializeString(din); byte[] raw = Serialize.deserializeByteArray(din, 2 * UserPublicKeyLink.MAX_SIZE); List<UserPublicKeyLink> res = ((CborObject.CborList)CborObject.fromByteArray(raw)).map(UserPublicKeyLink::fromCbor); ProofOfWork proof = ProofOfWork.fromCbor(CborObject.fromByteArray(Serialize.deserializeByteArray(din, 100))); boolean isAdded = coreNode.updateChain(username, res, proof).get(); dout.writeBoolean(isAdded); }

Target:
void updateChain(DataInputStream din, DataOutputStream dout) throws Exception { String username = CoreNodeUtils.deserializeString(din); byte[] raw = Serialize.deserializeByteArray(din, 2 * UserPublicKeyLink.MAX_SIZE); List<UserPublicKeyLink> res = ((CborObject.CborList)CborObject.fromByteArray(raw)).map(UserPublicKeyLink::fromCbor); ProofOfWork proof = ProofOfWork.fromCbor(CborObject.fromByteArray(Serialize.deserializeByteArray(din, 100))); Optional<RequiredDifficulty> err = coreNode.updateChain(username, res, proof).get(); dout.writeBoolean(err.isEmpty()); if (err.isPresent()) dout.writeInt(err.get().requiredDifficulty); }
Source:
public static String getData(String uuid, Integer major, Integer minor, String companyCode, Integer txPower, boolean LELimited, boolean LEGeneral, boolean BR_EDRSupported, boolean LE_BRController, boolean LE_BRHost) { String data = ""; String flags = "000"; flags += Integer.toString(LE_BRHost ? 1 : 0); flags += Integer.toString(LE_BRController ? 1 : 0); flags += Integer.toString(BR_EDRSupported ? 1 : 0); flags += Integer.toString(LEGeneral ? 1 : 0); flags += Integer.toString(LELimited ? 1 : 0); String flagsString = Integer.toHexString(Integer.parseInt(flags, 2)); if (flagsString.length() == 1) { flagsString = "0" + flagsString; } txPower = checkRange(txPower, TX_POWER_MAX, TX_POWER_MIN); String txPowerString = Integer.toHexString(txPower & 0xFF); if (txPowerString.length() == 1) { txPowerString = "0" + txPowerString; } data += PKT_BYTES_NUMBER; data += AD_BYTES_NUMBER; data += AD_FLAG; data += flagsString; data += PAYLOAD_BYTES_NUMBER; data += MANUFACTURER_AD; data += companyCode.substring(2, 4); data += companyCode.substring(0, 2); data += BEACON_ID; if (uuid.length() == 32) { data += checkHex(uuid.toString(), UUID_DEFAULT); } else { data += UUID_DEFAULT; } data += to2BytesHex(checkRange(major, MAJOR_MAX, MAJOR_MIN)); data += to2BytesHex(checkRange(minor, MINOR_MAX, MINOR_MIN)); data += txPowerString; data += "00"; return data; }

Target:
public static String getData(String uuid, Integer major, Integer minor, String companyCode, Integer txPower, boolean LELimited, boolean LEGeneral, boolean BR_EDRSupported, boolean LE_BRController, boolean LE_BRHost) { String data = ""; String flags = "000"; flags += Integer.toString(LE_BRHost ? 1 : 0); flags += Integer.toString(LE_BRController ? 1 : 0); flags += Integer.toString(BR_EDRSupported ? 1 : 0); flags += Integer.toString(LEGeneral ? 1 : 0); flags += Integer.toString(LELimited ? 1 : 0); String flagsString = Integer.toHexString(Integer.parseInt(flags, 2)); if (flagsString.length() == 1) { flagsString = "0" + flagsString; } txPower = inSetRange(txPower, TX_POWER_MAX, TX_POWER_MIN); String txPowerString = Integer.toHexString(txPower & 0xFF); if (txPowerString.length() == 1) { txPowerString = "0" + txPowerString; } data += PKT_BYTES_NUMBER; data += AD_BYTES_NUMBER; data += AD_FLAG; data += flagsString; data += PAYLOAD_BYTES_NUMBER; data += MANUFACTURER_AD; data += companyCode.substring(2, 4); data += companyCode.substring(0, 2); data += BEACON_ID; if (uuid.length() == 32) { data += inSetHex(uuid.toString(), UUID_DEFAULT); } else { data += UUID_DEFAULT; } data += to2BytesHex(inSetRange(major, MAJOR_MAX, MAJOR_MIN)); data += to2BytesHex(inSetRange(minor, MINOR_MAX, MINOR_MIN)); data += txPowerString; data += "00"; return data; }
Source:
public HttpHeaders getHeaders() { HttpHeaders headers = new HttpHeaders(); return headers; }

Target:
public HttpHeaders getHeaders() { return this.headers; }
Source:
public synchronized void flush() { for (CompletableFuture<Void> f : _pendingFutures) { try { f.get(); } catch (InterruptedException | ExecutionException e) { String msg = "Flush failed with error"; LOG.error(msg, e); throw new DatastreamRuntimeException(msg, e); } } _pendingFutures.clear(); }

Target:
public synchronized void flush() { if (_unrecoverableError != null) { throw _unrecoverableError; } for (CompletableFuture<Void> f : _pendingFutures) { try { f.get(); } catch (InterruptedException | ExecutionException e) { String msg = "Flush failed with error"; LOG.error(msg, e); throw new DatastreamRuntimeException(msg, e); } } _pendingFutures.clear(); }
Source:
public static File findLatestBuildToolsFolder(File buildToolsHome) { File[] buildToolsVersions = buildToolsHome.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.getName().matches("\\d+\\.\\d+\\.\\d+$"); } }); if (buildToolsVersions == null || buildToolsVersions.length == 0) { throw new SelendroidException("No valid build-tools versions found in " + buildToolsHome.getName()); } Arrays.sort( buildToolsVersions, new Comparator<File>() { @Override public int compare(File f1, File f2) { String[] v1 = f1.getName().split("\\."); String[] v2 = f2.getName().split("\\."); for (int i = 0; i < 3; i++) { int curV1 = Integer.parseInt(v1[i]); int curV2 = Integer.parseInt(v2[i]); if (curV1 != curV2) { return Integer.compare(curV1, curV2); } } return 0; } }); return buildToolsVersions[buildToolsVersions.length - 1].getAbsoluteFile(); }

Target:
public static File findLatestBuildToolsFolder(File buildToolsHome) { File[] buildToolsVersions = buildToolsHome.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.getName().matches(BUILD_TOOLS_VERSION_REGEX); } }); if (buildToolsVersions == null || buildToolsVersions.length == 0) { throw new SelendroidException("No valid build-tools versions found in " + buildToolsHome.getName()); } Pattern pattern = Pattern.compile(BUILD_TOOLS_VERSION_REGEX); Arrays.sort( buildToolsVersions, new Comparator<File>() { @Override public int compare(File f1, File f2) { Matcher m1 = pattern.matcher(f1.getName()); Matcher m2 = pattern.matcher(f2.getName()); m1.find(); m2.find(); for (int i = 1; i <= 3; i++) { int compare = Integer.compare( Integer.parseInt(m1.group(i)), Integer.parseInt(m2.group(i))); if (compare != 0) { return compare; } } return 0; } }); return buildToolsVersions[buildToolsVersions.length - 1].getAbsoluteFile(); }
Source:
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { TileEntity tileentity = world.getTileEntity(pos); if (tileentity instanceof TileEntityEngineeringTable) { IItemHandler itemHandler = tileentity.getCapability(ITEM_HANDLER_CAPABILITY, null); assert itemHandler != null; InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemHandler.getStackInSlot(0)); } super.breakBlock(world, pos, state); }

Target:
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { TileEntity tileentity = world.getTileEntity(pos); IItemHandler itemHandler = tileentity.getCapability(ITEM_HANDLER_CAPABILITY, null); if (itemHandler != null) { InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemHandler.getStackInSlot(0)); } super.breakBlock(world, pos, state); }
Source:
public int getLineVerticalIndent(int index) { checkWidget(); if (index < 0 || index > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } return isListening(ST.LineGetStyle) ? 0 : renderer.getLineVerticalIndent(index, verticalIndent); }

Target:
public int getLineVerticalIndent(int index) { checkWidget(); if (index < 0 || index > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } return isListening(ST.LineGetStyle) ? 0 : renderer.getLineVerticalIndent(index); }
Source:
public ListenableFuture<?> index(ChangeData cd) { return executor.submit(indexTask(cd)); }

Target:
public ListenableFuture<?> index(ChangeData cd) { return executor != null ? executor.submit(indexTask(cd)) : null; }
Source:
void renameColumn(CharSequence name, CharSequence newName) { int index = columnNameIndexMap.keyIndex(name); int columnIndex = columnNameIndexMap.valueAt(index); columnNameIndexMap.removeAt(index); columnNameIndexMap.putAt(columnNameIndexMap.keyIndex(newName), newName, columnIndex); TableColumnMetadata oldColumnMetadata = columnMetadata.get(columnIndex); TableColumnMetadata newColumnMetadata = new TableColumnMetadata(Chars.toString(newName), oldColumnMetadata.getType(), oldColumnMetadata.isIndexed(), oldColumnMetadata.getIndexValueBlockCapacity(), oldColumnMetadata.isSymbolTableStatic()); columnMetadata.setQuick(columnIndex, newColumnMetadata); }

Target:
void renameColumn(CharSequence name, CharSequence newName) { int index = columnNameIndexMap.keyIndex(name); int columnIndex = columnNameIndexMap.valueAt(index); columnNameIndexMap.removeAt(index); columnNameIndexMap.putAt(columnNameIndexMap.keyIndex(newName), newName, columnIndex); TableColumnMetadata oldColumnMetadata = columnMetadata.get(columnIndex); oldColumnMetadata.setName(Chars.toString(newName)); }
Source:
public long streamMessagesForRecording() { try (ExclusivePublication publication = aeron.addExclusivePublication(CHANNEL, STREAM_ID)) { final IdleStrategy idleStrategy = YieldingIdleStrategy.INSTANCE; while (!publication.isConnected()) { idleStrategy.idle(); } final long start = System.nanoTime(); final UnsafeBuffer buffer = this.buffer; for (long i = 0; i < NUMBER_OF_MESSAGES; i++) { buffer.putLong(0, i); idleStrategy.reset(); while (publication.offer(buffer, 0, MESSAGE_LENGTH) < 0) { idleStrategy.idle(); } } final long stopPosition = publication.position(); final CountersReader counters = aeron.countersReader(); final int counterId = RecordingPos.findCounterIdBySession(counters, publication.sessionId()); idleStrategy.reset(); while (counters.getCounterValue(counterId) < stopPosition) { idleStrategy.idle(); } final long durationMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); final double dataRate = (stopPosition * 1000.0d / durationMs) / MEGABYTE; final double recordingMb = stopPosition / MEGABYTE; final long msgRate = (NUMBER_OF_MESSAGES / durationMs) * 1000L; System.out.printf( "Recorded %.02f MB @ %.02f MB/s - %,d msg/sec - %d byte payload + 32 byte header%n", recordingMb, dataRate, msgRate, MESSAGE_LENGTH); return RecordingPos.getRecordingId(counters, counterId); } }

Target:
public long streamMessagesForRecording() { try (ExclusivePublication publication = aeron.addExclusivePublication(CHANNEL, STREAM_ID)) { final IdleStrategy idleStrategy = YieldingIdleStrategy.INSTANCE; while (!publication.isConnected()) { idleStrategy.idle(); } final long startNs = System.nanoTime(); final UnsafeBuffer buffer = this.buffer; for (long i = 0; i < NUMBER_OF_MESSAGES; i++) { buffer.putLong(0, i); idleStrategy.reset(); while (publication.offer(buffer, 0, MESSAGE_LENGTH) < 0) { idleStrategy.idle(); } } final long stopPosition = publication.position(); final CountersReader counters = aeron.countersReader(); final int counterId = RecordingPos.findCounterIdBySession(counters, publication.sessionId()); idleStrategy.reset(); while (counters.getCounterValue(counterId) < stopPosition) { idleStrategy.idle(); } final long durationMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs); final double dataRate = (stopPosition * 1000.0d / durationMs) / MEGABYTE; final double recordingMb = stopPosition / MEGABYTE; final long msgRate = (NUMBER_OF_MESSAGES / durationMs) * 1000L; System.out.printf( "Recorded %.02f MB @ %.02f MB/s - %,d msg/sec - %d byte payload + 32 byte header%n", recordingMb, dataRate, msgRate, MESSAGE_LENGTH); return RecordingPos.getRecordingId(counters, counterId); } }
Source:
public void start(BundleContext context) throws Exception { final Set<Bundle> bundlesToRefresh = Arrays.stream(context.getBundles()).filter(b -> b.getSymbolicName().contains("theme")).collect(Collectors.toSet()); if (!bundlesToRefresh.isEmpty()) { Bundle systemBundle = context.getBundle(0); FrameworkWiring frameworkWiring = systemBundle.adapt(FrameworkWiring.class); frameworkWiring.refreshBundles(bundlesToRefresh); } }

Target:
public void start(BundleContext context) throws Exception { final Set<Bundle> unresolvedVaadinThemeFragments = getUnresolvedVaadinThemeFragments(context); if (!unresolvedVaadinThemeFragments.isEmpty()) { final Bundle vaadinThemeHostBundle = getVaadinThemeHostbundle(context); final List<Bundle> bundlesToRefresh = new ArrayList<>(); bundlesToRefresh.add(vaadinThemeHostBundle); final Bundle systemBundle = context.getBundle(0); FrameworkWiring frameworkWiring = systemBundle.adapt(FrameworkWiring.class); frameworkWiring.refreshBundles(bundlesToRefresh); } }
Source:
public HttpRequest signGetBlob(String container, String name, long timeInSeconds) { System.out.println("Method signGetBlob is called " + container + " , " + name + " , " + timeInSeconds); checkNotNull(container, "container"); checkNotNull(name, "name"); return sign("GET", container, name, null, timeInSeconds, null, null); }

Target:
public HttpRequest signGetBlob(String container, String name, long timeInSeconds) { checkNotNull(container, "container"); checkNotNull(name, "name"); return sign("GET", container, name, null, timeInSeconds, null, null); }
Source:
public void reset() { super.write(new byte[] {0x72, 0x65, 0x73, 0x65, 0x74, 0x65, 0x6e, 0x63}); }

Target:
public void reset() { super.write(CANEncoder.RESET_ENCODER_BYTE_SEQUENCE); }
Source:
static InputStream getDecompressorStream(InputStream stream) throws IOException { BufferedInputStream buff = new BufferedInputStream(stream); int maxLen = Arrays.stream(ClientCompressor.values()).max( Comparator.comparingInt(x -> x.magic.length)).get().magic.length; buff.mark(maxLen); byte[] headerBuffer = new byte[maxLen]; int len = buff.read(headerBuffer); buff.reset(); Optional<ClientCompressor> compressor = Arrays.stream(ClientCompressor.values()).filter(t -> matchMagic(t, headerBuffer, len)).findFirst(); return compressor.map(t -> { try { return t.decompressorClass.getConstructor(InputStream.class).newInstance(buff); } catch (Exception exc) { throw new RuntimeException(exc); } }).orElseGet(() -> buff); }

Target:
static InputStream getDecompressorStream(InputStream stream) throws IOException { BufferedInputStream buff = new BufferedInputStream(stream); List<ClientCompressor> compressors = Arrays.stream(ClientCompressor.values()).sorted( Comparator.comparingInt((ClientCompressor t) -> t.magic.length).reversed() ).collect( Collectors.toList()); int maxLen = compressors.get(0).magic.length; buff.mark(maxLen); byte[] headerBuffer = new byte[maxLen]; int len = ByteStreams.read(buff, headerBuffer, 0, maxLen); buff.reset(); ClientCompressor compressor = compressors.stream().filter( t -> t.magic.length <= len && t.matchMagic(headerBuffer, len)).collect(MoreCollectors.onlyElement()); return compressor.decompressorCreator.apply(buff); }
Source:
private static ContentIdentifier create(EntityType type, String uri, String id, Integer seriesNumber) { switch (type) { case BRAND: return new BrandIdentifier(uri, id); case EPISODE: return new EpisodeIdentifier(uri, id); case FILM: return new FilmIdentifier(uri, id); case ITEM: case SONG: return new ItemIdentifier(uri, id); case PERSON: return new PersonIdentifier(uri, id); case SERIES: return new SeriesIdentifier(uri, seriesNumber, id); default: throw new RuntimeException("Can't createDefault content identifier for " + uri); } }

Target:
private static ContentIdentifier create(EntityType type, String uri, String id, Integer seriesNumber) { switch (type) { case BRAND: return new BrandIdentifier(uri, id); case EPISODE: return new EpisodeIdentifier(uri, id); case FILM: return new FilmIdentifier(uri, id); case ITEM: case SONG: return new ItemIdentifier(uri, id); case PERSON: return new PersonIdentifier(uri, id); case SERIES: return new SeriesIdentifier(uri, seriesNumber, id); default: throw new RuntimeException("Can't create content identifier for " + uri); } }
Source:
private int removeNodeElementsToSatisfyCharsLimit(ArrayNode node, int needToRemoveCharsNumber) { int removedCharsNumber = 0; while (node.size() > 0 && needToRemoveCharsNumber > removedCharsNumber) { final int lengthBeforeRemove = node.toString().length(); final int removeUntil = node.size() / 2; for (int removeAt = node.size() - 1; removeAt >= removeUntil; removeAt--) { node.remove(removeAt); } final int lengthAfterRemove = node.toString().length(); removedCharsNumber += lengthBeforeRemove - lengthAfterRemove; } return removedCharsNumber; }

Target:
private static int removeNodeElementsToSatisfyCharsLimit(ArrayNode node, int needToRemoveCharsNumber) { int removedCharsNumber = 0; while (node.size() > 0 && needToRemoveCharsNumber > removedCharsNumber) { final int lengthBeforeRemove = node.toString().length(); final int removeUntil = node.size() / 2; for (int removeAt = node.size() - 1; removeAt >= removeUntil; removeAt--) { node.remove(removeAt); } final int lengthAfterRemove = node.toString().length(); removedCharsNumber += lengthBeforeRemove - lengthAfterRemove; } return removedCharsNumber; }
Source:
private void setUsernamePasswordVisibility(int type) { if (requiresUsernamePassword(type)) { mView.findViewById(R.id.userpass).setVisibility(View.VISIBLE); } else { mView.findViewById(R.id.userpass).setVisibility(View.GONE); } }

Target:
private void setUsernamePasswordVisibility(int type) { mView.findViewById(R.id.userpass).setVisibility( requiresUsernamePassword(type) ? View.VISIBLE : View.GONE); }
Source:
public Response sendRequest(Request request) throws IOException { if (request == null) { throw new IllegalArgumentException(); } if (!mConnectionStatus.working()) { throw new IOException("Not connected to server"); } mSender.print(request.message()); mSender.flush(); Response response = null; String rawResponse = mReceiver.readLine(); if (isValid(rawResponse)) { response = new Response(rawResponse); } else { throw new IOException("Invalid response"); } return response; }

Target:
public Response sendRequest(Request request) throws IOException { Objects.requireNonNull(request); if (!mConnectionStatus.working()) { throw new IOException("Not connected to server"); } mSender.print(request.message()); mSender.flush(); Response response = null; String rawResponse = mReceiver.readLine(); if (isValid(rawResponse)) { response = new Response(rawResponse); } else { throw new IOException("Invalid response"); } return response; }
Source:
public static PID get(String value) { String id; String qualifier; String componentPath; String repositoryPath; if (value != null && value.startsWith(repository.getFedoraBase())) { repositoryPath = value; String path = value.substring(repository.getFedoraBase().length()); Matcher matcher = RepositoryPathConstants.repositoryPathPattern.matcher(path); if (matcher.matches()) { qualifier = matcher.group(1); componentPath = matcher.group(5); id = matcher.group(3); } else { return null; } } else if (value != null) { Matcher matcher = RepositoryPathConstants.identifierPattern.matcher(value); if (matcher.matches()) { qualifier = matcher.group(2); if (qualifier == null) { qualifier = RepositoryPathConstants.CONTENT_BASE; } id = matcher.group(4); componentPath = matcher.group(6); repositoryPath = getRepositoryPath(id, qualifier, componentPath); } else { return null; } } else { return null; } return new FedoraPID(id, qualifier, componentPath, URI.create(repositoryPath)); }

Target:
public static PID get(String value) { if (value == null) { return null; } String id; String qualifier; String componentPath; String repositoryPath; if (value.startsWith(repository.getFedoraBase())) { repositoryPath = value; String path = value.substring(repository.getFedoraBase().length()); Matcher matcher = RepositoryPathConstants.repositoryPathPattern.matcher(path); if (matcher.matches()) { qualifier = matcher.group(1); componentPath = matcher.group(5); id = matcher.group(3); } else { return null; } } else { Matcher matcher = RepositoryPathConstants.identifierPattern.matcher(value); if (matcher.matches()) { qualifier = matcher.group(2); if (qualifier == null) { qualifier = RepositoryPathConstants.CONTENT_BASE; } id = matcher.group(4); componentPath = matcher.group(6); repositoryPath = getRepositoryPath(id, qualifier, componentPath); } else { return null; } } return new FedoraPID(id, qualifier, componentPath, URI.create(repositoryPath)); }
Source:
void collectTypedefs() { for (TypedVar var : compiler.getTopScope().getAllSymbols()) { JSType type = var.getType(); if (type == null || !isTypedef(type) || var.getName().startsWith("window.") || isPrivate(var.getJSDocInfo())) { continue; } JSType realType = compiler.getTypeRegistry().getType(var.getName()); if (realType != null && shouldEmitTypedefByName(realType)) { typedefs.put(realType, var.getName()); } } }

Target:
void collectTypedefs() { for (TypedVar var : compiler.getTopScope().getAllSymbols()) { if (shouldSkipVar(var)) { continue; } JSType type = var.getType(); if (type == null || !isTypedef(type) || var.getName().startsWith("window.") || isPrivate(var.getJSDocInfo())) { continue; } JSType realType = compiler.getTypeRegistry().getType(var.getName()); if (realType != null && shouldEmitTypedefByName(realType) && !typedefs.containsKey(realType)) { typedefs.put(realType, var.getName()); } } }
Source:
private void injectFilter(ServletContext context, Bundle refBundle) { LOGGER.info( "Injecting SecurityJavaSubjectFilter into ID: {}", refBundle.getSymbolicName(), refBundle.getBundleId()); try { SessionCookieConfig sessionCookieConfig = context.getSessionCookieConfig(); sessionCookieConfig.setPath("/"); sessionCookieConfig.setSecure(true); sessionCookieConfig.setHttpOnly(true); } catch (Exception e) { LOGGER.trace( "Failed trying to set the cookie config path to /. This can usually be ignored", e); } for (Filter filter : filterList) { try { FilterRegistration filterReg = context.addFilter(SECURITY_JAVA_SUBJECT_FILTER, filter); if (filterReg == null) { filterReg = context.getFilterRegistration(SECURITY_JAVA_SUBJECT_FILTER); } else { ((FilterRegistration.Dynamic) filterReg).setAsyncSupported(true); } filterReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, ALL_URLS); } catch (IllegalStateException ise) { LOGGER.error( "Could not inject into because the servlet was already initialized. This means that SecurityJavaSubjectFilter will not be included in {}.", filter.getClass(), refBundle.getSymbolicName(), refBundle.getSymbolicName(), ise); } } }

Target:
private void injectFilter(ServletContext context, Bundle refBundle) { LOGGER.info( "Injecting SecurityJavaSubjectFilter into ID: {}", refBundle.getSymbolicName(), refBundle.getBundleId()); try { SessionCookieConfig sessionCookieConfig = context.getSessionCookieConfig(); sessionCookieConfig.setPath("/"); sessionCookieConfig.setSecure(true); sessionCookieConfig.setHttpOnly(true); } catch (Exception e) { LOGGER.trace( "Failed trying to set the cookie config path to /. This can usually be ignored", e); } for (Filter filter : filterList) { try { FilterRegistration filterReg = context.addFilter(filter.getClass().getName(), filter); if (filterReg == null) { filterReg = context.getFilterRegistration(filter.getClass().getName()); } else { ((FilterRegistration.Dynamic) filterReg).setAsyncSupported(true); } filterReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, ALL_URLS); } catch (IllegalStateException ise) { LOGGER.error( "Could not inject into because the servlet was already initialized. This means that SecurityJavaSubjectFilter will not be included in {}.", filter.getClass(), refBundle.getSymbolicName(), refBundle.getSymbolicName(), ise); } } }
Source:
private void transferBinaries(Resource resc, BinaryTransferSession transferSession) { PID objPid = PIDs.get(resc.toString()); Set<Resource> rescTypes = resc.listProperties(RDF.type).toList().stream() .map(Statement::getResource).collect(toSet()); if (TYPES_ALLOWING_DESC.stream().anyMatch(rescTypes::contains)) { transferModsFile(objPid, resc, transferSession); } if (rescTypes.contains(Cdr.FileObject)) { transferOriginalFile(objPid, resc, transferSession); transferFitsExtract(objPid, resc, transferSession); } else if (objPid.getQualifier().equals(DEPOSIT_RECORD_BASE)) { transferDepositManifests(objPid, resc, transferSession); } Path premisLogPath = getPremisFile(objPid).toPath(); resc.addProperty(CdrDeposit.premisStorageUri, premisLogPath.toUri().toString()); NodeIterator iterator = getChildIterator(resc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); transferBinaries(childResc, transferSession); } } finally { iterator.close(); } }

Target:
private void transferBinaries(Resource resc, BinaryTransferSession transferSession) { PID objPid = PIDs.get(resc.toString()); Set<Resource> rescTypes = resc.listProperties(RDF.type).toList().stream() .map(Statement::getResource).collect(toSet()); if (TYPES_ALLOWING_DESC.stream().anyMatch(rescTypes::contains)) { transferModsFile(objPid, resc, transferSession); } if (rescTypes.contains(Cdr.FileObject)) { transferOriginalFile(objPid, resc, transferSession); transferFitsExtract(objPid, resc, transferSession); } else if (objPid.getQualifier().equals(DEPOSIT_RECORD_BASE)) { transferDepositManifests(objPid, resc, transferSession); } NodeIterator iterator = getChildIterator(resc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); transferBinaries(childResc, transferSession); } } finally { iterator.close(); } }
Source:
public IActionInvokeStatus call() throws Exception { try { final IActionInvoker actionInvoker = resource.getDefaultActionInvoker(); final IAction action = createActionBean( actionClass, actionId ); final Map<String, Serializable> params = deserialize( action, actionParams ); IActionInvokeStatus status = actionInvoker.invokeAction( action, user, params ); if ( status != null && status.getThrowable() == null ) { getLogger().info( Messages.getInstance().getRunningInBgLocallySuccess( action.getClass().getName(), params ), status.getThrowable() ); } else { getLogger().error( Messages.getInstance().getCouldNotInvokeActionLocally( action.getClass().getName(), params ), status.getThrowable() ); } return status; } catch ( final Throwable thr ) { getLogger() .error( Messages.getInstance().getCouldNotInvokeActionLocallyUnexpected( ( StringUtil.isEmpty( actionClass ) ? actionId : actionClass ), actionParams ), thr ); } return null; }

Target:
public IActionInvokeStatus call() throws Exception { try { final IActionInvoker actionInvoker = resource.getDefaultActionInvoker(); final IAction action = createActionBean( actionClass, actionId ); final Map<String, Serializable> params = deserialize( action, actionParams ); IActionInvokeStatus status = actionInvoker.invokeAction( action, user, params ); if ( status != null && status.getThrowable() == null ) { getLogger().info( Messages.getInstance().getRunningInBgLocallySuccess( action.getClass().getName(), params ), status.getThrowable() ); } else { getLogger().error( Messages.getInstance().getCouldNotInvokeActionLocally( action.getClass().getName(), params ), ( status != null ? status.getThrowable() : null ) ); } return status; } catch ( final Throwable thr ) { getLogger() .error( Messages.getInstance().getCouldNotInvokeActionLocallyUnexpected( ( StringUtil.isEmpty( actionClass ) ? actionId : actionClass ), actionParams ), thr ); } return null; }
Source:
public AdHocPlannedStmtBatch plan(String sql, Object[] userParams, boolean singlePartition) throws AdHocPlanningException { List<String> sqlStatements = new ArrayList<>(); AdHocSQLMix mix = AdHocNTBase.processAdHocSQLStmtTypes(sql, sqlStatements); switch (mix) { case EMPTY: throw new AdHocPlanningException("No valid SQL found."); case ALL_DDL: case MIXED: throw new AdHocPlanningException("DDL not supported in stored procedures."); default: break; } if (sqlStatements.size() != 1) { throw new AdHocPlanningException("One statement only in stored procedures."); } sql = sqlStatements.get(0); Object partitionKey = singlePartition ? "1" : null; List<AdHocPlannedStatement> stmts = new ArrayList<>(); AdHocPlannedStatement result = null; result = AdHocNTBase.compileAdHocSQL(m_catalogContext, sql, false, partitionKey, ExplainMode.NONE, userParams); stmts.add(result); return new AdHocPlannedStmtBatch(userParams, stmts, -1, null, null, userParams); }

Target:
public AdHocPlannedStmtBatch plan(String sql, Object[] userParams, boolean singlePartition) throws AdHocPlanningException { List<String> sqlStatements = new ArrayList<>(); AdHocSQLMix mix = AdHocNTBase.processAdHocSQLStmtTypes(sql, sqlStatements); switch (mix) { case EMPTY: throw new AdHocPlanningException("No valid SQL found."); case ALL_DDL: case MIXED: throw new AdHocPlanningException("DDL not supported in stored procedures."); default: break; } if (sqlStatements.size() != 1) { throw new AdHocPlanningException("Only one statement is allowed in stored procedure, but received " + sqlStatements.size()); } sql = sqlStatements.get(0); Object partitionKey = singlePartition ? "1" : null; List<AdHocPlannedStatement> stmts = new ArrayList<>(); AdHocPlannedStatement result = null; result = AdHocNTBase.compileAdHocSQL(m_catalogContext, sql, false, partitionKey, ExplainMode.NONE, false, userParams); stmts.add(result); return new AdHocPlannedStmtBatch(userParams, stmts, -1, null, null, userParams); }
Source:
private void selectCSVFile() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("text/csv"); startActivityForResult(Intent.createChooser(intent, "Open CSV"), ACTIVITY_CHOOSE_FILE); }

Target:
private void selectCSVFile() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("text/csv"); startActivityForResult(Intent.createChooser(intent, getString(R.string.open_csv)), ACTIVITY_CHOOSE_FILE); }
Source:
public boolean realmExists() { return new File(canonicalPath).exists(); }

Target:
boolean realmExists() { return new File(canonicalPath).exists(); }
Source:
public void addSubAttribute(Attribute newSubAttribute) { if (newSubAttribute == null) { throw new IllegalArgumentException(); } subAttributes.put(newSubAttribute.getName(), newSubAttribute); }

Target:
public void addSubAttribute(Attribute newSubAttribute) { if (newSubAttribute == null || PARENT_PATH.equals(newSubAttribute.getName())) { throw new IllegalArgumentException("New attribute cannot be null or equal to the parent path '..'"); } subAttributes.put(newSubAttribute.getName(), newSubAttribute); }
Source:
public static QueryGranularity fromString(String str) { String name = str.toUpperCase(); if(name.equals("ALL")) { return QueryGranularity.ALL; } else if(name.equals("NONE")) { return QueryGranularity.NONE; } else if(CALENDRIC_GRANULARITIES.containsKey(name)) { return new PeriodGranularity(CALENDRIC_GRANULARITIES.get(name), null, null); } return new DurationGranularity(convertValue(str), 0); }

Target:
public static QueryGranularity fromString(String str) { String name = str.toUpperCase(); if(name.equals("ALL")) { return QueryGranularity.ALL; } else if(name.equals("NONE")) { return QueryGranularity.NONE; } else if(CALENDRIC_GRANULARITIES.containsKey(name)) { return CALENDRIC_GRANULARITIES.get(name); } return new DurationGranularity(convertValue(str), 0); }
Source:
public GetSCOTask(WeakReference<AbstractContentNode<?>> weakContentRef, PropertyChangeListener listener) { this.weakNodeRef = weakContentRef; this.listener = listener; }

Target:
GetSCOTask(WeakReference<AbstractContentNode<?>> weakContentRef, PropertyChangeListener listener) { this.weakNodeRef = weakContentRef; this.listener = listener; }
Source:
private PrestoException invalidSubfieldPath() { return new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid subfield path: '%s'", path)); }

Target:
private PrestoException invalidSubfieldPath() { return new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid subfield path: '%s'", this)); }