auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response remove(GlusterBricks bricks) { for (GlusterBrick brick : bricks.getGlusterBricks()) { validateParameters(brick, "id"); } return performAction(VdcActionType.GlusterVolumeRemoveBricks, new GlusterVolumeRemoveBricksParameters(asGuid(getVolumeId()), mapBricks(asGuid(getVolumeId()), bricks))); }

Target:
public Response remove(GlusterBricks bricks) { if (bricks.getGlusterBricks().size() > 0) { for (GlusterBrick brick : bricks.getGlusterBricks()) { validateParameters(brick, "id"); } } return performAction(VdcActionType.GlusterVolumeRemoveBricks, new GlusterVolumeRemoveBricksParameters(asGuid(getVolumeId()), mapBricks(asGuid(getVolumeId()), bricks))); }
Source:
private java.util.Timer makeConfigurationChangeMonitor(long reloadInterval, SslContextFactory.Server sslContextFactory) { java.util.Timer timer = new java.util.Timer("SSL Certificates Store Monitor", true); timer.schedule(new FileMonitoringTimerTask( Paths.get(keyStore), path -> { LOG.info("Reloading certificates from store keystore " + keyStore); try { sslContextFactory.reload(factory -> { }); } catch (Exception ex) { LOG.error("Failed to reload SSL keystore certificates", ex); } },null), reloadInterval, reloadInterval ); return timer; }

Target:
private Timer makeConfigurationChangeMonitor(long reloadInterval, SslContextFactory.Server sslContextFactory) { Timer timer = new Timer("SSL Certificates Store Monitor", true); timer.schedule(new FileMonitoringTimerTask( Paths.get(keyStore), path -> { LOG.info("Reloading certificates from store keystore " + keyStore); try { sslContextFactory.reload(factory -> { }); } catch (Exception ex) { LOG.error("Failed to reload SSL keystore certificates", ex); } },null), reloadInterval, reloadInterval ); return timer; }
Source:
protected OneTimePasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { decoder.startSequence(); final String algorithm = decoder.decodeOctetStringAsString(); final String seed = decoder.decodeOctetStringAsString(); final int sequenceNumber = decoder.decodeInteger().intValue(); decoder.endSequence(); return new OneTimePasswordAlgorithmSpec(algorithm, seed, sequenceNumber); }

Target:
protected OneTimePasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { decoder.startSequence(); final String algorithm = decoder.decodeOctetStringAsString(); final String seed = decoder.decodeIA5String(); final int sequenceNumber = decoder.decodeInteger().intValue(); decoder.endSequence(); return new OneTimePasswordAlgorithmSpec(algorithm, seed, sequenceNumber); }
Source:
private void saveClientCertSettings(){ if (getInteger(PERSIST_CLIENT_CERT, 0) > 0){ logger.warn("Saving Client Certificate settings: password will be found in config"); setUseClientCert(getInteger(USE_CLIENT_CERT, 0) > 0); setClientCertLocation(getString(CLIENT_CERT_LOCATION, "")); setClientCertPassword(getString(CLIENT_CERT_PASSWORD, "")); } else { setUseClientCert(false); setClientCertLocation(""); setClientCertPassword(""); } }

Target:
private void saveClientCertSettings(){ if (getBoolean(PERSIST_CLIENT_CERT, false)){ logger.warn("Saving Client Certificate settings: password will be found in config"); setUseClientCert(getBoolean(USE_CLIENT_CERT, false)); setClientCertLocation(getString(CLIENT_CERT_LOCATION, "")); setClientCertPassword(getString(CLIENT_CERT_PASSWORD, "")); setClientCertIndex(getInt(CLIENT_CERT_INDEX, 0)); } else { setUseClientCert(false); setClientCertLocation(""); setClientCertPassword(""); setClientCertIndex(0); } }
Source:
public Object[] getJsonFields() { List<String> elementlist = new ArrayList(); Iterator<Map.Entry<String, JsonNode>> fields = this.rootNode.getFields(); while(fields.hasNext()){ String fieldsstr = ""; Map.Entry<String, JsonNode> entry = fields.next(); fieldsstr += entry.getKey() +","+entry.getValue().toString(); elementlist.add(fieldsstr); } return elementlist.toArray(); }

Target:
public Object[] getJsonFields() { List<String> elementlist = new ArrayList(); Iterator<Map.Entry<String, JsonNode>> fields = this.rootNode.getFields(); while(fields.hasNext()){ Map.Entry<String, JsonNode> entry = fields.next(); StringBuilder fieldBuilder = new StringBuilder(); fieldBuilder.append(entry.getKey()); fieldBuilder.append(","); fieldBuilder.append(entry.getValue().toString()); elementlist.add(fieldBuilder.toString()); } return elementlist.toArray(); }
Source:
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause, Http2Exception http2Ex) { if (http2Ex == null) { http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause); } ChannelPromise promise = ctx.newPromise(); ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise()); if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) { doGracefulShutdown(ctx, future, promise); } else { future.addListener(new ClosingChannelFutureListener(ctx, promise)); } ctx.flush(); }

Target:
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause, Http2Exception http2Ex) { if (http2Ex == null) { http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause); } ChannelPromise promise = ctx.newPromise(); ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise()); if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) { doGracefulShutdown(ctx, future, promise); } else { future.addListener(new ClosingChannelFutureListener(ctx, promise)); } }
Source:
protected String runIf(CommandContext ctx) throws Exception { ctx.handle("if result.value==\"true\" of " + this.getReadPropertyReq()); ctx.handle(this.getWritePropertyReq("\"true\"")); ctx.handle("else"); ctx.handle(this.getWritePropertyReq("\"false\"")); ctx.handle("end-if"); cliOut.reset(); ctx.handle(getReadPropertyReq()); return getValue(); }

Target:
protected String runIf(CommandContext ctx) throws Exception { ctx.handle("if result.value==\"true\" of " + this.getReadPropertyReq()); ctx.handle(this.getWritePropertyReq("\"false\"")); ctx.handle("else"); ctx.handle(this.getWritePropertyReq("\"true\"")); ctx.handle("end-if"); cliOut.reset(); ctx.handle(getReadPropertyReq()); return getValue(); }
Source:
public void disable(CommandSource src) { Sponge.getServer().getWorld("no-save").ifPresent(world -> { Sponge.getServer().unloadWorld(world); Sponge.getServer().deleteWorld(world.getProperties()); }); Sponge.getServer().getWorld("metadata-only").ifPresent(world -> { Sponge.getServer().unloadWorld(world); Sponge.getServer().deleteWorld(world.getProperties()); }); }

