auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static String getName(OsmandApplication app, SearchResult searchResult) { switch (searchResult.objectType) { case STREET: if (searchResult.localeName.endsWith(")")) { int i = searchResult.localeName.indexOf('('); if (i > 0) { return searchResult.localeName.substring(0, i).trim(); } } break; case STREET_INTERSECTION: if (!Algorithms.isEmpty(searchResult.localeRelatedObjectName)) { return searchResult.localeName + " - " + searchResult.localeRelatedObjectName; } break; case RECENT_OBJ: HistoryEntry historyEntry = (HistoryEntry) searchResult.object; PointDescription pd = historyEntry.getName(); return pd.getSimpleName(app, false); case LOCATION: LatLon latLon = searchResult.location; return PointDescription.getLocationNamePlain(app, latLon.getLatitude(), latLon.getLongitude()); <START> case FAVORITE: <END> return ((FavouritePoint) searchResult.object).getName(); } return searchResult.localeName; }</code><technical_language>needed</technical_language>

Target:
public static String getName(OsmandApplication app, SearchResult searchResult) { switch (searchResult.objectType) { case STREET: if (searchResult.localeName.endsWith(")")) { int i = searchResult.localeName.indexOf('('); if (i > 0) { return searchResult.localeName.substring(0, i).trim(); } } break; case STREET_INTERSECTION: if (!Algorithms.isEmpty(searchResult.localeRelatedObjectName)) { return searchResult.localeName + " - " + searchResult.localeRelatedObjectName; } break; case RECENT_OBJ: HistoryEntry historyEntry = (HistoryEntry) searchResult.object; PointDescription pd = historyEntry.getName(); return pd.getSimpleName(app, false); case LOCATION: LatLon latLon = searchResult.location; return PointDescription.getLocationNamePlain(app, latLon.getLatitude(), latLon.getLongitude()); } return searchResult.localeName; }
Source:
<code>public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_PROXIMITY) { if (event.values[0] >= -SENSOR_SENSITIVITY && event.values[0] <= SENSOR_SENSITIVITY) { <START> if (isSensorEnabled()) { <END> unlockEvent(); } } } }</code><technical_language>check top of method</technical_language>

Target:
public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_PROXIMITY) { if (event.values[0] >= -SENSOR_SENSITIVITY && event.values[0] <= SENSOR_SENSITIVITY) { unlockEvent(); } } }
Source:
<code>public void testEntitiesBundleInstallsProperly() throws Exception { testEntitiesBundleInstallsProperly(true); <START> outputStream = new FileOutputStream(configurationFile); <END> Properties datanucleusProps = coreConfigurationService.loadDatanucleusConfig(); datanucleusProps.setProperty("datanucleus.cache.level2.type", "none"); datanucleusProps.store(outputStream, null); outputStream.close(); testEntitiesBundleInstallsProperly(false); outputStream = new FileOutputStream(configurationFile); datanucleusProps.remove("datanucleus.cache.level2.type", "none"); datanucleusProps.store(outputStream, null); outputStream.close(); }</code><technical_language>close streams - try resource. I a point stream stored instance variable</technical_language>

Target:
public void testEntitiesBundleInstallsProperly() throws Exception { testEntitiesBundleInstallsProperly(true); setCacheType("none"); testEntitiesBundleInstallsProperly(false); }
Source:
<code>public String toString() { return name; <START> <END> }</code><technical_language>Empty line, more fields (use ide toString generator)</technical_language>

Target:
public String toString() { return "EventListenerDescriptor [name=" + name + ", className=" + className + ", isPostCommit=" + isPostCommit + ", isAsync=" + isAsync + "]"; }
Source:
<code>protected boolean canDoAction() { if (getAffinityGroupDao().getByName(getParameters().getAffinityGroup().getName()) != null) { <START> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_AFFINITY_GROUP_NAME_EXSITS); <END> } return validateParameters(); }</code><technical_language>s/EXSITS/EXISTS/</technical_language>

Target:
protected boolean canDoAction() { if (getAffinityGroupDao().getByName(getParameters().getAffinityGroup().getName()) != null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_AFFINITY_GROUP_NAME_EXISTS); } return validateParameters(); }
Source:
<code>public void setName(String name) { fName = name; if (fRoot != null) { if (name != null && <START> name.length() > 0) { <END> fRoot.setAttribute(TargetDefinitionPersistenceHelper.ATTR_NAME, name); } else { fRoot.removeAttribute(TargetDefinitionPersistenceHelper.ATTR_NAME); } } }</code><technical_language>Please !string.isEmpty()</technical_language>

Target:
public void setName(String name) { fName = name; if (fRoot != null) { if (name != null && !name.isEmpty()) { fRoot.setAttribute(TargetDefinitionPersistenceHelper.ATTR_NAME, name); } else { fRoot.removeAttribute(TargetDefinitionPersistenceHelper.ATTR_NAME); } } }
Source:
<code>public void onApplicationEvent(ContextClosedEvent event) { if(closed.compareAndSet(false, true)) { afterInitialisation(); try { persistentQueueDAO.shutdown(); } finally { DownloadControlThread nextToCloseRunnable = null; while((nextToCloseRunnable = runningDownloadControlRunnables.poll()) != null) { nextToCloseRunnable.shutdown(); } Thread nextToCloseThread = null; List<Thread> toJoinThreads = new ArrayList<>(); while((nextToCloseThread = runningDownloadControllers.poll()) != null) { if(nextToCloseThread.isAlive()) { nextToCloseThread.interrupt(); toJoinThreads.add(nextToCloseThread); } } for(Thread nextToJoinThread : toJoinThreads) { try { <START> nextToJoinThread.join(5000); <END> } catch(InterruptedException e) { Thread.currentThread().interrupt(); } } } } }</code><technical_language>5000 * toJoinThreads.size() is conceivably large . Replace a single 5s sleep</technical_language>

