auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>CorrelationAttributeInstance( Type type, String value, int instanceId, CorrelationCase eamCase, CorrelationDataSource eamDataSource, String filePath, String comment, TskData.FileKnown knownStatus ) throws EamDbException { if (filePath == null) { throw new EamDbException("file path is null"); } if (value == null) { <START> throw new EamDbException("md5 value is null"); <END> } this.correlationType = type; this.correlationValue = value; this.ID = instanceId; this.correlationCase = eamCase; this.correlationDataSource = eamDataSource; this.filePath = filePath.toLowerCase(); this.comment = comment; this.knownStatus = knownStatus; }</code><technical_language>md5</technical_language>

Target:
CorrelationAttributeInstance( Type type, String value, int instanceId, CorrelationCase eamCase, CorrelationDataSource eamDataSource, String filePath, String comment, TskData.FileKnown knownStatus ) throws EamDbException { if (filePath == null) { throw new EamDbException("file path is null"); } if (value == null) { throw new EamDbException("correlation value is null"); } this.correlationType = type; this.correlationValue = value; this.ID = instanceId; this.correlationCase = eamCase; this.correlationDataSource = eamDataSource; this.filePath = filePath.toLowerCase(); this.comment = comment; this.knownStatus = knownStatus; }
Source:
<code>public static double similarityValue(double[] referenceEIC, double[] gaussianValues, int leftBound, int rightBound) { double diffArea = 0.0; for (int j = 0; j < rightBound - leftBound; j++) { diffArea += Math.abs(0.5 * ((referenceEIC[j] - gaussianValues[j]) + (referenceEIC[j + 1] - gaussianValues[j + 1]))); } final double exponentFactor = 0.2; final double exponentShift = Math.exp(-1 / exponentFactor); final double exponentHeight = 1.0 / (1.0 - exponentShift); <START> <END> double curSimilarity = ((Math.exp(-diffArea / exponentFactor)) - exponentShift) * exponentHeight; return curSimilarity; }</code><technical_language>class constants</technical_language>

Target:
public static double similarityValue(double[] referenceEIC, double[] gaussianValues, int leftBound, int rightBound) { double diffArea = 0.0; for (int j = 0; j < rightBound - leftBound; j++) { diffArea += Math.abs(0.5 * ((referenceEIC[j] - gaussianValues[j]) + (referenceEIC[j + 1] - gaussianValues[j + 1]))); } double curSimilarity = ((Math.exp(-diffArea / EXPONENT_FACTOR)) - EXPONENT_SHIFT) * EXPONENT_HEIGHT; return curSimilarity; }
Source:
<code>private static <T, S> void completeAllExceptionally( Map<T, CompletableFuture<S>> futuresByValue, Queue<T> valueQueue) { runUntilEmpty(valueQueue, value -> futuresByValue.get(value).completeExceptionally( <START> new RuntimeException("Task terminated early due to another concurrent request failing"))); <END> }</code><technical_language>chain originating exception this bloat? preallocate a dummy exception stacktrace avoid log bloat overhead in times of strife</technical_language>

Target:
private static <T, S> void completeAllExceptionally( Map<T, CompletableFuture<S>> futuresByValue, Queue<T> valueQueue) { runUntilEmpty(valueQueue, value -> futuresByValue.get(value).completeExceptionally(TASK_CANCELED_EXCEPTION)); }
Source:
<code>public QueryRequest getGazetteerFilter() { <START> return new QueryRequestImpl( <END> new QueryImpl( filterBuilder.attribute(Core.METACARD_TAGS).like().text("gazetteer"), 1, PARTITION_SIZE, new SortByImpl(Core.ID, SortOrder.ASCENDING), true, TimeUnit.MINUTES.toMillis(3))); }</code><technical_language>nice print some kind of progress bar. similar this? <LINK_0></technical_language>

Target:
public QueryRequest getGazetteerFilter() { return new QueryRequestImpl( new QueryImpl( filterBuilder.attribute(Core.METACARD_TAGS).like().text(GAZETTEER_METACARD_TAG), 1, PARTITION_SIZE, new SortByImpl(Core.ID, SortOrder.ASCENDING), true, TimeUnit.MINUTES.toMillis(3))); }
Source:
<code>private void performRequestedAction(){ if (mNote != null) { if (mActionType != null) { switch (mActionType) { case ARG_ACTION_LIKE: likeComment(); case ARG_ACTION_APPROVE: approveComment(); case ARG_ACTION_REPLY: <START> replyToComment(); <END> } } else { requestFailed(null); } } else { requestFailed(null); } }</code><technical_language>Default action is missing. returns requestFailed(null);</technical_language>

Target:
private void performRequestedAction(){ if (mNote != null) { if (mActionType != null) { switch (mActionType) { case ARG_ACTION_LIKE: likeComment(); break; case ARG_ACTION_APPROVE: approveComment(); break; case ARG_ACTION_REPLY: replyToComment(); break; default: requestFailed(null); break; } } else { requestFailed(null); } } else { requestFailed(null); } }
Source:
<code>public void isGreaterThan() { assertTrue(V3_0.isGreaterThan(of(2, 0))); assertFalse(V3_0.isGreaterThan(of(3, 0))); assertFalse(V3_0.isGreaterThan(of(4, 0))); assertTrue(V3_0.isGreaterThan(NEGATIVE_VERSION_1)); <START> assertTrue(NEGATIVE_VERSION_1.isGreaterThan(NEGATIVE_VERSION_2)); <END> }</code><technical_language>expect this other around, version is a WAN version. thinking subclassing Version. create ClusterVersion WanVersion - compare/sort versions properly, - validate set a cluster version, replaced a WAN version (checking sign bit) vice-versa. WDYT</technical_language>

