auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ItemUseHandler getItemHandler() { return e -> { Player p = e.getPlayer(); if (p.getFoodLevel() >= 2) { <START> if (p.getInventory().getItemInMainHand().getType() != Material.SHEARS && p.getInventory().getItemInOffHand().getType() != Material.SHEARS && p.getGameMode() != GameMode.CREATIVE) { <END> FoodLevelChangeEvent event = new FoodLevelChangeEvent(p, p.getFoodLevel() - 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { p.setFoodLevel(event.getFoodLevel()); } } p.setVelocity(p.getEyeLocation().getDirection().multiply(4)); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1); p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 1); p.setFallDistance(0F); } else { SlimefunPlugin.getLocalization().sendMessage(p, "messages.hungry", true); } }; }</code><technical_language>I this this easily exploited holding normal shears a multi tool in hand a normal Wind staff. check if a wind staff is held in of hands, isItem(...) for this</technical_language>

Target:
public ItemUseHandler getItemHandler() { return e -> { Player p = e.getPlayer(); if (p.getFoodLevel() >= 2) { if (isItem(e.getItem()) && p.getGameMode() != GameMode.CREATIVE) { FoodLevelChangeEvent event = new FoodLevelChangeEvent(p, p.getFoodLevel() - 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { p.setFoodLevel(event.getFoodLevel()); } } p.setVelocity(p.getEyeLocation().getDirection().multiply(4)); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1); p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 1); p.setFallDistance(0F); } else { SlimefunPlugin.getLocalization().sendMessage(p, "messages.hungry", true); } }; }
Source:
<code>public IllegalVerifierStateIssue() { super(Severity.ERROR, CheckType.ILLEGAL_VERIFIER_STATE, <START> new HashSet<Integer>() <END> ); }</code><technical_language>@Rikkola investigating coverage I realized Collections.emptySet Collections.EMPTY_SET, do think</technical_language>

Target:
public IllegalVerifierStateIssue() { super(Severity.ERROR, CheckType.ILLEGAL_VERIFIER_STATE, Collections.EMPTY_SET ); }
Source:
<code>protected String getSchedulerVersion(Long agentId) { Instance instance = agentInstanceDao.getInstanceByAgent(agentId); String imageUuid = (String) DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_IMAGE_UUID).get(); DockerImage img = DockerImage.parse(imageUuid); <START> if (!StringUtils.startsWith(img.getFullName(), "rancher/scheduler")) { <END> return "NotApplicable"; } String[] imageParts = img.getFullName().split(":"); if (imageParts.length <= 1) { return ""; } return imageParts[imageParts.length - 1]; }</code><technical_language>rancher/scheduler-windows starts "rancher/scheduler". This wont work</technical_language>

Target:
protected String getSchedulerVersion(Long agentId) { Instance instance = agentInstanceDao.getInstanceByAgent(agentId); String imageUuid = (String) DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_IMAGE_UUID).get(); DockerImage img = DockerImage.parse(imageUuid); String[] imageParts = img.getFullName().split(":"); if (imageParts.length <= 1) { return ""; } if (!imageParts[0].equals("rancher/scheduler")) { return "NotApplicable"; } return imageParts[imageParts.length - 1]; }
Source:
<code>public static void sendAnalyticsException(@NonNull Throwable t, boolean fatal) { <START> Throwable root = t; <END> while (root.getCause() != null) { root = t.getCause(); } sendAnalyticsException(t.getClass().getSimpleName(), fatal); }</code><technical_language>This variable unused...</technical_language>

Target:
public static void sendAnalyticsException(@NonNull Throwable t, boolean fatal) { sendAnalyticsException(getCause(t).toString(), fatal); }
Source:
<code>private ImageMapType getCitySchemaMapType() { ImageMapTypeOptions opts = ImageMapTypeOptions.newInstance(); opts.setMinZoom(ZOOM_MIN); opts.setMaxZoom(ZOOM_MAX); opts.setName(MAP_TYPE_ID); opts.setTileSize(Size.newInstance(TILE_SIZE, TILE_SIZE)); opts.setTileUrl(new TileUrlCallBack() { @Override public String getTileUrl(Point point, int zoomLevel) { Point normalizedCoord = getNormalizedCoords(point, zoomLevel); if (normalizedCoord == null) { return null; } <START> return "images/cityschema/" + (zoomLevel-2) + "/" + (zoomLevel-2) + "-" + (int)normalizedCoord.getY() + "-" + (int)(normalizedCoord.getX()) + ".png"; <END> } }); return ImageMapType.newInstance(opts); }</code><technical_language>consider move path, file name separator "-" extension constans</technical_language>

Target:
private ImageMapType getCitySchemaMapType() { ImageMapTypeOptions opts = ImageMapTypeOptions.newInstance(); opts.setMinZoom(ZOOM_MIN); opts.setMaxZoom(ZOOM_MAX); opts.setName(MAP_TYPE_ID); opts.setTileSize(Size.newInstance(TILE_SIZE, TILE_SIZE)); opts.setTileUrl(new TileUrlCallBack() { @Override public String getTileUrl(Point point, int zoomLevel) { Point normalizedCoord = getNormalizedCoords(point, zoomLevel); if (normalizedCoord == null) { return null; } return TILE_IMAGES_PATH.replace("/", PATH_SEPARATOR) + PATH_SEPARATOR + (zoomLevel - 2) + PATH_SEPARATOR + + (zoomLevel - 2) + TILE_IMAGES_FILE_NAME_SEPARATOR + (int) normalizedCoord.getY() + TILE_IMAGES_FILE_NAME_SEPARATOR + (int) normalizedCoord.getX() + FILE_EXTENSION_SEPARATOR + TILE_IMAGES_FILE_EXTENSION; } }); return ImageMapType.newInstance(opts); }
Source:
<code>private static void popMethod(JoinPoint joinPoint, Object result, long lengthMillis) { Signature signature = joinPoint.getSignature(); <START> String className = signature.getDeclaringType().getSimpleName(); <END> String methodName = signature.getName(); boolean hasReturnType = signature instanceof MethodSignature && ((MethodSignature) signature).getReturnType() != void.class; StringBuilder builder = new StringBuilder("⇠ ") .append(methodName) .append(" [") .append(lengthMillis) .append("ms]"); if (hasReturnType) { builder.append(" = "); appendObject(builder, result); } Log.d(className, builder.toString()); }</code><technical_language>this return for anonymous classes</technical_language>