Target:
public void onApplicationEvent(ContextClosedEvent event) { afterInitialisation(); if(closed.compareAndSet(false, true)) { try { persistentQueueDAO.shutdown(); } finally { DownloadControlThread nextToCloseRunnable = null; while((nextToCloseRunnable = runningDownloadControlRunnables.poll()) != null) { nextToCloseRunnable.shutdown(); } Thread nextToCloseThread = null; List<Thread> toJoinThreads = new ArrayList<>(); while((nextToCloseThread = runningDownloadControllers.poll()) != null) { if(nextToCloseThread.isAlive()) { nextToCloseThread.interrupt(); toJoinThreads.add(nextToCloseThread); } } if(!toJoinThreads.isEmpty()) { try { Thread.sleep(5000); } catch(InterruptedException e) { Thread.currentThread().interrupt(); } } } } }
Source:
<code>private <T> ImmutableSet<T> newFilteredImmutableSet(ImmutableSet<T> original, <START> Predicate<T> predicate) { <END> ImmutableSet.Builder<T> builder = ImmutableSet.builder(); for (T item : original) { if (predicate.apply(item)) builder.add(item); } return builder.build(); }</code><technical_language>formatting is here, matching rest of project (disable "Align multiline" for "Method call arguments" in editor code style). in other parts of this PR</technical_language>

Target:
private static <T> ImmutableSet<T> newFilteredImmutableSet(ImmutableSet<T> original, Predicate<T> predicate) { ImmutableSet.Builder<T> builder = ImmutableSet.builder(); for (T item : original) { if (predicate.apply(item)) builder.add(item); } return builder.build(); }
Source:
<code>private boolean validateFop2pdf( File fopFile, File pdffile ) throws Exception { File fopConfig = TestUtils.findTestFile( "/fop.xconf" ); <START> OutputStream out = new BufferedOutputStream(new FileOutputStream(pdffile)); <END> FopFactory fopFactory = FopFactory.newInstance(fopConfig); Fop fop = fopFactory.newFop("application/pdf", out); Source src = new StreamSource( fopFile ); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); return pdffile.length() > 0; }</code><technical_language>If run FindBugs this class, a warning indicating close a stream. code like... java OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(pdffile)); } finally { Utils.closeQuietly( out ); } This way, matter what, output stream closed. error is a frequent memory leak. This is care it. :wink:</technical_language>

Target:
private boolean validateFop2pdf( File fopFile, File pdffile ) throws Exception { File fopConfig = TestUtils.findTestFile( "/fop.xconf" ); OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(pdffile)); FopFactory fopFactory = FopFactory.newInstance(fopConfig); Fop fop = fopFactory.newFop("application/pdf", out); Source src = new StreamSource( fopFile ); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); } finally { Utils.closeQuietly ( out ); } return pdffile.length() > 0; }
Source:
<code>public Set<Square> getPossibleMoves(Point point){ Point[] adjacents = new Point[4]; adjacents[0] = new Point(point.x - 1, point.y); adjacents[1] = new Point(point.x + 1, point.y); adjacents[2] = new Point(point.x, point.y - 1); adjacents[3] = new Point(point.x, point.y + 1); Set<Square> retval = new HashSet<Square>(); for (Point p : adjacents){ <START> if (p.x >= 0 && p.y >= 0 && p.x < size.width && p.y < size.height){ <END> Square candidate = this.get(p); if (candidate.isPassable()) { retval.add(candidate); } } } return retval; }</code><technical_language>I if is a method check if a point is a rectangle</technical_language>

Target:
public Set<Square> getPossibleMoves(Point point){ Set<Point> adjacents = new HashSet<Point>(); adjacents.add(new Point(point.x - 1, point.y)); adjacents.add(new Point(point.x + 1, point.y)); adjacents.add(new Point(point.x, point.y - 1)); adjacents.add(new Point(point.x, point.y + 1)); Set<Square> retval = new HashSet<Square>(); for (Point p : adjacents){ if (new Rectangle(0, 0, size.width, size.height).contains(p)){ Square candidate = this.get(p); if (candidate.isPassable()) { retval.add(candidate); } } } return retval; }
Source:
<code>public void connectToSAMPHub(SedSAMPController controller) throws InterruptedException, Exception { controller.setAutoRunHub(false); controller.start(false); <START> Thread.sleep(2000); END> int count = 0; while (!controller.isConnected()) { if (++count > SAMP_CONN_RETRIES) { String msg = "Failed to connect to SAMP, failing Unit tests"; logger.info(msg); fail(msg); } logger.info("waiting connection"); Thread.sleep(1000); } assertTrue(controller.isConnected()); }</code><technical_language>loop handle waiting - logged, then</technical_language>

Target:
public void connectToSAMPHub(SedSAMPController controller) throws InterruptedException, Exception { controller.setAutoRunHub(false); controller.start(false); int count = 0; while (!controller.isConnected()) { if (++count > SAMP_CONN_RETRIES) { String msg = "Failed to connect to SAMP, failing tests"; logger.info(msg); fail(msg); } logger.info("waiting connection"); Thread.sleep(1000); } assertTrue(controller.isConnected()); }
Source:
<code>public void handle( HttpServletRequest request, HttpServletResponse response, AccessDeniedException exc) throws IOException, ServletException { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) { <START> logger.warn("User: " + auth.getName() + " attempted to access the protected URL: " + request.getRequestURI()); <END> } response.sendRedirect(request.getContextPath() + "/forbidden"); }</code><technical_language>warn level here. This easily happen a user is logged out session expired, try continue working. This worth a warning. info debug</technical_language>

Target:
public void handle( HttpServletRequest request, HttpServletResponse response, AccessDeniedException exc) throws IOException, ServletException { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) { logger.debug("User: " + auth.getName() + " attempted to access the protected URL: " + request.getRequestURI()); } response.sendRedirect(request.getContextPath() + "/forbidden"); }
Source:
<code>public void setFilters(@NonNull ViewerFilter[] filters) { fFilters.clear(); if (filters != null) { List<@NonNull ViewerFilter> filtersList = Arrays.asList(filters); fFilters.addAll(filtersList); <START> fireFiltersAdded(filtersList); <END> } }</code><technical_language>I if this fireFiltersChanged</technical_language>

