auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testAddStandardVariable() throws Exception { String propertyName = "property name " + new Random().nextInt(10000); this.ontologyDataManager.addProperty(propertyName, "test property", 1087); StandardVariable stdVariable = new StandardVariable(); stdVariable.setName("variable name " + new Random().nextInt(10000)); stdVariable.setDescription("variable description"); stdVariable.setProperty(this.ontologyDataManager.findTermByName(propertyName, CvId.PROPERTIES)); stdVariable.setMethod(new Term(4030, "Assigned", "Term, name or id assigned")); stdVariable.setScale(new Term(6000, "DBCV", "Controlled vocabulary from a database")); stdVariable.setDataType(new Term(1120, "Character variable", "variable with char values")); stdVariable.setIsA(new Term(1050, "Study condition", "Study condition class")); stdVariable.setEnumerations(new ArrayList<Enumeration>()); stdVariable.getEnumerations().add(new Enumeration(10001, "HB", "Hybridization nursery", 2)); stdVariable.getEnumerations().add(new Enumeration(10002, "PN", "Pedigree nursery", 3)); stdVariable.setConstraints(new VariableConstraints(100.0, 999.0)); stdVariable.setCropOntologyId("CROP-TEST"); try { this.ontologyDataManager.addStandardVariable(stdVariable, PROGRAM_UUID); } catch (MiddlewareQueryException e) { if (e.getMessage().contains("already exists")) { } } Debug.println(IntegrationTestBase.INDENT, "Standard variable saved: " + stdVariable.getId()); }

Target:
public void testAddStandardVariable() throws Exception { String propertyName = "property name " + new Random().nextInt(10000); this.ontologyDataManager.addProperty(propertyName, "test property", 1087); StandardVariable stdVariable = new StandardVariable(); stdVariable.setName("variable name " + new Random().nextInt(10000)); stdVariable.setDescription("variable description"); stdVariable.setProperty(this.ontologyDataManager.findTermByName(propertyName, CvId.PROPERTIES)); stdVariable.setMethod(new Term(4030, "Assigned", "Term, name or id assigned")); stdVariable.setScale(new Term(6000, "DBCV", "Controlled vocabulary from a database")); stdVariable.setDataType(new Term(1120, "Character variable", "variable with char values")); stdVariable.setIsA(new Term(1050, "Study condition", "Study condition class")); stdVariable.setEnumerations(new ArrayList<Enumeration>()); stdVariable.getEnumerations().add(new Enumeration(StudyType.N.getId(), StudyType.N.getName(), StudyType.N.getLabel(), 1)); stdVariable.getEnumerations().add(new Enumeration(StudyType.HB.getId(), StudyType.HB.getName(), StudyType.HB.getLabel(), 2)); stdVariable.getEnumerations().add(new Enumeration(StudyType.PN.getId(), StudyType.PN.getName(), StudyType.PN.getLabel(), 3)); stdVariable.setConstraints(new VariableConstraints(100.0, 999.0)); stdVariable.setCropOntologyId("CROP-TEST"); try { this.ontologyDataManager.addStandardVariable(stdVariable, PROGRAM_UUID); } catch (MiddlewareQueryException e) { if (e.getMessage().contains("already exists")) { } } Debug.println(IntegrationTestBase.INDENT, "Standard variable saved: " + stdVariable.getId()); }
Source:
public Principal getUser(final HttpServletRequest request, final HttpServletResponse response) { final HttpSession session = request.getSession(); if (session.getAttribute(LOGGED_IN_KEY) != null) { LOGGER.debug("Session found; user already logged in."); return (Principal) session.getAttribute(LOGGED_IN_KEY); } final Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION); if (assertion != null) { final Principal p = getUser(assertion.getPrincipal().getName()); if (p == null) { LOGGER.error("Principal is null for " + assertion.getPrincipal().getName()); } LOGGER.debug("Logging in from CAS.", p.getName()); session.setAttribute(LOGGED_IN_KEY, p); session.setAttribute(LOGGED_OUT_KEY, null); return p; } return super.getUser(request, response); }

Target:
public Principal getUser(final HttpServletRequest request, final HttpServletResponse response) { final HttpSession session = request.getSession(); if (session.getAttribute(LOGGED_IN_KEY) != null) { LOGGER.debug("Session found; user already logged in."); return (Principal) session.getAttribute(LOGGED_IN_KEY); } final Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION); if (assertion != null) { final Principal p = getUser(assertion.getPrincipal().getName()); if (p == null) { LOGGER.error("Principal is null for ", assertion.getPrincipal().getName()); } LOGGER.debug("Logging in from CAS.", p.getName()); session.setAttribute(LOGGED_IN_KEY, p); session.setAttribute(LOGGED_OUT_KEY, null); return p; } return super.getUser(request, response); }
Source:
protected IndexValue findKey(StoreKey key) throws StoreException { final Timer.Context context = metrics.findTime.time(); try { ConcurrentNavigableMap<Long, IndexSegment> segmentsMapsToFind = indexes.descendingMap(); for (Map.Entry<Long, IndexSegment> entry : segmentsMapsToFind.entrySet()) { logger.trace("Index : searching index with start offset {}", dataDir, entry.getKey()); IndexValue value = entry.getValue().find(key); if (value != null) { logger.trace("Index : found value offset size ttl {}", dataDir, value.getOffset(), value.getSize(), value.getTimeToLiveInMs()); return value; } } } finally { context.stop(); } return null; }

Target:
protected IndexValue findKey(StoreKey key) throws StoreException { final Timer.Context context = metrics.findTime.time(); try { ConcurrentNavigableMap<Long, IndexSegment> segmentsMapToFind = indexes.descendingMap(); for (Map.Entry<Long, IndexSegment> entry : segmentsMapToFind.entrySet()) { logger.trace("Index : searching index with start offset {}", dataDir, entry.getKey()); IndexValue value = entry.getValue().find(key); if (value != null) { logger.trace("Index : found value offset size ttl {}", dataDir, value.getOffset(), value.getSize(), value.getTimeToLiveInMs()); return value; } } } finally { context.stop(); } return null; }
Source:
void initialize() throws IOException { if ( !writerTaken.compareAndSet( false, true ) ) { throw new IllegalStateException( "Writer in " + this + " is already acquired by someone else. " + "Only a single writer is allowed. The writer will become available as soon as " + "acquired writer is closed" ); } boolean success = false; try { readLock = writerCheckpointMutex.readLock(); readLock.lock(); cursor = openRootCursor( PagedFile.PF_SHARED_WRITE_LOCK ); stableGeneration = stableGeneration( generation ); unstableGeneration = unstableGeneration( generation ); PointerChecking.assertNoSuccessor( cursor, stableGeneration, unstableGeneration ); treeLogic.initialize( cursor ); success = true; } catch ( TreeInconsistencyException e ) { throw appendTreeInformation( e ); } finally { if ( !success ) { closeCursor(); writerTaken.set( false ); releaseLock(); } } }

