auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void applyClusteredReadPositionFilter(final M2ArgumentCollection MTAC, final VariantContext vc, final Collection<String> filters) { if (MTAC.ENABLE_CLUSTERED_READ_POSITION_FILTER) { final Double tumorFwdPosMedian = (Double) vc.getAttribute(GATKVCFConstants.MEDIAN_LEFT_OFFSET_KEY); final Double tumorRevPosMedian = (Double) vc.getAttribute(GATKVCFConstants.MEDIAN_RIGHT_OFFSET_KEY); final Double tumorFwdPosMAD = (Double) vc.getAttribute(GATKVCFConstants.MAD_MEDIAN_LEFT_OFFSET_KEY); final Double tumorRevPosMAD = (Double) vc.getAttribute(GATKVCFConstants.MAD_MEDIAN_RIGHT_OFFSET_KEY); if ((tumorFwdPosMedian != null && tumorFwdPosMedian <= MTAC.PIR_MEDIAN_THRESHOLD && tumorFwdPosMAD != null && tumorFwdPosMAD <= MTAC.PIR_MAD_THRESHOLD) || (tumorRevPosMedian != null && tumorRevPosMedian <= MTAC.PIR_MEDIAN_THRESHOLD && tumorRevPosMAD != null && tumorRevPosMAD <= MTAC.PIR_MAD_THRESHOLD)) filters.add(GATKVCFConstants.CLUSTERED_READ_POSITION_FILTER_NAME); } }

Target:
private static void applyClusteredReadPositionFilter(final M2ArgumentCollection MTAC, final VariantContext vc, final Collection<String> filters) { if (MTAC.ENABLE_CLUSTERED_READ_POSITION_FILTER) { final Double tumorFwdPosMedian = (Double) vc.getAttribute(GATKVCFConstants.MEDIAN_LEFT_OFFSET_KEY); final Double tumorRevPosMedian = (Double) vc.getAttribute(GATKVCFConstants.MEDIAN_RIGHT_OFFSET_KEY); final Double tumorFwdPosMAD = (Double) vc.getAttribute(GATKVCFConstants.MAD_MEDIAN_LEFT_OFFSET_KEY); final Double tumorRevPosMAD = (Double) vc.getAttribute(GATKVCFConstants.MAD_MEDIAN_RIGHT_OFFSET_KEY); if ((tumorFwdPosMedian != null && tumorFwdPosMedian <= MTAC.PIR_MEDIAN_THRESHOLD && tumorFwdPosMAD != null && tumorFwdPosMAD <= MTAC.PIR_MAD_THRESHOLD) || (tumorRevPosMedian != null && tumorRevPosMedian <= MTAC.PIR_MEDIAN_THRESHOLD && tumorRevPosMAD != null && tumorRevPosMAD <= MTAC.PIR_MAD_THRESHOLD)) filters.add(GATKVCFConstants.CLUSTERED_READ_POSITION_FILTER_NAME); } }
Source:
protected PlanNodeStatsEstimate visitBetweenPredicate(BetweenPredicate node, Void context) { if (!(node.getValue() instanceof SymbolReference) || !(node.getMin() instanceof Literal) || !(node.getMax() instanceof Literal)) { return visitExpression(node, context); } SymbolStatsEstimate valueStats = input.getSymbolStatistics(Symbol.from(node.getValue())); Expression leftComparison; Expression rightComparison; if (isInfinite(valueStats.getLowValue())) { leftComparison = new ComparisonExpression(GREATER_THAN_OR_EQUAL, node.getValue(), node.getMin()); rightComparison = new ComparisonExpression(LESS_THAN_OR_EQUAL, node.getValue(), node.getMax()); } else { rightComparison = new ComparisonExpression(GREATER_THAN_OR_EQUAL, node.getValue(), node.getMin()); leftComparison = new ComparisonExpression(LESS_THAN_OR_EQUAL, node.getValue(), node.getMax()); } return process(and(leftComparison, rightComparison)); }

Target:
protected PlanNodeStatsEstimate visitBetweenPredicate(BetweenPredicate node, Void context) { if (!(node.getValue() instanceof SymbolReference) || !(node.getMin() instanceof Literal) || !(node.getMax() instanceof Literal)) { return visitExpression(node, context); } SymbolStatsEstimate valueStats = input.getSymbolStatistics(Symbol.from(node.getValue())); Expression lowerBound = new ComparisonExpression(GREATER_THAN_OR_EQUAL, node.getValue(), node.getMin()); Expression upperBound = new ComparisonExpression(LESS_THAN_OR_EQUAL, node.getValue(), node.getMax()); Expression transformed; if (isInfinite(valueStats.getLowValue())) { transformed = and(lowerBound, upperBound); } else { transformed = and(upperBound, lowerBound); } return process(transformed); }
Source:
private ServiceTicket createServiceTicket() { val mock = mock(ServiceTicket.class); when(mock.getService()).thenReturn(createService()); return mock; }

Target:
private ServiceTicket createServiceTicket() { val mock = mock(ServiceTicket.class); val service = createService(); when(mock.getService()).thenReturn(service); return mock; }
Source:
default void check() { if (meshProxy().isPresent()) { checkArgument(maxNumRetries() == 0, "If meshProxy is configured then maxNumRetries must be 0"); checkArgument(uris().size() == 1, "If meshProxy is configured then uris must contain exactly 1 URI"); } checkTimeoutPrecision(connectTimeout(), "connectTimeout"); checkTimeoutPrecision(readTimeout(), "readTimeout"); checkTimeoutPrecision(writeTimeout(), "writeTimeout"); }

Target:
default void check() { if (meshProxy().isPresent()) { checkArgument(maxNumRetries() == 0, "If meshProxy is configured then maxNumRetries must be 0"); checkArgument(uris().size() == 1, "If meshProxy is configured then uris must contain exactly 1 URI"); } checkTimeoutPrecision(connectTimeout(), "connectTimeout"); checkTimeoutPrecision(readTimeout(), "readTimeout"); checkTimeoutPrecision(writeTimeout(), "writeTimeout"); checkArgument(!failedUrlCooldown().isNegative(), "failedUrlCooldown may not be negative"); }
Source:
private static void unTar(TarInputStream tarInputStream, File outputDir) { try { TarEntry tarEntry; while ((tarEntry = tarInputStream.getNextEntry()) != null) { final File file = new File(outputDir, tarEntry.getName()); if (tarEntry.isDirectory()) { if (!file.exists()) { if (!file.mkdirs()) { logger.error(file + " failure to create directory"); } } } else { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); try { int length; byte data[] = new byte[BUFFER_SIZE]; while ((length = tarInputStream.read(data, 0, BUFFER_SIZE)) != -1) { out.write(data, 0, length); } out.flush(); } finally { try { out.close(); } catch (IOException e) { logger.error(e.getMessage()); } } } } } catch (IOException e) { logger.error(e.getMessage()); } }