Target:
public void setFilters(@NonNull ViewerFilter[] filters) { fFilters.clear(); if (filters != null) { List<@NonNull ViewerFilter> filtersList = Arrays.asList(filters); fFilters.addAll(filtersList); fireFiltersChanged(filtersList); } }
Source:
<code>private int parseFieldName(char current, int pos) { if (current == '{') { state = ParseState.INIT; } else { state = ParseState.FIELD; nesting++; <START> if (matcher.region(pos, value.length()).find()) { <END> currentFieldName = matcher.group("name"); pos = matcher.end() - 1; } } return pos; }</code><technical_language>find a more descripting name for matcher</technical_language>

Target:
private int parseFieldName(char current, int pos) { if (current == '{') { state = ParseState.INIT; } else { state = ParseState.FIELD; nesting++; if (fieldContentMatcher.region(pos, value.length()).find()) { currentFieldName = fieldContentMatcher.group("name"); pos = fieldContentMatcher.end() - 1; } } return pos; }
Source:
<code>private static List<String> linesFromData(final byte[] data) throws IOException { final List<String> lines = new ArrayList<String>(); <START> final BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data), CHARSET)); <END> try { while (true) { final String currentLine = reader.readLine(); if (currentLine == null) { break; } lines.add(currentLine); } } finally { reader.close(); } return lines; }</code><technical_language>Kieker requires Java 7, try-with-resource clause here</technical_language>

Target:
private static List<String> linesFromData(final byte[] data) throws IOException { final List<String> lines = new ArrayList<String>(); try (BufferedReader reader = new BufferedReader( new InputStreamReader(new ByteArrayInputStream(data), CHARSET))) { while (true) { final String currentLine = reader.readLine(); if (currentLine == null) { break; } lines.add(currentLine); } } return lines; }
Source:
<code>public RajawaliPipRenderer(Context context, float pipScale, float pipMarginX, float pipMarginY) { super(context); <START> this.pipScale = pipScale; <END> this.pipMarginX = pipMarginX; this.pipMarginY = pipMarginY; }</code><technical_language>kind of a personal preference thing, I dislike of 'this' pointer, passing this object another method. pipScale private final fields, declared mPipScale, eliminate this need</technical_language>

Target:
public RajawaliPipRenderer(Context context, float pipScale, float pipMarginX, float pipMarginY) { super(context); mPipScale = pipScale; mPipMarginX = pipMarginX; mPipMarginY = pipMarginY; }
Source:
<code>public void handleServerSide(EntityPlayerMP playerEntity) { <START> System.out.println("Received PacketBulletTrail on Server. This packet should only be send to clients"); <END> }</code><technical_language>Remove todo, FlansMod.log.warn</technical_language>

Target:
public void handleServerSide(EntityPlayerMP playerEntity) { FlansMod.log.warn("Received PacketBulletTrail on Server. This packet should only be send to clients"); }
Source:
<code>private static Connection getClosedConnection() { InvocationHandler handler = new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final String methodName = method.getName(); if ("isValid".equals(methodName)) { return Boolean.FALSE; } <START> else if ("close".equals(methodName)) { <END> return Void.TYPE; } else if ("abort".equals(methodName)) { return Void.TYPE; } else if ("toString".equals(methodName)) { return ClosedConnection.class.getCanonicalName(); } throw new SQLException("Connection is closed"); } }; return (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[] { Connection.class }, handler); }</code><technical_language>close() called ClosedConnection class? close() method of ProxyConnection [already checks](<LINK_0></technical_language>

Target:
private static Connection getClosedConnection() { InvocationHandler handler = new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final String methodName = method.getName(); if ("abort".equals(methodName)) { return Void.TYPE; } else if ("isValid".equals(methodName)) { return Boolean.FALSE; } else if ("toString".equals(methodName)) { return ClosedConnection.class.getCanonicalName(); } throw new SQLException("Connection is closed"); } }; return (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[] { Connection.class }, handler); }
Source:
<code>public boolean isTaskExecutable(NodeSet selectedNodes, EligibleTaskDescriptor task) { String requiredLicenses = getRequiredLicenses(task); if (requiredLicenses != null) { logger.debug("Try to get tokens for licenses " + requiredLicenses); final HashSet<String> requiredLicensesSet = new HashSet<String>(Arrays.asList(requiredLicenses.split(","))); for (String requiredLicense : requiredLicensesSet) { if (!licenseSynchronization.containsJobId(requiredLicense, ((EligibleTaskDescriptorImpl) task).getInternal() .getJobId() .value()) && !canGetToken(requiredLicense)) { logger.debug("Token for " + requiredLicense + " not available, keep task pending"); return false; } } logger.debug("Task can be executed since all tokens are available for licenses " + requiredLicenses); for (String requiredLicense : requiredLicensesSet) { if (!licenseSynchronization.containsJobId(requiredLicense, ((EligibleTaskDescriptorImpl) task).getInternal() .getJobId() .value())) { licenseSynchronization.addTaskToLicense(requiredLicense, task.getTaskId().toString()); <START> licenseSynchronization.acquireToken(requiredLicense); <END> licenseSynchronization.getAndPutForTasksLicensePersist(requiredLicense); } else { logger.debug("The license " + requiredLicense + " is already obtained at the job level, use it without getting a new token"); } } licenseSynchronization.persist(); return true; } else { logger.debug("Executable since it does not require any license"); return true; } }</code><technical_language>addTaskToLicense acquireToken done in a single call (the called first)</technical_language>