Target:
public void disable(CommandSource src) { final Server server = Sponge.getServer(); server.getWorld("no-save").ifPresent(world -> { server.unloadWorld(world); server.deleteWorld(world.getProperties()); }); server.getWorld("metadata-only").ifPresent(world -> { server.unloadWorld(world); server.deleteWorld(world.getProperties()); }); }
Source:
private BlockingQueue<Runnable> newQueue(boolean needPrioritySort) { return needPrioritySort ? new PriorityBlockingQueue<>() : new LinkedBlockingQueue<>(); }

Target:
private static BlockingQueue<Runnable> newQueue(boolean needPrioritySort) { return needPrioritySort ? new PriorityBlockingQueue<>() : new LinkedBlockingQueue<>(); }
Source:
private IStatus copyFile(InputStream in, IPath to, long ts) throws CoreException { File tempFile = null; try { File file = to.toFile(); tempFile = writeToTempFile(in, to); moveTempFile(tempFile, file); if (ts != IResource.NULL_STAMP && ts != 0) file.setLastModified(ts); } catch (CoreException e) { throw e; } catch (Exception e) { return new Status(IStatus.ERROR, ASWTPToolsPlugin.PLUGIN_ID, IEventCodes.JST_PUB_FAIL, NLS.bind(Messages.errorCopyingFile, to.toString(), e.getLocalizedMessage()), null); } finally { if (tempFile != null && tempFile.exists()) tempFile.deleteOnExit(); try { if (in != null) in.close(); } catch (Exception ex) { } } return null; }

Target:
private IStatus copyFile(InputStream in, IPath to, long ts) throws CoreException { File tempFile = null; try { File file = to.toFile(); tempFile = writeToTempFile(in, to); moveTempFile(tempFile, file); if (ts != IResource.NULL_STAMP && ts != 0) file.setLastModified(ts); } catch (CoreException e) { throw e; } catch (Exception e) { return new Status(IStatus.ERROR, ASWTPToolsPlugin.PLUGIN_ID, IEventCodes.JST_PUB_FAIL, NLS.bind(Messages.errorCopyingFile, to.toString(), e.getLocalizedMessage()), null); } finally { if (tempFile != null && tempFile.exists()) tempFile.deleteOnExit(); StreamUtils.safeClose(in); } return null; }
Source:
private void delete(Path d) { try { Instant threshold = Instant.now().minus(30, ChronoUnit.SECONDS); Instant lastModified = Files.getLastModifiedTime(d).toInstant(); if (lastModified.isBefore(threshold)) { Files.delete(d); } } catch (IOException e) { LOG.error("Unable to delete path {}", d, e); } }

Target:
private void delete(Path d) { try { Instant threshold = Instant.now().minus(30, ChronoUnit.SECONDS); Instant lastModified = Files.getLastModifiedTime(d).toInstant(); if (lastModified.isBefore(threshold)) { Files.delete(d); } } catch (IOException e) { LOG.error(MessageFormat.format(JGitText.get().cannotDeleteFile, d), e); } }
Source:
public static List<SqlScalarFunction> parseFunctionDefinitions(Class<?> clazz) { ImmutableList.Builder<SqlScalarFunction> builder = ImmutableList.builder(); for (ScalarHeaderAndMethods methods : findScalarsInFunctionSetClass(clazz)) { builder.add(parseParametricScalar(methods, ImmutableMap.of())); } return builder.build(); }

Target:
public static List<SqlScalarFunction> parseFunctionDefinitions(Class<?> clazz) { ImmutableList.Builder<SqlScalarFunction> builder = ImmutableList.builder(); for (ScalarHeaderAndMethods methods : findScalarsInFunctionSetClass(clazz)) { builder.add(parseParametricScalar(methods, Optional.empty())); } return builder.build(); }
Source:
private void renderCombinedEventScripts() { StringBuilder combinedScript = new StringBuilder(); for (HeaderItem curItem : domReadyItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); if (curItem instanceof OnDomReadyHeaderItem) { combinedScript.append(((OnDomReadyHeaderItem)curItem).getJavaScript()); } else if (curItem instanceof OnEventHeaderItem) { combinedScript.append(((OnEventHeaderItem)curItem).getCompleteJavaScript()); } combinedScript.append(';'); } } if (combinedScript.length() > 0) { combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);"); getRealResponse().render( OnDomReadyHeaderItem.forScript(combinedScript.append('\n').toString())); } combinedScript.setLength(0); for (OnLoadHeaderItem curItem : loadItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); combinedScript.append(curItem.getJavaScript()); combinedScript.append(';'); } } if (combinedScript.length() > 0) { combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_TIMERS_BOUND);"); getRealResponse().render( OnLoadHeaderItem.forScript(combinedScript.append('\n').toString())); } }

Target:
private void renderCombinedEventScripts() { StringBuilder combinedScript = new StringBuilder(); for (HeaderItem curItem : domReadyItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); if (curItem instanceof OnDomReadyHeaderItem) { combinedScript.append(((OnDomReadyHeaderItem)curItem).getJavaScript()); } else if (curItem instanceof OnEventHeaderItem) { combinedScript.append(((OnEventHeaderItem)curItem).getCompleteJavaScript()); } combinedScript.append(';'); } } if (combinedScript.length() > 0) { combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);"); getRealResponse().render( OnDomReadyHeaderItem.forScript(combinedScript.append('\n').toString())); } combinedScript.setLength(0); for (OnLoadHeaderItem curItem : loadItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); combinedScript.append(curItem.getJavaScript()); combinedScript.append(';'); } } if (combinedScript.length() > 0) { getRealResponse().render( OnLoadHeaderItem.forScript(combinedScript.append('\n').toString())); } }
Source:
public boolean getLock(DatabaseTransOperator transOperator, String lockName, int lockTimeoutInSeconds) throws SQLException { String getLockStatement = String.format(getLockTemplate, lockName, lockTimeoutInSeconds); return transOperator.query(getLockStatement, this); }