Target:
private static void popMethod(JoinPoint joinPoint, Object result, long lengthMillis) { Signature signature = joinPoint.getSignature(); Class<?> clazz = signature.getDeclaringType(); String methodName = signature.getName(); boolean hasReturnType = signature instanceof MethodSignature && ((MethodSignature) signature).getReturnType() != void.class; StringBuilder builder = new StringBuilder("⇠ ") .append(methodName) .append(" [") .append(lengthMillis) .append("ms]"); if (hasReturnType) { builder.append(" = "); appendObject(builder, result); } Log.d(asTag(clazz), builder.toString()); }
Source:
<code>protected boolean canDoAction() { <START> if (getGlusterVolume().isOnline()) { <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED); return false; } return super.canDoAction(); }</code><technical_language>add a check getGlusterVolume exists (not null)</technical_language>

Target:
protected boolean canDoAction() { if(! super.canDoAction()) { return false; } if (getGlusterVolume().isOnline()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED); return false; } return true; }
Source:
<code>public void afterEach() throws Exception { try { stopRepository(); <START> } catch (Exception e) { <END> } finally { FileUtil.delete("target/persistent_repository"); } }</code><technical_language>this exception left bubble fail test ? If afterEach fails means repository shutdown properly</technical_language>

Target:
public void afterEach() throws Exception { try { stopRepository(); } finally { FileUtil.delete("target/persistent_repository"); } }
Source:
<code>public boolean haveAllRepoUrlsBeenResolved() { <START> if(stackContext == null) { <END> return true; } return stackContext.haveAllRepoTasksCompleted(); }</code><technical_language>null. is happening? if directory for a stack (how?) context available</technical_language>

Target:
public boolean haveAllRepoUrlsBeenResolved() { return stackContext.haveAllRepoTasksCompleted(); }
Source:
<code>public byte[] persistToBytes() { byte[] result = new byte[4]; if (conservative()) { result[0] = (byte) 0x80; } if (dedicatedRow()) { result[0] |= 0x40; } result[0] |= shard() >> 2; result[1] = (byte) (shard() << 6); result[1] |= dedicatedRowNumber(); <START> return result; <END> }</code><technical_language>correct. I do result[1] |= shard() << 6; bytes in array default zero</technical_language>

Target:
public byte[] persistToBytes() { byte[] result = new byte[] { 0, 0, 0, 0 }; if (conservative()) { result[0] |= 0x80; } if (dedicatedRow()) { result[0] |= 0x40; } result[0] |= shard() >> 2; result[1] |= shard() << 6; result[1] |= dedicatedRowNumber(); return result; }
Source:
<code>private Set<TaskError> validateTrigger(Task task) { <START> LOGGER.debug("Validating the trigger in the task with name: and ID: {}", task.getName(), task.getId()); <END> TaskTriggerInformation trigger = task.getTrigger(); Channel channel = channelService.getChannel(trigger.getModuleName()); return validateTrigger(task, channel); }</code><technical_language>This for of validations - log results of validation</technical_language>

Target:
private Set<TaskError> validateTrigger(Task task) { LOGGER.debug("Validating trigger in task: with ID: {}", task.getName(), task.getId()); TaskTriggerInformation trigger = task.getTrigger(); Channel channel = channelService.getChannel(trigger.getModuleName()); return validateTrigger(task, channel); }
Source:
<code>private void getUnSyncedEntries(Map<String, Object> map) { Object[] healInfos = (Object[]) map.get(BRICKS); for (Object healInfoObj : healInfos) { Map<String, String> healInfo = (Map<String, String>) healInfoObj; String status = (String) healInfo.get(STATUS); Integer entries = null; if <START> ("Connected".equals(status)) <END> { String hostUuid = (String) healInfo.get(HOST_UUID); GlusterServer glusterServer = dbUtils.getServerByUuid(Guid.createGuidFromString(hostUuid)); String brickName = (String) healInfo.get(NAME); String[] brickParts = brickName.split(":", -1); if (brickParts.length != 2) { throw new RuntimeException("Invalid brick representation [" + brickName + "]"); } if (glusterServer == null) { log.warn("Could not fetch heal info for brick '{}' - server uuid '{}' not found", brickName, hostUuid); return; } GlusterBrickEntity brick = dbUtils.getGlusterBrickByServerUuidAndBrickDir(glusterServer.getId(), brickParts[1]); entries = Integer.valueOf((String) healInfo.get(NO_OF_ENTRIES)); unSyncedEntries.put(brick.getId(), entries); } } }</code><technical_language>please constant</technical_language>

Target:
private void getUnSyncedEntries(Map<String, Object> map) { Object[] healInfos = (Object[]) map.get(BRICKS); for (Object healInfoObj : healInfos) { Map<String, String> healInfo = (Map<String, String>) healInfoObj; String status = (String) healInfo.get(STATUS); Integer entries = null; if (BRICK_STATUS_CONNECTED.equals(status)) { String hostUuid = (String) healInfo.get(HOST_UUID); GlusterServer glusterServer = dbUtils.getServerByUuid(Guid.createGuidFromString(hostUuid)); String brickName = (String) healInfo.get(NAME); String[] brickParts = brickName.split(":", -1); if (brickParts.length != 2) { log.warn("Invalid brick representation in volume volume {}", brickName); continue; } if (glusterServer == null) { log.warn("Could not fetch heal info for brick '{}' - server uuid '{}' not found", brickName, hostUuid); continue; } GlusterBrickEntity brick = dbUtils.getGlusterBrickByServerUuidAndBrickDir(glusterServer.getId(), brickParts[1]); entries = Integer.valueOf((String) healInfo.get(NO_OF_ENTRIES)); unSyncedEntries.put(brick.getId(), entries); } } }
Source:
<code>private byte[] getParticipantObjectQueryForResponse(PRPAIN201306UV02 response) throws JAXBException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); <START> if (response.getControlActProcess() != null && response.getControlActProcess().getQueryByParameter() != null) { <END> getMarshaller().marshal(response.getControlActProcess().getQueryByParameter(), baos); } return baos.toByteArray(); }</code><technical_language>Is response guaranteed non-null this point</technical_language>