Target:
public boolean isTaskExecutable(NodeSet selectedNodes, EligibleTaskDescriptor task) { String requiredLicenses = getRequiredLicenses(task); if (requiredLicenses != null) { logger.debug("Try to get tokens for licenses " + requiredLicenses); final HashSet<String> requiredLicensesSet = new HashSet<String>(Arrays.asList(requiredLicenses.split(","))); for (String requiredLicense : requiredLicensesSet) { if (!licenseSynchronization.containsJobId(requiredLicense, ((EligibleTaskDescriptorImpl) task).getInternal() .getJobId() .value()) && !canGetToken(requiredLicense)) { logger.debug("Token for " + requiredLicense + " not available, keep task pending"); return false; } } logger.debug("Task can be executed since all tokens are available for licenses " + requiredLicenses); for (String requiredLicense : requiredLicensesSet) { if (!licenseSynchronization.containsJobId(requiredLicense, ((EligibleTaskDescriptorImpl) task).getInternal() .getJobId() .value())) { licenseSynchronization.addTaskToLicense(requiredLicense, task.getTaskId().toString()); licenseSynchronization.markTaskLicenseChange(requiredLicense); } else { logger.debug("The license " + requiredLicense + " is already obtained at the job level, use it without getting a new token"); } } licenseSynchronization.persist(); return true; } else { logger.debug("Executable since it does not require any license"); return true; } }
Source:
<code>private static Stream<String> getNamespacesFromUseCaseResolvedDirectory(Path logDirectory) { File[] directories = logDirectory.toFile().listFiles(File::isDirectory); if (directories == null) { <START> LoggerFactory.getLogger(DiskNamespaceLoader.class) <END> .error("Could not get file for the directory {}", SafeArg.of("dirName", logDirectory)); return Stream.of(); } return Arrays.stream(directories).map(File::getName); }</code><technical_language>this static, reason get logger call</technical_language>

Target:
private static Stream<String> getNamespacesFromUseCaseResolvedDirectory(Path logDirectory) { if (Files.notExists(logDirectory)) { log.info("No namespace directory exists at path: {}", SafeArg.of("dirName", logDirectory)); return Stream.of(); } File[] directories = logDirectory.toFile().listFiles(File::isDirectory); if (directories == null) { log.error("Namespace(s) cannot be read from directory: {}." + " Either the path does not denote a directory or an I/O error has occurred.", SafeArg.of("dirName", logDirectory)); throw new IllegalStateException("Failed to read directory: " + logDirectory + ". Either the path is invalid or an I/O error has occurred."); } return Arrays.stream(directories).map(File::getName); }
Source:
<code>protected void processUnknownExtensionElement( ExtensibilityElement element, Node parentNode ) throws Exception { <START> logger.debug("Unknown extension element {}", element); <END> }</code><technical_language>another. want find searching for "{}" this page</technical_language>

Target:
protected void processUnknownExtensionElement( ExtensibilityElement element, Node parentNode ) throws Exception { logger.debug("Unknown extension element: {0}", element); }
Source:
<code>public ImageName(String fullName, String givenTag) { if (fullName == null) { throw new NullPointerException("Image name must not be null"); } if(fullName.contains("@sha256")) { String[] digestParts = fullName.split("@"); digest = digestParts[1]; <START> repository = digestParts[0]; <END> } else { digest = null; Pattern tagPattern = Pattern.compile("^(.+?)(?::([^:/]+))?$"); Matcher matcher = tagPattern.matcher(fullName); if (!matcher.matches()) { throw new IllegalArgumentException(fullName + " is not a proper image name ([registry/][repo][:port]"); } tag = givenTag != null ? givenTag : matcher.group(2); String rest = matcher.group(1); String[] parts = rest.split("\\s*/\\s*"); if (parts.length == 1) { registry = null; user = null; repository = parts[0]; } else if (parts.length >= 2) { if (isRegistry(parts[0])) { registry = parts[0]; if (parts.length > 2) { user = parts[1]; repository = joinTail(parts); } else { user = null; repository = parts[1]; } } else { registry = null; user = parts[0]; repository = rest; } } if (tag == null) { tag = "latest"; } } doValidate(); }</code><technical_language>if user a registry/respository@sha245:digest ? registry</technical_language>

Target:
public ImageName(String fullName, String givenTag) { if (fullName == null) { throw new NullPointerException("Image name must not be null"); } if(fullName.contains("@sha256")) { String[] digestParts = fullName.split("@"); digest = digestParts[1]; parseComponentsBeforeTag(digestParts[0]); } else { digest = null; Pattern tagPattern = Pattern.compile("^(.+?)(?::([^:/]+))?$"); Matcher matcher = tagPattern.matcher(fullName); if (!matcher.matches()) { throw new IllegalArgumentException(fullName + " is not a proper image name ([registry/][repo][:port]"); } tag = givenTag != null ? givenTag : matcher.group(2); String rest = matcher.group(1); parseComponentsBeforeTag(rest); if (tag == null) { tag = "latest"; } } doValidate(); }
Source:
<code>public List<Part> specify(long offset, long length) { Builder<Part> parts = ImmutableList.builder(); parts.add(new Part(1, length, offset, null, null)); <START> return parts.build(); <END> }</code><technical_language>ImmutableList.of Collections.singletonList</technical_language>

Target:
public List<Part> specify(long offset, long length) { return ImmutableList.of(new Part(1, length, offset, null, null)); }
Source:
<code>public void testCreate() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse() .setResponseCode(201) .addHeader("ETag", "d9f5eb4bba4e2f2f046e54611bc8196b")) <START> .addHeader("Expires", "d9f5eb4bba4e2f2f046e54611bc8196b")); <END> try { SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift"); assertEquals( api.getObjectApiForRegionAndContainer("DFW", "myContainer").put("myObject", PAYLOAD, metadata(metadata)), "d9f5eb4bba4e2f2f046e54611bc8196b"); assertEquals(server.getRequestCount(), 2); assertAuthentication(server); RecordedRequest replace = server.takeRequest(); assertRequest(replace, "PUT", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject"); assertEquals(new String(replace.getBody()), "swifty"); for (Entry<String, String> entry : metadata.entrySet()) { assertEquals(replace.getHeader(OBJECT_METADATA_PREFIX + entry.getKey().toLowerCase()), entry.getValue()); } } finally { server.shutdown(); } }</code><technical_language>this a more 1234</technical_language>

