auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public long compress(InputStream is, OutputStream os, long maxReadLength, long maxWriteLength, long amountOfDataToCheckCompressionRatio, int minimumCompressionPercentage) throws IOException { if(maxReadLength <= 0) throw new IllegalArgumentException(); BZip2CompressorOutputStream bz2os = null; try { CountedOutputStream cos = new CountedOutputStream(os); bz2os = new BZip2CompressorOutputStream(HeaderStreams.dimOutput(BZ_HEADER, cos)); long read = 0; int bufferSize = 32768; byte[] buffer = new byte[bufferSize]; long iterationToCheckCompressionRatio = amountOfDataToCheckCompressionRatio / bufferSize; int i = 0; while(true) { int l = (int) Math.min(buffer.length, maxReadLength - read); int x = l == 0 ? -1 : is.read(buffer, 0, buffer.length); if(x <= -1) break; if(x == 0) throw new IOException("Returned zero from read()"); bz2os.write(buffer, 0, x); read += x; if(cos.written() > maxWriteLength) throw new CompressionOutputSizeException(); if (++i == iterationToCheckCompressionRatio) <START> checkCompressionEffect(read, cos.written(), minimumCompressionPercentage); <END> } bz2os.flush(); cos.flush(); bz2os.close(); bz2os = null; if(cos.written() > maxWriteLength) throw new CompressionOutputSizeException(); return cos.written(); } finally { if(bz2os != null) { bz2os.flush(); bz2os.close(); } } }</code><technical_language>please add curly braces if body</technical_language>

Target:
public long compress(InputStream is, OutputStream os, long maxReadLength, long maxWriteLength, long amountOfDataToCheckCompressionRatio, int minimumCompressionPercentage) throws IOException { if(maxReadLength <= 0) throw new IllegalArgumentException(); BZip2CompressorOutputStream bz2os = null; try { CountedOutputStream cos = new CountedOutputStream(os); bz2os = new BZip2CompressorOutputStream(HeaderStreams.dimOutput(BZ_HEADER, cos)); long read = 0; int bufferSize = 32768; byte[] buffer = new byte[bufferSize]; long iterationToCheckCompressionRatio = amountOfDataToCheckCompressionRatio / bufferSize; int i = 0; while(true) { int l = (int) Math.min(buffer.length, maxReadLength - read); int x = l == 0 ? -1 : is.read(buffer, 0, buffer.length); if(x <= -1) break; if(x == 0) throw new IOException("Returned zero from read()"); bz2os.write(buffer, 0, x); read += x; if(cos.written() > maxWriteLength) throw new CompressionOutputSizeException(); if (++i == iterationToCheckCompressionRatio) { checkCompressionEffect(read, cos.written(), minimumCompressionPercentage); } } bz2os.flush(); cos.flush(); bz2os.close(); bz2os = null; if(cos.written() > maxWriteLength) throw new CompressionOutputSizeException(); return cos.written(); } finally { if(bz2os != null) { bz2os.flush(); bz2os.close(); } } }
Source:
<code>public void testAssociatedArtId() throws Exception { String expected = "SELECT br1.*\n" + " FROM \n" + "osee_branch br1\n" + " WHERE \n" + "br1.associated_art_id = ?\n" + " ORDER BY br1.branch_id"; <START> ArtifactId artifactId = ArtifactId.valueOf(4); <END> queryData.addCriteria(new CriteriaAssociatedArtId(artifactId)); QuerySqlContext context = queryEngine.createQueryContext(session, queryData); assertEquals(expected, context.getSql()); List<Object> parameters = context.getParameters(); assertEquals(1, parameters.size()); List<AbstractJoinQuery> joins = context.getJoins(); assertEquals(0, joins.size()); Iterator<Object> iterator = parameters.iterator(); assertEquals(artifactId, iterator.next()); }</code><technical_language>4 represent? a named constant for maintainability</technical_language>

Target:
public void testAssociatedArtId() throws Exception { String expected = "SELECT br1.*\n" + " FROM \n" + "osee_branch br1\n" + " WHERE \n" + "br1.associated_art_id = ?\n" + " ORDER BY br1.branch_id"; queryData.addCriteria(new CriteriaAssociatedArtId(DefaultHierarchyRoot)); QuerySqlContext context = queryEngine.createQueryContext(session, queryData); assertEquals(expected, context.getSql()); List<Object> parameters = context.getParameters(); assertEquals(1, parameters.size()); List<AbstractJoinQuery> joins = context.getJoins(); assertEquals(0, joins.size()); Iterator<Object> iterator = parameters.iterator(); assertEquals(DefaultHierarchyRoot, iterator.next()); }
Source:
<code>private ITestModelProvider getModelProviderForNonUnsettableMultiValuedFeature(Resource resource) throws Exception { <START> EReference listA = getModel6Package().getRoot_ListA(); <END> Assert.assertFalse(listA.isUnsettable()); final Root root = getModel6Factory().createRoot(); resource.getContents().add(root); resource.save(Collections.emptyMap()); return new ITestModelProvider() { public void addObject() { root.getListA().add(getModel6Factory().createBaseObject()); } public EObject getRoot() { return root; } public void unset() { root.eUnset(getModel6Package().getRoot_ListA()); } public boolean isUnsettable() { return false; } }; }</code><technical_language>This reference is a containment REMOVE_ADAPTER notifications generated in Class1_Class2 reference. a containment unsettable multi-valued reference model6::ReferenceObject.referenceList for example</technical_language>

Target:
private ITestModelProvider getModelProviderForNonUnsettableMultiValuedFeature(Resource resource) throws Exception { EReference refList = getModel6Package().getReferenceObject_ReferenceList(); Assert.assertFalse(refList.isUnsettable()); final ReferenceObject root = getModel6Factory().createReferenceObject(); resource.getContents().add(root); resource.save(Collections.emptyMap()); return new ITestModelProvider() { public void addObject() { root.getReferenceList().add(getModel6Factory().createBaseObject()); } public EObject getRoot() { return root; } public void unset() { root.eUnset(getModel6Package().getReferenceObject_ReferenceList()); } public boolean isUnsettable() { return false; } }; }
Source:
<code>private CreateVolumeVDSCommandParameters getCreateVDSCommandParameters() { CreateVolumeVDSCommandParameters parameters = new CreateVolumeVDSCommandParameters(getStoragePoolId(), getDestinationStorageDomainId(), getImageGroupId(), getImage().getImageId(), getDiskImage().getSize(), newDiskImage.getVolumeType(), newDiskImage.getVolumeFormat(), getDiskImage().getId(), getDestinationImageId(), "", getStoragePool().getCompatibilityVersion(), getDiskImage().getContentType()); <START> parameters.setImageInitialSizeInBytes(newDiskImage.getActualSizeInBytes()); <END> return parameters; }</code><technical_language>I need like: if user initial size: set initial size vdsm get initialSize argument user value. A bad case is user anything, getActualSizeInBytes() returns 0, send 0 vdsm vdsm default initial size. initialSize=0 is valid input in file storage want avoid prealloction. is valid input for block storage if vdsm reject this</technical_language>