Target:
private byte[] getParticipantObjectQueryForResponse(PRPAIN201306UV02 response) throws JAXBException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (response != null && response.getControlActProcess() != null && response.getControlActProcess().getQueryByParameter() != null) { getMarshaller().marshal(response.getControlActProcess().getQueryByParameter(), baos); } return baos.toByteArray(); }
Source:
<code>public boolean apply(GHPullRequest remotePR) { @CheckForNull GitHubPRPullRequest localPR = localRepo.getPulls().get(remotePR.getNumber()); if (!isUpdated(remotePR, localPR)) { String logMessage = String.format("PR [#%s %s] not changed", remotePR.getNumber(), remotePR.getTitle()); logger.getLogger().println(logMessage); <START> LOGGER.info(logMessage); <END> return false; } return true; }</code><technical_language>info in jenkins, spam system logger. If want debug special class add in jenkins log handler level. trace debug</technical_language>

Target:
public boolean apply(GHPullRequest remotePR) { @CheckForNull GitHubPRPullRequest localPR = localRepo.getPulls().get(remotePR.getNumber()); if (!isUpdated(remotePR, localPR)) { String logMessage = String.format("PR [#%s %s] not changed", remotePR.getNumber(), remotePR.getTitle()); logger.getLogger().println(logMessage); LOGGER.debug(logMessage); return false; } return true; }
Source:
<code>private InitializationManager(Project project) { File baseFolder = new File(PluginManager.getPlugin(PluginId.findId("nl.tudelft.watchdog")).getPath().getPath()); File toTransferDatabaseFile = new File(baseFolder, WatchDogUtils.getProjectName() + "watchdog.mapdb"); File statisticsDatabaseFile = new File(baseFolder, WatchDogUtils.getProjectName() + "watchdogStatistics.mapdb"); toTransferPersister = new Persister( toTransferDatabaseFile); statisticsPersister = new Persister( statisticsDatabaseFile); intervalManager = new IntervalManager(toTransferPersister, statisticsPersister); eventManager = new EventManager(toTransferPersister, statisticsPersister); eventManager.setSessionSeed(intervalManager.getSessionSeed()); watchDogEventManager = new WatchDogEventManager(intervalManager, USER_ACTIVITY_TIMEOUT); new TimeSynchronityChecker(intervalManager, watchDogEventManager); transferManager = new TransferManagerBase(toTransferPersister, WatchDogUtils.getProjectName()); <START> intelliJListener = new IntelliJListener(watchDogEventManager, project); <END> intelliJListener.attachListeners(); XDebuggerManager.getInstance(project).getBreakpointManager().addBreakpointListener(new BreakpointListener(eventManager)); DebuggerManagerEx.getInstanceEx(project).getContextManager().addListener(new DebugEventListener(eventManager)); ActionManager.getInstance().addAnActionListener(new DebugActionListener(eventManager)); }</code><technical_language>this file a fresh mind, I difference WatchDogEvents other events is clear. propose renaming debug events such</technical_language>

Target:
private InitializationManager(Project project) { File baseFolder = new File(PluginManager.getPlugin(PluginId.findId("nl.tudelft.watchdog")).getPath().getPath()); File toTransferDatabaseFile = new File(baseFolder, WatchDogUtils.getProjectName() + "watchdog.mapdb"); File statisticsDatabaseFile = new File(baseFolder, WatchDogUtils.getProjectName() + "watchdogStatistics.mapdb"); toTransferPersister = new Persister( toTransferDatabaseFile); statisticsPersister = new Persister( statisticsDatabaseFile); intervalManager = new IntervalManager(toTransferPersister, statisticsPersister); debugEventManager = new DebugEventManager(toTransferPersister, statisticsPersister); debugEventManager.setSessionSeed(intervalManager.getSessionSeed()); watchDogEventManager = new WatchDogEventManager(intervalManager, USER_ACTIVITY_TIMEOUT); new TimeSynchronityChecker(intervalManager, watchDogEventManager); transferManager = new TransferManagerBase(toTransferPersister, WatchDogUtils.getProjectName()); intelliJListener = new IntelliJListener(watchDogEventManager, debugEventManager, project); intelliJListener.attachListeners(); }
Source:
<code>public String getGame(Model model, HttpSession session, @PathVariable int id) { model.addAttribute("gameId", id); if (session.getAttribute("member") == null) { <START> return "redirect:../../denied"; <END> } Member member = (Member) session.getAttribute("member"); List<Team> teams = member.getTeams(); model.addAttribute("teams", teams); TournamentDao tournamentDao = new TournamentDao(); List<Tournament> tournaments = tournamentDao.getLastXTournaments(5); model.addAttribute("tournaments", tournaments); GameDao gameDao = new GameDao(); Game game = gameDao.getGameById(id, true); model.addAttribute("game", game); return "game"; }</code><technical_language>above, absolute path accomplish this properly</technical_language>

