auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void checkMissingQueues() { long now = System.currentTimeMillis(); if (now - this.retryDeclarationInterval > this.lastRetryDeclaration) { synchronized(this.missingQueues) { Iterator<String> iterator = this.missingQueues.iterator(); while (iterator.hasNext()) { boolean available = true; String queue = iterator.next(); Channel channel = null; try { channel = this.connectionFactory.createConnection().createChannel(false); channel.queueDeclarePassive(queue); if (logger.isDebugEnabled()) { logger.debug("Queue '" + queue + "' is now available"); } } catch (IOException e) { available = false; if (logger.isDebugEnabled()) { logger.debug("Queue '" + queue + "' is still not available"); } } finally { if (channel != null) { try { channel.close(); } catch (IOException e) } } if (available) { try { this.consumeFromQueue(queue); iterator.remove(); } catch (IOException e) { throw RabbitExceptionTranslator.convertRabbitAccessException(e); } } } } } this.lastRetryDeclaration = now; }

Target:
private void checkMissingQueues() { long now = System.currentTimeMillis(); if (now - this.retryDeclarationInterval > this.lastRetryDeclaration) { synchronized(this.missingQueues) { Iterator<String> iterator = this.missingQueues.iterator(); while (iterator.hasNext()) { boolean available = true; String queue = iterator.next(); Channel channel = null; try { channel = this.connectionFactory.createConnection().createChannel(false); channel.queueDeclarePassive(queue); if (logger.isDebugEnabled()) { logger.debug("Queue '" + queue + "' is now available"); } } catch (IOException e) { available = false; if (logger.isDebugEnabled()) { logger.debug("Queue '" + queue + "' is still not available"); } } finally { if (channel != null) { try { channel.close(); } catch (IOException e) } } if (available) { try { this.consumeFromQueue(queue); iterator.remove(); } catch (IOException e) { throw RabbitExceptionTranslator.convertRabbitAccessException(e); } } } } this.lastRetryDeclaration = now; } }
Source:
public void safeRun() { boolean force = forceGarbageCollection.get(); boolean suspendMajor = suspendMajorCompaction.get(); boolean suspendMinor = suspendMinorCompaction.get(); try { runWithFlags(force, suspendMajor, suspendMinor); } catch (Exception e) { LOG.warn("Failed to complete gc {}", e.getMessage(), e); } if (force) { forceGarbageCollection.set(false); } }

Target:
public void safeRun() { boolean force = forceGarbageCollection.get(); boolean suspendMajor = suspendMajorCompaction.get(); boolean suspendMinor = suspendMinorCompaction.get(); runWithFlags(force, suspendMajor, suspendMinor); if (force) { forceGarbageCollection.set(false); } }
Source:
public static TmfAnalysisType getInstance() { if (fInstance == null) { fInstance = new TmfAnalysisType(); } return fInstance; }

Target:
public static TmfAnalysisType getInstance() { synchronized (syncObj) { if (fInstance == null) { fInstance = new TmfAnalysisType(); } } return fInstance; }
Source:
private void publish() { ModelControllerImpl.this.managementModel.set(this); ControllerLogger.MGMT_OP_LOGGER.tracef("published %s", this); published = true; capabilityRegistry.publish(); }

Target:
private void publish() { ModelControllerImpl.this.managementModel.set(this); published = true; ControllerLogger.MGMT_OP_LOGGER.tracef("published %s", this); }
Source:
public Pull create( @NotNull(message = "title can't be NULL") final String title, @NotNull(message = "head can't be NULL") final String head, @NotNull(message = "base can't be NULL") final String base ) throws IOException { if (head.isEmpty()) { throw new IllegalArgumentException("head cannot be empty!"); } if (base.isEmpty()) { throw new IllegalArgumentException("base cannot be empty!"); } final String canonicalHead; if (head.contains(USER_BRANCH_SEP)) { canonicalHead = head; } else { canonicalHead = this.coords.user() + USER_BRANCH_SEP + head; } this.storage.lock(); final int number; try { final Issue issue = this.repo().issues().create(title, "some body"); number = issue.number(); this.storage.apply( new Directives().xpath(this.xpath()).add("pull") .add("number").set(Integer.toString(number)).up() .add("head").set(canonicalHead).up() .add("base").set(base).up() .add("user") .add("login").set(this.self) .up() ); } finally { this.storage.unlock(); } return this.get(number); }

Target:
public Pull create( @NotNull(message = "title can't be NULL") final String title, @NotNull(message = "head can't be NULL") final String head, @NotNull(message = "base can't be NULL") final String base ) throws IOException { if (head.isEmpty()) { throw new IllegalArgumentException("head cannot be empty!"); } if (base.isEmpty()) { throw new IllegalArgumentException("base cannot be empty!"); } final String canonical; if (head.contains(MkPulls.USER_BRANCH_SEP)) { canonical = head; } else { canonical = String.format( "%s%s%s", this.coords.user(), MkPulls.USER_BRANCH_SEP, head ); } this.storage.lock(); final int number; try { final Issue issue = this.repo().issues().create(title, "some body"); number = issue.number(); this.storage.apply( new Directives().xpath(this.xpath()).add("pull") .add("number").set(Integer.toString(number)).up() .add("head").set(canonical).up() .add("base").set(base).up() .add("user") .add("login").set(this.self) .up() ); } finally { this.storage.unlock(); } return this.get(number); }
Source:
public <T extends Closeable> Mono<T> bind(ServerTransport<T> transport) { return Mono.defer( new Supplier<Mono<T>>() { final ServerSetup serverSetup = serverSetup(); @Override public Mono<T> get() { int maxFrameLength = transport.maxFrameLength(); if (maxFrameLength > FRAME_LENGTH_MASK) { return Mono.error( new IllegalArgumentException( "Configured maxFrameLength[" + maxFrameLength + "] exits maxFrameLength limit " + FRAME_LENGTH_MASK)); } if (maxFrameLength > maxPayloadSize) { return Mono.error( new IllegalArgumentException( "Configured maxFrameLength[" + maxFrameLength + "] exits maxPayloadSize[" + maxPayloadSize + "]")); } if (mtu != 0 && mtu > maxFrameLength) { return Mono.error( new IllegalArgumentException( "Configured maximumTransmissionUnit[" + mtu + "] exits configured maxFrameLength[" + maxFrameLength + "]")); } return transport .start(duplexConnection -> acceptor(serverSetup, duplexConnection)) .doOnNext(c -> c.onClose().doFinally(v -> serverSetup.dispose()).subscribe()); } }); }

