auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LStat lstat(FS fs, File file) throws NoSuchFileException, NotDirectoryException { FileMode mode; if (file.isDirectory()) { if (new File(file, Constants.DOT_GIT).isDirectory()) mode = FileMode.GITLINK; else mode = FileMode.TREE; } else if (fs.canExecute(file)) mode = FileMode.EXECUTABLE_FILE; else mode = FileMode.REGULAR_FILE; return new LStat(file.lastModified(), mode, file.length()); }

Target:
public LStat lstat(FS fs, File file) throws NoSuchFileException, NotDirectoryException { FileMode mode; if (file.isDirectory()) { if (new File(file, Constants.DOT_GIT).isDirectory()) mode = FileMode.GITLINK; else mode = FileMode.TREE; } else if (fs.canExecute(file)) mode = FileMode.EXECUTABLE_FILE; else mode = FileMode.REGULAR_FILE; long sz = file.length(); if (sz < 0) throw new NoSuchFileException(file.getAbsolutePath()); return new LStat(file.lastModified(), mode, sz); }
Source:
protected void generateComponent() { testRunSink = (TestRunSink) conf.get(StormTopologyLayoutConstants.STREAMLINE_COMPONENT_CONF_KEY); String spoutId = "testRunSinkBolt" + UUID_FOR_COMPONENTS; String spoutClassName = "com.hortonworks.streamline.streams.runtime.storm.testing.TestRunSinkBolt"; List<Object> constructorArgs = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); String testRunSourceJson = null; try { testRunSourceJson = mapper.writeValueAsString(testRunSink); } catch (JsonProcessingException e) { log.error("Error creating json config string for TestRunSink", e); } constructorArgs.add(testRunSourceJson); component = createComponent(spoutId, spoutClassName, null, constructorArgs, null); addParallelismToComponent(); }

Target:
protected void generateComponent() { testRunSink = (TestRunSink) conf.get(StormTopologyLayoutConstants.STREAMLINE_COMPONENT_CONF_KEY); String boltId = "testRunSinkBolt" + UUID_FOR_COMPONENTS; String boltClassName = "com.hortonworks.streamline.streams.runtime.storm.testing.TestRunSinkBolt"; List<Object> constructorArgs = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); String testRunSourceJson = null; try { testRunSourceJson = mapper.writeValueAsString(testRunSink); } catch (JsonProcessingException e) { log.error("Error creating json config string for TestRunSink", e); } constructorArgs.add(testRunSourceJson); component = createComponent(boltId, boltClassName, null, constructorArgs, null); addParallelismToComponent(); }
Source:
public void testEnableDataGridMinWidth() throws Exception { final int PAGE_SIZE = 10; Element mockElement =mock(Element.class); final int minWidth = 800; PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false); ColumnPicker columnPickerMock = mock(ColumnPicker.class); when(pagedTable.dataGridContainer.getElement()).thenReturn(mockElement); when(columnPickerMock.getDataGridMinWidth()).thenReturn(minWidth); pagedTable.setColumnPicker(columnPickerMock); pagedTable.enableDataGridMinWidth(true);; pagedTable.setTableHeight(); verify(columnPickerMock,never()).setDefaultColumnWidthSize(anyInt()); verify(mockElement).setAttribute("style", "min-width:" + minWidth + Style.Unit.PX.getType()); }

Target:
public void testEnableDataGridMinWidth() throws Exception { final int PAGE_SIZE = 10; Element mockElement = mock(Element.class); final int minWidth = 800; PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false); ColumnPicker columnPickerMock = mock(ColumnPicker.class); when(pagedTable.dataGridContainer.getElement()).thenReturn(mockElement); when(columnPickerMock.getDataGridMinWidth()).thenReturn(minWidth); pagedTable.setColumnPicker(columnPickerMock); pagedTable.enableDataGridMinWidth(true); pagedTable.setTableHeight(); verify(columnPickerMock, never()).setDefaultColumnWidthSize(anyInt()); verify(mockElement).setAttribute("style", "min-width:" + minWidth + Style.Unit.PX.getType()); }
Source:
public T getCredentials(String credentialsName, String type) { if (StringUtils.isEmpty(credentialsName)) { throw new IllegalArgumentException("Credentials name must be supplied"); } CredentialsRepository<? extends T> repository = allRepositories.get(type); if (repository == null) { throw new UnknownCredentialsTypeException("No credentials of type '" + type + "' found"); } T creds = repository.getOne(credentialsName); if (creds == null) { throw new IllegalArgumentException( "Credentials '" + credentialsName + "' of type '" + type + "' cannot be found"); } return creds; }

Target:
public T getCredentials(String credentialsName, String type) { CredentialsRepository<? extends T> repository = allRepositories.get(type); if (repository == null) { throw new UnknownCredentialsTypeException("No credentials of type '" + type + "' found"); } T creds = repository.getOne(credentialsName); if (creds == null) { throw new MissingCredentialsException( "Credentials '" + credentialsName + "' of type '" + type + "' cannot be found"); } return creds; }
Source:
private List<Object> assertResult(List<MapOrList> parentResults, Object result) { result = convertPossibleArray(result); if (result != null && !(result instanceof Iterable)) { throw new BatchAssertionFailed(String.format("BatchedDataFetcher provided an invalid result: Iterable expected but got '%s'. Affected fields are set to null.", result.getClass().getName())); } @SuppressWarnings("unchecked") Iterable<Object> iterableResult = (Iterable<Object>) result; if (iterableResult == null) { throw new BatchAssertionFailed("BatchedDataFetcher provided a null Iterable of result values. Affected fields are set to null."); } long size = iterableResult.spliterator().estimateSize(); if (size != parentResults.size()) { throw new BatchAssertionFailed(String.format("BatchedDataFetcher provided invalid number of result values, expected %d but got %d. Affected fields are set to null.", parentResults.size(), size)); } List<Object> resultList = new ArrayList<>(); iterableResult.forEach(resultList::add); return resultList; }

