auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CompileCSharpServerResponse compileCSharpServer( File sourcePath, File dependencies, File target) { String runScript = makeRunScript(sourcePath, dependencies, target); try { FileUtils.write(new File("runScript"), runScript, Charsets.UTF_8); } catch (IOException e) { e.printStackTrace(); new RuntimeException(compileScriptWriteErrorMsg + e.getMessage()); } ProcessBuilder runScriptProc = new ProcessBuilder("sh", "runScript"); try { logger.trace("About to run mcs script"); Process process = runScriptProc.start(); if (logger.isTraceEnabled()) { final InputStream inputStream = process.getInputStream(); final InputStreamReader inputStreamReader = new InputStreamReader(inputStream); final BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String line; while ((line = bufferedReader.readLine()) != null) logger.trace(line); } } catch (IOException e) { e.printStackTrace(); return new CompileCSharpServerResponse(false, e.getMessage()); } return new CompileCSharpServerResponse(true, compilationMessage); }

Target:
public CompileCSharpServerResponse compileCSharpServer( File sourcePath, File dependencies, File target) { String runScript = makeRunScript(sourcePath, dependencies, target); Process process = null; logger.trace("About to run mcs script"); try { process = Runtime.getRuntime().exec(runScript); final Process finalProcess = process; new Thread() { public void run() { final InputStream in = finalProcess.getInputStream(); try { final InputStreamReader inputStreamReader = new InputStreamReader(in); final BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String line; while ((line = bufferedReader.readLine()) != null) logger.trace(line); } catch (IOException e) { e.printStackTrace(); } finally { close(in); } } }.start(); new Thread() { public void run() { final InputStream in = finalProcess.getErrorStream(); try { final InputStreamReader inputStreamReader = new InputStreamReader(in); final BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String line; while ((line = bufferedReader.readLine()) != null) logger.error(line); } catch (IOException e) { e.printStackTrace(); } finally { close(in); } } }.start(); process.waitFor(); return new CompileCSharpServerResponse(true, compilationMessage); } catch (IOException e) { e.printStackTrace(); return new CompileCSharpServerResponse(false, e.getMessage()); } catch (InterruptedException e) { return new CompileCSharpServerResponse(false, e.getMessage()); } finally { if (process != null) { try { process.getOutputStream().close(); } catch (IOException e) { e.printStackTrace(); } process.destroy(); } } }
Source:
public Chain get(long key) { EhcacheEntityResponse response = null; try { response = entity.invoke(EhcacheEntityMessage.getOperation(cacheId, key)); if (response != null && response.getType() == EhcacheEntityResponse.Type.GET_RESPONSE) { return ((EhcacheEntityResponse.GetResponse)response).getChain(); } } catch (Exception e) { unwrapException(e, StoreAccessException.class); } return null; }

Target:
public Chain get(long key) { EhcacheEntityResponse response; try { response = entity.invoke(EhcacheEntityMessage.getOperation(cacheId, key), false); } catch (Exception e) { throw new ServerStoreProxyException(e); } if (response != null && response.getType() == EhcacheEntityResponse.Type.GET_RESPONSE) { return ((EhcacheEntityResponse.GetResponse)response).getChain(); } else { throw new ServerStoreProxyException("Response for get operation was invalid : " + response != null ? response.getType().toString() : "null message"); } }
Source:
void handleBookieFailure(final Map<Integer, BookieSocketAddress> failedBookies) { blockAddCompletions.incrementAndGet(); synchronized (this) { long lac = getLastAddConfirmed(); LedgerMetadata metadata = getLedgerMetadata(); List<BookieSocketAddress> currentEnsemble = getCurrentEnsemble(); try { List<BookieSocketAddress> newEnsemble = replaceBookiesInEnsemble(metadata, currentEnsemble, failedBookies); Set<Integer> replaced = diffEnsemble(currentEnsemble, newEnsemble); blockAddCompletions.decrementAndGet(); if (!replaced.isEmpty()) { newEnsemblesFromRecovery.put(lac + 1, newEnsemble); unsetSuccessAndSendWriteRequest(newEnsemble, replaced); } } catch (BKException.BKNotEnoughBookiesException e) { LOG.error("Could not get additional bookie to remake ensemble, closing ledger: {}", ledgerId); handleUnrecoverableErrorDuringAdd(e.getCode()); return; } } }

Target:
void handleBookieFailure(final Map<Integer, BookieSocketAddress> failedBookies) { blockAddCompletions.incrementAndGet(); synchronized (metadataLock) { long lac = getLastAddConfirmed(); LedgerMetadata metadata = getLedgerMetadata(); List<BookieSocketAddress> currentEnsemble = getCurrentEnsemble(); try { List<BookieSocketAddress> newEnsemble = replaceBookiesInEnsemble(metadata, currentEnsemble, failedBookies); Set<Integer> replaced = diffEnsemble(currentEnsemble, newEnsemble); blockAddCompletions.decrementAndGet(); if (!replaced.isEmpty()) { newEnsemblesFromRecovery.put(lac + 1, newEnsemble); unsetSuccessAndSendWriteRequest(newEnsemble, replaced); } } catch (BKException.BKNotEnoughBookiesException e) { LOG.error("Could not get additional bookie to remake ensemble, closing ledger: {}", ledgerId); handleUnrecoverableErrorDuringAdd(e.getCode()); return; } } }
Source:
public static void main(String[] args) { if (args == null || args.length != 3) { usage(); throw new IllegalStateException("No Arguments provided!"); } String modelTarFile = args[0]; String signatureFile = args[1]; String publicKeyName = args[2]; if (verify(tarContents(modelTarFile), signatureFile, getPublicKey(publicKeyName))) { log.info("Successfully Validated " + modelTarFile); } else { log.error("Could not verify " + modelTarFile + " with details provided"); } }

