auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPrintBranch() throws Exception { final DetailAST ast = JavaParser.parseFile( new File(getPath("InputAstTreeStringPrinterPrintBranch.java")), JavaParser.Options.WITHOUT_COMMENTS); final String eol = System.lineSeparator(); final String expected = "CLASS_DEF -> CLASS_DEF [3:0]" + eol + "|--MODIFIERS -> MODIFIERS [3:0]" + eol + "| `--LITERAL_PUBLIC -> public [3:0]" + eol; final DetailAST nodeToPrint = ast.getNextSibling().getFirstChild().getFirstChild(); final String result = AstTreeStringPrinter.printBranch(nodeToPrint); Assert.assertEquals("Branches do not match", expected, result); }

Target:
public void testPrintBranch() throws Exception { final DetailAST ast = JavaParser.parseFile( new File(getPath("InputAstTreeStringPrinterPrintBranch.java")), JavaParser.Options.WITH_COMMENTS); final String expected = addEndOfLine( "CLASS_DEF -> CLASS_DEF [3:0]", "|--MODIFIERS -> MODIFIERS [3:0]", "| `--LITERAL_PUBLIC -> public [3:0]"); final DetailAST nodeToPrint = ast.getNextSibling().getFirstChild().getFirstChild(); final String result = AstTreeStringPrinter.printBranch(nodeToPrint); assertThat("Branches do not match", result, is(expected)); }
Source:
public static <T> Flowable<T> fromOptional(@NonNull Optional<T> optional) { ObjectHelper.requireNonNull(optional, "optional is null"); return optional.map(Flowable::just).orElseGet(Flowable::empty); }

Target:
public static <T> Flowable<@NonNull T> fromOptional(@NonNull Optional<T> optional) { ObjectHelper.requireNonNull(optional, "optional is null"); return optional.map(Flowable::just).orElseGet(Flowable::empty); }
Source:
public void run() { Class c = null; try { c = Class.forName("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefault002Debuggee$TestClass"); } catch (ClassNotFoundException e) { e.printStackTrace(); } synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY); logWriter.println("InvokeMethodDefault002Debuggee"); synchronizer.receiveMessageWithoutException("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefault002Debuggee(#1)"); execMethod(); synchronizer.receiveMessageWithoutException("org.apache.harmony.jpda.tests.jdwp.ObjectReference.InvokeMethodDefault002Debuggee(#2)"); }

Target:
public void run() { Class c = null; String packageName = "org.apache.harmony.jpda.tests.jdwp."; try { c = Class.forName( packageName + "ObjectReference.InvokeMethodDefault002Debuggee$TestClass"); } catch (ClassNotFoundException e) { e.printStackTrace(); } synchronizer.sendMessage(JPDADebuggeeSynchronizer.SGNL_READY); logWriter.println("InvokeMethodDefault002Debuggee"); synchronizer.receiveMessageWithoutException( packageName + "ObjectReference.InvokeMethodDefault002Debuggee(#1)"); execMethod(); synchronizer.receiveMessageWithoutException( packageName + "ObjectReference.InvokeMethodDefault002Debuggee(#2)"); }
Source:
public static ViewTypes getViewType(String viewName) { switch (viewName) { case TOKENS: case LEMMA: case POS: return ViewTypes.TOKEN_LABEL_VIEW; case SENTENCE: case PARAGRAPH: case NER_ACE: case NER_CONLL: case NER_ONTONOTES: case SHALLOW_PARSE: case QUANTITIES: case WIKIFIER: case CLAUSES_CHARNIAK: case CLAUSES_STANFORD: case CLAUSES_BERKELEY: case BROWN_CLUSTERS: case GAZETTEER: case TREE_GAZETTEER: case GAZETTEER_NE: return ViewTypes.SPAN_LABEL_VIEW; case DEPENDENCY: case DEPENDENCY_STANFORD: case DEPENDENCY_HEADFINDER: return ViewTypes.DEPENDENCY_VIEW; case PARSE_GOLD: case PARSE_CHARNIAK: case PARSE_CHARNIAK_KBEST: case PSEUDO_PARSE_CHARNIAK: case PARSE_STANFORD: case PARSE_STANFORD_KBEST: case PSEUDO_PARSE_STANFORD: case PARSE_BERKELEY: case PSEUDO_PARSE_BERKELEY: return ViewTypes.PARSE_VIEW; case SRL_VERB: case SRL_NOM: case SRL_PREP: return ViewTypes.PREDICATE_ARGUMENT_VIEW; case COREF: case COREF_HEAD: case COREF_EXTENT: return ViewTypes.COREF_VIEW; } return null; }

Target:
public static ViewTypes getViewType(String viewName) { switch (viewName) { case TOKENS: case LEMMA: case POS: return ViewTypes.TOKEN_LABEL_VIEW; case SENTENCE: case PARAGRAPH: case MENTION_ACE: case NER_CONLL: case NER_ONTONOTES: case SHALLOW_PARSE: case QUANTITIES: case WIKIFIER: case CLAUSES_CHARNIAK: case CLAUSES_STANFORD: case CLAUSES_BERKELEY: case BROWN_CLUSTERS: case GAZETTEER: case TREE_GAZETTEER: case GAZETTEER_NE: return ViewTypes.SPAN_LABEL_VIEW; case DEPENDENCY: case DEPENDENCY_STANFORD: case DEPENDENCY_HEADFINDER: return ViewTypes.DEPENDENCY_VIEW; case PARSE_GOLD: case PARSE_CHARNIAK: case PARSE_CHARNIAK_KBEST: case PSEUDO_PARSE_CHARNIAK: case PARSE_STANFORD: case PARSE_STANFORD_KBEST: case PSEUDO_PARSE_STANFORD: case PARSE_BERKELEY: case PSEUDO_PARSE_BERKELEY: return ViewTypes.PARSE_VIEW; case SRL_VERB: case SRL_NOM: case SRL_PREP: return ViewTypes.PREDICATE_ARGUMENT_VIEW; case COREF: case COREF_HEAD: case COREF_EXTENT: return ViewTypes.COREF_VIEW; } return null; }
Source:
public Cluster getClusterByHostId(Guid hostId) { final String sql = "select cluster.* \n" + "from cluster_view as cluster \n" + "join vds_static on vds_static.cluster_id = cluster.cluster_id \n" + "where vds_static.vds_id = :v_hostId"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("hostId", hostId); final NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(getJdbcTemplate()); return namedParameterJdbcTemplate.queryForObject(sql, customMapSqlParameterSource, clusterRowMapper); }

