auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected HandlerRegistration[] doAddHandler(final ViewEventType type, final ViewHandler<? extends ViewEvent> eventHandler) { if (ViewEventType.MOUSE_CLICK.equals(type)) { return registerClickHandler((ViewHandler<ViewEvent>) eventHandler); } if (ViewEventType.MOUSE_DBL_CLICK.equals(type)) { return registerDoubleClickHandler((ViewHandler<ViewEvent>) eventHandler); } if (ViewEventType.MOUSE_ENTER.equals(type)) { return registerEnterHHandler((ViewHandler<ViewEvent>) eventHandler); } if (ViewEventType.MOUSE_EXIT.equals(type)) { return registerExitHandler((ViewHandler<ViewEvent>) eventHandler); } if (ViewEventType.TOUCH.equals(type)) { return registerTouchHandler((TouchHandler) eventHandler); } if (ViewEventType.GESTURE.equals(type)) { return registerGestureHandler((GestureHandler) eventHandler); } return null; }

Target:
protected HandlerRegistration[] doAddHandler(final ViewEventType type, final ViewHandler<? extends ViewEvent> eventHandler) { if (ViewEventType.MOUSE_CLICK.equals(type)) { return registerClickHandler((ViewHandler<ViewEvent>) eventHandler); } if (ViewEventType.MOUSE_DBL_CLICK.equals(type)) { return registerDoubleClickHandler((ViewHandler<ViewEvent>) eventHandler); } if (ViewEventType.MOUSE_ENTER.equals(type)) { return registerEnterHandler((ViewHandler<ViewEvent>) eventHandler); } if (ViewEventType.MOUSE_EXIT.equals(type)) { return registerExitHandler((ViewHandler<ViewEvent>) eventHandler); } if (ViewEventType.TOUCH.equals(type)) { return registerTouchHandler((TouchHandler) eventHandler); } if (ViewEventType.GESTURE.equals(type)) { return registerGestureHandler((GestureHandler) eventHandler); } return null; }
Source:
public ImmutableScan(Scan scan) throws IOException { this.delegateScan = new Scan(scan); }

Target:
public ImmutableScan(Scan scan) { this.delegateScan = scan; }
Source:
private void visitSuper(Node node, Node parent) { Node exprRoot = node; if (exprRoot.getParent().isGetElem() || exprRoot.getParent().isGetProp()) { exprRoot = exprRoot.getParent(); } Node enclosingMemberDef = NodeUtil.getEnclosingNode( exprRoot, new Predicate<Node>() { @Override public boolean apply(Node n) { switch (n.getToken()) { case MEMBER_FUNCTION_DEF: case GETTER_DEF: case SETTER_DEF: return true; default: return false; } } }); if (exprRoot.getParent().isNew()) { compiler.report(JSError.make(node, INVALID_SUPER_CALL)); } else if (NodeUtil.isCallOrNewTarget(exprRoot) && (exprRoot.isSuper() || exprRoot.getFirstChild().isSuper())) { visitSuperCall(node, exprRoot, enclosingMemberDef); } else { compiler.report(JSError.make(node, CANNOT_CONVERT_YET, "Only calls to super or to a method of super are supported.")); } }

Target:
private void visitSuper(Node node, Node parent) { Preconditions.checkState(node.isSuper()); Node exprRoot = node; if (exprRoot.getParent().isGetElem() || exprRoot.getParent().isGetProp()) { exprRoot = exprRoot.getParent(); } Node enclosingMemberDef = NodeUtil.getEnclosingNode( exprRoot, new Predicate<Node>() { @Override public boolean apply(Node n) { switch (n.getToken()) { case MEMBER_FUNCTION_DEF: case GETTER_DEF: case SETTER_DEF: return true; default: return false; } } }); if (parent.isCall()) { visitSuperCall(node, parent, enclosingMemberDef); } else if (parent.isGetProp()) { if (parent.getFirstChild() == node) { if (parent.getParent().isCall() && NodeUtil.isCallOrNewTarget(parent)) { visitSuperPropertyCall(node, parent, enclosingMemberDef); } else { compiler.report(JSError.make(node, CANNOT_CONVERT_YET, "Only calls to super or to a method of super are supported.")); } } else { compiler.report(JSError.make(node, CANNOT_CONVERT_YET, "Only calls to super or to a method of super are supported.")); } } else if (parent.isGetElem()) { compiler.report(JSError.make(node, CANNOT_CONVERT_YET, "Only calls to super or to a method of super are supported.")); } else if (parent.isNew()) { compiler.report(JSError.make(node, INVALID_SUPER_CALL)); } else { compiler.report(JSError.make(node, CANNOT_CONVERT_YET, "Only calls to super or to a method of super are supported.")); } }
Source:
private List<NameServer> getNameServers(DnsResolverConfiguration dnsResolverConfiguration) { if (dnsResolverConfiguration == null) { return Collections.EMPTY_LIST; } List<NameServer> nameServers = dnsResolverConfiguration.getNameServers(); if (nameServers == null || nameServers.isEmpty()) { return Collections.EMPTY_LIST; } return nameServers; }

Target:
private List<NameServer> getNameServers(DnsResolverConfiguration dnsResolverConfiguration) { if (dnsResolverConfiguration == null) { return Collections.emptyList(); } List<NameServer> nameServers = dnsResolverConfiguration.getNameServers(); if (nameServers == null || nameServers.isEmpty()) { return Collections.emptyList(); } return nameServers; }
Source:
public void removeCache(CacheEntryRemovedEvent<ScopedState, CacheState> event) { String cacheName = event.getKey().getName(); gcm.log.debugf("Remove cache %s", cacheName); gcm.localRemoveCache(cacheName); }

Target:
public void removeCache(CacheEntryRemovedEvent<ScopedState, CacheState> event) { String cacheName = event.getKey().getName(); gcm.localRemoveCache(cacheName); }
Source:
public AmazonS3 createS3Client(URI name, final String bucket, final AWSCredentialsProvider credentials, final String userAgentSuffix) throws IOException { Configuration conf = getConf(); final ClientConfiguration awsConf = S3AUtils .createAwsConf(conf, bucket, Constants.AWS_SERVICE_IDENTIFIER_S3); awsConf.setUseThrottleRetries( conf.getBoolean(EXPERIMENTAL_AWS_INTERNAL_THROTTLING, true)); if (!StringUtils.isEmpty(userAgentSuffix)) { awsConf.setUserAgentSuffix(userAgentSuffix); } return configureAmazonS3Client( newAmazonS3Client(credentials, awsConf), conf); }