Target:
public void isGreaterThan() throws Exception { assertTrue(V3_0.isGreaterThan(of(2, 0))); assertFalse(V3_0.isGreaterThan(of(3, 0))); assertFalse(V3_0.isGreaterThan(of(4, 0))); }
Source:
<code>public void testGroupByLongColumnWithExFn() { String jsFn = "function(str) { return 'super-' + str; }"; ExtractionFn jsExtractionFn = new JavaScriptExtractionFn(jsFn, false, JavaScriptConfig.getDefault()); GroupByQuery query = GroupByQuery .builder() .setDataSource(QueryRunnerTestHelper.dataSource) .setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird) <START> .setDimensions(Lists.<DimensionSpec>newArrayList(new ExtractionDimensionSpec("__time", "time_alias", jsExtractionFn))) <END> .setDimFilter(new SelectorDimFilter("quality", "entertainment", null)) .setAggregatorSpecs( Arrays.asList( QueryRunnerTestHelper.rowsCount, new LongSumAggregatorFactory("idx", "index") ) ) .setGranularity(QueryRunnerTestHelper.dayGran) .build(); List<Row> expectedResults = Arrays.asList( GroupByQueryRunnerTestHelper.createExpectedRow( "2011-04-01", "time_alias", "super-1301616000000", "rows", 1L, "idx", 158L ), GroupByQueryRunnerTestHelper.createExpectedRow( "2011-04-02", "time_alias", "super-1301702400000", "rows", 1L, "idx", 166L ) ); Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query); TestHelper.assertExpectedObjects(expectedResults, results, ""); }</code><technical_language>This test is good, please include another test other __time. __time special-case handling a good exercising of general long columns</technical_language>

Target:
public void testGroupByLongColumnWithExFn() { if (config.getDefaultStrategy().equals(GroupByStrategySelector.STRATEGY_V1)) { expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("GroupBy v1 does not support dimension selectors with unknown cardinality."); } String jsFn = "function(str) { return 'super-' + str; }"; ExtractionFn jsExtractionFn = new JavaScriptExtractionFn(jsFn, false, JavaScriptConfig.getDefault()); GroupByQuery query = GroupByQuery .builder() .setDataSource(QueryRunnerTestHelper.dataSource) .setQuerySegmentSpec(QueryRunnerTestHelper.firstToThird) .setDimensions(Lists.<DimensionSpec>newArrayList(new ExtractionDimensionSpec("qualityLong", "ql_alias", jsExtractionFn))) .setDimFilter(new SelectorDimFilter("quality", "entertainment", null)) .setAggregatorSpecs( Arrays.asList( QueryRunnerTestHelper.rowsCount, new LongSumAggregatorFactory("idx", "index") ) ) .setGranularity(QueryRunnerTestHelper.dayGran) .build(); List<Row> expectedResults = Arrays.asList( GroupByQueryRunnerTestHelper.createExpectedRow( "2011-04-01", "ql_alias", "super-1200", "rows", 1L, "idx", 158L ), GroupByQueryRunnerTestHelper.createExpectedRow( "2011-04-02", "ql_alias", "super-1200", "rows", 1L, "idx", 166L ) ); Iterable<Row> results = GroupByQueryRunnerTestHelper.runQuery(factory, runner, query); TestHelper.assertExpectedObjects(expectedResults, results, ""); }
Source:
<code>private void notifyListeners(Repository repository, IndexDiffData indexDiffData) { IndexDiffChangedListener[] tmpListeners; synchronized (listeners) { tmpListeners = listeners .toArray(new IndexDiffChangedListener[0]); } for (int i = 0; i < tmpListeners.length; i++) { try { tmpListeners[i].indexDiffChanged(repository, indexDiffData); } catch (RuntimeException e) { Activator.logError( <START> "Exception occurred in an IndexDiffChangedListener", e); END> } } }</code><technical_language>error message externalized</technical_language>

Target:
private void notifyListeners(Repository repository, IndexDiffData indexDiffData) { for (IndexDiffChangedListener listener : listeners) { SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.indexDiffChanged(repository, indexDiffData); } @Override public void handleException(Throwable exception) { } }); } }
Source:
<code>public void testThatTaskKillerInterruptsThreadImmediatelyWhenSetToNegativeNumber() { KilledThread testThreadToBeInterrupted = new KilledThread(); testThreadToBeInterrupted.start(); System.setProperty(this.taskKillerCleanupTimePropertyName, "-20"); TaskKiller taskKiller = new TaskKiller(testThreadToBeInterrupted); assertThat("Task Killer must not interrupt thread before kill() is called", testThreadToBeInterrupted.isInterruptedOnce, is(false)); assertThat("Task Killer must not interrupt thread before kill() is called", testThreadToBeInterrupted.isInterruptedMoreThanOnce, is(false)); startKilling(taskKiller); waitOrFailTest(100); <START> assertThat("Task Killer must must interrupt once if kill() is called and then wait for the timeout which is set to 10 seconds.", <END> testThreadToBeInterrupted.isInterruptedOnce, is(true)); assertThat("Task Killer must only interrupt once (not twice) after kill() is called and then wait for the timeout which is set to 10 seconds.", testThreadToBeInterrupted.isInterruptedMoreThanOnce, is(true)); System.clearProperty(this.taskKillerCleanupTimePropertyName); }</code><technical_language>typo</technical_language>

Target:
public void testThatTaskKillerInterruptsThreadImmediatelyWhenSetToNegativeNumber() { KilledThread testThreadToBeInterrupted = new KilledThread(); testThreadToBeInterrupted.start(); System.setProperty(this.taskKillerCleanupTimePropertyName, "-20"); TaskKiller taskKiller = new TaskKiller(testThreadToBeInterrupted); assertThat("Task Killer must not interrupt thread before kill() is called", testThreadToBeInterrupted.isInterruptedOnce, is(false)); assertThat("Task Killer must not interrupt thread before kill() is called", testThreadToBeInterrupted.isInterruptedMoreThanOnce, is(false)); startKilling(taskKiller); waitOrFailTest(100); assertThat("Task Killer must interrupt once if kill() is called and then wait for the timeout which is set to 10 seconds.", testThreadToBeInterrupted.isInterruptedOnce, is(true)); assertThat("Task Killer must only interrupt once (not twice) after kill() is called and then wait for the timeout which is set to 10 seconds.", testThreadToBeInterrupted.isInterruptedMoreThanOnce, is(true)); System.clearProperty(this.taskKillerCleanupTimePropertyName); }
Source:
<code>public ClassicUpload(String bucket, @Nullable UploadModule module, String pattern, String metadata, @Deprecated @Nullable String bucketNameWithVars, @Deprecated @Nullable String sourceGlobWithVars) { super(Objects.firstNonNull(bucket, bucketNameWithVars), module); this.sourceGlobWithVars = Objects.firstNonNull(pattern, sourceGlobWithVars); <START> this.metadata = Objects.firstNonNull(metadata, sourceGlobWithVars); <END> }</code><technical_language>Is this right use</technical_language>