Target:
public boolean getLock(DatabaseTransOperator transOperator, String lockName, int lockTimeoutInSeconds) throws SQLException { if (StringUtils.isEmpty(lockName)) { throw new IllegalArgumentException("Lock name cannot be null or empty"); } String getLockStatement = String.format(getLockTemplate, lockName, lockTimeoutInSeconds); return transOperator.query(getLockStatement, this); }
Source:
public static void applyGermlineVariantFilter(final M2ArgumentCollection MTAC, final VariantContext vc, final Collection<String> filters) { if (!vc.hasAttribute(GATKVCFConstants.NORMAL_LOD_KEY)) { return; } final int loc = vc.getStart(); final boolean siteInCosmic = vc.hasAttribute(SomaticGenotypingEngine.IN_COSMIC_VCF_ATTRIBUTE); final boolean siteInDbsnp = vc.hasAttribute(SomaticGenotypingEngine.IN_DBSNP_VCF_ATTRIBUTE); if (siteInDbsnp && !siteInCosmic ) { final double normalLod = vc.getAttributeAsDouble(GATKVCFConstants.NORMAL_LOD_KEY, 0.0); if (normalLod < MTAC.NORMAL_DBSNP_LOD_THRESHOLD) { filters.add(GATKVCFConstants.GERMLINE_RISK_FILTER_NAME); } } }

Target:
private static void applyGermlineVariantFilter(final M2ArgumentCollection MTAC, final VariantContext vc, final Collection<String> filters) { if (!vc.hasAttribute(GATKVCFConstants.NORMAL_LOD_KEY)) { return; } final boolean siteInCosmic = vc.hasAttribute(SomaticGenotypingEngine.IN_COSMIC_VCF_ATTRIBUTE); final boolean siteInDbsnp = vc.hasAttribute(SomaticGenotypingEngine.IN_DBSNP_VCF_ATTRIBUTE); if (siteInDbsnp && !siteInCosmic ) { final double normalLod = vc.getAttributeAsDouble(GATKVCFConstants.NORMAL_LOD_KEY, 0.0); if (normalLod < MTAC.NORMAL_DBSNP_LOD_THRESHOLD) { filters.add(GATKVCFConstants.GERMLINE_RISK_FILTER_NAME); } } }
Source:
private void write(Set<String> modules) throws ForbiddenException, ServerException, ConflictException { VirtualFileEntry file; file = baseFolder.getChild(MODULES_PATH); if (file == null && !modules.isEmpty()) file = ((FolderEntry)baseFolder.getChild(".codenvy")).createFile("modules", new byte[0], MediaType.TEXT_PLAIN); String all = ""; for (String path : modules) { all += (path + "\n"); } if (file != null) { ((FileEntry)file).updateContent(all.getBytes()); } }

Target:
private void write(Set<String> modules) throws ForbiddenException, ServerException, ConflictException { VirtualFileEntry file = baseFolder.getChild(MODULES_PATH); if (file == null && !modules.isEmpty()) { file = ((FolderEntry)baseFolder.getChild(".codenvy")).createFile("modules", new byte[0], MediaType.TEXT_PLAIN); } String all = ""; for (String path : modules) { all += (path + "\n"); } if (file != null) { ((FileEntry)file).updateContent(all.getBytes()); } }
Source:
static Stream<Arguments> getTestParameters() { ConfigurationServiceVersion[] filteredKeyServiceVersion = Arrays.stream(ConfigurationServiceVersion.values()).filter(TestHelper::shouldServiceVersionBeTested) .toArray(ConfigurationServiceVersion[]::new); return getArgumentsFromServiceVersion(Arrays.asList(filteredKeyServiceVersion)); }

Target:
static Stream<Arguments> getTestParameters() { return getArgumentsFromServiceVersion(ConfigurationServiceVersion.values(), shouldServiceVersionBeTested, SERVICE_VERSION_FROM_ENV); }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input") instanceof SwiftObject, "this binder is only valid for SwiftObject!"); checkNotNull(request, "request"); SwiftObject object = (SwiftObject) input; if (object.getPayload().getContentMetadata().getContentType() == null) object.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_OCTET_STREAM); if (object.getPayload().getContentMetadata().getContentLength() != null && object.getPayload().getContentMetadata().getContentLength() >= 0) { checkArgument(object.getPayload().getContentMetadata().getContentLength() <= 5l * 1024 * 1024 * 1024, "maximum size for put object is 5GB"); } else { request = (R) request.toBuilder().replaceHeader("Transfer-Encoding", "chunked").build(); } byte[] contentMD5 = object.getInfo().getHash(); if (contentMD5 != null) { request = (R) request.toBuilder() .addHeader(HttpHeaders.ETAG, BaseEncoding.base16().lowerCase().encode(contentMD5)) .build(); } Date expires = object.getPayload().getContentMetadata().getExpires(); if (expires != null) { request = (R) request.toBuilder() .addHeader("X-Delete-At", String.valueOf(expires.getTime() / 1000)) .build(); } request = mdBinder.bindToRequest(request, object2Blob.apply(object)); return request; }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input") instanceof SwiftObject, "this binder is only valid for SwiftObject!"); checkNotNull(request, "request"); SwiftObject object = (SwiftObject) input; if (object.getPayload().getContentMetadata().getContentType() == null) object.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_OCTET_STREAM); if (object.getPayload().getContentMetadata().getContentLength() != null && object.getPayload().getContentMetadata().getContentLength() >= 0) { checkArgument(object.getPayload().getContentMetadata().getContentLength() <= 5l * 1024 * 1024 * 1024, "maximum size for put object is 5GB"); } else { request = (R) request.toBuilder().replaceHeader("Transfer-Encoding", "chunked").build(); } byte[] contentMD5 = object.getInfo().getHash(); if (contentMD5 != null) { request = (R) request.toBuilder() .addHeader(HttpHeaders.ETAG, BaseEncoding.base16().lowerCase().encode(contentMD5)) .build(); } Date expires = object.getPayload().getContentMetadata().getExpires(); if (expires != null) { request = (R) request.toBuilder() .addHeader("X-Delete-At", String.valueOf( MILLISECONDS.toSeconds(expires.getTime()))) .build(); } request = mdBinder.bindToRequest(request, object2Blob.apply(object)); return request; }
Source:
static BoundedContext boundedContext(Stand stand, int concurrentThreads) { final Executor executor = concurrentThreads > 0 ? Executors.newFixedThreadPool(concurrentThreads) : new Executor() { @Override public void execute(Runnable command) { command.run(); } }; return boundedContextBuilder(stand) .setStandFunnelExecutor(executor) .build(); }