Target:
private List<Object> assertResult(List<MapOrList> parentResults, Object result) { result = convertPossibleArray(result); if (result != null && !(result instanceof Iterable)) { throw new BatchAssertionFailed(String.format("BatchedDataFetcher provided an invalid result: Iterable expected but got '%s'. Affected fields are set to null.", result.getClass().getName())); } @SuppressWarnings("unchecked") Iterable<Object> iterableResult = (Iterable<Object>) result; if (iterableResult == null) { throw new BatchAssertionFailed("BatchedDataFetcher provided a null Iterable of result values. Affected fields are set to null."); } List<Object> resultList = new ArrayList<>(); iterableResult.forEach(resultList::add); long size = resultList.size(); if (size != parentResults.size()) { throw new BatchAssertionFailed(String.format("BatchedDataFetcher provided invalid number of result values, expected %d but got %d. Affected fields are set to null.", parentResults.size(), size)); } return resultList; }
Source:
public void commit() throws IOException { close(); if(destFile.exists() && !destFile.delete()) throw new IOException("Unable to delete "+destFile); boolean success = tmpFile.renameTo(destFile); if (!success) { throw new IOException("Unable to rename: " + destFile); } }

Target:
public void commit() throws IOException { close(); Path destFilePath = destFile.toPath(); if (Files.exists(destFilePath)) { Files.delete(destFilePath); } Files.move(tmpFile.toPath(), destFilePath); }
Source:
public String readLine() throws IOException { final String line = readLine(mFp,this.longestLineLength); if (line != null) { this.longestLineLength = Math.max(this.longestLineLength, line.length()); } return line; }

Target:
public String readLine() throws IOException { return readLine(mFp, DEFAULT_BUFFER_SIZE); }
Source:
public void testChronologize(){ Map<Long, Set<TObject>> map = Maps.newLinkedHashMap(); Set<TObject> set = Sets.newLinkedHashSet(); long recordId = TestData.getLong(); for (long i = 30; i <= 50; i++) { TObject tObject = Convert.javaToThrift("foo" + i); add("name", tObject, recordId); } long start = Time.now(); for (long i = 51; i <= 70; i++) { set = Sets.newLinkedHashSet(set); TObject tObject = Convert.javaToThrift("foo" + i); add("name", tObject, recordId); set.add(tObject); map.put(i, set); } long end = Time.now(); for (long i = 71; i <= 90; i++) { TObject tObject = Convert.javaToThrift("foo" + i); add("name", tObject, recordId); } Map<Long, Set<TObject>> newMap = store.chronologize("name", recordId, start, end); long key = 51; for(Entry<Long, Set<TObject>> e : newMap.entrySet()){ Set<TObject> result = e.getValue(); Assert.assertEquals(map.get(key), result); key++; } }

Target:
public void testChronologize() { Map<Long, Set<TObject>> expected = Maps.newLinkedHashMap(); Set<TObject> set = Sets.newLinkedHashSet(); Set<TObject> allValues = Sets.newLinkedHashSet(); long recordId = TestData.getLong(); for (long i = 30; i <= 35; i++) { TObject tObject = null; while (tObject == null || !allValues.add(tObject)) { tObject = TestData.getTObject(); add("name", tObject, recordId); set.add(tObject); } } long start = Time.now(); for (long i = 36; i <= 45; i++) { set = Sets.newLinkedHashSet(set); TObject tObject = null; while (tObject == null || !allValues.add(tObject)) { tObject = TestData.getTObject(); add("name", tObject, recordId); } set.add(tObject); expected.put(i, set); } for (long i = 46; i <= 50; i++) { set = Sets.newLinkedHashSet(set); Iterator<TObject> it = allValues.iterator(); if(it.hasNext()) { TObject tObject = it.next(); if(i % 2 == 0) { remove("name", tObject, recordId); set.remove(tObject); } } expected.put(i, set); } long end = Time.now(); for (long i = 51; i <= 55; i++) { TObject tObject = null; while (tObject == null || !allValues.add(tObject)) { tObject = TestData.getTObject(); add("name", tObject, recordId); } } Map<Long, Set<TObject>> actual = store.chronologize("name", recordId, start, end); long key = 36; for (Entry<Long, Set<TObject>> e : actual.entrySet()) { Set<TObject> result = e.getValue(); Assert.assertEquals(expected.get(key), result); key++; } }
Source:
private boolean checkFormRecordStatus(FormRecord[] records) throws FileNotFoundException, TaskCancelledException { boolean needToSendLogs = false; processor.beginBulkSubmit(); for (int i = 0; i < records.length; ++i) { if (isCancelled()) { throw new TaskCancelledException(); } FormRecord record = records[i]; if (FormRecord.STATUS_COMPLETE.equals(record.getStatus())) { try { records[i] = processor.process(record); } catch (InvalidStructureException | XmlPullParserException | UnfullfilledRequirementsException e) { records[i] = handleExceptionFromFormProcessing(record, e); needToSendLogs = true; } catch (FileNotFoundException e) { if (CommCareApplication.instance().isStorageAvailable()) { Logger.log(LogTypes.TYPE_ERROR_DESIGN, "Removing form record because file was missing|" + getExceptionText(e)); record.logPendingDeletion(TAG, "the xml submission file associated with the record could not be found"); FormRecordCleanupTask.wipeRecord(c, record); records[i] = FormRecord.StandInForDeletedRecord(); } else { CommCareApplication.notificationManager().reportNotificationMessage( NotificationMessageFactory.message(ProcessIssues.StorageRemoved), true); throw e; } } catch (IOException e) { Logger.log(LogTypes.TYPE_ERROR_WORKFLOW, "IO Issues processing a form. " + "Tentatively not removing in case they are resolvable|" + getExceptionText(e)); } } } processor.closeBulkSubmit(); return needToSendLogs; }