Target:
public Cluster getClusterByHostId(Guid hostId) { final String sql = "select cluster.* \n" + "from cluster_view as cluster \n" + "join vds_static on vds_static.cluster_id = cluster.cluster_id \n" + "where vds_static.vds_id = :v_hostId"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("hostId", hostId); return getNamedParameterJdbcTemplate().queryForObject(sql, customMapSqlParameterSource, clusterRowMapper); }
Source:
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { BuildData buildData = build.getAction(BuildData.class); String sha1 = ObjectId.toString(buildData.getLastBuiltRevision().getSha1()); GitHubPushCause cause = build.getCause(GitHubPushCause.class); GitHubTrigger trigger = (GitHubTrigger) build.getProject().getTrigger(GitHubPushTrigger.class); for (GitHubRepositoryName gitHubRepositoryName : trigger.getGitHubRepositories()) { for (GHRepository repository : gitHubRepositoryName.resolve()) { GHCommitState state; String msg; Result result = build.getResult(); if (result.isBetterOrEqualTo(SUCCESS)) { state = GHCommitState.SUCCESS; msg = "Success"; } else if (result.isBetterOrEqualTo(UNSTABLE)) { state = GHCommitState.FAILURE; msg = "Unstable"; } else { state = GHCommitState.ERROR; msg = "Failed"; } listener.getLogger().println("setting commit status on Github for " + repository.getUrl() + "/commit/" + sha1); repository.createCommitStatus(sha1, state, build.getAbsoluteUrl(), msg); } } return true; }

Target:
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { BuildData buildData = build.getAction(BuildData.class); String sha1 = ObjectId.toString(buildData.getLastBuiltRevision().getSha1()); GitHubTrigger trigger = (GitHubTrigger) build.getProject().getTrigger(GitHubPushTrigger.class); for (GitHubRepositoryName gitHubRepositoryName : trigger.getGitHubRepositories()) { for (GHRepository repository : gitHubRepositoryName.resolve()) { GHCommitState state; String msg; Result result = build.getResult(); if (result.isBetterOrEqualTo(SUCCESS)) { state = GHCommitState.SUCCESS; msg = "Success"; } else if (result.isBetterOrEqualTo(UNSTABLE)) { state = GHCommitState.FAILURE; msg = "Unstable"; } else { state = GHCommitState.ERROR; msg = "Failed"; } listener.getLogger().println("setting commit status on Github for " + repository.getUrl() + "/commit/" + sha1); repository.createCommitStatus(sha1, state, build.getAbsoluteUrl(), msg); } } return true; }
Source:
public boolean isStandardHeader(String value) { return STANDARD_HEADERS.contains(value.toUpperCase()); }

Target:
public boolean isStandardHeader(String value) { return NullChecker.isNotNullish(value) ? STANDARD_HEADERS.contains(value.toUpperCase()) : false; }
Source:
private void loadData() { discountFragmentViewModel.getDiscountCodes().observe(this, discountCodes -> { this.discountCodes.clear(); this.discountCodes.addAll(discountCodes); discountCodesListAdapter.notifyDataSetChanged(); handleVisibility(); Timber.d("Total discount codes +"+this.discountCodes.size()); }); }

Target:
private void loadData() { discountFragmentViewModel.getDiscountCodes().observe(this, discountCodes -> { this.discountCodes.clear(); this.discountCodes.addAll(discountCodes); discountCodesListAdapter.notifyDataSetChanged(); handleVisibility(); }); }
Source:
public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(60) .redirectUris("https://anywhere") .and() .withClient("my-client-with-registered-redirect") .authorizedGrantTypes("authorization_code") .authorities("ROLE_CLIENT") .scopes("read", "trust") .resourceIds("oauth2-resource") .redirectUris("https://anywhere?key=value") .and() .withClient("my-client-with-secret") .authorizedGrantTypes("client_credentials", "password") .authorities("ROLE_CLIENT") .scopes("read") .resourceIds("oauth2-resource") .secret("secret") .and() .withClient("my-client-with-unlimited-scopes") .authorizedGrantTypes("password", "refresh_token"); }

Target:
public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(60) .redirectUris("https://anywhere") .and() .withClient("my-client-with-registered-redirect") .authorizedGrantTypes("authorization_code") .authorities("ROLE_CLIENT") .scopes("read", "trust") .resourceIds("oauth2-resource") .redirectUris("https://anywhere?key=value") .and() .withClient("my-client-with-secret") .authorizedGrantTypes("client_credentials", "password") .authorities("ROLE_CLIENT") .scopes("read") .resourceIds("oauth2-resource") .secret("secret") .and() .withClient("my-client-with-empty-scopes") .authorizedGrantTypes("password", "refresh_token"); }
Source:
public ProductResource getProduct(@QueryParam("productId") String productId) throws WebApplicationException { if (productId == null || productId.trim().equals("")) { throw new BadRequestException(ErrorTypes.BAD_REQUEST_EXCEPTION_PRODUCT_RESOURCE.getErrorType()); } try { FileManagerClient client = getContextClient(); Product product = client.getProductById(productId); product.setProductReferences(client.getProductReferences(product)); return new ProductResource(product, client.getMetadata(product), product.getProductReferences(), getContextWorkingDir()); } catch (Exception e) { String message = "Unable to find the requested resource."; LOGGER.log(Level.FINE, message, e); throw new NotFoundException(e.getMessage()); } }

Target:
public ProductResource getProduct(@QueryParam("productId") String productId) throws WebApplicationException { if (productId == null || productId.trim().equals("")) { throw new BadRequestException( ErrorType.BAD_REQUEST_EXCEPTION_PRODUCT_RESOURCE.getErrorType()); } try { FileManagerClient client = getContextClient(); Product product = client.getProductById(productId); product.setProductReferences(client.getProductReferences(product)); return new ProductResource( product, client.getMetadata(product), product.getProductReferences(), getContextWorkingDir()); } catch (Exception e) { throw new NotFoundException(e.getMessage()); } }
Source:
public Invocations getInvocations() { return new Invocations.Builder() .invocation().methods(GET).path("/v2/logging/loggers").handleWith(this::listLoggers) .invocation().methods(GET).path("/v2/logging/appenders").handleWith(this::listAppenders) .invocation().methods(DELETE).path("/v2/logging/loggers/{loggerName}").handleWith(this::deleteLogger) .invocation().methods(PUT).path("/v2/logging/loggers/{loggerName}").handleWith(this::setLogger) .create(); }

