auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void usage(final PrintStream stream, final boolean printCommon) { if (prefix.isEmpty()) { final String prefix = htmlUnescape(convertFromHtml(getStandardUsagePreamble(callerOptions.getClass()) + getUsagePreamble())); checkForNonASCII(prefix, "prefix"); stream.print(prefix); stream.println("\nVersion: " + getVersion()); stream.println("\n\nOptions:\n"); for (final String[] optionDoc : FRAMEWORK_OPTION_DOC) { printOptionParamUsage(stream, optionDoc[0], optionDoc[1], null, optionDoc[2]); } } if (!optionDefinitions.isEmpty()) { optionDefinitions.stream().filter(optionDefinition -> printCommon || !optionDefinition.isCommon).forEach(optionDefinition -> printOptionUsage(stream, optionDefinition)); } if (printCommon) { final Field fileField; try { fileField = getClass().getField("IGNORE_THIS_PROPERTY"); } catch (final NoSuchFieldException e) { throw new PicardException("Should never happen", e); } final OptionDefinition optionsFileOptionDefinition = new OptionDefinition(fileField, OPTIONS_FILE, "", "File of OPTION_NAME=value pairs. No positional parameters allowed. Unlike command-line options, " + "unrecognized options are ignored. " + "A single-valued option set in an options file may be overridden " + "by a subsequent command-line option. " + "A line starting with '#' is considered a comment.", false, true, false, 0, Integer.MAX_VALUE, null, true, new String[0], Integer.MAX_VALUE); printOptionUsage(stream, optionsFileOptionDefinition); } getChildParsersForHelp() .stream() .forEach(childClp -> childClp.usage(stream, printCommon)); }

Target:
public void usage(final PrintStream stream, final boolean printCommon) { if (prefix.isEmpty()) { final String preamble = htmlUnescape(convertFromHtml(getStandardUsagePreamble(callerOptions.getClass()) + getUsagePreamble())); checkForNonASCII(preamble, "Tool description"); stream.print(preamble); stream.println("\nVersion: " + getVersion()); stream.println("\n\nOptions:\n"); for (final String[] optionDoc : FRAMEWORK_OPTION_DOC) { printOptionParamUsage(stream, optionDoc[0], optionDoc[1], null, optionDoc[2]); } } if (!optionDefinitions.isEmpty()) { optionDefinitions.stream().filter(optionDefinition -> printCommon || !optionDefinition.isCommon).forEach(optionDefinition -> printOptionUsage(stream, optionDefinition)); } if (printCommon) { final Field fileField; try { fileField = getClass().getField("IGNORE_THIS_PROPERTY"); } catch (final NoSuchFieldException e) { throw new PicardException("Should never happen", e); } final OptionDefinition optionsFileOptionDefinition = new OptionDefinition(fileField, OPTIONS_FILE, "", "File of OPTION_NAME=value pairs. No positional parameters allowed. Unlike command-line options, " + "unrecognized options are ignored. " + "A single-valued option set in an options file may be overridden " + "by a subsequent command-line option. " + "A line starting with '#' is considered a comment.", false, true, false, 0, Integer.MAX_VALUE, null, true, new String[0], Integer.MAX_VALUE); printOptionUsage(stream, optionsFileOptionDefinition); } getChildParsersForHelp() .stream() .forEach(childClp -> childClp.usage(stream, printCommon)); }
Source:
public void read() throws IOException { final MkItem item = this.emptyMkItemWithMemo(); final DyMemo memo = new DyMemo(item); final XML xml = memo.read(); MatcherAssert.assertThat( xml.node().getFirstChild().getLocalName(), Matchers.equalTo("memo") ); }

Target:
public void read() throws IOException { final DyMemo memo = new DyMemo(this.emptyMkItemWithMemo()); final XML xml = memo.read(); MatcherAssert.assertThat( xml.node().getFirstChild().getLocalName(), Matchers.equalTo("memo") ); }
Source:
protected InputStream readStream( ResultSet rs ) throws BinaryStoreException { boolean error = false; try { if (!rs.next()) { return null; } return databaseType == Type.SQLSERVER ? rs.getBlob(1).getBinaryStream() : rs.getBinaryStream(1); } catch (SQLException e) { error = true; throw new BinaryStoreException(e); } catch (RuntimeException e) { error = true; throw e; } finally { try { rs.close(); } catch (SQLException e) { if (!error) throw new BinaryStoreException(e); } } }

Target:
protected InputStream readStream( ResultSet rs ) throws BinaryStoreException { boolean error = false; try { if (!rs.next()) { return null; } switch (databaseType) { case SQLSERVER: { return rs.getBlob(1).getBinaryStream(); } default: { return rs.getBinaryStream(1); } } } catch (SQLException e) { error = true; throw new BinaryStoreException(e); } catch (RuntimeException e) { error = true; throw e; } finally { try { rs.close(); } catch (SQLException e) { if (!error) throw new BinaryStoreException(e); } } }
Source:
public static void main(String[] args) throws Exception { URL url = new URL("<LINK_1>"); EventLoopGroup group = new NioEventLoopGroup(); try { final SslContext sslContext = SslContextBuilder.forClient() .protocols("TLSv1.2", "TLSv1.3") .applicationProtocolConfig(new ApplicationProtocolConfig( ApplicationProtocolConfig.Protocol.ALPN, ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE, ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT, ApplicationProtocolNames.HTTP_2, ApplicationProtocolNames.HTTP_1_1)) .build(); Bootstrap b = new Bootstrap(); b.group(group) .channel(NioSocketChannel.class) .handler(new Initializer(sslContext, url)); final Channel ch = b.connect(url.getHost(), url.getDefaultPort()).sync().channel(); Thread.sleep(1000); int randomID = new Random().nextInt(60000 - 1000) + 1000; DnsQuery query = new DefaultDnsQuery(randomID, DnsOpCode.QUERY); query.setRecord(DnsSection.QUESTION, new DefaultDnsQuestion(QUERY_DOMAIN, DnsRecordType.A)); ch.writeAndFlush(query).sync(); ch.closeFuture().await(10, TimeUnit.SECONDS); } finally { group.shutdownGracefully(); } }

