auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static DetailAST findFirstChildNodeOfType( final DetailAST node, final int type ) { DetailAST result = node.findFirstToken(type); if (result == null) { final DetailAST dot = node.findFirstToken(TokenTypes.DOT); if (dot != null) { result = DiamondOperatorCheck .findFirstChildNodeOfType(dot, type); } } return result; }

Target:
private static DetailAST findFirstChildNodeOfType( final DetailAST node, final int type ) { DetailAST result = node.findFirstToken(type); if (result == null) { final DetailAST child = node.getFirstChild(); if (child != null) { result = DiamondOperatorCheck .findFirstChildNodeOfType(child, type); } } return result; }
Source:
protected Supplier<String> internalGetAttribute(String attr) { Widget widget = getWidget(); switch(attr){ case "style": return () -> swtStyles != null ? swtStyles : ""; case "class": return () -> Objects.toString(getCSSClass(widget), ""); case "swt-lines-visible": if (widget instanceof Table) { return () -> String.valueOf(((Table) widget).getLinesVisible()); } if (widget instanceof Tree) { return () -> String.valueOf(((Tree) widget).getLinesVisible()); } case "swt-data-class": return () -> { Object data = widget.getData(); if (data == null) { return ""; } StringBuilder sb = new StringBuilder(); for (Class<?> clazz = data.getClass(); clazz != Object.class; sb.append(' ')) { sb.append(clazz.getName()); clazz = clazz.getSuperclass(); } return sb.toString(); }; default: Object o = widget.getData(attr.toLowerCase()); if (o != null) { return () -> o.toString(); } } return null; }

Target:
protected Supplier<String> internalGetAttribute(String attr) { Widget widget = getWidget(); switch(attr){ case "style": return () -> swtStyles != null ? swtStyles : ""; case "class": return () -> Objects.toString(getCSSClass(widget), ""); case "swt-data-class": return () -> { Object data = widget.getData(); if (data == null) { return ""; } StringBuilder sb = new StringBuilder(); for (Class<?> clazz = data.getClass(); clazz != Object.class; sb.append(' ')) { sb.append(clazz.getName()); clazz = clazz.getSuperclass(); } return sb.toString(); }; default: Object o = widget.getData(attr.toLowerCase()); if (o != null) { return () -> o.toString(); } } return null; }
Source:
public void shutdown() { isShutdown = true; getTableRegistry().shutdown(); garbageCollector.stop(); runtimeExecutor.shutdownNow(); if (layout != null) { try { layout.cancel(true); } catch (Exception e) { log.error("Runtime shutting down. Exception in terminating fetchLayout: {}", e); } } stop(true); if (parameters.shutdownNettyEventLoop) { nettyEventLoop.shutdownGracefully(); } }

Target:
public void shutdown() { isShutdown = true; TableRegistry tableRegistryObj = tableRegistry.get(); if (tableRegistryObj != null) { tableRegistryObj.shutdown(); } garbageCollector.stop(); runtimeExecutor.shutdownNow(); if (layout != null) { try { layout.cancel(true); } catch (Exception e) { log.error("Runtime shutting down. Exception in terminating fetchLayout: {}", e); } } stop(true); if (parameters.shutdownNettyEventLoop) { nettyEventLoop.shutdownGracefully(); } }
Source:
public void commit(Xid xid, boolean onePhase) throws XAException { if (LOG.isTraceEnabled()) { LOG.trace("DummyXAResource.commit(xid=" + xid + ", onePhase=" + onePhase + ")"); } counter.incrementAndGet(); }

Target:
public void commit(Xid xid, boolean onePhase) throws XAException { LOG.info("DummyXAResource.commit(xid=" + xid + ", onePhase=" + onePhase + ")"); counter.incrementAndGet(); }
Source:
public void testBindString() { final String drl = "import org.drools.compiler.oopath.*;\n" + "global java.util.List list\n" + "\n" + "rule R when\n" + " Adult( $name: /name )\n" + "then\n" + " list.add( $name );\n" + "end\n"; testScenarioBindString(drl, "Bob", "Alice"); }

Target:
public void testBindString() { final String drl = "import org.drools.compiler.oopath.model.*;\n" + "global java.util.List list\n" + "\n" + "rule R when\n" + " Adult( $name: /name )\n" + "then\n" + " list.add( $name );\n" + "end\n"; testScenarioBindString(drl, "Bob", "Alice"); }
Source:
public String getMessage() { return message; }

Target:
public final String getMessage() { return message; }
Source:
public static ResultSet executeQuery(Connection conn, QueryBuilder queryBuilder, String url, Configuration config) throws SQLException { SQLContext sqlContext = new SQLContext(SparkUtil.getSparkContext()); boolean forceRowKeyOrder = conn.unwrap(PhoenixConnection.class).getQueryServices().getProps() .getBoolean(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, false); if (forceRowKeyOrder && (queryBuilder.getOrderByClause()==null || queryBuilder.getOrderByClause().isEmpty())) { queryBuilder.setOrderByClause(Joiner.on(", ").join(queryBuilder.getRequiredColumns())); } Dataset phoenixDataSet = new PhoenixRDD(SparkUtil.getSparkContext(), queryBuilder.getFullTableName(), JavaConverters.collectionAsScalaIterableConverter(queryBuilder.getRequiredColumns()).asScala() .toSeq(), Option.apply((String) null), Option.apply(url), config, false, null).toDataFrame(sqlContext); phoenixDataSet.registerTempTable(queryBuilder.getFullTableName()); Dataset<Row> dataset = sqlContext.sql(queryBuilder.build()); SparkPlan plan = dataset.queryExecution().executedPlan(); Log.debug("Spark plan : "+plan.toString()); List<Row> rows = dataset.collectAsList(); ResultSet rs = new SparkResultSet(rows, dataset.columns()); return rs; }