Target:
public <T extends Closeable> Mono<T> bind(ServerTransport<T> transport) { return Mono.defer( new Supplier<Mono<T>>() { final ServerSetup serverSetup = serverSetup(); @Override public Mono<T> get() { int maxFrameLength = transport.maxFrameLength(); assertValidateSetup(maxFrameLength, maxInboundPayloadSize, mtu); return transport .start(duplexConnection -> acceptor(serverSetup, duplexConnection, maxFrameLength)) .doOnNext(c -> c.onClose().doFinally(v -> serverSetup.dispose()).subscribe()); } }); }
Source:
public Long commit(EDBCommit commit) throws EDBException { if (commit.isCommitted()) { throw new EDBException("EDBCommit is already commitet."); } if (commit.getParentRevisionNumber() != null && !commit.getParentRevisionNumber().equals(getCurrentRevisionNumber())) { throw new EDBException("EDBCommit do not have the correct head revision number."); } runBeginCommitHooks(commit); EDBException exception = runPreCommitHooks(commit); if (exception != null) { return runErrorHooks(commit, exception); } Long timestamp = performCommit(commit); runEDBPostHooks(commit); return timestamp; }

Target:
public Long commit(EDBCommit commit) throws EDBException { if (commit.isCommitted()) { throw new EDBException("EDBCommit is already commitet."); } if (revisionCheckEnabled && commit.getParentRevisionNumber() != null && !commit.getParentRevisionNumber().equals(getCurrentRevisionNumber())) { throw new EDBException("EDBCommit do not have the correct head revision number."); } runBeginCommitHooks(commit); EDBException exception = runPreCommitHooks(commit); if (exception != null) { return runErrorHooks(commit, exception); } Long timestamp = performCommit(commit); runEDBPostHooks(commit); return timestamp; }
Source:
public <K,V> boolean callForMap(Map.Entry<K, V> entry) { if (numberOfArguments==2) { return call(entry.getKey(), entry.getValue()); } else { return call(entry); } }

Target:
public <K,V> boolean callForMap(Map.Entry<K, V> entry) { return new BooleanClosureWrapper(wrapped).callForMap(entry); }
Source:
public void addAllIncludeFilters(Set<String> filters) { for (String filter : filters) { mIncludeFilters.add(filter); } }

Target:
public void addAllIncludeFilters(Set<String> filters) { mIncludeFilters.addAll(filters); }
Source:
public void customizeConnection(HttpURLConnection connection) { connection.setChunkedStreamingMode(5242880); }

Target:
public void customizeConnection(HttpURLConnection connection) { connection.setChunkedStreamingMode(chunkSize); }
Source:
public boolean isTimeZone(final String timeZone) { if (UTC.equals(timeZone)) { return false; } return getLoadedTimeZones().stream().anyMatch(s -> s.getId().equals(timeZone)); }

Target:
public boolean isTimeZone(final String timeZone) { if (TimeValueFormatter.UTC.equals(timeZone)) { return false; } return getLoadedTimeZones().stream().anyMatch(s -> s.getId().equals(timeZone)); }
Source:
public List<Attribute> getRequiredAttributes(PerunSession sess, Service service, Member member, Group group) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("mem") + " from attr_names " + "join service_required_attrs on id=service_required_attrs.attr_id and service_required_attrs.service_id=? " + "left join member_group_attr_values mem on id=mem.attr_id and mem.group_id=? and member_id=? " + "where namespace in (?,?,?)", new AttributeRowMapper(sess, this, member), service.getId(), group.getId(), member.getId(), AttributesManager.NS_MEMBER_GROUP_ATTR_DEF, AttributesManager.NS_MEMBER_GROUP_ATTR_OPT, AttributesManager.NS_MEMBER_GROUP_ATTR_VIRT); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, Service service, Member member, Group group) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("mem_gr") + " from attr_names " + "join service_required_attrs on id=service_required_attrs.attr_id and service_required_attrs.service_id=? " + "left join member_group_attr_values mem_gr on id=mem.attr_id and mem_gr.group_id=? and member_id=? " + "where namespace in (?,?,?)", new AttributeRowMapper(sess, this, member), service.getId(), group.getId(), member.getId(), AttributesManager.NS_MEMBER_GROUP_ATTR_DEF, AttributesManager.NS_MEMBER_GROUP_ATTR_OPT, AttributesManager.NS_MEMBER_GROUP_ATTR_VIRT); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
public LanguageToMapTransformer(final Contentlet con) { if (con.getInode() == null) { throw new DotStateException("Contentlet needs an inode to get fields"); } final List<Map<String, Object>> maps = new DotTransformerBuilder().languageToMapTransformer().content(con).build().toMaps(); if (maps.isEmpty()) { this.mapOfMaps = Collections.emptyMap(); } else { this.mapOfMaps = maps.get(0); } }

Target:
public LanguageToMapTransformer(final Contentlet con) { if (con.getInode() == null) { throw new DotStateException("Contentlet needs an inode to get fields"); } final List<Map<String, Object>> maps = new DotTransformerBuilder().languageToMapTransformer().content(con).build().toMaps(); this.mapOfMaps = maps.stream().findFirst().orElse(emptyMap()); }
Source:
public Entry<String, Resource> export(String type, Project project, Map<String, String> options) throws Exception { project.prepare(); Jar jar; if (EXECUTABLE_JAR.equals(type)) { try (ProjectLauncher launcher = project.getProjectLauncher()) { Configuration configuration = Converter.cnv(Configuration.class, options); if (configuration.keep() || Processor.isTrue(project.getProperty(Constants.RUNKEEP))) launcher.setKeep(true); jar = launcher.executable(); launcher.removeClose(jar); project.getInfo(launcher); } } else if (EXECUTABLE_PACK.equals(type)) { String profile = options.getOrDefault(Constants.PROFILE, project.getProperty(Constants.PROFILE)); jar = project.pack(profile); if (jar == null) return null; } else { project.error("Unknown type %s", type); return null; } String name = jar.getName(); String[] baseext = Strings.extension(name); if (baseext != null && ("bnd".equals(baseext[1]) || "bndrun".equals(baseext[1]))) { name = baseext[0]; } name = name + Constants.DEFAULT_JAR_EXTENSION; return new SimpleEntry<>(name, new JarResource(jar, true)); }

