auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void login( HttpServletRequest request, HttpServletResponse response, SsoSession ssoSession) throws Exception { log.debug("Entered login queryString: {}", request.getQueryString()); String redirectUrl; <START> String scope = SsoUtils.getScopeRequestParameter(request, ""); <END> if (SsoUtils.isUserAuthenticated(request)) { log.debug("User is authenticated redirecting to interactive-redirect-to-module"); redirectUrl = request.getContextPath() + SsoConstants.INTERACTIVE_REDIRECT_TO_MODULE_URI; } else if (SsoUtils.scopeAsList(scope).contains("ovirt-ext=auth:identity")) { redirectUrl = new URLBuilder(SsoUtils.getRedirectUrl(request)) .addParameter(SsoConstants.ERROR, SsoConstants.ERR_OVIRT_CODE_NOT_AUTHENTICATED) .addParameter(SsoConstants.ERROR_DESCRIPTION, SsoConstants.ERR_CODE_NOT_AUTHENTICATED_MSG).build(); } else { ssoSession.setAuthStack(getAuthSeq(ssoSession)); if (ssoSession.getAuthStack().isEmpty()) { throw new OAuthException(SsoConstants.ERR_CODE_ACCESS_DENIED, ssoContext.getLocalizationUtils().localize( SsoConstants.APP_ERROR_NO_VALID_AUTHENTICATION_MECHANISM_FOUND, (Locale) request.getAttribute(SsoConstants.LOCALE))); } redirectUrl = request.getContextPath() + SsoConstants.INTERACTIVE_LOGIN_NEXT_AUTH_URI; } log.debug("Redirecting to url: {}", redirectUrl); response.sendRedirect(redirectUrl); }</code><technical_language>this statement is relevant in context of 'else' part of line 114, extract method iline it: } else if (scopeContainsAuthIdentity(request)) { ... } private boolean scopeContainsAuthIdentity(HttpServletRequest request) { String scope = SsoUtils.getScopeRequestParameter(request, ""); return SsoUtils.scopeAsList(scope).contains("ovirt-ext=auth:identity"); }</technical_language>

Target:
protected void login( HttpServletRequest request, HttpServletResponse response, SsoSession ssoSession) throws Exception { log.debug("Entered login queryString: {}", request.getQueryString()); String redirectUrl; if (SsoUtils.isUserAuthenticated(request)) { log.debug("User is authenticated redirecting to interactive-redirect-to-module"); redirectUrl = request.getContextPath() + SsoConstants.INTERACTIVE_REDIRECT_TO_MODULE_URI; } else if (SsoUtils.scopeAsList(SsoUtils.getScopeRequestParameter(request, "")) .contains("ovirt-ext=auth:identity")) { redirectUrl = new URLBuilder(SsoUtils.getRedirectUrl(request)) .addParameter(SsoConstants.ERROR, SsoConstants.ERR_OVIRT_CODE_NOT_AUTHENTICATED) .addParameter(SsoConstants.ERROR_DESCRIPTION, SsoConstants.ERR_CODE_NOT_AUTHENTICATED_MSG).build(); } else { ssoSession.setAuthStack(getAuthSeq(ssoSession)); if (ssoSession.getAuthStack().isEmpty()) { throw new OAuthException(SsoConstants.ERR_CODE_ACCESS_DENIED, ssoContext.getLocalizationUtils().localize( SsoConstants.APP_ERROR_NO_VALID_AUTHENTICATION_MECHANISM_FOUND, (Locale) request.getAttribute(SsoConstants.LOCALE))); } redirectUrl = request.getContextPath() + SsoConstants.INTERACTIVE_LOGIN_NEXT_AUTH_URI; } log.debug("Redirecting to url: {}", redirectUrl); response.sendRedirect(redirectUrl); }
Source:
<code>private void renderLatexLineWidget(final Range range, final String text, final MathJaxTypesetCallback callback) { endRender(); final int row = range.getEnd().getRow(); LineWidget widget = docDisplay_.getLineWidgetForRow(row); if (widget == null) { if (pendingLineWidgets_.contains(row)) return; pendingLineWidgets_.add(row); createMathJaxLineWidget(row, range.getStart().getRow() == range.getEnd().getRow(), new CommandWithArg<LineWidget>() { @Override public void execute(LineWidget w) { <START> pendingLineWidgets_.remove(row); <END> renderLatexLineWidget(w, range, text, callback); } }); } else { pendingLineWidgets_.remove(row); renderLatexLineWidget(widget, range, text, callback); } }</code><technical_language>a number of failure modes row get stuck in a permanently pending state render a line widget (e.g. if exception is thrown in createMathJaxLineWidget of other codepaths execute prepare for running callback, if callback get invoked). iterating existing set of PinnedLineWidget objects if bound row</technical_language>

Target:
private void renderLatexLineWidget(final Range range, final String text, final MathJaxTypesetCallback callback) { endRender(); final int row = range.getEnd().getRow(); LineWidget widget = docDisplay_.getLineWidgetForRow(row); if (widget == null) { for (Map.Entry<ChunkOutputWidget, PinnedLineWidget> entry : cowToPlwMap_.entrySet()) if (entry.getValue().getRow() == row) return; createMathJaxLineWidget(row, range.getStart().getRow() == range.getEnd().getRow(), new CommandWithArg<LineWidget>() { @Override public void execute(LineWidget w) { renderLatexLineWidget(w, range, text, callback); } }); } else { renderLatexLineWidget(widget, range, text, callback); } }
Source:
<code>public void shouldEnrollPatientInDSDMProgramWhenDSDMIsSelectedOnNewForm() throws Exception { Patient patient = new Patient(1393); ProgramWorkflowService service = Context.getService(ProgramWorkflowService.class); HtmlForm htmlForm1 = new HtmlForm(); htmlForm1.setXmlData(xml); Form form1 = new Form(8); form1.setEncounterType(new EncounterType(15)); htmlForm1.setForm(form1); FormEntrySession session1 = new FormEntrySession(patient, null, FormEntryContext.Mode.ENTER, htmlForm1, new MockHttpSession()); session1.getHtmlToDisplay(); session1.prepareForSubmit(); HttpServletRequest request = mock(MockHttpServletRequest.class); when(request.getParameter("w1")).thenReturn("2017-04-01"); when(request.getParameter("w8")).thenReturn("165139"); session1.getSubmissionController().handleFormSubmission(session1, request); session1.applyActions(); List<PatientProgram> patientProgramList = getPatientPrograms(patient, null,null,null,false); Assert.assertEquals(service.getProgramByName("FTR"), patientProgramList.get(1).getProgram()); Assert.assertEquals(service.getProgramByName("FBIM"), patientProgramList.get(0).getProgram()); Assert.assertEquals(patientProgramList.get(1).getDateEnrolled(), patientProgramList.get(0).getDateCompleted()); <START> } <END></code><technical_language>@slubwama Break 2 Assertions hardcoded date in line 72 - dates correct null this test passes</technical_language>