Target:
private static void unTar(TarInputStream tarInputStream, File outputDir) { try { TarEntry tarEntry; while ((tarEntry = tarInputStream.getNextEntry()) != null) { final File file = new File(outputDir, tarEntry.getName()); if (tarEntry.isDirectory()) { if (!file.exists()) { if (!file.mkdirs()) { logger.error(file + " failure to create directory"); } } } else { try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { int length; byte data[] = new byte[BUFFER_SIZE]; while ((length = tarInputStream.read(data, 0, BUFFER_SIZE)) != -1) { out.write(data, 0, length); } } catch (IOException e) { logger.error(e.getMessage()); } } } } catch (IOException e) { logger.error(e.getMessage()); } }
Source:
public MessageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { MessageBubbleDrawable bubbleDrawable; MessageView messageView; if (viewType == 0) { bubbleDrawable = new MessageBubbleDrawable(parent.getContext(), R.color.colorPrimaryLight, Gravity.END); messageView = (MessageView) inflater.inflate(R.layout.self_message_item_layout, parent, false); } else { bubbleDrawable = new MessageBubbleDrawable(parent.getContext(), R.color.bubble_grey, Gravity.START); messageView = (MessageView) inflater.inflate(R.layout.message_item_layout, parent, false); } messageView.setTextBackground(bubbleDrawable); return new MessageViewHolder(messageView); }

Target:
public MessageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { MessageBubbleDrawable bubbleDrawable; MessageView messageView; if (viewType == VIEW_TYPE_MESSAGE_THIS_USER) { bubbleDrawable = new MessageBubbleDrawable(parent.getContext(), R.color.colorPrimaryLight, Gravity.END); messageView = (MessageView) inflater.inflate(R.layout.self_message_item_layout, parent, false); } else if (viewType == VIEW_TYPE_MESSAGE_OTHER_USERS) { bubbleDrawable = new MessageBubbleDrawable(parent.getContext(), R.color.bubble_grey, Gravity.START); messageView = (MessageView) inflater.inflate(R.layout.message_item_layout, parent, false); } else { throw new DeveloperError("There is an unknown view type, you should inflate a view for it."); } messageView.setTextBackground(bubbleDrawable); return new MessageViewHolder(messageView); }
Source:
int blockPlayerWin() { int equalCount = 0; int emptyI = 0, emptyJ = 0; int winCombinationsNumber = fieldSize * 2 + 2; for (int k = 0; k < winCombinationsNumber; k++) { equalCount = 0; for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { if (fieldArray[i][j] == playerMark && (getWinCombination(k, i, j) == 1)) { equalCount++; } if ((fieldArray[i][j] == EMPTY_MARK) && (getWinCombination(k, i, j) == 1)) { emptyI = i; emptyJ = j; } if ((fieldArray[i][j] == aIMark) && (getWinCombination(k, i, j) == 1)) { j = fieldSize; i = fieldSize; equalCount = 0; } } if (equalCount == (fieldSize - 1)) { return (emptyI * fieldSize + emptyJ); } } return NOTHING_TO_PREVENT; }

Target:
int blockPlayerWin() { int equalCount = 0; int emptyI = 0, emptyJ = 0; int winCombinationsNumber = fieldSize * 2 + 2; for (int k = 0; k < winCombinationsNumber; k++) { equalCount = 0; for (int i = 0; i < fieldSize; i++) for (int j = 0; j < fieldSize; j++) { if (fieldArray[i][j] == playerMark && (getWinCombination(k, i, j) == BELONGS_TO_WIN_COMBINATION)) { equalCount++; } if ((fieldArray[i][j] == EMPTY_MARK) && (getWinCombination(k, i, j) == BELONGS_TO_WIN_COMBINATION)) { emptyI = i; emptyJ = j; } if ((fieldArray[i][j] == aIMark) && (getWinCombination(k, i, j) == BELONGS_TO_WIN_COMBINATION)) { j = fieldSize; i = fieldSize; equalCount = 0; } } if (equalCount == (fieldSize - 1)) { return (emptyI * fieldSize + emptyJ); } } return NOTHING_TO_PREVENT; }
Source:
public static WindowsConfiguration create(final boolean provisionVMAgent, final WinRM winRM, final List<AdditionalUnattendContent> additionalUnattendContent, final boolean enableAutomaticUpdates) { return new AutoValue_VirtualMachineScaleSetOSProfile_WindowsConfiguration(provisionVMAgent, winRM, additionalUnattendContent, enableAutomaticUpdates); }

Target:
public static WindowsConfiguration create(final boolean provisionVMAgent, final WinRM winRM, final List<AdditionalUnattendContent> additionalUnattendContent, final boolean enableAutomaticUpdates) { return new AutoValue_VirtualMachineScaleSetOSProfile_WindowsConfiguration(provisionVMAgent, winRM, additionalUnattendContent == null ? ImmutableList.<AdditionalUnattendContent>of() : ImmutableList.copyOf(additionalUnattendContent), enableAutomaticUpdates); }
Source:
public void maybeStopRequesting( StreamRTPManagerDesc streamRTPManager, int pt, byte[] buf, int off, int len) { if (remainingRetries == 0) { return; } Byte redPT = null, vp8PT = null; for (Map.Entry<Byte, MediaFormat> entry : streamRTPManager .streamRTPManager.getMediaStream().getDynamicRTPPayloadTypes() .entrySet()) { String encoding = entry.getValue().getEncoding(); if (Constants.VP8.equals(encoding)) { vp8PT = entry.getKey(); } else if (Constants.RED.equals(encoding)) { redPT = entry.getKey(); } } if (vp8PT == null || vp8PT != pt) { return; } RawPacket pkt = new RawPacket(buf, off, len); if (!Utils.isKeyFrame(pkt, redPT, vp8PT)) { return; } if (TRACE) { logger.trace("Stopping FIRs to ssrc=" + mediaSenderSSRC); } synchronized (this) { remainingRetries = 0; } }