Target:
static BoundedContext boundedContext(Stand stand, int concurrentThreads) { final Executor executor = concurrentThreads > 0 ? Executors.newFixedThreadPool(concurrentThreads) : MoreExecutors.directExecutor(); return boundedContextBuilder(stand) .setStandFunnelExecutor(executor) .build(); }
Source:
public AuditLogType getAuditLogTypeValue() { addAuditLogCustomValues(); switch (getActionState()) { case END_SUCCESS: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_SUCCESS; case END_FAILURE: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_FAILURE; } return AuditLogType.UNASSIGNED; }

Target:
public AuditLogType getAuditLogTypeValue() { addAuditLogCustomValues(); switch (getActionState()) { case EXECUTE: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT; case END_SUCCESS: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_SUCCESS; case END_FAILURE: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_FAILURE; } return AuditLogType.UNASSIGNED; }
Source:
public void coerce(RecordCursor delegate, int field) { if (delegate.isNull(field)) { setIsNull(true); return; } Block block = (Block) delegate.getObject(field); BlockBuilder builder = toType.createBlockBuilder(new BlockBuilderStatus(), 1); BlockBuilder listBuilder = builder.beginBlockEntry(); for (int i = 0; i < block.getPositionCount(); i++) { if (block.isNull(i)) { listBuilder.appendNull(); } else if (elementCoercer == null) { block.writePositionTo(i, listBuilder); listBuilder.closeEntry(); } else { rewriteBlock(fromElementHiveType, toElementHiveType, fromElementType, toElementType, block, i, listBuilder, elementCoercer, field); } } builder.closeEntry(); setObject(builder.build().getObject(0, Block.class)); }

Target:
public void coerce(RecordCursor delegate, int field) { if (delegate.isNull(field)) { setIsNull(true); return; } Block block = (Block) delegate.getObject(field); if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder listBuilder = blockBuilder.beginBlockEntry(); for (int i = 0; i < block.getPositionCount(); i++) { if (elementCoercer == null) { toElementType.appendTo(block, i, listBuilder); } else { if (block.isNull(i)) { listBuilder.appendNull(); } else { rewriteBlock(fromElementType, toElementType, block, i, listBuilder, elementCoercer, bridgingRecordCursor); } } } blockBuilder.closeEntry(); pageBuilder.declarePosition(); setObject(toType.getObject(blockBuilder, blockBuilder.getPositionCount() - 1)); }
Source:
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException { Collection<Player> targets; if (args.length > 0) { targets = new ArrayList<>(); int pos = 0; for (int i = 0; i < args.length; i++) { targets.add(getPlayer(server, sender, args, pos).getBase()); pos++; } } else { targets = ess.getOnlinePlayers(); } ess.getTNTListener().enable(); for (Player player : targets) { if (player == null) { continue; } player.sendMessage(tl("nuke")); final Location loc = player.getLocation(); final World world = loc.getWorld(); for (int x = -10; x <= 10; x += 5) { for (int z = -10; z <= 10; z += 5) { final Location tntloc = new Location(world, loc.getBlockX() + x, world.getHighestBlockYAt(loc) + 64, loc.getBlockZ() + z); world.spawn(tntloc, TNTPrimed.class); } } } }

Target:
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException { Collection<Player> targets; if (args.length > 0) { targets = new ArrayList<>(); int pos = 0; for (String arg : args) { targets.add(getPlayer(server, sender, args, pos).getBase()); pos++; } } else { targets = ess.getOnlinePlayers(); } ess.getTNTListener().enable(); for (Player player : targets) { if (player == null) { continue; } player.sendMessage(tl("nuke")); final Location loc = player.getLocation(); final World world = loc.getWorld(); for (int x = -10; x <= 10; x += 5) { for (int z = -10; z <= 10; z += 5) { final Location tntloc = new Location(world, loc.getBlockX() + x, world.getHighestBlockYAt(loc) + 64, loc.getBlockZ() + z); world.spawn(tntloc, TNTPrimed.class); } } } }
Source:
protected void processRequest(CorfuMsg msg, ChannelHandlerContext ctx, IServerRouter r) { executor.submit( () -> { switch (msg.getMsgType()) { case READ_REQUEST: case KNOWN_ADDRESS_REQUEST: case COMPACT_REQUEST: Lock lock = resetLock.readLock(); lock.lock(); if (msg.getEpoch() != serverContext.getLogUnitEpochWaterMark()) { r.sendResponse(ctx, msg, new CorfuPayloadMsg<>(CorfuMsgType.WRONG_EPOCH, serverContext.getServerEpoch())); return; } try { getHandler().handle(msg, ctx, r); } finally { lock.unlock(); } break; default: getHandler().handle(msg, ctx, r); } }); }

Target:
protected void processRequest(CorfuMsg msg, ChannelHandlerContext ctx, IServerRouter r) { executor.submit(() -> getHandler().handle(msg, ctx, r)); }
Source:
private ContactService() { Random random = new Random(0); LocalDateTime time = LocalDateTime.of(1930, Month.JANUARY, 1, 0, 0); for (int i = 0; i < 100; i++) { Contact contact = new Contact(); contact.setFirstName(fnames[random.nextInt(fnames.length)]); contact.setLastName(lnames[random.nextInt(fnames.length)]); contact.setEmail(contact.getFirstName().toLowerCase(Locale.ENGLISH) + "@" + contact.getLastName().toLowerCase(Locale.ENGLISH) + ".com"); contact.setPhoneNumber("+ 358 555 " + (100 + random.nextInt(900))); time = time.plusYears(random.nextInt(70)); time = time.plusMonths(random.nextInt(11)); time = time.plusDays(random.nextInt(27)); contact.setBirthDate(time); save(contact); } }