Target:
public AmazonS3 createS3Client(URI name, final String bucket, final AWSCredentialsProvider credentials, final String userAgentSuffix) throws IOException { Configuration conf = getConf(); final ClientConfiguration awsConf = S3AUtils .createAwsConf(conf, bucket, Constants.AWS_SERVICE_IDENTIFIER_S3); awsConf.setUseThrottleRetries( conf.getBoolean(EXPERIMENTAL_AWS_INTERNAL_THROTTLING, EXPERIMENTAL_AWS_INTERNAL_THROTTLING_DEFAULT)); if (!StringUtils.isEmpty(userAgentSuffix)) { awsConf.setUserAgentSuffix(userAgentSuffix); } return configureAmazonS3Client( newAmazonS3Client(credentials, awsConf), conf); }
Source:
private RelDataType inferTypeFromOperands(SqlOperatorBinding opBinding) { final RelDataTypeFactory typeFactory = opBinding.getTypeFactory(); final List<RelDataType> argTypes = opBinding.collectOperandTypes(); assert (argTypes.size() % 2) == 1 : "odd number of arguments expected: " + argTypes.size(); assert argTypes.size() > 1 : "CASE must have more than 1 argument. Given " + argTypes.size() + ", " + argTypes; List<RelDataType> thenTypes = new ArrayList<>(); for (int j = 1; j < (argTypes.size() - 1); j += 2) { RelDataType argType = argTypes.get(j); if (opBinding instanceof RexCallBinding) { RexNode whenNode = ((RexCallBinding) opBinding).getOperands().get(j - 1); RexNode thenNode = ((RexCallBinding) opBinding).getOperands().get(j); if (whenNode.getKind() == SqlKind.IS_NOT_NULL && argType.isNullable()) { if (((RexCall) whenNode).getOperands().get(0).equals(thenNode)) { argType = typeFactory.createTypeWithNullability(argType, false); } } } thenTypes.add(argType); } thenTypes.add(Iterables.getLast(argTypes)); return typeFactory.leastRestrictive(thenTypes); }

Target:
private RelDataType inferTypeFromOperands(SqlOperatorBinding opBinding) { final RelDataTypeFactory typeFactory = opBinding.getTypeFactory(); final List<RelDataType> argTypes = opBinding.collectOperandTypes(); assert (argTypes.size() % 2) == 1 : "odd number of arguments expected: " + argTypes.size(); assert argTypes.size() > 1 : "CASE must have more than 1 argument. Given " + argTypes.size() + ", " + argTypes; List<RelDataType> thenTypes = new ArrayList<>(); for (int j = 1; j < (argTypes.size() - 1); j += 2) { RelDataType argType = argTypes.get(j); if (opBinding instanceof RexCallBinding) { final RexCallBinding rexCallBinding = (RexCallBinding) opBinding; final RexNode whenNode = rexCallBinding.operands().get(j - 1); final RexNode thenNode = rexCallBinding.operands().get(j); if (whenNode.getKind() == SqlKind.IS_NOT_NULL && argType.isNullable()) { final RexCall isNotNullCall = (RexCall) whenNode; if (isNotNullCall.getOperands().get(0).equals(thenNode)) { argType = typeFactory.createTypeWithNullability(argType, false); } } } thenTypes.add(argType); } thenTypes.add(Iterables.getLast(argTypes)); return typeFactory.leastRestrictive(thenTypes); }
Source:
public boolean shouldOverrideUrlLoading(WebView view, String url) { Uri responseUri = Uri.parse(url); String schema = responseUri.getScheme(); if (schema == null) { throw new RuntimeException("Invalid schema could not be parsed: " + responseUri.toString()); } String error = responseUri.getQueryParameter("error"); String errorDescription = responseUri.getQueryParameter("error_description"); final String authCode = responseUri.getQueryParameter("code"); if (error != null && !error.isEmpty()) { if (error.equalsIgnoreCase("access_denied") && errorDescription.equalsIgnoreCase("The user denied your request.")) { Toast.makeText(getApplicationContext(), "No credentials provided, failed to load secured resource", Toast.LENGTH_LONG).show(); mOAuthLoginDialog.dismiss(); return true; } } if (authCode != null && !authCode.isEmpty()) { OAuthTokenCredentialRequest request = new OAuthTokenCredentialRequest(mPortal, null, mClientId, mRedirectUri, authCode); final ListenableFuture<OAuthTokenCredential> future = request.executeAsync(); future.addDoneListener(new Runnable() { @Override public void run() { OAuthTokenCredential cred = null; try { cred = future.get(); } catch (Exception e) { } finally { finishOAuthChallenge(cred); } } }); return true; } return (false); }

Target:
public boolean shouldOverrideUrlLoading(WebView view, String url) { Uri responseUri = Uri.parse(url); String schema = responseUri.getScheme(); if (schema == null) { throw new IllegalArgumentException("Invalid schema could not be parsed: " + responseUri.toString()); } String error = responseUri.getQueryParameter("error"); String errorDescription = responseUri.getQueryParameter("error_description"); final String authCode = responseUri.getQueryParameter("code"); if (error != null && !error.isEmpty()) { if (error.equalsIgnoreCase("access_denied") && errorDescription.equalsIgnoreCase("The user denied your request.")) { Toast.makeText(getApplicationContext(), "No credentials provided, failed to load secured resource", Toast.LENGTH_LONG).show(); finishOAuthChallenge(null); mOAuthLoginDialog.dismiss(); return true; } } if (authCode != null && !authCode.isEmpty()) { OAuthTokenCredentialRequest request = new OAuthTokenCredentialRequest(mPortal, null, mClientId, mRedirectUri, authCode); final ListenableFuture<OAuthTokenCredential> future = request.executeAsync(); future.addDoneListener(new Runnable() { @Override public void run() { OAuthTokenCredential cred = null; try { cred = future.get(); } catch (Exception e) { } finally { finishOAuthChallenge(cred); } } }); return true; } return false; }
Source:
public Path getTargetPath(URI uri) { String relativePath = MavenUrlDecoder.toLocalGradlePath(uri); Path fullPath = getRoot().resolve(relativePath); try { if (fullPath.getParent().toFile().exists()) { Optional<Path> actualPath = Files.list(fullPath.getParent()) .filter(dir -> dir.toFile().isDirectory()) .map(dir -> dir.resolve(fullPath.getFileName())) .filter(path -> path.toFile().exists()) .findAny(); return actualPath.orElse(fullPath); } return fullPath; } catch (IOException e) { throw new HumanReadableException("Failed to list folders in the directory", e); } }