Target:
public Invocations getInvocations() { return new Invocations.Builder() .invocation().methods(GET).path("/v2/logging/loggers").handleWith(this::listLoggers) .invocation().methods(GET).path("/v2/logging/appenders").handleWith(this::listAppenders) .invocation().methods(DELETE).path("/v2/logging/loggers/{loggerName}").handleWith(this::deleteLogger) .invocation().methods(PUT).path("/v2/logging/loggers/{loggerName}").handleWith(this::setLogger) .invocation().methods(PUT).path("/v2/logging/loggers").handleWith(this::setLogger) .create(); }
Source:
private org.eclipse.che.api.workspace.server.model.impl.CommandImpl toWorkspaceCommand( Command devCommand, Action commandAction, FileContentProvider contentProvider) throws DevfileException { org.eclipse.che.api.workspace.server.model.impl.CommandImpl command = new org.eclipse.che.api.workspace.server.model.impl.CommandImpl(); command.setName(devCommand.getName()); command.setType(commandAction.getType()); command.setCommandLine(commandAction.getCommand()); if (commandAction.getWorkdir() != null) { command.getAttributes().put(WORKING_DIRECTORY_ATTRIBUTE, commandAction.getWorkdir()); } if (commandAction.getComponent() != null) { command .getAttributes() .put(Constants.COMPONENT_ALIAS_COMMAND_ATTRIBUTE, commandAction.getComponent()); } if (commandAction.getReference() != null) { command.getAttributes().put(COMMAND_ACTION_REFERENCE_ATTRIBUTE, commandAction.getReference()); } if (commandAction.getReferenceContent() != null) { command .getAttributes() .put(COMMAND_ACTION_REFERENCE_CONTENT_ATTRIBUTE, commandAction.getReferenceContent()); } else if (commandAction.getReference() != null) { try { String referenceContent = contentProvider.fetchContent(commandAction.getReference()); command.getAttributes().put(COMMAND_ACTION_REFERENCE_CONTENT_ATTRIBUTE, referenceContent); } catch (IOException e) { throw new DevfileException( format( "Failed to fetch content of action from reference %s", commandAction.getReference()), e); } } command.getAttributes().putAll(devCommand.getAttributes()); return command; }

Target:
private org.eclipse.che.api.workspace.server.model.impl.CommandImpl toWorkspaceCommand( Command devCommand, Action commandAction, FileContentProvider contentProvider) throws DevfileException { org.eclipse.che.api.workspace.server.model.impl.CommandImpl command = new org.eclipse.che.api.workspace.server.model.impl.CommandImpl(); command.setName(devCommand.getName()); command.setType(commandAction.getType()); command.setCommandLine(commandAction.getCommand()); if (commandAction.getWorkdir() != null) { command.getAttributes().put(WORKING_DIRECTORY_ATTRIBUTE, commandAction.getWorkdir()); } if (commandAction.getComponent() != null) { command .getAttributes() .put(Constants.COMPONENT_ALIAS_COMMAND_ATTRIBUTE, commandAction.getComponent()); } if (commandAction.getReference() != null) { command.getAttributes().put(COMMAND_ACTION_REFERENCE_ATTRIBUTE, commandAction.getReference()); } if (commandAction.getReferenceContent() != null) { command .getAttributes() .put(COMMAND_ACTION_REFERENCE_CONTENT_ATTRIBUTE, commandAction.getReferenceContent()); } else if (commandAction.getReference() != null) { try { String referenceContent = contentProvider.fetchContent(commandAction.getReference()); command.getAttributes().put(COMMAND_ACTION_REFERENCE_CONTENT_ATTRIBUTE, referenceContent); } catch (IOException e) { throw new DevfileException( format( "Failed to fetch content of action from reference %s: %s", commandAction.getReference(), e.getMessage()), e); } } command.getAttributes().putAll(devCommand.getAttributes()); return command; }
Source:
public String read(AccessRecord record) { if (new UriUpdateTableFilter().matches(record)) { return "Update"; } if (new UriQueryTableFilter().matches(record)) { return "Query"; } if (new UriDownloadTableFilter().matches(record)) { return "Download"; } if (new UriUploadTableFilter().matches(record)) { return "Upload"; } return "Uncategorized"; }

Target:
public String read(AccessRecord record) { if (UPDATE_FILTER.matches(record)) { return "Update"; } if (QUERY_FILTER.matches(record)) { return "Query"; } if (DOWNLOAD_FILTER.matches(record)) { return "Download"; } if (UPLOAD_FILTER.matches(record)) { return "Upload"; } return "Uncategorized"; }
Source:
public void visitNode(Tree tree) { if(tree.parent().is(Tree.Kind.IF_STATEMENT)) { IfStatementTree parentIf = (IfStatementTree) tree.parent(); if(tree.equals(parentIf.elseStatement())) { return; } } IfStatementTree ifStatementTree = (IfStatementTree) tree; int level = 1; while (ifStatementTree.elseKeyword() != null && ifStatementTree.elseStatement().is(Tree.Kind.IF_STATEMENT)) { level++; if(!sameEqualCondition(ifStatementTree.condition(), ((IfStatementTree) ifStatementTree.elseStatement()).condition())) { level = 0; break; } ifStatementTree = (IfStatementTree) ifStatementTree.elseStatement(); } if(level > 2) { reportIssue(tree, "Convert this \"if/else if\" structure into a \"switch\"."); } }

Target:
public void visitNode(Tree tree) { if(tree.parent().is(Tree.Kind.IF_STATEMENT)) { IfStatementTree parentIf = (IfStatementTree) tree.parent(); if(tree.equals(parentIf.elseStatement())) { return; } } IfStatementTree ifStatementTree = (IfStatementTree) tree; int level = 1; while (ifStatementTree.elseKeyword() != null && ifStatementTree.elseStatement().is(Tree.Kind.IF_STATEMENT)) { level++; if(!sameEqualCondition(ifStatementTree.condition(), ((IfStatementTree) ifStatementTree.elseStatement()).condition())) { level = 0; break; } ifStatementTree = (IfStatementTree) ifStatementTree.elseStatement(); } if(level > 2) { reportIssue(((IfStatementTree) tree).condition(), "Convert this \"if/else if\" structure into a \"switch\"." + context.getJavaVersion().java7CompatibilityMessage()); } }
Source:
void handleCommandLineArg(final MainController ctrl, String arg) { File file = new File(arg); if (!file.exists()) { if (!file.mkdirs()) { return; } } else if (file.isFile()) { if (file.getName().toLowerCase().endsWith(Aes256Cryptor.MASTERKEY_FILE_EXT.toLowerCase())) { file = file.getParentFile(); } else { return; } } File f = file; Platform.runLater(() -> { ctrl.addDirectory(f); ctrl.toFront(); }); }