Target:
public ClassicUpload(String bucket, @Nullable UploadModule module, String pattern, String metadata, @Deprecated @Nullable String bucketNameWithVars, @Deprecated @Nullable String sourceGlobWithVars) { super(firstNonNull(bucket, bucketNameWithVars), module); this.sourceGlobWithVars = firstNonNull(pattern, sourceGlobWithVars); this.metadata = metadata; }
Source:
<code>public void shutdown() { <START> forkJoinPool.shutdownNow(); <END> }</code><technical_language>wait for tasks finish. need awaitTermination call. timeout of 60 seconds? is is in Scheduler class</technical_language>

Target:
public void shutdown() { forkJoinPool.shutdownNow(); try { forkJoinPool.awaitTermination(60, TimeUnit.SECONDS); } catch (Exception e) { LOG.error("Unexpected exception occurred during shutdown of " + "RatisPipelineProvider", e); } }
Source:
<code>protected int getExpectedNumEntries() { <START> return getNumEntries() * (backupValueGenerator != null ? backupCacheInstances.length + 1 : 1); <END> }</code><technical_language>backupCacheInstances != null ? backupCacheInstances.length + 1 : 1 more sense</technical_language>

Target:
protected int getExpectedNumEntries() { return getNumEntries() * (backupCacheInstances != null ? backupCacheInstances.length + 1 : 1); }
Source:
<code>public ValueMatcher makeValueMatcher(String dimension, final Comparable value) { final DimensionSelector selector = cursor.makeDimensionSelector( new DefaultDimensionSpec(dimension, dimension) ); final boolean matchNull = isComparableNullOrEmpty(value); final int id = selector.lookupId((String) value); if (id < 0) { <START> return new BooleanValueMatcher(false); <END> } else { return new ValueMatcher() { @Override public boolean matches() { IndexedInts row = selector.getRow(); if(row.size() == 0) { return matchNull; } for (int rowVal : row) { if (rowVal == id) { return true; } } return false; } }; } }</code><technical_language>this BooleanValueMatcher(matchNull)</technical_language>

Target:
public ValueMatcher makeValueMatcher(String dimension, final Comparable value) { final DimensionSelector selector = cursor.makeDimensionSelector( new DefaultDimensionSpec(dimension, dimension) ); final boolean matchNull = isComparableNullOrEmpty(value); final int id = selector.lookupId((String) value); if (id < 0) { return new BooleanValueMatcher(false); } else { return new ValueMatcher() { @Override public boolean matches() { IndexedInts row = selector.getRow(); if (row.size() == 0) { return matchNull; } for (int i = 0; i < row.size(); i++) { if (row.get(i) == id) { return true; } } return false; } }; } }
Source:
<code>protected void render0(FunctionRenderContext context) { context.addChunk("jsonb_set("); context.addArgument(0); <START> context.addChunk("::jsonb,"); <END> context.addChunk("'{"); addUnquotedArgument(context, 2); for (int i = 3; i < context.getArgumentsSize(); i++) { context.addChunk(","); addUnquotedArgument(context, i); } context.addChunk("}',"); context.addArgument(1); context.addChunk(")"); }</code><technical_language>cast(... jsonb) syntax instead avoid issues subqueries happen in older hibernate versions</technical_language>

Target:
protected void render0(FunctionRenderContext context) { context.addChunk("jsonb_set(cast("); context.addArgument(0); context.addChunk(" as jsonb),"); context.addChunk("'{"); addUnquotedArgument(context, 2); for (int i = 3; i < context.getArgumentsSize(); i++) { context.addChunk(","); addUnquotedArgument(context, i); } context.addChunk("}',"); context.addArgument(1); context.addChunk(")"); }
Source:
<code>private static @BinaryName String basenamePart(@BinaryName String className) { int lastdot = className.lastIndexOf('.'); <START> return (lastdot == -1) ? className : className.substring(lastdot + 1); <END> }</code><technical_language>return className.substring(lastdot + 1); work</technical_language>

Target:
private static @BinaryName String basenamePart(@BinaryName String className) { int lastdot = className.lastIndexOf('.'); return className.substring(lastdot + 1); }
Source:
<code>public String render(Number number) { if (number != null) { NumberFormat format = NumberFormat.getDecimalFormat(); return format.format(number); } else { <START> return null; <END> } }</code><technical_language>A renderer return some meaningful text. If number is null, return CommonApplicationConstants.unAvailablePropertyLabel() empty string, depending UI expectations. Anyway, a class covers here: NullableNumberRenderer class RxTxTotalRenderer extends NullableNumberRenderer { public RxTxTotalRenderer() { super(NumberFormat.getDecimalFormat()); } }</technical_language>

Target:
public String render(Number number) { if (number != null) { NumberFormat format = NumberFormat.getDecimalFormat(); return format.format(number); } else { return ""; } }
Source:
<code>public void onClick(View v) { if (v == mCancelBtn) { finish(); } else if (v == mChooseBtn) { Intent i = getIntent(); <START> OCFile targetFile = (OCFile) i.getParcelableExtra(FolderPickerActivity.EXTRA_TARGET_FILE); <END> Intent data = new Intent(); data.putExtra(EXTRA_CURRENT_FOLDER, getCurrentFolder()); data.putExtra(EXTRA_TARGET_FILE, targetFile); setResult(RESULT_OK, data); finish(); } }</code><technical_language>Modify this line, possibility of extra NULL is account. Besides, cast OCFile; Parcelable is good enough, done object is passing a Parcelable lines later. (But if null)</technical_language>