Target:
public Entry<String, Resource> export(String type, Project project, Map<String, String> options) throws Exception { project.prepare(); Jar jar = null; if (EXECUTABLE_JAR.equals(type)) { jar = defaultExporter(project, options); } else if (EXECUTABLE_PACK.equals(type)) { String profile = options.getOrDefault(Constants.PROFILE, project.getProfile()); jar = pack(project, profile); } else { project.error("Unknown type %s", type); } if (jar == null) return null; String name = jar.getName(); String[] baseext = Strings.extension(name); if (baseext != null && ("bnd".equals(baseext[1]) || "bndrun".equals(baseext[1]))) { name = baseext[0]; } name = name + Constants.DEFAULT_JAR_EXTENSION; return new SimpleEntry<>(name, new JarResource(jar, true)); }
Source:
private PrivateEncryptedChannelExampleApp(final String[] args) { switch (args.length) { case 4: cluster = args[3]; case 3: eventName = args[2]; case 2: channelName = args[1]; case 0: apiKey = args[0]; } final HttpAuthorizer authorizer = new HttpAuthorizer( "http://localhost:3030/pusher/auth"); final PusherOptions options = new PusherOptions().setAuthorizer(authorizer).setEncrypted(true); options.setCluster(cluster); Pusher pusher = new Pusher(apiKey, options); pusher.connect(this); channel = pusher.subscribePrivateEncrypted(channelName, this, eventName); for (int i = 0; ; i++) { try { Thread.sleep(5000); pusher.disconnect(); pusher.connect(this); Thread.sleep(5000); pusher.unsubscribe(channelName); if (i % 2 == 0) { channel = pusher.subscribePrivateEncrypted(channelName, this, eventName); } } catch (final InterruptedException e) { e.printStackTrace(); } } }

Target:
private PrivateEncryptedChannelExampleApp(final String[] args) { switch (args.length) { case 4: cluster = args[3]; case 3: eventName = args[2]; case 2: channelName = args[1]; case 1: apiKey = args[0]; } final HttpAuthorizer authorizer = new HttpAuthorizer( "http://localhost:3030/pusher/auth"); final PusherOptions options = new PusherOptions().setAuthorizer(authorizer).setEncrypted(true); options.setCluster(cluster); Pusher pusher = new Pusher(apiKey, options); pusher.connect(this); channel = pusher.subscribePrivateEncrypted(channelName, this, eventName); while (true) { try { Thread.sleep(1000); } catch (final InterruptedException e) { e.printStackTrace(); } } }
Source:
private boolean hasBrandSummary(ProgData progData) { if (Strings.isNullOrEmpty(progData.getSeriesSummary())) { return false; } return true; }

Target:
private boolean hasBrandSummary(ProgData progData) { return !Strings.isNullOrEmpty(progData.getSeriesSummary()); }
Source:
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { noCache(res); try { checkRequiresCapability(); super.service(req, res); } catch (Error err) { handleError(err, req, res); } catch (RuntimeException err) { handleError(err, req, res); } }

Target:
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { noCache(res); try { checkRequiresCapability(); super.service(req, res); } catch (RequireCapabilityException err) { res.setStatus(HttpServletResponse.SC_FORBIDDEN); noCache(res); sendText(req, res, err.getMessage()); } catch (Error err) { handleError(err, req, res); } catch (RuntimeException err) { handleError(err, req, res); } }
Source:
private MultiStatus syncDown(IProgressMonitor monitor) throws CoreException { final RSync rsync = OpenShiftServerUtils.createRSync(getServer(), monitor); final File localDeploymentDirectory = new File(getDeploymentOptions().getDeploymentsRootFolder(true)); final MultiStatus status = new MultiStatus(OpenShiftCoreActivator.PLUGIN_ID, IStatus.OK, NLS.bind(OpenShiftCoreMessages.couldNoSyncPodsToFolder, localDeploymentDirectory.getAbsolutePath()), null); rsync.syncPodsToDirectory(localDeploymentDirectory, status, ServerConsoleModel.getDefault().getConsoleWriter()); return status; }

Target:
private MultiStatus syncDown(IProgressMonitor monitor) throws CoreException { final RSync rsync = OpenShiftServerUtils.createRSync(getServer(), monitor); final File localDeploymentDirectory = new File(getDeploymentOptions().getDeploymentsRootFolder(true)); final MultiStatus status = new MultiStatus(OpenShiftCoreActivator.PLUGIN_ID, IStatus.OK, NLS.bind("Could not sync all pods to folder {0}.", localDeploymentDirectory.getAbsolutePath()), null); rsync.syncPodsToDirectory(localDeploymentDirectory, status, ServerConsoleModel.getDefault().getConsoleWriter()); return status; }
Source:
public void failed(Exception ex) { JOB_EXECUTION_LOG.error("Failed. " + ex.getMessage(), ex); jobExecution.setEndDate(Instant.now()); jobExecution.setStatus(FAILED); jobExecution.setProgressMessage(ex.getLocalizedMessage()); sendEmail( jobExecution.getFailureEmail(), jobExecution.getType() + " job failed.", jobExecution.getLog()); update(); JobExecutionContext.unset(); }