Target:
public static void main(String[] args) throws ParseException, InvalidKeyException, NoSuchAlgorithmException, SignatureException, FileNotFoundException, KeyStoreException, IOException { Options options = prepareOptions(); CommandLine cli = new DefaultParser().parse(options, args); if (cli.hasOption("help")) { printHelp(options); return; } if (!cli.hasOption("tarFile") || !cli.hasOption("signatureFile") || !cli.hasOption("publicKeyName")) { printHelp(options); throw new MissingOptionException("Missing required option"); } String modelTarFile = cli.getOptionValue("tarFile"); String signatureFile = cli.getOptionValue("signatureFile"); String publicKeyName = cli.getOptionValue("publicKeyName"); if (verify(readTarContents(modelTarFile), signatureFile, getPublicKey(publicKeyName))) { log.info("Successfully Validated " + modelTarFile); } else { log.error("Could not verify " + modelTarFile + " with details provided"); System.exit(-1); } }
Source:
public void deactivate() { logger.debug("Deactivating FS20 binding"); cul.unregisterListener(this); CULManager.close(cul); }

Target:
public void deactivate() { logger.debug("Deactivating HMS binding"); cul.unregisterListener(this); CULManager.close(cul); }
Source:
private SpanId getNewSpanId() { Span parentSpan = spanAndEndpoint().state().getCurrentLocalSpan(); if (parentSpan == null) { parentSpan = spanAndEndpoint().state().getCurrentServerSpan().getSpan(); } long newSpanId = randomGenerator().nextLong(); SpanId.Builder builder = SpanId.builder().spanId(newSpanId); if (parentSpan == null) return builder.build(); return builder.traceId(parentSpan.getTrace_id()).parentId(parentSpan.getId()).build(); }

Target:
private SpanId getNewSpanId() { Span parentSpan = getNewSpanParent(); long newSpanId = randomGenerator().nextLong(); SpanId.Builder builder = SpanId.builder().spanId(newSpanId); if (parentSpan == null) return builder.build(); return builder.traceId(parentSpan.getTrace_id()).parentId(parentSpan.getId()).build(); }
Source:
public boolean hasViewers() { return playerList.size() > 0; }

Target:
public boolean hasViewers() { return this.playerList.size() > 0; }
Source:
private static boolean hasAuthAnnotation(Annotation[] annotations) { for (Annotation annotation : annotations) { if (annotation.annotationType() == CookieParam.class) { return true; } } return false; }

Target:
private static boolean hasAuthAnnotation(Annotation[] annotations) { for (Annotation annotation : annotations) { if (CookieParam.class.equals(annotation.annotationType())) { return true; } } return false; }
Source:
public void testMcqWeightsFeature_shouldHaveCorrectDefaultValue() throws Exception { ______TS("MCQ: Weight cells are hidden by default"); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.selectNewQuestionTypeAndWaitForNewQuestionPanelReady("MCQ"); assertFalse(feedbackEditPage.isMcqAssignWeightCheckboxChecked(NEW_QUESTION_INDEX)); assertFalse(feedbackEditPage.getMcqWeightsColumn(NEW_QUESTION_INDEX).isDisplayed()); assertFalse(feedbackEditPage.getMcqOtherWeightBox(NEW_QUESTION_INDEX).isDisplayed()); ______TS("MCQ: Check Mcq weight default value"); feedbackEditPage.fillQuestionTextBox("MCQ weight feature", NEW_QUESTION_INDEX); feedbackEditPage.fillQuestionDescription("More details", NEW_QUESTION_INDEX); feedbackEditPage.clickMcqAssignWeightCheckboxForNewQuestion(); feedbackEditPage.clickAddMcqOtherOptionCheckboxForNewQuestion(); feedbackEditPage.fillMcqOptionForNewQuestion(0, "Choice 1"); feedbackEditPage.verifyFieldValue("mcqWeight-0--1", "0"); feedbackEditPage.fillMcqOptionForNewQuestion(1, "Choice 2"); feedbackEditPage.verifyFieldValue("mcqWeight-1--1", "0"); feedbackEditPage.verifyFieldValue("mcqOtherWeight--1", "0"); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_QUESTION_ADDED); assertNotNull(BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1)); feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackMcqQuestionWeightAddSuccess.html"); feedbackEditPage.clickDeleteQuestionLink(1); feedbackEditPage.waitForConfirmationModalAndClickOk(); }

Target:
public void testMcqWeightsFeature_shouldHaveCorrectDefaultValue() throws Exception { ______TS("MCQ: Weight cells are hidden by default"); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.selectNewQuestionTypeAndWaitForNewQuestionPanelReady("MCQ"); assertFalse(feedbackEditPage.isMcqHasAssignWeightCheckboxChecked(NEW_QUESTION_INDEX)); assertFalse(feedbackEditPage.getMcqWeightsColumn(NEW_QUESTION_INDEX).isDisplayed()); assertFalse(feedbackEditPage.getMcqOtherWeightBox(NEW_QUESTION_INDEX).isDisplayed()); ______TS("MCQ: Check Mcq weight default value"); feedbackEditPage.fillQuestionTextBox("MCQ weight feature", NEW_QUESTION_INDEX); feedbackEditPage.fillQuestionDescription("More details", NEW_QUESTION_INDEX); feedbackEditPage.clickMcqAssignWeightCheckboxForNewQuestion(); feedbackEditPage.clickAddMcqOtherOptionCheckboxForNewQuestion(); feedbackEditPage.fillMcqOptionForNewQuestion(0, "Choice 1"); feedbackEditPage.verifyFieldValue("mcqWeight-0--1", "0"); feedbackEditPage.fillMcqOptionForNewQuestion(1, "Choice 2"); feedbackEditPage.verifyFieldValue("mcqWeight-1--1", "0"); feedbackEditPage.verifyFieldValue("mcqOtherWeight--1", "0"); feedbackEditPage.clickAddQuestionButton(); feedbackEditPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_QUESTION_ADDED); assertNotNull(BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1)); feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackMcqQuestionWeightAddSuccess.html"); feedbackEditPage.clickDeleteQuestionLink(1); feedbackEditPage.waitForConfirmationModalAndClickOk(); }
Source:
public String toHTMLList() { StringBuilder sb = new StringBuilder(); sb.append("<head>\n") .append( "\t<link rel=\"stylesheet\" href=\"<LINK_0>\">\n") .append("</head>\n") .append("<body>\n"); for (Row row : rows) { sb.append(row.toHTMLList(columns)); } sb.append("</body>"); return sb.toString(); }