Target:
private ContactService() { Random random = new Random(0); LocalDate time = LocalDate.of(1930, Month.JANUARY, 1); for (int i = 0; i < 100; i++) { Contact contact = new Contact(); contact.setFirstName(fnames[random.nextInt(fnames.length)]); contact.setLastName(lnames[random.nextInt(fnames.length)]); contact.setEmail(contact.getFirstName().toLowerCase(Locale.ENGLISH) + "@" + contact.getLastName().toLowerCase(Locale.ENGLISH) + ".com"); contact.setPhoneNumber("+ 358 555 " + (100 + random.nextInt(900))); time = time.plusYears(random.nextInt(70)); time = time.plusMonths(random.nextInt(11)); time = time.plusDays(random.nextInt(27)); contact.setBirthDate(time); save(contact); } }
Source:
public OpsManager() { this.states = new HashMap<String, Integer>(); this.ops = new HashMap<String, Integer>(); this.revStates = new ArrayList<String>(); this.revOps = new ArrayList<String>(); this.truthTable = null; this.order = false; ; }

Target:
public OpsManager() { this.states = new HashMap<String, Integer>(); this.ops = new HashMap<String, Integer>(); this.revStates = new ArrayList<String>(); this.revOps = new ArrayList<String>(); this.truthTable = null; this.order = false; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.actionSubmit: submitAction(); break; default: break; } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (id) { case R.id.actionSubmit: submitAction(); return true; default: break; } return super.onOptionsItemSelected(item); }
Source:
private void setLoggerLevel(String loggerConfig) { int i = loggerConfig.indexOf('='); if (i < 0) { return; } String loggerName = loggerConfig.substring(0, i); String levelStr = loggerConfig.substring(i + 1); if (loggerName == null) { return; } if (levelStr == null) { return; } loggerName = loggerName.trim(); levelStr = levelStr.trim(); addInfo("Trying to set level " + levelStr + " to logger " + loggerName); LoggerContext lc = (LoggerContext) context; Logger logger = lc.getLogger(loggerName); if ("null".equalsIgnoreCase(levelStr)) { logger.setLevel(null); } else { Level level = Level.toLevel(levelStr, null); if (level != null) { logger.setLevel(level); } } }

Target:
private void setLoggerLevel(String loggerConfig) { String[] parts = loggerConfig.split("=", 2); if (parts.length < 2) { return; } String loggerName = parts[0]; String levelStr = parts[1]; if (levelStr.isEmpty() || loggerName.isEmpty()) { return; } loggerName = loggerName.trim(); levelStr = levelStr.trim(); LoggerContext lc = (LoggerContext) context; Logger logger = lc.getLogger(loggerName); if ("null".equalsIgnoreCase(levelStr)) { logger.setLevel(null); } else { Level level = Level.toLevel(levelStr, null); if (level != null) { logger.setLevel(level); } } }
Source:
public boolean isValid(String mask, ConstraintValidatorContext context) { if (mask.isEmpty()) { return true; } boolean isMaskFormatValid = isMaskFormatValid(mask); AConstraint.AConstraintArgsFormatValue args = new AConstraint.AConstraintArgsFormatValue(isMaskFormatValid, isMaskFormatValid ? isMaskValid(mask) : false, VdcBllMessages.UPDATE_NETWORK_ADDR_IN_SUBNET_BAD_FORMAT.name(), VdcBllMessages.UPDATE_NETWORK_ADDR_IN_SUBNET_BAD_VALUE.name()); return AConstraint.getInstance().isValid(args, context, "mask"); }

Target:
public boolean isValid(String mask, ConstraintValidatorContext context) { if (mask.isEmpty()) { return true; } boolean isMaskFormatValid = isMaskFormatValid(mask); AValidatorConstraint.AValidatorConstraintArgsFormatValue args = new AValidatorConstraint.AValidatorConstraintArgsFormatValue(isMaskFormatValid, isMaskFormatValid ? isMaskValid(mask) : false, VdcBllMessages.UPDATE_NETWORK_ADDR_IN_SUBNET_BAD_FORMAT.name(), VdcBllMessages.UPDATE_NETWORK_ADDR_IN_SUBNET_BAD_VALUE.name()); return AValidatorConstraint.getInstance().isValid(args, context, "mask"); }
Source:
public <T> T[] toArray(T[] newArray) { Class<?> componentType = newArray.getClass().getComponentType(); T[] returnArray = newArray; int size = fInnerElements.size(); if (returnArray.length < size) { returnArray = (T[]) Array.newInstance(componentType, size); } Iterator<E> iterator = iterator(); for (int i = 0; i < size; i++) { @Nullable E next = null; while (iterator.hasNext() && next == null) { next = iterator.next(); } if (next != null) { Class<? extends @NonNull Object> elementClass = next.getClass(); if (!Objects.equals(elementClass, componentType) && !elementClass.isInstance(componentType)) { throw new ArrayStoreException("Cannot convert from (" + elementClass + " to " + newArray.getClass().getComponentType()); } } returnArray[i] = (T) next; } return returnArray; }

Target:
public <T> T[] toArray(T[] newArray) { Class<?> componentType = newArray.getClass().getComponentType(); T[] returnArray = newArray; int size = fInnerElements.size(); if (returnArray.length < size) { returnArray = (T[]) Array.newInstance(componentType, size); } for (int i = size; i < returnArray.length; i++) { returnArray[i] = null; } Iterator<E> iterator = iterator(); for (int i = 0; i < size; i++) { @Nullable E next = null; while (iterator.hasNext() && next == null) { next = iterator.next(); } if (next != null) { Class<? extends @NonNull Object> elementClass = next.getClass(); if (!Objects.equals(elementClass, componentType) && !elementClass.isInstance(componentType)) { throw new ArrayStoreException("Cannot convert from (" + elementClass + " to " + newArray.getClass().getComponentType()); } } returnArray[i] = (T) next; } return returnArray; }
Source:
private void removeSelectedPerson() { if (mSelectedPerson == null) { return; } PeopleUtils.removePerson(mSelectedPerson.getBlogId(), mSelectedPerson.getPersonID(), mSelectedPerson.getLocalTableBlogId(), new PeopleUtils.RemoveUserCallback() { @Override public void onSuccess(long personID, int localTableBlogId) { Person person = PeopleTable.getPerson(personID, localTableBlogId); String text; if (person != null) { PeopleTable.deletePerson(personID, localTableBlogId); text = getString(R.string.person_removed, person.getUsername()); } else { text = getString(R.string.person_removed_general); } ToastUtils.showToast(PeopleManagementActivity.this, text, ToastUtils.Duration.LONG); navigateBackToPeopleListFragment(); refreshPeopleListFragment(); } @Override public void onError() { ToastUtils.showToast(PeopleManagementActivity.this, R.string.error_remove_user, ToastUtils.Duration.LONG); } }); }