Target:
private boolean checkFormRecordStatus(FormRecord[] records) throws FileNotFoundException, TaskCancelledException { boolean needToSendLogs = false; processor.beginBulkSubmit(); for (int i = 0; i < records.length; ++i) { if (isCancelled()) { throw new TaskCancelledException(); } FormRecord record = records[i]; if (FormRecord.STATUS_COMPLETE.equals(record.getStatus())) { SQLiteDatabase userDb = CommCareApplication.instance().getUserDbHandle(); try { userDb.beginTransaction(); try { records[i] = processor.process(record); userDb.setTransactionSuccessful(); } finally { userDb.endTransaction(); } } catch (InvalidStructureException | XmlPullParserException | UnfullfilledRequirementsException e) { records[i] = handleExceptionFromFormProcessing(record, e); needToSendLogs = true; } catch (FileNotFoundException e) { if (CommCareApplication.instance().isStorageAvailable()) { Logger.log(LogTypes.TYPE_ERROR_DESIGN, "Removing form record because file was missing|" + getExceptionText(e)); record.logPendingDeletion(TAG, "the xml submission file associated with the record could not be found"); FormRecordCleanupTask.wipeRecord(c, record); records[i] = FormRecord.StandInForDeletedRecord(); } else { CommCareApplication.notificationManager().reportNotificationMessage( NotificationMessageFactory.message(ProcessIssues.StorageRemoved), true); throw e; } } catch (IOException e) { Logger.log(LogTypes.TYPE_ERROR_WORKFLOW, "IO Issues processing a form. " + "Tentatively not removing in case they are resolvable|" + getExceptionText(e)); } } } processor.closeBulkSubmit(); return needToSendLogs; }
Source:
public VmDevice(VmDevice vmDevice) { this.id = vmDevice.id; this.type = vmDevice.type; this.device = vmDevice.device; this.address = vmDevice.address; this.specParams = vmDevice.specParams; this.managed = vmDevice.managed; this.plugged = vmDevice.plugged; this.readOnly = vmDevice.readOnly; this.alias = vmDevice.alias; this.customProperties = vmDevice.customProperties; this.snapshotId = vmDevice.snapshotId; this.logicalName = vmDevice.logicalName; }

Target:
public VmDevice(VmDevice vmDevice) { this( vmDevice.id, vmDevice.type, vmDevice.device, vmDevice.address, vmDevice.specParams, vmDevice.managed, vmDevice.plugged, vmDevice.readOnly, vmDevice.alias, vmDevice.customProperties, vmDevice.snapshotId, vmDevice.logicalName); }
Source:
public SSHKeyPair createSSHKeyPair(final CreateSSHKeyPairCmd cmd) { final Account caller = getCaller(); final String accountName = cmd.getAccountName(); final Long domainId = cmd.getDomainId(); final Long projectId = cmd.getProjectId(); final Account owner = _accountMgr.finalizeOwner(caller, accountName, domainId, projectId); final SSHKeyPairVO s = _sshKeyPairDao.findByName(owner.getAccountId(), owner.getDomainId(), cmd.getName()); if (s != null) { throw new InvalidParameterValueException("A key pair with name '" + cmd.getName() + "' already exists."); } final SSHKeysHelper keys = new SSHKeysHelper(sshKeyLength.value()); final String name = cmd.getName(); if (StringUtils.isBlank(name)) { throw new InvalidParameterValueException("Please specify a valid name for the key pair. The key name can't be empty"); } final String publicKey = keys.getPublicKey(); final String fingerprint = keys.getPublicKeyFingerPrint(); final String privateKey = keys.getPrivateKey(); return createAndSaveSSHKeyPair(name, fingerprint, publicKey, privateKey, owner); }

Target:
public SSHKeyPair createSSHKeyPair(final CreateSSHKeyPairCmd cmd) { final Account caller = getCaller(); final String accountName = cmd.getAccountName(); final Long domainId = cmd.getDomainId(); final Long projectId = cmd.getProjectId(); final String name = cmd.getName(); if (StringUtils.isBlank(name)) { throw new InvalidParameterValueException("Please specify a valid name for the key pair. The key name can't be empty"); } final Account owner = _accountMgr.finalizeOwner(caller, accountName, domainId, projectId); final SSHKeyPairVO s = _sshKeyPairDao.findByName(owner.getAccountId(), owner.getDomainId(), cmd.getName()); if (s != null) { throw new InvalidParameterValueException("A key pair with name '" + cmd.getName() + "' already exists."); } final SSHKeysHelper keys = new SSHKeysHelper(sshKeyLength.value()); final String publicKey = keys.getPublicKey(); final String fingerprint = keys.getPublicKeyFingerPrint(); final String privateKey = keys.getPrivateKey(); return createAndSaveSSHKeyPair(name, fingerprint, publicKey, privateKey, owner); }
Source:
private RpslObjectWithReplacements replaceReferences(final RpslObject object, final Collection<RpslObject> references) { final Map<RpslAttribute, RpslAttribute> replacements = Maps.newHashMap(); for (final RpslAttribute rpslAttribute : object.getAttributes()) { AttributeType rpsAttributeType = rpslAttribute.getType(); if (rpsAttributeType != null) { for (final RpslObject reference : references) { if (rpslAttribute.getCleanValue().equals(reference.getKey()) && (rpsAttributeType.getReferences().contains(ObjectType.PERSON) || rpsAttributeType.getReferences().contains(ObjectType.ROLE))) { replacements.put(rpslAttribute, new RpslAttribute(rpsAttributeType, dummyRole)); } } } } if (replacements.isEmpty()) { return new RpslObjectWithReplacements(object, replacements); } final RpslObjectBuilder builder = new RpslObjectBuilder(object); builder.replaceAttributes(replacements); return new RpslObjectWithReplacements(builder.get(), replacements); }

Target:
private RpslObjectWithReplacements replaceReferences(final RpslObject object, final Collection<RpslObject> references) { final Map<RpslAttribute, RpslAttribute> replacements = Maps.newHashMap(); for (final RpslAttribute rpslAttribute : object.getAttributes()) { final AttributeType attributeType = rpslAttribute.getType(); if (attributeType != null) { for (final RpslObject reference : references) { if (rpslAttribute.getCleanValue().equals(reference.getKey()) && (attributeType.getReferences().contains(ObjectType.PERSON) || attributeType.getReferences().contains(ObjectType.ROLE))) { replacements.put(rpslAttribute, new RpslAttribute(attributeType, dummyRole)); } } } } if (replacements.isEmpty()) { return new RpslObjectWithReplacements(object, replacements); } final RpslObjectBuilder builder = new RpslObjectBuilder(object); builder.replaceAttributes(replacements); return new RpslObjectWithReplacements(builder.get(), replacements); }
Source:
protected void handleError(final Exception e, final String correlationUid, final String organisationIdentification, final String deviceIdentification, final String messageType) { LOGGER.error("Handling error for message type: " + messageType, e); OsgpException osgpException = null; if (e instanceof OsgpException) { osgpException = (OsgpException) e; } else { osgpException = new TechnicalException(ComponentType.DOMAIN_TARIFF_SWITCHING, "An unknown error occurred", e); } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.NOT_OK) .withOsgpException(osgpException).withDataObject(e).build()); }