Target:
public void maybeStopRequesting( StreamRTPManagerDesc streamRTPManager, int pt, byte[] buf, int off, int len) { if (remainingRetries == 0) { return; } Byte redPT = null, vp8PT = null; for (Map.Entry<Byte, MediaFormat> entry : streamRTPManager .streamRTPManager.getMediaStream().getDynamicRTPPayloadTypes() .entrySet()) { String encoding = entry.getValue().getEncoding(); if (Constants.VP8.equals(encoding)) { vp8PT = entry.getKey(); } else if (Constants.RED.equals(encoding)) { redPT = entry.getKey(); } } if (vp8PT == null || vp8PT != pt) { return; } if (!Utils.isKeyFrame(buf, off, len, redPT, vp8PT)) { return; } if (TRACE) { logger.trace("Stopping FIRs to ssrc=" + mediaSenderSSRC); } synchronized (this) { remainingRetries = 0; } }
Source:
static public byte[] decode(final String base32) { return BaseEncoding.base32().decode(base32); }

Target:
static public byte[] decode(final String base32) { return BaseEncoding.base32() .omitPadding() .lowerCase() .decode(base32.toLowerCase()); }
Source:
protected boolean getCPULoadEnabled() { return m_model.getLoadMetersEnabled(); }

Target:
protected boolean getCPULoadEnabled() { return m_model == null ? false : m_model.getLoadMetersEnabled(); }
Source:
private IJavaSearchScope getPackageAndOccurrencesWithoutNamesakesScope() { List<IJavaElement> scopeList= new ArrayList<>(); scopeList.add(fPackage); for (SearchResultGroup fOccurrence : fOccurrences) { ICompilationUnit cu= fOccurrence.getCompilationUnit(); if (cu == null) continue; IPackageFragment pack= (IPackageFragment) cu.getParent(); if (! pack.getElementName().equals(fPackage.getElementName())) scopeList.add(cu); } return SearchEngine.createJavaSearchScope(scopeList.toArray(new IJavaElement[scopeList.size()])); }

Target:
private IJavaSearchScope getPackageAndOccurrencesWithoutNamesakesScope() { List<IJavaElement> scopeList= new ArrayList<>(); scopeList.add(fPackage); for (SearchResultGroup occurrence : fOccurrences) { ICompilationUnit cu= occurrence.getCompilationUnit(); if (cu == null) continue; IPackageFragment pack= (IPackageFragment) cu.getParent(); if (! pack.getElementName().equals(fPackage.getElementName())) scopeList.add(cu); } return SearchEngine.createJavaSearchScope(scopeList.toArray(new IJavaElement[scopeList.size()])); }
Source:
public void agentStatus() { }

Target:
public String agentStatus() { return ""; }
Source:
public void update(final DomainObject domainObject) { final CanvasHandler canvasHandler = session.getCanvasHandler(); final Diagram diagram = canvasHandler.getDiagram(); final Graph<?, Node> graph = diagram.getGraph(); for (Node node : graph.nodes()) { if (node.getContent() instanceof Definition) { final Definition definition = (Definition) node.getContent(); if (definition.getDefinition() instanceof DomainObject) { final DomainObject d = (DomainObject) definition.getDefinition(); if (Objects.equals(d.getDomainObjectUUID(), domainObject.getDomainObjectUUID())) { canvasElementUpdatedEvent.fire(new CanvasElementUpdatedEvent(canvasHandler, node)); } } } } }

Target:
public void update(final DomainObject domainObject) { final CanvasHandler canvasHandler = session.getCanvasHandler(); final Diagram diagram = canvasHandler.getDiagram(); final Graph<?, Node> graph = diagram.getGraph(); for (final Node node : graph.nodes()) { if (node.getContent() instanceof Definition) { final Definition definition = (Definition) node.getContent(); if (definition.getDefinition() instanceof DomainObject) { final DomainObject d = (DomainObject) definition.getDefinition(); if (Objects.equals(d.getDomainObjectUUID(), domainObject.getDomainObjectUUID())) { canvasElementUpdatedEvent.fire(new CanvasElementUpdatedEvent(canvasHandler, node)); } } } } }
Source:
public CursorOperator(Context context, Uri uri, Scheduler.Worker scheduler, String[] projection, String selection, String[] selectionArgs, String sortOrder) { this.context = context; this.uri = uri; this.projection = projection; this.selection = selection; this.selectionArgs = selectionArgs; this.sortOrder = sortOrder; this.worker = scheduler; }

Target:
public CursorOperator(Context context, Uri uri, Scheduler.Worker scheduler, String[] projection, String selection, String[] selectionArgs, String sortOrder) { this.resolver = context.getApplicationContext().getContentResolver(); this.uri = uri; this.projection = projection; this.selection = selection; this.selectionArgs = selectionArgs; this.sortOrder = sortOrder; this.worker = scheduler; }
Source:
public static boolean validate(Schema schema) { for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String column = fieldSpec.getName(); String transformFunction = fieldSpec.getTransformFunction(); if (transformFunction != null) { ExpressionEvaluator expressionEvaluator = ExpressionEvaluatorFactory.getExpressionEvaluator(fieldSpec); if (expressionEvaluator != null) { List<String> arguments = expressionEvaluator.getArguments(); if (arguments.contains(column)) { LOGGER.error("The arguments of transform function: {}, should not contain the destination column: {}", transformFunction, column); return false; } } } else if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)) { TimeFieldSpec timeFieldSpec = (TimeFieldSpec) fieldSpec; TimeGranularitySpec incomingGranularitySpec = timeFieldSpec.getIncomingGranularitySpec(); TimeGranularitySpec outgoingGranularitySpec = timeFieldSpec.getOutgoingGranularitySpec(); if (outgoingGranularitySpec != null && !incomingGranularitySpec.equals(outgoingGranularitySpec) && incomingGranularitySpec.getName().equals(outgoingGranularitySpec.getName())) { LOGGER.error("Cannot convert from incoming field spec:{} to outgoing field spec:{} if name is the same", incomingGranularitySpec, outgoingGranularitySpec); return false; } } } } return true; }