Target:
public static ResultSet executeQuery(Connection conn, QueryBuilder queryBuilder, String url, Configuration config) throws SQLException { SQLContext sqlContext = SparkUtil.getSqlContext(); boolean forceRowKeyOrder = conn.unwrap(PhoenixConnection.class).getQueryServices().getProps() .getBoolean(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, false); String prevOrderBy = queryBuilder.getOrderByClause(); if (forceRowKeyOrder && (queryBuilder.getOrderByClause()==null || queryBuilder.getOrderByClause().isEmpty())) { queryBuilder.setOrderByClause(Joiner.on(", ").join(queryBuilder.getRequiredColumns())); } Dataset phoenixDataSet = new PhoenixRDD(SparkUtil.getSparkContext(), queryBuilder.getFullTableName(), JavaConverters.collectionAsScalaIterableConverter(queryBuilder.getRequiredColumns()).asScala() .toSeq(), Option.apply((String) null), Option.apply(url), config, false, null).toDataFrame(sqlContext); phoenixDataSet.registerTempTable(queryBuilder.getFullTableName()); Dataset<Row> dataset = sqlContext.sql(queryBuilder.build()); SparkPlan plan = dataset.queryExecution().executedPlan(); Log.debug("Spark plan : "+plan.toString()); List<Row> rows = dataset.collectAsList(); queryBuilder.setOrderByClause(prevOrderBy); ResultSet rs = new SparkResultSet(rows, dataset.columns()); return rs; }
Source:
public void saveRadiologyReport_shouldSaveRadiologyReportInDatabaseAndReturnIt() throws Exception { RadiologyReport existingRadiologyReport = radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID); existingRadiologyReport.setRadiologyReportStatus(RadiologyReportStatus.CLAIMED); existingRadiologyReport.setText("test - text"); RadiologyReport updatedReport = radiologyService.saveRadiologyReport(existingRadiologyReport); assertNotNull(updatedReport); assertThat(updatedReport.getId(), is(EXISTING_RADIOLOGY_REPORT_ID)); }

Target:
public void saveRadiologyReport_shouldSaveRadiologyReportInDatabaseAndReturnIt() throws Exception { RadiologyReport existingRadiologyReport = radiologyService .getRadiologyReportByRadiologyReportId(EXISTING_RADIOLOGY_REPORT_ID); existingRadiologyReport.setReportStatus(RadiologyReportStatus.CLAIMED); existingRadiologyReport.setReportBody("test - text"); assertNotNull(radiologyService.saveRadiologyReport(existingRadiologyReport)); assertThat(radiologyService.saveRadiologyReport(existingRadiologyReport).getId(), is(EXISTING_RADIOLOGY_REPORT_ID)); assertThat(radiologyService.saveRadiologyReport(existingRadiologyReport).getReportBody(), is("test - text")); }
Source:
public void addService(String basePath, Object service) { services.put(basePath, service); metadata.addMicroserviceMetadata(service, basePath); if (log.isDebugEnabled()) { log.debug("Added microservice: " + service); } }

Target:
public void addService(String basePath, Object service) { services.put(basePath, service); metadata.addMicroserviceMetadata(service, basePath); log.debug("Added microservice: {}.", service); }
Source:
public void usingUserWithViewRolesWithOauth() throws Exception { final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); TestPropertyValues.of( "spring.cloud.dataflow.client.server-uri=" + "http://localhost:" + localDataflowResource.getDataflowPort(), "spring.cloud.dataflow.client.authentication.client-id=myclient", "spring.cloud.dataflow.client.authentication.client-secret=mysecret", "spring.cloud.dataflow.client.authentication.token-uri=" + "http://localhost:" + oAuth2ServerResource.getOauth2ServerPort() + "/oauth/token", "spring.cloud.dataflow.client.authentication.scope=dataflow.view").applyTo(context); context.register(TestApplication2.class); context.refresh(); final DataFlowOperations dataFlowOperations = context.getBean(DataFlowOperations.class); final AboutResource about = dataFlowOperations.aboutOperation().get(); assertNotNull(about); assertEquals("myclient", about.getSecurityInfo().getUsername()); assertEquals(1, about.getSecurityInfo().getRoles().size()); context.close(); }

Target:
public void usingUserWithViewRolesWithOauth() { context = new AnnotationConfigApplicationContext(); TestPropertyValues.of( "spring.cloud.dataflow.client.server-uri=" + "http://localhost:" + localDataflowResource.getDataflowPort(), "spring.cloud.dataflow.client.authentication.client-id=myclient", "spring.cloud.dataflow.client.authentication.client-secret=mysecret", "spring.cloud.dataflow.client.authentication.token-uri=" + "http://localhost:" + oAuth2ServerResource.getOauth2ServerPort() + "/oauth/token", "spring.cloud.dataflow.client.authentication.scope=dataflow.view").applyTo(context); context.register(TestApplication2.class); context.refresh(); final DataFlowOperations dataFlowOperations = context.getBean(DataFlowOperations.class); final AboutResource about = dataFlowOperations.aboutOperation().get(); assertNotNull(about); assertEquals("myclient", about.getSecurityInfo().getUsername()); assertEquals(1, about.getSecurityInfo().getRoles().size()); }
Source:
public void setWordWrap(boolean newWordWrapStatus) { if (!isWordWrapSupported() || newWordWrapStatus == fIsWordWrapActivated) return; fIsWordWrapActivated = newWordWrapStatus; ISourceViewer viewer= getSourceViewer(); if (viewer != null && !isBlockSelectionModeEnabled()) { StyledText styledText= viewer.getTextWidget(); if (styledText != null) { styledText.setWordWrap(newWordWrapStatus); } } if (fVerticalRuler != null) { fVerticalRuler.update(); } }

Target:
public void setWordWrap(boolean newWordWrapStatus) { if (newWordWrapStatus == fIsWordWrapEnabled || !isWordWrapSupported()) return; fIsWordWrapEnabled = newWordWrapStatus; ISourceViewer viewer= getSourceViewer(); if (viewer != null && !isBlockSelectionModeEnabled()) { StyledText styledText= viewer.getTextWidget(); if (styledText != null) { styledText.setWordWrap(newWordWrapStatus); } } }
Source:
public void launchJob(AnalysisJob analysisJob) { final String datastoreName = analysisJob.getDatastore().getName(); final Datastore datastore = _dataCleanerConfiguration.getDatastoreCatalog().getDatastore(datastoreName); if (datastore == null) { throw new IllegalStateException("Datastore referred by the job (" + datastoreName + ") has not been found in the specified DataCleanerConfiguration"); } else { JavaSparkContext sc = null; try { DataContext dataContext = datastore.openConnection().getDataContext(); if (dataContext instanceof CsvDataContext) { CsvDataContext csvDataContext = (CsvDataContext) dataContext; String datastoreFilePath = csvDataContext.getResource().getQualifiedPath(); SparkConf conf = new SparkConf().setAppName("DataCleaner-spark").setMaster("yarn-client"); sc = new JavaSparkContext(conf); JavaRDD<String> instructionsRDD = sc.textFile(datastoreFilePath); long lineCount = instructionsRDD.count(); logger.info("Line count: " + lineCount); } } finally { if (sc != null) { sc.stop(); } } } }