Target:
protected void handleError(final Exception e, final String correlationUid, final String organisationIdentification, final String deviceIdentification, final String messageType) { LOGGER.error("Handling error for message type: " + messageType, e); OsgpException osgpException = null; if (e instanceof OsgpException) { osgpException = (OsgpException) e; } else { osgpException = new TechnicalException(ComponentType.DOMAIN_TARIFF_SWITCHING, "An unknown error occurred", e); } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.NOT_OK) .withOsgpException(osgpException).withDataObject(e).build(); this.webServiceResponseMessageSender.send(responseMessage); }
Source:
public long getNumberOfPayloads() { try { return jsonPayloadGenerator.getNumberOfPayloads(); } catch (Exception e) { LOGGER.warn("Failed to obtain number of payloads", e); } return PayloadGenerator.UNKNOWN_NUMBER_OF_PAYLOADS; }

Target:
public long getNumberOfPayloads() { return jsonPayloadGenerator.getNumberOfPayloads(); }
Source:
private void addPrefixes(Map<ObjectId, String> nonCommits, FIFORevQueue pending) throws IOException { if (!prefixes.isEmpty()) { for (String prefix : prefixes) addPrefix(prefix, nonCommits, pending); } else addPrefix(Constants.R_REFS, nonCommits, pending); }

Target:
private void addPrefixes(Map<ObjectId, String> nonCommits, FIFORevQueue pending) throws IOException { if (!prefixes.isEmpty()) { for (String prefix : prefixes) addPrefix(prefix, nonCommits, pending); } else if (refs.isEmpty()) addPrefix(Constants.R_REFS, nonCommits, pending); }
Source:
protected synchronized void setLocaleAndBundle(String locale, Bundle bundle, Map<String, ResourceBundle> resourceBundleMap) { this.locale = locale; this.bundle = bundle; this.resourceBundleMap = resourceBundleMap; }

Target:
protected synchronized void setLocaleAndBundle(String locale, Bundle bundle, Map<String, ResourceBundle> resourceBundleMap) { this.locale = locale; this.bundle = bundle; this.resourceBundleCache = resourceBundleMap; }
Source:
protected SootMethod tryResolve(final StringBuilder trace) { SootMethod resolved = Scene.v() .getOrMakeFastHierarchy() .resolveMethod(declaringClass, declaringClass, name, parameterTypes, returnType, true); if (resolved != null) { checkStatic(resolved); return resolved; } if (Scene.v().allowsPhantomRefs() && Options.v().ignore_resolution_errors()) { SootClass classToAddTo = declaringClass; while (classToAddTo != null && !classToAddTo.isPhantom()) { classToAddTo = classToAddTo.getSuperclassUnsafe(); } if (classToAddTo == null) { classToAddTo = declaringClass; } SootMethod method = Scene.v() .makeSootMethod(name, parameterTypes, returnType, isStatic() ? Modifier.STATIC : 0); method.setPhantom(true); method = classToAddTo.getOrAddMethod(method); checkStatic(method); return method; } return null; }

Target:
protected SootMethod tryResolve(final StringBuilder trace) { SootMethod resolved = Scene.v() .getOrMakeFastHierarchy() .resolveMethod(declaringClass, declaringClass, name, parameterTypes, returnType, true); if (resolved != null) { checkStatic(resolved); return resolved; } else if(Scene.v().allowsPhantomRefs()) { SootClass selectedClass = declaringClass; while (selectedClass != null) { if (selectedClass.isPhantom()) { SootMethod phantomMethod = Scene.v().makeSootMethod(name, parameterTypes, returnType, isStatic() ? Modifier.STATIC : 0); phantomMethod.setPhantom(true); phantomMethod = selectedClass.getOrAddMethod(phantomMethod); checkStatic(phantomMethod); return phantomMethod; } selectedClass = selectedClass.getSuperclassUnsafe(); } } if (Scene.v().allowsPhantomRefs() && Options.v().ignore_resolution_errors()) { SootClass classToAddTo = declaringClass; while (classToAddTo != null && !classToAddTo.isPhantom()) { classToAddTo = classToAddTo.getSuperclassUnsafe(); } if (classToAddTo == null) { classToAddTo = declaringClass; } SootMethod method = Scene.v() .makeSootMethod(name, parameterTypes, returnType, isStatic() ? Modifier.STATIC : 0); method.setPhantom(true); method = classToAddTo.getOrAddMethod(method); checkStatic(method); return method; } return null; }
Source:
private CertificateDTO addCertByAlias(List<CertificateDTO> toList, List<CertificateDTO> fromList, String alias){ for(CertificateDTO cert : fromList){ if(StringUtils.isNotEmpty(cert.getAlias()) && StringUtils.isNotEmpty(alias) && cert.getAlias().compareTo(alias)==0){ toList.add(cert); fromList.remove(cert); return cert; } } return null; }

Target:
private CertificateDTO addCertByAlias(List<CertificateDTO> toList, List<CertificateDTO> fromList, String alias){ for(CertificateDTO cert : fromList){ if (StringUtils.isNotEmpty(cert.getAlias()) && StringUtils.isNotEmpty(alias) && cert.getAlias().equals(alias)) { toList.add(0, cert); fromList.remove(cert); return cert; } } return null; }
Source:
public TaskJobEvent(ITask originalTask, ITask task) { this.originalTask = originalTask; this.task = task; }

Target:
public TaskJobEvent(ITask originalTask, ITask task) { this(originalTask, task, null); }
Source:
private void doByteBufferWrite(String cipherClass, boolean withChannel) throws Exception { CounterCryptoOutputStream out = getCryptoOutputStream(cipherClass, defaultBufferSize, withChannel); ByteBuffer buf = ByteBuffer.allocateDirect(dataLen / 2); buf.put(data, 0, dataLen / 2); buf.flip(); int n1 = out.write(buf); buf.clear(); buf.put(data, n1, dataLen / 3); buf.flip(); int n2 = out.write(buf); buf.clear(); buf.put(data, n1 + n2, dataLen - n1 - n2); buf.flip(); int n3 = out.write(buf); Assert.assertEquals(dataLen, n1 + n2 + n3); out.flush(); encData = baos.toByteArray(); InputStream in = getCryptoInputStream(cipherClass, defaultBufferSize, withChannel); buf = ByteBuffer.allocate(dataLen + 100); byteBufferReadCheck(in, buf, 0); in.close(); }