Target:
void initialize() throws IOException { if ( !writerTaken.compareAndSet( false, true ) ) { throw new IllegalStateException( "Writer in " + this + " is already acquired by someone else. " + "Only a single writer is allowed. The writer will become available as soon as " + "acquired writer is closed" ); } boolean success = false; try { readLock = writerCheckpointMutex.readLock(); readLock.lock(); cursor = openRootCursor( PagedFile.PF_SHARED_WRITE_LOCK ); stableGeneration = stableGeneration( generation ); unstableGeneration = unstableGeneration( generation ); PointerChecking.assertNoSuccessor( cursor, stableGeneration, unstableGeneration ); treeLogic.initialize( cursor ); success = true; } catch ( TreeInconsistencyException e ) { throw appendTreeInformation( e ); } finally { if ( !success ) { close(); } } }
Source:
public boolean setLocation(final Vector3d position, final UUID world) { final WorldProperties prop = Sponge.getServer().getWorldManager().getProperties(world).orElseThrow(() -> new IllegalArgumentException("Invalid World: No world found for UUID")); final World loaded; try { loaded = Sponge.getServer().getWorldManager().loadWorld(prop).orElseThrow(() -> new IllegalArgumentException("Invalid World: Could not load world for UUID")); } catch (IOException ex) { throw new IllegalArgumentException("Invalid World: ", ex); } return this.setLocation(Location.of(loaded, position)); }

Target:
public boolean setLocation(final Vector3d position, final UUID world) { final Optional<ServerWorld> targetWorld = Sponge.getServer().getWorldManager().getWorld(world); return targetWorld.isPresent() && this.setLocation(Location.of(targetWorld.get(), position)); }
Source:
public void run() { LOGGER.info("Run {}: {}", getClass().getName(), Thread.currentThread().getName()); LOGGER.info("Queue={}", queue); while (active.get()) { final MailQueueItem queueItem; try { queueItem = queue.deQueue(); workerService.execute(() -> { TimeMetric timeMetric = metricFactory.timer(SPOOL_PROCESSING); try { numActive.incrementAndGet(); processingActive.incrementAndGet(); Mail mail = queueItem.getMail(); LOGGER.debug("==== Begin processing mail ====", mail.getName()); try { mailProcessor.service(mail); queueItem.done(true); } catch (Exception e) { if (active.get()) { LOGGER.error("Exception processing mail while spooling {}", e.getMessage(), e); } queueItem.done(false); } finally { LifecycleUtil.dispose(mail); mail = null; } } catch (Throwable e) { if (active.get()) { LOGGER.error("Exception processing mail while spooling {}", e.getMessage(), e); } } finally { processingActive.decrementAndGet(); numActive.decrementAndGet(); timeMetric.stopAndPublish(); } }); } catch (MailQueueException e1) { if (active.get()) { LOGGER.error("Exception dequeue mail", e1); } } catch (InterruptedException interrupted) { } } LOGGER.info("Stop : {}", getClass().getName(), Thread.currentThread().getName()); }

Target:
public void run() { LOGGER.info("Run {}: {}", getClass().getName(), Thread.currentThread().getName()); LOGGER.info("Queue={}", queue); while (active.get()) { final MailQueueItem queueItem; try { queueItem = queue.deQueue(); workerService.execute(() -> { TimeMetric timeMetric = metricFactory.timer(SPOOL_PROCESSING); try { numActive.incrementAndGet(); processingActive.incrementAndGet(); Mail mail = queueItem.getMail(); LOGGER.debug("==== Begin processing mail ====", mail.getName()); try { mailProcessor.service(mail); queueItem.done(true); } catch (Exception e) { if (active.get()) { LOGGER.error("Exception processing mail while spooling", e); } queueItem.done(false); } finally { LifecycleUtil.dispose(mail); mail = null; } } catch (Throwable e) { if (active.get()) { LOGGER.error("Exception processing mail while spooling", e); } } finally { processingActive.decrementAndGet(); numActive.decrementAndGet(); timeMetric.stopAndPublish(); } }); } catch (MailQueueException e1) { if (active.get()) { LOGGER.error("Exception dequeue mail", e1); } } catch (InterruptedException interrupted) { } } LOGGER.info("Stop : {}", getClass().getName(), Thread.currentThread().getName()); }
Source:
public StageInfo getStageInfo() { return stateMachine.getStageInfo( () -> getAllTasks().stream() .map(RemoteTask::getTaskInfo) .collect(toImmutableList())); }

Target:
public StageInfo getStageInfo() { return stateMachine.getStageInfo(this::getAllTaskInfo); }
Source:
public JavaPackageSource(Package javaPackage) { this.packageName = javaPackage.getName(); }

Target:
public JavaPackageSource(Package javaPackage) { this(Preconditions.notNull(javaPackage, "java package must not be null").getName()); }
Source:
private static long sleep(long millis) { long startTime = System.nanoTime(); try { Thread.sleep(millis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } long sleepTimeMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); if (sleepTimeMs < 0) { sleepTimeMs = 0; } return sleepTimeMs; }

Target:
private static long sleep(long millis) throws InterruptedException { long startTime = System.nanoTime(); Thread.sleep(millis); long sleepTimeMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); if (sleepTimeMs < 0) { sleepTimeMs = 0; } return sleepTimeMs; }
Source:
public static Collection<Object[]> data() throws Exception { return Arrays.asList(new Object[][] { { getDetectorRequest(), "<?xml version=\"1.0\"?>\n" + "<detector-request location=\"MINION\" serviceName=\"ICMP\" address=\"localhost\">\n"+ "<attributes>port=8980</attributes> \n"+ "<attributes>timeout=5000</attributes> \n" + "<attributes>retries=10</attributes> \n" + "</detector-request>" } }); }