Target:
void handleCommandLineArg(final MainController ctrl, String arg) { Path file = FileSystems.getDefault().getPath(arg); if (!Files.exists(file)) { try { if (!Files.isDirectory(Files.createDirectories(file))) { return; } } catch (IOException e) { return; } } else if (Files.isRegularFile(file)) { if (StringUtils.endsWithIgnoreCase(file.getFileName().toString(), Aes256Cryptor.MASTERKEY_FILE_EXT)) { file = file.getParent(); } else { return; } } Path f = file; Platform.runLater(() -> { ctrl.addDirectory(f); ctrl.toFront(); }); }
Source:
public void dispose() { treeViewerManager.dispose(); treeViewerManager = null; super.dispose(); if (getAdapterFactory() instanceof IDisposable) { ((IDisposable) getAdapterFactory()).dispose(); } if (refreshAtOpeningActivator != null) { getSite().getPage().removePartListener(refreshAtOpeningActivator); refreshAtOpeningActivator = null; } }

Target:
public void dispose() { super.dispose(); if (getAdapterFactory() instanceof IDisposable) { ((IDisposable) getAdapterFactory()).dispose(); } if (refreshAtOpeningActivator != null) { getSite().getPage().removePartListener(refreshAtOpeningActivator); refreshAtOpeningActivator = null; } }
Source:
static Spanned enrichText(String text, List<Pair<Integer, Integer>> positions, Context context) { SpannableString enriched = new SpannableString(text); int primaryColor = UIColors.getPrimaryColor(context); for (Pair<Integer, Integer> position : positions) { enriched.setSpan( new ForegroundColorSpan(primaryColor), position.first, position.second, Spannable.SPAN_INCLUSIVE_INCLUSIVE ); } return enriched; }

Target:
Spanned enrichText(String text, List<Pair<Integer, Integer>> positions, Context context) { SpannableString enriched = new SpannableString(text); int primaryColor = UIColors.getPrimaryColor(context); for (Pair<Integer, Integer> position : positions) { enriched.setSpan( new ForegroundColorSpan(primaryColor), position.first, position.second, Spannable.SPAN_INCLUSIVE_INCLUSIVE ); } return enriched; }
Source:
public static String format(String messageTemplate, Object arg) { if (messageTemplate == null) { return format("", arg); } int placeholderPos = messageTemplate.indexOf("{}", 0); String argStr = String.valueOf(arg); StringBuilder builder = new StringBuilder(messageTemplate.length() + argStr.length()); if (placeholderPos >= 0) { builder .append(messageTemplate.substring(0, placeholderPos)) .append(arg) .append(messageTemplate.substring(placeholderPos + 2)); } else { builder.append(messageTemplate).append(" - [").append(arg).append(']'); } return builder.toString(); }

Target:
public static String format(String messageTemplate, Object arg) { if (messageTemplate == null) { return format("", arg); } int placeholderPos = messageTemplate.indexOf("{}", 0); String argStr = String.valueOf(arg); StringBuilder builder = new StringBuilder(messageTemplate.length() + argStr.length() + 3); if (placeholderPos >= 0) { builder .append(messageTemplate.substring(0, placeholderPos)) .append(argStr) .append(messageTemplate.substring(placeholderPos + 2)); } else { builder.append(messageTemplate).append(" - [").append(argStr).append(']'); } return builder.toString(); }
Source:
public CoupleMbusDeviceAsyncResponse coupleMbusDevice( @OrganisationIdentification final String organisationIdentification, @RequestPayload final CoupleMbusDeviceRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl) throws OsgpException { final String deviceIdentification = request.getDeviceIdentification(); final String mbusDeviceIdentification = request.getMbusDeviceIdentification(); LOGGER.info("Incoming CoupleMbusDeviceRequest for meter: and mbus device on channel {}.", deviceIdentification, mbusDeviceIdentification); CoupleMbusDeviceAsyncResponse response = null; try { response = new CoupleMbusDeviceAsyncResponse(); final String correlationUid = this.installationService.enqueueCoupleMbusDeviceRequest( organisationIdentification, deviceIdentification, mbusDeviceIdentification, MessagePriorityEnum.getMessagePriority(messagePriority), this.installationMapper.map(scheduleTime, Long.class)); response.setCorrelationUid(correlationUid); response.setDeviceIdentification(deviceIdentification); this.saveResponseUrlIfNeeded(correlationUid, responseUrl); } catch (final Exception e) { LOGGER.error("Exception: while coupling devices: and for organisation {}.", new Object[] { e.getMessage(), deviceIdentification, mbusDeviceIdentification, organisationIdentification }, e); this.handleException(e); } return response; }

Target:
public CoupleMbusDeviceAsyncResponse coupleMbusDevice( @OrganisationIdentification final String organisationIdentification, @RequestPayload final CoupleMbusDeviceRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl) throws OsgpException { final String deviceIdentification = request.getDeviceIdentification(); final String mbusDeviceIdentification = request.getMbusDeviceIdentification(); LOGGER.info("Incoming CoupleMbusDeviceRequest for meter: and mbus device {}.", deviceIdentification, mbusDeviceIdentification); CoupleMbusDeviceAsyncResponse response = null; try { response = new CoupleMbusDeviceAsyncResponse(); final String correlationUid = this.installationService.enqueueCoupleMbusDeviceRequest( organisationIdentification, deviceIdentification, mbusDeviceIdentification, MessagePriorityEnum.getMessagePriority(messagePriority), this.installationMapper.map(scheduleTime, Long.class)); response.setCorrelationUid(correlationUid); response.setDeviceIdentification(deviceIdentification); this.saveResponseUrlIfNeeded(correlationUid, responseUrl); } catch (final Exception e) { LOGGER.error("Exception while coupling devices: and for organisation {}.", deviceIdentification, mbusDeviceIdentification, organisationIdentification, e); this.handleException(e); } return response; }
Source:
public void accumulateRowSizes(int[] rowSizes) { verify(positionCount > 0); int averageElementSize = Integer.BYTES + Byte.BYTES; for (int i = 0; i < positionCount; i++) { rowSizes[i] += averageElementSize; } ensurePositionOffsetsSize(); System.arraycopy(offsets, 0, positionOffsets, 0, positionCount); rawBlockBuffer.accumulateRowSizes(positionOffsets, positionCount, rowSizes); }

