auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public QuotaCreditsResponse addQuotaCredits(final Long accountId, final Long domainId, final Double amount, final Long updatedBy, final Date despositedOn) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); QuotaCreditsVO result = null; try (TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB)) { QuotaCreditsVO credits = new QuotaCreditsVO(accountId, domainId, new BigDecimal(amount), updatedBy); s_logger.info("addQuotaCredits: Depositing " + amount + " on adjusted date " + despositedOn); credits.setUpdatedOn(despositedOn); result = _quotaCreditsDao.saveCredits(credits); } <START> TransactionLegacy.open(TransactionLegacy.CLOUD_DB).close(); <END> final AccountVO account = _accountDao.findById(accountId); final boolean lockAccountEnforcement = "true".equalsIgnoreCase(QuotaConfig.QuotaEnableEnforcement.value()); final BigDecimal currentAccountBalance = _quotaBalanceDao.lastQuotaBalance(accountId, domainId, startOfNextDay(despositedOn)); if (lockAccountEnforcement && (currentAccountBalance.compareTo(new BigDecimal(0)) >= 0)) { if (account.getState() == Account.State.locked) { _regionMgr.enableAccount(account.getAccountName(), domainId, accountId); } } String creditor = String.valueOf(Account.ACCOUNT_ID_SYSTEM); User creditorUser = _userDao.getUser(updatedBy); if (creditorUser != null) { creditor = creditorUser.getUsername(); } TransactionLegacy.open(opendb).close(); QuotaCreditsResponse response = new QuotaCreditsResponse(result, creditor); response.setCurrency(QuotaConfig.QuotaCurrencySymbol.value()); return response; }</code><technical_language>accessing database a response builder class a service</technical_language>

Target:
public QuotaCreditsResponse addQuotaCredits(final Long accountId, final Long domainId, final Double amount, final Long updatedBy, final Date despositedOn) { QuotaCreditsVO credits = new QuotaCreditsVO(accountId, domainId, new BigDecimal(amount), updatedBy); s_logger.debug("AddQuotaCredits: Depositing " + amount + " on adjusted date " + despositedOn); credits.setUpdatedOn(despositedOn); QuotaCreditsVO result = _quotaCreditsDao.saveCredits(credits); final AccountVO account = _accountDao.findById(accountId); final boolean lockAccountEnforcement = "true".equalsIgnoreCase(QuotaConfig.QuotaEnableEnforcement.value()); final BigDecimal currentAccountBalance = _quotaBalanceDao.lastQuotaBalance(accountId, domainId, startOfNextDay(despositedOn)); if (lockAccountEnforcement && (currentAccountBalance.compareTo(new BigDecimal(0)) >= 0)) { if (account.getState() == Account.State.locked) { _regionMgr.enableAccount(account.getAccountName(), domainId, accountId); } } String creditor = String.valueOf(Account.ACCOUNT_ID_SYSTEM); User creditorUser = _userDao.getUser(updatedBy); if (creditorUser != null) { creditor = creditorUser.getUsername(); } QuotaCreditsResponse response = new QuotaCreditsResponse(result, creditor); response.setCurrency(QuotaConfig.QuotaCurrencySymbol.value()); return response; }
Source:
<code>private void showPreviousView(boolean showSwipeAnimation) { <START> <END> if (currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } FormIndex startIndex = mFormController.getFormIndex(); FormIndex lastValidIndex = startIndex; if (mFormController.getEvent() != FormEntryController.EVENT_BEGINNING_OF_FORM) { int event = mFormController.stepToPreviousEvent(); while (event != FormEntryController.EVENT_BEGINNING_OF_FORM && event != FormEntryController.EVENT_QUESTION && !(event == FormEntryController.EVENT_GROUP && mFormController.indexIsInFieldList() && mFormController .getQuestionPrompts().length != 0)) { event = mFormController.stepToPreviousEvent(); lastValidIndex = mFormController.getFormIndex(); } if(event == FormEntryController.EVENT_BEGINNING_OF_FORM) { mFormController.jumpToIndex(lastValidIndex); if(lastValidIndex.equals(startIndex)) { FormEntryActivity.this.triggerUserQuitInput(); return; } if(lastValidIndex.isBeginningOfFormIndex()) { this.showNextView(true); return; } } QuestionsView next = createView(); if (showSwipeAnimation) { showView(next, AnimationType.LEFT); } else { showView(next, AnimationType.FADE, false); } } else { FormEntryActivity.this.triggerUserQuitInput(); } }</code><technical_language>new lines added unnecessary</technical_language>

Target:
private void showPreviousView(boolean showSwipeAnimation) { if (currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } resetLastChangedWidget(); FormIndex startIndex = mFormController.getFormIndex(); FormIndex lastValidIndex = startIndex; if (mFormController.getEvent() != FormEntryController.EVENT_BEGINNING_OF_FORM) { int event = mFormController.stepToPreviousEvent(); while (event != FormEntryController.EVENT_BEGINNING_OF_FORM && event != FormEntryController.EVENT_QUESTION && !(event == FormEntryController.EVENT_GROUP && mFormController.indexIsInFieldList() && mFormController .getQuestionPrompts().length != 0)) { event = mFormController.stepToPreviousEvent(); lastValidIndex = mFormController.getFormIndex(); } if(event == FormEntryController.EVENT_BEGINNING_OF_FORM) { mFormController.jumpToIndex(lastValidIndex); if(lastValidIndex.equals(startIndex)) { FormEntryActivity.this.triggerUserQuitInput(); return; } if(lastValidIndex.isBeginningOfFormIndex()) { this.showNextView(true); return; } } QuestionsView next = createView(); if (showSwipeAnimation) { showView(next, AnimationType.LEFT); } else { showView(next, AnimationType.FADE, false); } } else { FormEntryActivity.this.triggerUserQuitInput(); } }
Source:
<code><START> private void createContext() { <END> if ( vc == null ) { jContext = new MapContext(Collections.emptyMap()); } else { jContext = (g==null) ? new VariantJEXLContext(vc) : new GenotypeJEXLContext(vc, g); } }</code><technical_language>I this clearer distinct cases instead of collapsing of them</technical_language>