Target:
public void testCreate() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(new MockResponse() .setResponseCode(201) .addHeader("ETag", "d9f5eb4bba4e2f2f046e54611bc8196b")) .addHeader("Expires", "1406243553")); try { SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift"); assertEquals( api.getObjectApiForRegionAndContainer("DFW", "myContainer").put("myObject", PAYLOAD, metadata(metadata)), "d9f5eb4bba4e2f2f046e54611bc8196b"); assertEquals(server.getRequestCount(), 2); assertAuthentication(server); RecordedRequest replace = server.takeRequest(); assertRequest(replace, "PUT", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObject"); assertEquals(new String(replace.getBody()), "swifty"); for (Entry<String, String> entry : metadata.entrySet()) { assertEquals(replace.getHeader(OBJECT_METADATA_PREFIX + entry.getKey().toLowerCase()), entry.getValue()); } } finally { server.shutdown(); } }
Source:
<code>public CompletableFuture<FileWrapper> uploadFileSection(String filename, AsyncReader fileData, boolean isHidden, long startIndex, long endIndex, Optional<SymmetricKey> baseKey, boolean overwriteExisting, NetworkAccess network, Crypto crypto, ProgressConsumer<Long> monitor, byte[] firstChunkMapKey) { if (isWritable()) return network.synchronizer.applyComplexUpdate(owner(), signingPair(), (current, committer) -> uploadFileSection(current, committer, filename, fileData, isHidden, startIndex, endIndex, <START> baseKey, overwriteExisting, true, network, crypto, monitor, firstChunkMapKey)) <END> .thenCompose(finalBase -> getUpdated(finalBase, network)); if (! overwriteExisting) return Futures.errored(new IllegalStateException("Cannot upload a file to a directory without write access!")); return getChild(filename, crypto.hasher, network) .thenCompose(c -> { if (! c.isPresent()) return Futures.errored(new IllegalStateException("No child with name " + filename)); FileWrapper child = c.get(); return network.synchronizer.applyComplexUpdate(owner(), child.signingPair(), (current, committer) -> updateExistingChild(current, committer, child, fileData, startIndex, endIndex, network, crypto, monitor)) .thenApply(this::withVersion); }); }</code><technical_language>I agree this change. push a fix</technical_language>

Target:
public CompletableFuture<FileWrapper> uploadFileSection(String filename, AsyncReader fileData, boolean isHidden, long startIndex, long endIndex, Optional<SymmetricKey> baseKey, boolean overwriteExisting, NetworkAccess network, Crypto crypto, ProgressConsumer<Long> monitor, byte[] firstChunkMapKey) { if (isWritable()) return network.synchronizer.applyComplexUpdate(owner(), signingPair(), (current, committer) -> uploadFileSection(current, committer, filename, fileData, isHidden, startIndex, endIndex, baseKey, overwriteExisting, false, network, crypto, monitor, firstChunkMapKey)) .thenCompose(finalBase -> getUpdated(finalBase, network)); if (! overwriteExisting) return Futures.errored(new IllegalStateException("Cannot upload a file to a directory without write access!")); return getChild(filename, crypto.hasher, network) .thenCompose(c -> { if (! c.isPresent()) return Futures.errored(new IllegalStateException("No child with name " + filename)); FileWrapper child = c.get(); return network.synchronizer.applyComplexUpdate(owner(), child.signingPair(), (current, committer) -> updateExistingChild(current, committer, child, fileData, startIndex, endIndex, network, crypto, monitor)) .thenApply(this::withVersion); }); }
Source:
<code>public Observable<Void> handle(final ObservableConnection<I, O> connection) { ChannelHandlerContext ctx = connection.getChannelHandlerContext(); final ChannelPipeline p = ctx.channel().pipeline(); ChannelHandlerContext hctx = p.context(WebSocketServerHandler.class); if (hctx != null) { WebSocketServerHandler handler = p.get(WebSocketServerHandler.class); final PublishSubject<Void> subject = PublishSubject.create(); <START> handler.handshakeFuture().addListener(new ChannelFutureListener() { <END> @Override public void operationComplete(ChannelFuture future) throws Exception { originalHandler.handle(connection).subscribe(subject); } }); return subject; } return originalHandler.handle(connection); }</code><technical_language>Is worth if delay ObservableConnection callback instead of delaying Handler.onHandle() call</technical_language>

Target:
public Observable<Void> handle(final ObservableConnection<I, O> connection) { ChannelHandlerContext ctx = connection.getChannelHandlerContext(); final ChannelPipeline p = ctx.channel().pipeline(); ChannelHandlerContext hctx = p.context(WebSocketServerHandler.class); if (hctx != null) { WebSocketServerHandler handler = p.get(WebSocketServerHandler.class); final PublishSubject<Void> subject = PublishSubject.create(); handler.addHandshakeFinishedListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { originalHandler.handle(connection).subscribe(subject); } }); return subject; } return originalHandler.handle(connection); }
Source:
<code>private FBNetworkElement findMappingTargetFromName(String targetName) { FBNetworkElement element = null; if (null != targetName) { <START> ArrayDeque<String> <END> parts = new ArrayDeque<>(Arrays.asList(targetName.split("\\."))); if (parts.size() >= 2) { FBNetwork nw = null; Device dev = system.getDeviceNamed(parts.getFirst()); Application application = system.getApplicationNamed(parts.getFirst()); if (null != dev) { parts.pollFirst(); Resource res = dev.getResourceNamed(parts.pollFirst()); if (null != res) { nw = res.getFBNetwork(); element = findMappingTargetInFBNetwork(nw, parts); } } if (null == element && null != application) { parts = new ArrayDeque<>(Arrays.asList(targetName.split("\\."))); parts.pollFirst(); nw = application.getFBNetwork(); element = findMappingTargetInFBNetwork(nw, parts); } } } return element; }</code><technical_language>Deque<String></technical_language>

Target:
private FBNetworkElement findMappingTargetFromName(String targetName) { FBNetworkElement element = null; if (null != targetName) { Deque<String> parts = new ArrayDeque<>(Arrays.asList(targetName.split("\\."))); if (parts.size() >= 2) { FBNetwork nw = null; Device dev = system.getDeviceNamed(parts.getFirst()); Application application = system.getApplicationNamed(parts.getFirst()); if (null != dev) { parts.pollFirst(); Resource res = dev.getResourceNamed(parts.pollFirst()); if (null != res) { nw = res.getFBNetwork(); element = findMappingTargetInFBNetwork(nw, parts); } } if (null == element && null != application) { parts = new ArrayDeque<>(Arrays.asList(targetName.split("\\."))); parts.pollFirst(); nw = application.getFBNetwork(); element = findMappingTargetInFBNetwork(nw, parts); } } } return element; }
Source:
<code>public void setup() { <START> for (int ii = 0; ii < BUF_LEN; ++ii) <END> bb[ii] = (byte)ii; }</code><technical_language>i variable</technical_language>