Target:
public static void main(String[] args) throws Exception { URL url = new URL("<LINK_1>"); EventLoopGroup group = new NioEventLoopGroup(); try { final SslContext sslContext = SslContextBuilder.forClient() .applicationProtocolConfig(new ApplicationProtocolConfig( ApplicationProtocolConfig.Protocol.ALPN, ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE, ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT, ApplicationProtocolNames.HTTP_2, ApplicationProtocolNames.HTTP_1_1)) .build(); Bootstrap b = new Bootstrap(); b.group(group) .channel(NioSocketChannel.class) .handler(new Initializer(sslContext, url)); Channel ch = b.connect(url.getHost(), url.getDefaultPort()).sync().channel(); ch.pipeline().get(ALPNHandler.class).promise().sync(); DnsQuery query = new DefaultDnsQuery(0, DnsOpCode.QUERY); query.setRecord(DnsSection.QUESTION, new DefaultDnsQuestion(QUERY_DOMAIN, DnsRecordType.A)); ch.writeAndFlush(query).sync(); ch.closeFuture().await(10, TimeUnit.SECONDS); } finally { group.shutdownGracefully(); } }
Source:
private void checkOutputWritingStatus() { try { outputCapturer.join(timeoutInSeconds * CONVERT_SECONDS_TO_MILLISECONDS); } catch (InterruptedException e) { throw new ItemStreamException("Interrupted while waiting for the VEP output writer thread to finish. ", e); } if (outputCapturer.isAlive()) { outputCapturer.interrupt(); throw new ItemStreamException("Reached the timeout (" + timeoutInSeconds + " seconds) while waiting for VEP output writing to finish. Killed the thread."); } if (!writingOk.get()) { throw new ItemStreamException("VEP output writer thread could not finish properly. "); } }

Target:
private void checkOutputWritingStatus() { try { outputCaptureThread.join(timeoutInSeconds * 1000L); } catch (InterruptedException e) { throw new ItemStreamException("Interrupted while waiting for the VEP output writer thread to finish. ", e); } if (outputCaptureThread.isAlive()) { outputCaptureThread.interrupt(); throw new ItemStreamException("Reached the timeout (" + timeoutInSeconds + " seconds) while waiting for VEP output writing to finish. The thread has been killed."); } if (!writingOk.get()) { throw new ItemStreamException("VEP output writer thread could not finish properly. "); } }
Source:
public void initialize() { log.info("Start initializing " + getClass().getSimpleName()); if(Config.<Boolean>getValue(ConfigValues.PMHealthCheckEnabled)) { Integer pmHealthCheckInterval = Config.<Integer> getValue(ConfigValues.PMHealthCheckIntervalInSec); SchedulerUtilQuartzImpl.getInstance().scheduleAFixedDelayJob(this, "pmHealthCheck", new Class[]{}, new Object[]{}, pmHealthCheckInterval, pmHealthCheckInterval, TimeUnit.SECONDS); } log.info("Finished initializing " + getClass().getSimpleName()); }

Target:
public void initialize() { if(Config.<Boolean>getValue(ConfigValues.PMHealthCheckEnabled)) { log.info("Start initializing " + getClass().getSimpleName()); Integer pmHealthCheckInterval = Config.<Integer> getValue(ConfigValues.PMHealthCheckIntervalInSec); SchedulerUtilQuartzImpl.getInstance().scheduleAFixedDelayJob(this, "pmHealthCheck", new Class[]{}, new Object[]{}, pmHealthCheckInterval, pmHealthCheckInterval, TimeUnit.SECONDS); log.info("Finished initializing " + getClass().getSimpleName()); } }
Source:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode patchingInfo = new ModelNode(); PathAddress patchingAddress = PathAddress.pathAddress( PathElement.pathElement(HOST, environment.getHostControllerName()), PathElement.pathElement(CORE_SERVICE, "patching")); OperationEntry opEntry = context.getRootResourceRegistration().getOperationEntry(patchingAddress, "show-history"); if(opEntry != null) { context.addStep(patchingInfo, Util.createOperation("patch-info", patchingAddress), opEntry.getOperationHandler(), OperationContext.Stage.RUNTIME); } final Path installationDir = environment.getHomeDir().toPath(); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { System.out.println("Here is what we have as infos " + patchingInfo); ModelNode result = context.getResult(); result.get(SUMMARY_DEFINITION.getName()).set(createProductNode(context, environment, patchingInfo, installationDir)); } }, OperationContext.Stage.RUNTIME); }

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode patchingInfo = new ModelNode(); PathAddress patchingAddress = PathAddress.pathAddress( PathElement.pathElement(HOST, environment.getHostControllerName()), PathElement.pathElement(CORE_SERVICE, "patching")); OperationEntry opEntry = context.getRootResourceRegistration().getOperationEntry(patchingAddress, "show-history"); if(opEntry != null) { context.addStep(patchingInfo, Util.createOperation("show-history", patchingAddress), opEntry.getOperationHandler(), OperationContext.Stage.RUNTIME); } final Path installationDir = environment.getHomeDir().toPath(); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ModelNode result = context.getResult(); result.get(SUMMARY_DEFINITION.getName()).set(createProductNode(context, new InstallationConfiguration( environment, environment.getProductConfig(), patchingInfo, installationDir))); } }, OperationContext.Stage.RUNTIME); }
Source:
IStatus resolve(IProgressMonitor monitor) throws CoreException { assert fIndex == null; if (fIndex != null) return Status.CANCEL_STATUS; fIndex = CCorePlugin.getIndexManager() .getIndex(fTranslationUnit.getCProject(), IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT | IIndexManager.ADD_EXTENSION_FRAGMENTS_NAVIGATION); try { fIndex.acquireReadLock(); } catch (InterruptedException e) { return Status.CANCEL_STATUS; } try { return ASTProvider.getASTProvider().runOnAST(fTranslationUnit, ASTProvider.WAIT_ACTIVE_ONLY, monitor, this); } finally { fIndex.releaseReadLock(); } }