Target:
public static Collection<Object[]> data() throws Exception { return Arrays.asList(new Object[][] { { getDetectorRequest(), "<?xml version=\"1.0\"?>\n" + "<detector-request location=\"MINION\" serviceName=\"ICMP\" address=\"localhost\">\n"+ "<attributes><entry> <key>port</key> <value>8980</value> </entry> </attributes> \n" + "</detector-request>" } }); }
Source:
public Optional<SnmpAgentConfig> getAgentConfigFromProfiles(InetAddress inetAddress, String location, String oid) { List<SnmpProfile> snmpProfiles = agentConfigFactory.getProfiles(); List<SnmpProfile> matchedProfiles = snmpProfiles.stream() .filter(snmpProfile -> isFilterExpressionValid(inetAddress, snmpProfile.getFilterExpression())) .collect(Collectors.toList()); for (SnmpProfile snmpProfile : matchedProfiles) { Optional<SnmpAgentConfig> config = fitProfile(snmpProfile, inetAddress, location, oid); if (config.isPresent()) { return config; } } return Optional.empty(); }

Target:
public CompletableFuture<Optional<SnmpAgentConfig>> getAgentConfigFromProfiles(InetAddress inetAddress, String location, String oid) { CompletableFuture<Optional<SnmpAgentConfig>> future = new CompletableFuture<>(); List<SnmpProfile> snmpProfiles = agentConfigFactory.getProfiles(); List<SnmpProfile> matchedProfiles = snmpProfiles.stream() .filter(snmpProfile -> isFilterExpressionValid(inetAddress, snmpProfile.getFilterExpression())) .collect(Collectors.toList()); List<CompletableFuture<Optional<SnmpAgentConfig>>> futures = matchedProfiles.stream() .map(matchedProfile -> fitProfile(matchedProfile, inetAddress, location, oid)) .collect(Collectors.toList()); CompletableFuture<Void> allFutures = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])); CompletableFuture<List<Optional<SnmpAgentConfig>>> results = allFutures.thenApply(agentConfig -> { return futures.stream().map(CompletableFuture::join).collect(Collectors.toList()); }); results.whenComplete((configList, throwable) -> { if (throwable == null) { Optional<Optional<SnmpAgentConfig>> configOptional = configList.stream().filter(Optional::isPresent).findFirst(); future.complete(configOptional.orElse(Optional.empty())); } else { future.complete(Optional.empty()); } }); return future; }
Source:
public final void createAndOpenNewBoard(String boardName, List<PanelInfo> panelList) { prefs.addBoard(boardName, panelList); prefs.setLastOpenBoard(boardName); prefs.setLastOpenBoardPanelInfos(panelList); openBoard(boardName, panelList); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " created and opened"); ui.updateTitle(); }

Target:
public final void createAndOpenNewBoard(String boardName, List<PanelInfo> panelList) { openBoard(boardName, panelList); saveBoard(); }
Source:
public String toString() { return "SegmentPublishResult{" + "segments=" + segments + ", success=" + success + ", exception=" + errorMsg + '}'; }

Target:
public String toString() { return "SegmentPublishResult{" + "segments=" + segments + ", success=" + success + ", errorMsg='" + errorMsg + '\'' + '}'; }
Source:
public String toString() { InetAddress host = null; try { host = options.getTransportOptions().getHost(); } catch (IOException ignored) { } InetAddress adminHost = null; try { adminHost = options.getAdminTransportOptions().getHost(); } catch (IOException ignored) { } return String.format( "BigtableConnection-%d. Project: %s, Zone: %s, Cluster: %s. host: %s, adminhost: %s", id, options.getProjectId(), options.getZone(), options.getCluster(), host, adminHost); }

Target:
public String toString() { InetAddress host = options.getHost(); InetAddress adminHost = options.getAdminHost(); return MoreObjects.toStringHelper(BigtableConnection.class) .add("id", id) .add("zone", options.getZone()) .add("project", options.getProjectId()) .add("cluster", options.getCluster()) .add("host", host) .add("adminHost", adminHost) .toString(); }
Source:
public void testCreateDigitalSignature() throws Exception { InputStream inputStream = DigitalSignatureTest.class.getResourceAsStream("/example.zip"); byte[] signature = digitalSignature.createDigitalSignature(inputStream, ALIAS, KEYSTORE_PASS); assertThat(signature, is(notNullValue())); }

Target:
public void testCreateDigitalSignature() throws Exception { InputStream inputStream = DigitalSignatureTest.class.getResourceAsStream(EXAMPLE_EXPORT); byte[] signature = digitalSignature.createDigitalSignature(inputStream, ALIAS, KEYSTORE_PASS); assertThat(signature, is(notNullValue())); }
Source:
public void removeIndex(Session session, Index h2Idx) { lock(true); try { ensureNotDestroyed(); ArrayList<Index> idxs = new ArrayList<>(this.idxs); Index targetIdx = (h2Idx instanceof GridH2ProxyIndex) ? ((GridH2ProxyIndex)h2Idx).underlyingIndex() : h2Idx; for (int i = pkIndexPos; i < idxs.size();) { Index idx = idxs.get(i); if (idx == targetIdx || (idx instanceof GridH2ProxyIndex && ((GridH2ProxyIndex)idx).underlyingIndex() == targetIdx)) { Index idx0 = idxs.remove(i); if (idx0 instanceof GridH2ProxyIndex && idx.getSchema().findIndex(session, idx.getName()) != null) database.removeSchemaObject(session, idx); GridCacheContext cctx0 = cacheInfo.cacheContext(); if (cctx0 != null && idx0 instanceof GridH2IndexBase) { cctx0.shared().database().checkpointReadLock(); try { ((GridH2IndexBase)idx0).destroy(rmIndex); } finally { cctx0.shared().database().checkpointReadUnlock(); } } continue; } i++; } this.idxs = idxs; } finally { unlock(true); } }