Target:
public void accumulateRowSizes(int[] rowSizes) { for (int i = 0; i < positionCount; i++) { rowSizes[i] += POSITION_SIZE; } ensureOffsetsOffsetsCapacity(); System.arraycopy(offsets, 0, offsetsOffsets, 0, positionCount + 1); elementsBuffers.accumulateRowSizes(offsetsOffsets, positionCount, rowSizes); }
Source:
public void testList() { List<VirtualMachine> list = api().list(); VirtualMachine vm = api().get(getName()); assertTrue(list.size() > 0); boolean found = false; for (VirtualMachine virtualMachine : list) { if (virtualMachine.name().equals(getName())){ found = true; break; } } assertTrue(found); assertTrue(list.contains(vm)); }

Target:
public void testList() { List<VirtualMachine> list = api().list(); final VirtualMachine vm = api().get(getName()); boolean vmPresent = Iterables.any(list, new Predicate<VirtualMachine>() { public boolean apply(VirtualMachine input) { return input.name().equals(vm.name()); } }); assertTrue(vmPresent); }
Source:
public <T> T executeSQL(String databaseName, String query, ExecuteResultHandler<T> handler) throws SQLiteException { Util.throwIfNull(query); Util.throwIfNull(handler); SQLiteDatabase database = openDatabase(databaseName); try { String firstWordUpperCase = getFirstWord(query).toUpperCase(); if (firstWordUpperCase.equals("UPDATE") || firstWordUpperCase.equals("DELETE")) { return executeUpdateDelete(database, query, handler); } else if (firstWordUpperCase.equals("INSERT")) { return executeInsert(database, query, handler); } else if (QUERY_TYPES_WITH_RESULT.contains(firstWordUpperCase)) { return executeSelect(database, query, handler); } else { return executeRawQuery(database, query, handler); } } finally { database.close(); } }

Target:
public <T> T executeSQL(String databaseName, String query, ExecuteResultHandler<T> handler) throws SQLiteException { Util.throwIfNull(query); Util.throwIfNull(handler); SQLiteDatabase database = openDatabase(databaseName); try { String firstWordUpperCase = getFirstWord(query).toUpperCase(); switch (firstWordUpperCase) { case "UPDATE": case "DELETE": return executeUpdateDelete(database, query, handler); case "INSERT": return executeInsert(database, query, handler); case "SELECT": case "PRAGMA": case "EXPLAIN": return executeSelect(database, query, handler); default: return executeRawQuery(database, query, handler); } } finally { database.close(); } }
Source:
public void testNoCredentials() { assertNull(this.action.createCredentials(requestContext, null, "helloWorld")); }

Target:
public void testNoCredentials() { this.action.createCredentials(requestContext, null, "helloWorld"); }
Source:
private void checkFieldIndexToWrite() { if (fieldBlockBuilderReturned) { throw new IllegalStateException("field block builder has been returned"); } if (currentFieldIndexToWrite >= numFields) { throw new IllegalStateException("currentFieldIndexToWrite is not valid"); } }

Target:
private void checkFieldIndexToWrite() { if (fieldBlockBuilderReturned) { throw new IllegalStateException("cannot do sequential write after getFieldBlockBuilder is called"); } if (currentFieldIndexToWrite >= numFields) { throw new IllegalStateException("currentFieldIndexToWrite is not valid"); } }
Source:
public void onCreateFilePostExecute(@CreateFileRequestCode int requestCode, File file) { if (file == null) { navigator.showSaveErrorDialog(); return; } switch (requestCode) { case CREATE_FILE_DEFAULT: model.setSavedPictureUri(Uri.fromFile(file)); break; case CREATE_FILE_TAKE_PHOTO: Uri uri = view.getFileProviderUriFromFile(file); Log.d("DEBUGGING", "" + uri); model.setCameraImageUri(uri); navigator.startTakePictureActivity(REQUEST_CODE_TAKE_PICTURE, uri); break; default: throw new IllegalArgumentException(); } }

Target:
public void onCreateFilePostExecute(@CreateFileRequestCode int requestCode, File file) { if (file == null) { navigator.showSaveErrorDialog(); return; } switch (requestCode) { case CREATE_FILE_DEFAULT: model.setSavedPictureUri(view.getUriFromFile(file)); break; case CREATE_FILE_TAKE_PHOTO: Uri uri = view.getFileProviderUriFromFile(file); model.setCameraImageUri(uri); navigator.startTakePictureActivity(REQUEST_CODE_TAKE_PICTURE, uri); break; default: throw new IllegalArgumentException(); } }
Source:
public void setConstructorArguments(Snippet parameters) { this.arguments = Optional.of(parameters); }

Target:
public void setConstructorArguments(Snippet parameters) { arguments = Optional.of(parameters); }
Source:
abstract public List<Double> dumpTimings(String hostname) throws UnknownHostException; abstract void updateLatencyProbeSequence(List<InetAddressAndPort> sequence); @VisibleForTesting protected void reset() { nextProbeGenerationTime = System.nanoTime(); currentProbePosition = 0; latencyProbeSequence.clear(); }

Target:
public List<Double> dumpTimings(String hostname) throws UnknownHostException { List<Double> micros = dumpTimingsMicros(hostname); return micros.stream().map(s -> s / 1000.0).collect(Collectors.toList()); }
Source:
public NettySslHttp2Factory(SSLConfig sslConfig) throws GeneralSecurityException, IOException { nettyServerSslContext = getServerSslContext(sslConfig); nettyClientSslContext = getClientSslContext(sslConfig); jdkSslContext = sslConfig.sslHttp2SelfSign ? null : new JdkSslFactory(sslConfig).getSSLContext(); this.endpointIdentification = sslConfig.sslEndpointIdentificationAlgorithm.isEmpty() ? null : sslConfig.sslEndpointIdentificationAlgorithm; }

Target:
public NettySslHttp2Factory(SSLConfig sslConfig) throws GeneralSecurityException, IOException { nettyServerSslContext = getServerSslContext(sslConfig); nettyClientSslContext = getClientSslContext(sslConfig); this.endpointIdentification = sslConfig.sslEndpointIdentificationAlgorithm.isEmpty() ? null : sslConfig.sslEndpointIdentificationAlgorithm; }
Source:
private boolean consumeNonExecutePrefix() throws IOException { int c = nextNonWhitespace(false); if (c == -1) { return true; } else { pos--; } int p = pos; if (p + 5 > limit && !fillBuffer(5)) { return false; } char[] buf = buffer; if(! (buf[p] != ')' || buf[p + 1] != ']' || buf[p + 2] != '}' || buf[p + 3] != '\'' || buf[p + 4] != '\n')) { pos += 5; } return false; }