Target:
private void doByteBufferWrite(String cipherClass, boolean withChannel) throws Exception { CTRCryptoOutputStream out = getCryptoOutputStream(cipherClass, defaultBufferSize, withChannel); ByteBuffer buf = ByteBuffer.allocateDirect(dataLen / 2); buf.put(data, 0, dataLen / 2); buf.flip(); int n1 = out.write(buf); buf.clear(); buf.put(data, n1, dataLen / 3); buf.flip(); int n2 = out.write(buf); buf.clear(); buf.put(data, n1 + n2, dataLen - n1 - n2); buf.flip(); int n3 = out.write(buf); Assert.assertEquals(dataLen, n1 + n2 + n3); out.flush(); encData = baos.toByteArray(); InputStream in = getCryptoInputStream(cipherClass, defaultBufferSize, withChannel); buf = ByteBuffer.allocate(dataLen + 100); byteBufferReadCheck(in, buf, 0); in.close(); }
Source:
public void setMessage(String message) { super.setMessage(message); if (message != null && message.length() > 0) { table.setVisible(false); } if (message != null) { messageLabel.setText(message); } }

Target:
public void setMessage(String message) { super.setMessage(message); if (message != null && message.length() > 0) { table.setVisible(false); messageLabel.setText(message); } }
Source:
public void assertRequest(RecordedRequest request, String method, String path, String resourceLocation) { assertRequest(request, method, path); assertJsonRequest(request); JsonParser parser = new JsonParser(); JsonElement requestJson = null, resourceJson; try { requestJson = parser.parse(new String(request.getBody(), "UTF-8")); } catch (Exception e) { Throwables.propagate(e); } resourceJson = parser.parse(stringFromResource(resourceLocation)); assertEquals(requestJson, resourceJson); }

Target:
public void assertRequest(RecordedRequest request, String method, String path, String resourceLocation) { assertRequest(request, method, path); assertContentTypeIsJSON(request); JsonParser parser = new JsonParser(); JsonElement requestJson = null; JsonElement resourceJson; try { requestJson = parser.parse(new String(request.getBody(), "UTF-8")); } catch (Exception e) { Throwables.propagate(e); } resourceJson = parser.parse(stringFromResource(resourceLocation)); assertEquals(requestJson, resourceJson); }
Source:
public HandlerMappingConfiguration(Map<String, Map<String, ?>> handlerMapping, SiteSet siteSet) { this.handlerMapping = handlerMapping; this.siteKeys = ImmutableSet.<String>builder() .addAll(Preconditions.checkNotNull(siteSet).getSiteKeys()) .add(VALUE_NULLSITE) .build(); }

Target:
public HandlerMappingConfiguration(Map<String, Map<String, ?>> handlerMapping, SiteSet siteSet) { this.handlerMapping = handlerMapping != null ? handlerMapping : ImmutableMap.<String, Map<String, ?>>of("", ImmutableMap.<String, Object>of()); this.siteKeys = ImmutableSet.<String>builder() .addAll(siteSet.getSiteKeys()) .add(VALUE_NULLSITE) .build(); }
Source:
public String deleteFromClient() { int clientId = Integer.parseInt(Helper.getRequestParameter("ID")); try { Client client = serviceManager.getClientService().getById(clientId); this.userObject.getClients().remove(client); } catch (DAOException e) { Helper.setErrorMessage(ERROR_DATABASE_READING, new Object[] {Helper.getTranslation("client"), clientId }, logger, e); return null; } return null; }

Target:
public String deleteFromClient() { int clientId = 0; try { clientId = Integer.parseInt(Helper.getRequestParameter("ID")); Client client = serviceManager.getClientService().getById(clientId); this.userObject.getClients().remove(client); } catch (DAOException e) { Helper.setErrorMessage(ERROR_DATABASE_READING, new Object[] {Helper.getTranslation("client"), clientId }, logger, e); return null; } catch (NumberFormatException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } return null; }
Source:
public void removeNode(final RMNodeData rmNodeData) { if (nodeRecoveryDisabled()) { return; } if (rmdbManagerBuffer.canOperateDatabaseSynchronouslyWithNode(rmNodeData)) { try { logger.info("Remove node " + rmNodeData.getName() + " in database"); executeReadWriteTransaction(new SessionWork<Void>() { @Override public Void doInTransaction(Session session) { session.delete(rmNodeData); return null; } }); } catch (RuntimeException e) { throw new RuntimeException("Exception occurred while removing node " + rmNodeData.getName(), e); } } else { logger.info("Request " + RMDBManagerBuffer.class.getSimpleName() + " to remove node " + rmNodeData.getName() + " in database"); rmdbManagerBuffer.addRemoveNodeToPendingDatabaseOperations(rmNodeData); } }