Target:
public Path getTargetPath(URI uri) { String relativePath = MavenUrlDecoder.toLocalGradlePath(uri); Path fullPath = getRoot().resolve(relativePath); try { if (Files.exists(fullPath.getParent())) { try (Stream<Path> files = Files.list(fullPath.getParent())) { List<Path> actualPaths = files .filter(dir -> Files.isDirectory(dir)) .map(dir -> dir.resolve(fullPath.getFileName())) .filter(path -> Files.exists(path)) .collect(ImmutableList.toImmutableList()); if (actualPaths.size() == 1) { return actualPaths.get(0); } } } return fullPath; } catch (IOException e) { throw new HumanReadableException("Failed to list folders in the directory", e); } }
Source:
public boolean hasRole(Wrapper wrapper, Principal principal, String role) { if (wrapper != null) { String realRole = wrapper.findSecurityReference(role); if (realRole != null) { role = realRole; } } if (getContainer() instanceof Context) { Context context = (Context) getContainer(); String realRole = context.findRoleMapping(role); if (realRole != null) { role = realRole; } } if (principal == null || role == null) { return false; } boolean result = hasRoleInternal(principal, role); if (log.isDebugEnabled()) { String name = principal.getName(); if (result) log.debug(sm.getString("realmBase.hasRoleSuccess", name, role)); else log.debug(sm.getString("realmBase.hasRoleFailure", name, role)); } return result; }

Target:
public boolean hasRole(Wrapper wrapper, Principal principal, String role) { if (wrapper != null) { String realRole = wrapper.findSecurityReference(role); if (realRole != null) { role = realRole; } } if (principal == null || role == null) { return false; } boolean result = hasRoleInternal(principal, role); if (log.isDebugEnabled()) { String name = principal.getName(); if (result) log.debug(sm.getString("realmBase.hasRoleSuccess", name, role)); else log.debug(sm.getString("realmBase.hasRoleFailure", name, role)); } return result; }
Source:
public Writing(ConvertiblePair convertiblePair, Function<? super S, ? extends T> function) { super(convertiblePair, function); }

Target:
Writing(ConvertiblePair convertiblePair, Function<? super S, ? extends T> function) { super(convertiblePair, function); }
Source:
private void removeChildren(Guid snapshot) { List<Guid> children = new ArrayList<>(); getImageChildren(snapshot, children); children.stream().sorted(Collections.reverseOrder()).forEach(child -> diskImageDao.getSnapshotById(child)); }

Target:
private void removeChildren(Guid snapshot) { List<Guid> children = new ArrayList<>(); getImageChildren(snapshot, children); children.stream().sorted(Collections.reverseOrder()).forEach(child -> removeSnapshot(diskImageDao.getSnapshotById(child))); }
Source:
public void setCodeMiningProviders(ICodeMiningProvider[] codeMiningProviders) { if (fCodeMiningProviders != null) { for (ICodeMiningProvider contentMiningProvider : fCodeMiningProviders) { contentMiningProvider.dispose(); } } boolean enable= codeMiningProviders != null && codeMiningProviders.length > 0; fCodeMiningProviders= codeMiningProviders; if (fCodeMiningManager != null) { fCodeMiningManager.uninstall(); } fCodeMiningManager= null; if (enable) { ensureCodeMiningManagerInstalled(); } }

Target:
public void setCodeMiningProviders(ICodeMiningProvider[] codeMiningProviders) { boolean enable= codeMiningProviders != null && codeMiningProviders.length > 0; fCodeMiningProviders= codeMiningProviders; if (enable) { if (fCodeMiningManager != null) { fCodeMiningManager.setCodeMiningProviders(fCodeMiningProviders); } ensureCodeMiningManagerInstalled(); } else { if (fCodeMiningManager != null) { fCodeMiningManager.uninstall(); } fCodeMiningManager= null; } }
Source:
public static @Nonnull JSONObject getBundle(@Nonnull String baseName, @Nonnull Locale locale) throws MissingResourceException { String bundleKey = baseName + ":" + locale.toString(); JSONObject bundleJSON = bundles.get(bundleKey); if (bundleJSON != null) { return bundleJSON; } ResourceBundle bundle = getBundle(baseName, locale, Jenkins.class.getClassLoader()); if (bundle == null) { Jenkins jenkins = Jenkins.getInstanceOrNull(); if (jenkins != null) { for (PluginWrapper plugin : jenkins.getPluginManager().getPlugins()) { bundle = getBundle(baseName, locale, plugin.classLoader); if (bundle != null) { break; } } } } if (bundle == null) { throw new MissingResourceException("Can't find bundle for base name " + baseName + ", locale " + locale, baseName + "_" + locale, ""); } bundleJSON = toJSONObject(bundle); bundles.put(bundleKey, bundleJSON); return bundleJSON; }

Target:
public static @Nonnull JSONObject getBundle(@Nonnull String baseName, @Nonnull Locale locale) throws MissingResourceException { String bundleKey = baseName + ":" + locale.toString(); JSONObject bundleJSON = bundles.get(bundleKey); if (bundleJSON != null) { return bundleJSON; } ResourceBundle bundle = getBundle(baseName, locale, ResourceBundleUtil.class.getClassLoader()); if (bundle == null && JenkinsJVM.isJenkinsJVM()) { for (PluginWrapper plugin : Jenkins.getInstance().getPluginManager().getPlugins()) { bundle = getBundle(baseName, locale, plugin.classLoader); if (bundle != null) { break; } } } if (bundle == null) { throw new MissingResourceException("Can't find bundle for base name " + baseName + ", locale " + locale, baseName + "_" + locale, ""); } bundleJSON = toJSONObject(bundle); bundles.put(bundleKey, bundleJSON); return bundleJSON; }
Source:
public static <V> CompletableFuture<V> firstCompletedFuture(Iterable<? extends CompletionStage<? extends V>> futures) { requireNonNull(futures, "futures is null"); boolean hasFuture = false; CompletableFuture<V> future = new CompletableFuture<>(); for (CompletionStage<? extends V> stage : futures) { stage.whenComplete((value, exception) -> { if (exception != null) { future.completeExceptionally(exception); } else { future.complete(value); } }); hasFuture = true; } checkArgument(hasFuture, "futures is empty"); return future; }