Target:
public String getGame(Model model, HttpSession session, @PathVariable int id) { model.addAttribute("gameId", id); if (session.getAttribute("member") == null) { return "redirect:/denied"; } Member member = (Member) session.getAttribute("member"); Set<Team> teams = member.getTeams(); model.addAttribute("teams", teams); TournamentDao tournamentDao = new TournamentDao(); List<Tournament> tournaments = tournamentDao.getLastXTournaments(5); model.addAttribute("tournaments", tournaments); GameDao gameDao = new GameDao(); Game game = gameDao.getGameById(id, true); if(game==null) { return "redirect:/denied"; } model.addAttribute("game", game); return "game"; }
Source:
<code>protected Entity createNode(Location loc, Map<?, ?> flags) { Entity node = super.createNode(loc, flags); if (!IS_MASTER.apply(node)) { ServiceNotUpLogic.updateNotUpIndicator((EntityLocal)node, MySqlSlave.SLAVE_HEALTHY, "Replication not started"); FunctionFeed.builder() .entity((EntityLocal)node) <START> .period(Duration.FIVE_SECONDS) <END> .poll(FunctionPollConfig.forSensor(MySqlSlave.SLAVE_HEALTHY) .callable(new SlaveStateCallable(node)) .checkSuccess(StringPredicates.isNonBlank()) .onSuccess(new SlaveStateParser(node)) .setOnFailure(false) .description("Polls SHOW SLAVE STATUS")) .build(); node.addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS) .from(MySqlSlave.SLAVE_HEALTHY) .computing(Functionals.ifNotEquals(true).value("Slave replication status is not healthy") ) .build()); } return node; }</code><technical_language>extract private static variable in this class avoid magic number</technical_language>

Target:
protected Entity createNode(Location loc, Map<?, ?> flags) { Entity node = super.createNode(loc, flags); if (!IS_MASTER.apply(node)) { ServiceNotUpLogic.updateNotUpIndicator((EntityLocal)node, MySqlSlave.SLAVE_HEALTHY, "Replication not started"); addFeed(FunctionFeed.builder() .entity((EntityLocal)node) .period(Duration.FIVE_SECONDS) .poll(FunctionPollConfig.forSensor(MySqlSlave.SLAVE_HEALTHY) .callable(new SlaveStateCallable(node)) .checkSuccess(StringPredicates.isNonBlank()) .onSuccess(new SlaveStateParser(node)) .setOnFailure(false) .description("Polls SHOW SLAVE STATUS")) .build()); node.addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS) .from(MySqlSlave.SLAVE_HEALTHY) .computing(Functionals.ifNotEquals(true).value("Slave replication status is not healthy") ) .build()); } return node; }
Source:
<code>Attribute createAttribute(final String friendlyName, final String name, final String nameFormat) { return SAML2ComponentBuilder.createAttribute(friendlyName, name, <START> StringUtils.defaultIfBlank(nameFormat, "urn:oasis:names:tc:SAML:2.0:attrname-format:uri")); <END> }</code><technical_language>Consider put constant variable</technical_language>

Target:
Attribute createAttribute(final String friendlyName, final String name, final String nameFormat) { return SAML2ComponentBuilder.createAttribute(friendlyName, name, StringUtils.defaultIfBlank(nameFormat, NAME_FORMAT_STRING)); }
Source:
<code>public AuthOutcome authenticate(HttpFacade exchange) { List<String> authHeaders = exchange.getRequest().getHeaders("Authorization"); if (authHeaders == null || authHeaders.size() == 0) { challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.NO_AUTHORIZATION_HEADER, null, null); return AuthOutcome.NOT_ATTEMPTED; } tokenString = null; for (String authHeader : authHeaders) { String[] split = authHeader.trim().split("\\s+"); if (split == null || split.length != 2) continue; if (!split[0].equalsIgnoreCase("Basic")) continue; tokenString = split[1]; } if (tokenString == null) { challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.INVALID_TOKEN, null, null); return AuthOutcome.NOT_ATTEMPTED; } AccessTokenResponse atr=null; try { String userpw=new String(Base64.decode(tokenString)); int seperatorIndex = userpw.indexOf(":"); String user = userpw.substring(0, seperatorIndex); String pw = userpw.substring(seperatorIndex + 1); <START> log.debug("user: " + user); <END> log.debug("pw: " + pw); atr = getToken(user, pw); tokenString = atr.getToken(); } catch (Exception e) { log.debug("Failed to obtain token", e); challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.INVALID_TOKEN, "no_token", e.getMessage()); return AuthOutcome.FAILED; } return authenticateToken(exchange, atr.getToken()); }</code><technical_language>This is good logging. Please a message, a single log entry trace</technical_language>

Target:
public AuthOutcome authenticate(HttpFacade exchange) { List<String> authHeaders = exchange.getRequest().getHeaders("Authorization"); if (authHeaders == null || authHeaders.size() == 0) { challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.NO_AUTHORIZATION_HEADER, null, null); return AuthOutcome.NOT_ATTEMPTED; } tokenString = null; for (String authHeader : authHeaders) { String[] split = authHeader.trim().split("\\s+"); if (split == null || split.length != 2) continue; if (!split[0].equalsIgnoreCase("Basic")) continue; tokenString = split[1]; } if (tokenString == null) { challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.INVALID_TOKEN, null, null); return AuthOutcome.NOT_ATTEMPTED; } AccessTokenResponse atr=null; try { String userpw=new String(Base64.decode(tokenString)); int seperatorIndex = userpw.indexOf(":"); String user = userpw.substring(0, seperatorIndex); String pw = userpw.substring(seperatorIndex + 1); atr = getToken(user, pw); tokenString = atr.getToken(); } catch (Exception e) { log.debug("Failed to obtain token", e); challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.INVALID_TOKEN, "no_token", e.getMessage()); return AuthOutcome.FAILED; } return authenticateToken(exchange, atr.getToken()); }
Source:
<code>protected void copyDiff(Diff target, Monitor monitor, boolean rightToLeft) { if (isInTerminalState(target)) { return; } long start = System.currentTimeMillis(); target.setState(MERGING); Set<Diff> impliedMerges = getImpliedMerges(target, rightToLeft); while (!impliedMerges.isEmpty()) { Diff impliedMerge = impliedMerges.iterator().next(); if (impliedMerge != target && !isInTerminalState(impliedMerge)) { impliedMerge.setState(MERGED); impliedMerges.addAll(getImpliedMerges(impliedMerge, rightToLeft)); } impliedMerges.remove(impliedMerge); impliedMerges.remove(target); } if (isAccepting(target, rightToLeft)) { accept(target, rightToLeft); } else { reject(target, rightToLeft); } <START> target.setState(MERGED); <END> if (LOGGER.isDebugEnabled()) { long duration = System.currentTimeMillis() - start; if (rightToLeft) { LOGGER.debug("copyDiff(Diff, Monitor, Boolean) - diff " + target.hashCode() + " merged from right to left in " + duration + "ms"); } else { LOGGER.debug("copyDiff(Diff, Monitor, Boolean) - diff " + target.hashCode() + " merged from left to right in " + duration + "ms"); } } }</code><technical_language>Martin, do in a change. I do in this change early led modifications, I prefer postpone it. I a weird interaction MergeMode, in UI set markers Diffs merged DifferenceState. setting DifferenceState a proper (either MERGED DISCARDED) allow MergeMode in UI compute icon a merged diff. I want time consider fully</technical_language>