Target:
public void setup() { new Random().ints(BUF_LEN, Byte.MIN_VALUE, Byte.MAX_VALUE).forEach(k -> bb.put((byte) k)); }
Source:
<code>protected void createCacheManagers() throws Throwable { super.createCacheManagers(); for (EmbeddedCacheManager cacheManager : cacheManagers) { <START> multimapCacheCluster.put(cacheManager.getAddress().toString(), <END> EmbeddedMultimapCacheManagerFactory.get(cacheName, cacheManager, configuration.build())); } }</code><technical_language>address.toString() uuh... why</technical_language>

Target:
protected void createCacheManagers() throws Throwable { super.createCacheManagers(); for (EmbeddedCacheManager cacheManager : cacheManagers) { MultimapCacheManager multimapCacheManager = EmbeddedMultimapCacheManagerFactory.from(cacheManager); multimapCacheCluster.put(cacheManager.getAddress(), multimapCacheManager.get(cacheName)); } }
Source:
<code>public void enter() { super.enter(); mPhonebook.resetAtState(); mSystemInterface.getHeadsetPhoneState().listenForPhoneState(false); mVoiceRecognitionStarted = false; mWaitingForVoiceRecognition = false; mAudioParams.clear(); <START> processWBSEvent(0); <END> if (mPrevState == mConnecting) { broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.STATE_CONNECTING); } else if (mPrevState == mDisconnecting) { broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.STATE_DISCONNECTING); } else if (mPrevState instanceof ConnectedBase) { if (mPrevState == mAudioConnecting) { broadcastAudioState(mCurrentDevice, BluetoothHeadset.STATE_AUDIO_DISCONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTING); } else if (mPrevState == mAudioOn || mPrevState == mAudioDisconnecting) { broadcastAudioState(mCurrentDevice, BluetoothHeadset.STATE_AUDIO_DISCONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTED); } broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.STATE_CONNECTED); } else if (mPrevState != null) { stateLogWtfStack("Illegal state transition from " + mPrevState + ", mCurrentDevice=" + mCurrentDevice); } mCurrentDevice = null; }</code><technical_language>Is a named constant instead of a hard-coded value</technical_language>

Target:
public void enter() { super.enter(); mPhonebook.resetAtState(); mSystemInterface.getHeadsetPhoneState().listenForPhoneState(false); mVoiceRecognitionStarted = false; mWaitingForVoiceRecognition = false; mAudioParams.clear(); processWBSEvent(HeadsetHalConstants.BTHF_WBS_NO); if (mPrevState == mConnecting) { broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.STATE_CONNECTING); } else if (mPrevState == mDisconnecting) { broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.STATE_DISCONNECTING); } else if (mPrevState instanceof ConnectedBase) { if (mPrevState == mAudioConnecting) { broadcastAudioState(mCurrentDevice, BluetoothHeadset.STATE_AUDIO_DISCONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTING); } else if (mPrevState == mAudioOn || mPrevState == mAudioDisconnecting) { broadcastAudioState(mCurrentDevice, BluetoothHeadset.STATE_AUDIO_DISCONNECTED, BluetoothHeadset.STATE_AUDIO_CONNECTED); } broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED, BluetoothProfile.STATE_CONNECTED); } else if (mPrevState != null) { stateLogWtfStack("Illegal state transition from " + mPrevState + ", mCurrentDevice=" + mCurrentDevice); } mCurrentDevice = null; }
Source:
<code>public Mono<OffsetDateTime> renewMessageLock(ServiceBusReceivedMessage message) { if (isDisposed.get()) { return monoError(logger, new IllegalStateException( String.format(INVALID_OPERATION_DISPOSED_RECEIVER, "renewMessageLock"))); } else if (Objects.isNull(message)) { return monoError(logger, new NullPointerException("'message' cannot be null.")); } else if (message.getLockToken().isEmpty()) { <START> throw logger.logExceptionAsError(new IllegalArgumentException("'message.getLockToken()' cannot be empty.")); <END> } else if (receiverOptions.isSessionReceiver()) { return monoError(logger, new IllegalStateException( String.format("Cannot renew message lock [%s] for a session receiver.", message.getLockToken()))); } return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityPath, entityType)) .flatMap(serviceBusManagementNode -> serviceBusManagementNode.renewMessageLock(message.getLockToken(), getLinkName(null))) .map(instant -> managementNodeLocks.addOrUpdate(message.getLockToken(), instant, instant.atOffset(ZoneOffset.UTC)).atOffset(ZoneOffset.UTC)); }</code><technical_language>monoError. is this line different</technical_language>