Target:
public static <V> CompletableFuture<V> firstCompletedFuture(Iterable<? extends CompletionStage<? extends V>> futures) { requireNonNull(futures, "futures is null"); checkArgument(!isEmpty(futures), "futures is empty"); CompletableFuture<V> future = new CompletableFuture<>(); for (CompletionStage<? extends V> stage : futures) { stage.whenComplete((value, exception) -> { if (exception != null) { future.completeExceptionally(exception); } else { future.complete(value); } }); } return future; }
Source:
private void assignUserDirOwnership(final String effectiveUser) throws IOException { final ExecuteAsUser executeAsUser = new ExecuteAsUser( this.sysProps.getString(NATIVE_LIB_FOLDER)); final List<String> changeOwnershipCommand = Arrays .asList(CHOWN, effectiveUser + ":" + GROUP_NAME, getWorkingDirectory()); info("Change current working directory ownership to " + effectiveUser + ":" + GROUP_NAME + "."); final int result = executeAsUser.execute("root", changeOwnershipCommand); if (result != 0) { error("Failed to change current working directory ownership. Error code: " + Integer .toString(result)); } }

Target:
private void assignUserDirOwnership(final String effectiveUser) throws IOException { final ExecuteAsUser executeAsUser = new ExecuteAsUser( this.sysProps.getString(AZKABAN_SERVER_NATIVE_LIB_FOLDER)); final String groupName = this.sysProps.getString(AZKABAN_SERVER_GROUP_NAME, "azkaban"); final List<String> changeOwnershipCommand = Arrays .asList(CHOWN, effectiveUser + ":" + groupName, getWorkingDirectory()); info("Change current working directory ownership to " + effectiveUser + ":" + groupName + "."); final int result = executeAsUser.execute("root", changeOwnershipCommand); if (result != 0) { error("Failed to change current working directory ownership. Error code: " + Integer .toString(result)); } }
Source:
private void buildList() { mList = new ExpandableListView(mContext); mList.setId(R.id.snackbar); setListAppearance(); mList.setAdapter(generateAdapter()); mTargetParent.addView(mList); hide(); }

Target:
private void buildList() { mList = new SnackBarListView(mContext); mList.setId(R.id.snackbar); setListAppearance(); adapter = new SnackBarListAdapter(mContext); mList.setAdapter(adapter); mTargetParent.addView(mList); if (mMessagesList.size() > 0) { show(); } else { hide(); } }
Source:
private Collection<BlackboardArtifact> parseDownloadDictionary(Content dataSource, AbstractFile origFile, NSDictionary entry) throws TskCoreException { Collection<BlackboardArtifact> bbartifacts = new ArrayList<>(); String url = null; String path = null; Long time = null; Long pathID = null; FileManager fileManager = getCurrentCase().getServices().getFileManager(); NSString nsstring = (NSString) entry.get(PLIST_KEY_DOWNLOAD_URL); if (nsstring != null) { url = nsstring.toString(); } nsstring = (NSString) entry.get(PLIST_KEY_DOWNLOAD_PATH); if (nsstring != null) { path = nsstring.toString(); pathID = Util.findID(dataSource, path); } NSDate date = (NSDate) entry.get(PLIST_KEY_DOWNLOAD_DATE); if (date != null) { time = date.getDate().getTime(); } BlackboardArtifact bbart = origFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD); bbart.addAttributes(this.createDownloadAttributes(path, pathID, url, time, NetworkUtils.extractDomain(url), getName())); bbartifacts.add(bbart); for (AbstractFile downloadedFile : fileManager.findFiles(dataSource, FilenameUtils.getName(path), FilenameUtils.getPath(path))) { BlackboardArtifact downloadSourceArt = downloadedFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_DOWNLOAD_SOURCE); if (url != null) { downloadSourceArt.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, RecentActivityExtracterModuleFactory.getModuleName(), url)); } bbartifacts.add(downloadSourceArt); break; } return bbartifacts; }