Target:
public void shouldEnrollPatientInDSDMProgramWhenDSDMIsSelectedOnNewForm() throws Exception { Patient patient = new Patient(1393); ProgramWorkflowService service = Context.getService(ProgramWorkflowService.class); HtmlForm htmlForm1 = new HtmlForm(); htmlForm1.setXmlData(xml); Form form1 = new Form(8); form1.setEncounterType(new EncounterType(15)); htmlForm1.setForm(form1); FormEntrySession session1 = new FormEntrySession(patient, null, FormEntryContext.Mode.ENTER, htmlForm1, new MockHttpSession()); session1.getHtmlToDisplay(); session1.prepareForSubmit(); HttpServletRequest request = mock(MockHttpServletRequest.class); when(request.getParameter("w1")).thenReturn("2017-04-01"); when(request.getParameter("w8")).thenReturn("165139"); session1.getSubmissionController().handleFormSubmission(session1, request); session1.applyActions(); List<PatientProgram> patientProgramList = getPatientPrograms(patient, null,null,null,false); Assert.assertEquals(service.getProgramByName("FTR"), patientProgramList.get(1).getProgram()); Assert.assertEquals(service.getProgramByName("FBIM"), patientProgramList.get(0).getProgram()); Assert.assertEquals(session1.getEncounter().getEncounterDatetime(), patientProgramList.get(1).getDateEnrolled()); Assert.assertEquals(patientProgramList.get(1).getDateEnrolled(), patientProgramList.get(0).getDateCompleted()); }
Source:
<code>public static MongoQueryRunner createMongoQueryRunner(Iterable<TpchTable<?>> tables) throws Exception { MongoQueryRunner queryRunner = null; try { queryRunner = new MongoQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = ImmutableMap.of( "mongodb.seeds", queryRunner.getAddress().getHostString() + ":" + queryRunner.getAddress().getPort(), <START> "mongodb.socket-keep-alive", "true", <END> "mongodb.read-preference", "SECONDARY", "mongodb.read-preference-tags", "dc:east,use:reporting&use:reporting"); queryRunner.installPlugin(new MongoPlugin()); queryRunner.createCatalog("mongodb", "mongodb", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner); throw e; } }</code><technical_language>for forth, familiar Mongo, learning I go. I a understanding of tagsets, I tested. I leave this out test tagsets</technical_language>

Target:
public static MongoQueryRunner createMongoQueryRunner(Iterable<TpchTable<?>> tables) throws Exception { MongoQueryRunner queryRunner = null; try { queryRunner = new MongoQueryRunner(createSession(), 3); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); Map<String, String> properties = ImmutableMap.of( "mongodb.seeds", queryRunner.getAddress().getHostString() + ":" + queryRunner.getAddress().getPort(), "mongodb.socket-keep-alive", "true"); queryRunner.installPlugin(new MongoPlugin()); queryRunner.createCatalog("mongodb", "mongodb", properties); copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables); return queryRunner; } catch (Throwable e) { closeAllSuppress(e, queryRunner); throw e; } }
Source:
<code>public void addEntity(Query query, String alias, Class<?> type) { if (query instanceof NativeQuery) { <START> query.unwrap(NativeQuery.class).addEntity(alias, type); <END> } else { throw new IllegalArgumentException(String.format("invalid Query type `%s` in HibernateHandler", query.getClass())); } }</code><technical_language>unwrap is used, doesnt cast a NativeQuery in place. In fact, unwrap introduced prevent need for casts, is important in i.e. J2EE environments Query wrapped in a proxy implement NativeQuery. unwrap throw a PersistenceException if implementation is of requested type. This exception catch rethrow in IllegalArgumentException. a PersistenceException</technical_language>

Target:
public void addEntity(Query query, String alias, Class<?> type) { query.unwrap(NativeQuery.class).addEntity(alias, type); }
Source:
<code><START> private void checkNumColumns(String location, int[] baseColumnMap, Dataset<Row> table) throws StandardException { <END> if( baseColumnMap.length > table.schema().fields().length) { throw StandardException.newException(SQLState.INCONSISTENT_NUMBER_OF_ATTRIBUTE, baseColumnMap.length, table.schema().fields().length, location, ExternalTableUtils.getSuggestedSchema(table.schema())); } }</code><technical_language>nice! static I guess</technical_language>