Target:
public Mono<OffsetDateTime> renewMessageLock(ServiceBusReceivedMessage message) { if (isDisposed.get()) { return monoError(logger, new IllegalStateException( String.format(INVALID_OPERATION_DISPOSED_RECEIVER, "renewMessageLock"))); } else if (Objects.isNull(message)) { return monoError(logger, new NullPointerException("'message' cannot be null.")); } else if (Objects.isNull(message.getLockToken())) { return monoError(logger, new NullPointerException("'message.getLockToken()' cannot be null.")); } else if (message.getLockToken().isEmpty()) { return monoError(logger, new IllegalArgumentException("'message.getLockToken()' cannot be empty.")); } else if (receiverOptions.isSessionReceiver()) { return monoError(logger, new IllegalStateException( String.format("Cannot renew message lock [%s] for a session receiver.", message.getLockToken()))); } return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityPath, entityType)) .flatMap(serviceBusManagementNode -> serviceBusManagementNode.renewMessageLock(message.getLockToken(), getLinkName(null))) .map(instant -> managementNodeLocks.addOrUpdate(message.getLockToken(), instant, instant.atOffset(ZoneOffset.UTC)).atOffset(ZoneOffset.UTC)); }
Source:
<code>private CfDef createDefaultCfDef(String namespace, String tableName) { return new CfDef() .setKeyspace(namespace) .setName(tableName) .setComment("") .setColumn_metadata(new ArrayList<>()) .setTriggers(new LinkedList<>()) .setKey_alias(new byte[] {0x6B, 0x65, 0x79}) .setComparator_type("org.apache.cassandra.db.marshal.CompositeType" + "(org.apache.cassandra.db.marshal.BytesType,org.apache.cassandra.db.marshal.LongType)") .setCompaction_strategy_options(new HashMap<>()) .setRead_repair_chance(0.0) .setGc_grace_seconds(345600) .setDefault_validation_class("org.apache.cassandra.db.marshal.BytesType") .setMin_compaction_threshold(4) .setMax_compaction_threshold(32) .setKey_validation_class("org.apache.cassandra.db.marshal.BytesType") .setCompaction_strategy("org.apache.cassandra.db.compaction.LeveledCompactionStrategy") .setCompression_options( ImmutableMap.<String, String>builder() .put("sstable_compression", "org.apache.cassandra.io.compress.LZ4Compressor") .put("chunk_length_kb", "4") .build()) .setBloom_filter_fp_chance(0.1) .setCaching("KEYS_ONLY") .setDclocal_read_repair_chance(0.1) .setMemtable_flush_period_in_ms(0) .setDefault_time_to_live(0) .setSpeculative_retry("NONE") .setCells_per_row_to_cache("0") .setMin_index_interval(128) .setMax_index_interval(2048); <START> } <END></code><technical_language>this copied / do need licensing</technical_language>

Target:
private CfDef createDefaultCfDef(String namespace, String tableName) { return new CfDef() .setKeyspace(namespace) .setName(tableName) .setComment("") .setColumn_metadata(new ArrayList<>()) .setTriggers(new LinkedList<>()) .setKey_alias(new byte[] {0x6B, 0x65, 0x79}) .setComparator_type("org.apache.cassandra.db.marshal.CompositeType" + "(org.apache.cassandra.db.marshal.BytesType,org.apache.cassandra.db.marshal.LongType)") .setCompaction_strategy_options(new HashMap<>()) .setRead_repair_chance(0.0) .setGc_grace_seconds(FOUR_DAYS_IN_SECONDS) .setDefault_validation_class("org.apache.cassandra.db.marshal.BytesType") .setMin_compaction_threshold(4) .setMax_compaction_threshold(32) .setKey_validation_class("org.apache.cassandra.db.marshal.BytesType") .setCompaction_strategy("org.apache.cassandra.db.compaction.LeveledCompactionStrategy") .setCompression_options( ImmutableMap.<String, String>builder() .put("sstable_compression", "org.apache.cassandra.io.compress.LZ4Compressor") .put("chunk_length_kb", "4") .build()) .setBloom_filter_fp_chance(0.1) .setCaching("KEYS_ONLY") .setDclocal_read_repair_chance(0.1) .setMemtable_flush_period_in_ms(0) .setDefault_time_to_live(0) .setSpeculative_retry("NONE") .setCells_per_row_to_cache("0") .setMin_index_interval(128) .setMax_index_interval(2048); }
Source:
<code>private Filter adaptBinaryComparator( FilterAdapterContext context, CompareOp compareOp, BinaryComparator comparator) throws IOException { <START> ByteString quotedValue = ByteString.copyFrom(comparator.getValue()); <END> switch (compareOp) { case LESS: return FILTERS .qualifier() .rangeWithinFamily(FilterAdapterHelper.getSingleFamilyName(context)) .endOpen(quotedValue); case LESS_OR_EQUAL: return FILTERS .qualifier() .rangeWithinFamily(FilterAdapterHelper.getSingleFamilyName(context)) .endClosed(quotedValue); case EQUAL: return FILTERS .qualifier() .regex(ReaderExpressionHelper.quoteRegularExpression(comparator.getValue())); case NOT_EQUAL: String familyName = FilterAdapterHelper.getSingleFamilyName(context); return FILTERS .interleave() .filter(FILTERS.qualifier().rangeWithinFamily(familyName).endOpen(quotedValue)) .filter(FILTERS.qualifier().rangeWithinFamily(familyName).startOpen(quotedValue)); case GREATER_OR_EQUAL: return FILTERS .qualifier() .rangeWithinFamily(FilterAdapterHelper.getSingleFamilyName(context)) .startClosed(quotedValue); case GREATER: return FILTERS .qualifier() .rangeWithinFamily(FilterAdapterHelper.getSingleFamilyName(context)) .startOpen(quotedValue); case NO_OP: return FILTERS.pass(); default: throw new IllegalStateException( String.format("Cannot handle unknown compare op %s", compareOp)); } }</code><technical_language>ByteString value...its quoted anymore</technical_language>