Target:
public void removeIndex(Session session, Index h2Idx) { lock(true); try { ensureNotDestroyed(); ArrayList<Index> idxs = new ArrayList<>(this.idxs); Index targetIdx = (h2Idx instanceof GridH2ProxyIndex) ? ((GridH2ProxyIndex)h2Idx).underlyingIndex() : h2Idx; for (int i = pkIndexPos; i < idxs.size();) { Index idx = idxs.get(i); if (idx == targetIdx || (idx instanceof GridH2ProxyIndex && ((GridH2ProxyIndex)idx).underlyingIndex() == targetIdx)) { idxs.remove(i); if (idx instanceof GridH2ProxyIndex && idx.getSchema().findIndex(session, idx.getName()) != null) database.removeSchemaObject(session, idx); GridCacheContext cctx0 = cacheInfo.cacheContext(); if (cctx0 != null && idx instanceof GridH2IndexBase) { cctx0.shared().database().checkpointReadLock(); try { ((GridH2IndexBase)idx).destroy(rmIndex); } finally { cctx0.shared().database().checkpointReadUnlock(); } } continue; } i++; } this.idxs = idxs; } finally { unlock(true); } }
Source:
public void finish(TimePeriod timeout, boolean createModule, String moduleName) { checkShell(); log.info("Finish wizard"); Button button = new FinishButton(this); button.click(); ShellIsAvailable moduleShell = new ShellIsAvailable("New module-info.java"); new WaitUntil(moduleShell, TimePeriod.MEDIUM, false); if (moduleShell.getResult() != null) { NewModuleInfoDialog moduleDialog = new NewModuleInfoDialog(new DefaultShell(moduleShell.getResult())); if (createModule) { if (moduleName != null && !moduleName.isEmpty()) { moduleDialog.setModuleName(moduleName); } moduleDialog.create(); } else { moduleDialog.dontCreate(); } new WaitWhile(moduleShell, TimePeriod.DEFAULT); } new WaitWhile(new WindowIsAvailable(this), timeout); try { new WaitWhile(new JobIsRunning(), timeout); } catch (NoClassDefFoundError e) { } }

Target:
public void finish(TimePeriod timeout, boolean createModule, String moduleName) { checkShell(); log.info("Finish wizard"); Button button = new FinishButton(this); button.click(); ShellIsAvailable moduleShell = new ShellIsAvailable("New module-info.java"); new WaitUntil(moduleShell, TimePeriod.MEDIUM, false); if (moduleShell.getResult() != null) { NewModuleInfoDialog moduleDialog = new NewModuleInfoDialog(new DefaultShell(moduleShell.getResult())); if (createModule) { if (moduleName != null && !moduleName.isEmpty()) { moduleDialog.setModuleName(moduleName); } moduleDialog.create(); } else { moduleDialog.dontCreate(); } new WaitWhile(moduleShell, TimePeriod.DEFAULT); } new WaitWhile(new WindowIsAvailable(this), timeout); new WaitWhile(new JobIsRunning(), timeout); }
Source:
private void loadVMsFromExternalProvider(final OriginType type, String uri, String username, String password) { startProgress(); AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { if (returnValue instanceof VdcQueryReturnValue) { setError(messages.providerFailure()); stopProgress(); } else { List<VM> remoteVms = (List<VM>) returnValue; List<VM> remoteDownVms = new ArrayList<>(); for (VM vm : remoteVms) { if (vm.isDown()) { vm.setOrigin(type); remoteDownVms.add(vm); } } if (remoteVms.size() != remoteDownVms.size()) { setWarning(constants.runningVmsWereFilteredOnImportVm()); } updateVms(remoteDownVms); } } }); query.setHandleFailure(true); AsyncDataProvider.getInstance().getVmsFromExternalServer( query, getDataCenters().getSelectedItem().getId(), getProxyHosts().getSelectedItem() != null ? getProxyHosts().getSelectedItem().getId() : null, uri, username, password); }

Target:
private void loadVMsFromExternalProvider(final OriginType type, String uri, String username, String password) { startProgress(); AsyncQuery query = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { if (returnValue instanceof VdcQueryReturnValue) { setError(messages.providerFailure()); stopProgress(); } else { List<VM> remoteVms = (List<VM>) returnValue; List<VM> remoteDownVms = new ArrayList<>(); for (VM vm : remoteVms) { if (vm.isDown()) { vm.setOrigin(type); remoteDownVms.add(vm); } } if (remoteVms.size() != remoteDownVms.size()) { setWarning(constants.runningVmsWereFilteredOnImportVm()); } updateVms(remoteDownVms); } } }); Guid proxyId = null; switch (type) { case XEN: proxyId = getXenProxyHosts().getSelectedItem() != null ? getXenProxyHosts().getSelectedItem().getId() : null; break; case VMWARE: default: proxyId = getProxyHosts().getSelectedItem() != null ? getProxyHosts().getSelectedItem().getId() : null; break; } query.setHandleFailure(true); AsyncDataProvider.getInstance().getVmsFromExternalServer( query, getDataCenters().getSelectedItem().getId(), proxyId, uri, username, password, type); }
Source:
public void signInAccountIncomplete() { SignIn signIn = new SignIn.Builder().withStudy(TestConstants.TEST_STUDY_IDENTIFIER) .withPassword("password").build(); try { signIn.getAccountId(); } catch(IllegalArgumentException e) { assertEquals("SignIn not constructed with enough information to retrieve an account", e.getMessage()); } }

Target:
public void signInAccountIncomplete() { SignIn signIn = new SignIn.Builder().withStudy(TestConstants.TEST_STUDY_IDENTIFIER) .withPassword("password").build(); try { signIn.getAccountId(); fail("Should have thrown an exception"); } catch(IllegalArgumentException e) { assertEquals("SignIn not constructed with enough information to retrieve an account", e.getMessage()); } }
Source:
public void should_operate_silently() { String login = randomAlphabetic(10).toLowerCase(); String password = randomAlphabetic(10).toLowerCase(); userRule.createUser(login, password); WsResponse response = ItUtils.newUserWsClient(orchestrator, login, password).users().skipOnboardingTutorial(); assertThat(response.code()).isEqualTo(204); assertThat(response.hasContent()).isFalse(); }