Target:
private static void checkNumColumns(String location, int[] baseColumnMap, Dataset<Row> table) throws StandardException { if( baseColumnMap.length > table.schema().fields().length) { throw StandardException.newException(SQLState.INCONSISTENT_NUMBER_OF_ATTRIBUTE, baseColumnMap.length, table.schema().fields().length, location, ExternalTableUtils.getSuggestedSchema(table.schema())); } }
Source:
<code>public Map<DiskImage, DiskImage> mapChainToNewIDs(Guid sourceImageGroupID, Guid newImageGroupID, Guid targetStorageDomainID) { List<DiskImage> oldChain = diskImageDao.getAllSnapshotsForImageGroup(sourceImageGroupID); Map<DiskImage, DiskImage> oldToNewChain = new HashMap<>(oldChain.size()); Guid nextParentId = Guid.Empty; sortImageList(oldChain); for (DiskImage diskImage : oldChain) { DiskImage newImage = DiskImage.copyOf(diskImage); newImage.setParentId(nextParentId); newImage.setId(newImageGroupID); <START> newImage.setStorageIds(Collections.singletonList(targetStorageDomainID)); <END> nextParentId = Guid.newGuid(); newImage.setImageId(nextParentId); newImage.setVmSnapshotId(null); oldToNewChain.put(diskImage, newImage); } log.info("New image group {}", newImageGroupID); log.info("mapped old chain to new chain {}", ImagesHandler.getDiskImageIds(oldChain), oldToNewChain); return oldToNewChain; }</code><technical_language>consider java 11 List.of()</technical_language>

Target:
public Map<DiskImage, DiskImage> mapChainToNewIDs(Guid sourceImageGroupID, Guid newImageGroupID, Guid targetStorageDomainID) { List<DiskImage> oldChain = diskImageDao.getAllSnapshotsForImageGroup(sourceImageGroupID); Map<DiskImage, DiskImage> oldToNewChain = new HashMap<>(oldChain.size()); Guid nextParentId = Guid.Empty; sortImageList(oldChain); for (DiskImage diskImage : oldChain) { DiskImage newImage = DiskImage.copyOf(diskImage); newImage.setParentId(nextParentId); newImage.setId(newImageGroupID); newImage.setStorageIds(List.of(targetStorageDomainID)); nextParentId = Guid.newGuid(); newImage.setImageId(nextParentId); newImage.setVmSnapshotId(null); oldToNewChain.put(diskImage, newImage); } log.info("New image group {}", newImageGroupID); log.info("mapped old chain to new chain {}", ImagesHandler.getDiskImageIds(oldChain), oldToNewChain); return oldToNewChain; }
Source:
<code>private String toJavaSymbol(String s) { <START> String javaSymbol = s.replaceAll("[^A-Z-a-z0-9_]", ""); <END> if (!isAlphabetic(javaSymbol.charAt(0))) { javaSymbol = "_" + javaSymbol; } return javaSymbol; }</code><technical_language>do I understand correctly '-' is accepted a java symbol character? In case I is incorrect</technical_language>

Target:
private String toJavaSymbol(String s) { String javaSymbol = s.replaceAll("[^A-Za-z0-9_]", "_"); if (!isAlphabetic(javaSymbol.charAt(0))) { javaSymbol = "_" + javaSymbol; } return javaSymbol; }
Source:
<code>public Or buildInPredicate(final int nodeExpression) throws CQLException { List<Expression> exprList = new LinkedList<Expression>(); while (!getResultStack().empty()) { Result result = getResultStack().peek(); int node = result.getNodeType(); if (node != nodeExpression) { break; } getResultStack().popResult(); Expression expr = (Expression) getResultStack().popExpression(); exprList.add(expr); } assert exprList.size() >= 1 : "must have one or more expressions"; final Expression leftHandExpr = getResultStack().popExpression(); List<Filter> filterList = new LinkedList<Filter>(); for (Expression expression : exprList) { PropertyIsEqualTo eq = getFilterFactory().equals(leftHandExpr, expression); <START> filterList.add(0,eq); <END> } Or orFilter = getFilterFactory().or(filterList); return orFilter; }</code><technical_language>pre-pend instead of append</technical_language>

Target:
public Or buildInPredicate(final int nodeExpression) throws CQLException { List<Expression> exprList = new LinkedList<Expression>(); while (!getResultStack().empty()) { Result result = getResultStack().peek(); int node = result.getNodeType(); if (node != nodeExpression) { break; } getResultStack().popResult(); Expression expr = (Expression) getResultStack().popExpression(); exprList.add(expr); } assert exprList.size() >= 1 : "must have one or more expressions"; final Expression leftHandExpr = getResultStack().popExpression(); List<Filter> filterList = new LinkedList<Filter>(); for (Expression expression : exprList) { PropertyIsEqualTo eq = getFilterFactory().equals(leftHandExpr, expression); filterList.add(eq); } Collections.reverse(filterList); Or orFilter = getFilterFactory().or(filterList); return orFilter; }
Source:
<code>private boolean indexExists(final File vcf) { <START> return !Tribble.indexFile(vcf).exists() && !Tribble.tabixIndexFile(vcf).exists(); <END> }</code><technical_language>this logic backwards. want return true if exists Tribble.indexFile(vcf).exists() || Tribble.tabixIndexFile(vcf).exists()</technical_language>

Target:
private boolean indexExists(final File vcf) { return Tribble.indexFile(vcf).exists() || Tribble.tabixIndexFile(vcf).exists(); }
Source:
<code>private <T> T getLiteralValue(int childIndex, Class<T> type) { Expression expression = getChildren().get(childIndex); if (LOG.isDebugEnabled()) { LOG.debug("child: " + childIndex + ", expression: " + expression); } if (!(expression instanceof LiteralExpression)) { throw new ExpressionEvaluationException(expression); <START> } <END> return type.cast(((LiteralExpression) expression).getValue()); }</code><technical_language>This if statement necessary. Phoenix checks this throws if case based declaration of argument a constant</technical_language>