Target:
public void removeNode(final RMNodeData rmNodeData) { if (nodeRecoveryDisabled()) { return; } if (rmdbManagerBuffer.canOperateDatabaseSynchronouslyWithNode(rmNodeData)) { try { logger.info("Remove node " + rmNodeData.getName() + IN_DATABASE_STRING); executeReadWriteTransaction(new SessionWork<Void>() { @Override public Void doInTransaction(Session session) { session.delete(rmNodeData); return null; } }); } catch (RuntimeException e) { throw new RuntimeException("Exception occurred while removing node " + rmNodeData.getName(), e); } } else { logger.debug(REQUEST_BUFFER_STRING + "remove node " + rmNodeData.getName() + IN_DATABASE_STRING); rmdbManagerBuffer.addRemoveNodeToPendingDatabaseOperations(rmNodeData); } }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); if (!S3_LOG.equals(config.logFormat) && !CLF_LOG.equals(config.logFormat) && !CLOUDFRONT_LOG.equals(config.logFormat)) { LOG.error("Log format not currently supported."); throw new IllegalStateException("Unsupported log format: " + config.logFormat); } Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { if (!inputSchema.getType().equals(Schema.Type.RECORD)) { throw new IllegalArgumentException("Only Input Schema of type Schema.Type.RECORD is supported"); } Schema.Field inputNameSchema = inputSchema.getField(config.inputName); try { if (inputNameSchema == null) { throw new IllegalArgumentException( "Invalid inputName, no known inputField matches given input of " + config.inputName); } else if (inputNameSchema.getSchema() == null) { throw new IllegalArgumentException( "Schema for the field" + inputNameSchema.getName() + "is null in inputSchema"); } else { validateInputSchemaType(inputNameSchema.getSchema().getType()); } } catch (IllegalArgumentException e) { LOG.error(e.getMessage()); throw Throwables.propagate(e); } } pipelineConfigurer.getStageConfigurer().setOutputSchema(LOG_SCHEMA); }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) throws IllegalArgumentException { super.configurePipeline(pipelineConfigurer); if (!S3_LOG.equals(config.logFormat) && !CLF_LOG.equals(config.logFormat) && !CLOUDFRONT_LOG.equals(config.logFormat)) { LOG.error("Log format not currently supported."); throw new IllegalStateException("Unsupported log format: " + config.logFormat); } Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { if (!inputSchema.getType().equals(Schema.Type.RECORD)) { throw new IllegalArgumentException("Only Input Schema of type Schema.Type.RECORD is supported"); } Schema.Field inputNameSchema = inputSchema.getField(config.inputName); if (inputNameSchema == null) { throw new IllegalArgumentException("Field " + config.inputName + " is not present in the input schema"); } else { validateInputSchemaType(inputNameSchema.getSchema().getType()); } } pipelineConfigurer.getStageConfigurer().setOutputSchema(LOG_SCHEMA); }
Source:
private void handleMetadataRequest(CorfuMsg msg, ChannelHandlerContext ctx, IServerRouter r) { log.info("Log Replication Metadata Request received by Server."); if (isLeader(msg, r)) { LogReplicationMetadataManager metadataMgr = sinkManager.getLogReplicationMetadataManager(); LogReplicationMetadataResponse response = new LogReplicationMetadataResponse( metadataMgr.getTopologyConfigId(), metadataMgr.getVersion(), metadataMgr.getLastStartedSnapshotTimestamp(), metadataMgr.getLastTransferredSnapshotTimestamp(), metadataMgr.getLastAppliedSnapshotTimestamp(), metadataMgr.getLastProcessedLogEntryTimestamp()); log.info("Send Negotiation response"); sinkManager.reset(); r.sendResponse(msg, CorfuMsgType.LOG_REPLICATION_METADATA_RESPONSE.payloadMsg(response)); } else { log.warn("Dropping metadata request as this node is not the leader."); } }

Target:
private void handleMetadataRequest(CorfuMsg msg, ChannelHandlerContext ctx, IServerRouter r) { log.info("Log Replication Metadata Request received by Server."); if (isLeader(msg, r)) { LogReplicationMetadataManager metadataMgr = sinkManager.getLogReplicationMetadataManager(); LogReplicationMetadataResponse response = new LogReplicationMetadataResponse( metadataMgr.getTopologyConfigId(), metadataMgr.getVersion(), metadataMgr.getLastStartedSnapshotTimestamp(), metadataMgr.getLastTransferredSnapshotTimestamp(), metadataMgr.getLastAppliedSnapshotTimestamp(), metadataMgr.getLastProcessedLogEntryTimestamp()); log.info("Send Metadata response :: {}", response); r.sendResponse(msg, CorfuMsgType.LOG_REPLICATION_METADATA_RESPONSE.payloadMsg(response)); } else { log.warn("Dropping metadata request as this node is not the leader."); } }
Source:
public void testConditionHasDefaultTypeMapping() throws NoSuchFieldException, IllegalAccessException { Field conditionToTypeField = XMPPError.class.getDeclaredField("CONDITION_TO_TYPE"); conditionToTypeField.setAccessible(true); @SuppressWarnings("unchecked") Map<Condition, Type> conditionToTypeMap = (Map<Condition, Type>) conditionToTypeField.get(null); assertEquals("CONDITION_TO_TYPE map is likely out of sync with Condition enum", Condition.values().length, conditionToTypeMap.size()); }

Target:
public void testConditionHasDefaultTypeMapping() throws NoSuchFieldException, IllegalAccessException { Map<Condition, Type> conditionToTypeMap = XMPPError.CONDITION_TO_TYPE; assertEquals("CONDITION_TO_TYPE map is likely out of sync with Condition enum", Condition.values().length, conditionToTypeMap.size()); }
Source:
public static void main(String[] args) { ZipkinTraceExporter.createAndRegister("http://localhost:9411/api/v2/spans", "tracing-to-zipkin-service"); TraceConfig traceConfig = Tracing.getTraceConfig(); TraceParams activeTraceParams = traceConfig.getActiveTraceParams(); traceConfig.updateActiveTraceParams(activeTraceParams.toBuilder().setSampler(Samplers.alwaysSample()).build()); Tracer tracer = Tracing.getTracer(); Scope scope = tracer.spanBuilder("user-parent-span").startScopedSpan(); try { QueueClient queueClient = new QueueClientBuilder() .endpoint(String.format("<LINK_0>", ACCOUNT_NAME, QUEUE_NAME, SAS_TOKEN)) .buildClient(); Context tracingContext = new Context(OPENCENSUS_SPAN_KEY, tracer.getCurrentSpan()); queueClient.createWithResponse(null, null, tracingContext); queueClient.enqueueMessageWithResponse("This is message 1", null, null, null, tracingContext); queueClient.enqueueMessageWithResponse("This is message 2", null, null, null, tracingContext); System.out.println("Enqueuing of messages has completed!"); } finally { scope.close(); } Tracing.getExportComponent().shutdown(); }