Target:
private void removeSelectedPerson() { Person person = getCurrentPerson(); if (person == null) { return; } PeopleUtils.removePerson(person.getBlogId(), person.getPersonID(), person.getLocalTableBlogId(), new PeopleUtils.RemoveUserCallback() { @Override public void onSuccess(long personID, int localTableBlogId) { Person person = PeopleTable.getPerson(personID, localTableBlogId); String text; if (person != null) { PeopleTable.deletePerson(personID, localTableBlogId); text = getString(R.string.person_removed, person.getUsername()); } else { text = getString(R.string.person_removed_general); } ToastUtils.showToast(PeopleManagementActivity.this, text, ToastUtils.Duration.LONG); navigateBackToPeopleListFragment(); refreshPeopleListFragment(); } @Override public void onError() { ToastUtils.showToast(PeopleManagementActivity.this, R.string.error_remove_user, ToastUtils.Duration.LONG); } }); }
Source:
public static Pair<ClassificationCounter, Map<Serializable, ClassificationCounter>> countAllByAttributeValues( final Iterable<? extends AbstractInstance> instances, final String attribute, String splitAttribute, Serializable splitAttributeValue) { final Map<Serializable, ClassificationCounter> result = Maps.newHashMap(); final ClassificationCounter totals = new ClassificationCounter(); for (final AbstractInstance instance : instances) { final Serializable attrVal = instance.getAttributes().get(attribute); ClassificationCounter cc = null; boolean isAnAcceptableMissingValue = splitAttribute == null || splitAttributeValue == null || instance.getAttributes().get(splitAttribute).equals(splitAttributeValue); if (attrVal!=null) cc = result.get(attrVal); else if (isAnAcceptableMissingValue) cc = result.get(MISSING_VALUE); if (cc == null || isAnAcceptableMissingValue) { cc = new ClassificationCounter(); Serializable newKey = (attrVal != null) ? attrVal : MISSING_VALUE; result.put(newKey, cc); } cc.addClassification(instance.getClassification(), instance.getWeight()); totals.addClassification(instance.getClassification(), instance.getWeight()); } return Pair.with(totals, result); }

Target:
public static Pair<ClassificationCounter, Map<Serializable, ClassificationCounter>> countAllByAttributeValues( final Iterable<? extends AbstractInstance> instances, final String attribute, String splitAttribute, Serializable splitAttributeValue) { final Map<Serializable, ClassificationCounter> result = Maps.newHashMap(); final ClassificationCounter totals = new ClassificationCounter(); for (final AbstractInstance instance : instances) { final Serializable attrVal = instance.getAttributes().get(attribute); ClassificationCounter cc = null; boolean acceptableMissingValue = attrVal ==null && isAnAcceptableMissingValue(instance, splitAttribute, splitAttributeValue); if (attrVal!=null) cc = result.get(attrVal); else if (acceptableMissingValue) cc = result.get(MISSING_VALUE); else continue; if (cc == null) { cc = new ClassificationCounter(); Serializable newKey = (attrVal != null) ? attrVal : MISSING_VALUE; result.put(newKey, cc); } cc.addClassification(instance.getClassification(), instance.getWeight()); totals.addClassification(instance.getClassification(), instance.getWeight()); } return Pair.with(totals, result); }
Source:
public CharSeq padTo(int length, Character element) { final StringBuilder sb = new StringBuilder(back); for (int i = 0; i < length; i++) { sb.append(element); } return new CharSeq(sb.toString()); }

Target:
public CharSeq padTo(int length, Character element) { if(length <= back.length()) { return this; } final StringBuilder sb = new StringBuilder(back); final int limit = length - back.length(); for (int i = 0; i < limit; i++) { sb.append(element); } return new CharSeq(sb.toString()); }
Source:
public Tagger createDefaultTagger() { WeakReference<EnglishTagger> ref = cachedTagger; EnglishTagger tagger = ref == null ? null : ref.get(); if (tagger == null) { cachedTagger = new WeakReference<>(tagger = new EnglishTagger()); } return tagger; }

Target:
public Tagger createDefaultTagger() { WeakReference<EnglishTagger> ref = cachedTagger; EnglishTagger tagger = ref == null ? null : ref.get(); if (tagger == null) { tagger = new EnglishTagger(); cachedTagger = new WeakReference<>(tagger); } return tagger; }
Source:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { MCMaterial i = StaticLayer.GetConvertor().getMaterial(Static.getInt32(args[0], t)); CArray ret = new CArray(t); ret.set("maxstacksize", new CInt(i.getMaxStackSize(), t), t); ret.set("maxdurability", new CInt(i.getMaxDurability(), t), t); ret.set("hasgravity", new CBoolean(i.hasGravity(), t), t); ret.set("isblock", new CBoolean(i.isBlock(), t), t); ret.set("isburnable", new CBoolean(i.isBurnable(), t), t); ret.set("isedible", new CBoolean(i.isEdible(), t), t); ret.set("isflammable", new CBoolean(i.isFlammable(), t), t); ret.set("isoccluding", new CBoolean(i.isOccluding(), t), t); ret.set("isrecord", new CBoolean(i.isRecord(), t), t); ret.set("issolid", new CBoolean(i.isSolid(), t), t); ret.set("istransparent", new CBoolean(i.isTransparent(), t), t); return ret; }

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { MCMaterial i = StaticLayer.GetConvertor().getMaterial(Static.getInt32(args[0], t)); CArray ret = new CArray(t); ret.set("maxStacksize", new CInt(i.getMaxStackSize(), t), t); ret.set("maxDurability", new CInt(i.getMaxDurability(), t), t); ret.set("hasGravity", new CBoolean(i.hasGravity(), t), t); ret.set("isBlock", new CBoolean(i.isBlock(), t), t); ret.set("isBurnable", new CBoolean(i.isBurnable(), t), t); ret.set("isEdible", new CBoolean(i.isEdible(), t), t); ret.set("isFlammable", new CBoolean(i.isFlammable(), t), t); ret.set("isOccluding", new CBoolean(i.isOccluding(), t), t); ret.set("isRecord", new CBoolean(i.isRecord(), t), t); ret.set("isSolid", new CBoolean(i.isSolid(), t), t); ret.set("isTransparent", new CBoolean(i.isTransparent(), t), t); return ret; }
Source:
public ExceptionAwareTransactionMethod(InvocationContext context) { super(); this.context = context; }