Target:
private <T> T getLiteralValue(int childIndex, Class<T> type) { Expression expression = getChildren().get(childIndex); if (LOG.isDebugEnabled()) { LOG.debug("child: " + childIndex + ", expression: " + expression); } return type.cast(((LiteralExpression) expression).getValue()); }
Source:
<code>public void calcAutoCompleteSettings(String field, Map<String, Object> attributes) { if (attributes.containsKey("autoCompleteUrl")) { super.calcAutoCompleteSettings(field, attributes); return; } super.calcAutoCompleteSettings(field, attributes); if (attributes.containsKey("autoCompleteUrl")) { try { JellyContext jelly = Functions.getCurrentJellyContext(); Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext(); for (CredentialsSelectHelper.ContextResolver r : ExtensionList .lookup(CredentialsSelectHelper.ContextResolver.class)) { String token = r.getToken(context); if (token != null) { String fillUrl = (String) attributes.get("autoCompleteUrl"); <START> if (fillUrl.indexOf('?') != -1) { <END> fillUrl = fillUrl + '&'; } else { fillUrl = fillUrl + '?'; } attributes.put("autoCompleteUrl", fillUrl + "$provider=" + r.getClass().getName() + "&" + "$token=" + URLEncoder.encode(token, "UTF-8")); } } } } catch (AssertionError e) { } catch (UnsupportedEncodingException e) { } } }</code><technical_language>Check for null</technical_language>

Target:
public void calcAutoCompleteSettings(String field, Map<String, Object> attributes) { if (attributes.containsKey("autoCompleteUrl")) { super.calcAutoCompleteSettings(field, attributes); return; } super.calcAutoCompleteSettings(field, attributes); if (attributes.containsKey("autoCompleteUrl")) { try { JellyContext jelly = Functions.getCurrentJellyContext(); Object it = jelly.findVariable("it"); if (it instanceof CredentialsStore) { ModelObject context = ((CredentialsStore) it).getContext(); for (CredentialsSelectHelper.ContextResolver r : ExtensionList .lookup(CredentialsSelectHelper.ContextResolver.class)) { String token = r.getToken(context); if (token != null) { String autoCompleteUrl = (String) attributes.get("autoCompleteUrl"); if (autoCompleteUrl != null) { if (autoCompleteUrl.indexOf('?') != -1) { autoCompleteUrl = autoCompleteUrl + '&'; } else { autoCompleteUrl = autoCompleteUrl + '?'; } attributes.put("autoCompleteUrl", autoCompleteUrl + "$provider=" + URLEncoder.encode(r.getClass().getName(), "UTF-8") + "&$token=" + URLEncoder.encode(token, "UTF-8")); } } } } } catch (AssertionError e) { } catch (UnsupportedEncodingException e) { } } }
Source:
<code>public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); <START> mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", <END> "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_url", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties" })); }</code><technical_language>need update well</technical_language>

Target:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vmName", "description", "domain", "os", "osType", "creationDate", "numOfMonitors", "allowConsoleReconnect", "usbPolicy", "autoSuspend", "autoStartup", "dedicatedVmForVds", "defaultDisplayType", "priority", "defaultBootSequence", "initrdUrl", "kernelUrl", "kernelParams", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties" })); }
Source:
<code>protected ICommand getAfterMoveCommand(final MoveRequest request) { ICommand moveCommand = super.getAfterMoveCommand(request); Set<View> viewsToDestroy = new HashSet<View>(); Object parameter = request.getParameter(TYPE_MOVING); <START> if ((parameter == null) || (!parameter.equals(TYPE_MOVING_DIAGRAM))) { <END> @SuppressWarnings("unchecked") Iterator<EObject> it = request.getElementsToMove().keySet().iterator(); while (it.hasNext()) { EObject eObject = it.next(); viewsToDestroy.addAll(getMemberViewsToDestroy(eObject)); } Iterator<View> viewToDestroyIterator = viewsToDestroy.iterator(); while (viewToDestroyIterator.hasNext()) { View view = viewToDestroyIterator.next(); DeleteCommand destroyViewsCommand = new DeleteCommand(request.getEditingDomain(), view); moveCommand = CompositeCommand.compose(moveCommand, destroyViewsCommand); } } return moveCommand; }</code><technical_language>null == ... instead</technical_language>

Target:
protected ICommand getAfterMoveCommand(final MoveRequest request) { ICommand moveCommand = super.getAfterMoveCommand(request); Set<View> viewsToDestroy = new HashSet<View>(); Object parameter = request.getParameter(DefaultCreationEditPolicy.TYPE_MOVING); if ((null == parameter) || (!DefaultCreationEditPolicy.TYPE_MOVING_DIAGRAM.equals(parameter))) { @SuppressWarnings("unchecked") Iterator<EObject> it = request.getElementsToMove().keySet().iterator(); while (it.hasNext()) { EObject eObject = it.next(); viewsToDestroy.addAll(getMemberViewsToDestroy(eObject)); } Iterator<View> viewToDestroyIterator = viewsToDestroy.iterator(); while (viewToDestroyIterator.hasNext()) { View view = viewToDestroyIterator.next(); DeleteCommand destroyViewsCommand = new DeleteCommand(request.getEditingDomain(), view); moveCommand = CompositeCommand.compose(moveCommand, destroyViewsCommand); } } return moveCommand; }
Source:
<code>public static ParameterSet fromByteBuffer(ByteBuffer buffer) throws IOException { int startPos = buffer.position(); short count = buffer.getShort(); if (count < 0) { <START> throw new RuntimeException("ParameterSet exceeds the length limitation " + Short.MAX_VALUE); <END> } Object[] params = new Object[count]; byte[][] encodedStrings = null; byte[][][] encodedStringArrays = null; for (int i = 0; i < count; ++i) { OneParamInfo opi = readOneParameter(buffer); params[i] = opi.value; if (opi.encodedString != null) { if (encodedStrings == null) { encodedStrings = new byte[count][]; } encodedStrings[i] = opi.encodedString; } if (opi.encodedStringArray != null) { if (encodedStringArrays == null) { encodedStringArrays = new byte[count][][]; } encodedStringArrays[i] = opi.encodedStringArray; } } int size = buffer.position() - startPos; return new ParameterSet(params, size, encodedStrings, encodedStringArrays); }</code><technical_language>error message is wrong invalid parameter length. add count in message</technical_language>