Target:
public void should_operate_silently() { String login = randomAlphabetic(10).toLowerCase(); String password = randomAlphabetic(10).toLowerCase(); userRule.createUser(login, password); WsResponse response; try { response = ItUtils.newUserWsClient(orchestrator, null, null).users().skipOnboardingTutorial(); } finally { userRule.deactivateUsers(login); } assertThat(response.code()).isEqualTo(204); assertThat(response.hasContent()).isFalse(); }
Source:
void serializeMessageInfoAndMetadataList(ByteBuffer outputBuffer) { outputBuffer.putInt(messageInfoList == null ? 0 : messageInfoList.size()); if (messageInfoList != null) { ListIterator<MessageInfo> infoListIterator = messageInfoList.listIterator(); ListIterator<MessageMetadata> metadataListIterator = messageMetadataList.listIterator(); while (infoListIterator.hasNext()) { MessageInfo messageInfo = infoListIterator.next(); MessageMetadata messageMetadata = metadataListIterator.next(); outputBuffer.put(messageInfo.getStoreKey().toBytes()); outputBuffer.putLong(messageInfo.getSize()); outputBuffer.putLong(messageInfo.getExpirationTimeInMs()); outputBuffer.put(messageInfo.isDeleted() ? DELETED : (byte) ~DELETED); if (version < VERSION_1 || version > VERSION_4) { throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } if (version > VERSION_1) { Long crc = messageInfo.getCrc(); if (crc != null) { outputBuffer.put(CRC_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~CRC_PRESENT); } } if (version > VERSION_2) { outputBuffer.putShort(messageInfo.getAccountId()); outputBuffer.putShort(messageInfo.getContainerId()); outputBuffer.putLong(messageInfo.getOperationTimeMs()); } if (version > VERSION_3) { if (messageMetadata == null) { outputBuffer.putInt(0); } else { messageMetadata.serializeMessageMetadata(outputBuffer); } } } } }

Target:
void serializeMessageInfoAndMetadataList(ByteBuffer outputBuffer) { outputBuffer.putInt(messageInfoList == null ? 0 : messageInfoList.size()); if (messageInfoList != null) { ListIterator<MessageInfo> infoListIterator = messageInfoList.listIterator(); ListIterator<MessageMetadata> metadataListIterator = messageMetadataList.listIterator(); while (infoListIterator.hasNext()) { MessageInfo messageInfo = infoListIterator.next(); MessageMetadata messageMetadata = metadataListIterator.next(); outputBuffer.put(messageInfo.getStoreKey().toBytes()); outputBuffer.putLong(messageInfo.getSize()); outputBuffer.putLong(messageInfo.getExpirationTimeInMs()); outputBuffer.put(messageInfo.isDeleted() ? DELETED : (byte) ~DELETED); if (version < VERSION_1 || version > VERSION_4) { throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } if (version > VERSION_1) { Long crc = messageInfo.getCrc(); if (crc != null) { outputBuffer.put(FIELD_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~FIELD_PRESENT); } } if (version > VERSION_2) { outputBuffer.putShort(messageInfo.getAccountId()); outputBuffer.putShort(messageInfo.getContainerId()); outputBuffer.putLong(messageInfo.getOperationTimeMs()); } if (version > VERSION_3) { if (messageMetadata != null) { outputBuffer.put(FIELD_PRESENT); messageMetadata.serializeMessageMetadata(outputBuffer); } else { outputBuffer.put((byte) ~FIELD_PRESENT); } } } } }
Source:
public static String getExceptionAsString(Throwable t) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter, true); log.error(t); printWriter.flush(); stringWriter.flush(); return stringWriter.toString(); }

Target:
public static String getExceptionAsString(Throwable t) { return ExceptionUtils.getStackTrace(t); }
Source:
public static EventContext createEventContext(Any producerId, @Nullable Version version, CommandContext commandContext) { final EventId eventId = generateId(); final Timestamp timestamp = getCurrentTime(); final EventContext.Builder builder = EventContext.newBuilder() .setEventId(eventId) .setTimestamp(timestamp) .setCommandContext(commandContext) .setProducerId(producerId); if (version != null) { builder.setVersion(version); } return builder.build(); }

Target:
public static EventContext createEventContext(Any producerId, @Nullable Version version, CommandContext commandContext) { checkNotNull(producerId); checkNotNull(commandContext); final EventId eventId = generateId(); final Timestamp timestamp = getCurrentTime(); final EventContext.Builder builder = EventContext.newBuilder() .setEventId(eventId) .setTimestamp(timestamp) .setCommandContext(commandContext) .setProducerId(producerId); if (version != null) { builder.setVersion(version); } return builder.build(); }
Source:
public void deinit() { synchronized (this) { if (!mThreadPoolExecutor.isShutdown()) { mThreadPoolExecutor.shutdown(); } } }

Target:
public void deinit() { synchronized (mExecutorLock) { if (!mThreadPoolExecutor.isShutdown()) { mThreadPoolExecutor.shutdown(); } } }
Source:
public SubscriptionValidationConfig build() { SubscriptionValidationConfig subscriptionValidationConfig = new SubscriptionValidationConfig(); subscriptionValidationConfig.serviceURL = serviceURL; subscriptionValidationConfig.username = username; subscriptionValidationConfig.password = password; return subscriptionValidationConfig; }

Target:
public SubscriptionValidationConfig build() { SubscriptionValidationConfig subscriptionValidationConfig = new SubscriptionValidationConfig(); subscriptionValidationConfig.serviceURL = serviceURL; subscriptionValidationConfig.username = username; subscriptionValidationConfig.password = password; subscriptionValidationConfig.enabled = enabled; return subscriptionValidationConfig; }
Source:
public void validateSaveUser() { if (user == null || user.getUsername() == null || user.getUsername().trim().equals("")) { addFieldError("user.username", REQUIRED); } if (user == null || user.getLastNm() == null || user.getLastNm().trim().equals("")) { addFieldError("user.lastNm", REQUIRED); } if (user == null || user.getFirstNm() == null || user.getFirstNm().trim().equals("")) { addFieldError("user.firstNm", REQUIRED); } if (user != null && !User.PASSIVE.equals(user.getUserType())) { if (user != null && user.getPassword() != null && !user.getPassword().trim().equals("")){ if(!user.getPassword().equals(user.getPasswordConfirm())) { addActionError("Passwords do not match"); } else if(!PasswordUtil.isValid(user.getPassword())) { addActionError(PasswordUtil.PASSWORD_REQ_ERROR_MSG); } } if(user!=null && user.getId()==null && !Auth.AUTH_EXTERNAL.equals(user.getAuthType()) && (user.getPassword()==null || user.getPassword().trim().equals(""))){ addActionError("Password is required"); } } if(user!=null && !UserDB.isUnique(user.getId(),user.getUsername())){ addActionError("Username has been taken"); } if (!this.getFieldErrors().isEmpty()||!this.getActionErrors().isEmpty()) { Long userId = AuthUtil.getUserId(servletRequest.getSession()); sortedSet = UserDB.getUserSet(sortedSet); user.setId(userId); } }