Target:
public static boolean validate(Schema schema) { try { for (FieldSpec fieldSpec : schema.getAllFieldSpecs()) { if (!fieldSpec.isVirtualColumn()) { String column = fieldSpec.getName(); String transformFunction = fieldSpec.getTransformFunction(); if (transformFunction != null) { ExpressionEvaluator expressionEvaluator = ExpressionEvaluatorFactory.getExpressionEvaluator(fieldSpec); if (expressionEvaluator != null) { List<String> arguments = expressionEvaluator.getArguments(); if (arguments.contains(column)) { LOGGER.error("The arguments of transform function: {}, should not contain the destination column: {}", transformFunction, column); return false; } } } else if (fieldSpec.getFieldType().equals(FieldSpec.FieldType.TIME)) { TimeFieldSpec timeFieldSpec = (TimeFieldSpec) fieldSpec; TimeGranularitySpec incomingGranularitySpec = timeFieldSpec.getIncomingGranularitySpec(); TimeGranularitySpec outgoingGranularitySpec = timeFieldSpec.getOutgoingGranularitySpec(); if (!incomingGranularitySpec.equals(outgoingGranularitySpec)) { if (incomingGranularitySpec.getName().equals(outgoingGranularitySpec.getName())) { LOGGER.error("Cannot convert from incoming field spec:{} to outgoing field spec:{} if name is the same", incomingGranularitySpec, outgoingGranularitySpec); return false; } else { if (!incomingGranularitySpec.getTimeFormat().equals(TimeGranularitySpec.TimeFormat.EPOCH.toString()) || !outgoingGranularitySpec.getTimeFormat() .equals(TimeGranularitySpec.TimeFormat.EPOCH.toString())) { LOGGER.error( "When incoming and outgoing specs are different, cannot perform time conversion for time format other than EPOCH"); return false; } } } } } } } catch (Exception e) { LOGGER.error("Exception in validating schema {}", schema.getSchemaName(), e); return false; } return true; }
Source:
protected List<Guid> executeHSMGetStorageDomainsList(HSMGetStorageDomainsListVDSCommandParameters parameters) { return (ArrayList<Guid>) runVdsCommand(VDSCommandType.HSMGetStorageDomainsList, parameters).getReturnValue(); }

Target:
protected List<Guid> executeHSMGetStorageDomainsList(HSMGetStorageDomainsListVDSCommandParameters parameters) { return (List<Guid>) runVdsCommand(VDSCommandType.HSMGetStorageDomainsList, parameters).getReturnValue(); }
Source:
protected JsonErrorResult handleClientAlreadyExists(ClientAlreadyExistsException e) { LOGGER.warn("A ClientAlreadyExistsException occurred", e); return new JsonErrorResult(HttpStatus.CONFLICT.name(), e.getMessage()); }

Target:
protected JsonErrorResult handleClientAlreadyExists(ClientAlreadyExistsException e) { LOGGER.warn(e.getMessage()); return new JsonErrorResult(HttpStatus.CONFLICT.name(), e.getMessage()); }
Source:
public void testFacetParams() { List<NameValuePair> actual = buildFacetParams("journal", "foo", true); SetMultimap<String, String> actualMap = convertToMap(actual); assertFacetParams(2, actualMap); assertSingle("journal", actualMap.get("facet.field")); assertSingle("dismax", actualMap.get("defType")); assertSingle("foo", actualMap.get("q")); actual = buildFacetParams("journal", "*:*", false); actualMap = convertToMap(actual); assertFacetParams(2, actualMap); assertSingle("journal", actualMap.get("facet.field")); assertEquals(actualMap.get("defType").size(), 0); assertSingle("*:*", actualMap.get("q")); ArticleSearchQuery.Facet facet = ArticleSearchQuery.Facet.builder() .setField("foo") .setExcludeKey("bar") .build(); ArticleSearchQuery asq = ArticleSearchQuery.builder() .addFacet(facet) .setQuery("query") .build(); actual = SolrQueryBuilder.buildParameters(asq); actualMap = convertToMap(actual); System.out.println(actualMap.get("facet.field")); assertSingle("{!ex=bar}foo", actualMap.get("facet.field")); assertSingle("query", actualMap.get("q")); }

Target:
public void testFacetParams() { List<NameValuePair> actual = buildFacetParams("journal", "foo", true); SetMultimap<String, String> actualMap = convertToMap(actual); assertFacetParams(2, actualMap); assertSingle("journal", actualMap.get("facet.field")); assertSingle("dismax", actualMap.get("defType")); assertSingle("foo", actualMap.get("q")); actual = buildFacetParams("journal", "*:*", false); actualMap = convertToMap(actual); assertFacetParams(2, actualMap); assertSingle("journal", actualMap.get("facet.field")); assertEquals(actualMap.get("defType").size(), 0); assertSingle("*:*", actualMap.get("q")); ArticleSearchQuery.Facet facet = ArticleSearchQuery.Facet.builder() .setField("foo") .setExcludeKey("bar") .build(); ArticleSearchQuery asq = ArticleSearchQuery.builder() .addFacet(facet) .setQuery("query") .build(); actual = SolrQueryBuilder.buildParameters(asq); actualMap = convertToMap(actual); assertSingle("{!ex=bar}foo", actualMap.get("facet.field")); assertSingle("query", actualMap.get("q")); }
Source:
public void testList() { publicIps = publicIpApi().getList(); assertNotNull(publicIps); assertFalse(publicIps.isEmpty()); Assert.assertTrue(publicIps.size() > 0); }

Target:
public void testList() { publicIps = publicIpApi().list(); Assert.assertTrue(publicIps.size() > 0); }
Source:
public void onTransportError(Event event) { super.onTransportError(event); final Transport transport = event.getTransport(); final Connection connection = event.getConnection(); if (connection == null || transport == null) { return; } final ErrorCondition errorCondition = transport.getCondition(); if (errorCondition == null || !(errorCondition.getCondition().equals(ConnectionError.FRAMING_ERROR) || errorCondition.getCondition().equals(AmqpErrorCode.PROTON_IO_ERROR))) { return; } final String hostName = event.getReactor().getConnectionAddress(connection); final ProxySelector proxySelector = ProxySelector.getDefault(); final boolean isProxyConfigured = proxySelector != null || (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured()); if (!isProxyConfigured || ImplUtils.isNullOrEmpty(hostName)) { return; } final String[] hostNameParts = hostName.split(":"); if (hostNameParts.length != 2) { return; } int port; try { port = Integer.parseInt(hostNameParts[1]); } catch (NumberFormatException ignore) { return; } final IOException ioException = new IOException(errorCondition.getDescription()); final URI url = createURI(amqpHostname, getProtocolPort()); final InetSocketAddress address = new InetSocketAddress(hostNameParts[0], port); logger.error(String.format("Failed to connect to url: '%s', proxy host: '%s'", url.toString(), address.getHostString()), ioException); if (proxySelector != null) { proxySelector.connectFailed(url, address, ioException); } }