Target:
public static ParameterSet fromByteBuffer(ByteBuffer buffer) throws IOException { int startPos = buffer.position(); short count = buffer.getShort(); if (count < 0) { throw new IllegalArgumentException("Invalid parameter length " + count + " for ParameterSet." ); } Object[] params = new Object[count]; byte[][] encodedStrings = null; byte[][][] encodedStringArrays = null; for (int i = 0; i < count; ++i) { OneParamInfo opi = readOneParameter(buffer); params[i] = opi.value; if (opi.encodedString != null) { if (encodedStrings == null) { encodedStrings = new byte[count][]; } encodedStrings[i] = opi.encodedString; } if (opi.encodedStringArray != null) { if (encodedStringArrays == null) { encodedStringArrays = new byte[count][][]; } encodedStringArrays[i] = opi.encodedStringArray; } } int size = buffer.position() - startPos; return new ParameterSet(params, size, encodedStrings, encodedStringArrays); }
Source:
<code>private List<String> recursiveFolderUpload(ChannelSftp channelSftp, String sourcePath, String destinationPath) throws SftpException, FileNotFoundException { List<String> filesRelativePathName = new ArrayList<>(); File sourceFile = new File(sourcePath); if (sourceFile.isFile()) { channelSftp.cd(destinationPath); getOut().println("Uploading " + sourcePath); channelSftp.put(new FileInputStream(sourceFile), sourceFile.getName(), ChannelSftp.OVERWRITE); getOut().println("File uploaded successfully to " + Paths.get(destinationPath, sourceFile.getName()).toString()); filesRelativePathName.add(Paths.get(destinationPath, sourceFile.getName()).toString()); } else { String remoteFilePath = Paths.get(destinationPath, sourceFile.getName()).toString(); File[] files = sourceFile.listFiles(); <START> if (files != null && !sourceFile.getName().startsWith(".")) { <END> channelSftp.cd(destinationPath); if (!remoteDirExists(channelSftp, remoteFilePath)) { channelSftp.mkdir(sourceFile.getName()); } for (File f : files) { filesRelativePathName.addAll(recursiveFolderUpload(channelSftp, f.getAbsolutePath(), remoteFilePath)); } } } return filesRelativePathName; }</code><technical_language>consider isHidden()</technical_language>

Target:
private List<String> recursiveFolderUpload(ChannelSftp channelSftp, String sourcePath, String destinationPath) throws SftpException, FileNotFoundException { List<String> filesRelativePathName = new ArrayList<>(); File sourceFile = new File(sourcePath); String remoteFilePath = Paths.get(destinationPath, sourceFile.getName()).toString(); if (sourceFile.isFile()) { getOut().println("Uploading " + sourcePath); channelSftp.put(new FileInputStream(sourceFile), remoteFilePath, ChannelSftp.OVERWRITE); getOut().println("File uploaded successfully to " + remoteFilePath); filesRelativePathName.add(remoteFilePath); } else { File[] files = sourceFile.listFiles(); if (!sourceFile.isHidden()) { if (!remoteDirExists(channelSftp, remoteFilePath)) { channelSftp.mkdir(remoteFilePath); } for (File f : files) { filesRelativePathName.addAll(recursiveFolderUpload(channelSftp, f.getAbsolutePath(), remoteFilePath)); } } } return filesRelativePathName; }
Source:
<code>public OperationContext(String clientId) { this.clientId = clientId; <START> this.correlationId = new Random().nextInt(); <END> }</code><technical_language>This work. correlationIds same. need atomiclong increment operations</technical_language>

Target:
public OperationContext(String clientId) { this.clientId = clientId; this.correlationId = currentCount.incrementAndGet(); }
Source:
<code>public AndroidByteBuddyMockMaker() { if (Platform.isAndroid() || Boolean.getBoolean("org.mockito.mock.android")) { delegate = new SubclassByteBuddyMockMaker(new AndroidLoadingStrategy()); } else { <START> System.err.println(join( <END> "IMPORTANT NOTE FROM MOCKITO:", "", "You included the 'mockito-android' dependency in a non-Android environment.", "The Android mock maker was disabled. You should only include the latter in your 'androidTestCompile' configuration", "If disabling was a mistake, you can set the 'org.mockito.mock.android' property to 'true' to override this behavior." )); delegate = new SubclassByteBuddyMockMaker(); } }</code><technical_language>extends ConsoleMockitoLogger log System.err</technical_language>

Target:
public AndroidByteBuddyMockMaker() { if (Platform.isAndroid() || Platform.isAndroidMockMakerRequired()) { delegate = new SubclassByteBuddyMockMaker(new AndroidLoadingStrategy()); } else { new ConsoleMockitoLogger().log(join( "IMPORTANT NOTE FROM MOCKITO:", "", "You included the 'mockito-android' dependency in a non-Android environment.", "The Android mock maker was disabled. You should only include the latter in your 'androidTestCompile' configuration", "If disabling was a mistake, you can set the 'org.mockito.mock.android' property to 'true' to override this detection.", "", "Visit <LINK_0> for more information" )); delegate = new SubclassByteBuddyMockMaker(); } }
Source:
<code>public void setup() throws InjectionException { final Configuration configuration = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(ServerId.class, "ServerId") .build(); final Injector injector = Tang.Factory.getTang().newInjector(configuration); mockSender = mock(WorkerMsgSender.class); injector.bindVolatileInstance(WorkerMsgSender.class, mockSender); injector.bindVolatileInstance(ParameterUpdater.class, mock(ParameterUpdater.class)); injector.bindVolatileInstance(ServerResolver.class, mock(ServerResolver.class)); injector.bindVolatileParameter(PSParameters.KeyCodecName.class, new IntegerCodec()); injector.bindVolatileParameter(WorkerQueueSize.class, 2500); <START> injector.bindVolatileParameter(ParameterWorkerNumThreads.class, 2); <END> doAnswer(invocationOnMock -> { final EncodedKey<Integer> encodedKey = (EncodedKey) invocationOnMock.getArguments()[1]; handler.processReply(encodedKey.getKey(), encodedKey.getKey()); return null; }).when(mockSender).sendPullMsg(anyString(), anyObject()); worker = injector.getInstance(ParameterWorkerImpl.class); handler = injector.getInstance(AsyncWorkerHandlerImpl.class); }</code><technical_language>2500 2 variable</technical_language>