Target:
private Collection<BlackboardArtifact> parseDownloadDictionary(Content dataSource, AbstractFile origFile, NSDictionary entry) throws TskCoreException { Collection<BlackboardArtifact> bbartifacts = new ArrayList<>(); String url = null; String path = null; Long time = null; Long pathID = null; FileManager fileManager = getCurrentCase().getServices().getFileManager(); NSString nsstring = (NSString) entry.get(PLIST_KEY_DOWNLOAD_URL); if (nsstring != null) { url = nsstring.toString(); } nsstring = (NSString) entry.get(PLIST_KEY_DOWNLOAD_PATH); if (nsstring != null) { path = nsstring.toString(); pathID = Util.findID(dataSource, path); } NSDate date = (NSDate) entry.get(PLIST_KEY_DOWNLOAD_DATE); if (date != null) { time = date.getDate().getTime(); } BlackboardArtifact bbart = origFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD); bbart.addAttributes(this.createDownloadAttributes(path, pathID, url, time, NetworkUtils.extractDomain(url), getName())); bbartifacts.add(bbart); for (AbstractFile downloadedFile : fileManager.findFiles(dataSource, FilenameUtils.getName(path), FilenameUtils.getPath(path))) { BlackboardArtifact downloadSourceArt = downloadedFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_DOWNLOAD_SOURCE); downloadSourceArt.addAttributes(createDownloadSourceAttributes(url)); bbartifacts.add(downloadSourceArt); break; } return bbartifacts; }
Source:
public IStatus validate(IProject project, String path) { File file = new File(path); if (!file.exists()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File not found: " + path); } if (!file.isFile()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Not a file. It's a directory: " + path); } int confidence = 0; try { if (!TmfTraceUtils.isText(file)) { return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(path, "r")) { goToCorrectStart(rafile); int lineCount = 0; int matches = 0; String line = readNextEventString(() -> rafile.read()); while ((line != null) && (lineCount++ < MAX_LINES)) { try { OpenTracingField field = OpenTracingField.parseJson(line); if (field != null) { matches++; } } catch (RuntimeException e) { confidence = Integer.MIN_VALUE; } confidence = MAX_CONFIDENCE * matches / lineCount; line = readNextEventString(() -> rafile.read()); } if (matches == 0) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Most assuredly NOT a " + fTraceType + " trace"); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); }

Target:
public IStatus validate(IProject project, String path) { File file = new File(path); if (!file.exists()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File not found: " + path); } if (!file.isFile()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Not a file. It's a directory: " + path); } int confidence = 0; try { if (!TmfTraceUtils.isText(file)) { return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(path, "r")) { goToCorrectStart(rafile); int lineCount = 0; int matches = 0; String line = readNextEventString(() -> rafile.read()); while ((line != null) && (lineCount++ < MAX_LINES)) { try { OpenTracingField field = OpenTracingField.parseJson(line); if (field != null) { matches++; } } catch (RuntimeException e) { confidence = Integer.MIN_VALUE; } confidence = MAX_CONFIDENCE * matches / lineCount; line = readNextEventString(() -> rafile.read()); } if (matches == 0) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Most assuredly NOT a Open-Tracing trace"); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); }
Source:
protected String getNodeSecret(String nodeName) throws Failure { computer = (SlaveComputer) Jenkins.getInstance().getComputer(nodeName); if (computer == null) { throw new Failure("Slave trying to register for invalid node: " + nodeName); } return computer.getJnlpMac(); }

Target:
protected String getNodeSecret(String nodeName) throws Failure { computer = (SlaveComputer) Jenkins.getInstance().getComputer(nodeName); if (computer == null) { throw new Failure("Agent trying to register for invalid node: " + nodeName); } return computer.getJnlpMac(); }
Source:
public void testInstagramDetection() throws Exception { InputStream testFileStream = DatasiftTwitterActivitySerializerTest.class.getResourceAsStream("/instagram_datasift_json.txt"); Scanner scanner = new Scanner(testFileStream, "UTF-8").useDelimiter(newLinePattern); String line = null; while(scanner.hasNextLine()) { line = scanner.nextLine(); Datasift datasift = MAPPER.readValue(line, Datasift.class); assert(DatasiftEventClassifier.detectClass(datasift) == Instagram.class); assert(DatasiftEventClassifier.bestSerializer(datasift) instanceof DatasiftInstagramActivitySerializer); } }

Target:
public void testInstagramDetection() throws Exception { Scanner scanner = StreamsScannerUtil.getInstance("/instagram_datasift_json.txt"); String line = null; while(scanner.hasNextLine()) { line = scanner.nextLine(); Datasift datasift = MAPPER.readValue(line, Datasift.class); assert(DatasiftEventClassifier.detectClass(datasift) == Instagram.class); assert(DatasiftEventClassifier.bestSerializer(datasift) instanceof DatasiftInstagramActivitySerializer); } }
Source:
public void sendFile( String file1, String file2 ) throws Exception { log.debug(String.format("Sending: '%1$s' '%2$s", file1, file2)); _remoteFileName(file2); MessageDigest localDigest = MessageDigest.getInstance("MD5"); final InputStream in = new DigestInputStream( new FileInputStream(file1), localDigest ); PipedInputStream pin = new PipedInputStream(); final PipedOutputStream pout = new PipedOutputStream(pin); Thread t = new Thread( new Runnable() { public void run() { OutputStream out = null; try { out = new GZIPOutputStream(pout); byte b[] = new byte[8192]; int n; while ((n = in.read(b)) != -1) { out.write(b, 0, n); } } catch (IOException e) { log.debug(e); } finally { if (out != null) { try { out.close(); } catch (IOException e) { log.error(e); } } } } }, "SSHClient.compress " + file1 ); try { t.start(); ByteArrayOutputStream remoteDigest = new ConstraintByteArrayOutputStream(1024); executeCommand( String.format(COMMAND_FILE_SEND, "gunzip -q", file2), pin, new ConstraintByteArrayOutputStream(1024), remoteDigest ); t.join(1000); _validateDigest(localDigest, new String(remoteDigest.toByteArray(), "UTF-8").trim()); } catch(Exception e) { log.debug(e); throw e; } finally { t.interrupt(); try { in.close(); } catch(IOException e) { log.error(e); } } }

Target:
public void sendFile( String file1, String file2 ) throws Exception { log.debug(String.format("Sending: '%1$s' '%2$s", file1, file2)); _remoteFileName(file2); MessageDigest localDigest = MessageDigest.getInstance("MD5"); final InputStream in = new DigestInputStream( new FileInputStream(file1), localDigest ); PipedInputStream pin = new PipedInputStream(STREAM_BUFFER_SIZE); final OutputStream pout = new PipedOutputStream(pin); Thread t = new Thread( new Runnable() { public void run() { OutputStream out = null; try { out = new GZIPOutputStream(pout); byte b[] = new byte[STREAM_BUFFER_SIZE]; int n; while ((n = in.read(b)) != -1) { out.write(b, 0, n); } } catch (IOException e) { log.debug("Exceution during stream processing", e); } finally { if (out != null) { try { out.close(); } catch (IOException e) { log.error("Cannot close stream", e); } } } } }, "SSHClient.compress " + file1 ); try { t.start(); ByteArrayOutputStream remoteDigest = new ConstraintByteArrayOutputStream(CONSTRAINT_BUFFER_SIZE); executeCommand( String.format(COMMAND_FILE_SEND, "gunzip -q", file2), pin, new ConstraintByteArrayOutputStream(CONSTRAINT_BUFFER_SIZE), remoteDigest ); t.join(THREAD_JOIN_WAIT_TIME); if (t.getState() != Thread.State.TERMINATED) { throw new IllegalStateException("Cannot stop SSH stream thead"); } _validateDigest(localDigest, new String(remoteDigest.toByteArray(), "UTF-8").trim()); } catch(Exception e) { log.debug("Send failed", e); throw e; } finally { t.interrupt(); try { in.close(); } catch(IOException e) { log.error("Cannot close stream", e); } } log.debug(String.format("Sent: '%1$s' '%2$s", file1, file2)); }
Source:
public void unLoad(String scriptIdentifier) { HashMap<String, Object> objects = objectCache.remove(scriptIdentifier); if (objects != null) { Object hr = objects.get("AutomationManager"); if (hr != null) { ScriptedAutomationManager handlerRegistry = (ScriptedAutomationManager) hr; handlerRegistry.removeAll(); } } }

Target:
public void unLoad(String scriptIdentifier) { HashMap<String, Object> objects = objectCache.remove(scriptIdentifier); if (objects != null) { Object hr = objects.get(AUTOMATION_MANAGER); if (hr != null) { ScriptedAutomationManager automationManager = (ScriptedAutomationManager) hr; automationManager.removeAll(); } } }
Source:
public void doubleAllocateButton() { WPIFactory factory = injector.getInstance(WPIFactory.class); XXboxController controller = factory.getXboxController(0); thrown.expect(RobotAssertionException.class); controller.getXboxButton(XboxButton.A); controller.getXboxButton(XboxButton.A); }

Target:
public void doubleAllocateButton() { WPIFactory factory = injector.getInstance(WPIFactory.class); XXboxController controller = factory.getXboxController(0); controller.getXboxButton(XboxButton.A); controller.getXboxButton(XboxButton.A); }
Source:
@Test public void getWithPathThenUrlThrows() { class Example { @GET Call<Object> method(@Path("hey") String hey, @Url Object url) { return null; } } try { buildRequest(Example.class, "foo/bar"); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("@Path can only be used with relative url on @GET (parameter #1)\n" + " for method Example.method"); } }

Target:
@Test public void getWithPathThenUrlThrows() { class Example { @GET Call<Object> method(@Path("hey") String hey, @Url Object url) { return null; } } try { buildRequest(Example.class, "foo/bar"); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("@Path can only be used with relative url on @GET (parameter #1)\n" + " for method Example.method"); } }
Source:
public void onRenderPlayer(RenderPlayerEvent.Pre event) { EntityPlayer p = event.getEntityPlayer(); PlayerSwimData d = getData(p); updateSwimRenderAngles(p); BlockPos bp = new BlockPos((int) p.posX, (int) p.posY + 2, (int) p.posZ); boolean liquidAbove = p.world.getBlockState(bp).getMaterial().isLiquid(); if (p.isInWater()) { if(p.limbSwingAmount <= 0) { } if(p.onGround && !this.isPlayerWearingFlippers(p)) { }else { p.limbSwingAmount = 0.2f+(d.currentSwimSpeed/20); } }else { if(d.currentRotationPitch == 0f && d.currentRotationRoll == 0f) { return; } } GlStateManager.pushMatrix(); GlStateManager.translate(0, 1.5f, 0f); GlStateManager.rotate(d.currentRotationYaw, 0f, -1f, 0f); GlStateManager.rotate(d.currentRotationPitch, 1f, 0f, 0f); GlStateManager.rotate(d.currentRotationRoll, 0f, 0f, -1f); GlStateManager.translate(0, -1.5f, 0f); updateSwimDataAngles(p); clearPlayerRenderAngles(p); }

Target:
public void onRenderPlayer(RenderPlayerEvent.Pre event) { EntityPlayer p = event.getEntityPlayer(); PlayerSwimData d = getData(p); updateSwimRenderAngles(p); if (p.isInWater()) { if (p.onGround && !this.isPlayerWearingFlippers(p)) { } else { p.limbSwingAmount = 0.2f + (d.currentSwimSpeed / 20); } } else { if (d.currentRotationPitch == 0f && d.currentRotationRoll == 0f) { return; } } GlStateManager.pushMatrix(); GlStateManager.translate(0, 1.5f, 0f); GlStateManager.rotate(d.currentRotationYaw, 0f, -1f, 0f); GlStateManager.rotate(d.currentRotationPitch, 1f, 0f, 0f); GlStateManager.rotate(d.currentRotationRoll, 0f, 0f, -1f); GlStateManager.translate(0, -1.5f, 0f); updateSwimDataAngles(p); clearPlayerRenderAngles(p); }
Source:
public void revert(Project project) { synchronized (project) { for (int i = _changes.size() - 1; i >= 0; i--){ _changes.get(i).revert(project); } if (_updateRowContextDependencies) { project.update(); } } }

Target:
public void revert(Project project) { synchronized (project) { for (Change change : Lists.reverse(_changes)){ change.revert(project); } if (_updateRowContextDependencies) { project.update(); } } }
Source:
public void addTree(byte[] pathPrefix, int stage, ObjectReader reader, AnyObjectId tree) throws IOException { CanonicalTreeParser p = readTree(pathPrefix, reader, tree); while (!p.eof()) { if (isTree(p)) { p = enterTree(p, reader); continue; } DirCacheEntry first = toEntry(stage, p); beforeAdd(first); fastAdd(first); p = p.next(); break; } while (!p.eof()) { if (isTree(p)) { p = enterTree(p, reader); } else { fastAdd(toEntry(stage, p)); p = p.next(); } } }

Target:
public void addTree(byte[] pathPrefix, int stage, ObjectReader reader, AnyObjectId tree) throws IOException { CanonicalTreeParser p = createTreeParser(pathPrefix, reader, tree); while (!p.eof()) { if (isTree(p)) { p = enterTree(p, reader); continue; } DirCacheEntry first = toEntry(stage, p); beforeAdd(first); fastAdd(first); p = p.next(); break; } while (!p.eof()) { if (isTree(p)) { p = enterTree(p, reader); } else { fastAdd(toEntry(stage, p)); p = p.next(); } } }
Source:
public void run() throws Exception { WebResource webResource = getClient().resource(endpoint + "/v1/version"); ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); String jsonResponse = clientResponse.getEntity(String.class); String version = getJsonParser().readValue(jsonResponse,String.class); getOut().println("Brooklyn version: "+version); }

Target:
public void run() throws Exception { WebResource webResource = getClient().resource(endpoint + "/v1/version"); ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); if (clientResponse.getStatus() != Response.Status.OK.getStatusCode()) { String err = getErrorMessage(clientResponse); throw new CommandExecutionException(err); } String jsonResponse = clientResponse.getEntity(String.class); String version = getJsonParser().readValue(jsonResponse,String.class); getOut().println("Brooklyn version: "+version); }
Source:
protected String getSqlType(SinkRecordField field) { if (field.schemaName() != null) { switch (field.schemaName()) { case Decimal.LOGICAL_NAME: return "DOUBLE"; case Date.LOGICAL_NAME: return "TIMESTAMP"; case Time.LOGICAL_NAME: return "TIMESTAMP"; case Timestamp.LOGICAL_NAME: return "TIMESTAMP"; default: } } switch (field.schemaType()) { case INT8: return "INTEGER"; case INT16: return "INTEGER"; case INT32: return "INTEGER"; case INT64: return "INTEGER"; case FLOAT32: return "FLOAT"; case FLOAT64: return "FLOAT"; case BOOLEAN: return "BOOLEAN"; case STRING: return "VARCHAR"; case BYTES: return "BYTE"; default: return super.getSqlType(field); } }

Target:
protected String getSqlType(SinkRecordField field) { if (field.schemaName() != null) { switch (field.schemaName()) { case Decimal.LOGICAL_NAME: return "DOUBLE"; case Date.LOGICAL_NAME: return "TIMESTAMP"; case Time.LOGICAL_NAME: return "TIMESTAMP"; case Timestamp.LOGICAL_NAME: return "TIMESTAMP"; default: } } switch (field.schemaType()) { case INT8: return "BYTE"; case INT16: return "SHORT"; case INT32: return "INTEGER"; case INT64: return "LONG"; case FLOAT32: return "FLOAT"; case FLOAT64: return "DOUBLE"; case BOOLEAN: return "BOOLEAN"; case STRING: return "STRING"; case BYTES: return "BYTE"; default: return super.getSqlType(field); } }
Source:
private static void processFailLoadAndGc() throws TestFailed { try { BrokenDexLoader loader; loader = new BrokenDexLoader(ClassLoader.getSystemClassLoader()); loader.findBrokenClass(); System.out.println("ERROR: Inaccessible was accessible"); } catch (InvocationTargetException ite) { Throwable cause = ite.getCause(); if (cause instanceof NullPointerException) { System.out.println("Got expected ITE/NPE"); } else { System.out.println("Got unexpected ITE"); ite.printStackTrace(); } } }

Target:
private static void processFailLoadAndGc() throws TestFailed { try { BrokenDexLoader loader; loader = new BrokenDexLoader(ClassLoader.getSystemClassLoader()); loader.findBrokenClass(); System.out.println("ERROR: Inaccessible was accessible"); } catch (InvocationTargetException ite) { Throwable cause = ite.getCause(); if (cause instanceof NullPointerException) { System.out.println("Got expected ITE/NPE"); } else { System.out.println("Got unexpected ITE"); ite.printStackTrace(System.out); } } }
Source:
public AsyncFuture<Void> start() { final ResolvableFuture<Void> future = async.future(); final ServerBootstrap s = new ServerBootstrap(); s.channel(NioServerSocketChannel.class); s.group(boss, worker); s.childHandler(new ChannelInitializer<Channel>() { @Override protected void initChannel(final Channel ch) { connected.add(ch); log.info("Connected {}", ch); ch.closeFuture().addListener((ChannelFutureListener) future1 -> { connected.remove(ch); log.info("Disconnected {}", ch); }); } }); s.bind(localAddress).addListener((ChannelFutureListener) f -> { if (!f.isSuccess()) { future.fail(f.cause()); return; } log.info("Bound to {}", localAddress); if (!server.compareAndSet(null, f.channel())) { f.channel().close(); future.fail(new IllegalStateException("server already started")); return; } future.resolve(null); }); return future; }

Target:
public AsyncFuture<Void> start() { final ResolvableFuture<Void> future = async.future(); final ServerBootstrap s = new ServerBootstrap(); s.channel(NioServerSocketChannel.class); s.group(boss, worker); s.childHandler(new ChannelInitializer<Channel>() { @Override protected void initChannel(final Channel ch) { connected.add(ch); log.info("Connected {}", ch); ch.closeFuture().addListener((ChannelFutureListener) f -> { connected.remove(ch); log.info("Disconnected {}", ch); }); } }); s.bind(localAddress).addListener((ChannelFutureListener) f -> { if (!f.isSuccess()) { future.fail(f.cause()); return; } log.info("Bound to {}", localAddress); if (!server.compareAndSet(null, f.channel())) { f.channel().close(); future.fail(new IllegalStateException("server already started")); return; } future.resolve(null); }); return future; }
Source:
public FoundIndication scan(Run build) throws IOException { String currentfile = build.getLogFile().getName(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(build.getLogInputStream(), Charsets.UTF_8)); return scanMultiLineOneFile(build, reader, currentfile); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close the reader. ", e); } } } }

Target:
public FoundIndication scan(Run build) throws IOException { String currentfile = build.getLogFile().getName(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(build.getLogInputStream(), build.getCharset())); return scanMultiLineOneFile(build, reader, currentfile); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.log(Level.WARNING, "Failed to close the reader. ", e); } } } }
Source:
public String mapOrganizationName(String name) { final Predicate<Map.Entry<String, String>> matcher; if (customMappingEnabled) { if (matchPrefix) { matcher = e -> name.startsWith(e.getKey()); } else { matcher = e -> name.equals(e.getKey()); } } else { matcher = e -> false; } return sortedOrganizationMappings.stream() .filter(matcher) .findFirst() .map(Map.Entry::getValue) .orElse(name); }