Target:
IStatus resolve(IProgressMonitor monitor) throws CoreException { assert fIndex == null; if (fIndex != null) return Status.CANCEL_STATUS; fIndex = CCorePlugin.getIndexManager() .getIndex(fTranslationUnit.getCProject(), IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_DEPENDENT | IIndexManager.ADD_EXTENSION_FRAGMENTS_NAVIGATION); try { fIndex.acquireReadLock(); } catch (InterruptedException e) { return Status.CANCEL_STATUS; } try { return ASTProvider.getASTProvider().runOnAST(fTranslationUnit, ASTProvider.WAIT_NO, monitor, this); } finally { fIndex.releaseReadLock(); } }
Source:
public void login() { final LobbyServerProperties lobbyServerProperties = LobbyPropertyFetcherConfiguration.lobbyServerPropertiesFetcher() .fetchLobbyServerProperties() .orElseThrow(LobbyAddressFetchException::new); final LobbyLogin login = new LobbyLogin(ui, lobbyServerProperties); Optional.ofNullable(login.login()) .ifPresent( lobbyClient -> { final LobbyFrame lobbyFrame = new LobbyFrame(lobbyClient, lobbyServerProperties); GameRunner.hideMainFrame(); lobbyFrame.setVisible(true); boolean passwordChanged = false; if (lobbyClient.isPasswordChangeRequired()) { try { passwordChanged = ChangePasswordPanel.doPasswordChange( lobbyFrame, lobbyClient.getHttpLobbyClient(), ChangePasswordPanel.AllowCancelMode.DO_NOT_SHOW_CANCEL_BUTTON); if (passwordChanged) { DialogBuilder.builder() .parent(lobbyFrame) .title("Success") .infoMessage("Password successfully updated!") .showDialog(); } else { notifyTempPasswordInvalid(lobbyFrame, null); } } catch (final HttpInteractionException e) { notifyTempPasswordInvalid(lobbyFrame, e); } } }); }

Target:
public void login() { final LobbyServerProperties lobbyServerProperties = LobbyPropertyFetcherConfiguration.lobbyServerPropertiesFetcher() .fetchLobbyServerProperties() .orElseThrow(LobbyAddressFetchException::new); final LobbyLogin login = new LobbyLogin(ui, lobbyServerProperties); Optional.ofNullable(login.login()) .ifPresent( lobbyClient -> { final LobbyFrame lobbyFrame = new LobbyFrame(lobbyClient, lobbyServerProperties); GameRunner.hideMainFrame(); lobbyFrame.setVisible(true); if (lobbyClient.isPasswordChangeRequired()) { try { final boolean passwordChanged = ChangePasswordPanel.doPasswordChange( lobbyFrame, lobbyClient.getHttpLobbyClient(), ChangePasswordPanel.AllowCancelMode.DO_NOT_SHOW_CANCEL_BUTTON); if (passwordChanged) { DialogBuilder.builder() .parent(lobbyFrame) .title("Success") .infoMessage("Password successfully updated!") .showDialog(); } else { notifyTempPasswordInvalid(lobbyFrame, null); } } catch (final HttpInteractionException e) { notifyTempPasswordInvalid(lobbyFrame, e); } } }); }
Source:
protected MessageHandler createHandler(Object bean, Method method, List<Annotation> annotations) { org.springframework.integration.transformer.Transformer transformer; if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) { Object target = this.resolveTargetBeanFromMethodWithBeanAnnotation(method); transformer = this.extractTypeIfPossible(target, org.springframework.integration.transformer.Transformer.class); if (transformer == null) { if (target instanceof AbstractReplyProducingMessageHandler) { return (MessageHandler) target; } transformer = new MethodInvokingTransformer(target); } } else { transformer = new MethodInvokingTransformer(bean, method); } MessageTransformingHandler handler = new MessageTransformingHandler(transformer); this.setOutputChannelIfPresent(annotations, handler); return handler; }

Target:
protected MessageHandler createHandler(Object bean, Method method, List<Annotation> annotations) { org.springframework.integration.transformer.Transformer transformer; if (AnnotatedElementUtils.isAnnotated(method, Bean.class.getName())) { Object target = this.resolveTargetBeanFromMethodWithBeanAnnotation(method); transformer = this.extractTypeIfPossible(target, org.springframework.integration.transformer.Transformer.class); if (transformer == null) { if (this.extractTypeIfPossible(target, AbstractReplyProducingMessageHandler.class) != null) { return (MessageHandler) target; } transformer = new MethodInvokingTransformer(target); } } else { transformer = new MethodInvokingTransformer(bean, method); } MessageTransformingHandler handler = new MessageTransformingHandler(transformer); this.setOutputChannelIfPresent(annotations, handler); return handler; }
Source:
public void update() { deltaProgress.tick(); if (worldObj.isRemote) { return; } if (scanning && isValid) { int target = shouldScanDetails ? 30 : 10; int back = 3; if (progress == 0) { deltaProgress.addDelta(0, target, 100); deltaProgress.addDelta(target, target + back, -100); } if (progress < target + back) { progress++; return; } progress = 0; scanSingleBlock(); if (!scanning) { if (shouldScanEntities) { scanEntities(); } finishScanning(); } } else if (progress != -1) { progress = -1; deltaProgress.setValue(0); } }

Target:
public void update() { deltaProgress.tick(); if (worldObj.isRemote) { return; } if (scanning && isValid) { int target = shouldScanDetails ? 2 : 1; int back = shouldScanDetails ? 1 : 0; if (progress == 0) { deltaProgress.addDelta(0, target, 100); deltaProgress.addDelta(target, target + back, -100); } if (progress < target + back) { progress++; return; } progress = 0; scanSingleBlock(); if (!scanning) { if (shouldScanEntities) { scanEntities(); } finishScanning(); } } else if (progress != -1) { progress = -1; deltaProgress.setValue(0); } }
Source:
protected static boolean checkNumeric(String contents) { return NUMERIC.matcher(contents).matches(); }