Target:
public static void main(String[] args) { ZipkinTraceExporter.createAndRegister("http://localhost:9411/api/v2/spans", "tracing-to-zipkin-service"); TraceConfig traceConfig = Tracing.getTraceConfig(); TraceParams activeTraceParams = traceConfig.getActiveTraceParams(); traceConfig.updateActiveTraceParams(activeTraceParams.toBuilder().setSampler(Samplers.alwaysSample()).build()); Tracer tracer = Tracing.getTracer(); Scope scope = tracer.spanBuilder("user-parent-span").startScopedSpan(); try { QueueClient queueClient = new QueueClientBuilder() .endpoint(String.format("<LINK_0>", ACCOUNT_NAME, QUEUE_NAME, "<GENERATED_SAS_TOKEN>")) .buildClient(); Context tracingContext = new Context(OPENCENSUS_SPAN_KEY, tracer.getCurrentSpan()); queueClient.createWithResponse(null, null, tracingContext); queueClient.enqueueMessageWithResponse("This is message 1", null, null, null, tracingContext); queueClient.enqueueMessageWithResponse("This is message 2", null, null, null, tracingContext); System.out.println("Enqueuing of messages has completed!"); } finally { scope.close(); Tracing.getExportComponent().shutdown(); } }
Source:
public void configure(Map configurationValues) { OptionsService optionsService = serviceRegistry.getService( OptionsService.class ); ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class ); ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService ); try { this.config = new RedisConfiguration( propertyReader ); } catch (Exception e) { throw log.unableToConfigureDatastoreProvider( e ); } this.config.initConfiguration( configurationValues ); }

Target:
public void configure(Map configurationValues) { ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class ); ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationValues, classLoaderService ); try { this.config = new RedisConfiguration( propertyReader ); } catch (Exception e) { throw log.unableToConfigureDatastoreProvider( e ); } }
Source:
static GeoIPCookie unmarshal(@Nullable String cookie) { if (TextUtils.isEmpty(cookie)) { return new GeoIPCookie(); } String[] components = cookie.split(":"); if (components.length < Component.values().length || !components[Component.VERSION.ordinal()].equals("v4")) { return new GeoIPCookie(); } Location location = new Location(""); try { location.setLatitude(Double.parseDouble(components[Component.LATITUDE.ordinal()])); location.setLongitude(Double.parseDouble(components[Component.LONGITUDE.ordinal()])); } catch (NumberFormatException e) { L.w(e); location = null; } return new GeoIPCookie(components[Component.COUNTRY.ordinal()], components[Component.REGION.ordinal()], components[Component.CITY.ordinal()], location); }

Target:
static GeoIPCookie unmarshal(@Nullable String cookie) throws IllegalArgumentException { if (TextUtils.isEmpty(cookie)) { throw new IllegalArgumentException("Cookie is empty."); } String[] components = cookie.split(":"); if (components.length < Component.values().length) { throw new IllegalArgumentException("Cookie is malformed."); } else if (!components[Component.VERSION.ordinal()].equals("v4")) { throw new IllegalArgumentException("Incorrect cookie version."); } Location location = null; if (!TextUtils.isEmpty(components[Component.LATITUDE.ordinal()]) && !TextUtils.isEmpty(components[Component.LONGITUDE.ordinal()])) { location = new Location(""); try { location.setLatitude(Double.parseDouble(components[Component.LATITUDE.ordinal()])); location.setLongitude(Double.parseDouble(components[Component.LONGITUDE.ordinal()])); } catch (NumberFormatException e) { throw new IllegalArgumentException("Location is malformed."); } } return new GeoIPCookie(components[Component.COUNTRY.ordinal()], components[Component.REGION.ordinal()], components[Component.CITY.ordinal()], location); }
Source:
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) { Log_OC.d(TAG, "Received result of operation in FileActivity - common behaviour for all the " + "FileActivities "); mFileOperationsHelper.setOpIdWaitingFor(Long.MAX_VALUE); dismissLoadingDialog(); if (!result.isSuccess() && ( result.getCode() == ResultCode.UNAUTHORIZED || (result.isException() && result.getException() instanceof AuthenticatorException) )) { requestCredentialsUpdate(); if (result.getCode() == ResultCode.UNAUTHORIZED) { showSnackMessage( ErrorMessageAdapter.Companion.getResultMessage(result, operation, getResources()) ); } } else if (!result.isSuccess() && ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(result.getCode())) { showUntrustedCertDialog(result); } else if (operation == null || operation instanceof SynchronizeFolderOperation ) { if (result.isSuccess()) { updateFileFromDB(); } else if (result.getCode() != ResultCode.CANCELLED) { showSnackMessage( ErrorMessageAdapter.Companion.getResultMessage(result, operation, getResources()) ); } } else if (operation instanceof SynchronizeFileOperation) { onSynchronizeFileOperationFinish((SynchronizeFileOperation) operation, result); } else if (operation instanceof RenameFileOperation && result.isSuccess()) { result.getData(); } }

Target:
public void onRemoteOperationFinish(RemoteOperation operation, RemoteOperationResult result) { Timber.d("Received result of operation in FileActivity - common behaviour for all the FileActivities"); mFileOperationsHelper.setOpIdWaitingFor(Long.MAX_VALUE); dismissLoadingDialog(); if (!result.isSuccess() && ( result.getCode() == ResultCode.UNAUTHORIZED || (result.isException() && result.getException() instanceof AuthenticatorException) )) { requestCredentialsUpdate(); if (result.getCode() == ResultCode.UNAUTHORIZED) { showSnackMessage( ErrorMessageAdapter.Companion.getResultMessage(result, operation, getResources()) ); } } else if (!result.isSuccess() && ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED.equals(result.getCode())) { showUntrustedCertDialog(result); } else if (operation == null || operation instanceof SynchronizeFolderOperation ) { if (result.isSuccess()) { updateFileFromDB(); } else if (result.getCode() != ResultCode.CANCELLED) { showSnackMessage( ErrorMessageAdapter.Companion.getResultMessage(result, operation, getResources()) ); } } else if (operation instanceof SynchronizeFileOperation) { onSynchronizeFileOperationFinish((SynchronizeFileOperation) operation, result); } else if (operation instanceof RenameFileOperation && result.isSuccess()) { result.getData(); } }
Source:
private void populateLabels() { EntityRef building = buildingUpgradeSystem.getBuildingToUpgrade(); ConstructedBuildingComponent buildingComponent = building.getComponent(ConstructedBuildingComponent.class); if (buildingComponent == null) { logger.info("component null"); return; } buildingName.setText(buildingComponent.buildingType.toString()); buildingLevel.setText("" + buildingComponent.currentLevel); }