Target:
private void createContext() { if (vc == null) { jContext = new MapContext(Collections.emptyMap()); } else if (g == null) { jContext = new VariantJEXLContext(vc); } else { jContext = new GenotypeJEXLContext(vc, g); } }
Source:
<code><START> private void add(Range range) { <END> if (!ranges.isEmpty()) { int lastIndex = ranges.size() - 1; Range last = ranges.get(lastIndex); assert last.compareTo(range) <= 0; Range u = Range.union(last, range); if (u != null) { ranges.set(lastIndex, u); } else { ranges.add(range); } } else { ranges.add(range); } }</code><technical_language>I rename this addRangeAtEnd condition of assert more explicit</technical_language>

Target:
private void add(Range range) { Range rangeToAdd = range; for (int i = ranges.size() - 1; i >= 0; --i) { Range last = ranges.get(i); assert !last.isAfter(range); Range u = Range.union(last, rangeToAdd); if (u == null) { break; } rangeToAdd = u; ranges.remove(i); } ranges.add(rangeToAdd); }
Source:
<code>public Binary getBinary(Blob blob) throws IOException { if (!(blob instanceof FileBlob)) { return super.getBinary(blob); } File file = blob.getFile(); String digest; try (InputStream in = new FileInputStream(file)) { digest = DigestUtils.md5Hex(in); } GridFSFile dbFile = gridFSBucket.find(Filters.eq("filename", digest)).first(); if (dbFile == null) { try (InputStream in = new FileInputStream(file)) { gridFSBucket.uploadFromStream(digest, in); } } return new GridFSBinary(digest, blobProviderId); <START> } <END></code><technical_language>"filename" times, please a constant for it. defined GridFS itself</technical_language>

Target:
public Binary getBinary(Blob blob) throws IOException { if (!(blob instanceof FileBlob)) { return super.getBinary(blob); } File file = blob.getFile(); String digest; try (InputStream in = new FileInputStream(file)) { digest = DigestUtils.md5Hex(in); } GridFSFile dbFile = gridFSBucket.find(Filters.eq(METADATA_PROPERTY_FILENAME, digest)).first(); if (dbFile == null) { try (InputStream in = new FileInputStream(file)) { gridFSBucket.uploadFromStream(digest, in); } } return new GridFSBinary(digest, blobProviderId); }
Source:
<code>public void testSerde() throws Exception { RabbitMQFirehoseFactory factory = new RabbitMQFirehoseFactory( new JacksonifiedConnectionFactory(), <START> new RabbitMQFirehoseConfig(), <END> new StringInputRowParser( new JSONParseSpec( new TimestampSpec("timestamp", "auto"), new DimensionsSpec( Arrays.<String>asList("dim"), Lists.<String>newArrayList(), Lists.<SpatialDimensionSchema>newArrayList() ) ), null, null, null, null ) ); byte[] bytes = mapper.writeValueAsBytes(factory); RabbitMQFirehoseFactory factory2 = mapper.readValue(bytes, RabbitMQFirehoseFactory.class); byte[] bytes2 = mapper.writeValueAsBytes(factory2); Assert.assertArrayEquals(bytes, bytes2); }</code><technical_language>This test include a config a common set "host", "port", "username", "password", round-trip properly. means want pull config out of firehose serialize->deserializing right stuff set. More uncommon configs useful test too, in case wants them</technical_language>

Target:
public void testSerde() throws Exception { RabbitMQFirehoseConfig config = new RabbitMQFirehoseConfig( "test", "test2", "test3", true, true, true, 5, 10, 20 ); JacksonifiedConnectionFactory connectionFactory = new JacksonifiedConnectionFactory( "foo", 9978, "user", "pw", "host", null, 5, 10, 11, 12, ImmutableMap.<String, Object>of("hi", "bye") ); RabbitMQFirehoseFactory factory = new RabbitMQFirehoseFactory( connectionFactory, config, new StringInputRowParser( new JSONParseSpec( new TimestampSpec("timestamp", "auto"), new DimensionsSpec( Arrays.asList("dim"), Lists.<String>newArrayList(), Lists.<SpatialDimensionSchema>newArrayList() ) ), null, null, null, null ) ); byte[] bytes = mapper.writeValueAsBytes(factory); RabbitMQFirehoseFactory factory2 = mapper.readValue(bytes, RabbitMQFirehoseFactory.class); byte[] bytes2 = mapper.writeValueAsBytes(factory2); Assert.assertArrayEquals(bytes, bytes2); Assert.assertEquals(factory.getConfig(), factory2.getConfig()); Assert.assertEquals(factory.getConnectionFactory(), factory2.getConnectionFactory()); }
Source:
<code>protected void onEvent(GHEvent event, String payload) { <START> JSONObject parsedPayload = JSONObject.fromObject(payload); <END> JSONObject repository = parsedPayload.optJSONObject("repository"); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getString("url")); } else { JSONObject organization = parsedPayload.optJSONObject("organization"); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getString("url")); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } }</code><technical_language>remove static import? mislead here, preferable</technical_language>