Target:
protected static final void checkNumeric(String contents) throws IllegalArgumentException { if (!NUMERIC.matcher(contents).matches()) { throw new IllegalArgumentException("Input should only contain digits 0-9"); } }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (AuthUI.canHandleIntent(getIntent())) { Intent intent = new Intent(ChooserActivity.this, AuthUiActivity .class); intent.putExtra(ExtraConstants.EMAIL_LINK_SIGN_IN, getIntent().getData().toString()); startActivity(intent); } setContentView(R.layout.activity_chooser); ButterKnife.bind(this); mActivities.setLayoutManager(new LinearLayoutManager(this)); mActivities.setAdapter(new ActivityChooserAdapter()); mActivities.setHasFixedSize(true); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (AuthUI.canHandleIntent(getIntent())) { Intent intent = new Intent(ChooserActivity.this, AuthUiActivity .class); intent.putExtra(ExtraConstants.EMAIL_LINK_SIGN_IN, getIntent().getData().toString()); startActivity(intent); finish(); return; } setContentView(R.layout.activity_chooser); ButterKnife.bind(this); mActivities.setLayoutManager(new LinearLayoutManager(this)); mActivities.setAdapter(new ActivityChooserAdapter()); mActivities.setHasFixedSize(true); }
Source:
protected void verifyAccessibleForInstructorsOfTheSameCourse(String[] submissionParams) { ______TS("course instructor can access"); InstructorAttributes instructor1OfCourse1 = data.instructors.get("instructor1OfCourse1"); StudentAttributes student1InCourse1 = data.students.get("student1InCourse1"); InstructorAttributes otherInstructor = data.instructors.get("instructor1OfCourse2"); gaeSimulation.loginAsInstructor(instructor1OfCourse1.googleId); verifyCanAccess(addUserIdToParams(instructor1OfCourse1.googleId, submissionParams)); verifyCannotMasquerade(addUserIdToParams(student1InCourse1.googleId, submissionParams)); verifyCannotMasquerade(addUserIdToParams(otherInstructor.googleId, submissionParams)); }

Target:
protected void verifyAccessibleForInstructorsOfTheSameCourse(String[] submissionParams) { ______TS("course instructor can access"); InstructorAttributes instructor1OfCourse1 = data.instructors.get("instructor1OfCourse1"); StudentAttributes student1InCourse1 = data.students.get("student1InCourse1"); InstructorAttributes otherInstructor = data.instructors.get("instructor1OfCourse2"); gaeSimulation.loginAsInstructor(instructor1OfCourse1.googleId); verifyCanAccess(submissionParams); verifyCannotMasquerade(addUserIdToParams(student1InCourse1.googleId, submissionParams)); verifyCannotMasquerade(addUserIdToParams(otherInstructor.googleId, submissionParams)); }
Source:
private String buildProcedureQuery( String procedureName, List<Object> parameters ) { StringBuilder sb = new StringBuilder(); sb.append( "CALL " ).append( procedureName ).append( "(" ); boolean first = true; for ( Object parameter : parameters ) { if ( !first ) { sb.append( "," ); } sb.append( parameter ); first = false; } sb.append( ")" ); return sb.toString(); }

Target:
private String buildProcedureQuery( String procedureName, List<Object> parameters ) { StringJoiner stringJoiner = new StringJoiner( ",", "CALL " + procedureName + "(", ")" ); for ( Object parameter : parameters ) { stringJoiner.add( parameter.toString() ); } return stringJoiner.toString(); }
Source:
@VisibleForTesting Call<MwQueryResponse<QueryResult>> request(@NonNull Service service, @NonNull final String userName, @NonNull final Callback cb) { cancel(); groupCall = service.request(userName); groupCall.enqueue(new retrofit2.Callback<MwQueryResponse<QueryResult>>() { @Override public void onResponse(Call<MwQueryResponse<QueryResult>> call, Response<MwQueryResponse<QueryResult>> response) { if (response.isSuccessful()) { final MwQueryResponse<QueryResult> body = response.body(); final QueryResult query = body.query(); if (response.body().success()) { cb.success(call, query.id(), query.getGroupsFor(userName)); } else if (response.body().hasError()) { cb.failure(call, new LoginClient.LoginFailedException( "Failed to retrieve group membership data. " + body.getError().toString())); } else { cb.failure(call, new LoginClient.LoginFailedException( "Unexpected error trying to retrieve group membership data. " + body.toString())); } } else { cb.failure(call, new LoginClient.LoginFailedException(response.message())); } } @Override public void onFailure(Call<MwQueryResponse<QueryResult>> call, Throwable caught) { cb.failure(call, caught); } }); return groupCall; }

Target:
@VisibleForTesting Call<MwQueryResponse<QueryResult>> request(@NonNull Service service, @NonNull final String userName, @NonNull final Callback cb) { cancel(); groupCall = service.request(userName); groupCall.enqueue(new retrofit2.Callback<MwQueryResponse<QueryResult>>() { @Override public void onResponse(Call<MwQueryResponse<QueryResult>> call, Response<MwQueryResponse<QueryResult>> response) { if (response.isSuccessful()) { final MwQueryResponse<QueryResult> body = response.body(); final QueryResult query = body.query(); if (response.body().success()) { cb.success(call, query.id(), query.getGroupsFor(userName)); } else if (response.body().hasError()) { cb.failure(call, new LoginClient.LoginFailedException( "Failed to retrieve user ID and group membership data. " + body.getError().toString())); } else { cb.failure(call, new LoginClient.LoginFailedException( "Unexpected error trying to retrieve user ID and group membership data. " + body.toString())); } } else { cb.failure(call, new LoginClient.LoginFailedException(response.message())); } } @Override public void onFailure(Call<MwQueryResponse<QueryResult>> call, Throwable caught) { cb.failure(call, caught); } }); return groupCall; }
Source:
public ElideResponse post(String baseUrlEndPoint, String path, String jsonApiDocument, MultivaluedMap<String, String> queryParams, User opaqueUser, String apiVersion, UUID requestId) { return post(baseUrlEndPoint, path, jsonApiDocument, queryParams, null, opaqueUser, apiVersion, requestId); }

Target:
public ElideResponse post(String baseUrlEndPoint, String path, String jsonApiDocument, MultivaluedMap<String, String> queryParams, User opaqueUser, String apiVersion, UUID requestId) { return post(baseUrlEndPoint, path, jsonApiDocument, queryParams, Collections.emptyMap(), opaqueUser, apiVersion, requestId); }
Source:
protected void failed(Throwable t) { log.error(errorMessage, t); taskHandler.handleErrorMessage(format("%s: %s", errorMessage, t.getMessage())); }

Target:
protected void failed(Throwable t) { log.error(errorMessage, t); taskHandler.handleErrorMessage(errorMessage); }
Source:
protected void awaitConsistency() { if (view.getConsistencyModel() == ConsistencyModel.EVENTUAL) { Uninterruptibles.sleepUninterruptibly(20, TimeUnit.SECONDS); } }