Target:
public void setup() throws InjectionException, NetworkException { final Configuration configuration = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(ServerId.class, "ServerId") .build(); final Injector injector = Tang.Factory.getTang().newInjector(configuration); mockSender = mock(WorkerMsgSender.class); injector.bindVolatileInstance(WorkerMsgSender.class, mockSender); injector.bindVolatileInstance(ParameterUpdater.class, mock(ParameterUpdater.class)); injector.bindVolatileInstance(ServerResolver.class, mock(ServerResolver.class)); injector.bindVolatileParameter(PSParameters.KeyCodecName.class, new IntegerCodec()); injector.bindVolatileParameter(WorkerQueueSize.class, WORKER_QUEUE_SIZE); injector.bindVolatileParameter(ParameterWorkerNumThreads.class, WORKER_NUM_THREADS); doAnswer(invocationOnMock -> { final EncodedKey<Integer> encodedKey = (EncodedKey) invocationOnMock.getArguments()[1]; handler.processReply(encodedKey.getKey(), encodedKey.getKey()); return null; }).when(mockSender).sendPullMsg(anyString(), anyObject()); worker = injector.getInstance(ParameterWorkerImpl.class); handler = injector.getInstance(AsyncWorkerHandlerImpl.class); }
Source:
<code>public String toString() { <START> return "SenderId{" + <END> "id=" + id + '}'; }</code><technical_language>Alot of noise in (what an) IDE-autogenerated toString? "SenderId{id}" returned toString</technical_language>

Target:
public String toString() { return "SenderId{" + id + "}"; }
Source:
<code>private static long doubleToSortableLong(double value) { long bits = Double.doubleToLongBits(value); <START> return bits ^ (bits >> 63) & Long.MAX_VALUE; <END> }</code><technical_language>Add clarifying parenthesis. easy forget precedence rules for ^ & code easier reason about</technical_language>

Target:
private static long doubleToSortableLong(double value) { long bits = Double.doubleToLongBits(value); return bits ^ ((bits >> 63) & Long.MAX_VALUE); }
Source:
<code>private void requestLocationUpdates(){ if(locationListener == null) { locationListener = new LocationListener() { @Override public void onLocationChanged(android.location.Location location) { double latitude = location.getLatitude(); double longitude = location.getLongitude(); <START> Log.e(getClass().getSimpleName(), "New Latitude: " + latitude + "New Longitude: " + longitude); <END> } @Override public void onStatusChanged(String provider, int status, Bundle extras) { Log.e(getClass().getSimpleName(), "GPS location enabled"); } @Override public void onProviderEnabled(String provider) { Log.e(getClass().getSimpleName(), "GPS location enabled"); } @Override public void onProviderDisabled(String provider) { Log.e(getClass().getSimpleName(), "GPS location disabled"); } }; } locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); }</code><technical_language>Remove log</technical_language>

Target:
private void requestLocationUpdates(){ if(locationListener == null) { locationListener = new LocationListener() { @Override public void onLocationChanged(android.location.Location location) @Override public void onStatusChanged(String provider, int status, Bundle extras) @Override public void onProviderEnabled(String provider) @Override public void onProviderDisabled(String provider) }; } locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); }
Source:
<code>private void checkField(final PendingCertifiedProductDTO listing, final Object field, final String errorField, String type) { <START> if (type.equals(ERROR)) { <END> if (field instanceof Long) { Long fieldCasted = (Long) field; if (fieldCasted.toString().length() > getMaxLength("maxLength." + errorField)) { listing.getErrorMessages().add(msgUtil.getMessage("listing." + errorField + ".maxlength", String.valueOf(getMaxLength("maxLength." + errorField)), fieldCasted)); } } else if (field instanceof String) { String fieldCasted = (String) field; if (fieldCasted.length() > getMaxLength("maxLength." + errorField)) { listing.getErrorMessages().add(msgUtil.getMessage("listing." + errorField + ".maxlength", String.valueOf(getMaxLength("maxLength." + errorField)), fieldCasted)); } } } else { if (field instanceof Long) { Long fieldCasted = (Long) field; if (fieldCasted.toString().length() > getMaxLength("maxLength." + errorField)) { listing.getWarningMessages().add(msgUtil.getMessage("listing." + errorField + ".maxlength", String.valueOf(getMaxLength("maxLength." + errorField)), fieldCasted)); } } else if (field instanceof String) { String fieldCasted = (String) field; if (fieldCasted.length() > getMaxLength("maxLength." + errorField)) { listing.getWarningMessages().add(msgUtil.getMessage("listing." + errorField + ".maxlength", String.valueOf(getMaxLength("maxLength." + errorField)), fieldCasted)); } } } }</code><technical_language>"if long if string" stuff is duplicated. generate message first, independent of ERROR a WARNING, end add an: if type.equals(ERROR) listing.geterrormessages.add(message) else listing.getwarningmessages.add(message)</technical_language>