Target:
private CreateVolumeVDSCommandParameters getCreateVDSCommandParameters() { CreateVolumeVDSCommandParameters parameters = new CreateVolumeVDSCommandParameters(getStoragePoolId(), getDestinationStorageDomainId(), getImageGroupId(), getImage().getImageId(), getDiskImage().getSize(), newDiskImage.getVolumeType(), newDiskImage.getVolumeFormat(), getDiskImage().getId(), getDestinationImageId(), "", getStoragePool().getCompatibilityVersion(), getDiskImage().getContentType()); if (newDiskImage.getActualSizeInBytes() != 0) { parameters.setImageInitialSizeInBytes(newDiskImage.getActualSizeInBytes()); } return parameters; }
Source:
<code>public Optional<ChangeEdit> byChange(Change change) throws AuthException, IOException, InvalidChangeOperationException { if (!user.get().isIdentifiedUser()) { throw new AuthException("Authentication required"); } Repository repo = gitManager.openRepository(change.getProject()); try { IdentifiedUser me = (IdentifiedUser) user.get(); Map<String, Ref> refs = repo.getRefDatabase().getRefs(editRefPrefix( me.getAccountId(), change.getId())); if (refs.isEmpty()) { return Optional.absent(); } <START> Ref ref = Iterables.getOnlyElement(refs.values()); <END> RevWalk rw = new RevWalk(repo); try { RevCommit commit = rw.parseCommit(ref.getObjectId()); PatchSet basePs = getBasePatchSet(change, commit); return Optional.of(new ChangeEdit(me, change, ref, commit, basePs)); } finally { rw.release(); } } finally { repo.close(); } }</code><technical_language>failing encounter corrupt state is more ref, silently deleting current in this case</technical_language>

Target:
public Optional<ChangeEdit> byChange(Change change) throws AuthException, IOException, InvalidChangeOperationException { if (!user.get().isIdentifiedUser()) { throw new AuthException("Authentication required"); } Repository repo = gitManager.openRepository(change.getProject()); try { IdentifiedUser me = (IdentifiedUser) user.get(); String editRefPrefix = editRefPrefix(me.getAccountId(), change.getId()); Map<String, Ref> refs = repo.getRefDatabase().getRefs(editRefPrefix); if (refs.isEmpty()) { return Optional.absent(); } Ref ref = Iterables.getOnlyElement(refs.values()); RevWalk rw = new RevWalk(repo); try { RevCommit commit = rw.parseCommit(ref.getObjectId()); PatchSet basePs = getBasePatchSet(change, ref); return Optional.of(new ChangeEdit(me, change, ref, commit, basePs)); } finally { rw.release(); } } finally { repo.close(); } }
Source:
<code>private void showFeaturedImage(int postId, WPNetworkImageView imgFeatured) { String imageUrl = mFeaturedImageUrls.get(postId); if (imageUrl == null) { imgFeatured.setVisibility(View.GONE); } else if (imageUrl.startsWith("http")) { String photonUrl = ReaderUtils.getResizedImageUrl(imageUrl, mPhotonWidth, mPhotonHeight, mSite.isPrivate()); imgFeatured.setVisibility(View.VISIBLE); imgFeatured.setImageUrl(photonUrl, WPNetworkImageView.ImageType.PHOTO); } else { <START> Bitmap bmp = fastResizeBitmap(imageUrl, mPhotonWidth); <END> if (bmp != null) { imgFeatured.setVisibility(View.VISIBLE); imgFeatured.setImageBitmap(bmp); } else { imgFeatured.setVisibility(View.GONE); } } }</code><technical_language>reason Bitmap bmp = ImageUtils.getWPImageSpanThumbnailFromFilePath(context, imageUrl, mPhotonWidth); is tested in app? actual implementation in consideration orientation of pictures, resulting in pictures turned 90 some devices, show "poster" picture for videos</technical_language>

Target:
private void showFeaturedImage(int postId, WPNetworkImageView imgFeatured) { String imageUrl = mFeaturedImageUrls.get(postId); if (imageUrl == null) { imgFeatured.setVisibility(View.GONE); } else if (imageUrl.startsWith("http")) { String photonUrl = ReaderUtils.getResizedImageUrl( imageUrl, mPhotonWidth, mPhotonHeight, !SiteUtils.isPhotonCapable(mSite)); imgFeatured.setVisibility(View.VISIBLE); imgFeatured.setImageUrl(photonUrl, WPNetworkImageView.ImageType.PHOTO); } else { Bitmap bmp = ImageUtils.getWPImageSpanThumbnailFromFilePath( imgFeatured.getContext(), imageUrl, mPhotonWidth); if (bmp != null) { imgFeatured.setVisibility(View.VISIBLE); imgFeatured.setImageBitmap(bmp); } else { imgFeatured.setVisibility(View.GONE); } } }
Source:
<code>CorsConfiguration findCorsConfiguration(String lookupPath) { ResourceMetadata resource = getResourceMetadata(getRepositoryBasePath(lookupPath)); <START> if (resource != null) { <END> return createConfiguration( repositories.getRepositoryInformationFor(resource.getDomainType()).getRepositoryInterface()); } return null; }</code><technical_language>Ternary if</technical_language>

Target:
CorsConfiguration findCorsConfiguration(String lookupPath) { ResourceMetadata resource = getResourceMetadata(getRepositoryBasePath(lookupPath)); return resource != null ? createConfiguration( repositories.getRepositoryInformationFor(resource.getDomainType()).getRepositoryInterface()) : null; }
Source:
<code>public void setup(OperatorContext arg0) { <START> table1 = new ArrayList<Map<String, Object>>(); <END> table2 = new ArrayList<Map<String, Object>>(); }</code><technical_language>Generics right side redundant Java7</technical_language>