Target:
protected void copyDiff(Diff target, Monitor monitor, boolean rightToLeft) { if (isInTerminalState(target)) { return; } long start = System.currentTimeMillis(); target.setState(MERGING); Set<Diff> impliedMerges = getImpliedMerges(target, rightToLeft); while (!impliedMerges.isEmpty()) { Diff impliedMerge = impliedMerges.iterator().next(); if (impliedMerge != target && !isInTerminalState(impliedMerge)) { impliedMerge.setState(MERGED); impliedMerges.addAll(getImpliedMerges(impliedMerge, rightToLeft)); } impliedMerges.remove(impliedMerge); impliedMerges.remove(target); } if (isAccepting(target, rightToLeft)) { accept(target, rightToLeft); } else { reject(target, rightToLeft); } target.setState(MERGED); if (LOGGER.isDebugEnabled()) { long duration = System.currentTimeMillis() - start; LOGGER.debug("copyDiff(Diff, Monitor, Boolean) - diff " + target.hashCode() + " merged (rightToLeft: " + rightToLeft + ") in " + duration + "ms"); } }
Source:
<code>void _setVisible (boolean visible) { if (visible == OS.gtk_widget_get_mapped (handle)) return; if (visible) { sendEvent (SWT.Show); if (getItemCount () != 0) { if ((parent._getShell ().style & SWT.ON_TOP) != 0) { OS.gtk_menu_shell_set_take_focus (handle, false); } if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { long address = 0; hasLocation = false; long data = 0; TrayItem item = display.currentTrayItem; if (item != null && !item.isDisposed()) { data = item.handle; address = OS.gtk_status_icon_position_menu_func (); } OS.gtk_menu_popup (handle, 0, 0, address, data, 0, display.getLastEventTime ()); } else { long eventPtr = OS.gtk_get_current_event(); if (eventPtr == 0) { eventPtr = OS.gdk_event_new(OS.GDK_BUTTON_PRESS); <START> GdkEventButton event <END> = new GdkEventButton(); event.window = OS.g_object_ref(OS.gtk_widget_get_window(getShell().handle)); OS.memmove (eventPtr, event, GdkEventButton.sizeof); } OS.gtk_menu_popup_at_pointer (handle, eventPtr); OS.gdk_event_free (eventPtr); } } else { sendEvent (SWT.Hide); } } else { OS.gtk_menu_popdown (handle); } }</code><technical_language>a generic GdkEvent instead of a specialized GdkEventButton here? reason is if a GdkEventButton, set button, gdk throws a warning: g_warning ("Event type %d holding a GdkDevice. " "It is synthesized Gdk/GTK+"). this warning if fire Snippet67</technical_language>

Target:
void _setVisible (boolean visible) { if (visible == OS.gtk_widget_get_mapped (handle)) return; if (visible) { sendEvent (SWT.Show); if (getItemCount () != 0) { if ((parent._getShell ().style & SWT.ON_TOP) != 0) { OS.gtk_menu_shell_set_take_focus (handle, false); } if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { long address = 0; hasLocation = false; long data = 0; TrayItem item = display.currentTrayItem; if (item != null && !item.isDisposed()) { data = item.handle; address = OS.gtk_status_icon_position_menu_func (); } OS.gtk_menu_popup (handle, 0, 0, address, data, 0, display.getLastEventTime ()); } else { long eventPtr = OS.gtk_get_current_event(); if (eventPtr == 0) { eventPtr = OS.gdk_event_new(OS.GDK_BUTTON_PRESS); GdkEventButton event = new GdkEventButton(); event.type = OS.GDK_BUTTON_PRESS; event.window = OS.g_object_ref(OS.gtk_widget_get_window(getShell().handle)); long device_manager = OS.gdk_display_get_device_manager( OS.gdk_display_get_default ()); event.device = OS.gdk_device_manager_get_client_pointer (device_manager); event.time = display.getLastEventTime (); OS.memmove (eventPtr, event, GdkEventButton.sizeof); } OS.gtk_menu_popup_at_pointer (handle, eventPtr); OS.gdk_event_free (eventPtr); } } else { sendEvent (SWT.Hide); } } else { OS.gtk_menu_popdown (handle); } }
Source:
<code>protected void fireStoppedEvent(final MIOutput output, final IExecutionDMContext ctx) { final DsfSession session = DsfSession.getSession(ctx.getSessionId()); <START> session.getExecutor().execute(new DsfRunnable() { <END> @Override public void run() { int token = output.getMIResultRecord().getToken(); session.dispatchEvent(MIErrorEvent.parse(ctx, token, output.getMIResultRecord().getMIResults(), output.getMIOOBRecords()), null); } }); }</code><technical_language>need call session.dispatchEvent() executor is @ThreadSafe. call executor</technical_language>