Target:
public void failed(Exception ex) { JOB_EXECUTION_LOG.error("Failed. " + ex.getMessage(), ex); jobExecution.setEndDate(Instant.now()); jobExecution.setStatus(FAILED); jobExecution.setProgressMessage(ex.getMessage()); sendEmail( jobExecution.getFailureEmail(), jobExecution.getType() + " job failed.", jobExecution.getLog()); update(); JobExecutionContext.unset(); }
Source:
public static <T extends Entity> CatalogEntitySummary catalogEntitySummary(BrooklynRestResourceUtils b, CatalogItem<T,EntitySpec<? extends T>> item) { Set<EntityConfigSummary> config = Sets.newLinkedHashSet(); Set<SensorSummary> sensors = Sets.newTreeSet(SummaryComparators.nameComparator()); Set<EffectorSummary> effectors = Sets.newTreeSet(SummaryComparators.nameComparator()); try { @SuppressWarnings({ "unchecked", "rawtypes" }) EntitySpec<?> spec = (EntitySpec<?>) b.getCatalog().createSpec((CatalogItem) item); EntityDynamicType typeMap = BrooklynTypes.getDefinedEntityType(spec.getType()); EntityType type = typeMap.getSnapshot(); for (SpecParameter<?> input: spec.getParameters()) config.add(EntityTransformer.entityConfigSummary(input)); for (Sensor<?> x: type.getSensors()) sensors.add(SensorTransformer.sensorSummaryForCatalog(x)); for (Effector<?> x: type.getEffectors()) effectors.add(EffectorTransformer.effectorSummaryForCatalog(x)); } catch (Exception e) { Exceptions.propagateIfFatal(e); if (item.getCatalogItemType()==CatalogItemType.ENTITY) { log.warn("Unable to create spec for "+item+": "+e, e); } if (log.isTraceEnabled()) { log.trace("Unable to create spec for "+item+": "+e, e); } } return new CatalogEntitySummary(item.getSymbolicName(), item.getVersion(), item.getDisplayName(), item.getJavaType(), item.getPlanYaml(), item.getDescription(), tidyIconLink(b, item, item.getIconUrl()), item.tags().getTags(), config, sensors, effectors, item.isDeprecated(), makeLinks(item)); }

Target:
public static <T extends Entity> CatalogEntitySummary catalogEntitySummary(BrooklynRestResourceUtils b, CatalogItem<T,EntitySpec<? extends T>> item) { Set<EntityConfigSummary> config = Sets.newLinkedHashSet(); Set<SensorSummary> sensors = Sets.newTreeSet(SummaryComparators.nameComparator()); Set<EffectorSummary> effectors = Sets.newTreeSet(SummaryComparators.nameComparator()); EntitySpec<?> spec = null; try { spec = (EntitySpec<?>) b.getCatalog().createSpec((CatalogItem) item); EntityDynamicType typeMap = BrooklynTypes.getDefinedEntityType(spec.getType()); EntityType type = typeMap.getSnapshot(); for (SpecParameter<?> input: spec.getParameters()) config.add(EntityTransformer.entityConfigSummary(input)); for (Sensor<?> x: type.getSensors()) sensors.add(SensorTransformer.sensorSummaryForCatalog(x)); for (Effector<?> x: type.getEffectors()) effectors.add(EffectorTransformer.effectorSummaryForCatalog(x)); } catch (Exception e) { Exceptions.propagateIfFatal(e); if (item.getCatalogItemType()==CatalogItemType.ENTITY) { log.warn("Unable to create spec for "+item+": "+e, e); } if (log.isTraceEnabled()) { log.trace("Unable to create spec for "+item+": "+e, e); } } return new CatalogEntitySummary(item.getSymbolicName(), item.getVersion(), item.getDisplayName(), item.getJavaType(), item.getPlanYaml(), item.getDescription(), tidyIconLink(b, item, item.getIconUrl()), makeTags(spec, item), config, sensors, effectors, item.isDeprecated(), makeLinks(item)); }
Source:
private static Value readArrayFromBuffer( ByteBuffer buffer ) { if ( buffer.limit() <= 0 ) { throw new IllegalStateException( "Given buffer is empty" ); } byte typeId = buffer.get(); buffer.order( ByteOrder.BIG_ENDIAN ); try { if ( typeId == PropertyType.STRING.intValue() ) { int arrayLength = buffer.getInt(); String[] result = new String[arrayLength]; for ( int i = 0; i < arrayLength; i++ ) { int byteLength = buffer.getInt(); result[i] = UTF8.decode( buffer.array(), buffer.position(), byteLength ); buffer.position( buffer.position() + byteLength ); } return Values.stringArray( result ); } else { ShortArray type = ShortArray.typeOf( typeId ); int bitsUsedInLastByte = buffer.get(); int requiredBits = buffer.get(); if ( requiredBits == 0 ) { return type.createEmptyArray(); } if ( type == ShortArray.BYTE && requiredBits == Byte.SIZE ) { byte[] byteArray = new byte[buffer.limit() - buffer.position()]; buffer.get( byteArray ); return Values.byteArray( byteArray ); } else { Bits bits = Bits.bitsFromBytes( buffer.array(), buffer.position() ); int length = ((buffer.limit() - buffer.position()) * 8 - (8 - bitsUsedInLastByte)) / requiredBits; return type.createArray( length, bits, requiredBits ); } } } finally { buffer.order( ByteOrder.LITTLE_ENDIAN ); } }

Target:
private static ArrayValue readArrayFromBuffer( ByteBuffer buffer ) { if ( buffer.limit() <= 0 ) { throw new IllegalStateException( "Given buffer is empty" ); } byte typeId = buffer.get(); buffer.order( ByteOrder.BIG_ENDIAN ); try { if ( typeId == PropertyType.STRING.intValue() ) { int arrayLength = buffer.getInt(); String[] result = new String[arrayLength]; for ( int i = 0; i < arrayLength; i++ ) { int byteLength = buffer.getInt(); result[i] = UTF8.decode( buffer.array(), buffer.position(), byteLength ); buffer.position( buffer.position() + byteLength ); } return Values.stringArray( result ); } else { ShortArray type = ShortArray.typeOf( typeId ); int bitsUsedInLastByte = buffer.get(); int requiredBits = buffer.get(); if ( requiredBits == 0 ) { return type.createEmptyArray(); } if ( type == ShortArray.BYTE && requiredBits == Byte.SIZE ) { byte[] byteArray = new byte[buffer.limit() - buffer.position()]; buffer.get( byteArray ); return Values.byteArray( byteArray ); } else { Bits bits = Bits.bitsFromBytes( buffer.array(), buffer.position() ); int length = ((buffer.limit() - buffer.position()) * 8 - (8 - bitsUsedInLastByte)) / requiredBits; return type.createArray( length, bits, requiredBits ); } } } finally { buffer.order( ByteOrder.LITTLE_ENDIAN ); } }
Source:
public void completeImportWizard() { SimpleCertificateResponseMessageType response = service.completeImportWizard(); if (null != response) { if (response.isStatus()) { HelperUtil.addMessageInfo(null, response.getMessage()); } else { HelperUtil.addMessageError(null, response.getMessage()); } } else { HelperUtil.addMessageError(null, "Error occured while calling completeImportWizard."); } }