Target:
public String mapOrganizationName(String name) { if (!customMappingEnabled) { return name; } final Predicate<Map.Entry<String, String>> matcher; if (matchPrefix) { matcher = e -> name.startsWith(e.getKey()); } else { matcher = e -> name.equals(e.getKey()); } return sortedOrganizationMappings.stream() .filter(matcher) .findFirst() .map(Map.Entry::getValue) .orElse(name); }
Source:
public String getData() throws IOException { int thisProduct =0, thisUser =0; Files.deleteIfExists(Paths.get("Result.csv")); File result = new File("Result.csv"); InputStream fileReader = new GZIPInputStream(new FileInputStream(this.file)); BufferedReader br = new BufferedReader(new InputStreamReader(fileReader)); FileWriter fileWriter = new FileWriter(result); BufferedWriter bw = new BufferedWriter(fileWriter); String line; String[] sp; String key, value; while((line = br.readLine()) != null) { if (line.length() >= 0) { sp = line.split(" "); key = sp[0]; if (key.equals("product/productId:")) { value = sp[1]; if (!HashProduct.containsKey(value)){ HashProduct.put(value,products); InvertedHashProduct.put(products,value); thisProduct = HashProduct.get(value); products++; }else{ thisProduct = HashProduct.get(value); } }else if (key.equals("review/userId:")){ value = sp[1]; if (!HashUser.containsKey(value)){ HashUser.put(value, users); thisUser = HashUser.get(value); users++; }else{ thisUser = HashUser.get(value); } }else if (key.equals("review/score:")){ String score = sp[1]; bw.write(thisUser + "," + thisProduct + "," + score + "\n"); reviews ++; } } } br.close(); bw.close(); return null; }