Target:
public void launchJob(AnalysisJob analysisJob) { final String datastoreName = analysisJob.getDatastore().getName(); final Datastore datastore = _dataCleanerConfiguration.getDatastoreCatalog().getDatastore(datastoreName); if (datastore == null) { throw new IllegalStateException("Datastore referred by the job (" + datastoreName + ") has not been found in the specified DataCleanerConfiguration"); } else { JavaSparkContext sc = null; try { DataContext dataContext = datastore.openConnection().getDataContext(); if (dataContext instanceof CsvDataContext) { CsvDataContext csvDataContext = (CsvDataContext) dataContext; String datastoreFilePath = csvDataContext.getResource().getQualifiedPath(); SparkConf conf = new SparkConf().setAppName("DataCleaner-spark"); sc = new JavaSparkContext(conf); JavaRDD<String> instructionsRDD = sc.textFile(datastoreFilePath); long lineCount = instructionsRDD.count(); logger.info("Line count: " + lineCount); } } finally { if (sc != null) { sc.stop(); } } } }
Source:
public NodeValue getAccValue() { double median; if ( count == 0 ) return noValuesToMedian ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } Arrays.sort(arrDouble); if(indexsize%2!=0) { median = arrDouble[(indexsize/2)]; }else { median = ((arrDouble[(indexsize/2)]+arrDouble[((indexsize/2)-1)])/2); } return (NodeValue.makeDecimal((median))); }

Target:
public NodeValue getAccValue() { double median; if ( count == 0 ) return noValuesToMedian ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } Arrays.sort(arrDouble); if(indexsize%2!=0) { median = arrDouble[(indexsize/2)]; }else { median = ((arrDouble[(indexsize/2)]+arrDouble[((indexsize/2)-1)])/2); } return NodeValue.makeDecimal(median); }
Source:
private void populateDefaultsForAllOrders(Order order) { Provider orderer = order.getOrderer(); if (orderer == null) { order.setOrderer(getProvider()); } User creator = Utils.getUserFromProvider(orderer); order.setEncounter(createEncounter(order.getPatient(), creator, new Date())); order.setCreator(creator); }

Target:
private void populateDefaultsForAllOrders(Order order) { Provider orderer = order.getOrderer(); if (orderer == null) { order.setOrderer(getProvider()); } User creator = Utils.getUserFromProvider(orderer); order.setEncounter(createEncounter(order.getPatient(), creator, new Date())); }
Source:
@Override public String getMessage() { return String.format("Trip Ids %s & %s (route %s) are duplicates (%s)", duplicateTripId, affectedEntityId, routeId, tripKey); }

Target:
@Override public String getMessage() { return String.format("Trip Ids %s & %s (route %s) are duplicates (pattern: %s, calendar: %s, from %s to %s)", duplicateTripId, affectedEntityId, routeId, patternName, serviceId, firstDeparture, lastArrival); }
Source:
void takePictureInternal(final ReadableMap options) { if (!mIsRecording.get() && isPictureCaptureInProgress.compareAndSet(false, true)) { try{ if (options.hasKey("orientation") && options.getInt("orientation") != Constants.ORIENTATION_AUTO) { mOrientation = options.getInt("orientation"); int rotation = orientationEnumToRotation(mOrientation); mCameraParameters.setRotation(calcCameraRotation(rotation)); try{ mCamera.setParameters(mCameraParameters); } catch(RuntimeException e ) { Log.e("CAMERA_1::", "setParameters failed", e); } } mCamera.takePicture(null, null, null, new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { if (options.hasKey("pauseAfterCapture") && !options.getBoolean("pauseAfterCapture")) { camera.startPreview(); mIsPreviewActive = true; if (mIsScanning) { camera.setPreviewCallback(Camera1.this); } } else { camera.stopPreview(); mIsPreviewActive = false; camera.setPreviewCallback(null); } isPictureCaptureInProgress.set(false); mOrientation = Constants.ORIENTATION_AUTO; mCallback.onPictureTaken(data, displayOrientationToOrientationEnum(mDeviceOrientation), 0); if(mustUpdateSurface){ updateSurface(); } } }); } catch(Exception e){ isPictureCaptureInProgress.set(false); throw e; } } else{ throw new IllegalStateException("Camera capture failed. Camera is already capturing."); } }

Target:
void takePictureInternal(final ReadableMap options) { if (!mIsRecording.get() && isPictureCaptureInProgress.compareAndSet(false, true)) { try{ if (options.hasKey("orientation") && options.getInt("orientation") != Constants.ORIENTATION_AUTO) { mOrientation = options.getInt("orientation"); int rotation = orientationEnumToRotation(mOrientation); mCameraParameters.setRotation(calcCameraRotation(rotation)); try{ mCamera.setParameters(mCameraParameters); } catch(RuntimeException e ) { Log.e("CAMERA_1::", "setParameters failed", e); } } mCamera.takePicture(null, null, null, new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { if (options.hasKey("pauseAfterCapture") && !options.getBoolean("pauseAfterCapture")) { camera.startPreview(); mIsPreviewActive = true; if (mIsScanning) { camera.setPreviewCallback(Camera1.this); } } else { camera.stopPreview(); mIsPreviewActive = false; camera.setPreviewCallback(null); } isPictureCaptureInProgress.set(false); mOrientation = Constants.ORIENTATION_AUTO; mCallback.onPictureTaken(data, displayOrientationToOrientationEnum(mDeviceOrientation), getCameraOrientation()); if(mustUpdateSurface){ updateSurface(); } } }); } catch(Exception e){ isPictureCaptureInProgress.set(false); throw e; } } else{ throw new IllegalStateException("Camera capture failed. Camera is already capturing."); } }
Source:
public static int writeUnsignedInt(byte[] bytes, int offset, int i) { int localOffset = offset; while ((i & ~0x7F) != 0) { bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80); i >>>= 7; } bytes[localOffset] = (byte) i; return localOffset + 1; }