Target:
public void setup(OperatorContext arg0) { table1 = new ArrayList<>(); table2 = new ArrayList<>(); }
Source:
<code>public final Group drawGraph(final int position) { <START> return viewVar.drawGraph(modelVar.getSegments(position)); <END> }</code><technical_language>viewVar renamed view</technical_language>

Target:
public final Group drawGraph(final int position) { return view.drawGraph(model.getSegments(position)); }
Source:
<code>public void delete() { DomainException.throwWhenDeleteBlocked(getDeletionBlockers()); ProfessorshipManagementLog.createLog(getExecutionCourse(), Bundle.MESSAGING, "log.executionCourse.professorship.removed", getPerson().getPresentationName(), getExecutionCourse().getNome(), getExecutionCourse() .getDegreePresentationString()); <START> ExecutionCourse executionCourse = getExecutionCourse(); <END> setExecutionCourse(null); setPerson(null); if (super.getPermissions() != null) { getPermissions().delete(); } setRootDomainObject(null); setCreator(null); deleteDomainObject(); }</code><technical_language>is this variable for? is in remainder of code block</technical_language>

Target:
public void delete() { DomainException.throwWhenDeleteBlocked(getDeletionBlockers()); ProfessorshipManagementLog.createLog(getExecutionCourse(), Bundle.MESSAGING, "log.executionCourse.professorship.removed", getPerson().getPresentationName(), getExecutionCourse().getNome(), getExecutionCourse() .getDegreePresentationString()); setExecutionCourse(null); setPerson(null); if (super.getPermissions() != null) { getPermissions().delete(); } setRootDomainObject(null); setCreator(null); deleteDomainObject(); }
Source:
<code>public Query getRevisionAndjobsInfoQuery(final String user, final boolean pending, final boolean running, final boolean finished, String startCursor, String endCursor, int pageSize, boolean first, FilterModel filterModel) { try { Jobs.Builder jobsBuilder = new Jobs.Builder().excludeDataManagement().excludeRemovedTime(); if (startCursor != null) jobsBuilder.after(startCursor); if (endCursor != null) jobsBuilder.before(endCursor); if (first) jobsBuilder.first(pageSize); else jobsBuilder.last(pageSize); List<JobInput> input = getJobInputs(user, pending, running, finished, filterModel); jobsBuilder.input(input); Query.Builder queryBuilder = new Query.Builder().query(jobsBuilder.build().getQueryString()); <START> LOGGER.log(Level.SEVERE, queryBuilder.build().getQuery()); <END> return queryBuilder.build(); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage()); return null; } }</code><technical_language>forget this log output</technical_language>

Target:
public Query getRevisionAndjobsInfoQuery(final String user, final boolean pending, final boolean running, final boolean finished, String startCursor, String endCursor, int pageSize, boolean first, FilterModel filterModel) { try { Jobs.Builder jobsBuilder = new Jobs.Builder().excludeDataManagement().excludeRemovedTime(); if (startCursor != null) jobsBuilder.after(startCursor); if (endCursor != null) jobsBuilder.before(endCursor); if (first) jobsBuilder.first(pageSize); else jobsBuilder.last(pageSize); List<JobInput> input = getJobInputs(user, pending, running, finished, filterModel); jobsBuilder.input(input); Query.Builder queryBuilder = new Query.Builder().query(jobsBuilder.build().getQueryString()); return queryBuilder.build(); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage()); return null; } }
Source:
<code>public RunnerApi.Environment createEnvironment() throws IOException, InterruptedException { Map<String, String> env = constructEnvironmentVariables(); File runnerScript = ResourceUtil.extractUdfRunner(baseDirectory); <START> String pythonWorkerCommand = String.join(File.separator, baseDirectory, runnerScript.getName()); <END> return Environments.createProcessEnvironment( "", "", pythonWorkerCommand, env); }</code><technical_language>suggestion String pythonWorkerCommand = runnerScript.getPath(); Besides, variable pythonWorkerCommand removed</technical_language>

Target:
public RunnerApi.Environment createEnvironment() throws IOException, InterruptedException { Map<String, String> env = constructEnvironmentVariables(); File runnerScript = ResourceUtil.extractUdfRunner(baseDirectory); return Environments.createProcessEnvironment( "", "", runnerScript.getPath(), env); }
Source:
<code>private void writeImagingOutput(final ImagingResult result, final ItcImagingResult s) { final Flamingos2 instrument = (Flamingos2) result.instrument(); _println(""); _print(CalculatablePrinter.getTextResult(result.sfCalc())); _println(CalculatablePrinter.getTextResult(result.iqCalc())); _println(CalculatablePrinter.getTextResult(result.is2nCalc(), result.observation())); _println(CalculatablePrinter.WarnIfReadNoiseLimited(result.is2nCalc())); <START> <END> _printPeakPixelInfo(s.ccd(0)); _printWarnings(s.warnings()); _print(OverheadTablePrinter.print(this, p, result)); printConfiguration((Flamingos2) result.instrument(), result.parameters()); }</code><technical_language>I prints extra blank line warning is triggered, I obvious it... I ITC this looks, I suppose call _print instead of _println? adding another \n warning present if want preserve newlines for case. A hacky do change warning return Option<String> instead of a String. java import edu.gemini.shared.util.immutable.*; public static Option<String> ReadNoiseLimitedWarning(final ImagingS2NCalculatable s2n) { return (s2n.getVarReadout() ...) ? ImOption.apply("Warning: observation is read noise limited ...") : ImOption.<String>empty(); } java CalculatablePrinter.ReadNoiseLimitedWarning(result.is2nCalc()).foreach(s -> _println(s));</technical_language>