Target:
public ExceptionAwareTransactionMethod(InvocationContext context) { this.context = context; }
Source:
public static void waitTillInstanceReachState(ColoHelper cluster, Entity entity, String instanceTime, CoordinatorAction.Status expectedStatus, Frequency frequency, int totalMinutesToWait) throws URISyntaxException, AuthenticationException, InterruptedException, IOException { String entityName = entity.getName(); EntityType type = entity.getEntityType(); String endTime=getNextInstanceTime(instanceTime, frequency); String params = "?start=" + instanceTime + "&end=" + endTime; int maxTries = 50; int totalSleepTime = totalMinutesToWait * 60; int sleepTime = totalSleepTime / maxTries; LOGGER.info(String.format("Sleep for %d seconds", sleepTime)); for (int i = 0; i < maxTries; i++) { InstancesResult statusResult = cluster.getProcessHelper().getProcessInstanceStatus(entityName, params); if (statusResult.getInstances() != null) { if (statusResult.getInstances()[0].getStatus().name().equals(expectedStatus.toString())) { return; } } LOGGER.info(type + " " + entityName + " still doesn't have expected status"); TimeUtil.sleepSeconds(5); } Assert.fail("expected state of instance was never reached"); }

Target:
public static void waitTillInstanceReachState(ColoHelper cluster, Entity entity, String instanceTime, CoordinatorAction.Status expectedStatus, Frequency frequency, int totalMinutesToWait) throws URISyntaxException, AuthenticationException, InterruptedException, IOException { String entityName = entity.getName(); EntityType type = entity.getEntityType(); String endTime=getNextInstanceTime(instanceTime, frequency); String params = "?start=" + instanceTime + "&end=" + endTime; int totalSleepTime = totalMinutesToWait * 60; int sleepTime = 10; for (int i = 0; i < totalSleepTime; i = i+sleepTime) { InstancesResult statusResult = cluster.getProcessHelper().getProcessInstanceStatus(entityName, params); if (statusResult.getInstances() != null) { if (statusResult.getInstances()[0].getStatus().name() == expectedStatus.name()) { return; } } LOGGER.info(type + " " + entityName + " still doesn't have expected status"); TimeUtil.sleepSeconds(sleepTime); } Assert.fail("expected state of instance was never reached"); }
Source:
public boolean processMessage(Message message) { switch (message.what) { case CMD_RECEIVE_CHILD_REQUEST: handleRequestIkeMessage( (IkeMessage) message.obj, message.arg1 , null ); return HANDLED; case CMD_SEND_CHILD_MESSAGE: throw new UnsupportedOperationException("Cannot handle it"); case CMD_CHILD_PROCEDURE_FINISH: ChildSessionSmCallback childCb = (ChildSessionSmCallback) message.obj; if (mChildInLocalProcedure != null && mChildInLocalProcedure.isMyCallback(childCb)) { mChildInLocalProcedure = null; } if (mChildInRemoteProcedure != null && mChildInRemoteProcedure.isMyCallback(childCb)) { mChildInRemoteProcedure = null; } if (mChildInLocalProcedure == null && mChildInRemoteProcedure == null) { transitionTo(mIdle); } return HANDLED; case CMD_HANDLE_FIRST_CHILD_NEGOTIATION: FirstChildNegotiationData childData = (FirstChildNegotiationData) message.obj; mChildInLocalProcedure = buildChildSession(childData.childSessionOptions); mChildInLocalProcedure.handleFirstChildExchange( childData.reqPayloads, childData.respPayloads); return HANDLED; case CMD_LOCAL_REQUEST_CREATE_CHILD: throw new UnsupportedOperationException("Cannot handle it"); default: return NOT_HANDLED; } }

Target:
public boolean processMessage(Message message) { switch (message.what) { case CMD_RECEIVE_CHILD_REQUEST: handleRequestIkeMessage( (IkeMessage) message.obj, message.arg1 , null ); return HANDLED; case CMD_SEND_CHILD_MESSAGE: throw new UnsupportedOperationException("Cannot handle it"); case CMD_CHILD_PROCEDURE_FINISH: ChildSessionStateMachine childSession = (ChildSessionStateMachine) message.obj; if (mChildInLocalProcedure == childSession) { mChildInLocalProcedure = null; } if (mChildInRemoteProcedure == childSession) { mChildInRemoteProcedure = null; } if (mChildInLocalProcedure == null && mChildInRemoteProcedure == null) { transitionTo(mIdle); } return HANDLED; case CMD_HANDLE_FIRST_CHILD_NEGOTIATION: FirstChildNegotiationData childData = (FirstChildNegotiationData) message.obj; mChildInLocalProcedure = buildChildSession(childData.childSessionOptions); mChildInLocalProcedure.handleFirstChildExchange( childData.reqPayloads, childData.respPayloads); return HANDLED; case CMD_LOCAL_REQUEST_CREATE_CHILD: throw new UnsupportedOperationException("Cannot handle it"); default: return NOT_HANDLED; } }
Source:
protected void doExecute() throws Exception { if (skip) { return; } runMojo("org.apache.maven.plugins", "maven-compiler-plugin", "compile"); runMojo("org.apache.maven.plugins", "maven-resources-plugin", "resources"); if(!looseApplication) { runMojo("org.apache.maven.plugins", "maven-war-plugin", "war"); } runLibertyMojoCreate(); runLibertyMojoInstallFeature(null); runLibertyMojoDeploy(); ServerTask serverTask = initializeJava(); copyConfigFiles(); serverTask.setUseEmbeddedServer(embedded); serverTask.setClean(clean); serverTask.setOperation("run"); serverTask.execute(); }