Target:
public static int writeUnsignedInt(byte[] bytes, int offset, int i) { int localOffset = offset; while ((i & ~0x7F) != 0) { bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80); i >>>= 7; } bytes[localOffset++] = (byte) i; return localOffset - offset; }
Source:
public Transport getTransport(Set<SocketAddress> failedServers, byte[] cacheName) { SocketAddress server; synchronized (lock) { FailoverRequestBalancingStrategy balancer = balancers.get(cacheName); if (balancer == null) balancer = addBalancer(cacheName); server = balancer.nextServer(failedServers); } return borrowTransportFromPool(server); }

Target:
public Transport getTransport(Set<SocketAddress> failedServers, byte[] cacheName) { SocketAddress server; synchronized (lock) { server = getNextServer(failedServers, cacheName); } return borrowTransportFromPool(server); }
Source:
private View createCheckableAction(CarMenuItem item) { Context context = getContext(); ViewGroup checkableAction = (ViewGroup) LayoutInflater.from(context) .inflate(R.layout.checkable_action_item, this, false); Switch switchWidget = checkableAction.findViewById(R.id.switch_widget); switchWidget.setEnabled(item.isEnabled()); switchWidget.setChecked(item.isChecked()); switchWidget.setScaleX(mSwitchScale); switchWidget.setScaleY(mSwitchScale); checkableAction.setOnClickListener(b -> { if (!item.isEnabled()) { return; } switchWidget.toggle(); item.setChecked(switchWidget.isChecked()); CarMenuItem.OnClickListener itemOnClickListener = item.getOnClickListener(); if (itemOnClickListener != null) { itemOnClickListener.onClick(item); } }); CharSequence title = item.getTitle(); if (!(title == null || TextUtils.isEmpty(title))) { Button button = new Button(context, null, 0, item.getStyleResId()); button.setText(title); button.setBackgroundResource(0); checkableAction.addView(button); } return checkableAction; }

Target:
private View createCheckableAction(CarMenuItem item) { Context context = getContext(); ViewGroup checkableAction = (ViewGroup) LayoutInflater.from(context) .inflate(R.layout.checkable_action_item, this, false); Switch switchWidget = checkableAction.findViewById(R.id.switch_widget); switchWidget.setEnabled(item.isEnabled()); switchWidget.setChecked(item.isChecked()); if (item.isEnabled()) { checkableAction.setOnClickListener(v -> { switchWidget.toggle(); item.setChecked(switchWidget.isChecked()); CarMenuItem.OnClickListener itemOnClickListener = item.getOnClickListener(); if (itemOnClickListener != null) { itemOnClickListener.onClick(item); } }); } else { checkableAction.setClickable(false); } CharSequence title = item.getTitle(); if (!TextUtils.isEmpty(title)) { Button button = new Button(context, null, 0, item.getStyleResId()); button.setText(title); checkableAction.addView(button); } return checkableAction; }
Source:
private Map.Entry<String, Object> downloadSingleFile(String path) throws DropboxException { try { OutputStreamBuilder target = OutputStreamBuilder.withExchange(exchange); DbxEntry.File downloadedFile = client.getFile(path, null, target); if (downloadedFile != null) { LOG.info("downloaded path:" + path); return new AbstractMap.SimpleEntry<>(path, target.build()); } else { return null; } } catch (DbxException e) { throw new DropboxException(path + " does not exist or can't obtain metadata"); } catch (IOException e) { throw new DropboxException(path + " can't obtain a stream"); } }

Target:
private Map.Entry<String, Object> downloadSingleFile(String path) throws DropboxException { try { OutputStreamBuilder target = OutputStreamBuilder.withExchange(exchange); DbxEntry.File downloadedFile = client.getFile(path, null, target); if (downloadedFile != null) { LOG.debug("downloaded path={}", path); return new AbstractMap.SimpleEntry<>(path, target.build()); } else { return null; } } catch (DbxException e) { throw new DropboxException(path + " does not exist or can't obtain metadata"); } catch (IOException e) { throw new DropboxException(path + " can't obtain a stream"); } }
Source:
protected boolean loadNextFromDisk() { return !fetched && (state == null || state.getAddedProperty( propertyKeyId ) == null); }

Target:
protected boolean loadNextFromDisk() { if ( fetched ) { return false; } return state == null || state.getAddedProperty( propertyKeyId ) == null; }
Source:
public int compareTo(BaragonRequestKey o) { return updatedAt >= o.updatedAt ? -1 : 1; }

Target:
public int compareTo(BaragonRequestKey o) { return Long.compare(updatedAt, o.updatedAt); }
Source:
private String readLine(boolean trim) throws IOException { boolean done = false; boolean sawCarriage = false; int removalBytes = 0; while (!done) { if (isReadBufferEmpty()) { offset = 0; end = 0; int bytesRead = inputStream.read(buffer, end, Math.min(DEFAULT_READ_COUNT, buffer.length - end)); if (bytesRead < 0) { if (sawCarriage) { done = true; if (trim) { removalBytes = -1; } } else { throw new IOException("Reached the end of the stream"); } } else { end += bytesRead; } } int originalOffset = offset; for (; !done && offset < end; offset++) { if (buffer[offset] == LF || sawCarriage) { int cpLength = offset - originalOffset + 1; if (trim) { int length = 0; if (buffer[offset] == LF) { length ++; if (sawCarriage) { length++; } } else { offset--; length += 2; } cpLength -= length; } if (cpLength > 0) { copyToStrBuffer(buffer, originalOffset, cpLength); } else { removalBytes = cpLength; } done = true; } else { sawCarriage = buffer[offset] == CR; } } if (!done) { copyToStrBuffer(buffer, originalOffset, end - originalOffset); offset = end; } } int strLength = strBufferIndex + removalBytes; strBufferIndex = 0; return new String(strBuffer, 0, strLength, charset); }