Target:
private Filter adaptBinaryComparator( FilterAdapterContext context, CompareOp compareOp, BinaryComparator comparator) throws IOException { ByteString value = ByteString.copyFrom(comparator.getValue()); switch (compareOp) { case LESS: return FILTERS .qualifier() .rangeWithinFamily(FilterAdapterHelper.getSingleFamilyName(context)) .endOpen(value); case LESS_OR_EQUAL: return FILTERS .qualifier() .rangeWithinFamily(FilterAdapterHelper.getSingleFamilyName(context)) .endClosed(value); case EQUAL: return FILTERS .qualifier() .regex(ReaderExpressionHelper.quoteRegularExpression(comparator.getValue())); case NOT_EQUAL: String familyName = FilterAdapterHelper.getSingleFamilyName(context); return FILTERS .interleave() .filter(FILTERS.qualifier().rangeWithinFamily(familyName).endOpen(value)) .filter(FILTERS.qualifier().rangeWithinFamily(familyName).startOpen(value)); case GREATER_OR_EQUAL: return FILTERS .qualifier() .rangeWithinFamily(FilterAdapterHelper.getSingleFamilyName(context)) .startClosed(value); case GREATER: return FILTERS .qualifier() .rangeWithinFamily(FilterAdapterHelper.getSingleFamilyName(context)) .startOpen(value); case NO_OP: return FILTERS.pass(); default: throw new IllegalStateException( String.format("Cannot handle unknown compare op %s", compareOp)); } }
Source:
<code>public void testCreateAvroTableWithSchemaUrl() throws Exception { File tempDir = createTempDir(); File schemaFile = new File(tempDir, "avro_single_column.avsc"); Files.write("{\n" + " \"namespace\": \"com.facebook.test\",\n" + " \"name\": \"single_column\",\n" + " \"type\": \"record\",\n" + " \"fields\": [\n" + " { \"name\":\"string_col\", \"type\":\"string\" }\n" + "]}", schemaFile, UTF_8); @Language("SQL") String createTableSqlFormat = "" + "CREATE TABLE %s.%s.test_create_avro (\n" + " dummy_col varchar,\n" + " another_dummy_col varchar\n" + ")\n" + "WITH (\n" + " avro_schema_url = '%s',\n" + " format = 'AVRO'\n" + ")"; String createTableSql = format(createTableSqlFormat, getSession().getCatalog().get(), getSession().getSchema().get(), schemaFile.getAbsolutePath()); String expectedSql = format(createTableSqlFormat, getSession().getCatalog().get(), getSession().getSchema().get(), <START> "file:/ END> assertUpdate(createTableSql); MaterializedResult actual = computeActual("SHOW CREATE TABLE test_create_avro"); assertEquals(actual.getOnlyValue(), expectedSql); assertUpdate("DROP TABLE test_create_avro"); deleteRecursively(tempDir.toPath(), ALLOW_INSECURE); }</code><technical_language>schemaFile.toURI().toString()</technical_language>

Target:
public void testCreateAvroTableWithSchemaUrl() throws Exception { File tempDir = createTempDir(); File schemaFile = createSchemaFileIn(tempDir); String createTableSql = getAvroCreateTableSql(schemaFile.getAbsolutePath()); String expectedSql = getAvroCreateTableSql(schemaFile.toURI().toString()); assertUpdate(createTableSql); MaterializedResult actual = computeActual("SHOW CREATE TABLE test_create_avro"); assertEquals(actual.getOnlyValue(), expectedSql); assertUpdate("DROP TABLE test_create_avro"); deleteRecursively(tempDir.toPath(), ALLOW_INSECURE); }
Source:
<code>private void logErrorAndWriteResponseToClient(Exception e, HttpServletResponse response) { try { <START> String errorMessage = e.getMessage().replace("<", "&lt;").replace(">", "&gt;"); <END> LOGGER.warn("Export node source failed", e); response.getWriter().write(errorMessage); } catch (IOException ioe) { LOGGER.warn("Failed to return node source export error to client", ioe); } }</code><technical_language>replaceAll is needed</technical_language>

Target:
private void logErrorAndWriteResponseToClient(Exception e, HttpServletResponse response) { try { String errorMessage = e.getMessage().replace("<", "&lt;").replace(">", "&gt;"); LOGGER.warn(EXPORT_FAILED_MESSAGE, e); response.getWriter().write(EXPORT_FAILED_MESSAGE + ": " + errorMessage); } catch (IOException ioe) { LOGGER.warn("Failed to return node source export error to client", ioe); } }
Source:
<code>public void testIDetectNoParentEntry() throws Exception { final Path cwd = path("/" + getMethodName() + "-" + UUID.randomUUID()); final Path file = new Path(cwd, "file"); try { touch(guardedFs, file); awaitFileStatus(guardedFs, file); metadataStore.forgetMetadata(cwd); final S3GuardFsck s3GuardFsck = new S3GuardFsck(rawFS, metadataStore); final List<S3GuardFsck.ComparePair> comparePairs = s3GuardFsck.compareS3RootToMs(cwd); <START> assertEquals("Number of pairs should be two. The cwd (parent) and the " <END> + "child.", 2, comparePairs.size()); final S3GuardFsck.ComparePair cwdPair = comparePairs.stream() .filter(p -> p.getPath().equals(cwd)) .findFirst().get(); assertNotNull("The pair should not be null.", cwdPair); assertTrue("The cwdPair must contain a violation.", cwdPair.containsViolation()); Assertions.assertThat(cwdPair.getViolations()) .describedAs("Violations in the cwdPair") .contains(S3GuardFsck.Violation.NO_METADATA_ENTRY); final S3GuardFsck.ComparePair childPair = comparePairs.stream() .filter(p -> p.getPath().equals(file)) .findFirst().get(); assertNotNull("The pair should not be null.", childPair); assertTrue("The childPair must contain a violation.", childPair.containsViolation()); Assertions.assertThat(childPair.getViolations()) .describedAs("Violations in the childPair") .contains(S3GuardFsck.Violation.NO_PARENT_ENTRY); } finally { rawFS.delete(cwd, true); metadataStore.forgetMetadata(file); metadataStore.forgetMetadata(cwd); } }</code><technical_language>If switch assertJ do more details mismatch. Probe is test cases factored out assertion</technical_language>

Target:
public void testIDetectNoParentEntry() throws Exception { final Path cwd = path("/" + getMethodName() + "-" + UUID.randomUUID()); final Path file = new Path(cwd, "file"); try { touchGuardedAndWaitRaw(file); metadataStore.forgetMetadata(cwd); final S3GuardFsck s3GuardFsck = new S3GuardFsck(rawFs, metadataStore); final List<S3GuardFsck.ComparePair> comparePairs = s3GuardFsck.compareS3ToMs(cwd); assertComparePairsSize(comparePairs, 2); checkForViolationInPairs(cwd, comparePairs, S3GuardFsck.Violation.NO_METADATA_ENTRY); checkForViolationInPairs(file, comparePairs, S3GuardFsck.Violation.NO_PARENT_ENTRY); } finally { cleanup(file, cwd); } }