Target:
protected void awaitConsistency() { if (view.getConsistencyModel() == ConsistencyModel.EVENTUAL) { Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS); } }
Source:
protected void validateImpl(@Nonnull DexType type) { Set<String> notProcessedFields = new HashSet<String>(validators.keySet()); for (DexField field : type.getFields()) { String name = field.getId(); DexValidator<DexField> validator = validators.get(name); if (validator != null) { notProcessedFields.remove(name); validator.validate(field); } } for (String field : notProcessedFields) { Assert.fail("Not processed field: " + field); } }

Target:
protected void validateImpl(@Nonnull DexType type) { TreeSet<String> notProcessedFields = new TreeSet<String>(validators.keySet()); for (DexField field : type.getFields()) { String name = field.getId(); DexValidator<DexField> validator = validators.get(name); if (validator != null) { notProcessedFields.remove(name); validator.validate(field); } } for (String field : notProcessedFields) { Assert.fail("Not processed field: " + field); } }
Source:
protected List<ResourceGroupSpec> getRootGroups() { if (lastRefresh.get() == 0) { throw new PrestoException(CONFIGURATION_UNAVAILABLE, "Root groups cannot be fetched from database"); } if (System.nanoTime() - lastRefresh.get() > maxRefreshInterval.toMillis() * 1_000_000) { throw new PrestoException( CONFIGURATION_UNAVAILABLE, format("Selectors cannot be fetched from database. Current selectors are loaded %s ago", succinctNanos(System.nanoTime() - lastRefresh.get()).toString())); } if (this.selectors.get().isEmpty()) { throw new PrestoException(CONFIGURATION_INVALID, "No root groups are configured"); } return rootGroups.get(); }

Target:
protected List<ResourceGroupSpec> getRootGroups() { checkMaxRefreshInterval(); if (this.selectors.get().isEmpty()) { throw new PrestoException(CONFIGURATION_INVALID, "No root groups are configured"); } return rootGroups.get(); }
Source:
public Response removeAttachment(@PathParam("ID") String applicationId, @QueryParam("attachment") String attachment, @HeaderParam("Referer") String referer) { try { if (!isApplicationCall(referer)) { return Response.status(Status.FORBIDDEN).build(); } java.nio.file.Path path = Paths.get(getSettingValue("application.storagePath"), applicationId, attachment); File file = path.toFile(); if (file.exists()) { if (file.delete()) { logger.log(Level.INFO, String.format("Removed application attachment %s", file.getAbsolutePath())); return Response.noContent().build(); } } } catch (Exception e) { logger.log(Level.SEVERE, String.format("Exception serving application attachment %s", attachment), e); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } return Response.status(Status.NOT_FOUND).build(); }

Target:
public Response removeAttachment(@PathParam("ID") String applicationId, @QueryParam("attachment") String attachment, @HeaderParam("Referer") String referer) { if (!isApplicationCall(referer)) { return Response.status(Status.FORBIDDEN).build(); } String attachmentsFolder = getSettingValue("application.storagePath"); if (StringUtils.isEmpty(attachmentsFolder)) { logger.log(Level.SEVERE, "application.storagePath not set"); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } applicationId = sanitizeFilename(applicationId); attachment = sanitizeFilename(attachment); if (StringUtils.isEmpty(applicationId) || StringUtils.isEmpty(attachment)) { return Response.status(Status.BAD_REQUEST).build(); } try { java.nio.file.Path path = Paths.get(attachmentsFolder, applicationId, attachment); File file = path.toFile(); if (file.exists() && file.delete()) { logger.log(Level.INFO, String.format("Removed application attachment %s", file.getAbsolutePath())); return Response.noContent().build(); } } catch (Exception e) { logger.log(Level.SEVERE, String.format("Exception serving application attachment %s", attachment), e); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } return Response.status(Status.NOT_FOUND).build(); }
Source:
protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(STATE_KEY_NUM_ATTACHMENTS_LOADING, mNumAttachmentsLoading); outState.putString(STATE_KEY_WAITING_FOR_ATTACHMENTS, mWaitingForAttachments.name()); outState.putParcelableArrayList(STATE_KEY_ATTACHMENTS, createAttachmentList()); outState.putSerializable(STATE_KEY_QUOTED_TEXT_MODE, mQuotedTextMode); outState.putBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, mSourceMessageProcessed); outState.putLong(STATE_KEY_DRAFT_ID, mDraftId); outState.putSerializable(STATE_IDENTITY, mIdentity); outState.putBoolean(STATE_IDENTITY_CHANGED, mIdentityChanged); outState.putString(STATE_IN_REPLY_TO, mInReplyTo); outState.putString(STATE_REFERENCES, mReferences); outState.putSerializable(STATE_KEY_HTML_QUOTE, mQuotedHtmlContent); outState.putBoolean(STATE_KEY_READ_RECEIPT, mReadReceipt); outState.putBoolean(STATE_KEY_DRAFT_NEEDS_SAVING, draftNeedsSaving); outState.putBoolean(STATE_KEY_FORCE_PLAIN_TEXT, mForcePlainText); outState.putSerializable(STATE_KEY_QUOTED_TEXT_FORMAT, mQuotedTextFormat); outState.putBoolean(STATE_FIRST_TIME_EMPTY_SUBJECT, mFirstTimeEmptySubject); recipientPresenter.onSaveInstanceState(outState); }