Target:
protected void onEvent(GHEvent event, String payload) { JSONObject parsedPayload = fromObject(payload); JSONObject repository = parsedPayload.optJSONObject("repository"); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getString("url")); } else { JSONObject organization = parsedPayload.optJSONObject("organization"); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getString("url")); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } }
Source:
<code>public void stepSetRemoteTimeout(RequestMonitor rm) { if (fGDBBackend.getSessionType() == SessionType.REMOTE && <START> fGDBBackend.getIsAttachSession()) { <END> String remoteTimeout = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT, LaunchUtils.getRemoteTimeoutDefault()); if (remoteTimeout != null && !remoteTimeout.isEmpty()) { fCommandControl.queueCommand( fCommandFactory.createMIGDBSetRemoteTimeout(fCommandControl.getContext(), remoteTimeout), new ImmediateDataRequestMonitor<MIInfo>(rm)); return; } } rm.done(); }</code><technical_language>set remote timeout for remote non-attach sessions. Ref: org.eclipse.cdt.dsf.gdb.service.DebugNewProcessSequence.stepRemoteConnection(RequestMonitor) need ensure remote timeout is set remote connection is initiated for attach non-attach cases</technical_language>

Target:
public void stepSetRemoteTimeout(RequestMonitor rm) { if (fGDBBackend.getSessionType() == SessionType.REMOTE) { boolean remoteTimeoutEnabled = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, LaunchUtils.getRemoteTimeoutEnabledDefault()); String remoteTimeoutValue = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, LaunchUtils.getRemoteTimeoutValueDefault()); if (remoteTimeoutEnabled && remoteTimeoutValue != null && !remoteTimeoutValue.isEmpty()) { fCommandControl.queueCommand( fCommandFactory.createMIGDBSetRemoteTimeout(fCommandControl.getContext(), remoteTimeoutValue), new ImmediateDataRequestMonitor<MIInfo>(rm) { @Override protected void handleError() { IStatus status = getStatus(); MultiStatus ms = new MultiStatus(GdbPlugin.PLUGIN_ID, -1, new IStatus[] { status }, LaunchMessages.getString("FinalLaunchSequence.2"), null); rm.done(ms); } }); return; } } rm.done(); }
Source:
<code><START> public void testGeneIdsorGeneNames() { <END> List<FeatureCoordinates> featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_EXISTING), Arrays.asList(GENE_NAME_EXISITNG)); assertEquals(GENE_ID_EXISTING, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG, featureCoordinates.get(0).getName()); featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_EXISTING), null); assertEquals(GENE_ID_EXISTING, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG, featureCoordinates.get(0).getName()); featureCoordinates = findByIdsOrNamesHelper(null, Arrays.asList(GENE_NAME_EXISITNG)); assertEquals(GENE_ID_EXISTING, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG, featureCoordinates.get(0).getName()); }</code><technical_language>another test lists of 2 elements nice, check a "find one"</technical_language>

Target:
public void testGeneIdsorGeneNames() { List<FeatureCoordinates> featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_EXISTING1), Arrays.asList(GENE_NAME_EXISITNG1)); assertEquals(GENE_ID_EXISTING1, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG1, featureCoordinates.get(0).getName()); featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_EXISTING1), null); assertEquals(GENE_ID_EXISTING1, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG1, featureCoordinates.get(0).getName()); featureCoordinates = findByIdsOrNamesHelper(null, Arrays.asList(GENE_NAME_EXISITNG1)); assertEquals(GENE_ID_EXISTING1, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG1, featureCoordinates.get(0).getName()); }
Source:
<code>public void presentAnnotationIsAvailable() throws Exception { Field field = ClassWithDummyField.class.getField("annotatedField"); FrameworkField frameworkField = new FrameworkField(field); Annotation annotation = frameworkField.getAnnotation(Rule.class); <START> assertThat(annotation, isA((Class)Rule.class)); <END> }</code><technical_language>A class instance is a singleton (unless multiple class loaders) do: assertEquals(Rule.class, annotation.getClass()); If prefer have, please put a space cast operator. saddened (but surprised) Hamcrest requires it</technical_language>

Target:
public void presentAnnotationIsAvailable() throws Exception { Field field = ClassWithDummyField.class.getField("annotatedField"); FrameworkField frameworkField = new FrameworkField(field); Annotation annotation = frameworkField.getAnnotation(Rule.class); assertTrue(Rule.class.isAssignableFrom(annotation.getClass())); }
Source:
<code>private void show(Object data) { <START> if (oneline) { <END> if (data instanceof ChangeAttribute) { ChangeAttribute change = (ChangeAttribute) data; out.print(String.format("%s %s (%s)\n", Change.Key.parse(change.id) .abbreviate(), change.subject, change.owner.username)); } return; } switch (outputFormat) { default: case TEXT: if (data instanceof ChangeAttribute) { out.print("change "); out.print(((ChangeAttribute) data).id); out.print("\n"); showText(data, 1); } else { showText(data, 0); } out.print('\n'); break; case JSON: out.print(gson.toJson(data)); out.print('\n'); break; } }</code><technical_language>good check if other options specified, output error if so</technical_language>

Target:
private void show(Object data) { switch (outputFormat) { default: case TEXT: if (data instanceof ChangeAttribute) { out.print("change "); out.print(((ChangeAttribute) data).id); out.print("\n"); showText(data, 1); } else { showText(data, 0); } out.print('\n'); break; case JSON: out.print(gson.toJson(data)); out.print('\n'); break; case SHORT: if (data instanceof ChangeAttribute) { if (includeApprovals || includeComments || includeCommitMessage || includeCurrentPatchSet || includeDependencies || includeFiles || includePatchSets) { ErrorMessage m = new ErrorMessage(); m.message = "--format=SHORT (or --online) argument is mutually exclusive with all other options"; showText(m, 0); return; } ChangeAttribute change = (ChangeAttribute) data; out.print(String.format("%s %s (%s)\n", Change.Key.parse(change.id) .abbreviate(), change.subject, change.owner.username)); } } }
Source:
<code>void validate() { if (keyField.isEmpty()) { <START> throw new IllegalArgumentException("The 'Key Field' property must be set."); <END> } else if (fieldName.isEmpty()) { throw new IllegalArgumentException("The 'Input Field Name' property must be set."); } else if (fieldValue.isEmpty()) { throw new IllegalArgumentException("The 'Input Field Value' property must be set."); } else if (outputFields.isEmpty()) { throw new IllegalArgumentException("The 'OutputFields' property must be set."); } }</code><technical_language>error messages name of expected property. keyField</technical_language>