Target:
protected void doExecute() throws Exception { if (skip) { return; } runMojo("org.apache.maven.plugins", "maven-compiler-plugin", "compile"); runMojo("org.apache.maven.plugins", "maven-resources-plugin", "resources"); if(!looseApplication) { runMojo("org.apache.maven.plugins", "maven-war-plugin", "war"); } runLibertyMojoCreate(); runLibertyMojoInstallFeature(null); runLibertyMojoDeploy(false); ServerTask serverTask = initializeJava(); copyConfigFiles(); serverTask.setUseEmbeddedServer(embedded); serverTask.setClean(clean); serverTask.setOperation("run"); serverTask.execute(); }
Source:
public void test_MergingUpdater_updated() throws IOException, RDFParseException, RDFHandlerException { final AbstractTripleStore store = getStore(); try { final String originalResource = "data-original.ttl"; final MergingUpdater original = doMergingUpdate(store, originalResource); long originalStatementsCount = original.getInserted(); final String updatedResource = "data-updated.ttl"; final MergingUpdater reapplied = doMergingUpdate(store, updatedResource); assertEquals(originalStatementsCount - 17, reapplied.getCollectedToDelete()); assertEquals(originalStatementsCount, reapplied.getCollectedToInsert()); assertEquals(originalStatementsCount - 21, reapplied.getSkippedInserts()); assertEquals(originalStatementsCount - 21, reapplied.getSkippedRemovals()); assertEquals(4, reapplied.getRemoved()); assertEquals(4, reapplied.getInserted()); assertEquals(4, reapplied.getInsertModified()); assertEquals(originalStatementsCount - 4, reapplied.getInsertsSaved()); assertEquals(0L, reapplied.getRefsAndValuesRemoved()); } finally { store.__tearDownUnitTest(); } }

Target:
public void test_MergingUpdater_updated() throws IOException, RDFParseException, RDFHandlerException { final AbstractTripleStore store = getStore(); try { final String originalResource = "data-original.ttl"; final MergingUpdaterResult original = doMergingUpdate(store, originalResource); long originalStatementsCount = original.inserted; final String updatedResource = "data-updated.ttl"; final MergingUpdaterResult reapplied = doMergingUpdate(store, updatedResource); assertEquals(originalStatementsCount - 17, reapplied.collectedToDelete); assertEquals(originalStatementsCount, reapplied.collectedToInsert); assertEquals(originalStatementsCount - 21, reapplied.skippedInserts); assertEquals(originalStatementsCount - 21, reapplied.skippedRemovals); assertEquals(4, reapplied.removed); assertEquals(4, reapplied.inserted); assertEquals(4, reapplied.insertModified); assertEquals(originalStatementsCount - 4, reapplied.insertsSaved); assertEquals(0L, reapplied.refsAndValuesRemoved); } finally { store.__tearDownUnitTest(); } }
Source:
public boolean hasLabel( int label ) { if ( hasChanges() ) { TransactionState txState = read.txState(); if ( txState.nodeStateLabelDiffSets( getId() ).getAdded().contains( label ) ) { return true; } } long[] longs = NodeLabelsField.get( this, labelCursor() ); for ( long labelToken : longs ) { if ( labelToken == label ) { return true; } } return false; }

Target:
public boolean hasLabel( int label ) { if ( hasChanges() ) { TransactionState txState = read.txState(); ReadableDiffSets<Integer> diffSets = txState.nodeStateLabelDiffSets( getId() ); if ( diffSets.getAdded().contains( label ) ) { return true; } if ( diffSets.getRemoved().contains( label ) ) { return false; } } long[] longs = NodeLabelsField.get( this, labelCursor() ); for ( long labelToken : longs ) { if ( labelToken == label ) { assert (int) labelToken == labelToken : "value too big to be represented as and int"; return true; } } return false; }
Source:
public StorageTraversal resolveLocalModel(IResource start, IProgressMonitor monitor) throws InterruptedException { if (!(start instanceof IFile)) { return new StorageTraversal(new LinkedHashSet<IStorage>()); } ThreadSafeProgressMonitor subMonitor = new ThreadSafeProgressMonitor(SubMonitor.convert(monitor, 100)); createThreadPools(); lock.lockInterruptibly(); try { while (!currentlyResolving.isEmpty()) { notResolving.await(); } resolvedResources = new LinkedHashSet<URI>(); diagnostic = new BasicDiagnostic(EMFCompareIDEUIPlugin.PLUGIN_ID, 0, null, new Object[0]); if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final SynchronizedResourceSet resourceSet = new SynchronizedResourceSet(); updateDependencies(resourceSet, (IFile)start, subMonitor); updateChangedResources(resourceSet, subMonitor); } while (!currentlyResolving.isEmpty()) { resolutionEnd.await(); } final Set<IStorage> traversalSet = resolveTraversal((IFile)start, Collections.<URI> emptySet()); StorageTraversal traversal = new StorageTraversal(traversalSet, diagnostic); return traversal; } finally { diagnostic = null; resolvedResources = null; notResolving.signal(); lock.unlock(); shutdownThreadPools(); subMonitor.setWorkRemaining(0); } }

Target:
public StorageTraversal resolveLocalModel(IResource start, IProgressMonitor monitor) throws InterruptedException { if (!(start instanceof IFile)) { return new StorageTraversal(new LinkedHashSet<IStorage>()); } ThreadSafeProgressMonitor subMonitor = null; lock.lockInterruptibly(); try { subMonitor = new ThreadSafeProgressMonitor(SubMonitor.convert(monitor, 100)); createThreadPools(); while (!currentlyResolving.isEmpty()) { notResolving.await(); } resolvedResources = new LinkedHashSet<URI>(); diagnostic = new BasicDiagnostic(EMFCompareIDEUIPlugin.PLUGIN_ID, 0, null, new Object[0]); if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final SynchronizedResourceSet resourceSet = new SynchronizedResourceSet(); updateDependencies(resourceSet, (IFile)start, subMonitor); updateChangedResources(resourceSet, subMonitor); } while (!currentlyResolving.isEmpty()) { resolutionEnd.await(); } final Set<IStorage> traversalSet = resolveTraversal((IFile)start, Collections.<URI> emptySet()); StorageTraversal traversal = new StorageTraversal(traversalSet, diagnostic); return traversal; } finally { diagnostic = null; resolvedResources = null; notResolving.signal(); lock.unlock(); shutdownThreadPools(); if (subMonitor != null) { subMonitor.setWorkRemaining(0); } } }