Target:
public void completeImportWizard() { SimpleCertificateResponseMessageType response = service.completeImportWizard(); if (null != response) { if (response.isStatus()) { HelperUtil.addMessageInfo(null, response.getMessage()); } else { HelperUtil.addMessageError(null, response.getMessage()); } } else { HelperUtil.addMessageError(null, "Error occured while calling webservice."); } }
Source:
public void initialize(URI uri, Configuration conf) throws IOException { super.initialize(uri, conf); setConf(conf); defaultBlockSize = getDefaultBlockSize(new Path(".")); }

Target:
public void initialize(URI uri, Configuration conf) throws IOException { super.initialize(uri, conf); setConf(conf); defaultBlockSize = getDefaultBlockSize(new Path(uri)); }
Source:
public static Submission.SrlExperiment mongoGetExperiment(final DB dbs, final String userId, final String problemId, final SubmissionManagerInterface submissionManager) throws DatabaseAccessException, AuthenticationException { final Data.ItemResult.Builder send = Data.ItemResult.newBuilder(); send.setQuery(ItemQuery.EXPERIMENT); final DBObject cursor = dbs.getCollection(DatabaseStringConstants.EXPERIMENT_COLLECTION).findOne(new ObjectId(problemId)); if (cursor == null) { throw new DatabaseAccessException("The student has not submitted anything for this problem"); } if (!cursor.containsField(userId) || Strings.isNullOrEmpty((String) cursor.get(userId))) { throw new DatabaseAccessException("The student has not submitted anything for this problem"); } final String sketchId = cursor.get(userId).toString(); LOG.info("SketchId: ", sketchId); final List<Submission.SrlExperiment> experimentList = submissionManager.getSubmission(userId, null, problemId, sketchId); if (experimentList.isEmpty()) { throw new DatabaseAccessException("No experiments were found"); } return experimentList.get(0); }

Target:
public static Submission.SrlExperiment mongoGetExperiment(final DB dbs, final String userId, final String problemId, final SubmissionManagerInterface submissionManager) throws DatabaseAccessException, AuthenticationException { final Data.ItemResult.Builder send = Data.ItemResult.newBuilder(); send.setQuery(ItemQuery.EXPERIMENT); final DBObject cursor = dbs.getCollection(DatabaseStringConstants.EXPERIMENT_COLLECTION).findOne(new ObjectId(problemId)); if (cursor == null || !cursor.containsField(userId) || Strings.isNullOrEmpty((String) cursor.get(userId))) { throw new DatabaseAccessException("The student has not submitted anything for this problem"); } final String sketchId = cursor.get(userId).toString(); LOG.info("SketchId: ", sketchId); final List<Submission.SrlExperiment> experimentList = submissionManager.getSubmission(userId, null, problemId, sketchId); if (experimentList.isEmpty()) { throw new DatabaseAccessException("No experiments were found"); } return experimentList.get(0); }
Source:
public String valueAsString() { if(this == LOCKED) { return "locked"; } return "Unlocked"; }

Target:
public String valueAsString() { if(this == LOCKED) { return "locked"; } return "unlocked"; }
Source:
public Boolean isAnonymous() { return anonymous != null && anonymous; }

Target:
public boolean isAnonymous() { return anonymous != null && anonymous; }
Source:
public boolean loadSegment(final DataSegment segment) throws SegmentLoadingException { final Segment adapter; try { adapter = segmentLoader.getSegment(segment); } catch (SegmentLoadingException e) { try { segmentLoader.cleanup(segment); } catch (SegmentLoadingException e1) { } throw e; } if (adapter == null) { throw new SegmentLoadingException("Null adapter from loadSpec[%s]", segment.getLoadSpec()); } synchronized (lock) { final String dataSource = segment.getDataSource(); final VersionedIntervalTimeline<String, ReferenceCountingSegment> loadedIntervals = dataSources.computeIfAbsent( dataSource, k -> new VersionedIntervalTimeline<>(Ordering.natural()) ); final PartitionHolder<ReferenceCountingSegment> entry = loadedIntervals.findEntry( segment.getInterval(), segment.getVersion() ); if ((entry != null) && (entry.getChunk(segment.getShardSpec().getPartitionNum()) != null)) { log.warn("Told to load a adapter for a segment[%s] that already exists", segment.getIdentifier()); return false; } loadedIntervals.add( segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(new ReferenceCountingSegment(adapter)) ); synchronized (dataSourceSizes) { dataSourceSizes.add(dataSource, segment.getSize()); } synchronized (dataSourceCounts) { dataSourceCounts.add(dataSource, 1L); } return true; } }