Target:
public void validateSaveUser() { if (user == null || user.getUsername() == null || user.getUsername().trim().equals("")) { addFieldError("user.username", REQUIRED); } if (user == null || user.getLastNm() == null || user.getLastNm().trim().equals("")) { addFieldError("user.lastNm", REQUIRED); } if (user == null || user.getFirstNm() == null || user.getFirstNm().trim().equals("")) { addFieldError("user.firstNm", REQUIRED); } if (user != null && !User.PASSIVE.equals(user.getUserType())) { if (user.getPassword() != null && !user.getPassword().trim().equals("")){ if(!user.getPassword().equals(user.getPasswordConfirm())) { addActionError("Passwords do not match"); } else if(!PasswordUtil.isValid(user.getPassword())) { addActionError(PasswordUtil.PASSWORD_REQ_ERROR_MSG); } } if(user!=null && user.getId()==null && !Auth.AUTH_EXTERNAL.equals(user.getAuthType()) && (user.getPassword()==null || user.getPassword().trim().equals(""))){ addActionError("Password is required"); } } if(user!=null && !UserDB.isUnique(user.getId(),user.getUsername())){ addActionError("Username has been taken"); } if (!this.getFieldErrors().isEmpty()||!this.getActionErrors().isEmpty()) { Long userId = AuthUtil.getUserId(servletRequest.getSession()); sortedSet = UserDB.getUserSet(sortedSet); user.setId(userId); } }
Source:
private long writeArtifact(RepositoryPath repositoryPath, InputStream is, OutputStream os) throws IOException { ArtifactOutputStream aos = StreamUtils.findSource(ArtifactOutputStream.class, os); Repository repository = repositoryPath.getRepository(); Boolean checksumAttribute = RepositoryFiles.isChecksum(repositoryPath); if (Boolean.TRUE.equals(checksumAttribute)) { aos.setCacheOutputStream(new ByteArrayOutputStream()); } if (repository.isHostedRepository()) { artifactEventListenerRegistry.dispatchArtifactUploadingEvent(repositoryPath); } long totalAmountOfBytes = IOUtils.copy(is, os); Map<String, String> digestMap = aos.getDigestMap(); if (Boolean.FALSE.equals(checksumAttribute) && !digestMap.isEmpty()) { addChecksumsToCacheManager(digestMap, repositoryPath); } if (Boolean.TRUE.equals(checksumAttribute)) { String checksumValue = ((ByteArrayOutputStream) aos.getCacheOutputStream()).toString(StandardCharsets.UTF_8.name()); String algorithm = FilenameUtils.getExtension(repositoryPath.toString()); String fileBaseName = FilenameUtils.getBaseName(repositoryPath.toString()); checksumCacheManager.addArtifactChecksum(repositoryPath.resolveSibling(fileBaseName), algorithm, checksumValue); } return totalAmountOfBytes; }

Target:
private long writeArtifact(RepositoryPath repositoryPath, InputStream is, OutputStream os) throws IOException { LayoutOutputStream aos = StreamUtils.findSource(LayoutOutputStream.class, os); Repository repository = repositoryPath.getRepository(); Boolean checksumAttribute = RepositoryFiles.isChecksum(repositoryPath); if (Boolean.TRUE.equals(checksumAttribute)) { aos.setCacheOutputStream(new ByteArrayOutputStream()); } if (repository.isHostedRepository()) { artifactEventListenerRegistry.dispatchArtifactUploadingEvent(repositoryPath); } long totalAmountOfBytes = IOUtils.copy(is, os); URI repositoryPathId = repositoryPath.toUri(); Map<String, String> digestMap = aos.getDigestMap(); if (Boolean.FALSE.equals(checksumAttribute) && !digestMap.isEmpty()) { addChecksumsToCacheManager(digestMap, repositoryPathId); writeChecksums(repositoryPath, digestMap); } if (Boolean.TRUE.equals(checksumAttribute)) { byte[] checksumValue = ((ByteArrayOutputStream) aos.getCacheOutputStream()).toByteArray(); if (checksumValue != null && checksumValue.length > 0) { validateUploadedChecksumAgainstCache(checksumValue, repositoryPathId); } } return totalAmountOfBytes; }
Source:
public void onPartitionBecomeLeaderFromStandby(String partitionName) { try { PartitionStateChangeListener cloudToStoreReplicationListener = partitionStateChangeListeners.get(StateModelListenerType.CloudToStoreReplicationManagerListener); if (cloudToStoreReplicationListener != null) { cloudToStoreReplicationListener.onPartitionBecomeLeaderFromStandby(partitionName); } } catch (Exception e) { participantMetrics.standbyCount.addAndGet(-1); participantMetrics.errorStateCount.addAndGet(1); throw e; } participantMetrics.standbyCount.addAndGet(-1); participantMetrics.leaderCount.addAndGet(1); }

Target:
public void onPartitionBecomeLeaderFromStandby(String partitionName) { try { PartitionStateChangeListener cloudToStoreReplicationListener = partitionStateChangeListeners.get(StateModelListenerType.CloudToStoreReplicationManagerListener); if (cloudToStoreReplicationListener != null) { cloudToStoreReplicationListener.onPartitionBecomeLeaderFromStandby(partitionName); } } catch (Exception e) { participantMetrics.errorStateCount.addAndGet(1); throw e; } finally { participantMetrics.standbyCount.addAndGet(-1); } participantMetrics.leaderCount.addAndGet(1); }
Source:
protected boolean canDoAction() { if (disk == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } buildSharedLockMap(); return acquireLockInternal() && validateAllVmsForDiskAreDown() && disk.getDiskStorageType() == DiskStorageType.IMAGE ? canRemoveDiskBasedOnImageStorageCheck() : true; }