Target:
private void populateLabels() { EntityRef building = buildingUpgradeSystem.getBuildingToUpgrade(); ConstructedBuildingComponent buildingComponent = building.getComponent(ConstructedBuildingComponent.class); if (buildingComponent == null) { logger.info("ConstructedBuildingComponent null"); return; } buildingName.setText(buildingComponent.buildingType.toString()); buildingLevel.setText("" + buildingComponent.currentLevel); }
Source:
public boolean contains(Object o) { boolean contains = super.contains(o); if (!contains && o != null) { MarshalledEntry<K, V> me = persistenceManager.loadFromAllStores(o, true); contains = me != null; } return contains; }

Target:
public boolean contains(Object o) { boolean contains = false; if (o != null) { contains = super.contains(o); if (!contains) { MarshalledEntry<K, V> me = persistenceManager.loadFromAllStores(o, true); contains = me != null; } } return contains; }
Source:
public static void main(String[] args) throws Exception { Crypto crypto = Crypto.initJava(); NetworkAccess network = NetworkAccess.buildJava(new URL("<LINK_0>")).get(); List<String> usernames = network.coreNode.getUsernames("").get(); List<Summary> summaries = usernames.stream().parallel().flatMap(username -> { try { List<UserPublicKeyLink> chain = network.coreNode.getChain(username).get(); UserPublicKeyLink last = chain.get(chain.size() - 1); LocalDate expiry = last.claim.expiry; Set<PublicKeyHash> ownedKeysRecursive = WriterData.getOwnedKeysRecursive(username, network.coreNode, network.mutable, network.dhtClient); long total = 0; for (PublicKeyHash writer : ownedKeysRecursive) { MaybeMultihash target = network.mutable.getPointerTarget(writer, network.dhtClient).get(); if (target.isPresent()) total += network.dhtClient.getRecursiveBlockSize(target.get()).get(); } String summary = "User: " + username + ", expiry: " + expiry + " usage: " + total + "\n"; LOG.info(summary); return Stream.of(new Summary(username, expiry, total)); } catch (Exception e) { LOG.severe("Error for " + username); LOG.log(Level.WARNING, e.getMessage(), e); return Stream.empty(); } }).collect(Collectors.toList()); summaries.sort((a, b) -> (int) (b.usage - a.usage)); summaries.forEach(System.out::println); }

Target:
public static void main(String[] args) throws Exception { Crypto crypto = Crypto.initJava(); NetworkAccess network = NetworkAccess.buildJava(new URL("<LINK_0>")).get(); List<String> usernames = network.coreNode.getUsernames("").get(); List<Summary> summaries = usernames.stream().parallel().flatMap(username -> { try { List<UserPublicKeyLink> chain = network.coreNode.getChain(username).get(); UserPublicKeyLink last = chain.get(chain.size() - 1); LocalDate expiry = last.claim.expiry; Set<PublicKeyHash> ownedKeysRecursive = WriterData.getOwnedKeysRecursive(username, network.coreNode, network.mutable, network.dhtClient); long total = 0; for (PublicKeyHash writer : ownedKeysRecursive) { MaybeMultihash target = network.mutable.getPointerTarget(writer, network.dhtClient).get(); if (target.isPresent()) total += network.dhtClient.getRecursiveBlockSize(target.get()).get(); } String summary = "User: " + username + ", expiry: " + expiry + " usage: " + total + "\n"; System.out.println(summary); return Stream.of(new Summary(username, expiry, total)); } catch (Exception e) { System.err.println("Error for " + username); e.printStackTrace(); return Stream.empty(); } }).collect(Collectors.toList()); summaries.sort((a, b) -> (int) (b.usage - a.usage)); summaries.forEach(System.out::println); }
Source:
public void testProcessNodeForUnchangedEntity(String key, Object base, Object update) { Owner owner = TestUtil.createOwner(); String id = TestUtil.randomString("test_id"); Content existing = this.createPopulatedExistingEntity(id, key, base); ContentInfo imported = this.createPopulatedImportedEntity(id, key, base); MergeValidator<ContentInfo> validator = this.validators.get(key); EntityNode<Content, ContentInfo> node = new ContentNode(owner, id) .setExistingEntity(existing) .setImportedEntity(imported); ContentNodeVisitor visitor = this.buildContentNodeVisitor(); assertFalse(node.visited()); assertFalse(node.changed()); assertNull(node.getMergedEntity()); visitor.processNode(this.mockNodeProcessor, this.mockNodeMapper, node); visitor.complete(); assertTrue(node.visited()); assertFalse(node.changed()); assertNull(node.getMergedEntity()); }

Target:
public void testProcessNodeForUnchangedEntity(String key, Object base, Object update) { Owner owner = TestUtil.createOwner(); String id = TestUtil.randomString("test_id"); Content existing = this.createPopulatedExistingEntity(id, key, base); ContentInfo imported = this.createPopulatedImportedEntity(id, key, base); EntityNode<Content, ContentInfo> node = new ContentNode(owner, id) .setExistingEntity(existing) .setImportedEntity(imported); ContentNodeVisitor visitor = this.buildContentNodeVisitor(); assertFalse(node.visited()); assertFalse(node.changed()); assertNull(node.getMergedEntity()); visitor.processNode(this.mockNodeProcessor, this.mockNodeMapper, node); visitor.complete(); assertFalse(node.changed()); assertNull(node.getMergedEntity()); verify(this.mockContentCurator, never()).saveOrUpdate(any(Content.class)); }
Source:
public void addRemoteCatalog(String catalogFileURL, String description, boolean verify) { new PushButton(ADD_REMOTE_CATALOG).click(); new WaitUntil(new ShellWithTextIsAvailable(REMOTE_CATALOG_SHELL), TimePeriod.NORMAL); new DefaultCombo().setText(catalogFileURL); new LabeledText(CATALOG_DESCRIPTION).setText(description); if (verify) { new PushButton(VERIFY_BUTTON).click(); } new OkButton().click(); }

Target:
public String addRemoteCatalog(String catalogFileURL, String description, boolean verify) { String verificationResult = ""; new PushButton(ADD_REMOTE_CATALOG).click(); new WaitUntil(new ShellWithTextIsAvailable(REMOTE_CATALOG_SHELL), TimePeriod.NORMAL); new DefaultCombo().setText(catalogFileURL); new LabeledText(CATALOG_DESCRIPTION).setText(description); if (verify) { verificationResult = verifyURL(); } log.info(verificationResult); new OkButton().click(); return verificationResult; }