Target:
public void onTransportError(Event event) { super.onTransportError(event); final Transport transport = event.getTransport(); final Connection connection = event.getConnection(); if (connection == null || transport == null) { return; } final ErrorCondition errorCondition = transport.getCondition(); if (errorCondition == null || !(errorCondition.getCondition().equals(ConnectionError.FRAMING_ERROR) || errorCondition.getCondition().equals(AmqpErrorCode.PROTON_IO_ERROR))) { return; } final String hostName = event.getReactor().getConnectionAddress(connection); final ProxySelector proxySelector = ProxySelector.getDefault(); final boolean isProxyConfigured = proxySelector != null || (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured()); if (!isProxyConfigured || ImplUtils.isNullOrEmpty(hostName)) { return; } final String[] hostNameParts = hostName.split(":"); if (hostNameParts.length != 2) { logger.warning("Invalid hostname: {}", hostName); return; } int port; try { port = Integer.parseInt(hostNameParts[1]); } catch (NumberFormatException ignore) { logger.warning("Invalid port number: {}", hostNameParts[1]); return; } final IOException ioException = new IOException(errorCondition.getDescription()); final URI url = createURI(amqpHostname, getProtocolPort()); final InetSocketAddress address = new InetSocketAddress(hostNameParts[0], port); logger.error(String.format("Failed to connect to url: '%s', proxy host: '%s'", url.toString(), address.getHostString()), ioException); if (proxySelector != null) { proxySelector.connectFailed(url, address, ioException); } }
Source:
protected URLConnection connect(DownloadJob job, URL src) throws IOException { URLConnection conn = ProxyConfiguration.open(src); if(conn instanceof HttpURLConnection) { HttpURLConnection httpConn = (HttpURLConnection) conn; if (httpConn.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP || httpConn.getResponseCode() == HttpURLConnection.HTTP_MOVED_PERM) { conn = connect(job, new URL(httpConn.getHeaderField("location"))); IOUtils.closeQuietly(httpConn.getInputStream()); } } return conn; }

Target:
protected URLConnection connect(DownloadJob job, URL src) throws IOException { URLConnection conn = ProxyConfiguration.open(src); if(conn instanceof HttpURLConnection) { HttpURLConnection httpConn = (HttpURLConnection) conn; if (httpConn.getResponseCode() == HttpURLConnection.HTTP_MOVED_TEMP || httpConn.getResponseCode() == HttpURLConnection.HTTP_MOVED_PERM) { try { URL redirectUrl = new URL(httpConn.getHeaderField("location")); conn = connect(job, redirectUrl); } finally { Util.closeAndLogFailures(httpConn.getInputStream(), LOGGER, job.getDestination().getName(), src.toString()); } } } return conn; }
Source:
public String getServerMOTD() { try { StringBuffer mOTD = new StringBuffer(); FileReader reader = new FileReader("motd.md"); BufferedReader bufferedReader = new BufferedReader(reader); String line; while ((line = bufferedReader.readLine()) != null) { mOTD.append(line); } serverMOTD = mOTD.toString(); return serverMOTD; } catch (IOException e) { return serverMOTD; } }

Target:
public String getServerMOTD() { try { StringBuffer mOTD = new StringBuffer(); InputStreamReader reader = new InputStreamReader(new FileInputStream("motd.md"), "UTF8"); BufferedReader bufferedReader = new BufferedReader(reader); String line; while ((line = bufferedReader.readLine()) != null) { mOTD.append(line); } reader.close(); serverMOTD = mOTD.toString(); return serverMOTD; } catch (IOException e) { return serverMOTD; } }
Source:
public ResourceBundle getBundle(String baseName, Locale locale) { File resourceBundleDir = resourceBundleBaseDir; if (resourceBundleDir == null) { resourceBundleDir = new File(String.format("%s/etc/i18n/", System.getProperty("ddf.home"))); } try { URL[] urls = {resourceBundleDir.toURI().toURL()}; try (URLClassLoader loader = new URLClassLoader(urls)) { return ResourceBundle.getBundle(baseName, locale, loader); } } catch (MalformedURLException e) { throw new MissingResourceException( "An error occurred while loading ResourceBundle: " + baseName + "," + locale.getCountry(), getClass().getName(), baseName); } catch (IOException e) { throw new MissingResourceException( "An error occurred while creating class loader to URL for ResourceBundle: " + baseName + "," + locale.getCountry(), getClass().getName(), baseName); } }

Target:
public ResourceBundle getBundle(String baseName, Locale locale) throws IOException { File resourceBundleDir = Paths.get(resourceBundleBaseDir.toString(), baseName).toFile(); URL[] urls = {resourceBundleDir.toURI().toURL()}; try (URLClassLoader loader = AccessController.doPrivileged( (PrivilegedAction<URLClassLoader>) () -> new URLClassLoader(urls))) { return ResourceBundle.getBundle(baseName, locale, loader); } }
Source:
private static String buildPrefix(String message) { return message != null && message.length() != 0 ? message + " ==> " : ""; }

Target:
private static String buildPrefix(String message) { return message != null && message.length() != 0 ? message + ": " : ""; }
Source:
public Response add(Disk disk) { if (QueryHelper.hasMatrixParam(getUriInfo(), UNREGISTERED_CONSTRAINT_PARAMETER)) { GetUnregisteredDiskQueryParameters getDiskParams = new GetUnregisteredDiskQueryParameters( asGuid(disk.getId()), storageDomainId, getStoragePoolIdForDomain(storageDomainId)); DiskImage unregisteredDisk = getEntity(DiskImage.class, VdcQueryType.GetUnregisteredDisk, getDiskParams, disk.getId()); unregisteredDisk.setDiskAlias(disk.getAlias()); RegisterDiskParameters registerDiskParams = new RegisterDiskParameters(unregisteredDisk); return performCreate(VdcActionType.RegisterDisk, registerDiskParams, ID_RESOLVER); } else { validateDiskForCreation(disk); AddDiskParameters params = new AddDiskParameters(); params.setDiskInfo(getMapper(Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class).map( disk, null)); params.setStorageDomainId(this.storageDomainId); return performCreate(VdcActionType.AddDisk, params, ID_RESOLVER); } }