Target:
private String readLine(boolean trim) throws IOException { boolean done = false; boolean sawCarriage = false; int removalBytes = 0; while (!done) { if (isReadBufferEmpty()) { offset = 0; end = 0; int bytesRead = inputStream.read(buffer, end, Math.min(DEFAULT_READ_COUNT, buffer.length - end)); if (bytesRead < 0) { throw new IOException("Reached the end of the stream"); } else { end += bytesRead; } } int originalOffset = offset; for (; !done && offset < end; offset++) { if (buffer[offset] == LF) { int cpLength = offset - originalOffset + 1; if (trim) { int length = 0; if (buffer[offset] == LF) { length ++; if (sawCarriage) { length++; } } cpLength -= length; } if (cpLength > 0) { copyToStrBuffer(buffer, originalOffset, cpLength); } else { removalBytes = cpLength; } done = true; } else { sawCarriage = buffer[offset] == CR; } } if (!done) { copyToStrBuffer(buffer, originalOffset, end - originalOffset); offset = end; } } int strLength = strBufferIndex + removalBytes; strBufferIndex = 0; return new String(strBuffer, 0, strLength, charset); }
Source:
public RemoteConnector(RemoteSettings settings) { fSettings = settings; new Throwable().printStackTrace(); }

Target:
public RemoteConnector(RemoteSettings settings) { fSettings = settings; }
Source:
public void register() { if (!registered.get() && registered.compareAndSet(false, true)) { DubboShutdownHook dubboShutdownHook = getDubboShutdownHook(); Runtime.getRuntime().addShutdownHook(dubboShutdownHook); dispatch(new DubboShutdownHookRegisteredEvent(dubboShutdownHook)); ShutdownHookCallbacks.INSTANCE.addCallback(() -> { AbstractRegistryFactory.destroyAll(); this.destroyProtocols(); }); } }

Target:
public void register() { if (!registered.get() && registered.compareAndSet(false, true)) { DubboShutdownHook dubboShutdownHook = getDubboShutdownHook(); Runtime.getRuntime().addShutdownHook(dubboShutdownHook); dispatch(new DubboShutdownHookRegisteredEvent(dubboShutdownHook)); } }
Source:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"- " \"<LINK_0>\">"); email = request.getParameter("email"); password = request.getParameter("password"); BasicUserService basicUserService = new BasicUserService(new DbUserServices()); boolean authenticated = false; try { authenticated = basicUserService.verifyUser(email, password); } catch (PersistanceUserServicesException e) { e.printStackTrace(); } if (authenticated) { out.println("<p>HI</p>"); } else { out.println("<p>Username not found. Do you want to <a href = \"register.html\"> register</a>?</p>"); } }

Target:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"- " \"<LINK_0>\">"); out.println("<head><title>Login Page</title></head><body>"); email = request.getParameter("email"); password = request.getParameter("password"); UserService userService = ServiceFactory.getUserServiceInstance(); boolean authenticated = false; try { authenticated = userService.verifyUser(email, password); } catch (UserServiceException e) { System.err.println("User service error occurred"); e.printStackTrace(); } if (authenticated) { out.println("<p>Welcome to the Diet Tracker App</p><p>Redirecting...</p>"); response.setHeader("Location", "./welcome.jsp"); } else { out.println("<p>Username not found. Do you want to <a href = \"register.html\"> register</a>?</p>"); } out.println("</body></html>"); }
Source:
protected Object openWhenClosed(Object info, boolean forceAdd, IProgressMonitor monitor) throws JavaModelException { JavaModelManager manager = JavaModelManager.getJavaModelManager(); boolean hadTemporaryCache = manager.hasTemporaryCache(); try { HashMap<IJavaElement, Object> newElements = manager.getTemporaryCache(); generateInfos(info, newElements, monitor); if (info == null) { info = newElements.get(this); } if (info == null) { info = manager.getInfo(this); } if (info == null) { Openable openable = (Openable) getOpenable(); if (newElements.containsKey(openable)) { openable.closeBuffer(); } throw newNotPresentException(); } if (!hadTemporaryCache) { info = manager.putInfos(this, info, forceAdd, newElements); } } finally { if (!hadTemporaryCache) { manager.resetTemporaryCache(); } } return info; }

Target:
protected Object openWhenClosed(Object info, boolean forceAdd, IProgressMonitor monitor) throws JavaModelException { JavaModelManager manager = JavaModelManager.getJavaModelManager(); boolean hadTemporaryCache = manager.hasTemporaryCache(); try { HashMap<IJavaElement, Object> newElements = manager.getTemporaryCache(); generateInfos(info, newElements, monitor); if (info == null) { info = newElements.get(this); } if (info == null) { info = manager.getInfo(this); if (info != null) { return info; } } if (info == null) { Openable openable = (Openable) getOpenable(); if (newElements.containsKey(openable)) { openable.closeBuffer(); } throw newNotPresentException(); } if (!hadTemporaryCache) { info = manager.putInfos(this, info, forceAdd, newElements); } } finally { if (!hadTemporaryCache) { manager.resetTemporaryCache(); } } return info; }
Source:
private void notifyThingsAboutBridgeStatusChange(final Bridge bridge, final ThingStatusInfo bridgeStatus) { if (bridgeStatus.getStatus() == ThingStatus.ONLINE || bridgeStatus.getStatus() == ThingStatus.OFFLINE) { for (final Thing child : bridge.getThings()) { ThreadPoolManager.getPool(THING_MANAGER_THREADPOOL_NAME).execute(new Runnable() { @Override public void run() { try { ThingHandler handler = child.getHandler(); if (handler != null && isInitialized(child)) { handler.bridgeStatusChanged(bridgeStatus); } } catch (Exception ex) { logger.error("Exception occured during notification about bridge status change on thing '" + child.getUID() + "': " + ex.getMessage(), ex); } } }); } } }