Target:
private void checkField(final PendingCertifiedProductDTO listing, final Object field, final String errorField, String type) { String message = null; if (field instanceof Long) { Long fieldCasted = (Long) field; if (fieldCasted.toString().length() > getMaxLength("maxLength." + errorField)) { message = msgUtil.getMessage("listing." + errorField + ".maxlength", String.valueOf(getMaxLength("maxLength." + errorField)), fieldCasted); } } else if (field instanceof String) { String fieldCasted = (String) field; if (fieldCasted.length() > getMaxLength("maxLength." + errorField)) { message = msgUtil.getMessage("listing." + errorField + ".maxlength", String.valueOf(getMaxLength("maxLength." + errorField)), fieldCasted); } } if (type.equals(ERROR)) { listing.getErrorMessages().add(message); } else { listing.getWarningMessages().add(message); } }
Source:
<code>private static void checkParameterTypes(String methodName, Class[] parameterTypes, String methodAnnotation, String[] parameterNames) { int totalLength = parameterTypes.length; Set<Class> injectedTypes = new HashSet<Class>() { private static final long serialVersionUID = -5324894581793435812L; { add(ITestContext.class); add(ITestResult.class); add(XmlTest.class); add(Method.class); add(Object[].class); }}; for (Class parameterType : parameterTypes) { if (injectedTypes.contains(parameterType)) { totalLength--; } } if ((parameterNames.length == 0)) { <START> String annotation = methodAnnotation; <END> if (!methodAnnotation.startsWith("@")) { annotation = "@" + methodAnnotation; } boolean invalid = (totalLength != 0) || (!validParameters(methodAnnotation, parameterTypes)); if (invalid) { String errPrefix = "Cannot inject " + annotation + " annotated Method [" + methodName + "] with " + Arrays.toString(parameterTypes); if (mapping.containsKey(methodAnnotation) ) { errPrefix = "Can inject only one of " + prettyFormat(mapping.get(methodAnnotation)) + " into a " + annotation + " annotated " + methodName; } throw new TestNGException(errPrefix + ".\nFor more information on native dependency injection please refer to " + "<LINK_0>" ); } } if (parameterNames.length != totalLength) { throw new TestNGException( "Method " + methodName + " requires " + parameterTypes.length + " parameters but " + parameterNames.length + " were supplied in the " + methodAnnotation + " annotation."); } }</code><technical_language>annotation is in if (invalid) this part moved (and gain a bit)</technical_language>

Target:
private static void checkParameterTypes(String methodName, Class[] parameterTypes, String methodAnnotation, String[] parameterNames) { int totalLength = parameterTypes.length; Set<Class> injectedTypes = new HashSet<Class>() { private static final long serialVersionUID = -5324894581793435812L; { add(ITestContext.class); add(ITestResult.class); add(XmlTest.class); add(Method.class); add(Object[].class); }}; for (Class parameterType : parameterTypes) { if (injectedTypes.contains(parameterType)) { totalLength--; } } if (parameterNames.length == 0) { boolean invalid = (totalLength != 0) || (!validParameters(methodAnnotation, parameterTypes)); if (invalid) { String annotation = methodAnnotation; if (!methodAnnotation.startsWith("@")) { annotation = "@" + methodAnnotation; } String errPrefix; if (mapping.containsKey(methodAnnotation)) { errPrefix = "Can inject only one of " + prettyFormat(mapping.get(methodAnnotation)) + " into a " + annotation + " annotated " + methodName; } else { errPrefix = "Cannot inject " + annotation + " annotated Method [" + methodName + "] with " + Arrays.toString(parameterTypes); } throw new TestNGException(errPrefix + ".\nFor more information on native dependency injection please refer to " + "<LINK_0>" ); } } if (parameterNames.length != totalLength) { throw new TestNGException( "Method " + methodName + " requires " + parameterTypes.length + " parameters but " + parameterNames.length + " were supplied in the " + methodAnnotation + " annotation."); } }
Source:
<code>public void testAddUserToOrgs() { ApiClient client = getWebClient(USER_2_USERNAME, testingPostgres); UsersApi userApi = new UsersApi(client); List<Workflow> workflows = userApi.refreshWorkflowsByOrganization((long)1, "DockstoreTestUser"); long numberOfWorkflows = workflows.size(); testingPostgres.runUpdateStatement("delete from user_entry where entryid = 951"); long newNumberOfWorkflows = userApi.userWorkflows((long)1).size(); assertEquals("Should have one less workflow", numberOfWorkflows - 1, newNumberOfWorkflows); <START> newNumberOfWorkflows= userApi.addUserToDockstoreWorkflows().size(); <END> assertEquals("Should have the original number of workflows", numberOfWorkflows, newNumberOfWorkflows); }</code><technical_language>test workflows (follow serviceDAO discussion) e.g. if some bizarro coincidence this returned equal number of services workflows</technical_language>

Target:
public void testAddUserToOrgs() { io.dockstore.openapi.client.ApiClient client = getOpenAPIWebClient(USER_2_USERNAME, testingPostgres); io.dockstore.openapi.client.api.UsersApi userApi = new io.dockstore.openapi.client.api.UsersApi(client); List<io.dockstore.openapi.client.model.Workflow> workflows = userApi.refreshWorkflowsByOrganization((long)1, "DockstoreTestUser"); long numberOfWorkflows = workflows.size(); testingPostgres.runUpdateStatement("delete from user_entry where entryid = 951"); long newNumberOfWorkflows = userApi.userWorkflows((long)1).size(); assertEquals("Should have one less workflow", numberOfWorkflows - 1, newNumberOfWorkflows); workflows = userApi.addUserToDockstoreWorkflows((long)1, ""); newNumberOfWorkflows = workflows.size(); assertEquals("Should have the original number of workflows", numberOfWorkflows, newNumberOfWorkflows); assertTrue("Should have the workflow DockstoreTestUser/dockstore-whalesay-2", workflows.stream().anyMatch(workflow -> Objects.equals("dockstore-whalesay-2", workflow.getRepository()) && Objects.equals("DockstoreTestUser", workflow.getOrganization()))); }
Source:
<code>private static void removePermissionsFile(Project project) { <START> File permissionsFile = new File(project.getDirectory(), "permissions.txt"); <END> if (permissionsFile.exists()) { permissionsFile.delete(); } }</code><technical_language>please put "permissions.txt" in constants</technical_language>

Target:
public static void removePermissionsFile(Project project) { File permissionsFile = new File(project.getDirectory(), PERMISSIONS_FILE_NAME); if (permissionsFile.exists()) { permissionsFile.delete(); } }
Source:
<code>public String url() { <START> return scheme + path; <END> }</code><technical_language>sounds fine</technical_language>