Target:
public String toHTMLList() { StringBuilder sb = new StringBuilder(); sb.append("<head>\n") .append(" <link rel=\"stylesheet\" href=\"") .append(BOOTSTRAP_CSS) .append("\">\n") .append("</head>\n") .append("<body>\n"); for (Row row : rows) { sb.append(row.toHTMLList(columns)); } sb.append("</body>"); return sb.toString(); }
Source:
public void createPointBill(String loginName, Long orderId, PointBusinessType businessType, long point, String note) { AccountModel accountModel = accountMapper.lockByLoginName(loginName); if (accountModel == null) { logger.info(String.format("createPointBill: %s no account", loginName)); return; } UserPointModel userPointModel = userPointService.findOrCreate(loginName); long channelPoint = calculateChannelPoint(userPointModel, point, businessType); long sudaiPoint = point - channelPoint; pointBillMapper.create(new PointBillModel(loginName, orderId, sudaiPoint, channelPoint, businessType, note)); userPointMapper.increasePoint(loginName, sudaiPoint, channelPoint, new Date()); }

Target:
public void createPointBill(String loginName, Long orderId, PointBusinessType businessType, long point, String note) { AccountModel accountModel = accountMapper.findByLoginName(loginName); if (accountModel == null) { logger.info(String.format("createPointBill: %s no account", loginName)); return; } if (!userPointMapper.exists(loginName)) { userPointMapper.createIfNotExist(new UserPointModel(loginName, 0, 0, null)); } UserPointModel userPointModel = userPointMapper.lockByLoginName(loginName); long channelPoint = calculateChannelPoint(userPointModel, point, businessType); long sudaiPoint = point - channelPoint; pointBillMapper.create(new PointBillModel(loginName, orderId, sudaiPoint, channelPoint, businessType, note)); userPointMapper.increasePoint(loginName, sudaiPoint, channelPoint, new Date()); }
Source:
public void importGender(@AlsoLoad("gender") String gender) { if (gender == null) { return; } this.gender = Gender.valueOf(gender.toUpperCase()); }

Target:
public void importGender(@AlsoLoad("gender") String gender) { if (gender == null) { return; } this.gender = Gender.valueOf(gender); }
Source:
@Override public ClientResponse process(ClientConnectionContext ctx) { ClusterState state = ctx.kernalContext().grid().cluster().state(); return ctx.currentProtocolContext().isFeatureSupported(ClientBitmaskFeature.CLUSTER_API) ? new ClientByteResponse(requestId(), (byte)state.ordinal()) : new ClientBooleanResponse(requestId(), state != ClusterState.INACTIVE); }

Target:
@Override public ClientResponse process(ClientConnectionContext ctx) { ClusterState state = ctx.kernalContext().grid().cluster().state(); return ctx.currentProtocolContext().isFeatureSupported(ClientBitmaskFeature.CLUSTER_API) ? new ClientByteResponse(requestId(), (byte)state.ordinal()) : new ClientBooleanResponse(requestId(), ClusterState.active(state)); }
Source:
public void setVpnProxy(@Nullable ProxyInfo proxyInfo) { synchronized (mProxyLock) { mVPNProxy = null; if (proxyInfo == null) return; if (!TextUtils.isEmpty(proxyInfo.getHost()) && proxyInfo.getPort() != 0) { mVPNProxy = proxyInfo; } } }

Target:
public void setVpnProxy(@Nullable ProxyInfo proxyInfo) { synchronized (mProxyLock) { if (proxyInfo == null) { mVPNProxy = null; return; } if (!TextUtils.isEmpty(proxyInfo.getHost()) && proxyInfo.getPort() != 0) { mVPNProxy = proxyInfo; } } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); completePlayerSetup(asked); toolbar.bringToFront(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); completePlayerSetup(asked); if (toolbar != null) { setSupportActionBar(toolbar); toolbar.bringToFront(); } }
Source:
public AggregateReduceFunctionsRule(RelOptRuleOperand operand, RelBuilderFactory relBuilderFactory) { super(operand, relBuilderFactory, null); this.functionsToReduce = new HashSet<>(); addDefaultSetOfFunctionsToReduce(); }

Target:
public AggregateReduceFunctionsRule(RelOptRuleOperand operand, RelBuilderFactory relBuilderFactory) { super(operand, relBuilderFactory, null); functionsToReduce = EnumSet.noneOf(SqlKind.class); addDefaultSetOfFunctionsToReduce(); }
Source:
public Response transferApplicationOwnership( @Valid @NotNull TransferOwnership transferOwnership) { List<RoleEntity> newRoles = new ArrayList<>(); Optional<RoleEntity> optNewPORole = roleService.findByScopeAndName(RoleScope.APPLICATION, transferOwnership.getPoRole()); if (optNewPORole.isPresent()) { newRoles.add(optNewPORole.get()); } else { } applicationService.findById(application); membershipService.transferApplicationOwnership(application, new MembershipService.MembershipMember( transferOwnership.getId(), transferOwnership.getReference(), MembershipMemberType.USER), newRoles); return Response.noContent().build(); }

Target:
public Response transferApplicationOwnership( @Valid @NotNull TransferOwnership transferOwnership) { List<RoleEntity> newRoles = new ArrayList<>(); Optional<RoleEntity> optNewPORole = roleService.findByScopeAndName(RoleScope.APPLICATION, transferOwnership.getPoRole()); if (optNewPORole.isPresent()) { newRoles.add(optNewPORole.get()); } else { } applicationService.findById(application); membershipService.transferApplicationOwnership(application, new MembershipService.MembershipMember( transferOwnership.getId(), transferOwnership.getReference(), MembershipMemberType.USER), newRoles); return Response.ok().build(); }
Source:
private static void generatePrepSection(StringBuilder buffer) { buffer.append("%prep\n"); buffer.append("%setup -q -n %{name}-%{version} #You may need to update this according to your Source0\n\n\n"); }

Target:
private static void generatePrepSection(StringBuilder buffer) { buffer.append("%prep\n"); buffer.append("%setup -q #You may need to update this according to your Source0\n\n\n"); }
Source:
private static boolean isMultilineComment(StringLiteral stringLiteral) { Tree parent = stringLiteral.parent(); StringElement firstElement = stringLiteral.stringElements().get(0); return (firstElement.value().endsWith("'''") || firstElement.value().endsWith("\"\"\"")) && parent.is(Tree.Kind.EXPRESSION_STMT); }