Target:
private boolean consumeNonExecutePrefix() throws IOException { int c = nextNonWhitespace(false); if (c == -1) { return true; } else { pos--; } int p = pos; if (p + 5 > limit && !fillBuffer(5)) { return false; } char[] buf = buffer; if (buf[p] == ')' && buf[p + 1] == ']' && buf[p + 2] == '}' && buf[p + 3] == '\'' && buf[p + 4] == '\n') { pos += 5; } return false; }
Source:
private static File createOrReuse(Path portLockFilePath) throws IOException { File file; try { try { file = Files.createFile(portLockFilePath, asFileAttribute(PERMISSIONS)).toFile(); } catch (UnsupportedOperationException e) { file = Files.createFile(portLockFilePath).toFile(); } LOGGER.info("Created port lock file: {}", file.getAbsolutePath()); } catch (FileAlreadyExistsException e) { file = portLockFilePath.toFile(); LOGGER.info("Using existing port lock file: {}", file.getAbsolutePath()); } return file; }

Target:
private static File createOrReuse(Path portLockFilePath) throws IOException { File file; try { try { file = Files.createFile(portLockFilePath, asFileAttribute(PERMISSIONS)).toFile(); } catch (UnsupportedOperationException e) { file = Files.createFile(portLockFilePath).toFile(); } LOGGER.info("Created port lock file: {}", file.getAbsolutePath()); } catch (FileAlreadyExistsException e) { if (!Files.isReadable(portLockFilePath)) { throw new PortLockingException("File is not readable: " + portLockFilePath, e); } if (!Files.isWritable(portLockFilePath)) { throw new PortLockingException("File is not writable: " + portLockFilePath, e); } file = portLockFilePath.toFile(); LOGGER.info("Using existing port lock file: {}", file.getAbsolutePath()); } return file; }
Source:
public JobExecutionResult executeJobBlocking(JobGraph job) throws JobExecutionException, InterruptedException { checkNotNull(job, "job is null"); final CompletableFuture<JobSubmissionResult> submissionFuture = submitJob(job); final CompletableFuture<JobResult> jobResultFuture = submissionFuture.thenCompose( (JobSubmissionResult ignored) -> requestJobResult(job.getJobID())); final JobResult jobResult; try { jobResult = jobResultFuture.get(); } catch (ExecutionException e) { throw new JobExecutionException(job.getJobID(), ApplicationStatus.UNKNOWN, "Could not retrieve JobResult.", ExceptionUtils.stripExecutionException(e)); } try { return jobResult.toJobExecutionResult(Thread.currentThread().getContextClassLoader()); } catch (IOException | ClassNotFoundException e) { throw new JobExecutionException(job.getJobID(), jobResult.getApplicationStatus(), e); } }

Target:
public JobExecutionResult executeJobBlocking(JobGraph job) throws JobExecutionException, InterruptedException { checkNotNull(job, "job is null"); final CompletableFuture<JobSubmissionResult> submissionFuture = submitJob(job); final CompletableFuture<JobResult> jobResultFuture = submissionFuture.thenCompose( (JobSubmissionResult ignored) -> requestJobResult(job.getJobID())); final JobResult jobResult; try { jobResult = jobResultFuture.get(); } catch (ExecutionException e) { throw new JobExecutionException(job.getJobID(), ApplicationStatus.UNKNOWN, "Could not retrieve JobResult.", ExceptionUtils.stripExecutionException(e)); } try { return jobResult.toJobExecutionResult(Thread.currentThread().getContextClassLoader()); } catch (IOException | ClassNotFoundException e) { throw new JobExecutionException(job.getJobID(), jobResult.getApplicationStatus(), "Could not deserialize the serialized accumulator results.", e); } }
Source:
public TestCheckContext(File file, Settings settings, JavaScriptCheck check) { this.file = file; this.complexity = new ComplexityVisitor(); this.settings = settings; try { this.tree = (ScriptTree) p.parse(file); this.symbolModel = SymbolModelImpl.create(tree, null, null); } catch (RecognitionException e) { LOG.error("Unable to parse file: " + file.getAbsolutePath()); LOG.error(e.getMessage()); if ((check.getClass().getSimpleName().equals("ParsingErrorCheck"))) { this.addIssue(null, e.getLine(), e.getMessage()); } } }

Target:
public TestCheckContext(File file, Settings settings, JavaScriptCheck check) { this.file = file; this.complexity = new ComplexityVisitor(); this.settings = settings; try { this.tree = (ScriptTree) p.parse(file); this.symbolModel = SymbolModelImpl.create(tree, null, null); } catch (RecognitionException e) { LOG.error("Unable to parse file: " + file.getAbsolutePath()); LOG.error(e.getMessage()); if ("ParsingErrorCheck".equals(check.getClass().getSimpleName())) { this.addIssue(null, e.getLine(), e.getMessage()); } } }
Source:
private byte[] encrypt(final byte[] plaintext) throws Exception { final byte[] keyBytes = encryptionConfig.encryptionKey.getBytes(); SecretKeySpec keySpec = new SecretKeySpec(keyBytes, encryptionConfig.encryptionAlgorithm); Cipher cipher = Cipher.getInstance(encryptionConfig.encryptionTransformation, encryptionConfig.encryptionProvider); cipher.init(Cipher.ENCRYPT_MODE, keySpec); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write(cipher.getIV()); outputStream.write(cipher.doFinal(plaintext)); return outputStream.toByteArray(); }

Target:
private byte[] encrypt(final byte[] plaintext) throws Exception { Cipher cipher = Cipher.getInstance( encryptionConfig.encryptionTransformation,encryptionConfig.encryptionProvider); cipher.init(Cipher.ENCRYPT_MODE, keySpec); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write(cipher.getIV()); outputStream.write(cipher.doFinal(plaintext)); return outputStream.toByteArray(); }
Source:
public int knapsackRec(int[] w, int[] v, int n, int W) { if (n <= 0) return 0; else if (w[n - 1] > W) return knapsackRec(w, v, n - 1, W); else return Math.max(knapsackRec(w, v, n - 1, W), v[n - 1] + knapsackRec(w, v, n - 1, W - w[n - 1])); }