Target:
void validate() { if (keyField.isEmpty()) { throw new IllegalArgumentException("The 'keyField' property must be set."); } else if (nameField.isEmpty()) { throw new IllegalArgumentException("The 'nameField' property must be set."); } else if (valueField.isEmpty()) { throw new IllegalArgumentException("The 'valueField' property must be set."); } else if (outputFields.isEmpty()) { throw new IllegalArgumentException("The 'outputFields' property must be set."); } }
Source:
<code><START> public ArrayList<FieldReport> getFieldReports() { return mfieldReports; } <END></code><technical_language>If mFieldReports is null, set empty arraylist assured mFieldReports is arraylist</technical_language>

Target:
public ArrayList<FieldReport> getFieldReports() { if (mFieldReports == null){ return new ArrayList<FieldReport>(); } return mFieldReports; }
Source:
<code>public void testMkdirRootNonExistentContainer() throws Exception { final Configuration rawConf = getRawConfiguration(); FsShell fsShell = new FsShell(rawConf); final String account = rawConf.get(FS_AZURE_ABFS_ACCOUNT_NAME, null); String nonExistentContainer = "nonexistent-" + UUID.randomUUID(); <START> final AbfsConfiguration conf = getConfiguration(); conf.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, false); <END> int result = fsShell.run(new String[] { "-mkdir", ABFS_SCHEME + "://" + nonExistentContainer + "@" + account + "/testDirOnRoot" }); assertEquals(1, result); }</code><technical_language>Creating copy of Configuration (like new Configuration(getRawConfiguration())) updating existing AbfsConfiguration . FsShell created updated copy in case</technical_language>

Target:
public void testMkdirRootNonExistentContainer() throws Exception { final Configuration rawConf = getRawConfiguration(); final String account = rawConf.get(FS_AZURE_ABFS_ACCOUNT_NAME, null); rawConf.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, false); String nonExistentContainer = "nonexistent-" + UUID.randomUUID(); FsShell fsShell = new FsShell(rawConf); int result = fsShell.run(new String[] {"-mkdir", ABFS_SCHEME + "://" + nonExistentContainer + "@" + account + "/"}); assertEquals(1, result); }
Source:
<code>private static boolean headersEquivalent(String a, String b) { if (a.length() != b.length()) return false; <START> List<String> remaining = new LinkedList<String>(Arrays.asList(a.split("\\t"))); <END> for (String item : b.split("\\t")) { if (!remaining.remove(item)) return false; } return remaining.isEmpty(); }</code><technical_language>final</technical_language>

Target:
private static final boolean headersEquivalent(String a, String b) { if (a.length() != b.length()) return false; List<String> remaining = new LinkedList<String>(Arrays.asList(a.split("\\t"))); for (final String item : b.split("\\t")) { if (!remaining.remove(item)) return false; } return remaining.isEmpty(); }
Source:
<code>public List<Variant> createSiteModifyingVariants() { List<Variant> listVariant = new ArrayList<Variant>(); if (getExtension() != null) { List<ScriptWrapper> scripts = getExtension().getScripts(ExtensionActiveScan.SCRIPT_TYPE_VARIANT); for (ScriptWrapper script : scripts) { if (script.isEnabled()) { try { <START> listVariant.add(new VariantCustom(script, getExtension())); <END> } catch (Exception e) { getExtension().handleScriptException(script, e); } } } } for (Class<? extends Variant> variant : customVariants) { try { listVariant.add(variant.getDeclaredConstructor().newInstance()); } catch (Exception e) { LOG.error(e.getMessage(), e); } } return listVariant; }</code><technical_language>This happen(?), VariantCustom that</technical_language>

Target:
public List<Variant> createSiteModifyingVariants() { List<Variant> listVariant = new ArrayList<Variant>(); addScriptVariants(listVariant); addCustomVariants(listVariant); return listVariant; }
Source:
<code>public boolean sweepTable(String tableName) { TableReference tableRef = TableReference.createFromFullyQualifiedName(tableName); Preconditions.checkArgument(TableReference.isFullyQualifiedName(tableName), <START> String.format("Table name %s is not fully qualified", tableName)); <END> Preconditions.checkState(specificTableSweeper.getKvs().getAllTableNames().contains(tableRef), String.format("Table requested to sweep %s does not exist", tableName)); return specificTableSweeper.runOnceForTable(new TableToSweep(tableRef, null), false, Optional.empty()); }</code><technical_language>2 nits: - this remoting's WebPreconditions toss a 400 user here, 500 current implementation give (in a sense user's fault!) - TableReference.createFromFullyQualifiedName() a (normal) preconditions check, this _before_ table reference is created</technical_language>

Target:
public void sweepTable(String tableName) { TableReference tableRef = getTableRef(tableName); checkTableExists(tableName, tableRef); runSweepWithoutSavingResults(tableRef); }
Source:
<code>public static boolean isKeyframe(ByteArrayBuffer baf) { <START> if (baf.getLength() < 2) <END> return false; byte b = baf.getBuffer()[baf.getOffset() + 1]; return (b & KF_MASK) != 0; }</code><technical_language>a null reaches this point</technical_language>

Target:
public static boolean isKeyframe(ByteArrayBuffer baf) { if (baf == null || baf.getLength() < 2) { return false; } byte b = baf.getBuffer()[baf.getOffset() + 1]; return (b & KF_MASK) != 0; }
Source:
<code>public void dropSchemaAndDatabase(SessionFactory sessionFactory) { final InfinispanRemoteDatastoreProvider datastoreProvider = getProvider( sessionFactory ); <START> final Set<String> mappedCacheNames = datastoreProvider.getCacheTemplatesByName().keySet(); <END> mappedCacheNames.forEach( cacheName -> datastoreProvider.getCache( cacheName ).clear() ); }</code><technical_language>other method? easier clearer</technical_language>