Target:
public String url() { return String.format("%s://%s", scheme, path); }
Source:
<code>public byte[] getDataFromService(KM200Device device, String service) { byte[] responseBodyB64 = null; <START> HttpClient client = new HttpClient(); <END> GetMethod method = new GetMethod("http://" + device.getIP4Address() + service); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); method.setRequestHeader("Accept", "application/json"); method.addRequestHeader("User-Agent", "TeleHeater/2.2.3"); try { int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { String statusLine = method.getStatusLine().toString(); if (statusLine.contains(" 403 ")) { byte[] test = new byte[1]; return test; } else { logger.error("HTTP GET failed: " + method.getStatusLine()); return null; } } device.setCharSet(method.getResponseCharSet()); responseBodyB64 = ByteStreams.toByteArray(method.getResponseBodyAsStream()); } catch (HttpException e) { logger.error("Fatal protocol violation: " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { logger.error("Fatal transport error: " + e.getMessage()); e.printStackTrace(); } finally { method.releaseConnection(); } return responseBodyB64; }</code><technical_language>more efficient a single HttpClient, instead of creating a new time this method is called</technical_language>

Target:
public byte[] getDataFromService(KM200Device device, String service) { byte[] responseBodyB64 = null; if (client == null) { client = new HttpClient(); } GetMethod method = new GetMethod("http://" + device.getIP4Address() + service); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); method.setRequestHeader("Accept", "application/json"); method.addRequestHeader("User-Agent", "TeleHeater/2.2.3"); try { int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { String statusLine = method.getStatusLine().toString(); if (statusLine.contains(" 403 ")) { byte[] test = new byte[1]; return test; } else { logger.error("HTTP GET failed: {}", method.getStatusLine()); return null; } } device.setCharSet(method.getResponseCharSet()); responseBodyB64 = ByteStreams.toByteArray(method.getResponseBodyAsStream()); } catch (HttpException e) { logger.error("Fatal protocol violation: {}", e); e.printStackTrace(); } catch (IOException e) { logger.error("Fatal transport error: {}", e); e.printStackTrace(); } finally { method.releaseConnection(); } return responseBodyB64; }
Source:
<code>private void placeYinYang(CoreChunk chunk, Vector3i yinYangPosition) { for (int i = -RADIUS; i <= RADIUS; i++) { for (int j = -2 * RADIUS; j <= 2 * RADIUS; j++) { String blockString = pixel(j, i, RADIUS); Vector3i chunkBlockPosition = new Vector3i(i, 0, j).add(yinYangPosition); if (chunk.getRegion().contains(chunkBlockPosition)) { <START> chunk.setBlock(ChunkMath.calcRelativeBlockPos(chunkBlockPosition, new Vector3i()), getBlock(blockString)); <END> } } } }</code><technical_language>reuse temp vector</technical_language>

Target:
private void placeYinYang(CoreChunk chunk, Vector3i yinYangPosition) { Vector3i tempPos = new Vector3i(); for (int i = -RADIUS; i <= RADIUS; i++) { for (int j = -2 * RADIUS; j <= 2 * RADIUS; j++) { String blockString = pixel(j, i, RADIUS); Vector3i chunkBlockPosition = new Vector3i(i, 0, j).add(yinYangPosition); if (chunk.getRegion().contains(chunkBlockPosition)) { chunk.setBlock(ChunkMath.calcRelativeBlockPos(chunkBlockPosition, tempPos), getBlock(blockString)); } } } }
Source:
<code>public boolean supportsAtomicCreateNewFile() { if (supportsAtomicCreateNewFile == AtomicFileCreation.UNDEFINED) { determineAtomicFileCreationSupport(); <START> if (supportsAtomicCreateNewFile == AtomicFileCreation.UNDEFINED) { supportsAtomicCreateNewFile = AtomicFileCreation.SUPPORTED; } <END> } return supportsAtomicCreateNewFile == AtomicFileCreation.SUPPORTED; }</code><technical_language>I if move this determineAtomicFileCreationSupport method? moment caller is (L360) if in future called else, this patch effective</technical_language>

Target:
public boolean supportsAtomicCreateNewFile() { if (supportsAtomicCreateNewFile == AtomicFileCreation.UNDEFINED) { determineAtomicFileCreationSupport(); } return supportsAtomicCreateNewFile == AtomicFileCreation.SUPPORTED; }
Source:
<code>public boolean isStopped() { <START> return stopRequested && activeSyncs.size() == 0; <END> }</code><technical_language>stop it, reset of stopRequested, i.e. stopRequested = false? this condition return activeSyncs.size() == 0, i.e. active syncs running</technical_language>

Target:
public boolean isStopped() { return this.state == State.STOPPED; }
Source:
<code><START> public LzfEncoder(boolean safeInstance, int totalLength, int compressThreshold) { <END> super(false); if (totalLength < MIN_BLOCK_TO_COMPRESS || totalLength > MAX_CHUNK_LEN) { throw new IllegalArgumentException("totalLength: " + totalLength + " (expected: " + MIN_BLOCK_TO_COMPRESS + '-' + MAX_CHUNK_LEN + ')'); } setCompressThreshold(compressThreshold); this.encoder = safeInstance ? ChunkEncoderFactory.safeNonAllocatingInstance(totalLength) : ChunkEncoderFactory.optimalNonAllocatingInstance(totalLength); this.recycler = BufferRecycler.instance(); }</code><technical_language>need constructor for combat</technical_language>

Target:
public LzfEncoder(boolean safeInstance, int totalLength, int compressThreshold) { super(false); if (totalLength < MIN_BLOCK_TO_COMPRESS || totalLength > MAX_CHUNK_LEN) { throw new IllegalArgumentException("totalLength: " + totalLength + " (expected: " + MIN_BLOCK_TO_COMPRESS + '-' + MAX_CHUNK_LEN + ')'); } if (compressThreshold < MIN_BLOCK_TO_COMPRESS) { throw new IllegalArgumentException("compressThreshold:" + compressThreshold + " expected >=" + MIN_BLOCK_TO_COMPRESS); } this.compressThreshold = compressThreshold; this.encoder = safeInstance ? ChunkEncoderFactory.safeNonAllocatingInstance(totalLength) : ChunkEncoderFactory.optimalNonAllocatingInstance(totalLength); this.recycler = BufferRecycler.instance(); }