Target:
protected boolean canDoAction() { if (disk == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } buildSharedLockMap(); return acquireLockInternal() && validateAllVmsForDiskAreDown() && canRemoveDiskBasedOnStorageTypeCheck(); }
Source:
public <T> Mono<T> getDataAsync(Class<T> clazz, JsonSerializer dataDeserializer) { if (!parsed) { throw logger.logExceptionAsError(new IllegalStateException( "This method should only be called on events created through the parse method")); } return dataDeserializer.deserializeAsync(new ByteArrayInputStream((byte[]) this.event.getData()), TypeReference.createInstance(clazz)); }

Target:
public <T> Mono<T> getDataAsync(Class<T> clazz, JsonSerializer dataDeserializer) { if (!parsed) { return FluxUtil.monoError(logger, new IllegalStateException( "This method should only be called on events created through the parse method")); } return dataDeserializer.deserializeAsync(new ByteArrayInputStream((byte[]) this.event.getData()), TypeReference.createInstance(clazz)); }
Source:
public DiskBuffer(File bufferDir, int maxEvents) { super(); this.bufferDir = bufferDir; this.maxEvents = maxEvents; String errMsg = "Could not create or write to disk buffer dir: " + bufferDir.getAbsolutePath(); try { bufferDir.mkdirs(); if (!bufferDir.isDirectory() || !bufferDir.canWrite()) { logger.error(errMsg); } } catch (Exception e) { logger.error(errMsg, e); } logger.debug(Integer.toString(getNumStoredEvents()) + " stored events found in dir: " + bufferDir.getAbsolutePath()); }

Target:
public DiskBuffer(File bufferDir, int maxEvents) { super(); this.bufferDir = bufferDir; this.maxEvents = maxEvents; String errMsg = "Could not create or write to disk buffer dir: " + bufferDir.getAbsolutePath(); try { bufferDir.mkdirs(); if (!bufferDir.isDirectory() || !bufferDir.canWrite()) { throw new RuntimeException(errMsg); } } catch (Exception e) { throw new RuntimeException(errMsg, e); } logger.debug(Integer.toString(getNumStoredEvents()) + " stored events found in dir: " + bufferDir.getAbsolutePath()); }
Source:
private void visitEnrollPage_forCourseWithResponses_hasWarningMessage() throws Exception { ______TS("Typical case 2: open the enroll page of a course with existing feedback responses"); InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor.getGoogleId()); String courseId = instructor.getCourseId(); String[] submissionParams = new String[]{Const.ParamsNames.COURSE_ID, courseId}; InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams); ShowPageResult pageResult = getShowPageResult(enrollPageAction); assertEquals(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL + "?error=false&user=idOfInstructor1OfCourse1", pageResult.getDestinationWithParams()); assertFalse(pageResult.isError); assertEquals(Const.StatusMessages.COURSE_ENROLL_POSSIBLE_DATA_LOSS, pageResult.getStatusMessage()); InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data; assertEquals(courseId, pageData.getCourseId()); assertEquals(null, pageData.getEnrollStudents()); String expectedLogSegment = "instructorCourseEnroll Page Load<br>" + "Enrollment for Course <span class=\"bold\">[" + courseId + "]</span>"; AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage()); }

Target:
private void visitEnrollPage_forCourseWithResponses_hasWarningMessage() throws Exception { ______TS("Typical case 2: open the enroll page of a course with existing feedback responses"); InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor.getGoogleId()); String courseId = instructor.getCourseId(); String[] submissionParams = new String[]{Const.ParamsNames.COURSE_ID, courseId}; InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams); ShowPageResult pageResult = getShowPageResult(enrollPageAction); assertEquals(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL + "?error=false&user=idOfInstructor1OfCourse1", pageResult.getDestinationWithParams()); assertFalse(pageResult.isError); assertEquals(Const.StatusMessages.COURSE_ENROLL_POSSIBLE_DATA_LOSS, pageResult.getStatusMessage()); InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data; assertEquals(courseId, pageData.getCourseId()); assertEquals(null, pageData.getEnrollStudents()); String expectedLogSegment = String.format( Const.StatusMessages.ADMIN_LOG_INSTRUCTOR_COURSE_ENROLL_PAGE_LOAD, courseId); AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage()); }
Source:
public void injectProtocolAndPortToComponent(Map<String, String> configurations, Component component) { try { ComponentPropertyPattern confMap = ComponentPropertyPattern .valueOf(component.getName()); String value = configurations.get(confMap.getConnectionConfName()); if (value != null) { Matcher matcher = confMap.getParsePattern().matcher(value); if (matcher.matches()) { String protocol = matcher.group(1); String portStr = matcher.group(2); if (!protocol.isEmpty()) { component.setProtocol(protocol); } if (!portStr.isEmpty()) { try { component.setPort(Integer.parseInt(portStr)); } catch (NumberFormatException e) { LOG.warn( "Protocol/Port information for component doesn't seem to known format [{}]." + "skip assigning...", value, component.getName(), confMap.getParsePattern()); component.setProtocol(null); } } } else { LOG.warn("Protocol/Port information for component doesn't seem to known format [{}]. " + "skip assigning...", value, component.getName(), confMap.getParsePattern()); } } else { LOG.warn("Protocol/Port related configuration ({}) is not set", confMap.getConnectionConfName()); } } catch (IllegalArgumentException e) { } }