Target:
private void writeImagingOutput(final ImagingResult result, final ItcImagingResult s) { final Flamingos2 instrument = (Flamingos2) result.instrument(); _println(""); _print(CalculatablePrinter.getTextResult(result.sfCalc())); _println(CalculatablePrinter.getTextResult(result.iqCalc())); _println(CalculatablePrinter.getTextResult(result.is2nCalc(), result.observation())); CalculatablePrinter.ReadNoiseLimitedWarning(result.is2nCalc()).foreach(str -> _println(str)); _printPeakPixelInfo(s.ccd(0)); _printWarnings(s.warnings()); _print(OverheadTablePrinter.print(this, p, result)); printConfiguration((Flamingos2) result.instrument(), result.parameters()); }
Source:
<code>public List<QueryResult> lookup(List<GHPoint> points, FlagEncoder encoder) { if (points.size() < 2) throw new IllegalArgumentException("At least 2 points have to be specified, but was:" + points.size()); EdgeFilter edgeFilter = new DefaultEdgeFilter(encoder); queryResults = new ArrayList<>(points.size()); for (int placeIndex = 0; placeIndex < points.size(); placeIndex++) { GHPoint point = points.get(placeIndex); if(ghRequest.hasPointHints()){ <START> edgeFilter = new LevensteinDistanceEdgeFilter(encoder, ghRequest.getPointHint(placeIndex)); <END> } QueryResult res = locationIndex.findClosest(point.lat, point.lon, edgeFilter); if (!res.isValid()) ghResponse.addError(new PointNotFoundException("Cannot find point " + placeIndex + ": " + point, placeIndex)); queryResults.add(res); } return queryResults; }</code><technical_language>I a wrapper of edgeFilter, accept stuff edgeFilter reject</technical_language>

Target:
public List<QueryResult> lookup(List<GHPoint> points, FlagEncoder encoder) { if (points.size() < 2) throw new IllegalArgumentException("At least 2 points have to be specified, but was:" + points.size()); EdgeFilter edgeFilter = new DefaultEdgeFilter(encoder); queryResults = new ArrayList<>(points.size()); for (int placeIndex = 0; placeIndex < points.size(); placeIndex++) { GHPoint point = points.get(placeIndex); QueryResult res; if(ghRequest.hasPointHints()){ res = locationIndex.findClosest(point.lat, point.lon, new NameSimilarityEdgeFilter(edgeFilter, ghRequest.getPointHint(placeIndex))); if(!res.isValid()){ res = locationIndex.findClosest(point.lat, point.lon, edgeFilter); } }else{ res = locationIndex.findClosest(point.lat, point.lon, edgeFilter); } if (!res.isValid()) ghResponse.addError(new PointNotFoundException("Cannot find point " + placeIndex + ": " + point, placeIndex)); queryResults.add(res); } return queryResults; }
Source:
<code>public String getDetailedMessage(Type keyType, ConnectorSession session) { <START> return format("Duplicate keys (%s) are not allowed in map", keyType.getObjectValue(session, block, position)); <END> }</code><technical_language>Duplicate map keys (%s) allowed</technical_language>

Target:
public String getDetailedMessage(Type keyType, ConnectorSession session) { return format("Duplicate map keys (%s) are not allowed", keyType.getObjectValue(session, block, position)); }
Source:
<code>public void testUnapplyAll() throws ExecutionException { EasyMock.expect(reverseLookupCache.get(EasyMock.eq("value"), EasyMock.anyObject(Callable.class))) .andReturn(Lists.newArrayList("key")) .once(); EasyMock.replay(reverseLookupCache); Assert.assertEquals( ImmutableMap.of("value", Lists.newArrayList("key")), <START> loadingLookup.unapplyAll(ImmutableSet.<String>of("value")) <END> ); EasyMock.verify(reverseLookupCache); }</code><technical_language>please remove unnecessary type argument</technical_language>

Target:
public void testUnapplyAll() throws ExecutionException { EasyMock.expect(reverseLookupCache.get(EasyMock.eq("value"), EasyMock.anyObject(Callable.class))) .andReturn(Collections.singletonList("key")) .once(); EasyMock.replay(reverseLookupCache); Assert.assertEquals(ImmutableMap.of("value", Collections.singletonList("key")), loadingLookup.unapplyAll(ImmutableSet.of("value"))); EasyMock.verify(reverseLookupCache); }
Source:
<code>private static boolean isGoogRequireCall(Node statement) { if (statement == null) { return false; } if (!statement.isExprResult()) { return false; } if (statement.getFirstChild() == null) { return false; } Node googRequireCall = statement.getFirstChild(); <START> return googRequireCall != null <END> && googRequireCall.isCall() && googRequireCall.getFirstChild().matchesQualifiedName("goog.require"); }</code><technical_language>null-check child twice. I drop getFirstChild() == null "if" block</technical_language>

Target:
private static boolean isGoogRequireCall(Node statement) { if (statement == null) { return false; } if (!statement.isExprResult()) { return false; } Node googRequireCall = statement.getFirstChild(); return googRequireCall != null && googRequireCall.isCall() && googRequireCall.getFirstChild().matchesQualifiedName("goog.require"); }
Source:
<code>public void testConstructorWithUnparseablePath() throws IOException { Path unparseablePath = (new File(".")).toPath().resolve("UnparseableTagFolderName"); try { Tag tag = new ConfigurationTag(unparseablePath); <START> } catch (ParseException e) { <END> Assert.assertTrue(true); return; } Assert.assertTrue("Error: ParseException has not been thrown!", false); }</code><technical_language>y @Test (expected...)</technical_language>

Target:
public void testConstructorWithUnparseablePath() throws IOException, ParseException { Path unparseablePath = (new File(".")).toPath().resolve("UnparseableTagFolderName"); Tag tag = new ConfigurationTag(unparseablePath); }
Source:
<code>static boolean isDefaultArgumentsConstructor(final MethodNode methodNode) { <START> if (!methodNode.name.equals("<init>")) { <END> return false; } final Type[] argumentTypes = Type.getMethodType(methodNode.desc) .getArgumentTypes(); if (argumentTypes.length < 2) { return false; } return "kotlin.jvm.internal.DefaultConstructorMarker" .equals(argumentTypes[argumentTypes.length - 1].getClassName()); }</code><technical_language>"<init>".equals() is null safe consistent check in this method</technical_language>