Target:
public int knapsackRec(int[] w, int[] v, int n, int W) { if (n <= 0) { return 0; } else if (w[n - 1] > W) { return knapsackRec(w, v, n - 1, W); } else { return Math.max(knapsackRec(w, v, n - 1, W), v[n - 1] + knapsackRec(w, v, n - 1, W - w[n - 1])); } }
Source:
private void initCustomPermissionAuthority() { ReadOnlyPermissionAuthority readOnlyPermissionAuthority = new ReadOnlyPermissionAuthority(); IPermissionProvider permissionProvider = new DefaultPermissionProvider(readOnlyPermissionAuthority); StandalonePermissionProviderDescriptor permissionProviderDescriptor = new StandalonePermissionProviderDescriptor("org.eclipse.sirius.tree.tests.forbiddenPermissionAuthorityProvider", ExtenderConstants.HIGHEST_PRIORITY, permissionProvider); PermissionService.addExtension(permissionProviderDescriptor); }

Target:
private void initCustomPermissionAuthority() { IPermissionAuthority permissionAuthority = PermissionService .createDefaultPermissionAuthority(); IPermissionProvider permissionProvider = new DefaultPermissionProvider( permissionAuthority); StandalonePermissionProviderDescriptor permissionProviderDescriptor = new StandalonePermissionProviderDescriptor( "org.eclipse.sirius.tree.tests.forbiddenPermissionAuthorityProvider", ExtenderConstants.HIGHEST_PRIORITY, permissionProvider); PermissionService.addExtension(permissionProviderDescriptor); }
Source:
private void handleDeeplink(Uri uri) { if (uri == null || uri.getPath() == null) { return; } switch (uri.getPath()) { case "/search": String query = uri.getQueryParameter("query"); if (query == null) { return; } this.loadChildFragment(OnlineSearchFragment.newInstance(CombinedSearcher.class, query)); break; case "/main": String feature = uri.getQueryParameter("featureName"); if (feature == null) { return; } feature = feature.toLowerCase(); switch (feature) { case "downloads": loadFragment(DownloadsFragment.TAG, null); break; case "history": loadFragment(PlaybackHistoryFragment.TAG, null); break; case "episodes": loadFragment(EpisodesFragment.TAG, null); break; case "queue": loadFragment(QueueFragment.TAG, null); break; case "subscriptions": loadFragment(SubscriptionFragment.TAG, null); break; default: loadFragment(AddFeedFragment.TAG, null); break; } break; } }

Target:
private void handleDeeplink(Uri uri) { if (uri == null || uri.getPath() == null) { return; } switch (uri.getPath()) { case "/deeplink/search": String query = uri.getQueryParameter("query"); if (query == null) { return; } this.loadChildFragment(OnlineSearchFragment.newInstance(CombinedSearcher.class, query)); break; case "/deeplink/main": String feature = uri.getQueryParameter("featureName"); if (feature == null) { return; } feature = feature.toLowerCase(Locale.getDefault()); switch (feature) { case "downloads": loadFragment(DownloadsFragment.TAG, null); break; case "history": loadFragment(PlaybackHistoryFragment.TAG, null); break; case "episodes": loadFragment(EpisodesFragment.TAG, null); break; case "queue": loadFragment(QueueFragment.TAG, null); break; case "subscriptions": loadFragment(SubscriptionFragment.TAG, null); break; default: loadFragment(AddFeedFragment.TAG, null); break; } break; default: break; } }
Source:
public ExecutionError filter(ExecutionErrorContext errorContext) { Builder errorBuilder = ExecutionError.builder().type("DB"); StringWriter writer = new StringWriter(); PrintWriter p = new PrintWriter(writer); errorContext.getCause().printStackTrace(p); String stacktrace = writer.toString(); Task task = errorContext.getLastExecutedTask(); NodeInstance nodeInstance = errorContext.getLastExecutedNode(); logger.debug("Last executed node instance {}, last executed task {}", nodeInstance, task); if (nodeInstance != null) { logger.debug("Last executed node instance will be used to populate error details", nodeInstance); errorBuilder .deploymentId(((ProcessInstanceImpl)nodeInstance.getProcessInstance()).getDeploymentId()) .processInstanceId(nodeInstance.getProcessInstance().getId()) .processId(nodeInstance.getProcessInstance().getProcessId()) .activityId(nodeInstance.getId()) .activityName(nodeName(nodeInstance)); } else if (task != null) { logger.debug("Last executed task will be used to populate error details", task); errorBuilder .deploymentId(task.getTaskData().getDeploymentId()) .processInstanceId(task.getTaskData().getProcessInstanceId()) .processId(task.getTaskData().getProcessId()) .activityId(task.getId()) .activityName(task.getName()); } return errorBuilder .message(errorContext.getCause().getMessage()) .error(stacktrace) .errorDate(new Date()) .build(); }

Target:
public ExecutionError filter(ExecutionErrorContext errorContext) { Builder errorBuilder = ExecutionError.builder().type("DB"); String stacktrace = getStackTrace(errorContext.getCause()); Task task = errorContext.getLastExecutedTask(); NodeInstance nodeInstance = errorContext.getLastExecutedNode(); logger.debug("Last executed node instance {}, last executed task {}", nodeInstance, task); if (nodeInstance != null) { logger.debug("Last executed node instance will be used to populate error details", nodeInstance); errorBuilder .deploymentId(((ProcessInstanceImpl)nodeInstance.getProcessInstance()).getDeploymentId()) .processInstanceId(nodeInstance.getProcessInstance().getId()) .processId(nodeInstance.getProcessInstance().getProcessId()) .activityId(nodeInstance.getId()) .activityName(nodeName(nodeInstance)); } else if (task != null) { logger.debug("Last executed task will be used to populate error details", task); errorBuilder .deploymentId(task.getTaskData().getDeploymentId()) .processInstanceId(task.getTaskData().getProcessInstanceId()) .processId(task.getTaskData().getProcessId()) .activityId(task.getId()) .activityName(task.getName()); } return errorBuilder .message(errorContext.getCause().getMessage()) .error(stacktrace) .errorDate(new Date()) .build(); }
Source:
public void onEvent(Event event, Object source, Object data) { try { List<UntypedRecordableEventDescriptor> descriptors = componentManager.getInstanceList(UntypedRecordableEventDescriptor.class); for (UntypedRecordableEventDescriptor descriptor : descriptors) { if (descriptor.getEventTriggers().contains(event.getClass().getCanonicalName()) && checkXObjectCondition(descriptor, source) && this.evaluateVelocityTemplate( event, descriptor.getAuthorReference(), descriptor.getValidationExpression())) { observationManager.notify( new DefaultUntypedRecordableEvent(descriptor.getEventType()), "org.xwiki.platform:xwiki-platform-eventstream-api", source); } } } catch (ComponentLookupException e) { logger.warn( String.format("Unable to retrieve UntypedRecordableEventDescriptor from the ComponentManager. " + "Error : %s", e.getMessage())); } }