Target:
public void onClick(View v) { if (v == mCancelBtn) { finish(); } else if (v == mChooseBtn) { Intent i = getIntent(); Parcelable targetFile = i.getParcelableExtra(FolderPickerActivity.EXTRA_FILE); Intent data = new Intent(); data.putExtra(EXTRA_FOLDER, getCurrentFolder()); if (targetFile != null) { data.putExtra(EXTRA_FILE, targetFile); } setResult(RESULT_OK, data); finish(); } }
Source:
<code>private boolean shouldCancelBecauseOfRunningLaunches() { if (mode == MODE_CHECKOUT) return false; final IPreferenceStore store = Activator.getDefault().getPreferenceStore(); if (!store .getBoolean(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING)) return false; final ILaunchConfiguration launchConfiguration = getRunningLaunchConfiguration(); if (launchConfiguration != null) { <START> final Boolean[] dialogResult = new Boolean[1]; <END> PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { dialogResult[0] = showContinueDialogInUI(store, launchConfiguration); } }); return dialogResult[0].booleanValue(); } return false; }</code><technical_language>this is Boolean instead of boolean (I'll fix)</technical_language>

Target:
private boolean shouldCancelBecauseOfRunningLaunches() { if (mode == MODE_CHECKOUT) return false; final IPreferenceStore store = Activator.getDefault().getPreferenceStore(); if (!store .getBoolean(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING)) return false; final ILaunchConfiguration launchConfiguration = getRunningLaunchConfiguration(); if (launchConfiguration != null) { final boolean[] dialogResult = new boolean[1]; PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { public void run() { dialogResult[0] = showContinueDialogInUI(store, launchConfiguration); } }); return dialogResult[0]; } return false; }
Source:
<code>public void removeType( final String typeName ) { final Short adapterId = internalAdapterStore.getAdapterId(typeName); if (adapterId != -1) { final AdapterToIndexMapping mapping = indexMappingStore.getIndicesForAdapter(adapterId); final String[] indexNames = mapping.getIndexNames(); for (int i = 0; i < indexNames.length; i++) { baseOperations.deleteAll( indexNames[i], <START> "", <END> adapterId); } statisticsStore.removeAllStatistics(adapterId); indexMappingStore.remove(adapterId); internalAdapterStore.remove(adapterId); adapterStore.removeAdapter(adapterId); } }</code><technical_language>need type name</technical_language>

Target:
public void removeType( final String typeName ) { final Short adapterId = internalAdapterStore.getAdapterId(typeName); if (adapterId != -1) { final AdapterToIndexMapping mapping = indexMappingStore.getIndicesForAdapter(adapterId); final String[] indexNames = mapping.getIndexNames(); for (int i = 0; i < indexNames.length; i++) { baseOperations.deleteAll( indexNames[i], typeName, adapterId); } statisticsStore.removeAllStatistics(adapterId); indexMappingStore.remove(adapterId); internalAdapterStore.remove(adapterId); adapterStore.removeAdapter(adapterId); } }
Source:
<code>public Pair<Boolean, Guid> getSelectedLease() { boolean haveLeases = getSnapshots().getItems() .stream() .anyMatch(model -> model.getLease() != null); SnapshotModel selectedLeaseSnapshotModel = getSnapshots().getItems() .stream() .filter(model -> model.getLease() != null) .filter(model -> model.getLease().getEntity()) .findFirst() .orElse(null); if (selectedLeaseSnapshotModel == null && haveLeases) { return new Pair<>(false, null); } return selectedLeaseSnapshotModel == null ? new Pair<>(true, null) : <START> new Pair<>(true, getSnapshotLeaseDomainsMap().get(selectedLeaseSnapshotModel.getEntity().getId())); <END> }</code><technical_language>favor of returning a pair, confusing (too implicit). Try split method, e.g. 'isSnapshotsContainsLeases' 'getSelectedLease' simply return selected</technical_language>