Target:
public Response add(Disk disk) { if (QueryHelper.hasMatrixParam(getUriInfo(), UNREGISTERED_CONSTRAINT_PARAMETER)) { GetUnregisteredDiskQueryParameters getDiskParams = new GetUnregisteredDiskQueryParameters( asGuid(disk.getId()), storageDomainId, getStoragePoolIdForDomain(storageDomainId)); DiskImage unregisteredDisk = getEntity(DiskImage.class, VdcQueryType.GetUnregisteredDisk, getDiskParams, disk.getId()); unregisteredDisk = (DiskImage) getMapper(Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class).map(disk, unregisteredDisk); RegisterDiskParameters registerDiskParams = new RegisterDiskParameters(unregisteredDisk); return performCreate(VdcActionType.RegisterDisk, registerDiskParams, ID_RESOLVER); } else { validateDiskForCreation(disk); AddDiskParameters params = new AddDiskParameters(); params.setDiskInfo(getMapper(Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class).map( disk, null)); params.setStorageDomainId(this.storageDomainId); return performCreate(VdcActionType.AddDisk, params, ID_RESOLVER); } }
Source:
public PlanNode replaceChildren(List<PlanNode> newChildren) { checkArgument(newChildren.size() == 2, "expected newChildren to contain 2 nodes"); PlanNode newLeft = newChildren.get(0); PlanNode newRight = newChildren.get(1); List<Symbol> newOutputSymbols = outputSymbols; if (isCrossJoin()) { Set<Symbol> outputSymbolSet = new HashSet<>(outputSymbols); newOutputSymbols = Stream.concat(newLeft.getOutputSymbols().stream(), newRight.getOutputSymbols().stream()) .filter(outputSymbolSet::contains) .collect(toImmutableList()); } return new JoinNode(getId(), type, newLeft, newRight, criteria, newOutputSymbols, filter, leftHashSymbol, rightHashSymbol, distributionType); }

Target:
public PlanNode replaceChildren(List<PlanNode> newChildren) { checkArgument(newChildren.size() == 2, "expected newChildren to contain 2 nodes"); return new JoinNode(getId(), type, newChildren.get(0), newChildren.get(1), criteria, outputSymbols, filter, leftHashSymbol, rightHashSymbol, distributionType); }
Source:
private List<Pair<List<Statement>, List<Statement>>> getSwitchStructure(final SwitchStatement node) { final List<Pair<List<Statement>, List<Statement>>> switchStructure = new ArrayList<Pair<List<Statement>, List<Statement>>>(); Pair<List<Statement>, List<Statement>> currentCase = Pair.<List<Statement>, List<Statement>>of(new ArrayList<Statement>(), new ArrayList<Statement>()); for (final Object oneStatement : node.statements()) { if (oneStatement instanceof SwitchCase) { final SwitchCase oneSwitchCase = (SwitchCase) oneStatement; if (!currentCase.getSecond().isEmpty()) { switchStructure.add(currentCase); currentCase = Pair.<List<Statement>, List<Statement>>of( new ArrayList<Statement>(), new ArrayList<Statement>()); } currentCase.getFirst().add(oneSwitchCase); } else { currentCase.getSecond().add((Statement) oneStatement); } } if (!currentCase.getFirst().isEmpty()) { switchStructure.add(currentCase); } return switchStructure; }

Target:
private List<SwitchCaseSection> getSwitchStructure(final SwitchStatement node) { final List<SwitchCaseSection> switchStructure = new ArrayList<SwitchCaseSection>(); SwitchCaseSection currentCase = new SwitchCaseSection(); for (final Object oneStatement : node.statements()) { if (oneStatement instanceof SwitchCase) { final SwitchCase oneSwitchCase = (SwitchCase) oneStatement; if (!currentCase.stmts.isEmpty()) { switchStructure.add(currentCase); currentCase = new SwitchCaseSection(); } currentCase.existingCases.add(oneSwitchCase); } else { currentCase.stmts.add((Statement) oneStatement); } } if (!currentCase.existingCases.isEmpty()) { switchStructure.add(currentCase); } return switchStructure; }
Source:
public IdentifierSource newObject() { return new SequentialIdentifierGenerator(); }