Target:
public void dropSchemaAndDatabase(SessionFactory sessionFactory) { final InfinispanRemoteDatastoreProvider datastoreProvider = getProvider( sessionFactory ); final Set<String> mappedCacheNames = datastoreProvider.getMappedCacheNames(); mappedCacheNames.forEach( cacheName -> datastoreProvider.getCache( cacheName ).clear() ); }
Source:
<code>public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = new HashMap<String, String>(); jobProperties.put(VdcObjectType.VDS.name().toLowerCase(), <START> (getVdsName() == null) ? "" : getVdsName()); <END> jobProperties.put(VdcObjectType.Storage.name().toLowerCase(), getStorageDomainName()); } return jobProperties; }</code><technical_language>is passing command a storageDomain, is ""</technical_language>

Target:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = new HashMap<String, String>(); jobProperties.put(VdcObjectType.VDS.name().toLowerCase(), (getVdsName() == null) ? "" : getVdsName()); } return jobProperties; }
Source:
<code>public static <T extends DBObject> T clone(T source) { if (source == null) { return null; } if (source instanceof BasicDBObject) { @SuppressWarnings("unchecked") T clone = (T) ((BasicDBObject) source).copy(); return clone; } if (source instanceof BasicDBList) { @SuppressWarnings("unchecked") T clone = (T) ((BasicDBList) source).copy(); return clone; } <START> if (source instanceof LazyDBList) { <END> BasicDBList clone = new BasicDBList(); Iterator it = ((LazyDBList) source).iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof DBObject) { clone.add(Util.clone((DBObject) o)); } else { clone.add(o); } } return (T) clone; } if (source instanceof LazyBSONObject) { @SuppressWarnings("unchecked") BasicDBObject clone = new BasicDBObject(); for (Map.Entry<String, Object> entry : ((LazyBSONObject) source).entrySet()) { if (entry.getValue() instanceof DBObject) { clone.put(entry.getKey(), Util.clone((DBObject) entry.getValue())); } else { clone.put(entry.getKey(), entry.getValue()); } } return (T) clone; } throw new IllegalArgumentException("Don't know how to clone: " + source); }</code><technical_language>a LazyDB object here</technical_language>

Target:
public static <T extends DBObject> T clone(T source) { if (source == null) { return null; } if (source instanceof BasicDBObject) { @SuppressWarnings("unchecked") T clone = (T) ((BasicDBObject) source).copy(); return clone; } if (source instanceof BasicDBList) { @SuppressWarnings("unchecked") T clone = (T) ((BasicDBList) source).copy(); return clone; } if (source instanceof LazyDBList) { BasicDBList clone = new BasicDBList(); Iterator it = ((LazyDBList) source).iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof DBObject) { clone.add(Util.clone((DBObject) o)); } else { clone.add(o); } } return (T) clone; } if (source instanceof LazyBSONObject) { @SuppressWarnings("unchecked") BasicDBObject clone = new BasicDBObject(); for (Map.Entry<String, Object> entry : ((LazyBSONObject) source).entrySet()) { if (entry.getValue() instanceof DBObject) { clone.put(entry.getKey(), Util.clone((DBObject) entry.getValue())); } else { clone.put(entry.getKey(), entry.getValue()); } } return (T) clone; } throw new IllegalArgumentException("Don't know how to embedded: " + source); }
Source:
<code>public static void main(String[] args) { try { ScrubInputs scrubInputs = new ScrubInputs(); if(args.length == 0){ logger.info("{}{}{}", <START> "Command line options can be displayed with the --help arguemnt.", <END> SystemProperties.lineSeparator, "Entering interactive mode."); scrubInputs.interactive = true; scrubInputs.runInteractive(); } else { List<String> errors = scrubInputs.parseIinputs(args); if (errors.size() > 0) { for(String err: errors){ logger.info(err); } scrubInputs.usage(); logger.info("Exiting..."); System.exit(0); } } ResourceCache.terminal.dispose(); new ScrubService().exec(scrubInputs); } catch (Exception e) { logger.info("Fatal error occurred: {}. {}", e.getMessage(), Constants.CHECK_LOG); } finally { ResourceCache.closeAll(); } }</code><technical_language>I if easier read this if flips order of text: Entering interactive mode. Command line options displayed --help arguemnt. people entering interactive mode stop reading (rather line, stop reading second). do line separator appearing in logs</technical_language>

Target:
public static void main(String[] args) { try { ScrubInputs scrubInputs = new ScrubInputs(); if(args.length == 0){ logger.info(Constants.interactiveMsg); scrubInputs.interactive = true; scrubInputs.runInteractive(); } else { List<String> errors = scrubInputs.parseIinputs(args); if (errors.size() > 0) { for(String err: errors){ logger.info(err); } scrubInputs.usage(); logger.info("Exiting..."); System.exit(0); } } ResourceCache.terminal.dispose(); new ScrubService().exec(scrubInputs); } catch (Exception e) { logger.info("Fatal error occurred: {}. {}", e.getMessage(), Constants.CHECK_LOG); } finally { ResourceCache.closeAll(); } }
Source:
<code>public synchronized Throwable getCause() { if (cause == null) { CompositeExceptionCausalChain _cause = new CompositeExceptionCausalChain(); Set<Throwable> seenCauses = new HashSet<Throwable>(); Throwable chain = _cause; for (Throwable e : exceptions) { if (seenCauses.contains(e)) { continue; } seenCauses.add(e); List<Throwable> listOfCauses = getListOfCauses(e); for(Throwable child : listOfCauses) { if (seenCauses.contains(child)) { e = new RuntimeException("Duplicate found in causal chain so cropping to prevent loop ..."); continue; } seenCauses.add(child); } try { chain.initCause(e); } catch (Throwable t) { chain = e; } <START> chain = chain.getCause(); <END> } cause = _cause; } return cause; }</code><technical_language>I this line moved try clause. Otherwise, chain assigned here</technical_language>