Target:
public Guid getSelectedLease() { SnapshotModel selectedLeaseSnapshotModel = getSnapshots().getItems() .stream() .filter(model -> model.getLease() != null) .filter(model -> model.getLease().getEntity()) .findFirst() .orElse(null); return selectedLeaseSnapshotModel != null ? getSnapshotLeaseDomainsMap().get(selectedLeaseSnapshotModel.getEntity().getId()) : null; }
Source:
<code>protected Collection<String> getInAppFrames(Dsn dsn) { Collection<String> inAppFrames = super.getInAppFrames(dsn); if (inAppFrames.isEmpty()) { PackageInfo info = null; try { <START> info = this.ctx.getPackageManager().getPackageInfo(this.ctx.getPackageName(), 0); <END> } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Error getting package information.", e); } if (info != null && !Util.isNullOrEmpty(info.packageName)) { List<String> newPackages = new ArrayList<>(1); newPackages.add(info.packageName); return newPackages; } } return inAppFrames; }</code><technical_language>// nitpick-mode-on change this.ctx ctx? // nitpick-mode-off</technical_language>

Target:
protected Collection<String> getInAppFrames(Dsn dsn) { Collection<String> inAppFrames = super.getInAppFrames(dsn); if (inAppFrames.isEmpty()) { PackageInfo info = null; try { info = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Error getting package information.", e); } if (info != null && !Util.isNullOrEmpty(info.packageName)) { List<String> newPackages = new ArrayList<>(1); newPackages.add(info.packageName); return newPackages; } } return inAppFrames; }
Source:
<code>public void getRequiredMemberResourceGroupAttributesFromOneServiceWorkWithUser() throws Exception { System.out.println(CLASS_NAME + "getRequiredMemberResourceGroupAttributesFromOneServiceWorkWithUser"); vo = setUpVo(); member = setUpMember(); group = setUpGroup(); facility = setUpFacility(); resource = setUpResource(); service = setUpService(); attributes = setUpRequiredAttributes(); perun.getResourcesManager().assignService(sess, resource, service); List<Attribute> reqAttr = attributesManager.getRequiredAttributes(sess, service, resource, group, member, true); <START> assertNotNull("unable to get required resource-member attributes for one service",reqAttr); <END> assertTrue("should have at least 5 req attribute",reqAttr.size() >= 5); }</code><technical_language>I guess ommit "resource-member" if do name other namespaces returned method</technical_language>

Target:
public void getRequiredMemberResourceGroupAttributesFromOneServiceWorkWithUser() throws Exception { System.out.println(CLASS_NAME + "getRequiredMemberResourceGroupAttributesFromOneServiceWorkWithUser"); vo = setUpVo(); member = setUpMember(); group = setUpGroup(); facility = setUpFacility(); resource = setUpResource(); service = setUpService(); attributes = setUpRequiredAttributes(); perun.getResourcesManager().assignService(sess, resource, service); List<Attribute> reqAttr = attributesManager.getRequiredAttributes(sess, service, resource, group, member, true); assertNotNull("unable to get required attributes for one service",reqAttr); assertTrue("should have at least 5 req attributes",reqAttr.size() >= 5); }
Source:
<code>protected boolean isMigrationNeeded(Key<Instructor> key) throws Exception { Instructor instructor = ofy().load().key(key).now(); if (!SanitizationHelper.sanitizeForHtml(instructor.getName()).equals(instructor.getName())) { <START> System.err.println(String.format("Instructor %s has unsanitized name %s, this should not happen", <END> instructor.getUniqueId(), instructor.getName())); } return SanitizationHelper.isSanitizedHtml(instructor.getName()); }</code><technical_language>Actually, name John Doe is sanitisation. is error</technical_language>

Target:
protected boolean isMigrationNeeded(Key<Instructor> key) throws Exception { Instructor instructor = ofy().load().key(key).now(); return SanitizationHelper.isSanitizedHtml(instructor.getName()); }
Source:
<code>protected Type union(Type toMerge, boolean strict) { if (!toMerge.isPrimitive()) { reportSchemaMergeError(toMerge); } if (strict) { if (!primitive.equals(toMerge.asPrimitiveType().getPrimitiveTypeName())) { reportSchemaMergeError(toMerge); } if (getOriginalType() == null && toMerge.getOriginalType() != null || getOriginalType() != null && !getOriginalType().equals(toMerge.getOriginalType())) { <START> reportSchemaMergeError(toMerge); <END> } int toMergeLength = toMerge.asPrimitiveType().getTypeLength(); if (primitive == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY && length != toMergeLength) { reportSchemaMergeError(toMerge); } } Types.PrimitiveBuilder<PrimitiveType> builder = Types.primitive(primitive, toMerge.getRepetition()); if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitive) { builder.length(length); } return builder.as(getOriginalType()).named(getName()); }</code><technical_language>originalType is Enum, do like: if (getOriginalType() != toMerge.getOriginalType()) reportSchemaMergeError(toMerge); covers: 1. if null, condition evals false 2. if is null other is null, condition evals true 3. if null, condition evals false if values, evals true otherwise. @liancheng do think</technical_language>

Target:
protected Type union(Type toMerge, boolean strict) { if (!toMerge.isPrimitive()) { reportSchemaMergeError(toMerge); } if (strict) { if (!primitive.equals(toMerge.asPrimitiveType().getPrimitiveTypeName()) || getOriginalType() != toMerge.getOriginalType()) { reportSchemaMergeError(toMerge); } int toMergeLength = toMerge.asPrimitiveType().getTypeLength(); if (primitive == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY && length != toMergeLength) { reportSchemaMergeError(toMerge); } } Types.PrimitiveBuilder<PrimitiveType> builder = Types.primitive(primitive, toMerge.getRepetition()); if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitive) { builder.length(length); } return builder.as(getOriginalType()).named(getName()); }
Source:
<code>private static int getGapForNextGridStep(int currentCoordinate, int gridSpacing, int levelToPass) { int <START> gap <END> = ((currentCoordinate + gridSpacing) % gridSpacing); if (gap >= 0) { gap = gridSpacing - gap; } if (levelToPass != Integer.MIN_VALUE && currentCoordinate + gap < levelToPass) { return gap + getGapForNextGridStep(currentCoordinate + gap, gridSpacing, levelToPass); } return gap; }</code><technical_language>gap absolute value. Fixed in next patchset</technical_language>

Target:
private static int getGapForNextGridStep(int currentCoordinate, int gridSpacing, int levelToPass) { int gap = Math.abs(((currentCoordinate + gridSpacing) % gridSpacing)); if (gap >= 0) { gap = gridSpacing - gap; } if (levelToPass != Integer.MIN_VALUE && currentCoordinate + gap < levelToPass) { return gap + getGapForNextGridStep(currentCoordinate + gap, gridSpacing, levelToPass); } return gap; }
Source:
<code>private void addAuthorities(String[] params, Set<GrantedAuthority> authorities, String root, String filter, String authorityPrefix, boolean hierarchical, int level) { String formattedFilter = MessageFormat.format(filter, params); List ldapAuthorities = ldapTemplate.search(root, formattedFilter, new AbstractContextMapper() { @Override protected Object doMapFromContext(DirContextOperations ctx) { return new Authority(ctx.getStringAttribute(groupRoleAttribute), ctx.getNameInNamespace()); } }); if (logger.isDebugEnabled()) { logger.debug("Authorities from search: " + ldapAuthorities); } for (Object authority : ldapAuthorities) { Authority ldapAuthority = (Authority)authority; addAuthority(authorities, authorityPrefix, ldapAuthority.getName()); <START> if (hierarchical && level < maxLevelGroupsSearch) { <END> String[] searchParams = new String[] {ldapAuthority.getDn(), ldapAuthority.getName()}; addAuthorities(searchParams, authorities, root, groupInGroupSearchFilter, authorityPrefix, hierarchical, level + 1); } } }</code><technical_language>probable improvement, check if current ldap group Set<GrantedAuthority> authorities, for avoiding Ldap (bad?) circular references long recursive calls? Asking this checking GS side</technical_language>

Target:
private void addAuthorities(String[] params, Set<GrantedAuthority> authorities, String root, String filter, String authorityPrefix, boolean hierarchical, int level) { String formattedFilter = MessageFormat.format(filter, params); List ldapAuthorities = ldapTemplate.search(root, formattedFilter, new AbstractContextMapper() { @Override protected Object doMapFromContext(DirContextOperations ctx) { return new Authority(ctx.getStringAttribute(groupRoleAttribute), ctx.getNameInNamespace()); } }); if (logger.isDebugEnabled()) { logger.debug("Authorities from search: " + ldapAuthorities); } for (Object authority : ldapAuthorities) { Authority ldapAuthority = (Authority)authority; boolean added = addAuthority(authorities, authorityPrefix, ldapAuthority.getName()); if (added && hierarchical && level < maxLevelGroupsSearch) { String[] searchParams = new String[] {ldapAuthority.getDn(), ldapAuthority.getName()}; addAuthorities(searchParams, authorities, root, groupInGroupSearchFilter, authorityPrefix, hierarchical, level + 1); } } }
Source:
<code>public static ICalendar createIcalEventList(List<Event> events){ ICalendar iCal = new ICalendar(); <START> events.forEach(event -> {iCal.addEvent(createICalEvent(event));}); <END> iCal.addName("CH Event Calendar"); iCal.setColor("turquoise"); return iCal; }</code><technical_language>{ } unnecessary I</technical_language>

Target:
public static ICalendar createIcalEventList(List<Event> events){ ICalendar iCal = new ICalendar(); events.forEach(event -> iCal.addEvent(createICalEvent(event))); iCal.addName("CH Event Calendar"); return iCal; }
Source:
<code>public void process() { if (renderingConfig.isBloom()) { PerformanceMonitor.startActivity("rendering/bloompasses"); sceneBloom0 = frameBuffersManager.getFBO("sceneBloom0"); sceneBloom1 = frameBuffersManager.getFBO("sceneBloom1"); sceneBloom2 = frameBuffersManager.getFBO("sceneBloom2"); sceneHighPass = frameBuffersManager.getFBO("sceneHighPass"); sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); generateHighPass(); generateBloom(sceneBloom0); generateBloom(sceneBloom1); <START> generateBloom(sceneBloom2); <END> PerformanceMonitor.endActivity(); } }</code><technical_language>add this block: // TODO: review - sense split operations highpass node blur nodes parameters? Interestingly, this hints a bigger issue: if a number of "elementary" nodes working closely achieve a more complex effect, "grouped" together? this handled considering some nodes a graph graph, is functionality need anyway, i.e. handle eye-based parallel graphs for stereoscopic displays</technical_language>

Target:
public void process() { if (renderingConfig.isBloom()) { PerformanceMonitor.startActivity("rendering/bloomPasses"); sceneBloom0 = frameBuffersManager.getFBO("sceneBloom0"); sceneBloom1 = frameBuffersManager.getFBO("sceneBloom1"); sceneBloom2 = frameBuffersManager.getFBO("sceneBloom2"); sceneHighPass = frameBuffersManager.getFBO("sceneHighPass"); sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); generateHighPass(); generateBloom(sceneBloom0); generateBloom(sceneBloom1); generateBloom(sceneBloom2); PerformanceMonitor.endActivity(); } }
Source:
<code>public void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e) { File reportFile = buildInfo.getFile(TEST_PLAN_REPORT_FILE); String repotFilePath = reportFile.getAbsolutePath(); try (BufferedReader br = new BufferedReader(new FileReader(repotFilePath))) { DashboardPostMessage postMessage = new DashboardPostMessage(); String currentLine; while ((currentLine = br.readLine()) != null) { String[] <START> splited = <END> currentLine.split("\\s+"); if (splited.length != 2) { CLog.e(String.format("Invalid keys %s", currentLine)); continue; } TestPlanReportMessage testPlanMessage = new TestPlanReportMessage(); testPlanMessage.addTestModuleName(splited[0]); testPlanMessage.addTestModuleStartTimestamp(Long.parseLong(splited[1])); postMessage.addTestPlanReport(testPlanMessage); } Upload(postMessage); } catch (IOException ex) { CLog.d(String.format("Can't read the test plan result file %s", repotFilePath)); return; } }</code><technical_language>Spelling: splitted</technical_language>