Target:
static boolean isDefaultArgumentsConstructor(final MethodNode methodNode) { if (!"<init>".equals(methodNode.name)) { return false; } final Type[] argumentTypes = Type.getMethodType(methodNode.desc) .getArgumentTypes(); if (argumentTypes.length < 2) { return false; } return "kotlin.jvm.internal.DefaultConstructorMarker" .equals(argumentTypes[argumentTypes.length - 1].getClassName()); }
Source:
<code>private void changeDate() { DateChooser dc = new DateChooser(frame, date); if (dc.showDateChooser() == DateChooser.OK_OPTION) { if (scenario.isCurrent()) { if (dc.getDate().isBefore(campaign.getLocalDate())) { JOptionPane.showMessageDialog(frame, "You cannot choose a date before the current date for a pending battle.", "Invalid date", JOptionPane.ERROR_MESSAGE); return; } else { <START> LocalDate nextMonday = campaign.getLocalDate() <END> .plusDays(8 - campaign.getLocalDate().getDayOfWeek().getValue()); if (!dc.getDate().isBefore(nextMonday)) { JOptionPane.showMessageDialog(frame, "You cannot choose a date beyond the current week.", "Invalid date", JOptionPane.ERROR_MESSAGE); return; } } } else if (dc.getDate().isAfter(campaign.getLocalDate())) { JOptionPane.showMessageDialog(frame, "You cannot choose a date after the current date.", "Invalid date", JOptionPane.ERROR_MESSAGE); return; } date = dc.getDate(); btnDate.setText(campaign.getCampaignOptions().getDisplayFormattedDate(date)); } }</code><technical_language>TemporalAdjusters</technical_language>

Target:
private void changeDate() { DateChooser dc = new DateChooser(frame, date); if (dc.showDateChooser() == DateChooser.OK_OPTION) { if (scenario.isCurrent()) { if (dc.getDate().isBefore(campaign.getLocalDate())) { JOptionPane.showMessageDialog(frame, "You cannot choose a date before the current date for a pending battle.", "Invalid date", JOptionPane.ERROR_MESSAGE); return; } else { LocalDate nextMonday = campaign.getLocalDate().with(TemporalAdjusters.nextOrSame(DayOfWeek.MONDAY)); if (!dc.getDate().isBefore(nextMonday)) { JOptionPane.showMessageDialog(frame, "You cannot choose a date beyond the current week.", "Invalid date", JOptionPane.ERROR_MESSAGE); return; } } } else if (dc.getDate().isAfter(campaign.getLocalDate())) { JOptionPane.showMessageDialog(frame, "You cannot choose a date after the current date.", "Invalid date", JOptionPane.ERROR_MESSAGE); return; } date = dc.getDate(); btnDate.setText(campaign.getCampaignOptions().getDisplayFormattedDate(date)); } }
Source:
<code>public void connect() throws IOException { synchronized (lock) { if (!connected) { if (sslSocketFactory == null) { throw new SocketException("sslSocketFactory is null when connecting through SSL"); } sslSocket = (SSLSocket) sslSocketFactory.createSocket(host, port); <START> if (readBufferSize > 0) { <END> sslSocket.setReceiveBufferSize(readBufferSize); } if (writeBufferSize > 0) { sslSocket.setSendBufferSize(writeBufferSize); } sslSocket.setSoTimeout(readTimeoutMs); sslSocket.setKeepAlive(true); sslSocket.setTcpNoDelay(true); sslSocket.startHandshake(); writeChannel = Channels.newChannel(sslSocket.getOutputStream()); readChannel = sslSocket.getInputStream(); connected = true; logger.debug( "Created socket with SO_TIMEOUT = (requested {}), SO_RCVBUF = (requested {}), SO_SNDBUF = (requested {})", sslSocket.getSoTimeout(), readTimeoutMs, sslSocket.getReceiveBufferSize(), readBufferSize, sslSocket.getSendBufferSize(), writeBufferSize); } } }</code><technical_language>if this true, defaults</technical_language>

Target:
public void connect() throws IOException { synchronized (lock) { if (!connected) { sslSocket = (SSLSocket) sslSocketFactory.createSocket(host, port); if (readBufferSize > 0) { sslSocket.setReceiveBufferSize(readBufferSize); } if (writeBufferSize > 0) { sslSocket.setSendBufferSize(writeBufferSize); } sslSocket.setSoTimeout(readTimeoutMs); sslSocket.setKeepAlive(true); sslSocket.setTcpNoDelay(true); sslSocket.startHandshake(); writeChannel = Channels.newChannel(sslSocket.getOutputStream()); readChannel = sslSocket.getInputStream(); connected = true; logger.debug( "Created socket with SO_TIMEOUT = (requested {}), SO_RCVBUF = (requested {}), SO_SNDBUF = (requested {})", sslSocket.getSoTimeout(), readTimeoutMs, sslSocket.getReceiveBufferSize(), readBufferSize, sslSocket.getSendBufferSize(), writeBufferSize); } } }
Source:
<code>protected void validate(int attachmentIndex) throws ServiceValidationException { if ((this.fileName == null || this.fileName.isEmpty()) <START> && (this.content == null) && (this.contentStream == null)) { <END> throw new ServiceValidationException(String.format( Strings.FileAttachmentContentIsNotSet, attachmentIndex)); } }</code><technical_language>unnecessary parenthesis here</technical_language>

Target:
protected void validate(int attachmentIndex) throws ServiceValidationException { if ((this.fileName == null || this.fileName.isEmpty()) && this.content == null && this.contentStream == null) { throw new ServiceValidationException(String.format( Strings.FileAttachmentContentIsNotSet, attachmentIndex)); } }
Source:
<code>public Mono<Void> uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions accessConditions) { final ParallelTransferOptions finalParallelTransferOptions = parallelTransferOptions == null ? new ParallelTransferOptions() : parallelTransferOptions; try { return Mono.using(() -> uploadFileResourceSupplier(filePath), channel -> { try { long fileSize = channel.size(); <START> if (fileSize > 256 * Constants.MB) { <END> return uploadBlocks(fileSize, finalParallelTransferOptions, headers, metadata, tier, accessConditions, channel); } else { return uploadFullBlob(headers, metadata, tier, accessConditions, channel, fileSize); } } catch (IOException ex) { return Mono.error(new UncheckedIOException(ex)); } }, this::uploadFileCleanup); } catch (RuntimeException ex) { return monoError(logger, ex); } }</code><technical_language>matters a ton right now, ultimately this configurable in future. Customers pretty quick ask for this in v11, do well. I 256 is a good default service limit else is a guess</technical_language>