Target:
public boolean loadSegment(final DataSegment segment) throws SegmentLoadingException { final Segment adapter = getAdapter(segment); synchronized (lock) { final String dataSource = segment.getDataSource(); final VersionedIntervalTimeline<String, ReferenceCountingSegment> loadedIntervals = dataSources.computeIfAbsent( dataSource, k -> new VersionedIntervalTimeline<>(Ordering.natural()) ); final PartitionHolder<ReferenceCountingSegment> entry = loadedIntervals.findEntry( segment.getInterval(), segment.getVersion() ); if ((entry != null) && (entry.getChunk(segment.getShardSpec().getPartitionNum()) != null)) { log.warn("Told to load a adapter for a segment[%s] that already exists", segment.getIdentifier()); return false; } loadedIntervals.add( segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(new ReferenceCountingSegment(adapter)) ); synchronized (dataSourceSizes) { dataSourceSizes.add(dataSource, segment.getSize()); } synchronized (dataSourceCounts) { dataSourceCounts.add(dataSource, 1L); } return true; } }
Source:
public IZenSymbol resolve(IEnvironmentGlobal environment, List<Token> tokens) { if (tokens.size() == 1 && tokens.get(0).getValue().equals("*")) { return symbolAny; } if (tokens.size() > 2) { if (tokens.get(0).getValue().equals("material") && tokens.get(1).getValue().equals(":")) { return find(environment, tokens, 2, tokens.size()); } } return null; }

Target:
public IZenSymbol resolve(IEnvironmentGlobal environment, List<Token> tokens) { if (tokens.size() > 2) { if (tokens.get(0).getValue().equals("material") && tokens.get(1).getValue().equals(":")) { return find(environment, tokens, 2, tokens.size()); } } return null; }
Source:
public IBinding getPromiscuousBinding() { return promiscuousBinding; }

Target:
public final IBinding getPromiscuousBinding() { return promiscuousBinding; }
Source:
public void handleGetConfigurationDeviceResponse(final DeviceResponse deviceResponse, final ResponseMessageSender responseMessageSender, final String domain, final String domainVersion, final String messageType, final int retryCount) { ResponseMessageResultType result = ResponseMessageResultType.OK; OsgpException osgpException = null; Configuration configuration = null; try { final GetConfigurationDeviceResponse response = (GetConfigurationDeviceResponse) deviceResponse; this.deviceResponseService.handleDeviceMessageStatus(response.getStatus()); configuration = response.getConfiguration(); } catch (final Exception e) { LOGGER.error("Device Response Exception", e); result = ResponseMessageResultType.NOT_OK; osgpException = new TechnicalException(ComponentType.UNKNOWN, "Unexpected exception while retrieving response message", e); } final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage(domain, domainVersion, messageType, deviceResponse.getCorrelationUid(), deviceResponse.getOrganisationIdentification(), deviceResponse.getDeviceIdentification(), result, osgpException, configuration, retryCount); responseMessageSender.send(responseMessage); }

Target:
private void handleGetConfigurationDeviceResponse(final DeviceResponse deviceResponse, final ResponseMessageSender responseMessageSender, final String domain, final String domainVersion, final String messageType, final int retryCount) { ResponseMessageResultType result = ResponseMessageResultType.OK; OsgpException osgpException = null; Configuration configuration = null; try { final GetConfigurationDeviceResponse response = (GetConfigurationDeviceResponse) deviceResponse; this.deviceResponseService.handleDeviceMessageStatus(response.getStatus()); configuration = response.getConfiguration(); } catch (final Exception e) { LOGGER.error("Device Response Exception", e); result = ResponseMessageResultType.NOT_OK; osgpException = new TechnicalException(ComponentType.UNKNOWN, "Unexpected exception while retrieving response message", e); } final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage(domain, domainVersion, messageType, deviceResponse.getCorrelationUid(), deviceResponse.getOrganisationIdentification(), deviceResponse.getDeviceIdentification(), result, osgpException, configuration, retryCount); responseMessageSender.send(responseMessage); }
Source:
private KeyPairCredential createKeyPairCredential(String algorithm, int size) throws NoSuchAlgorithmException, NoSuchProviderException { KeyPairGenerator keyPairGenerator; switch (algorithm) { case Pem.RSA_ALGORITHM: { size = (size < 512 | size > 2048) ? 2048 : size; break; } case Pem.DSA_ALGORITHM: { size = (size < 1024 | size > 2048) ? 1024 : size; break; } case Pem.EC_ALGORITHM: { size = (size < 112 | size > 571) ? 571 : size; break; } case Pem.EDDSA_ALGORITHM: { size = 256; break; } default: { algorithm = Pem.RSA_ALGORITHM; size = 2048; break; } } try { keyPairGenerator = (algorithm == Pem.EDDSA_ALGORITHM) ? KeyPairGenerator.getInstance(algorithm, EdDSASecurityProvider.PROVIDER_NAME) : KeyPairGenerator.getInstance(algorithm); } catch(NoSuchAlgorithmException e) { throw ElytronToolMessages.msg.unknownKeyPairAlgorithm(algorithm); } catch(NoSuchProviderException e) { throw ElytronToolMessages.msg.unknownKeyFactoryProvider(EdDSASecurityProvider.PROVIDER_NAME); } keyPairGenerator.initialize(size, new SecureRandom()); KeyPairCredential keyPairCredential = new KeyPairCredential(keyPairGenerator.generateKeyPair()); return keyPairCredential; }

Target:
private KeyPairCredential createKeyPairCredential(String algorithm, int size) throws NoSuchAlgorithmException { KeyPairGenerator keyPairGenerator; switch (algorithm) { case RSA_ALGORITHM: { size = (512 <= size && size <= 16384) ? size : 2048; break; } case DSA_ALGORITHM: { size = (512 <= size && size <= 1024 && (size % 64) == 0) || size == 2048 || size == 3072 ? size : 2048; break; } case EC_ALGORITHM: { size = (112 <= size && size <= 571) ? size : 256; break; } default: { algorithm = RSA_ALGORITHM; size = 2048; break; } } try { keyPairGenerator = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw ElytronToolMessages.msg.unknownKeyPairAlgorithm(algorithm); } try { keyPairGenerator.initialize(size, new SecureRandom()); } catch (InvalidParameterException e) { throw ElytronToolMessages.msg.invalidKeySize(e.getMessage()); } KeyPairCredential keyPairCredential = new KeyPairCredential(keyPairGenerator.generateKeyPair()); return keyPairCredential; }
Source:
public NodeMetadata apply(VagrantNode node) { Machine input = node.getMachine(); NodeMetadataBuilder nodeMetadataBuilder = new NodeMetadataBuilder() .ids(input.getId()) .name(input.getName()) .group(input.getPath().getName()) .location(Iterables.getOnlyElement(locations.get())) .hostname(input.getName()) .status(toPortableNodeStatus.apply(input.getStatus())) .loginPort(22) .privateAddresses(node.getNetworks()) .publicAddresses(ImmutableList.<String>of()) .hostname(node.getHostname()); Credentials credentials = credentialStore.get("node#" + input.getId()); if (credentials != null) { nodeMetadataBuilder.credentials(LoginCredentials.fromCredentials(credentials)); } else if (node.getSshConfig() != null) { SshConfig sshConfig = node.getSshConfig(); nodeMetadataBuilder.credentials(LoginCredentials.builder().user(sshConfig.getUser()).privateKey(sshConfig.getIdentityFile()).build()); } return nodeMetadataBuilder.build(); }