Target:
public void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e) { File reportFile = buildInfo.getFile(TEST_PLAN_REPORT_FILE); String repotFilePath = reportFile.getAbsolutePath(); try (BufferedReader br = new BufferedReader(new FileReader(repotFilePath))) { DashboardPostMessage postMessage = new DashboardPostMessage(); String currentLine; while ((currentLine = br.readLine()) != null) { String[] lineWords = currentLine.split("\\s+"); if (lineWords.length != 2) { CLog.e(String.format("Invalid keys %s", currentLine)); continue; } TestPlanReportMessage testPlanMessage = new TestPlanReportMessage(); testPlanMessage.addTestModuleName(lineWords[0]); testPlanMessage.addTestModuleStartTimestamp(Long.parseLong(lineWords[1])); postMessage.addTestPlanReport(testPlanMessage); } Upload(postMessage); } catch (IOException ex) { CLog.d(String.format("Can't read the test plan result file %s", repotFilePath)); return; } }
Source:
<code>public void detectCorruptionIfLearnedValueIsNotTheGreatestAcceptedValue() { <START> helper.writeLogsOnDefaultLocalAndRemote(1, 10); <END> helper.induceGreaterAcceptedValueCorruptionOnDefaultLocalServer(5); List<CompletePaxosHistoryForNamespaceAndUseCase> historyForAll = helper.getHistory(); assertThat(HistoryAnalyzer.divergedLearners(Iterables.getOnlyElement(historyForAll))) .isEqualTo(CorruptionCheckViolation.NONE); assertThat(HistoryAnalyzer.learnedValueWithoutQuorum(Iterables.getOnlyElement(historyForAll))) .isEqualTo(CorruptionCheckViolation.NONE); assertThat(HistoryAnalyzer.greatestAcceptedValueNotLearned(Iterables.getOnlyElement(historyForAll))) .isEqualTo(CorruptionCheckViolation.ACCEPTED_VALUE_GREATER_THAN_LEARNED); helper.assertViolationDetected(CorruptionCheckViolation.ACCEPTED_VALUE_GREATER_THAN_LEARNED); }</code><technical_language>I tell, test params 1, 10. mix this a bit? numbers large (e.g. 10k)? catch funny errors test large numbers - if sense in prod</technical_language>

Target:
public void detectCorruptionIfLearnedValueIsNotTheGreatestAcceptedValue() { helper.writeLogsOnDefaultLocalAndRemote(9, 453); helper.induceGreaterAcceptedValueCorruptionOnDefaultLocalServer(432); List<CompletePaxosHistoryForNamespaceAndUseCase> historyForAll = helper.getHistory(); assertThat(HistoryAnalyzer.divergedLearners(Iterables.getOnlyElement(historyForAll))) .isEqualTo(CorruptionCheckViolation.NONE); assertThat(HistoryAnalyzer.learnedValueWithoutQuorum(Iterables.getOnlyElement(historyForAll))) .isEqualTo(CorruptionCheckViolation.NONE); assertThat(HistoryAnalyzer.greatestAcceptedValueNotLearned(Iterables.getOnlyElement(historyForAll))) .isEqualTo(CorruptionCheckViolation.ACCEPTED_VALUE_GREATER_THAN_LEARNED); helper.assertViolationDetected(CorruptionCheckViolation.ACCEPTED_VALUE_GREATER_THAN_LEARNED); }
Source:
<code>public void testInterrupt() throws Exception { Pipelining<String> pipelining = new Pipelining<String>(1); pipelining.add(mock(ICompletableFuture.class)); TestThread t = new TestThread() { @Override public void doRun() throws Throwable { <START> pipelining.add(mock(ICompletableFuture.class)); <END> } }; t.start(); t.interrupt(); t.assertFailsEventually(InterruptedException.class); }</code><technical_language>need mark pipelining final code needs JDK6 compatible</technical_language>