Target:
public Mono<Void> uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions accessConditions) { try { return Mono.using(() -> uploadFileResourceSupplier(filePath), channel -> { try { BlockBlobAsyncClient blockBlobAsyncClient = getBlockBlobAsyncClient(); long fileSize = channel.size(); if (fileSize > 256 * Constants.MB) { return uploadBlocks(fileSize, parallelTransferOptions, headers, metadata, tier, accessConditions, channel, blockBlobAsyncClient); } else { return blockBlobAsyncClient.uploadWithResponse(FluxUtil.readFile(channel), fileSize, headers, metadata, tier, accessConditions) .then(); } } catch (IOException ex) { return Mono.error(ex); } }, this::uploadFileCleanup); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>public void remove(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("id", id); getCallsHandler().executeModification("Deletevm_interface", parameterSource); <START> DbFacade.getInstance().getVmInterfaceDynamic().remove(id); <END> }</code><technical_language>I disagree this is right place for it, hiding this logic in unrelated place, I this call needs done explicitly remove is called (as is case for statistics)</technical_language>

Target:
public void remove(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("id", id); getCallsHandler().executeModification("Deletevm_interface", parameterSource); }
Source:
<code>public void write(AsyncHttpRequest request, DataSink sink, CompletedCallback completed) { <START> Util.pump(stream, sink, completed); <END> }</code><technical_language>a variant of Util.pump takes a length argument: java public static void pump(final InputStream is, final int max, final DataSink ds, final CompletedCallback callback) See: max. that, read more bytes stream</technical_language>

Target:
public void write(AsyncHttpRequest request, DataSink sink, CompletedCallback completed) { Util.pump(stream, this.length, sink, completed); }
Source:
<code>@Override public boolean add(E element) { lock.lock(); try { queue.add(element); nonEmpty.signal(); return true; } catch (IOException e) { QueueFile.<Error>getSneakyThrowable(e); <START> return false; <END> } finally { lock.unlock(); } }</code><technical_language>throw QueueFile.<Error>getSneakyThrowable(e);? need unreachable return statement</technical_language>

Target:
@Override public boolean add(E element) { lock.lock(); try { queue.add(element); nonEmpty.signal(); return true; } catch (IOException e) { throw QueueFile.<Error>getSneakyThrowable(e); } finally { lock.unlock(); } }
Source:
<code>public MavenExecutionPlan calculateExecutionPlan(final MavenProject project, final List<String> goals, final boolean setup, final IProgressMonitor monitor) throws CoreException { <START> return context().execute(project, new ICallable<MavenExecutionPlan>() { <END> public MavenExecutionPlan call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException { return calculateExecutionPlan(context.getSession(), project, goals, setup, monitor); } }, monitor); }</code><technical_language>unnecessary change</technical_language>

Target:
public MavenExecutionPlan calculateExecutionPlan(final MavenProject project, final List<String> goals, final boolean setup, final IProgressMonitor monitor) throws CoreException { return context().execute(project, (context, pm) -> calculateExecutionPlan(context.getSession(), project, goals, setup, pm), monitor); }
Source:
<code>protected int ensureCumulatives(int high) { if (allValid) { return highToBitmap.size(); } else if (compare(high, firstHighNotValid) < 0) { int position = binarySearch(sortedHighs, high); if (position >= 0) { return position + 1; } else { int insertionPosition = -position - 1; return insertionPosition; } } else { SortedMap<Integer, BitmapDataProvider> tailMap = highToBitmap.tailMap(firstHighNotValid, true); <START> int indexOk = highToBitmap.size() - tailMap.size(); <END> Iterator<Entry<Integer, BitmapDataProvider>> it = tailMap.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, BitmapDataProvider> e = it.next(); int currentHigh = e.getKey(); if (compare(currentHigh, high) > 0) { break; } else if (e.getValue().isEmpty()) { if (latestAddedHigh != null && latestAddedHigh.getKey().intValue() == currentHigh) { latestAddedHigh = null; } it.remove(); } else { ensureOne(e, currentHigh, indexOk); indexOk++; } } if (highToBitmap.isEmpty() || indexOk == highToBitmap.values().size()) { allValid = true; } return indexOk; } }</code><technical_language>for index of firstHighNotValid instead, if want avoid call other iterator</technical_language>

Target:
protected int ensureCumulatives(int high) { if (allValid) { return highToBitmap.size(); } else if (compare(high, firstHighNotValid) < 0) { int position = binarySearch(sortedHighs, high); if (position >= 0) { return position + 1; } else { int insertionPosition = -position - 1; return insertionPosition; } } else { SortedMap<Integer, BitmapDataProvider> tailMap = highToBitmap.tailMap(firstHighNotValid, true); int indexOk = highToBitmap.size() - tailMap.size(); Iterator<Entry<Integer, BitmapDataProvider>> it = tailMap.entrySet().iterator(); while (it.hasNext()) { Entry<Integer, BitmapDataProvider> e = it.next(); int currentHigh = e.getKey(); if (compare(currentHigh, high) > 0) { break; } else if (e.getValue().isEmpty()) { if (latestAddedHigh != null && latestAddedHigh.getKey().intValue() == currentHigh) { latestAddedHigh = null; } it.remove(); } else { ensureOne(e, currentHigh, indexOk); indexOk++; } } if (highToBitmap.isEmpty() || indexOk == highToBitmap.size()) { allValid = true; } return indexOk; } }
Source:
<code>public void setAndGetAttachmentsTest() throws Exception { String attachmentName = "attachment_1.txt"; MutableDocumentRevision rev_1Mut = new MutableDocumentRevision(); rev_1Mut.body = bodyOne; BasicDocumentRevision rev_1 = datastore.createDocumentFromRevision(rev_1Mut); File f = TestUtils.loadFixture("fixture/" + attachmentName); Attachment att = new UnsavedFileAttachment(f, "text/plain"); BasicDocumentRevision newRevision = null; try { MutableDocumentRevision rev1_mut = rev_1.mutableCopy(); rev1_mut.attachments.put(attachmentName, att); newRevision = datastore.updateDocumentFromRevision(rev1_mut); } catch (ConflictException ce) { Assert.fail("ConflictException thrown: " + ce); } FileInputStream fis = null; try { byte[] expectedSha1 = Misc.getSha1((fis = new FileInputStream(f))); SavedAttachment savedAtt = (SavedAttachment) datastore.getAttachment(newRevision, attachmentName); Assert.assertArrayEquals(expectedSha1, savedAtt.key); SavedAttachment savedAtt2 = (SavedAttachment) datastore.attachmentsForRevision (newRevision).get(0); Assert.assertArrayEquals(expectedSha1, savedAtt2.key); } catch (FileNotFoundException fnfe) { Assert.fail("FileNotFoundException thrown " + fnfe); } finally { <START> if (fis != null) { <END> fis.close(); } } }</code><technical_language>closeQuietly before, need do null check</technical_language>

Target:
public void setAndGetAttachmentsTest() throws Exception { String attachmentName = "attachment_1.txt"; MutableDocumentRevision rev_1Mut = new MutableDocumentRevision(); rev_1Mut.body = bodyOne; BasicDocumentRevision rev_1 = datastore.createDocumentFromRevision(rev_1Mut); File f = TestUtils.loadFixture("fixture/"+attachmentName); Attachment att = new UnsavedFileAttachment(f, "text/plain"); BasicDocumentRevision newRevision = null; try { MutableDocumentRevision rev1_mut = rev_1.mutableCopy(); rev1_mut.attachments.put(attachmentName, att); newRevision = datastore.updateDocumentFromRevision(rev1_mut); } catch (ConflictException ce){ Assert.fail("ConflictException thrown: "+ce); } FileInputStream fis = null; try { byte[] expectedSha1 = Misc.getSha1((fis = new FileInputStream(f))); SavedAttachment savedAtt = (SavedAttachment) datastore.getAttachment(newRevision, attachmentName); Assert.assertArrayEquals(expectedSha1, savedAtt.key); SavedAttachment savedAtt2 = (SavedAttachment) datastore.attachmentsForRevision (newRevision).get(0); Assert.assertArrayEquals(expectedSha1, savedAtt2.key); } catch (FileNotFoundException fnfe) { Assert.fail("FileNotFoundException thrown " + fnfe); } finally { IOUtils.closeQuietly(fis); } }
Source:
<code>public ClientCacheSqlFieldsQueryRequest(BinaryRawReaderEx reader) { super(reader); String schema = reader.readString(); int pageSize = reader.readInt(); reader.readInt(); String sql = reader.readString(); Object[] args = PlatformCache.readQueryArgs(reader); JdbcStatementType stmtType = JdbcStatementType.fromOrdinal(reader.readByte()); boolean distributedJoins = reader.readBoolean(); boolean loc = reader.readBoolean(); boolean replicatedOnly = reader.readBoolean(); boolean enforceJoinOrder = reader.readBoolean(); boolean collocated = reader.readBoolean(); boolean lazy = reader.readBoolean(); int timeout = (int) reader.readLong(); includeFieldNames = reader.readBoolean(); SqlFieldsQuery qry = stmtType == JdbcStatementType.ANY_STATEMENT_TYPE ? new SqlFieldsQuery(sql) : new SqlFieldsQueryEx(sql,stmtType == JdbcStatementType.SELECT_STATEMENT_TYPE); qry.setSchema(schema) .setPageSize(pageSize) .setArgs(args) .setDistributedJoins(distributedJoins) .setLocal(loc) .setReplicatedOnly(replicatedOnly) .setEnforceJoinOrder(enforceJoinOrder) .setCollocated(collocated) .setLazy(lazy); <START> if (timeout >= 0) { <END> qry.setTimeout(timeout, TimeUnit.MILLISECONDS); } this.qry = qry; }</code><technical_language>Curly braces redundant code style</technical_language>

Target:
public ClientCacheSqlFieldsQueryRequest(BinaryRawReaderEx reader) { super(reader); String schema = reader.readString(); int pageSize = reader.readInt(); reader.readInt(); String sql = reader.readString(); Object[] args = PlatformCache.readQueryArgs(reader); JdbcStatementType stmtType = JdbcStatementType.fromOrdinal(reader.readByte()); boolean distributedJoins = reader.readBoolean(); boolean loc = reader.readBoolean(); boolean replicatedOnly = reader.readBoolean(); boolean enforceJoinOrder = reader.readBoolean(); boolean collocated = reader.readBoolean(); boolean lazy = reader.readBoolean(); int timeout = (int) reader.readLong(); includeFieldNames = reader.readBoolean(); SqlFieldsQuery qry = stmtType == JdbcStatementType.ANY_STATEMENT_TYPE ? new SqlFieldsQuery(sql) : new SqlFieldsQueryEx(sql,stmtType == JdbcStatementType.SELECT_STATEMENT_TYPE); qry.setSchema(schema) .setPageSize(pageSize) .setArgs(args) .setDistributedJoins(distributedJoins) .setLocal(loc) .setReplicatedOnly(replicatedOnly) .setEnforceJoinOrder(enforceJoinOrder) .setCollocated(collocated) .setLazy(lazy); if (timeout >= 0) qry.setTimeout(timeout, TimeUnit.MILLISECONDS); this.qry = qry; }
Source:
<code>public HttpResponse handleException(RequestContext ctx, HttpRequest req, Throwable cause) { ZipkinHttpCollector.metrics.incrementMessagesDropped(); <START> LOGGER.warn("Unexpected error handling request.", cause); <END> String message = cause.getMessage() != null ? cause.getMessage() : ""; if (cause instanceof IllegalArgumentException) { return HttpResponse.of(BAD_REQUEST, MediaType.ANY_TEXT_TYPE, message); } else { return HttpResponse.of(INTERNAL_SERVER_ERROR, MediaType.ANY_TEXT_TYPE, message); } }</code><technical_language>want add this logging in cases. verbose for bad requests</technical_language>

Target:
public HttpResponse handleException(RequestContext ctx, HttpRequest req, Throwable cause) { ZipkinHttpCollector.metrics.incrementMessagesDropped(); String message = cause.getMessage() != null ? cause.getMessage() : ""; if (cause instanceof IllegalArgumentException) { return HttpResponse.of(BAD_REQUEST, MediaType.ANY_TEXT_TYPE, message); } else { LOGGER.warn("Unexpected error handling request.", cause); return HttpResponse.of(INTERNAL_SERVER_ERROR, MediaType.ANY_TEXT_TYPE, message); } }
Source:
<code>public void shouldRejectNotValidAuthorizationString() throws Exception { SecurityDomain securityDomainMock = mock(SecurityDomain.class); BasicAuthenticator basicAuthenticator = new BasicAuthenticator(securityDomainMock, "ApplicationRealm"); <START> restServer = RestServerHelper.defaultRestServer().withAuthenticator(basicAuthenticator).start(this.getTestName()); <END> ContentResponse response = client .newRequest(String.format("http://localhost:%d/rest/%s/%s", restServer.getPort(), "default", "test")) .method(HttpMethod.GET) .header(HttpHeader.AUTHORIZATION, "Invalid string") .send(); ResponseAssertion.assertThat(response).isUnauthorized(); }</code><technical_language>current's thread name (which a Surefire fork) grabbing test name explicitly. This start method need accept parameters</technical_language>

Target:
public void shouldRejectNotValidAuthorizationString() throws Exception { SecurityDomain securityDomainMock = mock(SecurityDomain.class); BasicAuthenticator basicAuthenticator = new BasicAuthenticator(securityDomainMock, "ApplicationRealm"); restServer = RestServerHelper.defaultRestServer().withAuthenticator(basicAuthenticator).start(TestResourceTracker.getCurrentTestShortName()); ContentResponse response = client .newRequest(String.format("http://localhost:%d/rest/%s/%s", restServer.getPort(), "default", "test")) .method(HttpMethod.GET) .header(HttpHeader.AUTHORIZATION, "Invalid string") .send(); ResponseAssertion.assertThat(response).isUnauthorized(); }
Source:
<code>public void processLti(HttpServletRequest request, HttpServletResponse response) throws IOException { for (Object e : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) e; String name = entry.getKey(); for (String value : entry.getValue()) { M_log.debug(name + " = " + value); } } if(appExtSecurePropertiesFile!=null) { ltiKey = appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_LTI_KEY); ltiSecret = appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_LTI_SECRET); <START> ltiUrl = request.getRequestURL().toString(); <END> M_log.debug("ltiKey: " + ltiKey); M_log.debug("ltiSecret: " + ltiSecret); M_log.debug("ltiUrl: " + ltiUrl); } else { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); M_log.error("Failed to load system properties(sectionsToolProps.properties) for SectionsTool"); return; } if(RequestSignatureUtils.verifySignature(request, ltiKey, ltiSecret, ltiUrl)){ doRequest(request, response); return; } doError(request, response, "Missing required parameter: Launch type or version is incorrect."); return; }</code><technical_language>changed is necessary read ltiUlr a property anymore</technical_language>