Target:
private void notifyThingsAboutBridgeStatusChange(final Bridge bridge, final ThingStatusInfo bridgeStatus) { if (bridgeStatus.getStatus() == ThingStatus.ONLINE || bridgeStatus.getStatus() == ThingStatus.OFFLINE) { for (final Thing child : bridge.getThings()) { ThreadPoolManager.getPool(THING_MANAGER_THREADPOOL_NAME).execute(new Runnable() { @Override public void run() { try { ThingHandler handler = child.getHandler(); if (handler != null && isInitialized(child)) { handler.bridgeStatusChanged(bridgeStatus); } } catch (Exception e) { logger.error( "Exception occured during notification about bridge status change on thing '{}': {}", child.getUID(), e.getMessage(), e); } } }); } } }
Source:
protected BaseCommand(SelectedOptions selectedOptions) { this.options = selectedOptions; this.paths = selectedOptions.getPaths(); if (options.isQuiet()) { this.printStream = new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { } }); } }

Target:
protected BaseCommand(SelectedOptions selectedOptions) { this.options = selectedOptions; this.paths = selectedOptions.getPaths(); if (options.isQuiet()) { this.printStream = new PrintStream(new OutputStream() { @Override public void write(int b) { } }); } }
Source:
public void writeTo(Wrapper<?> identifier, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { Map<String, String> parameters = mediaType.getParameters(); Boolean isStrict = Boolean.parseBoolean(parameters.get("strict")); MarshallingFormat format = MarshallingFormat.fromType(mediaType.toString()); Marshaller marshaller = MarshallerFactory.getMarshaller(format, Thread.currentThread().getContextClassLoader()); if ((isStrict || STRICT_ID_JSON) && MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType)) { entityStream.write(marshaller.marshall(identifier).getBytes()); } else { entityStream.write(identifier.getId().toString().getBytes()); } }

Target:
public void writeTo(Wrapper<?> identifier, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { Map<String, String> parameters = mediaType.getParameters(); Boolean isStrict = Boolean.parseBoolean(parameters.get("strict")); MarshallingFormat format = MarshallingFormat.fromType(mediaType.toString()); Marshaller marshaller = MarshallerFactory.getMarshaller(format, Thread.currentThread().getContextClassLoader()); boolean isJsonFormat = MediaType.APPLICATION_JSON_TYPE.isCompatible(mediaType); boolean isXmlFormat = MediaType.APPLICATION_XML_TYPE.isCompatible(mediaType); if ((isStrict || STRICT_ID_FORMAT) && (isJsonFormat || isXmlFormat)) { entityStream.write(marshaller.marshall(identifier).getBytes()); } else { entityStream.write(identifier.getId().toString().getBytes()); } }
Source:
protected ChangeLogSet(Run<?,?> run, RepositoryBrowser<?> browser) { this.run = run; build = run instanceof AbstractBuild ? (AbstractBuild) run : null; this.browser = browser; this.scm = null; }

Target:
protected ChangeLogSet(Run<?,?> run, RepositoryBrowser<?> browser) { this(run, browser, null); }
Source:
public String toString() { return "Offset: " + offset + ", Size: " + getSize() + ", Deleted: " + isFlagSet(Flags.Delete_Index) + ", TTL Updated: " + isFlagSet(Flags.Ttl_Update_Index) + ", Undelete Updated: " + isFlagSet( Flags.Undelete_Index) + ", ExpiresAtMs: " + getExpiresAtMs() + ", Original Message Offset: " + getOriginalMessageOffset() + (formatVersion != PersistentIndex.VERSION_0 ? (", OperationTimeAtSecs " + getOperationTimeInMs() + ", AccountId " + getAccountId() + ", ContainerId " + getContainerId()) : "") + (formatVersion > PersistentIndex.VERSION_2 ? ", Update Version:" + lifeVersion : ""); }

Target:
public String toString() { return "Offset: " + offset + ", Size: " + getSize() + ", Deleted: " + isFlagSet(Flags.Delete_Index) + ", TTL Updated: " + isFlagSet(Flags.Ttl_Update_Index) + ", Undelete: " + isFlagSet( Flags.Undelete_Index) + ", ExpiresAtMs: " + getExpiresAtMs() + ", Original Message Offset: " + getOriginalMessageOffset() + (formatVersion != PersistentIndex.VERSION_0 ? (", OperationTimeAtSecs " + getOperationTimeInMs() + ", AccountId " + getAccountId() + ", ContainerId " + getContainerId()) : "") + (formatVersion > PersistentIndex.VERSION_2 ? ", Life Version:" + lifeVersion : ""); }
Source:
public void fallsBackInsideResponse() throws Exception { MatcherAssert.assertThat( new RsPrint( new TkFallback( new Take() { @Override public Response act(final Request req) { return new RsOf( () -> { throw new UnsupportedOperationException(""); }, () -> { throw new IllegalArgumentException( "here we fail" ); } ); } }, new FbFixed(new RsText("caught here!")) ).act(new RqFake()) ).printBody(), Matchers.startsWith("caught") ); }

Target:
public void fallsBackInsideResponse() throws Exception { MatcherAssert.assertThat( new RsPrint( new TkFallback( new Take() { @Override public Response act(final Request req) { return new ResponseOf( () -> { throw new UnsupportedOperationException(""); }, () -> { throw new IllegalArgumentException( "here we fail" ); } ); } }, new FbFixed(new RsText("caught here!")) ).act(new RqFake()) ).printBody(), Matchers.startsWith("caught") ); }
Source:
private Map<String, List<String>> getRefererParameters(Map<String, String[]> requestParams, String referer) throws URISyntaxException { List<NameValuePair> refererParameters = new URIBuilder(referer).getQueryParams(); Map<String, List<String>> combinedRefererParameters = new HashMap<>(); for (NameValuePair pair : refererParameters) { if (!requestParams.containsKey(pair.getName())) { if (combinedRefererParameters.containsKey(pair.getName())) { List<String> values = combinedRefererParameters.get(pair.getName()); values.add(pair.getValue()); combinedRefererParameters.put(pair.getName(), values); } else { combinedRefererParameters.put(pair.getName(), new ArrayList<>(Arrays.asList(pair.getValue()))); } } } return combinedRefererParameters; }

Target:
private Map<String, List<String>> getRefererParameters(Map<String, String[]> requestParams, String referer) throws URISyntaxException, UnsupportedEncodingException { List<Map.Entry<String, String>> queryPairs = getParameterNameValuePairsFromURL(referer); Map<String, List<String>> combinedRefererParameters = new HashMap<>(); for (Map.Entry<String, String> pair : queryPairs) { if (!requestParams.containsKey(pair.getKey())) { if (combinedRefererParameters.containsKey(pair.getKey())) { List<String> values = combinedRefererParameters.get(pair.getKey()); values.add(pair.getValue()); combinedRefererParameters.put(pair.getKey(), values); } else { combinedRefererParameters.put(pair.getKey(), new ArrayList<>(Arrays.asList(pair.getValue()))); } } } return combinedRefererParameters; }
Source:
private void createToolbar() { final IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class); form.getToolBarManager().add(new Action("", Activator.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)) { @Override public void run() { final EditingDomain editingDomain = AdapterFactoryEditingDomain .getEditingDomainFor(modelElementContext .getDomainObject()); new ECPCommand(modelElementContext.getDomainObject(), editingDomain) { @Override protected void doRun() { EcoreUtil.delete(modelElementContext.getDomainObject(), true); } }.run(true); MEEditorPage.this.getEditor().close(true); } }); menuService.populateContributionManager((ContributionManager) form.getToolBarManager(), TOOLBAR_ORG_ECLIPSE_EMF_ECP_EDITOR_INTERNAL_E3_ME_EDITOR_PAGE); form.getToolBarManager().update(true); }