Target:
public NodeMetadata apply(VagrantNode node) { NodeMetadataBuilder nodeMetadataBuilder = new NodeMetadataBuilder() .ids(node.id()) .name(node.name()) .group(node.group()) .imageId(node.image().getId()) .location(location) .hardware(getHardware(node)) .operatingSystem(node.image().getOperatingSystem()) .hostname(node.name()) .status(node.machineState()) .loginPort(getLoginPort(node.image())) .privateAddresses(node.networks()) .publicAddresses(ImmutableList.<String> of()) .hostname(node.hostname()); return nodeMetadataBuilder.build(); }
Source:
public PartitionUpdate( String name, boolean isNew, Path writePath, Path targetPath, List<String> fileNames, long rowCount, long inMemoryDataSizeInBytes, long onDiskDataSizeInBytes) { this.name = requireNonNull(name, "name is null"); this.isNew = isNew; this.writePath = requireNonNull(writePath, "writePath is null"); this.targetPath = requireNonNull(targetPath, "targetPath is null"); this.fileNames = ImmutableList.copyOf(requireNonNull(fileNames, "fileNames is null")); checkArgument(rowCount >= 0, "rowCount is expected to be greater or equal than zero: %d", rowCount); this.rowCount = rowCount; checkArgument(inMemoryDataSizeInBytes >= 0, "inMemoryDataSizeInBytes is expected to be greater or equal than zero: %d", inMemoryDataSizeInBytes); this.inMemoryDataSizeInBytes = inMemoryDataSizeInBytes; checkArgument(onDiskDataSizeInBytes >= 0, "onDiskDataSizeInBytes is expected to be greater or equal than zero: %d", onDiskDataSizeInBytes); this.onDiskDataSizeInBytes = onDiskDataSizeInBytes; }

Target:
public PartitionUpdate( String name, boolean isNew, Path writePath, Path targetPath, List<String> fileNames, long rowCount, long inMemoryDataSizeInBytes, long onDiskDataSizeInBytes) { this.name = requireNonNull(name, "name is null"); this.isNew = isNew; this.writePath = requireNonNull(writePath, "writePath is null"); this.targetPath = requireNonNull(targetPath, "targetPath is null"); this.fileNames = ImmutableList.copyOf(requireNonNull(fileNames, "fileNames is null")); checkArgument(rowCount >= 0, "rowCount is negative: %d", rowCount); this.rowCount = rowCount; checkArgument(inMemoryDataSizeInBytes >= 0, "inMemoryDataSizeInBytes is negative: %d", inMemoryDataSizeInBytes); this.inMemoryDataSizeInBytes = inMemoryDataSizeInBytes; checkArgument(onDiskDataSizeInBytes >= 0, "onDiskDataSizeInBytes is negative: %d", onDiskDataSizeInBytes); this.onDiskDataSizeInBytes = onDiskDataSizeInBytes; }
Source:
public static void setup() throws IOException { }

Target:
public static void setup() throws IOException { SESSION = new ScriptSessionProvider().getInstance(); }
Source:
public void onConnectionFailed(@NonNull ConnectionResult result) { if (mSignInProgress != STATE_IN_PROGRESS) { if (!GoogleApiAvailability.getInstance().isUserResolvableError(result.getErrorCode())) { if (!PrefUtils.shouldShowFatalPlayServiceMessage(this)) { return; } PrefUtils.setFatalPlayServiceMessageShown(this); } mSignInIntent = result.getResolution(); if (mSignInIntent != null) { resolveSignInError(); } else { if (PrefUtils.shouldShowFatalPlayServiceMessage(this)) { Timber.e("Google Play Service did not resolve error"); GoogleApiAvailability.getInstance().showErrorNotification(this, result.getErrorCode()); PrefUtils.setFatalPlayServiceMessageShown(this); } } } }

Target:
public void onConnectionFailed(@NonNull ConnectionResult result) { if (mSignInProgress != STATE_IN_PROGRESS) { if (isFatalPlayServiceError(result.getErrorCode())) { if (PrefUtils.shouldShowFatalPlayServiceMessage(this)) { showFatalPlayServiceMessage(result); } return; } mSignInIntent = result.getResolution(); if (mSignInIntent != null) { resolveSignInError(); } else { if (PrefUtils.shouldShowFatalPlayServiceMessage(this)) { showFatalPlayServiceMessage(result); } } } }
Source:
public TestFrameworkRegistry(Set<TestRunner> runners) { System.out.println("inititilaized TestFrameworkRegistry " + runners.size() + " fefef " + runners.toString()); runners.forEach(this::register); }

Target:
public TestFrameworkRegistry(Set<TestRunner> runners) { runners.forEach(this::register); }
Source:
public static boolean fileExistsInSources(IFile original, String fileName) { if (fileName.trim().equals("")) { return false; } IContainer container = original.getParent(); IResource resourceToOpen = container.findMember(fileName); IFile file = null; if (resourceToOpen == null) { IResource sourcesFolder = container.getProject().findMember( "SOURCES"); file = container.getFile(new Path(fileName)); if (sourcesFolder != null) { file = ((IFolder) sourcesFolder).getFile(new Path(fileName)); } if (!file.exists()) { return false; } } return true; }