Target:
public void processLti(HttpServletRequest request, HttpServletResponse response) throws IOException { for (Object e : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) e; String name = entry.getKey(); for (String value : entry.getValue()) { M_log.debug(name + " = " + value); } } if(appExtSecurePropertiesFile!=null) { ltiKey = appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_LTI_KEY); ltiSecret = appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_LTI_SECRET); if(appExtPropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_LTI_URL) != null){ ltiUrl = appExtPropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_LTI_URL); } else{ ltiUrl = request.getRequestURL().toString(); } M_log.debug("ltiKey: " + ltiKey); M_log.debug("ltiSecret: " + ltiSecret); M_log.debug("ltiUrl: " + ltiUrl); } else { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); M_log.error("Failed to load system properties(sectionsToolProps.properties) for SectionsTool"); return; } if(RequestSignatureUtils.verifySignature(request, ltiKey, ltiSecret, ltiUrl)){ doRequest(request, response); return; } doError(request, response, "Missing required parameter: Launch type or version is incorrect."); return; }
Source:
<code>protected String[] customCommandLineValidation() { final List<String> errorMsgs = new ArrayList<>(); if (SCATTER_COUNT < 1) { errorMsgs.add("SCATTER_COUNT must be greater than 0."); } if (BREAK_BANDS_AT_MULTIPLES_OF < 0) { errorMsgs.add("BREAK_BANDS_AT_MULTIPLES_OF must be greater than or equal to 0."); } if ((SECOND_INPUT == null || SECOND_INPUT.isEmpty()) && ACTION.takesSecondInput) { errorMsgs.add("SECOND_INPUT was not provided but action " + ACTION + " requires a second input."); } if ((SECOND_INPUT != null && !SECOND_INPUT.isEmpty()) && !ACTION.takesSecondInput) { errorMsgs.add("SECOND_INPUT was provided but action " + ACTION + " doesn't take a second input."); } <START> if(COUNT_OUTPUT != null && OUTPUT_VALUE == Output.NONE) { <END> errorMsgs.add("COUNT_OUTPUT was provided but OUTPUT_VALUE is set to NONE."); } if(COUNT_OUTPUT == null && OUTPUT_VALUE != Output.NONE) { errorMsgs.add("OUTPUT_VALUE is set to "+OUTPUT_VALUE+" but COUNT_OUTPUT was not provided."); } return errorMsgs.isEmpty() ? null : errorMsgs.toArray(new String[errorMsgs.size()]); }</code><technical_language>suggestion if (COUNT_OUTPUT != null && OUTPUT_VALUE == Output.NONE) {</technical_language>

Target:
protected String[] customCommandLineValidation() { final List<String> errorMsgs = new ArrayList<>(); if (SCATTER_COUNT < 1) { errorMsgs.add("SCATTER_COUNT must be greater than 0."); } if (BREAK_BANDS_AT_MULTIPLES_OF < 0) { errorMsgs.add("BREAK_BANDS_AT_MULTIPLES_OF must be greater than or equal to 0."); } if ((SECOND_INPUT == null || SECOND_INPUT.isEmpty()) && ACTION.takesSecondInput) { errorMsgs.add("SECOND_INPUT was not provided but action " + ACTION + " requires a second input."); } if ((SECOND_INPUT != null && !SECOND_INPUT.isEmpty()) && !ACTION.takesSecondInput) { errorMsgs.add("SECOND_INPUT was provided but action " + ACTION + " doesn't take a second input."); } if (COUNT_OUTPUT != null && OUTPUT_VALUE == Output.NONE) { errorMsgs.add("COUNT_OUTPUT was provided but OUTPUT_VALUE is set to NONE."); } return errorMsgs.isEmpty() ? null : errorMsgs.toArray(new String[errorMsgs.size()]); }