Target:
private void createToolbar() { final IMenuService menuService = (IMenuService) PlatformUI.getWorkbench().getService(IMenuService.class); form.getToolBarManager().add(new Action("", Activator.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)) { @Override public void run() { deleteService.deleteElement(modelElementContext.getDomainObject()); MEEditorPage.this.getEditor().close(true); } }); menuService.populateContributionManager((ContributionManager) form.getToolBarManager(), TOOLBAR_ORG_ECLIPSE_EMF_ECP_EDITOR_INTERNAL_E3_ME_EDITOR_PAGE); form.getToolBarManager().update(true); }
Source:
public CompletableFuture<Boolean> getIssueMetadata(String repoId, List<TurboIssue> issues) { String message = "Getting metadata for " + repoId + "..."; logger.info("Getting metadata for issues " + issues.stream().map(TurboIssue::getId).map(Object::toString).collect(Collectors.joining(", "))); UI.status.displayMessage(message); String currentUser = prefs.getLastLoginUsername(); return repoIO.getIssueMetadata(repoId, issues).thenApply(this::processUpdates) .thenApply(metadata -> { String updatedMessage = "Received metadata from " + repoId + "!"; UI.status.displayMessage(updatedMessage); models.insertMetadata(repoId, metadata, currentUser); return true; }) .exceptionally(withResult(false)); }

Target:
public CompletableFuture<Boolean> getIssueMetadata(String repoId, List<TurboIssue> issues) { String message = "Getting metadata for " + repoId + "..."; logger.info("Getting metadata for issues " + issues); UI.status.displayMessage(message); return repoIO.getIssueMetadata(repoId, issues).thenApply(this::processUpdates) .thenApply(metadata -> insertMetadata(metadata, repoId, prefs.getLastLoginUsername())) .exceptionally(withResult(false)); }
Source:
public TimeFormat getTimeFormat() { return fTimeFormat; }

Target:
public Utils.TimeFormat getTimeFormat() { return Utils.TimeFormat.values()[fTimeFormat.ordinal()]; }
Source:
public void testStringFunction() throws Exception { FilterFactory ff = dataStore.getFilterFactory(); Function function = ff.function("strToLowerCase", ff.property("stringProperty")); PropertyIsLike likeWithStringFunction = ff.like(function, "z%", "%", "-", "\\", true); assumeTrue(dataStore.getFilterCapabilities().fullySupports(likeWithStringFunction)); assertEquals(1, featureSource.getCount(new Query(null, likeWithStringFunction))); }

Target:
public void testStringFunction() throws Exception { if (!dataStore.getFilterCapabilities().supports(FilterFunction_strToLowerCase.class)) { LOGGER.info("Ignoring testStringFunction test"); return; } FilterFactory ff = dataStore.getFilterFactory(); Function function = ff.function("strToLowerCase", ff.property("stringProperty")); PropertyIsLike likeWithStringFunction = ff.like(function, "z%", "%", "-", "\\", true); assertEquals(1, featureSource.getCount(new Query(null, likeWithStringFunction))); }
Source:
private void postRefundRequest(String payload) { publicAuthMock.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID); String refundStatus = "available"; connectorMock.respondAccepted_whenCreateARefund(AMOUNT, REFUND_AMOUNT_AVAILABLE, GATEWAY_ACCOUNT_ID, CHARGE_ID, REFUND_ID, refundStatus, CREATED_DATE); given().port(app.getLocalPort()) .header(AUTHORIZATION, "Bearer " + API_KEY) .header(CONTENT_TYPE, APPLICATION_JSON) .body(payload) .post(format("/v1/payments/%s/refunds", CHARGE_ID)) .then() .statusCode(ACCEPTED.getStatusCode()) .contentType(JSON) .body("refund_id", is(REFUND_ID)) .body("amount", is(AMOUNT)) .body("status", is(refundStatus)) .body("created_date", is(CREATED_DATE)) .body("_links.self.href", is(paymentRefundLocationFor(CHARGE_ID, REFUND_ID))) .body("_links.payment.href", is(paymentLocationFor(CHARGE_ID))); }

Target:
private void postRefundRequest(String payload) { publicAuthMock.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID); String refundStatus = "available"; connectorMock.respondAccepted_whenCreateARefund(AMOUNT, REFUND_AMOUNT_AVAILABLE, GATEWAY_ACCOUNT_ID, CHARGE_ID, REFUND_ID, refundStatus, CREATED_DATE); postRefunds(payload) .then() .statusCode(ACCEPTED.getStatusCode()) .contentType(JSON) .body("refund_id", is(REFUND_ID)) .body("amount", is(AMOUNT)) .body("status", is(refundStatus)) .body("created_date", is(CREATED_DATE)) .body("_links.self.href", is(paymentRefundLocationFor(CHARGE_ID, REFUND_ID))) .body("_links.payment.href", is(paymentLocationFor(CHARGE_ID))); }
Source:
public SnapshotReadMessage read() { if (currentStreamInfo == null || !currentStreamInfo.iterator.hasNext()) { if (streamsToSent.isEmpty()) { return new SnapshotReadMessage(null, true); } currentStreamInfo = new StreamInfo(streamsToSent.poll(), rt, globalSnapshot); } List msgs = new ArrayList<TxMessage>(); msgs.add(next(currentStreamInfo)); return new SnapshotReadMessage(msgs, streamsToSent.isEmpty()&&!currentStreamInfo.iterator.hasNext()); }