Target:
public void injectProtocolAndPortToComponent(Map<String, String> configurations, Component component) { try { ComponentPropertyPattern confMap = ComponentPropertyPattern .valueOf(component.getName()); String value = configurations.get(confMap.getConnectionConfName()); if (value != null) { Matcher matcher = confMap.getParsePattern().matcher(value); if (matcher.matches()) { String protocol = matcher.group(1); String portStr = matcher.group(2); if (!protocol.isEmpty()) { component.setProtocol(protocol); } if (!portStr.isEmpty()) { try { component.setPort(Integer.parseInt(portStr)); } catch (NumberFormatException e) { LOG.warn( "Protocol/Port information for component has illegal format [{}]." + "skip assigning...", value, component.getName(), confMap.getParsePattern()); component.setProtocol(null); } } } else { LOG.warn("Protocol/Port information for component doesn't seem to known format [{}]. " + "skipping assignment...", value, component.getName(), confMap.getParsePattern()); } } else { LOG.warn("Protocol/Port related configuration ({}) is not set", confMap.getConnectionConfName()); } } catch (IllegalArgumentException e) { } }
Source:
private void setupMetacardMappers() { metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_METACARDS, remapKey(Associations.RELATED)); metacardToJsonEntryMapper.put("src", remapKey(QueryMetacardTypeImpl.QUERY_SOURCES)); metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_QUERIES, remapValue( value -> { List<Map<String, Object>> queries = (List) value; return queries .stream() .map(query -> transformIntoMetacard(new QueryMetacardImpl()).apply(query)) .map(this::toMetacardXml) .collect(Collectors.toList()); })); metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_LISTS, remapValue( value -> { List<Map<String, Object>> content = (List) value; return content .stream() .map(transformIntoMetacard(new ListMetacardImpl())) .map(this::toMetacardXml) .collect(Collectors.toList()); })); metacardToJsonEntryMapper.put( Security.ACCESS_INDIVIDUALS, remapValue( value -> { if (!(value instanceof List)) { return value; } return ((List<String>) value) .stream() .filter(StringUtils::isNotBlank) .collect(Collectors.toCollection(ArrayList::new)); })); metacardToJsonEntryMapper.put( QueryMetacardTypeImpl.QUERY_SORTS, remapValue( value -> ((List<LazyValueMap>) value) .stream() .map( lazyValueMap -> lazyValueMap.get("attribute") + "," + lazyValueMap.get("direction")) .collect(Collectors.toList()))); }

Target:
private void setupMetacardMappers() { metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_METACARDS, remapKey(Associations.RELATED)); metacardToJsonEntryMapper.put("src", remapKey(QueryMetacardTypeImpl.QUERY_SOURCES)); metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_QUERIES, remapValue( value -> { List<Map<String, Object>> queries = (List) value; return queries .stream() .map(query -> transformIntoMetacard(new QueryMetacardImpl()).apply(query)) .map(this::toMetacardXml) .collect(Collectors.toList()); })); metacardToJsonEntryMapper.put( WorkspaceAttributes.WORKSPACE_LISTS, remapValue( value -> { List<Map<String, Object>> content = (List) value; return content .stream() .map(transformIntoMetacard(new ListMetacardImpl())) .map(this::toMetacardXml) .collect(Collectors.toList()); })); metacardToJsonEntryMapper.put( Security.ACCESS_INDIVIDUALS, remapValue( value -> { if (!(value instanceof List)) { return value; } return ((List<String>) value) .stream() .filter(StringUtils::isNotBlank) .collect(Collectors.toCollection(ArrayList::new)); })); metacardToJsonEntryMapper.put( QueryMetacardTypeImpl.QUERY_SORTS, remapValue( value -> ((List<ValueMap>) value) .stream() .map( lazyValueMap -> lazyValueMap.get("attribute") + "," + lazyValueMap.get("direction")) .collect(Collectors.toList()))); }
Source:
private void fail(Throwable t, JobConfig jobConfig, Serializable taskArgs) { if (ServerConfiguration.getBoolean(PropertyKey.DEBUG)) { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, ExceptionUtils.getStackTrace(t)); } else { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, t.getMessage()); } LOG.warn("Exception running task for job {}({}) : {}", (jobConfig == null) ? "" : jobConfig.getName(), (taskArgs == null) ? "" : taskArgs.toString(), t.getMessage()); return; }

Target:
private void fail(Throwable t, JobConfig jobConfig, Serializable taskArgs) { if (ServerConfiguration.getBoolean(PropertyKey.DEBUG)) { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, ExceptionUtils.getStackTrace(t)); } else { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, t.getMessage()); } LOG.warn("Exception running task for job {}({}) : {}", (jobConfig == null) ? "Undefined" : jobConfig.getName(), (taskArgs == null) ? "Undefined" : taskArgs.toString(), t.getMessage()); return; }
Source:
protected void buildMessageInternal() { if (currentProcessedMimeMessage != null) { throw new IllegalStateException("message can only be built once!"); } if (cryptoStatus == null) { throw new IllegalStateException("PgpMessageBuilder must have cryptoStatus set before building!"); } Long openPgpKeyId = cryptoStatus.getOpenPgpKeyId(); try { currentProcessedMimeMessage = build(); } catch (MessagingException me) { queueMessageBuildException(me); return; } if (openPgpKeyId == null) { queueMessageBuildSuccess(currentProcessedMimeMessage); return; } if (!cryptoStatus.isProviderStateOk()) { queueMessageBuildException(new MessagingException("OpenPGP Provider is not ready!")); return; } addAutocryptHeaderIfAvailable(openPgpKeyId); addDraftStateHeader(); startOrContinueBuildMessage(null); }

Target:
protected void buildMessageInternal() { if (currentProcessedMimeMessage != null) { throw new IllegalStateException("message can only be built once!"); } if (cryptoStatus == null) { throw new IllegalStateException("PgpMessageBuilder must have cryptoStatus set before building!"); } Long openPgpKeyId = cryptoStatus.getOpenPgpKeyId(); try { currentProcessedMimeMessage = build(); } catch (MessagingException me) { queueMessageBuildException(me); return; } if (openPgpKeyId == null) { queueMessageBuildSuccess(currentProcessedMimeMessage); return; } if (!cryptoStatus.isProviderStateOk()) { queueMessageBuildException(new MessagingException("OpenPGP Provider is not ready!")); return; } addAutocryptHeaderIfAvailable(openPgpKeyId); if (isDraft()) { addDraftStateHeader(); } startOrContinueBuildMessage(null); }
Source:
public Boolean shouldAllowRequest(String url) { return true; }

Target:
public Boolean shouldAllowRequest(String url) { return null; }