Target:
protected void fireStoppedEvent(final MIOutput output, final IExecutionDMContext ctx) { DsfSession session = DsfSession.getSession(ctx.getSessionId()); int token = output.getMIResultRecord().getToken(); session.dispatchEvent(MIErrorEvent.parse(ctx, token, output.getMIResultRecord().getMIResults(), output.getMIOOBRecords()), null); }
Source:
<code>public boolean addConsumer(MqttMessageSubscriber subscriber) throws MqttException { String topic = StringUtils.replace(StringUtils.replace(subscriber.getTopic(), "+", "[^/]*"), "#", ".*"); synchronized (consumers) { List<MqttMessageSubscriber> subscriberList = consumers.get(topic); if (subscriberList == null) { subscriberList = new ArrayList<>(); } subscriberList.add(subscriber); <START> consumers.put(subscriber.getTopic(), subscriberList); <END> } if (isConnected()) { try { client.subscribe(subscriber.getTopic(), qos); } catch (org.eclipse.paho.client.mqttv3.MqttException e) { throw new MqttException(e); } } return true; }</code><technical_language>current state of patch sense me. lines a is done get subscriberList a new is created if is one. subscriber is added list put consumers key subscriber.getTopic(). lookup done key topic. So, if original topic used, needs fixed places. I prefer put if receive list. add element list a put operation</technical_language>

Target:
public boolean addConsumer(MqttMessageSubscriber subscriber) throws MqttException { String topic = prepareTopic(subscriber.getTopic()); synchronized (consumers) { List<MqttMessageSubscriber> subscriberList = consumers.get(topic); if (subscriberList == null) { subscriberList = new ArrayList<>(); consumers.put(topic, subscriberList); } subscriberList.add(subscriber); } if (isConnected()) { try { client.subscribe(subscriber.getTopic(), qos); } catch (org.eclipse.paho.client.mqttv3.MqttException e) { throw new MqttException(e); } } return true; }
Source:
<code>protected int getSpecificHeaderSize() { int maxChildren = getConfig().getMaxChildren(); int specificSize = SIZE_INT + SIZE_INT + SIZE_INT * maxChildren + SIZE_LONG * maxChildren + SIZE_LONG * maxChildren <START> + SIZE_INT * maxChildren <END> + SIZE_INT * maxChildren; return specificSize; }</code><technical_language>2 ints? I written header</technical_language>

Target:
protected int getSpecificHeaderSize() { int maxChildren = getConfig().getMaxChildren(); int specificSize = SIZE_INT + SIZE_INT + SIZE_INT * maxChildren + SIZE_LONG * maxChildren + SIZE_LONG * maxChildren; return specificSize; }
Source:
<code>public PhysicalDeviceDto getPhysicalDevice() { <START> return physicalDevice; <END> }</code><technical_language>Add this qualifier</technical_language>

Target:
public PhysicalDeviceDto getPhysicalDevice() { return this.physicalDevice; }
Source:
<code>protected ItemStack dispenseStack(GlowBlock block, ItemStack stack) { Material armor = stack.getType(); BlockFace facing = BlockDispenser.getFacing(block); GlowBlock target = block.getRelative(facing); Location location1 = target.getLocation(); Location location2 = location1.clone(); location2.setY(location2.getY() - 1); World world = location1.getWorld(); List<LivingEntity> entities = new ArrayList<>(); <START> for (Entity cEntity : world.getNearbyEntities(location1, 3, 3, 3)) { <END> switch (cEntity.getType()) { case PLAYER: entities.add((LivingEntity) cEntity); break; } } Location location; Boolean location1Test; Boolean location2Test; for (LivingEntity player : entities) { location = player.getLocation().clone(); location.setX(location.getBlockX()); location.setY(location.getBlockY()); location.setZ(location.getBlockZ()); location1Test = (location.getX() == location1.getX() && location.getY() == location1.getY() && location.getZ() == location1.getZ()); location2Test = (location.getX() == location2.getX() && location.getY() == location2.getY() && location.getZ() == location2.getZ()); if ((location1Test || location2Test)) { return ((GlowInventory) ((Player) player).getInventory()).tryToFillSlots(stack, 36, 40); } } return defaultBehavior.dispense(block, stack); }</code><technical_language>reason this is named cEntity instead of entity</technical_language>

Target:
protected ItemStack dispenseStack(GlowBlock block, ItemStack stack) { BlockFace facing = BlockDispenser.getFacing(block); Location targetLocation = block.getLocation().clone().add(facing.getModX(), facing.getModY(), facing.getModZ()); List<LivingEntity> entities = new ArrayList<>(); for (Entity entity : targetLocation.getWorld().getNearbyEntities(targetLocation, 3, 3, 3)) { switch (entity.getType()) { case PLAYER: entities.add((LivingEntity) entity); break; } } boolean targetLocationTest1; boolean targetLocationTest2; for (LivingEntity player : entities) { targetLocationTest1 = (player.getLocation().getBlockX() == targetLocation.getX() && player.getLocation().getBlockY() == targetLocation.getY() && player.getLocation().getBlockZ() == targetLocation.getZ()); targetLocationTest2 = (player.getEyeLocation().getBlockX() == targetLocation.getX() && player.getEyeLocation().getBlockY() == targetLocation.getY() && player.getEyeLocation().getBlockZ() == targetLocation.getZ()); if ((targetLocationTest1 || targetLocationTest2)) { return ((GlowInventory) ((Player) player).getInventory()).tryToFillSlots(stack, 36, 40); } } return defaultBehavior.dispense(block, stack); }
Source:
<code>protected RuntimeException safeTransformEntityErrorResponse(RuntimeException e, Response response, Supplier<RuntimeException> entityExceptionSupplier, Supplier<RuntimeException> fallbackExceptionSupplier) { RuntimeException suppressedException = null; try { <START> if (response.hasEntity() && MediaType.APPLICATION_JSON_TYPE.equals(response.getMediaType())) { <END> return entityExceptionSupplier.get(); } } catch (@SuppressWarnings("squid:S1166") javax.ws.rs.ProcessingException | IllegalStateException ex) { suppressedException = ex; } RuntimeException exception = fallbackExceptionSupplier.get(); if (suppressedException != null) { exception.addSuppressed(suppressedException); } return exception; }</code><technical_language>Move this check ErrorDoRestClientExceptionTransformer (a generic error response entity "encoded" another textual representation) open issue: solution get supressed exception</technical_language>