Target:
protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(STATE_KEY_NUM_ATTACHMENTS_LOADING, mNumAttachmentsLoading); outState.putString(STATE_KEY_WAITING_FOR_ATTACHMENTS, mWaitingForAttachments.name()); outState.putParcelableArrayList(STATE_KEY_ATTACHMENTS, createAttachmentList()); outState.putSerializable(STATE_KEY_QUOTED_TEXT_MODE, mQuotedTextMode); outState.putBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, mSourceMessageProcessed); outState.putLong(STATE_KEY_DRAFT_ID, mDraftId); outState.putSerializable(STATE_IDENTITY, mIdentity); outState.putBoolean(STATE_IDENTITY_CHANGED, mIdentityChanged); outState.putString(STATE_IN_REPLY_TO, mInReplyTo); outState.putString(STATE_REFERENCES, mReferences); outState.putSerializable(STATE_KEY_HTML_QUOTE, mQuotedHtmlContent); outState.putBoolean(STATE_KEY_READ_RECEIPT, mReadReceipt); outState.putBoolean(STATE_KEY_DRAFT_NEEDS_SAVING, draftNeedsSaving); outState.putBoolean(STATE_KEY_FORCE_PLAIN_TEXT, mForcePlainText); outState.putSerializable(STATE_KEY_QUOTED_TEXT_FORMAT, mQuotedTextFormat); outState.putBoolean(STATE_ALREADY_NOTIFIED_USER_OF_EMPTY_SUBJECT, alreadyNotifiedUserOfEmptySubject); recipientPresenter.onSaveInstanceState(outState); }
Source:
public static RequestBodyImpl createInstance(AnnotationModel annotation, ApiContext context) { RequestBodyImpl from = new RequestBodyImpl(); from.setDescription(annotation.getValue("description", String.class)); from.setRequired(annotation.getValue("required", Boolean.class)); String ref = annotation.getValue("ref", String.class); if (ref != null && !ref.isEmpty()) { from.setRef(ref); } final List<ContentImpl> contents = createList(); extractAnnotations(annotation, context, "content", ContentImpl::createInstance, contents::add); for (ContentImpl content : contents) { ContentImpl.merge(content, from.content, true, context); } return from; }

Target:
public static RequestBodyImpl createInstance(AnnotationModel annotation, ApiContext context) { RequestBodyImpl from = new RequestBodyImpl(); from.setDescription(annotation.getValue("description", String.class)); from.setRequired(annotation.getValue("required", Boolean.class)); String ref = annotation.getValue("ref", String.class); if (ref != null && !ref.isEmpty()) { from.setRef(ref); } final List<ContentImpl> contents = createList(); extractAnnotations(annotation, context, "content", ContentImpl::createInstance, contents::add); for (ContentImpl content : contents) { content.getMediaTypes().forEach(from.content::addMediaType); } return from; }
Source:
protected final void validatePage() { String text = fNameField.getText(); RefactoringStatus status = fRefactoringProcessor.validateNewElementName(text); setPageComplete(status); }

Target:
private void validatePage() { String text = fNameField.getText(); RefactoringStatus status = fRefactoringProcessor.validateNewElementName(text); setPageComplete(status); }
Source:
private RevCommit createCommit(NoteMap map, PersonIdent author, String message, RevCommit... parents) throws IOException { ObjectInserter inserter = db.newObjectInserter(); CommitBuilder b = new CommitBuilder(); b.setTreeId(map.writeTree(inserter)); b.setAuthor(author); b.setCommitter(gerritIdent); if (parents.length > 0) { b.setParentIds(parents); } b.setMessage(message); return revWalk.parseCommit(inserter.insert(b)); }

Target:
private RevCommit createCommit(NoteMap map, PersonIdent author, String message, RevCommit... parents) throws IOException { CommitBuilder b = new CommitBuilder(); b.setTreeId(map.writeTree(inserter)); b.setAuthor(author); b.setCommitter(gerritIdent); if (parents.length > 0) { b.setParentIds(parents); } b.setMessage(message); ObjectId commitId = inserter.insert(b); inserter.flush(); return revWalk.parseCommit(commitId); }
Source:
private static PlanFragment createValuesPlan() { Symbol symbol = new Symbol("column"); PlanNodeId valuesNodeId = new PlanNodeId("plan"); PlanFragment planFragment = new PlanFragment( new PlanFragmentId("plan"), new ValuesNode(valuesNodeId, ImmutableList.of(symbol), ImmutableList.of(ImmutableList.of(new StringLiteral("foo")))), ImmutableMap.of(symbol, VARCHAR), SOURCE_DISTRIBUTION, ImmutableList.of(valuesNodeId), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(symbol)), StageExecutionStrategy.ungroupedExecution(), emptyMap(), emptyMap()); return planFragment; }

Target:
private static PlanFragment createValuesPlan() { Symbol symbol = new Symbol("column"); PlanNodeId valuesNodeId = new PlanNodeId("plan"); PlanFragment planFragment = new PlanFragment( new PlanFragmentId("plan"), new ValuesNode(valuesNodeId, ImmutableList.of(symbol), ImmutableList.of(ImmutableList.of(new StringLiteral("foo")))), ImmutableMap.of(symbol, VARCHAR), SOURCE_DISTRIBUTION, ImmutableList.of(valuesNodeId), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(symbol)), StageExecutionStrategy.ungroupedExecution(), StatsAndCosts.empty()); return planFragment; }
Source:
public void testDmPingResponse() throws IllegalAccessException { MsgEcho ping = new MsgEcho( "PING:TEST" ); AgentMessageProcessor processor = (AgentMessageProcessor) agent.getMessagingClient().getMessageProcessor(); processor.processMessage( ping ); List<Message> messages = this.client.messagesForTheDm; Assert.assertTrue( messages.size() == 1 ); Message message = messages.get(0); Assert.assertTrue( message instanceof MsgEcho ); MsgEcho echo = (MsgEcho) message; Assert.assertTrue( echo.getContent().equals( "PONG:TEST" ) ); }