Target:
public synchronized Throwable getCause() { if (cause == null) { CompositeExceptionCausalChain _cause = new CompositeExceptionCausalChain(); Set<Throwable> seenCauses = new HashSet<Throwable>(); Throwable chain = _cause; for (Throwable e : exceptions) { if (seenCauses.contains(e)) { continue; } seenCauses.add(e); List<Throwable> listOfCauses = getListOfCauses(e); for(Throwable child : listOfCauses) { if (seenCauses.contains(child)) { e = new RuntimeException("Duplicate found in causal chain so cropping to prevent loop ..."); continue; } seenCauses.add(child); } try { chain.initCause(e); chain = chain.getCause(); } catch (Throwable t) { chain = e; } } cause = _cause; } return cause; }
Source:
<code>private void populateFilters() { this.testingCheck = new SidebarCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); <START> this.requiresPatchCheck = new SidebarCheckBox(tr("Patch Required")); <END> this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new SidebarCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new SidebarCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new SidebarGroup("Filters", testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }</code><technical_language>upper case "R"</technical_language>

Target:
private void populateFilters() { this.testingCheck = new SidebarCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new SidebarCheckBox(tr("Patch required")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new SidebarCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new SidebarCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new SidebarGroup("Filters", testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }
Source:
<code>public void start() throws SchedulerException { try { this.scheduler.start(); logger.info("Quartz Scheduler started."); } catch (SchedulerConfigException e) { if(e.getCause() instanceof org.quartz.JobPersistenceException) { if(e.getCause().getCause() instanceof java.io.InvalidClassException) { if(enableSerializationHack()) { try { <START> this.scheduler.start(); <END> logger.info("Quartz Scheduler started (with serialization hack)."); return; } catch (SchedulerConfigException e2) { logger.error("Error initializing hacked scheduler", e2); } } } } logger.error("Error initializing scheduler", e); scheduler = null; } }</code><technical_language>planning change serialized objects in db? follow multiple versions of serialized objects? I personally comfortable catching exception add constructing version objects</technical_language>

Target:
public void start() throws SchedulerException { try { this.scheduler.start(); logger.info("Quartz Scheduler started."); } catch (SchedulerConfigException e) { if (isSerializationBug(e) && enableSerializationHack()) { try { this.scheduler.start(); logger.info("Quartz Scheduler started (with serialization hack)."); return; } catch (SchedulerConfigException e2) { logger.error("Error initializing hacked scheduler", e2); } } logger.error("Error initializing scheduler", e); scheduler = null; } }
Source:
<code>public void add(ComplexEventChunk<StreamEvent> addingEventChunk) throws ConnectionUnavailableException { if (isCacheEnabled) { ComplexEventChunk<StreamEvent> addingEventChunkWithTimestamp = new ComplexEventChunk<>(); while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); Object[] outputData = event.getOutputData(); Object[] outputDataWithTimeStamp = appendValue(outputData, <START> new Timestamp(System.currentTimeMillis()).getTime()); <END> StreamEvent eventWithTimeStamp = new StreamEvent(0, 0, outputDataWithTimeStamp.length); eventWithTimeStamp.setOutputData(outputDataWithTimeStamp); addingEventChunkWithTimestamp.add(eventWithTimeStamp); } cachedTable.add(addingEventChunk); if (cachedTable.size() > maxCacheSize) { isCacheEnabled = false; log.warn(siddhiAppContext.getName() + ": " + cacheTableDefinition.getId() + " size is now " + cachedTable.size() + " which is bigger than cache table size defined as " + maxCacheSize + ". So cache is now disabled"); } } List<Object[]> records = new ArrayList<>(); addingEventChunk.reset(); long timestamp = 0L; while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); records.add(event.getOutputData()); timestamp = event.getTimestamp(); } if (recordTableHandler != null) { recordTableHandler.add(timestamp, records); } else { add(records); } }</code><technical_language>siddhi's timestamp, get context. do System.currentTimeMillis()</technical_language>

Target:
public void add(ComplexEventChunk<StreamEvent> addingEventChunk) throws ConnectionUnavailableException { if (isCacheEnabled) { ComplexEventChunk<StreamEvent> addingEventChunkWithTimestamp = new ComplexEventChunk<>(); while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); Object[] outputData = event.getOutputData(); Object[] outputDataWithTimeStamp = new Object[outputData.length + 1]; System.arraycopy(outputData, 0 , outputDataWithTimeStamp, 0, outputData.length); outputDataWithTimeStamp[outputDataWithTimeStamp.length - 1] = siddhiAppContext.getTimestampGenerator().currentTime(); StreamEvent eventWithTimeStamp = new StreamEvent(0, 0, outputDataWithTimeStamp.length); eventWithTimeStamp.setOutputData(outputDataWithTimeStamp); addingEventChunkWithTimestamp.add(eventWithTimeStamp); } } List<Object[]> records = new ArrayList<>(); addingEventChunk.reset(); long timestamp = 0L; while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); records.add(event.getOutputData()); timestamp = event.getTimestamp(); } if (isCacheEnabled) { readWriteLock.writeLock().lock(); try { cachedTable.add(addingEventChunk); if (recordTableHandler != null) { recordTableHandler.add(timestamp, records); } else { add(records); } } finally { readWriteLock.writeLock().unlock(); } if (cachedTable.size() > maxCacheSize) { isCacheEnabled = false; log.warn(siddhiAppContext.getName() + ": " + cacheTableDefinition.getId() + " size is now " + cachedTable.size() + " which is bigger than cache table size defined as " + maxCacheSize + ". So cache is now disabled"); } } else { if (recordTableHandler != null) { recordTableHandler.add(timestamp, records); } else { add(records); } } }
Source:
<code>public void changePassword_nullThrows() { SyncUser user = createTestUser(); try { <START> user.changePassword(null); <END> fail(); } catch (IllegalArgumentException ignored) { } }</code><technical_language>ExpectedException shorter</technical_language>