Target:
private static boolean isMultilineComment(StringLiteral stringLiteral) { Tree parent = stringLiteral.parent(); StringElement firstElement = stringLiteral.stringElements().get(0); return firstElement.isTripleQuoted() && parent.is(Tree.Kind.EXPRESSION_STMT); }
Source:
private Number[] getAttributeNumericValues(String name) { VariableAttributeOverride attributeOverride = findAttribute(name); return attributeOverride == null ? null : attributeOverride.getAttributeNumericValues(); }

Target:
private Number[] getAttributeNumericValues(String name) { VariableAttributeOverride attributeOverride = findAttribute(name); if (attributeOverride == null) return null; else if (attributeOverride.getType() == null) return attributeOverride.getAttributeNumericValues(type); else return attributeOverride.getAttributeNumericValues(); }
Source:
static ThriftDDL parseThriftDDL(String ddl) { if (Strings.isNullOrEmpty(ddl)) { return null; } String[] parts = ddl.trim().split("\\s+"); Preconditions.checkArgument(parts.length >= 5, "Invalid thrift DDL " + ddl); Preconditions.checkArgument(THRIFT_STRUCT.equals(parts[0]), "ThriftDDL should start with " + THRIFT_STRUCT); ThriftDDL thriftDDL = new ThriftDDL(); thriftDDL.setTableName(parts[1]); Preconditions.checkArgument(START_STRUCT.equals(parts[2]), "Invalid thrift DDL " + ddl); Preconditions.checkArgument(parts[parts.length - 1].endsWith(END_STRUCT), "Invalid thrift DDL " + ddl); parts[parts.length - 1] = parts[parts.length - 1].substring(0, parts[parts.length - 1].length() - 1); List<ThriftField> fields = new ArrayList<>(); for (int i = 3; i < parts.length - 1; i += 2) { ThriftField thriftField = new ThriftField(); thriftField.setType(parts[i]); if (parts[i + 1].endsWith(FIELD_SEPARATOR)) { parts[i + 1] = parts[i + 1].substring(0, parts[i + 1].length() - 1); } thriftField.setName(parts[i + 1]); fields.add(thriftField); } thriftDDL.setFields(fields); return thriftDDL; }

Target:
private static ThriftDDL parseThriftDDL(String ddl) { if (isNullOrEmpty(ddl)) { return null; } String[] parts = ddl.trim().split("\\s+"); checkArgument(parts.length >= 5, "Invalid thrift DDL " + ddl); checkArgument(THRIFT_STRUCT.equals(parts[0]), "ThriftDDL should start with " + THRIFT_STRUCT); ThriftDDL thriftDDL = new ThriftDDL(); thriftDDL.setTableName(parts[1]); checkArgument(START_STRUCT.equals(parts[2]), "Invalid thrift DDL " + ddl); checkArgument(parts[parts.length - 1].endsWith(END_STRUCT), "Invalid thrift DDL " + ddl); parts[parts.length - 1] = parts[parts.length - 1].substring(0, parts[parts.length - 1].length() - 1); List<ThriftField> fields = new ArrayList<>(); for (int i = 3; i < parts.length - 1; i += 2) { ThriftField thriftField = new ThriftField(); thriftField.setType(parts[i]); if (parts[i + 1].endsWith(FIELD_SEPARATOR)) { parts[i + 1] = parts[i + 1].substring(0, parts[i + 1].length() - 1); } thriftField.setName(parts[i + 1]); fields.add(thriftField); } thriftDDL.setFields(fields); return thriftDDL; }
Source:
private void setAllowedFields(String[] allowedFields) { List<String> trimedFields = new ArrayList<>(); for (String field : allowedFields) { trimedFields.add(field.trim()); } if (!trimedFields.contains("email")) { trimedFields.add("email"); } if (!trimedFields.contains("password")) { trimedFields.add("password"); } if (!trimedFields.contains("confirmPassword")) { confirmedPasswordIsConfigured = false; } String fieldUserName = "userName"; if (!usernameEqualsEmail && !trimedFields.contains(fieldUserName)) { trimedFields.add(fieldUserName); } else if (usernameEqualsEmail && trimedFields.contains(fieldUserName)) { trimedFields.remove(fieldUserName); } this.allowedFields = trimedFields.toArray(new String[trimedFields.size()]); }

Target:
private void setAllowedFields(String[] allowedFields) { List<String> trimmedFields = new ArrayList<>(); for (String field : allowedFields) { trimmedFields.add(field.trim()); } if (!trimmedFields.contains("email")) { trimmedFields.add("email"); } if (!trimmedFields.contains("password")) { trimmedFields.add("password"); } if (!trimmedFields.contains("confirmPassword")) { confirmPasswordRequired = false; } String fieldUserName = "userName"; if (!usernameEqualsEmail && !trimmedFields.contains(fieldUserName)) { trimmedFields.add(fieldUserName); } else if (usernameEqualsEmail && trimmedFields.contains(fieldUserName)) { trimmedFields.remove(fieldUserName); } this.allowedFields = trimmedFields.toArray(new String[trimmedFields.size()]); }
Source:
private static int majorVersionFromSystemClass() { InputStream in = ClassLoader.getSystemResourceAsStream("java/lang/ClassLoader.class"); assert in != null; int version; try { in.skip(6L); version = (in.read() << 8) + in.read() - 44; } catch (IOException ex) { throw new RuntimeException(ex); } finally { try { in.close(); } catch (IOException ignored) { } } assert version >= 6; return version; }

Target:
private static int majorVersionFromSystemClass() { InputStream in = ClassLoader.getSystemResourceAsStream("java/lang/ClassLoader.class"); if (in == null) { return majorVersionFromJavaSpecificationVersion(); } int version; try { in.skip(6L); version = (in.read() << 8) + in.read() - 44; } catch (IOException ex) { throw new RuntimeException(ex); } finally { try { in.close(); } catch (IOException ignored) { } } assert version >= 6; return version; }
Source:
private ExecutableElement findFirst(Collection<ExecutableElement> elements, String name) { for (ExecutableElement executableElement : elements) { if (executableElement.getSimpleName().toString().equals(name)) return executableElement; } throw new IllegalArgumentException(name + " not found in " + elements); }