Target:
protected RuntimeException safeTransformEntityErrorResponse(RuntimeException e, Response response, Supplier<RuntimeException> entityExceptionSupplier, Supplier<RuntimeException> fallbackExceptionSupplier) { RuntimeException suppressedException = null; try { if (response.hasEntity()) { return entityExceptionSupplier.get(); } } catch (RuntimeException ex) { suppressedException = ex; } RuntimeException exception = fallbackExceptionSupplier.get(); if (suppressedException != null) { exception.addSuppressed(suppressedException); } return exception; }
Source:
<code>public void testAnySubpaths() { String id = RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body(jsonParser.getJson(tractorAsPropertyFile)) .post(propertyPath) .then() .assertThat() .statusCode(HttpStatus.SC_CREATED) .extract() .path(idPath); RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get(propertyPath + "?page[totals]") .then() .assertThat() .statusCode(HttpStatus.SC_OK) .body("meta.page.totalRecords", greaterThan(0)); RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get(propertyPath + sep + id + "/myStuff") .then() .assertThat() .statusCode(HttpStatus.SC_OK) .body("data.attributes.horsepower", equalTo(horsepower), idPath, equalTo(one)); RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get(propertyPath + sep + id + "/myStuff?page[totals]") .then() .assertThat() .statusCode(HttpStatus.SC_OK) <START> .body("meta", equalTo(null)); <END> RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get(propertyPath + sep + id + "?filter[tractor]=horsepower==103") .then() .assertThat() .statusCode(HttpStatus.SC_BAD_REQUEST); }</code><technical_language>This right me. meta null</technical_language>