Target:
public void changePassword_nullThrows() { SyncUser user = createTestUser(); thrown.expect(IllegalArgumentException.class); user.changePassword(null); }
Source:
<code>public boolean shouldRender(Minecraft minecraft) { EntityPlayer player = Minecraft.getMinecraft().player; ItemStack sigilStack = player.getHeldItem(EnumHand.MAIN_HAND); boolean flag = false; if (simple) { if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION) flag = true; if(!flag) flag = isFlagSigilHolding(sigilStack, true); if (!flag) { sigilStack = player.getHeldItem(EnumHand.OFF_HAND); if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION) flag = true; } if(!flag) { <START> flag = isFlagSigilHolding(sigilStack, true); <END> } } else { if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER) flag = true; if(!flag) flag = isFlagSigilHolding(sigilStack, false); if (!flag) { sigilStack = player.getHeldItem(EnumHand.OFF_HAND); if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER) flag = true; } if(!flag) flag = isFlagSigilHolding(sigilStack, false); } return super.shouldRender(minecraft) && flag; }</code><technical_language>Move this if block logic flow clearer</technical_language>

Target:
public boolean shouldRender(Minecraft minecraft) { EntityPlayer player = Minecraft.getMinecraft().player; ItemStack sigilStack = player.getHeldItem(EnumHand.MAIN_HAND); boolean flag = false; if (simple) { if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION) flag = true; else flag = isFlagSigilHolding(sigilStack, true); if (!flag) { sigilStack = player.getHeldItem(EnumHand.OFF_HAND); if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION) flag = true; else flag = isFlagSigilHolding(sigilStack, true); } } else { if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER) flag = true; else flag = isFlagSigilHolding(sigilStack, false); if (!flag) { sigilStack = player.getHeldItem(EnumHand.OFF_HAND); if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER) flag = true; else flag = isFlagSigilHolding(sigilStack, false); } } return super.shouldRender(minecraft) && flag; }
Source:
<code>public void testUpsertAndDeleteWithGlobalIndex() throws Exception { Assume.assumeTrue(HbaseCompatCapabilities.hasPreWALAppend()); SchemaBuilder builder = new SchemaBuilder(getUrl()); boolean createGlobalIndex = true; long ddlTimestamp = upsertAndDeleteHelper(builder, createGlobalIndex); assertAnnotation(2, builder.getPhysicalTableName(false), null, builder.getTableOptions().getSchemaName(), builder.getDataOptions().getTableName(), PTableType.TABLE, ddlTimestamp); assertAnnotation(0, builder.getPhysicalTableIndexName(false), null, builder.getTableOptions().getSchemaName(), SchemaUtil.getTableNameFromFullName(builder.getEntityTableIndexName()), PTableType.INDEX, <START> ddlTimestamp); <END> }</code><technical_language>expect 0 numOccurences, logicalname ddlTimestamp right? pass in null modify assertAnnotation() this clear</technical_language>

Target:
public void testUpsertAndDeleteWithGlobalIndex() throws Exception { Assume.assumeTrue(HbaseCompatCapabilities.hasPreWALAppend()); SchemaBuilder builder = new SchemaBuilder(getUrl()); boolean createGlobalIndex = true; long ddlTimestamp = upsertAndDeleteHelper(builder, createGlobalIndex); assertAnnotation(2, builder.getPhysicalTableName(false), null, builder.getTableOptions().getSchemaName(), builder.getDataOptions().getTableName(), PTableType.TABLE, ddlTimestamp); assertAnnotation(0, builder.getPhysicalTableIndexName(false), null, null, null, null, ddlTimestamp); }
Source:
<code>public void openAndCloseEvent() { Single.just("1") .delay(1, TimeUnit.MILLISECONDS, testScheduler) .compose(new UntilCorrespondingEventSingleTransformer<String, String>(lifecycle, CORRESPONDING_EVENTS)) .subscribe(testSubscriber); lifecycle.onNext("create"); lifecycle.onNext("destroy"); <START> testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); <END> testSubscriber.assertNoValues(); testSubscriber.assertError(CancellationException.class); }</code><technical_language>is missing</technical_language>

Target:
public void openAndCloseEvent() { Single.just("1") .delay(1, TimeUnit.MILLISECONDS, testScheduler) .compose(new UntilCorrespondingEventSingleTransformer<String, String>(lifecycle, CORRESPONDING_EVENTS)) .subscribe(testSubscriber); lifecycle.onNext("create"); testSubscriber.assertNoErrors(); lifecycle.onNext("destroy"); testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); testSubscriber.assertNoValues(); testSubscriber.assertError(CancellationException.class); }
Source:
<code>public int hashCode() { <START> return Objects.hash(message, sqlState, errorCode, errorName, errorType, errorLocation, failureInfo); <END> }</code><technical_language>please order in equals obvious (why is equals required?)</technical_language>

Target:
public int hashCode() { return Objects.hash(errorCode, message, sqlState, errorName, errorType, errorLocation, failureInfo); }
Source:
<code>public Map<Consumer, List<Entitlement>> getDistinctConsumers( List<Entitlement> entsToRevoke) { Map<Consumer, List<Entitlement>> result = new HashMap<Consumer, List<Entitlement>>(); for (Entitlement ent : entsToRevoke) { <START> if (!result.containsKey(ent.getConsumer())) { <END> result.put(ent.getConsumer(), new ArrayList<Entitlement>()); } result.get(ent.getConsumer()).add(ent); } return result; }</code><technical_language>I get key, if key null create entry idiom crog suggested in review</technical_language>