Target:
private ExecutableElement findFirst(Collection<ExecutableElement> elements, String name) { for (ExecutableElement executableElement : elements) { if (executableElement.getSimpleName().toString().equals(name)) { return executableElement; } } throw new IllegalArgumentException(name + " not found in " + elements); }
Source:
public T revertFromTrash(Long trashId) { validateCredentials(); Object trashRecord = trashService.findTrashById(trashId, getClassType().getName()); if (trashRecord == null) { throw new TrashInstanceNotFoundException(getClassType().getName(), trashId); } verifySchemaVersion(trashRecord, trashId, true); try { T newInstance = getClassType().newInstance(); copyValuesFromRecord(newInstance, trashRecord); newInstance = repository.create(newInstance); trashService.moveFromTrash(newInstance, trashRecord, recordHistory); return newInstance; } catch (InstantiationException | IllegalAccessException e) { throw new ObjectUpdateException(trashRecord.getClass().getName(), trashId, e); } }

Target:
public T revertFromTrash(Long trashId) { validateCredentials(); Object trashRecord = trashService.findTrashById(trashId, getClassType().getName()); if (trashRecord == null) { throw new TrashInstanceNotFoundException(getClassType().getName(), trashId); } verifySchemaVersion(trashRecord, trashId, true); try { T newInstance = getClassType().newInstance(); copyValuesFromRecord(newInstance, trashRecord); newInstance = create(newInstance); trashService.removeFromTrash(trashRecord); return newInstance; } catch (InstantiationException | IllegalAccessException e) { throw new ObjectUpdateException(trashRecord.getClass().getName(), trashId, e); } }
Source:
@Override public Response execute(Request request) throws IOException { com.squareup.okhttp.Request requestOk = new com.squareup.okhttp.Request.Builder() .url(request.getUrl()) .build(); com.squareup.okhttp.Response response = client.newCall(requestOk).execute(); List<Header> headerList = new ArrayList<Header>(); for (int i = 0; i < response.headers().size(); i++) { Header header = new Header(response.headers().name(i), response.headers().value(i)); headerList.add(header); } TypedInput responseBody = new TypedInputStream( response.body().contentType().type(), response.body().contentLength(), response.body().byteStream()); Response resp = new Response(request.getUrl(), response.code(), response.message(), headerList, responseBody); return resp; }

Target:
public Response execute(Request request) throws IOException { com.squareup.okhttp.Request requestOk = new com.squareup.okhttp.Request.Builder() .url(request.getUrl()) .build(); com.squareup.okhttp.Response response = client.newCall(requestOk).execute(); List<Header> headerList = new ArrayList<Header>(); Headers headers = response.headers(); for (int i = 0; i < headers.size(); i++) { Header header = new Header(headers.name(i), headers.value(i)); headerList.add(header); } TypedInput responseBody = new TypedInputStream( response.body().contentType().type(), response.body().contentLength(), response.body().byteStream()); Response resp = new Response(request.getUrl(), response.code(), response.message(), headerList, responseBody); return resp; }
Source:
public boolean checkSourceCodeValidity() { try { GHRateLimit ghRateLimit = github.rateLimit(); if (ghRateLimit.remaining == 0) { ZonedDateTime zonedDateTime = Instant.ofEpochSecond(ghRateLimit.reset.getTime()).atZone(ZoneId.systemDefault()); throw new CustomWebApplicationException("Out of rate limit, please wait till " + zonedDateTime, HttpStatus.SC_BAD_REQUEST); } github.getMyOrganizations(); } catch (IOException e) { throw new CustomWebApplicationException( "Please recreate your GitHub token by unlinking and then relinking your Github account through the Accounts page. " + "We need an upgraded token to list your organizations.", HttpStatus.SC_BAD_REQUEST); } return true; }

Target:
public boolean checkSourceCodeValidity() { try { GHRateLimit ghRateLimit = github.rateLimit(); if (ghRateLimit.remaining == 0) { ZonedDateTime zonedDateTime = Instant.ofEpochSecond(ghRateLimit.reset.getTime()).atZone(ZoneId.systemDefault()); throw new CustomWebApplicationException("Out of rate limit, please wait till " + zonedDateTime, HttpStatus.SC_BAD_REQUEST); } github.getMyOrganizations(); } catch (IOException e) { throw new CustomWebApplicationException( "Please recreate your GitHub token by unlinking and then relinking your GitHub account through the Accounts page. " + "We need an upgraded token to list your organizations.", HttpStatus.SC_BAD_REQUEST); } return true; }
Source:
public void getUserLocation_shouldGetAUserLocationByItsId() throws Exception { Assert.fail("Not yet implemented"); }

Target:
public void getUserLocation_shouldGetAUserLocationByItsId() throws Exception { MohCoreService cservice = Context.getService(MohCoreService.class); User sysUser = new User(); sysUser.setUserId(501); Location userLoc = new Location(); userLoc.setLocationId(1); UserLocation userlocation = new UserLocation(); userlocation.setSysUser(sysUser); userlocation.setUserLoc(userLoc); UserLocation returnedUserLocation=cservice.saveUserLocation(userlocation); Assert.assertNotNull(cservice.getUserLocation(returnedUserLocation.getUserLocationId())); }
Source:
protected void start() throws InterruptedException { logger.info("Starting NettyPerfClient"); reporter.start(); group = new NioEventLoopGroup(concurrency); b.group(group).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new HttpClientCodec()).addLast(new ChunkedWriteHandler()).addLast(new RequestSender()); } }); logger.info("Connecting to {}:{}", host, port); b.remoteAddress(host, port); perfClientStartTime = System.currentTimeMillis(); for (int i = 0; i < concurrency; i++) { b.connect().addListener(channelConnectListener); } logger.info("Created channel(s)", concurrency); logger.info("NettyPerfClient started"); }

Target:
protected void start() throws InterruptedException { logger.info("Starting NettyPerfClient"); reporter.start(); group = new NioEventLoopGroup(concurrency); b.group(group).channel(NioSocketChannel.class).handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new HttpClientCodec()).addLast(new ChunkedWriteHandler()).addLast(new ResponseHandler()); } }); logger.info("Connecting to {}:{}", host, port); b.remoteAddress(host, port); perfClientStartTime = System.currentTimeMillis(); for (int i = 0; i < concurrency; i++) { b.connect().addListener(channelConnectListener); } isRunning = true; logger.info("Created channel(s)", concurrency); logger.info("NettyPerfClient started"); }
Source:
private static void initMessages() { ResourceBundle bundle = readMessagesFromBundle(); for (String key : bundle.keySet()) { try { AuditLogType type = AuditLogType.valueOf(key); if (!messages.containsKey(type)) { messages.put(type, bundle.getString(key)); } else { log.errorFormat("The type {0} appears more then once in audit log messages bundle with the values '{1}' and '{2}'", messages.get(type), bundle.getString(key)); } } catch (Exception e) { log.errorFormat("Cannot convert the string {0} to AuditLogType, the key does not exist in the AuditLogType declared types", bundle.getString(key)); } } checkMessages(); }