Target:
public void testAnySubpaths() { String id = RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body(jsonParser.getJson("/AnyPolymorphismIT/AddTractorProperty.json")) .post("/property") .then() .assertThat() .statusCode(HttpStatus.SC_CREATED) .extract() .path("data.id"); Response response = RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get("/property?page[totals]") .then() .assertThat() .statusCode(HttpStatus.SC_OK) .extract() .response(); Integer collectionSize = response.path("data.size()"); Integer totalSize = response.path("meta.page.totalRecords"); Assert.assertEquals(collectionSize, totalSize); RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get("/property/" + id + "/myStuff") .then() .assertThat() .statusCode(HttpStatus.SC_OK) .body("data.attributes.horsepower", equalTo(102), "data.id", equalTo("1")); RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get("/device") .then() .assertThat() .statusCode(HttpStatus.SC_NOT_FOUND) .body("errors[0]", containsString("Unknown collection")); RestAssured .given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .get("/property/" + id + "?filter[tractor]=horsepower==103") .then() .assertThat() .statusCode(HttpStatus.SC_BAD_REQUEST); }
Source:
<code>public static void setAsDefault() { try { HttpsURLConnection.setDefaultSSLSocketFactory(getInstance()); } catch (NoSuchAlgorithmException | KeyManagementException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>here. In case want open ErrorScreen, do of reportError() methods <LINK_0></technical_language>

Target:
public static void setAsDefault() { try { HttpsURLConnection.setDefaultSSLSocketFactory(getInstance()); } catch (NoSuchAlgorithmException | KeyManagementException e) { if (DEBUG) e.printStackTrace(); } }
Source:
<code>public List<Extension> getExtension() { if (extension == null) { <START> extension = new ArrayList<Extension>(); <END> } return this.extension; }</code><technical_language>instantiate provider list constructor itself? allow get rid of "if" condition called getProvider method is invoked</technical_language>

Target:
public List<Extension> getExtension() { return this.extension; }
Source:
<code>public void close() { <START> if (TransactionalContext.isInTransaction()) { if (txnType == READ_ONLY) { long timeElapsed = System.nanoTime() - txnStartTime; tablesInTxn.forEach(t -> t.getMetrics().readOnlyTxnTimes.set(timeElapsed)); } else { log.warn("close()ing a transaction with mutations without calling commit()!"); } this.objectsView.TXAbort(); } operations.clear(); tablesInTxn.clear(); <END> }</code><technical_language>I if want support case user end read-only transaction calling commit, this.objectsView.TxEnd() instead of this.objectsView.TXAbort(), Corfu internally bookkeeps some metrics logs, if TXAbort, confuse corfu logging metrics. I personally support this, error prone: imagining txn intially read-only user write commit(), modifiied transaction added some write logic, forget add commit(), log a warning here, silently fail. I encourage standarizing transaction commit pattern avoid confusion mistakes</technical_language>

Target:
public void close() { if (TransactionalContext.isInTransaction()) { log.warn("close()ing a transaction without calling commit()!", txnType); long timeElapsed = System.nanoTime() - txnStartTime; if (txnType == READ_ONLY) { tablesInTxn.forEach(t -> t.getMetrics().setReadOnlyTxnTimes(timeElapsed)); } else { tablesInTxn.forEach(t -> t.getMetrics().incNumTxnAborts()); } this.objectsView.TXAbort(); } operations.clear(); tablesInTxn.clear(); }
Source:
<code>public void test() throws Exception { File file = new File("./example/example.xml"); URL channelsURL = file.toURI().toURL(); ThingDescriptionReader reader = new ThingDescriptionReader(); ThingDescriptionList thingList = (ThingDescriptionList) reader.readFromXML(channelsURL); thingList.stream().forEach(it -> { if (it instanceof ChannelTypeXmlResult) { <START> ((ChannelTypeXmlResult) it).toChannelType(); <END> } }); }</code><technical_language>..stream() call unused. toChannelType() return a property, changing reference. I guess this dropped completely</technical_language>

Target:
public void test() throws Exception { File file = new File("./example/example.xml"); URL channelsURL = file.toURI().toURL(); ThingDescriptionReader reader = new ThingDescriptionReader(); ThingDescriptionList thingList = (ThingDescriptionList) reader.readFromXML(channelsURL); }
Source:
<code>private void verifyProtocolLogging(LoadBalancer loadBalancer, LoadBalancer dbLoadBalancer) throws UnprocessableEntityException { String logErr = "Protocol must be a non-UDP protocol for connection logging to be enabled."; String proErr = "Cannot change protocol from non-UDP to UDP while logging is enabled."; boolean changingLogging = loadBalancer.isConnectionLogging() != null && !loadBalancer.isConnectionLogging().equals(dbLoadBalancer.isConnectionLogging()); boolean changingProtocol = loadBalancer.getProtocol() != null && !loadBalancer.getProtocol().equals(dbLoadBalancer.getProtocol()); if (changingProtocol && changingLogging) { if(loadBalancer.isUdpProtocol() && loadBalancer.isConnectionLogging()) { LOG.error(logErr); throw new UnprocessableEntityException(logErr); } LOG.debug("ConnectionLogging is being enabled on the loadbalancer."); <START> } <END> else if (changingLogging) { if (loadBalancer.isConnectionLogging()) { if (dbLoadBalancer.isUdpProtocol()) { LOG.error(logErr); throw new UnprocessableEntityException(logErr); } LOG.debug("ConnectionLogging is being enabled on the loadbalancer."); } else { LOG.debug("ConnectionLogging is being disabled on the loadbalancer."); } dbLoadBalancer.setConnectionLogging(loadBalancer.isConnectionLogging()); } else if (changingProtocol) { if (loadBalancer.isUdpProtocol()) { if (dbLoadBalancer.isConnectionLogging()) { LOG.error(proErr); throw new UnprocessableEntityException(proErr); } } } }</code><technical_language>this block of code handled blocks check for changingProtocol changingLogging? I this is redundant if protocol logging changes want check. Instead of if-else block if blocks...one checks for changing protocol checks for changing logging</technical_language>

Target:
private void verifyProtocolLogging(LoadBalancer loadBalancer, LoadBalancer dbLoadBalancer) throws UnprocessableEntityException { String logErr = "Cannot change to UDP based protocol while logging is enabled."; if (loadBalancer.getProtocol() != null && !loadBalancer.getProtocol().equals(dbLoadBalancer.getProtocol())) { if (loadBalancer.isUdpProtocol()) { if (dbLoadBalancer.isConnectionLogging()) { LOG.error(logErr); throw new UnprocessableEntityException(logErr); } LOG.debug("Change to UDP based protocol does not clash with current logging state."); } } }
Source:
<code>public void testAdd() { String id = "fakeID"; IItemDescriptor<Factory> instance = createDescriptor(id, 1, new MatchEngineFactoryImpl()); IItemDescriptor<Factory> oldValue = registry.add(instance); <START> assertTrue(registry.getItemDescriptors().size() == 1); <END> assertTrue(registry.getItemDescriptor(id) == instance); assertTrue(registry.getHighestRankingDescriptor() == instance); assertTrue(oldValue == null); }</code><technical_language>Please correct "assert" versions. check for equality, "assertEquals"</technical_language>

Target:
public void testAdd() { String id = "fakeID"; IItemDescriptor<Factory> instance = createDescriptor(id, 1, new MatchEngineFactoryImpl()); IItemDescriptor<Factory> oldValue = registry.add(instance); assertEquals(registry.getItemDescriptors().size(), 1); assertSame(registry.getItemDescriptor(id), instance); assertSame(registry.getHighestRankingDescriptor(), instance); assertNull(oldValue); }
Source:
<code>public void testConvertToMimeType(String mimeType) throws IOException { String converterName = cs.getConverterName(mimeType, "text/html"); assertEquals("zip2html", converterName); checkConverterAvailability(converterName); BlobHolder htmlBH = getBlobFromPath("test-docs/hello.zip"); htmlBH.getBlob().setMimeType(mimeType); Map<String, Serializable> parameters = Collections.emptyMap(); BlobHolder result = cs.convert(converterName, htmlBH, parameters); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(3, blobs.size()); Map<String, String> zipContent = new HashMap<>(); zipContent.put("hello.xml", "Hello from a xml <b>document</b>"); zipContent.put("hello.txt", "Hello from a text document"); String content = blobs.get(0).getString(); assertTrue(content, content.contains("<li><a href=\"hello.xml\">hello.xml</a></li>")); assertTrue(content, content.contains("<li><a href=\"hello.txt\">hello.txt</a></li>")); for (int i = 1; i < blobs.size(); i++) { File file = blobs.get(i).getFile(); content = DocumentUTUtils.readContent(file); <START> assertTrue(content, content.contains(zipContent.get(file.getName()))); <END> zipContent.remove(file.getName()); } assertEquals(zipContent.size(), 0, zipContent.size()); }</code><technical_language>Put file.getName() in a local variable, add iteration number filename in failure message: assertTrue("file " + i + " " + filename + ": " + content, ...)</technical_language>

Target:
public void testConvertToMimeType(String mimeType) throws IOException { String converterName = cs.getConverterName(mimeType, "text/html"); assertEquals("zip2html", converterName); checkConverterAvailability(converterName); BlobHolder htmlBH = getBlobFromPath("test-docs/hello.zip"); htmlBH.getBlob().setMimeType(mimeType); Map<String, Serializable> parameters = Collections.emptyMap(); BlobHolder result = cs.convert(converterName, htmlBH, parameters); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(3, blobs.size()); Map<String, String> zipContent = new HashMap<>(); zipContent.put("hello.xml", "Hello from a xml <b>document</b>"); zipContent.put("hello.txt", "Hello from a text document"); String content = blobs.get(0).getString(); assertTrue(content, content.contains("<li><a href=\"hello.xml\">hello.xml</a></li>")); assertTrue(content, content.contains("<li><a href=\"hello.txt\">hello.txt</a></li>")); for (int i = 1; i < blobs.size(); i++) { File file = blobs.get(i).getFile(); String filename = file.getName(); content = DocumentUTUtils.readContent(file); assertTrue("File " + i + " does not contain " + filename + ": " + content, content.contains(zipContent.get(file.getName()))); zipContent.remove(file.getName()); } assertTrue("Unexpected remaining files: " + zipContent.keySet(), zipContent.isEmpty()); }