Target:
private void getData() throws IOException { int thisProduct =0, thisUser =0; Files.deleteIfExists(Paths.get("Result.csv")); File result = new File("Result.csv"); InputStream fileReader = new GZIPInputStream(new FileInputStream(this.file)); FileWriter fileWriter = new FileWriter(result); String line; String[] sp; String key, value; try (BufferedReader br = new BufferedReader(new InputStreamReader(fileReader)); BufferedWriter bw = new BufferedWriter(fileWriter)) { System.out.println("Reading File: "+this.file); while((line = br.readLine()) != null) { if (line.length() >= 0) { sp = line.split(":"); key = sp[0]; if ("product/productId".equals(key)) { value = sp[1].trim(); if (!HashProduct.containsKey(value)){ HashProduct.put(value,products); InvertedHashProduct.put(products,value); thisProduct = HashProduct.get(value); products++; }else{ thisProduct = HashProduct.get(value); } }else if ("review/userId".equals(key)){ value = sp[1].trim(); if (!HashUser.containsKey(value)){ HashUser.put(value, users); thisUser = HashUser.get(value); users++; }else{ thisUser = HashUser.get(value); } }else if ("review/score".equals(key)){ String score = sp[1].trim(); bw.write(thisUser + "," + thisProduct + "," + score + "\n"); reviews ++; } } } } catch (FileNotFoundException e) { e.printStackTrace(); } }
Source:
public static <ValueT> Async<ValueT> constant(final ValueT val) { return new Async<ValueT>() { @Override public Registration onSuccess(Handler<? super ValueT> successHandler) { successHandler.handle(val); return Registration.EMPTY; } @Override public Registration onResult(Handler<? super ValueT> successHandler, Handler<Throwable> failureHandler) { return onSuccess(successHandler); } @Override public Registration onFailure(Handler<Throwable> failureHandler) { return Registration.EMPTY; } @Override public <ResultT> Async<ResultT> map(final Function<? super ValueT, ? extends ResultT> success) { Function<? super ValueT, ResultT> newFunction = new Function<ValueT, ResultT>() { @Override public ResultT apply(ValueT value) { return success.apply(value); } }; return Asyncs.map(this, newFunction); } @Override public <ResultT> Async<ResultT> then(Function<? super ValueT, Async<ResultT>> success) { return Asyncs.select(this, success); } }; }