Target:
public IdentifierSource newObject() { return Context.getService(IdentifierSourceService.class).getIdentifierSourceByUuid(getUuidProperty()); }
Source:
public final void renderTileEntityAt(T tile, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer VertexBuffer = tessellator.getBuffer(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend(); GlStateManager.enableCull(); if(Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); renderTileEntityFast(tile, x, y, z, partialTicks, destroyStage, VertexBuffer); VertexBuffer.setTranslation(0, 0, 0); tessellator.draw(); RenderHelper.enableStandardItemLighting(); }

Target:
public void renderTileEntityAt(T tile, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer VertexBuffer = tessellator.getBuffer(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend(); GlStateManager.enableCull(); if(Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); renderTileEntityFast(tile, x, y, z, partialTicks, destroyStage, VertexBuffer); VertexBuffer.setTranslation(0, 0, 0); tessellator.draw(); RenderHelper.enableStandardItemLighting(); }
Source:
protected void promoteToMaster() { if (!running) { LOG.warn("Ignoring promote-to-master request, as HighAvailabilityManager is no longer running"); return; } if (promotionListener != null) { try { promotionListener.promotingToMaster(); } catch (Exception e) { Exceptions.propagateIfFatal(e); LOG.warn("Problem in promption-listener (continuing)", e); } } nodeState = ManagementNodeState.MASTER; publishPromotionToMaster(); try { managementContext.getRebindManager().rebind(); } catch (Exception e) { LOG.info("Problem during rebind when promoting node to master; demoting to failed and rethrowing): "+e); nodeState = ManagementNodeState.FAILED; publishDemotionFromMaterOnFailure(); throw Exceptions.propagate(e); } managementContext.getRebindManager().start(); }

Target:
protected void promoteToMaster() { if (!running) { LOG.warn("Ignoring promote-to-master request, as HighAvailabilityManager is no longer running"); return; } if (promotionListener != null) { try { promotionListener.promotingToMaster(); } catch (Exception e) { Exceptions.propagateIfFatal(e); LOG.warn("Problem in promption-listener (continuing)", e); } } nodeState = ManagementNodeState.MASTER; publishPromotionToMaster(); try { managementContext.getRebindManager().rebind(); } catch (Exception e) { LOG.info("Problem during rebind when promoting node to master; demoting to failed and rethrowing): "+e); nodeState = ManagementNodeState.FAILED; publishDemotionFromMasterOnFailure(); throw Exceptions.propagate(e); } managementContext.getRebindManager().start(); }
Source:
public void testCreateUserPrincipal() { AADJwtBearerTokenAuthenticationConverter aadJwtBearerTokenAuthenticationConverter = new AADJwtBearerTokenAuthenticationConverter(); AbstractAuthenticationToken authenticationToken = aadJwtBearerTokenAuthenticationConverter.convert(jwt); assertThat(authenticationToken.getPrincipal()).isExactlyInstanceOf(AADOAuth2AuthenticatedPrincipal.class); AADOAuth2AuthenticatedPrincipal principal = (AADOAuth2AuthenticatedPrincipal) authenticationToken .getPrincipal(); assertThat(principal.getClaims()).isNotEmpty(); assertThat(principal.getIssuer()).isEqualTo(claims.get("iss")); assertThat(principal.getTenantId()).isEqualTo(claims.get("tid")); }

Target:
public void testCreateUserPrincipal() { AADJwtBearerTokenAuthenticationConverter converter = new AADJwtBearerTokenAuthenticationConverter(); AbstractAuthenticationToken authenticationToken = converter.convert(jwt); assertThat(authenticationToken.getPrincipal()).isExactlyInstanceOf(AADOAuth2AuthenticatedPrincipal.class); AADOAuth2AuthenticatedPrincipal principal = (AADOAuth2AuthenticatedPrincipal) authenticationToken .getPrincipal(); assertThat(principal.getClaims()).isNotEmpty(); assertThat(principal.getIssuer()).isEqualTo(claims.get("iss")); assertThat(principal.getTenantId()).isEqualTo(claims.get("tid")); }
Source:
public void compute(final Vertex<Double, Void> vertex, final Iterable<Double> messages) { if (getSuperstep() == 0) { vertex.setValue(1d); } else { final double sum = messages == null ? 0d : Lists.newArrayList(messages).stream().mapToDouble(Double::doubleValue).sum(); vertex.setValue((1 - DAMPING_FACTOR) + DAMPING_FACTOR * sum); } if (getSuperstep() < NUM_TOTAL_SUPERSTEP) { getMsgFutureList().addAll(sendMessagesToAdjacents(vertex, vertex.getValue() / vertex.getNumEdges())); } else { vertex.voteToHalt(); } }

Target:
public void compute(final Vertex<Double, Void> vertex, final Iterable<Double> messages) { if (getSuperstep() == 0) { vertex.setValue(1d); } else { double sum = 0.0; for (final Double message : messages) { sum += message; } vertex.setValue((1 - DAMPING_FACTOR) + DAMPING_FACTOR * sum); } if (getSuperstep() < NUM_TOTAL_SUPERSTEP) { sendMessagesToAdjacents(vertex, vertex.getValue() / vertex.getNumEdges()); } else { vertex.voteToHalt(); } }
Source:
public ConnectorPageSource createPageSource( ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorSplit split, List<ColumnHandle> columns, SplitContext splitContext) { RaptorSplit raptorSplit = (RaptorSplit) split; HiveFileContext hiveFileContext = DEFAULT_HIVE_FILE_CONTEXT; OptionalInt bucketNumber = raptorSplit.getBucketNumber(); TupleDomain<RaptorColumnHandle> predicate = raptorSplit.getEffectivePredicate(); ReaderAttributes attributes = ReaderAttributes.from(session); OptionalLong transactionId = raptorSplit.getTransactionId(); Optional<Map<String, Type>> columnTypes = raptorSplit.getColumnTypes(); boolean tableSupportsDeltaDelete = raptorSplit.isTableSupportsDeltaDelete(); FileSystemContext context = new FileSystemContext(session); Map<UUID, UUID> shardDeltaMap = raptorSplit.getShardDeltaMap(); if (raptorSplit.getShardUuids().size() == 1) { UUID shardUuid = raptorSplit.getShardUuids().iterator().next(); return createPageSource( context, hiveFileContext, shardUuid, Optional.ofNullable(shardDeltaMap.get(shardUuid)), tableSupportsDeltaDelete, bucketNumber, columns, predicate, attributes, transactionId, columnTypes); } Iterator<ConnectorPageSource> iterator = raptorSplit.getShardUuids().stream() .map(shardUuid -> createPageSource( context, hiveFileContext, shardUuid, Optional.ofNullable(shardDeltaMap.get(shardUuid)), tableSupportsDeltaDelete, bucketNumber, columns, predicate, attributes, transactionId, columnTypes)) .iterator(); return new ConcatPageSource(iterator); }

Target:
public ConnectorPageSource createPageSource( ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorSplit split, List<ColumnHandle> columns, SplitContext splitContext) { RaptorSplit raptorSplit = (RaptorSplit) split; HiveFileContext hiveFileContext = new HiveFileContext(splitContext.isCacheable(), Optional.empty()); OptionalInt bucketNumber = raptorSplit.getBucketNumber(); TupleDomain<RaptorColumnHandle> predicate = raptorSplit.getEffectivePredicate(); ReaderAttributes attributes = ReaderAttributes.from(session); OptionalLong transactionId = raptorSplit.getTransactionId(); Optional<Map<String, Type>> columnTypes = raptorSplit.getColumnTypes(); boolean tableSupportsDeltaDelete = raptorSplit.isTableSupportsDeltaDelete(); FileSystemContext context = new FileSystemContext(session); Map<UUID, UUID> shardDeltaMap = raptorSplit.getShardDeltaMap(); if (raptorSplit.getShardUuids().size() == 1) { UUID shardUuid = raptorSplit.getShardUuids().iterator().next(); return createPageSource( context, hiveFileContext, shardUuid, Optional.ofNullable(shardDeltaMap.get(shardUuid)), tableSupportsDeltaDelete, bucketNumber, columns, predicate, attributes, transactionId, columnTypes); } Iterator<ConnectorPageSource> iterator = raptorSplit.getShardUuids().stream() .map(shardUuid -> createPageSource( context, hiveFileContext, shardUuid, Optional.ofNullable(shardDeltaMap.get(shardUuid)), tableSupportsDeltaDelete, bucketNumber, columns, predicate, attributes, transactionId, columnTypes)) .iterator(); return new ConcatPageSource(iterator); }
Source:
public List<CloudBlobMetadata> purgeBlobs(List<CloudBlobMetadata> blobMetadataList) throws BlobStorageException { List<CloudBlobMetadata> deletedBlobs = new ArrayList<>(); List<List<CloudBlobMetadata>> partitionedLists = Lists.partition(blobMetadataList, purgeBatchSize); for (List<CloudBlobMetadata> someBlobs : partitionedLists) { BlobBatch blobBatch = blobBatchClient.getBlobBatch(); List<Response<Void>> responseList = new ArrayList<>(); for (CloudBlobMetadata blobMetadata : someBlobs) { String containerName = getAzureContainerName(blobMetadata); String blobName = getAzureBlobName(blobMetadata); responseList.add(blobBatch.deleteBlob(containerName, blobName)); } blobBatchClient.submitBatchWithResponse(blobBatch, false, Duration.ofHours(1), Context.NONE); for (int j = 0; j < responseList.size(); j++) { Response<Void> response = responseList.get(j); CloudBlobMetadata blobMetadata = someBlobs.get(j); int statusCode; try { statusCode = response.getStatusCode(); } catch (BlobStorageException bex) { statusCode = bex.getStatusCode(); } switch (statusCode) { case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_ACCEPTED: case HttpURLConnection.HTTP_NOT_FOUND: case HttpURLConnection.HTTP_GONE: deletedBlobs.add(blobMetadata); break; default: logger.error("Deleting blob got status {}", blobMetadata.getId(), statusCode); } } } return deletedBlobs; }

Target:
public List<CloudBlobMetadata> purgeBlobs(List<CloudBlobMetadata> blobMetadataList) throws BlobStorageException { List<CloudBlobMetadata> deletedBlobs = new ArrayList<>(); List<List<CloudBlobMetadata>> partitionedLists = Utils.partitionList(blobMetadataList, purgeBatchSize); for (List<CloudBlobMetadata> batchOfBlobs : partitionedLists) { BlobBatch blobBatch = blobBatchClient.getBlobBatch(); List<Response<Void>> responseList = new ArrayList<>(); for (CloudBlobMetadata blobMetadata : batchOfBlobs) { String containerName = getAzureContainerName(blobMetadata); String blobName = getAzureBlobName(blobMetadata); responseList.add(blobBatch.deleteBlob(containerName, blobName)); } blobBatchClient.submitBatchWithResponse(blobBatch, false, Duration.ofSeconds(batchPurgeTimeoutSec), Context.NONE); for (int j = 0; j < responseList.size(); j++) { Response<Void> response = responseList.get(j); CloudBlobMetadata blobMetadata = batchOfBlobs.get(j); int statusCode; try { statusCode = response.getStatusCode(); } catch (BlobStorageException bex) { statusCode = bex.getStatusCode(); } switch (statusCode) { case HttpURLConnection.HTTP_OK: case HttpURLConnection.HTTP_ACCEPTED: case HttpURLConnection.HTTP_NOT_FOUND: case HttpURLConnection.HTTP_GONE: deletedBlobs.add(blobMetadata); break; default: logger.error("Deleting blob got status {}", blobMetadata.getId(), statusCode); } } } return deletedBlobs; }
Source:
private int calculateRunSize(int sizeIdx) { int maxElements = 1 << pageShifts - SizeClasses.LOG2_QUANTUM; int runSize = 0, nElements; final int elemSize = arena.sizeIdx2size(sizeIdx); do { runSize += pageSize; nElements = runSize / elemSize; if (nElements >= maxElements) { break; } } while (runSize != nElements * elemSize); while (nElements > maxElements) { runSize -= pageSize; nElements = runSize / elemSize; } assert nElements > 0; assert runSize <= chunkSize; assert runSize >= elemSize; return runSize; }

Target:
private int calculateRunSize(int sizeIdx) { int maxElements = 1 << pageShifts - SizeClasses.LOG2_QUANTUM; int runSize = 0; int nElements; final int elemSize = arena.sizeIdx2size(sizeIdx); do { runSize += pageSize; nElements = runSize / elemSize; } while (nElements < maxElements && runSize != nElements * elemSize); while (nElements > maxElements) { runSize -= pageSize; nElements = runSize / elemSize; } assert nElements > 0; assert runSize <= chunkSize; assert runSize >= elemSize; return runSize; }
Source:
public Trader(String name, double cashInHand) { super(); this.name = name; this.cashInHand = cashInHand; this.position = new ArrayList<Order>(); this.ordersPlaced = new ArrayList<Order>(); }

Target:
public Trader(String name, double cashInHand) { this.name = name; this.cashInHand = cashInHand; this.position = new ArrayList<Order>(); this.ordersPlaced = new ArrayList<Order>(); }
Source:
private void reset() { probeIndexBuilder.reset(); buildPageBuilder.reset(); if (reachedProbeEnd) { probe = null; } }

Target:
private void reset() { probeIndexBuilder.clear(); buildPageBuilder.reset(); if (reachedProbeEnd) { probe = null; } }
Source:
public static String messagesToJson(Project project, String... additionalTags) { if (project == null) { return emptyJSON; } List<String> tags = new ArrayList<>(); tags.addAll(Arrays.asList(additionalTags)); tags.add(project.getName()); project.getGroups().stream().forEach((Group t) -> { tags.add(t.getName()); }); return messagesToJson(tags); }

Target:
public static String messagesToJson(Project project, String... additionalTags) { if (project == null) { return JSONable.EMPTY; } List<String> tags = new ArrayList<>(); tags.addAll(Arrays.asList(additionalTags)); tags.add(project.getName()); project.getGroups().stream().map(Group::getName).forEach(tags::add); return messagesToJson(tags); }
Source:
public String getConfirmationLink() { String ref = ""; if (institute == null) { ref = Const.ActionURIs.INSTRUCTOR_COURSE_JOIN_AUTHENTICATED + "?key=" + regkey; } else { ref = Const.ActionURIs.INSTRUCTOR_COURSE_JOIN_AUTHENTICATED + "?key=" + regkey + "&" + Const.ParamsNames.INSTRUCTOR_INSTITUTION + "=" + Sanitizer.sanitizeForUri(institute); } return ref; }

Target:
public String getConfirmationLink() { String ref = Const.ActionURIs.INSTRUCTOR_COURSE_JOIN_AUTHENTICATED + "?key=" + regkey; if (institute != null) { ref += "&" + Const.ParamsNames.INSTRUCTOR_INSTITUTION + "=" + Sanitizer.sanitizeForUri(institute); } return ref; }
Source:
private void writeRepeatedWithReuse(int COUNT, ValuesWriter cw, String prefix) throws UnsupportedEncodingException { byte[] reused = (prefix + "0").getBytes("UTF-8"); for (int i = 0; i < COUNT; i++) { Binary content = Binary.fromString(prefix + i % 10); System.arraycopy(content.getBytesUnsafe(), 0, reused, 0, reused.length); cw.writeBytes(Binary.fromReusedByteArray(reused)); } }

Target:
private void writeRepeatedWithReuse(int COUNT, ValuesWriter cw, String prefix) throws UnsupportedEncodingException { Binary reused = Binary.fromReusedByteArray((prefix + "0").getBytes("UTF-8")); for (int i = 0; i < COUNT; i++) { Binary content = Binary.fromString(prefix + i % 10); System.arraycopy(content.getBytesUnsafe(), 0, reused.getBytesUnsafe(), 0, reused.length()); cw.writeBytes(reused); } }