Target:
public Map<Consumer, List<Entitlement>> getDistinctConsumers( List<Entitlement> entsToRevoke) { Map<Consumer, List<Entitlement>> result = new HashMap<Consumer, List<Entitlement>>(); for (Entitlement ent : entsToRevoke) { List<Entitlement> ents = result.get(ent.getConsumer()); if (ents == null) { ents = new ArrayList<Entitlement>(); result.put(ent.getConsumer(), ents); } ents.add(ent); } return result; }
Source:
<code>public QName(final String namespaceURI, final String localPart, final String prefix) { if (namespaceURI == null) { setNamespaceURI(XMLConstants.NULL_NS_URI); } else { setNamespaceURI(namespaceURI); } if (localPart == null) { throw new IllegalArgumentException( <START> "local part cannot be \"null\" when creating a QName"); <END> } setLocalPart(localPart); if (prefix == null) { throw new IllegalArgumentException( "prefix cannot be \"null\" when creating a QName"); } setPrefix(prefix); setKey(toString()); final String usedPrefix = !StringUtils.isEmpty(getPrefix()) ? getPrefix() + ":" : ""; final String string = "{" + getNamespaceURI() + "}" + usedPrefix + getLocalPart(); setString(string); }</code><technical_language>fit easily line</technical_language>

Target:
public QName(final String namespaceURI, final String localPart, final String prefix) { if (Objects.isNull(namespaceURI)) { setNamespaceURI(XMLConstants.NULL_NS_URI); } else { setNamespaceURI(namespaceURI); } if (Objects.isNull(localPart)) { throw new IllegalArgumentException("local part cannot be \"null\" when creating a QName"); } setLocalPart(localPart); if (Objects.isNull(prefix)) { throw new IllegalArgumentException("prefix cannot be \"null\" when creating a QName"); } setPrefix(prefix); setKey(toString()); final String usedPrefix = !StringUtils.isEmpty(getPrefix()) ? getPrefix() + ":" : ""; final String string = "{" + getNamespaceURI() + "}" + usedPrefix + getLocalPart(); setString(string); }
Source:
<code>public static IPluggableSerializer getSerializer(Map<String, Object> config) { IPluggableSerializer serializer; try { String serializerClassName = (String) config.get(Config.TOPOLOGY_SERIALIZER_CLASSNAME); if (serializerClassName == null) { LOG.log(Level.WARNING, "Serializer class name not provided"); LOG.log(Level.WARNING, "Fall back to Java serializer. " + "This could cause serious performance degradation"); <START> LOG.log(Level.WARNING, "You can specify to use Kryo as serializer. " <END> + "See <LINK_0> for details"); serializer = new JavaSerializer(); } else { serializer = (IPluggableSerializer) Class.forName(serializerClassName).newInstance(); } serializer.initialize(config); return serializer; } catch (ClassNotFoundException ex) { throw new RuntimeException("Serializer class must be in class path " + ex); } catch (InstantiationException ex) { throw new RuntimeException( "Serializer class must be concrete and have a nullary constructor " + ex); } catch (IllegalAccessException ex) { throw new RuntimeException("Serializer class constructor must be public " + ex); } }</code><technical_language>please include in log message? typically entire log entry in longer warning line breaks, split multiple lines</technical_language>

Target:
public static IPluggableSerializer getSerializer(Map<String, Object> config) { IPluggableSerializer serializer; try { String serializerClassName = (String) config.get(Config.TOPOLOGY_SERIALIZER_CLASSNAME); if (serializerClassName == null) { LOG.log(Level.WARNING, "Serializer class name not provided. " + "Fall back to Java serializer. " + "This could cause serious performance degradation. " + "You can specify to use Kryo as serializer. " + "See <LINK_0> for details"); serializer = new JavaSerializer(); } else { serializer = (IPluggableSerializer) Class.forName(serializerClassName).newInstance(); } serializer.initialize(config); return serializer; } catch (ClassNotFoundException ex) { throw new RuntimeException("Serializer class must be in class path " + ex); } catch (InstantiationException ex) { throw new RuntimeException( "Serializer class must be concrete and have a nullary constructor " + ex); } catch (IllegalAccessException ex) { throw new RuntimeException("Serializer class constructor must be public " + ex); } }
Source:
<code>public static void unzip(String zipFilename, String[] filenames, String outdir) throws IOException { ZipFile zipFile = new ZipFile(zipFilename); Enumeration entries = zipFile.entries(); L1: while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); for (int i = 0; i < filenames.length; i++) { if (entry.getName().equals(filenames[i])) { <START> Utilities.assertNotZipSlipVulnarable(outdir + "\\" + filenames[i], outdir); <END> byte[] buffer = new byte[1024]; int len; InputStream zipin = zipFile.getInputStream(entry); BufferedOutputStream fileout = new BufferedOutputStream( new FileOutputStream(outdir + "\\" + filenames[i])); while ((len = zipin.read(buffer)) >= 0) fileout.write(buffer, 0, len); zipin.close(); fileout.flush(); fileout.close(); continue L1; } } } }</code><technical_language>This file concatenation is windows specific. building a File object in assert method, new File(outdir, filenames[i]) instead</technical_language>

Target:
public static void unzip(String zipFilename, String[] filenames, String outdir) throws IOException { ZipFile zipFile = new ZipFile(zipFilename); Enumeration entries = zipFile.entries(); L1: while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); for (int i = 0; i < filenames.length; i++) { if (entry.getName().equals(filenames[i])) { Utilities.assertNotZipSlipVulnarable( new File(outdir, filenames[i]), Paths.get(outdir)); byte[] buffer = new byte[1024]; int len; InputStream zipin = zipFile.getInputStream(entry); BufferedOutputStream fileout = new BufferedOutputStream( new FileOutputStream(new File(outdir, filenames[i]))); while ((len = zipin.read(buffer)) >= 0) fileout.write(buffer, 0, len); zipin.close(); fileout.flush(); fileout.close(); continue L1; } } } }