Target:
public void testDmPingResponse() throws IllegalAccessException { MsgEcho ping = new MsgEcho( "PING:TEST", 1234L ); AgentMessageProcessor processor = (AgentMessageProcessor) agent.getMessagingClient().getMessageProcessor(); processor.processMessage( ping ); List<Message> messages = this.client.messagesForTheDm; Assert.assertEquals( 1, messages.size() ); Message message = messages.get(0); Assert.assertTrue( message instanceof MsgEcho ); MsgEcho echo = (MsgEcho) message; Assert.assertEquals( "PONG:TEST", echo.getContent() ); Assert.assertEquals( 1234L, echo.getExpirationTime() ); }
Source:
protected boolean canDoAction() { boolean retValue = true; if (disk == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } if (retValue) { buildSharedLockMap(); } retValue = retValue && acquireLockInternal(); if (retValue && disk.getVmEntityType() == VmEntityType.VM && (getParameters().getStorageDomainId() == null || Guid.Empty.equals(getParameters().getStorageDomainId()))) { getParameters().setStorageDomainId(disk.getstorage_ids().get(0)); setStorageDomainId(disk.getstorage_ids().get(0)); } if (retValue && !disk.getstorage_ids().contains(getParameters().getStorageDomainId())) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STOARGE_DOMAIN_IS_WRONG); } StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retValue = retValue && validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()) && validator.domainIsValidDestination(getReturnValue().getCanDoActionMessages()); if (retValue && disk.getimageStatus() == ImageStatus.LOCKED) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED); } if (retValue) { if (disk.getVmEntityType() == VmEntityType.VM) { retValue = canRemoveVmDisk(); } else if (disk.getVmEntityType() == VmEntityType.TEMPLATE) { retValue = canRemoveTemplateDisk(); } } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = true; if (disk == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } if (retValue) { buildSharedLockMap(); retValue = acquireLockInternal(); } if (retValue && disk.getVmEntityType() == VmEntityType.VM && (getParameters().getStorageDomainId() == null || Guid.Empty.equals(getParameters().getStorageDomainId()))) { getParameters().setStorageDomainId(disk.getstorage_ids().get(0)); setStorageDomainId(disk.getstorage_ids().get(0)); } if (retValue && !disk.getstorage_ids().contains(getParameters().getStorageDomainId())) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STOARGE_DOMAIN_IS_WRONG); } StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retValue = retValue && validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()) && validator.domainIsValidDestination(getReturnValue().getCanDoActionMessages()); if (retValue && disk.getimageStatus() == ImageStatus.LOCKED) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED); } if (retValue) { if (disk.getVmEntityType() == VmEntityType.VM) { retValue = canRemoveVmDisk(); } else if (disk.getVmEntityType() == VmEntityType.TEMPLATE) { retValue = canRemoveTemplateDisk(); } } return retValue; }
Source:
protected PrestoVerifier() { }

Target:
private PrestoVerifier() { }
Source:
public default <A extends Statement> A addAndGetStatement(A statement) { getStmts().add(statement); statement.setParentNode((Node) this); return statement; }

Target:
default <A extends Statement> A addAndGetStatement(A statement) { getStmts().add(statement); statement.setParentNode((Node) this); return statement; }
Source:
private String schemaDisplayName(final String connectionName) { if ("REJECT".equalsIgnoreCase(connectionName)) { return "Reject Schema"; } if (EConnectionType.FLOW_MAIN.getName().equalsIgnoreCase(connectionName)) { return "Schema"; } return "Schema" + " " + connectionName; }

Target:
private String schemaDisplayName(final String connectionName) { if ("REJECT".equalsIgnoreCase(connectionName)) { return "Reject Schema"; } if (EConnectionType.FLOW_MAIN.getName().equalsIgnoreCase(connectionName)) { return "Schema"; } return "Schema " + connectionName; }
Source:
public Set<String> getCategories() { DocumentList docs = this.getAllCategoriesFromPublishedPosts(); Set<String> result = new HashSet<String>(); for (Map<String, Object> document : docs) { String[] categories = DBUtil.toStringArray(document.get("categories")); Collections.addAll(result, categories); } return result; }

Target:
public Set<String> getCategories() { DocumentList docs = this.getAllCategoriesFromPublishedPosts(); Set<String> result = new HashSet<String>(); for (Map<String, Object> document : docs) { String[] categories = DBUtil.toStringArray(document.get(Crawler.Attributes.CATEGORIES)); Collections.addAll(result, categories); } return result; }
Source:
private ZapMenuItem getMenuImportLocalGraphQl() { if (menuImportLocalGraphQl == null) { menuImportLocalGraphQl = new ZapMenuItem("graphql.topmenu.import.importgraphql"); menuImportLocalGraphQl.setToolTipText( Constant.messages.getString("graphql.topmenu.import.importgraphql.tooltip")); menuImportLocalGraphQl.addActionListener( e -> new ImportFromFileDialog( View.getSingleton().getMainFrame(), ExtensionGraphQl.this)); } return menuImportLocalGraphQl; }

Target:
private ZapMenuItem getMenuImportLocalGraphQl() { if (menuImportLocalGraphQl == null) { menuImportLocalGraphQl = new ZapMenuItem("graphql.topmenu.import.importgraphql"); menuImportLocalGraphQl.setToolTipText( Constant.messages.getString("graphql.topmenu.import.importgraphql.tooltip")); menuImportLocalGraphQl.addActionListener( e -> new ImportFromFileDialog(View.getSingleton().getMainFrame(), this)); } return menuImportLocalGraphQl; }
Source:
public void doOperation(int operation) { if (operation == QUICK_OUTLINE && outlinePresenter != null) { outlinePresenter.showInformation(); return; } Runnable toRevert = null; try { switch (operation) { case PASTE: if (preprocessor != null) { Clipboard clipboard = new Clipboard(getControlDisplay()); toRevert = preprocessor.prepareClipboard(clipboard); } break; } super.doOperation(operation); } finally { if (toRevert != null) { toRevert.run(); } } }