Target:
public SnapshotReadMessage read() { if (currentStreamInfo == null || !currentStreamInfo.iterator.hasNext()) { while (!streamsToSend.isEmpty()) { currentStreamInfo = new OpaqueStreamIterator(streamsToSend.poll(), rt, globalSnapshot); if (currentStreamInfo.iterator.hasNext()) { break; } log.info("Snapshot reader will skip reading stream as there are no entries to send", currentStreamInfo.uuid); } if (streamsToSend.isEmpty() && !currentStreamInfo.iterator.hasNext()) { log.info(""); return new SnapshotReadMessage(null, true); } } List msgs = new ArrayList<TxMessage>(); msgs.add(read(currentStreamInfo)); if (!currentStreamInfo.iterator.hasNext()) { log.debug("Snapshot reader finish reading stream {}", currentStreamInfo.uuid); } if (streamsToSend.isEmpty()) { log.info("Snapshot reader finish reading all streams {}", streams); } return new SnapshotReadMessage(msgs, streamsToSend.isEmpty()&&!currentStreamInfo.iterator.hasNext()); }
Source:
private void glusterHostAdd(Guid targetClusterId) { String hostName = (getVds().gethost_name().isEmpty()) ? getVds().getManagmentIp() : getVds().gethost_name(); VDSReturnValue returnValue = runVdsCommand( VDSCommandType.GlusterHostAdd, new GlusterHostAddVDSParameters(getClusterUtils().getUpServer(targetClusterId).getId(), hostName)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_HOST_ADD_FAILED; return; } }

Target:
private boolean glusterHostAdd(Guid targetClusterId) { String hostName = (getVds().gethost_name().isEmpty()) ? getVds().getManagmentIp() : getVds().gethost_name(); VDSReturnValue returnValue = runVdsCommand( VDSCommandType.GlusterHostAdd, new GlusterHostAddVDSParameters(getClusterUtils().getUpServer(targetClusterId).getId(), hostName)); if (getSucceeded()) { return true; } else { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_HOST_ADD_FAILED; return false; } }
Source:
public void emitTuples() { if (currentWindowId <= windowDataManager.getLargestCompletedWindow()) { return; } if (inputStream == null) { try { if (currentFile != null && offset > 0) { int tmpOffset = offset; if (fs.exists(new Path(currentFile))) { this.inputStream = openFile(new Path(currentFile)); offset = tmpOffset; skipCount = tmpOffset; } else { currentFile = null; offset = 0; skipCount = 0; } } else if (!unfinishedFiles.isEmpty()) { retryFailedFile(unfinishedFiles.poll()); } else if (!pendingFiles.isEmpty()) { String newPathString = pendingFiles.iterator().next(); pendingFiles.remove(newPathString); if (fs.exists(new Path(newPathString))) { this.inputStream = openFile(new Path(newPathString)); } } else if (!failedFiles.isEmpty()) { retryFailedFile(failedFiles.poll()); } else { scanDirectory(); } } catch (IOException ex) { failureHandling(ex); } } if (inputStream != null) { int startOffset = offset; String file = currentFile; boolean fileClosed = false; try { int counterForTuple = 0; while (counterForTuple++ < emitBatchSize) { T line = readEntity(); if (line == null) { LOG.info("done reading file ({} entries).", offset); closeFile(inputStream); fileClosed = true; break; } if (skipCount == 0) { offset++; emit(line); } else { skipCount--; } } } catch (IOException e) { failureHandling(e); } if (offset > startOffset) { currentWindowRecoveryState.add(new RecoveryEntry(file, startOffset, offset, fileClosed)); } } }

Target:
public void emitTuples() { if (currentWindowId <= windowDataManager.getLargestCompletedWindow()) { return; } if (inputStream == null) { try { if (currentFile != null && offset > 0) { long tmpOffset = offset; if (fs.exists(new Path(currentFile))) { this.inputStream = openFile(new Path(currentFile)); offset = tmpOffset; skipCount = tmpOffset; } else { currentFile = null; offset = 0; skipCount = 0; } } else if (!unfinishedFiles.isEmpty()) { retryFailedFile(unfinishedFiles.poll()); } else if (!pendingFiles.isEmpty()) { String newPathString = pendingFiles.iterator().next(); pendingFiles.remove(newPathString); if (fs.exists(new Path(newPathString))) { this.inputStream = openFile(new Path(newPathString)); } } else if (!failedFiles.isEmpty()) { retryFailedFile(failedFiles.poll()); } else { scanDirectory(); } } catch (IOException ex) { failureHandling(ex); } } if (inputStream != null) { long startOffset = offset; String file = currentFile; boolean fileClosed = false; try { int counterForTuple = 0; while (counterForTuple++ < emitBatchSize) { T line = readEntity(); if (line == null) { LOG.info("done reading file ({} entries).", offset); closeFile(inputStream); fileClosed = true; break; } if (skipCount == 0) { offset++; emit(line); } else { skipCount--; } } } catch (IOException e) { failureHandling(e); } if (offset >= startOffset) { currentWindowRecoveryState.add(new RecoveryEntry(file, startOffset, offset, fileClosed)); } } }
Source:
void postSpans(byte[] json) throws Exception { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_JSON); json = compressRequestIfApplicable(json); RequestEntity<byte[]> requestEntity = new RequestEntity<>(json, httpHeaders, HttpMethod.POST, URI.create(this.url)); this.restTemplate.exchange(requestEntity, String.class); }

Target:
void postSpans(byte[] json) { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setContentType(MediaType.APPLICATION_JSON); RequestEntity<byte[]> requestEntity = new RequestEntity<>(json, httpHeaders, HttpMethod.POST, URI.create(this.url)); this.restTemplate.exchange(requestEntity, String.class); }