Target:
public void testInterrupt() throws Exception { final Pipelining<String> pipelining = new Pipelining<String>(1); pipelining.add(mock(ICompletableFuture.class)); TestThread t = new TestThread() { @Override public void doRun() throws Throwable { pipelining.add(mock(ICompletableFuture.class)); } }; t.start(); t.interrupt(); t.assertFailsEventually(InterruptedException.class); }
Source:
<code>public void testShowErrorAndRejectWithRejection() { persistencePresenter.showErrorAndReject("Test message").then(i -> { Assert.fail("Promise should've not been resolved!"); return promises.resolve(); }).catch_(e -> { verify(view).showError(eq("Test message")); Assert.assertEquals(e, <START> persistencePresenter); <END> return promises.resolve(); }); }</code><technical_language>you, please, fix asserts order of parameters assertEquals(expected, actual)</technical_language>

Target:
public void testShowErrorAndRejectWithRejection() { showErrorAndRejectFn(persistencePresenter.showErrorAndReject("Test message")); }
Source:
<code>public static double[] nearestNeighborUniform1DInterpolate(@Nonnull final double[] data, final int newLength) throws IllegalArgumentException { <START> if (data.length == 0) <END> throw new IllegalArgumentException("The input array is empty."); ParamUtils.isPositive(newLength - 1, "The new length of the array must be >= 2"); final double fact = (double)(data.length - 1)/(newLength - 1); return IntStream.range(0, newLength).mapToDouble(i -> data[(int) FastMath.floor(i*fact + 0.5)]).toArray(); }</code><technical_language>Missing braces</technical_language>

Target:
public static double[] nearestNeighborUniform1DInterpolate(@Nonnull final double[] data, final int newLength) throws IllegalArgumentException { Utils.validateArg(data.length > 0, "The input array is empty."); Utils.validateArg(newLength >= 2, "The new length of the array must be >= 2"); final double fact = (double)(data.length - 1)/(newLength - 1); return IntStream.range(0, newLength).mapToDouble(i -> data[(int) FastMath.floor(i*fact + 0.5)]).toArray(); }
Source:
<code>public void testIllegalImageReturnedByQuery() throws Exception { <START> GetVmConfigurationBySnapshotQuery<GetVmConfigurationBySnapshotQueryParams> executeQuery = <END> setupQueryBySnapshotId(existingSnapshotId); existingVm.getDiskMap().put(existingDiskImage.getinternal_drive_mapping(), existingDiskImage); existingVm.getImages().add(existingDiskImage); doReturn(existingVm).when(executeQuery).getVmFromConfiguration(anyString()); executeQuery.Execute(); VdcQueryReturnValue returnValue = executeQuery.getQueryReturnValue(); assertNotNull("Return value from query cannot be null", returnValue); VM vm = (VM) returnValue.getReturnValue(); for (DiskImage diskImage : vm.getDiskMap().values()) { assertEquals(diskImage.getimageStatus(), ImageStatus.ILLEGAL); } }</code><technical_language>call executeQuery</technical_language>

Target:
public void testIllegalImageReturnedByQuery() throws Exception { GetVmConfigurationBySnapshotQuery<GetVmConfigurationBySnapshotQueryParams> query = setupQueryBySnapshotId(existingSnapshotId); existingVm.getDiskMap().put(existingDiskImage.getinternal_drive_mapping(), existingDiskImage); existingVm.getImages().add(existingDiskImage); doReturn(existingVm).when(query).getVmFromConfiguration(anyString()); query.Execute(); VdcQueryReturnValue returnValue = query.getQueryReturnValue(); assertNotNull("Return value from query cannot be null", returnValue); VM vm = (VM) returnValue.getReturnValue(); for (DiskImage diskImage : vm.getDiskMap().values()) { assertEquals(diskImage.getimageStatus(), ImageStatus.ILLEGAL); } }
Source:
<code>private void doMain() throws Exception { <START> start(); <END> while (true) { try { Thread.sleep(5); } catch (Exception e) { log.info("shutting down", e); break; } } unregisterMBeans(); }</code><technical_language>unneeded changes, code style, in this PR. Removing this. is needed adds unnecessary noise this PR. move this another PR</technical_language>

Target:
private void doMain() throws Exception { this.start(); while (true) { try { Thread.sleep(5); } catch (Exception e) { log.info("shutting down", e); break; } } this.unregisterMBeans(); }
Source:
<code>public void hashRow(DimensionSelector dimSelector, Hasher hasher) { final IndexedInts row = dimSelector.getRow(); final int size = row.size(); if (size == 1) { final String value = dimSelector.lookupName(row.get(0)); if (NullHandling.replaceWithDefault() || value != null) { hasher.putUnencodedChars(nullToSpecial(value)); } } else if (size != 0) { boolean hasNonNullValue = false; final String[] values = new String[size]; for (int i = 0; i < size; ++i) { final String value = dimSelector.lookupName(row.get(i)); <START> if (!NullHandling.replaceWithDefault() && !hasNonNullValue && value != null) { <END> hasNonNullValue = true; } values[i] = nullToSpecial(value); } if (NullHandling.replaceWithDefault() || hasNonNullValue) { Arrays.sort(values); for (int i = 0; i < size; ++i) { if (i != 0) { hasher.putChar(CARDINALITY_AGG_SEPARATOR); } hasher.putUnencodedChars(values[i]); } } } }</code><technical_language>NullHandling.sqlCompatible()</technical_language>