Target:
private static void initMessages() { ResourceBundle bundle = readMessagesFromBundle(); for (String key : bundle.keySet()) { try { AuditLogType type = AuditLogType.valueOf(key); if (!messages.containsKey(type)) { messages.put(type, bundle.getString(key)); } else { log.errorFormat("The type {0} appears more then once in audit log messages bundle with the values '{1}' and '{2}'", type, messages.get(type), bundle.getString(key)); } } catch (Exception e) { log.errorFormat("Cannot convert the string {0} to AuditLogType, the key does not exist in the AuditLogType declared types", bundle.getString(key)); } } checkMessages(); }
Source:
ValueHolder<V> get(K key) throws CacheAccessException; boolean containsKey(K key) throws CacheAccessException; void put(K key, V value, long creationTime, long lastAccessTime) throws CacheAccessException; void remove(K key) throws CacheAccessException; void clear() throws CacheAccessException; void destroy() throws CacheAccessException; void close() throws CacheAccessException; Store.Iterator<Cache.Entry<K, ValueHolder<V>>> iterator(); public interface ValueHolder<V> { V value(); long creationTime(); long lastAccessTime(); }

Target:
ValueHolder<V> get(K key) throws CacheAccessException; boolean containsKey(K key) throws CacheAccessException; void put(K key, ValueHolder<V> value) throws CacheAccessException; void remove(K key) throws CacheAccessException; void clear() throws CacheAccessException; void destroy() throws CacheAccessException; void close() throws CacheAccessException; Store.Iterator<Cache.Entry<K, ValueHolder<V>>> iterator(); public interface ValueHolder<V> { V value(); long creationTime(); long lastAccessTime(); }
Source:
public Coordinate getCoordinateInDirection(Direction direction) { switch (direction) { case NORTH: return new Coordinate(x, y - 1); case EAST: return new Coordinate(x + 1, y); case WEST: return new Coordinate(x - 1, y); case SOUTH: return new Coordinate(x, y + 1); case NORTHEAST: return new Coordinate(x + 1, y - 1); case NORTHWEST: return new Coordinate(x - 1, y - 1); case SOUTHEAST: return new Coordinate(x + 1, y + 1); case SOUTHWEST: return new Coordinate(x - 1, y + 1); default: throw new IllegalArgumentException(); } }

Target:
public Coordinate getCoordinateInDirection(Direction direction) { if (direction == null) throw new IllegalArgumentException(); switch (direction) { case NORTH: return new Coordinate(x, y - 1); case EAST: return new Coordinate(x + 1, y); case WEST: return new Coordinate(x - 1, y); case SOUTH: return new Coordinate(x, y + 1); case NORTHEAST: return new Coordinate(x + 1, y - 1); case NORTHWEST: return new Coordinate(x - 1, y - 1); case SOUTHEAST: return new Coordinate(x + 1, y + 1); case SOUTHWEST: return new Coordinate(x - 1, y + 1); default: throw new IllegalArgumentException(); } }
Source:
public int execute() { try { TableExport.Paths exportPaths = new TableExport.Paths( work.getAstRepresentationForErrorMsg(), work.getExportRootDir(), conf, false); Hive db = getHive(); LOG.debug("Exporting data to: {}", exportPaths.exportRootDir()); work.acidPostProcess(db); TableExport tableExport = new TableExport(exportPaths, work.getTableSpec(), work.getReplicationSpec(), db, null, conf, work.getMmContext()); tableExport.write(true); } catch (Exception e) { LOG.error("failed", e); setException(e); return 1; } return 0; }