Target:
public static <ValueT> Async<ValueT> constant(final ValueT val) { return new Async<ValueT>() { @Override public Registration onSuccess(Handler<? super ValueT> successHandler) { successHandler.handle(val); return Registration.EMPTY; } @Override public Registration onResult(Handler<? super ValueT> successHandler, Handler<Throwable> failureHandler) { return onSuccess(successHandler); } @Override public Registration onFailure(Handler<Throwable> failureHandler) { return Registration.EMPTY; } @Override public <ResultT> Async<ResultT> map(final Function<? super ValueT, ? extends ResultT> success) { return Asyncs.map(this, success); } @Override public <ResultT> Async<ResultT> flatMap(Function<? super ValueT, Async<ResultT>> success) { return Asyncs.select(this, success); } }; }
Source:
public void deleteMessages(Map<SystemStreamPartition, String> offsets) { if (deleteCommittedMessages) { Map<TopicPartition, RecordsToDelete> recordsToDelete = offsets.entrySet() .stream() .collect(Collectors.toMap(entry -> new TopicPartition(entry.getKey().getStream(), entry.getKey().getPartition().getPartitionId()), entry -> RecordsToDelete.beforeOffset(Long.parseLong(entry.getValue()) + 1))); adminClient.deleteRecords(recordsToDelete).all().whenComplete((ignored, exception) -> { if (exception != null) { LOG.error("Delete message failed for SSPs due to {}", offsets.keySet(), exception); } }); deleteMessageCalled = true; } }

Target:
public void deleteMessages(Map<SystemStreamPartition, String> offsets) { if (deleteCommittedMessages) { Map<TopicPartition, RecordsToDelete> recordsToDelete = offsets.entrySet() .stream() .collect(Collectors.toMap(entry -> new TopicPartition(entry.getKey().getStream(), entry.getKey().getPartition().getPartitionId()), entry -> RecordsToDelete.beforeOffset(Long.parseLong(entry.getValue()) + 1))); adminClient.deleteRecords(recordsToDelete).all().whenComplete((ignored, exception) -> { if (exception != null) { LOG.error("Delete message failed for SSPs " + offsets.keySet() + " due to", exception); } }); deleteMessageCalled = true; } }
Source:
public final synchronized ByteBuffer next() { seq += inc; if (seq >= maxSeq) { randomizePrefix(); resetSequential(); } byte[] b = new byte[totalLen]; System.arraycopy(pre, 0, b, 0, preLen); int i = b.length; for (long l = seq; i > preLen; l /= base) { i--; b[i] = (byte) (l % base + (byte)'0'); } return ByteBuffer.wrap(b); }

Target:
public final String next() { return StandardCharsets.US_ASCII.decode(getInstance().nextBuffer()).toString(); }