Target:
public void onEvent(Event event, Object source, Object data) { try { List<UntypedRecordableEventDescriptor> descriptors = componentManager.getInstanceList(UntypedRecordableEventDescriptor.class); for (UntypedRecordableEventDescriptor descriptor : descriptors) { if (descriptor.getEventTriggers().contains(event.getClass().getCanonicalName()) && checkXObjectCondition(descriptor, source) && this.evaluateVelocityTemplate( event, descriptor.getAuthorReference(), descriptor.getValidationExpression())) { observationManager.notify( new DefaultUntypedRecordableEvent(descriptor.getEventType()), "org.xwiki.platform:xwiki-platform-eventstream-api", source); } } } catch (ComponentLookupException e) { logger.error("Unable to retrieve a list of registered UntypedRecordableEventDescriptor " + "from the ComponentManager.", e); } }
Source:
public void testCrossJoinPreserveSortOrderNoJoinStrategyHint() throws Exception { String sqlText = format("select tt2.a from \n" + "tab2 tt2 --splice-properties useSpark=%s\n" + "inner join %s ttb\n" + "on ttb.c2 < 5 and tt2.a < 4 order by tt2.a", useSpark, bigTable); if (useSpark) { ResultSet rs = classWatcher.executeQuery("explain " + sqlText); String matchString = TestUtils.FormattedResult.ResultFactory.toStringUnsorted(rs); assertTrue("Cross join is not selected for OLAP", matchString.contains("CrossJoin")); } String expected = "A |\n" + "----\n" + " 1 |\n" + " 1 |\n" + " 1 |\n" + " 1 |\n" + " 2 |\n" + " 2 |\n" + " 2 |\n" + " 2 |\n" + " 3 |\n" + " 3 |\n" + " 3 |\n" + " 3 |"; ResultSet rs = classWatcher.executeQuery(sqlText); String resultString = TestUtils.FormattedResult.ResultFactory.toStringUnsorted(rs); assertEquals("\n" + sqlText + "\n" + "expected result: " + expected + "\n,actual result: " + resultString, expected, resultString); rs.close(); }

Target:
public void testCrossJoinPreserveSortOrderNoJoinStrategyHint() throws Exception { String sqlText = format("select tt2.a from \n" + "tab2 tt2 --splice-properties useSpark=%s\n" + "inner join %s ttb\n" + "on ttb.c2 < 5 and tt2.a < 4 order by tt2.a", useSpark, bigTable); if (useSpark) { try (ResultSet rs = classWatcher.executeQuery("explain " + sqlText)) { String matchString = TestUtils.FormattedResult.ResultFactory.toStringUnsorted(rs); assertTrue("Cross join is not selected for OLAP", matchString.contains("CrossJoin")); } } String expected = "A |\n" + "----\n" + " 1 |\n" + " 1 |\n" + " 1 |\n" + " 1 |\n" + " 2 |\n" + " 2 |\n" + " 2 |\n" + " 2 |\n" + " 3 |\n" + " 3 |\n" + " 3 |\n" + " 3 |"; try (ResultSet rs = classWatcher.executeQuery(sqlText)) { String resultString = TestUtils.FormattedResult.ResultFactory.toStringUnsorted(rs); assertEquals("\n" + sqlText + "\n" + "expected result: " + expected + "\n,actual result: " + resultString, expected, resultString); } }
Source:
public String toString() { return "Bing tile [" + x + ", " + y + "] at level " + zoomLevel; }

Target:
public String toString() { return toStringHelper(this) .add("x", x) .add("y", y) .add("zoom_level", zoomLevel) .toString(); }
Source:
protected VdcReturnValueBase checkAndPerformRollbackUsingCommand(VdcActionType commandType, VdcActionParametersBase params, CommandContext context) { VdcReturnValueBase result = new VdcReturnValueBase(); if (canPerformRollbackUsingCommand(commandType, params)) { result = runInternalCommandOnRollback(commandType, params, context); } else { result.setSucceeded(false); } return result; }

Target:
protected VdcReturnValueBase checkAndPerformRollbackUsingCommand(VdcActionType commandType, VdcActionParametersBase params, CommandContext context) { VdcReturnValueBase result = null; if (canPerformRollbackUsingCommand(commandType, params)) { result = runInternalCommandOnRollback(commandType, params, context); } else { result = new VdcReturnValueBase(); result.setSucceeded(false); } return result; }
Source:
public void test_abidw() throws Exception { String[] cmd = new String[] { mKernelImageCheckTool.getAbsolutePath() + "/abidw", "--linux-tree", mKernelImageFile.getParent(), "--out-file", "abi-new.out" }; CommandResult result = RunUtil.getDefault().runTimedCmd(1000000, cmd); CLog.i("Result stdout: %s", result.getStdout()); CLog.e("Result stderr: %s", result.getStderr()); assertEquals(result.getStatus(), CommandStatus.SUCCESS); }

Target:
public void test_abidw() throws Exception { String[] cmd = new String[] { mKernelImageCheckTool.getAbsolutePath() + "/abidw", "--linux-tree", mKernelImageFile.getParent(), "--out-file", "abi-new.out" }; CommandResult result = RunUtil.getDefault().runTimedCmd(CMD_TIMEOUT, cmd); CLog.i("Result stdout: %s", result.getStdout()); if (result.getExitCode() != 0) { CLog.e("Result stderr: %s", result.getStderr()); } assertEquals(CommandStatus.SUCCESS, result.getStatus()); cmd = new String[] { mKernelImageCheckTool.getAbsolutePath() + "/abidiff", "abi-new.out", mKernelAbiFile.getAbsolutePath() }; result = RunUtil.getDefault().runTimedCmd(CMD_TIMEOUT, cmd); CLog.i("Result stdout: %s", result.getStdout()); if (result.getExitCode() != 0) { CLog.e("Result stderr: %s", result.getStderr()); } assertEquals(CommandStatus.SUCCESS, result.getStatus()); }