Target:
public static boolean fileExistsInSources(IFile original, String fileName) { if (fileName.trim().isEmpty()) { return false; } IContainer container = original.getParent(); IResource resourceToOpen = container.findMember(fileName); IFile file = null; if (resourceToOpen == null) { IResource sourcesFolder = container.getProject().findMember( "SOURCES"); file = container.getFile(new Path(fileName)); if (sourcesFolder != null) { file = ((IFolder) sourcesFolder).getFile(new Path(fileName)); } if (!file.exists()) { return false; } } return true; }
Source:
private Request startBlockwiseUpload(final Exchange exchange, final Request request) { final KeyUri key = getKey(exchange, request); Block1BlockwiseStatus status = getOutboundBlock1Status(key, exchange, request); final Request block = status.getNextRequestBlock(); block.addMessageObserver(new MessageObserverAdapter() { private void copyToken() { request.setToken(block.getToken()); } @Override public void onAcknowledgement() { copyToken(); } @Override public void onReject() { copyToken(); clearBlock1Status(key); } @Override public void onTimeout() { copyToken(); clearBlock1Status(key); } @Override public void onCancel() { clearBlock1Status(key); } }); return block; }

Target:
private Request startBlockwiseUpload(final Exchange exchange, final Request request) { final KeyUri key = getKey(exchange, request); synchronized (block1Transfers) { Block1BlockwiseStatus status = getBlock1Status(key); if (status != null) { status.cancelRequest(); clearBlock1Status(key); } status = getOutboundBlock1Status(key, exchange, request); final Request block = status.getNextRequestBlock(); block.addMessageObserver(new MessageObserverAdapter() { private void copyToken() { request.setToken(block.getToken()); } @Override public void onAcknowledgement() { copyToken(); } @Override public void onReject() { copyToken(); clearBlock1Status(key); } @Override public void onTimeout() { copyToken(); clearBlock1Status(key); } @Override public void onCancel() { clearBlock1Status(key); } }); return block; } }
Source:
protected EEFWidgetStyle getWidgetStyle() { EEFWidgetStyle style = this.description.getStyle(); if (style == null) { EEFTextStyle textStyle = EefFactory.eINSTANCE.createEEFTextStyle(); super.setDefaultInheritedLabelStyle(textStyle, composite); setDefaultInheritedStyle(textStyle); style = textStyle; } return style; }

Target:
protected EEFWidgetStyle getWidgetStyle() { return this.description.getStyle(); }
Source:
protected void publishIfNeeded(List<TimeAlert> alerts) { TimeAlert triggeredAlert = null; for (TimeAlert alert : alerts) { boolean alertTriggerable = isTrigger(alert); if (isPolicyAttached(alert) && alertTriggerable && null == triggeredAlert) { publish(alert); triggeredAlert = alert; } else if (alertTriggerable && triggeredAlert != null) { historyService.createEntry(ScalingStatus.TRIGGER_FAILED, String.format( "Autoscaling Schedule '%s' overlaps with '%s'.", alert.getName(), triggeredAlert.getName()), alert.getCluster()); } } }

Target:
protected void publishIfNeeded(List<TimeAlert> alerts) { for (TimeAlert alert : alerts) { if (isPolicyAttached(alert) && isTrigger(alert)) { publish(alert); break; } } }
Source:
private void validate(JsonNode contentNode) throws DevfileFormatException { try { List<Problem> validationErrors = new ArrayList<>(); ProblemHandler handler = ProblemHandler.collectingTo(validationErrors); if (!contentNode.hasNonNull("apiVersion")) { throw new DevfileFormatException( "Devfile schema validation failed. Error: The object must have a property whose name is \"apiVersion\"."); } String apiVersion = contentNode.get("apiVersion").asText(); if (!schemasByVersion.containsKey(apiVersion)) { throw new DevfileFormatException( String.format("version '%s' of the devfile is not supported", apiVersion)); } JsonSchema schema = schemasByVersion.get(apiVersion); try (JsonReader reader = service.createReader( new StringReader(jsonMapper.writeValueAsString(contentNode)), schema, handler)) { reader.read(); } if (!validationErrors.isEmpty()) { String error = errorMessageComposer.extractMessages(validationErrors, new StringBuilder()); throw new DevfileFormatException( format("Devfile schema validation failed. Error: %s", error)); } } catch (IOException e) { throw new DevfileFormatException("Unable to validate Devfile. Error: " + e.getMessage()); } }

Target:
private void validate(JsonNode contentNode) throws DevfileFormatException { try { List<Problem> validationErrors = new ArrayList<>(); ProblemHandler handler = ProblemHandler.collectingTo(validationErrors); if (!contentNode.hasNonNull("apiVersion")) { throw new DevfileFormatException( "Devfile schema validation failed. Error: The object must have a property whose name is \"apiVersion\"."); } String apiVersion = contentNode.get("apiVersion").asText(); if (!schemasByVersion.containsKey(apiVersion)) { throw new DevfileFormatException( String.format( "Version '%s' of the devfile is not supported. Supported versions are '%s'.", apiVersion, SUPPORTED_VERSIONS)); } JsonSchema schema = schemasByVersion.get(apiVersion); try (JsonReader reader = service.createReader( new StringReader(jsonMapper.writeValueAsString(contentNode)), schema, handler)) { reader.read(); } if (!validationErrors.isEmpty()) { String error = errorMessageComposer.extractMessages(validationErrors, new StringBuilder()); throw new DevfileFormatException( format("Devfile schema validation failed. Error: %s", error)); } } catch (IOException e) { throw new DevfileFormatException("Unable to validate Devfile. Error: " + e.getMessage()); } }
Source:
public SAMSequenceRecord(final String name, final int sequenceLength) { if (name != null) { if (!LEGAL_RNAME_PATTERN.matcher(name).useAnchoringBounds(true).matches()) { throw new SAMException(String.format("Sequence name '%s' doesn't match regex: '%s' ", name, LEGAL_RNAME_PATTERN)); } validateSequenceName(name); mSequenceName = name.intern(); } else { mSequenceName = null; } mSequenceLength = sequenceLength; }

Target:
public SAMSequenceRecord(final String name, final int sequenceLength) { if (name != null) { validateSequenceName(name); mSequenceName = name.intern(); } else { mSequenceName = null; } mSequenceLength = sequenceLength; }