Target:
public int execute() { try { TableExport.Paths exportPaths = new TableExport.Paths( work.getAstRepresentationForErrorMsg(), work.getExportRootDir(), conf, false); Hive db = getHive(); LOG.debug("Exporting data to: {}", exportPaths.exportRootDir()); work.acidPostProcess(db); TableExport tableExport = new TableExport(exportPaths, work.getTableSpec(), work.getReplicationSpec(), db, null, conf, work.getMmContext()); if (!tableExport.write()) { throw new SemanticException(ErrorMsg.INCOMPATIBLE_SCHEMA.getMsg()); } } catch (Exception e) { LOG.error("failed", e); setException(e); return 1; } return 0; }
Source:
public void testValidateFailed() { PlanNode root = new OutputNode(idAllocator.getNextId(), new ExplainAnalyzeNode(idAllocator.getNextId(), new OutputNode(idAllocator.getNextId(), new ProjectNode(idAllocator.getNextId(), new ValuesNode( idAllocator.getNextId(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of()), Assignments.of() ), ImmutableList.of(), ImmutableList.of(), ImmutableList.of() ), new VariableReferenceExpression("a", BIGINT), false), ImmutableList.of(), ImmutableList.of(), ImmutableList.of()); new VerifyOnlyOneOutputNode().validate(root, null, null, null, null, WarningCollector.NOOP); }

Target:
public void testValidateFailed() { PlanNode root = new OutputNode(idAllocator.getNextId(), new ExplainAnalyzeNode(idAllocator.getNextId(), new OutputNode(idAllocator.getNextId(), new ProjectNode(idAllocator.getNextId(), new ValuesNode( idAllocator.getNextId(), ImmutableList.of(), ImmutableList.of()), Assignments.of() ), ImmutableList.of(), ImmutableList.of() ), new VariableReferenceExpression("a", BIGINT), false), ImmutableList.of(), ImmutableList.of()); new VerifyOnlyOneOutputNode().validate(root, null, null, null, null, WarningCollector.NOOP); }
Source:
public Allele getAltAlleleWithHighestAlleleCount() { if ( isBiallelic() ) return getAlternateAllele(0); return getAlternateAlleles().stream() .max((a1, a2) -> Integer.compare(getCalledChrCount(a1), getCalledChrCount(a2))) .get(); }

Target:
public Allele getAltAlleleWithHighestAlleleCount() { if ( isBiallelic() ) return getAlternateAllele(0); return getAlternateAlleles().stream() .map(allele -> new Tuple<>(allele, getCalledChrCount(allele))) .max((alleleAndCount1, alleleAndCount2) -> Integer.compare(alleleAndCount1.b, alleleAndCount2.b)) .get() .a; }
Source:
FileSender( StoreResource resource ) { this.resource = resource; this.byteBuffer = ByteBuffer.allocate( MAX_SIZE ); }

Target:
FileSender( StoreResource resource ) { this.resource = resource; this.byteBuffer = ByteBuffer.allocateDirect( MAX_SIZE ); }
Source:
public void setPageIndicator(int from, int to, int total) { this.pageIndicator.textContent = from + "-" + to + " of " + total; }

Target:
public void setPageIndicator(int from, int to, int total) { this.pageIndicator.textContent = from + "-" + to + " " + ts.getTranslation(LibraryConstants.Of) + " " + total; }
Source:
public OptionSet setOscore(byte[] oscore){ if(oscore != null) this.oscore = oscore.clone(); return this; }

Target:
public OptionSet setOscore(byte[] oscore){ if(oscore != null){ this.oscore = oscore.clone(); }else{ throw new NullPointerException("Oscore cannot be null."); } return this; }
Source:
private boolean isInSelection(Event event) { if (selection.x == selection.y) return false; int offset = getOffsetAtPoint(event.x, event.y, null, true); if (selection.x <= offset && offset < selection.y) return true; else return false; }

Target:
private boolean isInSelection(Event event) { if (selection.x == selection.y) return false; int offset = getOffsetAtPoint(event.x, event.y, null, true); if (selection.x <= offset && offset < selection.y) return true; return false; }
Source:
public static SortedKeyValueIterator<Key,Value> setupSystemScanIterators( SortedKeyValueIterator<Key,Value> source, Set<Column> cols, Authorizations auths, byte[] defaultVisibility, AccumuloConfiguration conf) { SortedKeyValueIterator<Key,Value> delIter = DeletingIterator.wrap(source, false, DeletingIterator.getBehavior(conf)); ColumnFamilySkippingIterator cfsi = new ColumnFamilySkippingIterator(delIter); SortedKeyValueIterator<Key,Value> colFilter = ColumnQualifierFilter.wrap(cfsi, cols); return VisibilityFilter.wrap(colFilter, auths, defaultVisibility); }

Target:
public static SortedKeyValueIterator<Key,Value> setupSystemScanIterators( SortedKeyValueIterator<Key,Value> source, Set<Column> cols, Authorizations auths, byte[] defaultVisibility, AccumuloConfiguration conf) throws IOException { SortedKeyValueIterator<Key,Value> delIter = DeletingIterator.wrap(source, false, DeletingIterator.getBehavior(conf)); ColumnFamilySkippingIterator cfsi = new ColumnFamilySkippingIterator(delIter); SortedKeyValueIterator<Key,Value> colFilter = ColumnQualifierFilter.wrap(cfsi, cols); return VisibilityFilter.wrap(colFilter, auths, defaultVisibility); }
Source:
public void toggleDirectBuffers() throws Exception { ModelNodeResult modelNodeResult = operations.readAttribute(BUFFER_POOL_ADDRESS, DIRECT_BUFFERS); modelNodeResult.assertSuccess(); final boolean originalValue = !modelNodeResult.hasDefinedValue() || modelNodeResult.booleanValue(); try { new ConfigChecker.Builder(client, BUFFER_POOL_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, DIRECT_BUFFERS, !originalValue) .verifyFormSaved() .verifyAttribute(DIRECT_BUFFERS, !originalValue); new ConfigChecker.Builder(client, BUFFER_POOL_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, DIRECT_BUFFERS, originalValue) .verifyFormSaved() .verifyAttribute(DIRECT_BUFFERS, originalValue); } finally { operations.writeAttribute(BUFFER_POOL_ADDRESS, DIRECT_BUFFERS, modelNodeResult.value()); } }

Target:
public void toggleDirectBuffers() throws Exception { final ModelNodeResult originalNodeResult = operations.readAttribute(BUFFER_POOL_ADDRESS, DIRECT_BUFFERS); originalNodeResult.assertSuccess(); final boolean originalValue = !originalNodeResult.hasDefinedValue() || originalNodeResult.booleanValue(); try { new ConfigChecker.Builder(client, BUFFER_POOL_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, DIRECT_BUFFERS, !originalValue) .verifyFormSaved() .verifyAttribute(DIRECT_BUFFERS, !originalValue); new ConfigChecker.Builder(client, BUFFER_POOL_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, DIRECT_BUFFERS, originalValue) .verifyFormSaved() .verifyAttribute(DIRECT_BUFFERS, originalValue); } finally { operations.writeAttribute(BUFFER_POOL_ADDRESS, DIRECT_BUFFERS, originalNodeResult.value()); } }
Source:
public void testGoodTableSourceWithMetadataFields() { TableSchema sourceSchema = defaultSourceSchema().build(); Map<String, String> sourceOptions = defaultSourceOptions().build(); KinesisDynamicSource actualSource = (KinesisDynamicSource) FactoryUtil.createTableSource( null, ObjectIdentifier.of("default", "default", SOURCE_TABLE), createSourceTable(sourceSchema, sourceOptions, Collections.emptyList()), new Configuration(), Thread.currentThread().getContextClassLoader(), false); KinesisDynamicSource expectedSource = new KinesisDynamicSource( sourceSchema.toPhysicalRowDataType(), SOURCE_STREAM, KINESIS_PROPERTIES, new TestFormatFactory.DecodingFormatMock(",", true)); List<String> metadataKeys = Arrays.asList("ShardId", "ApproximateArrivalTimestamp"); DataType producedDataType = getProducedType(sourceSchema, Metadata.values()); expectedSource.applyReadableMetadata(metadataKeys, producedDataType); actualSource.applyReadableMetadata(metadataKeys, producedDataType); assertEquals(expectedSource, actualSource); assertEquals(expectedSource, actualSource.copy()); }

Target:
public void testGoodTableSourceWithMetadataFields() { TableSchema sourceSchema = defaultSourceSchema().build(); Map<String, String> sourceOptions = defaultTableOptions().build(); CatalogTable sourceTable = createSourceTable(sourceSchema, sourceOptions); Metadata[] requestedMetadata = new Metadata[]{ShardId, Timestamp}; List<String> metadataKeys = Arrays.asList(ShardId.getFieldName(), Timestamp.getFieldName()); DataType producedDataType = getProducedType(sourceSchema, requestedMetadata); KinesisDynamicSource actualSource = actualDynamicSource(sourceTable); actualSource.applyReadableMetadata(metadataKeys, producedDataType); KinesisDynamicSource expectedSource = new KinesisDynamicSource( sourceSchema.toPhysicalRowDataType(), STREAM_NAME, defaultConsumerProperties(), new TestFormatFactory.DecodingFormatMock(",", true), producedDataType, Arrays.asList(requestedMetadata)); assertEquals(expectedSource, actualSource); assertEquals(expectedSource, actualSource.copy()); }
Source:
private void authenticate() { SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> param = retrieveSessionParameters(); cmisSession = createSession(sessionFactory, param); boolean isAlfresco = cmisSession.getRepositoryInfo().getProductName() .startsWith(OnPremiseConstant.ALFRESCO_VENDOR); String version = RepositoryVersionHelper.getVersionString(cmisSession.getRepositoryInfo().getProductVersion(), 0); RepositoryInfo tmpRepositoryInfo = new OnPremiseRepositoryInfoImpl(cmisSession.getRepositoryInfo()); if (isAlfresco && version != null && Integer.parseInt(version) >= OnPremiseConstant.ALFRESCO_VERSION_4) { param.put(SessionParameter.ATOMPUB_URL, baseUrl.concat(OnPremiseUrlRegistry.BINDING_CMISATOM)); Session cmisSession2 = null; try { cmisSession2 = createSession(sessionFactory, param); } catch (Exception e) { cmisSession2 = null; } cmisSession = (cmisSession2 != null) ? cmisSession2 : cmisSession; } rootNode = new FolderImpl(cmisSession.getRootFolder()); repositoryInfo = new OnPremiseRepositoryInfoImpl(cmisSession.getRepositoryInfo()); if (repositoryInfo.getEdition() == OnPremiseConstant.ALFRESCO_EDITION_UNKNOWN && tmpRepositoryInfo.getEdition() != OnPremiseConstant.ALFRESCO_EDITION_UNKNOWN) { repositoryInfo = tmpRepositoryInfo; } create(); }

Target:
private void authenticate() { SessionFactory sessionFactory = SessionFactoryImpl.newInstance(); Map<String, String> param = retrieveSessionParameters(); cmisSession = createSession(sessionFactory, param); boolean isAlfresco = cmisSession.getRepositoryInfo().getProductName() .startsWith(OnPremiseConstant.ALFRESCO_VENDOR); String version = RepositoryVersionHelper.getVersionString(cmisSession.getRepositoryInfo().getProductVersion(), 0); RepositoryInfo tmpRepositoryInfo = new OnPremiseRepositoryInfoImpl(cmisSession.getRepositoryInfo()); if (isAlfresco && version != null && Integer.parseInt(version) >= OnPremiseConstant.ALFRESCO_VERSION_4) { param.put(SessionParameter.ATOMPUB_URL, baseUrl.concat(OnPremiseUrlRegistry.BINDING_CMISATOM)); Session cmisSession2 = null; try { cmisSession2 = createSession(sessionFactory, param); } catch (Exception e) { cmisSession2 = null; } cmisSession = (cmisSession2 != null) ? cmisSession2 : cmisSession; } rootNode = new FolderImpl(cmisSession.getRootFolder()); repositoryInfo = new OnPremiseRepositoryInfoImpl(cmisSession.getRepositoryInfo()); if (repositoryInfo.getEdition() == OnPremiseConstant.ALFRESCO_EDITION_UNKNOWN && tmpRepositoryInfo.getEdition() != OnPremiseConstant.ALFRESCO_EDITION_UNKNOWN) { repositoryInfo = new OnPremiseRepositoryInfoImpl(cmisSession.getRepositoryInfo(), tmpRepositoryInfo.getEdition()); } create(); }
Source:
protected CompletableFuture<Void> doResolve(ITextViewer viewer, IProgressMonitor monitor) { return CompletableFuture.runAsync(() -> { try { IJavaElement element= super.getElement(); long implCount = 0; if (element instanceof IType) { implCount= countTypeImplementations((IType) element, monitor); action= implCount > 0 ? e -> new OpenTypeHierarchyAction(editor).run(new StructuredSelection(element)) : null; if (implCount == 0 && showImplementationsAtLeastOne) { super.setLabel(""); } else { super.setLabel(MessageFormat.format(JavaCodeMiningMessages.JavaImplementationCodeMining_label, implCount)); } } else if (element instanceof IMethod) { implCount= countMethodImplementations((IMethod) element, monitor); action= implCount > 0 ? e -> new FindDeclarationsInHierarchyAction(editor).run(element) : null; if (implCount == 0 && showImplementationsAtLeastOne) { super.setLabel(""); } else { super.setLabel(MessageFormat.format(JavaCodeMiningMessages.JavaImplementationCodeMining_label, implCount)); } } } catch (JavaModelException e) { } catch (CoreException e1) { } }); }

Target:
protected CompletableFuture<Void> doResolve(ITextViewer viewer, IProgressMonitor monitor) { return CompletableFuture.runAsync(() -> { try { IJavaElement element= super.getElement(); long implCount = 0; if (element instanceof IType) { implCount= countTypeImplementations((IType) element, monitor); action= implCount > 0 ? e -> new OpenTypeHierarchyAction(editor).run(new StructuredSelection(element)) : null; if (implCount == 0 && showImplementationsAtLeastOne) { super.setLabel(""); } else { super.setLabel(MessageFormat.format(JavaCodeMiningMessages.JavaImplementationCodeMining_label, implCount)); } } else if (element instanceof IMethod) { implCount= countMethodImplementations((IMethod) element, monitor); action= implCount > 0 ? e -> new FindDeclarationsInSubHierarchyAction(editor).run(element) : null; if (implCount == 0 && showImplementationsAtLeastOne) { super.setLabel(""); } else { super.setLabel(MessageFormat.format(JavaCodeMiningMessages.JavaImplementationCodeMining_label, implCount)); } } } catch (JavaModelException e) { } catch (CoreException e1) { } }); }