Target:
public void doOperation(int operation) { if (operation == QUICK_OUTLINE && outlinePresenter != null) { outlinePresenter.showInformation(); return; } Runnable toRevert = null; try { switch (operation) { case PASTE: if (preprocessor != null) { Clipboard clipboard = new Clipboard(getControl().getDisplay()); toRevert = preprocessor.prepareClipboard(clipboard); } break; } super.doOperation(operation); } finally { if (toRevert != null) { toRevert.run(); } } }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (cachedResult == null) { ColumnExpression columnExp = (ColumnExpression)exps.get(0); LiteralExpression isAscendingExpression = (LiteralExpression)exps.get(1); boolean isAscending = (Boolean)isAscendingExpression.getValue(); LiteralExpression valueExp = (LiteralExpression)exps.get(2); NavigableMap<ImmutableBytesPtr, Integer> sortedMap = new TreeMap<ImmutableBytesPtr, Integer>(valueVsCount); if (!isAscending) { sortedMap = sortedMap.descendingMap(); } long distinctCountsSum = 0; for (Entry<ImmutableBytesPtr, Integer> entry : sortedMap.entrySet()) { Object value = valueExp.getValue(); Object colValue = columnExp.getDataType().toObject(entry.getKey()); int compareResult = columnExp.getDataType().compareTo(colValue, value, valueExp.getDataType()); boolean done = isAscending ? compareResult > 0 : compareResult <= 0; if (done) break; distinctCountsSum += entry.getValue(); } float result = (float)distinctCountsSum / totalCount; this.cachedResult = new BigDecimal(result); } if (buffer == null) { initBuffer(); } buffer = PDataType.DECIMAL.toBytes(this.cachedResult); ptr.set(buffer); return true; }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (cachedResult == null) { ColumnExpression columnExp = (ColumnExpression)exps.get(0); LiteralExpression isAscendingExpression = (LiteralExpression)exps.get(1); boolean isAscending = (Boolean)isAscendingExpression.getValue(); LiteralExpression valueExp = (LiteralExpression)exps.get(2); Entry<ImmutableBytesPtr, Integer>[] entries = getSortedValueVsCount(isAscending); long distinctCountsSum = 0; for (Entry<ImmutableBytesPtr, Integer> entry : entries) { Object value = valueExp.getValue(); Object colValue = columnExp.getDataType().toObject(entry.getKey()); int compareResult = columnExp.getDataType().compareTo(colValue, value, valueExp.getDataType()); boolean done = isAscending ? compareResult > 0 : compareResult <= 0; if (done) break; distinctCountsSum += entry.getValue(); } float result = (float)distinctCountsSum / totalCount; this.cachedResult = new BigDecimal(result); } if (buffer == null) { initBuffer(); } buffer = PDataType.DECIMAL.toBytes(this.cachedResult); ptr.set(buffer); return true; }
Source:
public void updateCheckedState(TreeItem item) { Object element = item.getData(); if (element instanceof IBreakpoint) { try { item.setChecked(((IBreakpoint) element).isEnabled()); refreshItem(item); } catch (CoreException e) { DebugUIPlugin.log(e); } } else if (element instanceof IBreakpointContainer) { IBreakpoint[] breakpoints = ((IBreakpointContainer) element).getBreakpoints(); int enabledChildren= 0; for (IBreakpoint breakpoint : breakpoints) { try { if (breakpoint.isEnabled()) { enabledChildren++; } } catch (CoreException e) { DebugUIPlugin.log(e); } } if (enabledChildren == 0) { item.setGrayed(false); item.setChecked(false); } else if (enabledChildren == breakpoints.length) { item.setGrayed(false); item.setChecked(true); } else { item.setGrayed(true); item.setChecked(true); } for (TreeItem item2 : item.getItems()) { updateCheckedState(item2); } } }

Target:
public void updateCheckedState(TreeItem item) { Object element = item.getData(); if (element instanceof IBreakpoint) { try { item.setChecked(((IBreakpoint) element).isEnabled()); refreshItem(item); } catch (CoreException e) { DebugUIPlugin.log(e); } } else if (element instanceof IBreakpointContainer) { IBreakpoint[] breakpoints = ((IBreakpointContainer) element).getBreakpoints(); int enabledChildren= 0; for (IBreakpoint breakpoint : breakpoints) { try { if (breakpoint.isEnabled()) { enabledChildren++; } } catch (CoreException e) { DebugUIPlugin.log(e); } } if (enabledChildren == 0) { item.setGrayed(false); item.setChecked(false); } else if (enabledChildren == breakpoints.length) { item.setGrayed(false); item.setChecked(true); } else { item.setGrayed(true); item.setChecked(true); } for (TreeItem childItem : item.getItems()) { updateCheckedState(childItem); } } }
Source:
public void negativeTests(final IlluminaFileUtil.SupportedIlluminaFormat[] formats, final IlluminaDataType[] dataTypes, final List<String> filesToDelete, final List<String> filesToEmpty, final int lane, final List<Integer> tiles, final int[] cycles, final String readStructure, final int expectedNumErrors, final List<Integer> filterTiles, final boolean makeFakeFiles) { makeFiles(formats, lane, tiles, cycles); IlluminaFileUtilTest.deleteRelativeFiles(intensityDir, filesToDelete); IlluminaFileUtilTest.emptyRelativeFiles(intensityDir, filesToEmpty); writeTileMetricsOutFile(makeMap(makeList(lane - 1, lane + 1, lane), makeList(makeList(1, 2, 3), tiles, tiles))); final String[] args = makeCheckerArgs(basecallDir, lane, readStructure, dataTypes, filterTiles, makeFakeFiles, false); final int returnCode = runPicardCommandLine(args); Assert.assertEquals(returnCode, 1); try { final int numErrors = Integer.parseInt(new String(Files.readAllBytes(Paths.get("./errors.count")))); Assert.assertEquals(numErrors, expectedNumErrors); Files.deleteIfExists(Paths.get("./errors.count")); } catch (IOException e) { Assert.fail("Could not read the number of errors from file", e); } if (makeFakeFiles) { Assert.assertEquals(runPicardCommandLine(args), 0); } }

Target:
public void negativeTests(final IlluminaFileUtil.SupportedIlluminaFormat[] formats, final IlluminaDataType[] dataTypes, final List<String> filesToDelete, final List<String> filesToEmpty, final int lane, final List<Integer> tiles, final int[] cycles, final String readStructure, final int expectedNumErrors, final List<Integer> filterTiles, final boolean makeFakeFiles) { makeFiles(formats, lane, tiles, cycles); IlluminaFileUtilTest.deleteRelativeFiles(intensityDir, filesToDelete); IlluminaFileUtilTest.emptyRelativeFiles(intensityDir, filesToEmpty); writeTileMetricsOutFile(makeMap(makeList(lane - 1, lane + 1, lane), makeList(makeList(1, 2, 3), tiles, tiles))); final String[] args = makeCheckerArgs(basecallDir, lane, readStructure, dataTypes, filterTiles, makeFakeFiles, false); final int returnCode = runPicardCommandLine(args); Assert.assertEquals(returnCode, 1); try { final Path errorPath = Paths.get("./errors.count"); final int numErrors = Integer.parseInt(new String(Files.readAllBytes(errorPath))); Assert.assertEquals(numErrors, expectedNumErrors); Files.deleteIfExists(errorPath); } catch (IOException e) { Assert.fail("Could not read the number of errors from file", e); } if (makeFakeFiles) { Assert.assertEquals(runPicardCommandLine(args), 0); } }