Target:
public void hashRow(DimensionSelector dimSelector, Hasher hasher) { final IndexedInts row = dimSelector.getRow(); final int size = row.size(); if (size == 1) { final String value = dimSelector.lookupName(row.get(0)); if (NullHandling.replaceWithDefault() || value != null) { hasher.putUnencodedChars(nullToSpecial(value)); } } else if (size != 0) { boolean hasNonNullValue = false; final String[] values = new String[size]; for (int i = 0; i < size; ++i) { final String value = dimSelector.lookupName(row.get(i)); if (NullHandling.sqlCompatible() && !hasNonNullValue && value != null) { hasNonNullValue = true; } values[i] = nullToSpecial(value); } if (NullHandling.replaceWithDefault() || hasNonNullValue) { Arrays.sort(values); for (int i = 0; i < size; ++i) { if (i != 0) { hasher.putChar(CARDINALITY_AGG_SEPARATOR); } hasher.putUnencodedChars(values[i]); } } } }
Source:
<code>public void shouldWrapExceptionIntoStorIOExceptionCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); when(storIOSQLite.lowLevel()).thenReturn(internal); final DeleteResolver<DeleteQuery> deleteResolver = mock(DeleteResolver.class); when(deleteResolver.performDelete(same(storIOSQLite), any(DeleteQuery.class))) .thenThrow(new IllegalStateException("test exception")); final TestSubscriber<DeleteResult> testSubscriber = new TestSubscriber<DeleteResult>(); new PreparedDeleteByQuery.Builder(storIOSQLite, DeleteQuery.builder().table("test_table").build()) .withDeleteResolver(deleteResolver) .prepare() .asRxComleatable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); testSubscriber.assertError(StorIOException.class); StorIOException expected = (StorIOException) testSubscriber.getOnErrorEvents().get(0); IllegalStateException cause = (IllegalStateException) expected.getCause(); <START> assertThat(cause).hasMessage("test exception"); <END> verify(deleteResolver).performDelete(same(storIOSQLite), any(DeleteQuery.class)); verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); }</code><technical_language>check exception is same() expected</technical_language>

Target:
public void shouldWrapExceptionIntoStorIOExceptionCompletable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); when(storIOSQLite.lowLevel()).thenReturn(internal); final DeleteResolver<DeleteQuery> deleteResolver = mock(DeleteResolver.class); when(deleteResolver.performDelete(same(storIOSQLite), any(DeleteQuery.class))) .thenThrow(new IllegalStateException("test exception")); final TestSubscriber<DeleteResult> testSubscriber = new TestSubscriber<DeleteResult>(); new PreparedDeleteByQuery.Builder(storIOSQLite, DeleteQuery.builder().table("test_table").build()) .withDeleteResolver(deleteResolver) .prepare() .asRxComletable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); testSubscriber.assertError(StorIOException.class); StorIOException expected = (StorIOException) testSubscriber.getOnErrorEvents().get(0); IllegalStateException cause = (IllegalStateException) expected.getCause(); assertThat(cause).hasMessage("test exception"); verify(deleteResolver).performDelete(same(storIOSQLite), any(DeleteQuery.class)); verifyNoMoreInteractions(storIOSQLite, internal, deleteResolver); }
Source:
<code>public void addRandomElectionPolicyInUI() throws Exception { page.treeNavigation() .step(SINGLETON_POLICY) .step(SINGLETON_POLICY_RESOURCE) .step(ELECTION_POLICY) .navigateToTreeItem().clickLabel(); WizardWindowWithAdvancedSelectBoxOptions window = page.getResourceManager() .addResource(WizardWindowWithAdvancedSelectBoxOptions.class); window.pick(RANDOM) .clickContinue() .finish(); new ResourceVerifier(SINGLETON_POLICY_ADDRESS.and(ELECTION_POLICY, RANDOM), client) <START> .verifyExists("This fails because of <LINK_0>"); <END> }</code><technical_language>Please add assert message</technical_language>

Target:
public void addRandomElectionPolicyInUI() throws Exception { page.treeNavigation() .step(SINGLETON_POLICY) .step(SINGLETON_POLICY_RESOURCE) .step(ELECTION_POLICY) .navigateToTreeItem().clickLabel(); WizardWindowWithAdvancedSelectBoxOptions window = page.getResourceManager() .addResource(WizardWindowWithAdvancedSelectBoxOptions.class); window.pick(RANDOM) .clickContinue() .finish(); new ResourceVerifier(SINGLETON_POLICY_ADDRESS.and(ELECTION_POLICY, RANDOM), client) .verifyExists("This probably fails because of <LINK_0>"); }
Source:
<code>private HttpURLConnection connectTo(Endpoint endpoint) throws IOException { <START> URL url = new URL(endpoint.asString()); <END> return (HttpURLConnection) url.openConnection(); }</code><technical_language>endpoint.asUrl() no? this is place asString is called</technical_language>

Target:
private HttpURLConnection connectTo(Endpoint endpoint) throws IOException { URL url = endpoint.asURL(); return (HttpURLConnection) url.openConnection(); }
Source:
<code>public File newFolder(String folder) throws IOException { if (folder.startsWith(File.separator)) { throw new IOException("Folder name cannot start with a file separator"); } <START> return newFolder(folder.split(FILE_SEPARATOR_REGEX)); <END> }</code><technical_language>Instead of regex, new File(folder) call getParent() returns null? This a test newFolder("foo/bar") able run Windows Unix</technical_language>

Target:
public File newFolder(String folder) throws IOException { if (new File(folder).isAbsolute()) { throw new IOException("folder name must be a relative path"); } File file = new File(getRoot(), folder); if (!file.mkdirs()) { throw new IOException( "a folder with the name \'" + folder + "\' already exists"); } return file; }
Source:
<code>private Set<IStorage> resolveTraversal(IFile file, Set<URI> bounds) { Collection<URI> uris = dependencyProviderRegistry.getDependencies(createURIFor(file)); Set<IStorage> traversalSet = new LinkedHashSet<IStorage>(); <START> for (URI uri : uris) { <END> IFile toResolve = getFileAt(uri); final Iterable<URI> dependencies = getDependenciesOf(toResolve, bounds); for (URI dep : dependencies) { traversalSet.add(getFileAt(dep)); } } return traversalSet; }</code><technical_language>Iterate : Sets.union(Collections.singleton(uri), uris) is dependency registry's responsibility "uri" is in traversal, is</technical_language>

Target:
private Set<IStorage> resolveTraversal(IFile file, Set<URI> bounds) { final URI baseUri = createURIFor(file); final Set<IStorage> traversalSet = new LinkedHashSet<IStorage>(); for (URI uri : getUriAndDependentUrisFromDependencyProvider(baseUri)) { final IFile toResolve = getFileAt(uri); final Iterable<URI> dependencies = getDependenciesOf(toResolve, bounds); for (URI dep : dependencies) { traversalSet.add(getFileAt(dep)); } } return traversalSet; }