auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static File getPathForFeature(FeatureNameType featureName) { switch(featureName) { case COMMANDLOG : return new File(VoltDB.instance().getCommandLogPath()); case COMMANDLOGSNAPSHOT : return new File(VoltDB.instance().getCommandLogSnapshotPath()); case DROVERFLOW: return new File(VoltDB.instance().getDROverflowPath()); case EXPORTOVERFLOW: return new File(VoltDB.instance().getExportOverflowPath()); case SNAPSHOTS: return new File(VoltDB.instance().getSnapshotPath()); default: return null; } }

Target:
private static VoltFile getPathForFeature(FeatureNameType featureName) { switch(featureName) { case COMMANDLOG : return new VoltFile(VoltDB.instance().getCommandLogPath()); case COMMANDLOGSNAPSHOT : return new VoltFile(VoltDB.instance().getCommandLogSnapshotPath()); case DROVERFLOW: return new VoltFile(VoltDB.instance().getDROverflowPath()); case EXPORTOVERFLOW: return new VoltFile(VoltDB.instance().getExportOverflowPath()); case SNAPSHOTS: return new VoltFile(VoltDB.instance().getSnapshotPath()); default: return null; } }
Source:
int length() { return (int) Math.pow( 2, dimension ); }

Target:
final int length() { return (int) Math.pow( 2, dimension ); }
Source:
private void handleCandidateUsed(JingleS5BTransportInfoElement info, JingleElement wrapping) { JingleManager jingleManager = getParent().getParent().getJingleManager(); String candidateId = ((JingleS5BTransportInfoElement.CandidateUsed) info).getCandidateId(); if (theirSelectedCandidate != null) { try { jingleManager.getConnection().sendStanza(JingleElement.createJingleErrorOutOfOrder(wrapping)); } catch (SmackException.NotConnectedException | InterruptedException e) { LOGGER.log(Level.SEVERE, "Could not respond to candidate-used transport-info.", e); } return; } for (JingleTransportCandidate<?> jingleTransportCandidate : getOurCandidates()) { JingleS5BTransportCandidate candidate = (JingleS5BTransportCandidate) jingleTransportCandidate; if (candidate.getCandidateId().equals(candidateId)) { theirSelectedCandidate = candidate; } } if (theirSelectedCandidate == null) { LOGGER.log(Level.SEVERE, "Unknown candidateID."); return; } connectIfReady(); }

Target:
private void handleCandidateUsed(JingleS5BTransportInfoElement info, JingleElement wrapping) { JingleManager jingleManager = getParent().getParent().getJingleManager(); String candidateId = ((JingleS5BTransportInfoElement.CandidateUsed) info).getCandidateId(); if (theirSelectedCandidate != null) { try { jingleManager.getConnection().sendStanza(JingleElement.createJingleErrorOutOfOrder(wrapping)); } catch (SmackException.NotConnectedException | InterruptedException e) { LOGGER.log(Level.SEVERE, "Could not respond to candidate-used transport-info.", e); } return; } for (JingleTransportCandidate<?> jingleTransportCandidate : getOurCandidates()) { JingleS5BTransportCandidate candidate = (JingleS5BTransportCandidate) jingleTransportCandidate; if (candidate.getCandidateId().equals(candidateId)) { theirSelectedCandidate = candidate; } } if (theirSelectedCandidate == null) { LOGGER.log(Level.SEVERE, "Unknown candidateID: " + ((JingleS5BTransportInfoElement.CandidateUsed) info).getCandidateId()); return; } connectIfReady(); }
Source:
private List<String> findCustomClassesInIBFile(File file) throws XMLStreamException, IOException { List<String> customClasses = new ArrayList<>(); FileInputStream fis = FileUtils.openInputStream(file); XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader reader = factory.createXMLStreamReader(fis); while (reader.hasNext()) { int event = reader.next(); switch (event) { case XMLStreamConstants.START_ELEMENT: switch (reader.getLocalName()) { case "viewController": case "view": case "placeholder": String customClass = reader.getAttributeValue(null, "customClass"); if (customClass != null && !customClass.trim().isEmpty()) { customClasses.add(customClass); } break; } break; } } reader.close(); fis.close(); return customClasses; }

Target:
private List<String> findCustomClassesInIBFile(File file) throws XMLStreamException, IOException { List<String> customClasses = new ArrayList<>(); try (FileInputStream fis = FileUtils.openInputStream(file)) { XMLInputFactory factory = XMLInputFactory.newInstance(); XMLStreamReader reader = factory.createXMLStreamReader(fis); while (reader.hasNext()) { int event = reader.next(); switch (event) { case XMLStreamConstants.START_ELEMENT: switch (reader.getLocalName()) { case "viewController": case "view": case "placeholder": String customClass = reader.getAttributeValue(null, "customClass"); if (customClass != null && !customClass.trim().isEmpty()) { customClasses.add(customClass); } break; } break; } } reader.close(); } return customClasses; }
Source:
public void showOfflineError(final RefreshListener listener) { showError(R.string.offline_text, FontAwesomeIcons.fa_wifi, R.string.lbl_reload, Snackbar.LENGTH_INDEFINITE, new View.OnClickListener() { @Override public void onClick(View v) { if (NetworkUtil.isConnected(MainApplication.application)) { listener.onRefresh(); hideError(); } } }); }

Target:
public void showOfflineError(final RefreshListener listener) { showError(R.string.offline_text, FontAwesomeIcons.fa_wifi, R.string.lbl_reload, new View.OnClickListener() { @Override public void onClick(View v) { if (NetworkUtil.isConnected(MainApplication.application)) { listener.onRefresh(); hideError(); } } }); }
Source:
public void updateModel(@Nullable ISegmentStore<ISegment> dataInput) { TmfTimeRange currentRange = TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange(); long currentStart = currentRange.getStartTime().toNanos(); long currentEnd = currentRange.getEndTime().toNanos(); if (dataInput == null) { if (!getDisplay().isDisposed()) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { clearContent(); } }); } fDisplayData = Collections.emptyList(); } else { fDisplayData = dataInput.getIntersectingElements(currentStart, currentEnd, SegmentComparators.INTERVAL_START_COMPARATOR); } setWindowRange(currentStart, currentEnd); updateContent(); }

Target:
public void updateModel(@Nullable ISegmentStore<ISegment> dataInput) { TmfTimeRange currentRange = TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange(); long currentStart = currentRange.getStartTime().toNanos(); long currentEnd = currentRange.getEndTime().toNanos(); if (dataInput == null) { if (!getDisplay().isDisposed()) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { clearContent(); } }); } fDisplayData = Collections.emptyList(); } setWindowRange(currentStart, currentEnd); updateContent(); }
Source:
public void createQueue() { RabbitAdmin admin = new RabbitAdmin(connectionFactory); Queue sourceQueue = new Queue(queue); admin.declareQueue(sourceQueue); TopicExchange exchange = new TopicExchange(DEFAULT_EXCHANGE); admin.declareExchange(exchange); admin.declareBinding( BindingBuilder.bind(sourceQueue).to(exchange).with("foo." + queue)); }

Target:
public void createQueue() { RabbitAdmin admin = new RabbitAdmin(connectionFactory); Queue sourceQueue = new Queue(queue, false, false, true); admin.declareQueue(sourceQueue); TopicExchange exchange = new TopicExchange(DEFAULT_EXCHANGE); admin.declareExchange(exchange); admin.declareBinding( BindingBuilder.bind(sourceQueue).to(exchange).with("rabbitfixture.*")); }
Source:
protected void executeQueryCommand() { Map<String, Object> response = SSOOAuthServiceUtils.getAvailableNamespaces( getSessionDataContainer().getSsoAccessToken(getParameters().getSessionId())); Map<String, List<String>> namespacesMap = new HashMap<>(); if (response.containsKey("result")) { namespacesMap = (Map<String, List<String>>) response.get("result"); } for (List<String> entry : namespacesMap.values()) { Collections.sort(entry); } setReturnValue(namespacesMap); }

Target:
protected void executeQueryCommand() { Map<String, List<String>> namespacesMap = (Map<String, List<String>>) SSOOAuthServiceUtils .getAvailableNamespaces(getSessionDataContainer().getSsoAccessToken(getParameters().getSessionId())) .get("result"); if (namespacesMap != null) { namespacesMap.values().forEach(Collections::sort); } setReturnValue(namespacesMap == null ? Collections.emptyMap() : namespacesMap); }
Source:
public static DataTypes getDataType (String value) { if (!UtilMethods.isSet(value) || value.contains("_divider") || value.contains("binary") || value.contains("_tab") || value .contains("constant")) { return SYSTEM; } value = value.replaceAll("[0-9]", ""); DataTypes[] types = DataTypes.values(); for (DataTypes type : types) { if (type.value.equals(value.toLowerCase())) return type; } return SYSTEM; }

Target:
public static DataTypes getDataType (String value) { if (!UtilMethods.isSet(value) || value.contains("_divider") || value.contains("binary") || value.contains("_tab") || value .contains("constant")) { return SYSTEM; } value = value.replaceAll("[0-9]", ""); DataTypes[] types = DataTypes.values(); for (DataTypes type : types) { if (type.value.equalsIgnoreCase(value)) return type; } return SYSTEM; }
Source:
public String halfOuterJoinResultSetMethodName() { return "getBroadcastLeftOuterJoinResultSet"; }

Target:
public String halfOuterJoinResultSetMethodName() { throw new UnsupportedOperationException("Cross join doesn't support half outer join"); }
Source:
public UnstagedComparator(boolean sortAlphabetically) { this.alphabeticallySort = sortAlphabetically; }

Target:
private UnstagedComparator(boolean sortAlphabetically) { this.alphabeticallySort = sortAlphabetically; }
Source:
private void forwardAckToOtherReplicas(long uso, int tuplesSent) { Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get(); Mailbox mbx = p.getFirst(); if (mbx != null && p.getSecond().size() > 0) { final int msgLen = 4 + 4 + m_signatureBytes.length + 8 + 4; ByteBuffer buf = ByteBuffer.allocate(msgLen); buf.put(ExportManager.RELEASE_BUFFER); buf.putInt(m_partitionId); buf.putInt(m_signatureBytes.length); buf.put(m_signatureBytes); buf.putLong(uso); buf.putInt(tuplesSent); BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[0], buf.array()); for( Long siteId: p.getSecond()) { mbx.send(siteId, bpm); } if (exportLog.isDebugEnabled()) { exportLog.debug("Send RELEASE_BUFFER " + toString() + " with uso " + uso + " from " + CoreUtils.hsIdToString(mbx.getHSId()) + " to " + CoreUtils.hsIdCollectionToString(p.getSecond())); } } }

Target:
private void forwardAckToOtherReplicas(long uso, int tuplesSent) { Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get(); Mailbox mbx = p.getFirst(); if (mbx != null && p.getSecond().size() > 0) { final int msgLen = 1 + 4 + 4 + m_signatureBytes.length + 8 + 4; ByteBuffer buf = ByteBuffer.allocate(msgLen); buf.put(ExportManager.RELEASE_BUFFER); buf.putInt(m_partitionId); buf.putInt(m_signatureBytes.length); buf.put(m_signatureBytes); buf.putLong(uso); buf.putInt(tuplesSent); BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[0], buf.array()); for( Long siteId: p.getSecond()) { mbx.send(siteId, bpm); } if (exportLog.isDebugEnabled()) { exportLog.debug("Send RELEASE_BUFFER " + toString() + " with uso " + uso + " from " + CoreUtils.hsIdToString(mbx.getHSId()) + " to " + CoreUtils.hsIdCollectionToString(p.getSecond())); } } }
Source:
protected void configure() { super.configure(); bind(new TypeLiteral<ComputeServiceAdapter<Droplet, Size, Image, Region>>() { }).to(DigitalOceanComputeServiceAdapter.class); bind(new TypeLiteral<Function<Droplet, NodeMetadata>>() { }).to(DropletToNodeMetadata.class); bind(new TypeLiteral<Function<Image, org.jclouds.compute.domain.Image>>() { }).to(ImageToImage.class); bind(new TypeLiteral<Function<Region, Location>>() { }).to(RegionToLocation.class); bind(new TypeLiteral<Function<Size, Hardware>>() { }).to(SizeToHardware.class); bind(new TypeLiteral<Function<Droplet.Status, Status>>() { }).to(DropletStatusToStatus.class); install(new LocationsFromComputeServiceAdapterModule<Droplet, Size, Image, Region>() { }); bind(CreateNodesInGroupThenAddToSet.class).to(CreateKeyPairsBeforeCreatingNodes.class); bind(TemplateOptions.class).to(DigitalOceanTemplateOptions.class); bind(TemplateOptionsToStatement.class).to(TemplateOptionsToStatementWithoutPublicKey.class); bind(new TypeLiteral<ImageExtension>() { }).to(DigitalOceanImageExtension.class); }

Target:
protected void configure() { super.configure(); bind(new TypeLiteral<ComputeServiceAdapter<Droplet, Size, Image, Region>>() { }).to(DigitalOceanComputeServiceAdapter.class); bind(new TypeLiteral<Function<Droplet, NodeMetadata>>() { }).to(DropletToNodeMetadata.class); bind(new TypeLiteral<Function<Image, org.jclouds.compute.domain.Image>>() { }).to(ImageToImage.class); bind(new TypeLiteral<Function<Region, Location>>() { }).to(RegionToLocation.class); bind(new TypeLiteral<Function<Size, Hardware>>() { }).to(SizeToHardware.class); bind(new TypeLiteral<Function<Droplet.Status, Status>>() { }).to(DropletStatusToStatus.class); install(new LocationsFromComputeServiceAdapterModule<Droplet, Size, Image, Region>() { }); bind(CreateNodesInGroupThenAddToSet.class).to(CreateKeyPairsThenCreateNodes.class); bind(TemplateOptions.class).to(DigitalOceanTemplateOptions.class); bind(TemplateOptionsToStatement.class).to(TemplateOptionsToStatementWithoutPublicKey.class); bind(new TypeLiteral<ImageExtension>() { }).to(DigitalOceanImageExtension.class); }
Source:
Optional<MemorySegment> getUnconsumedSegment() throws IOException { final int position = lengthBuffer.position(); if (position > 0) { MemorySegment segment = MemorySegmentFactory.allocateUnpooledSegment(position); lengthBuffer.position(0); segment.put(0, lengthBuffer, position); return Optional.of(segment); } if (recordLength > THRESHOLD_FOR_SPILLING) { throw new UnsupportedOperationException("Unaligned checkpoint currently do not support spilled " + "records."); } else if (recordLength != -1) { int leftOverSize = leftOverLimit - leftOverStart; int unconsumedSize = Integer.BYTES + accumulatedRecordBytes + leftOverSize; DataOutputSerializer serializer = new DataOutputSerializer(unconsumedSize); serializer.writeInt(recordLength); serializer.write(buffer, 0, accumulatedRecordBytes); if (leftOverSize > 0) { serializer.write(checkNotNull(leftOverData), leftOverStart, leftOverSize); } MemorySegment segment = MemorySegmentFactory.allocateUnpooledSegment(unconsumedSize); segment.put(0, serializer.getSharedBuffer(), 0, segment.size()); return Optional.of(segment); } return Optional.empty(); }

Target:
Optional<MemorySegment> getUnconsumedSegment() throws IOException { final int position = lengthBuffer.position(); if (position > 0) { MemorySegment segment = MemorySegmentFactory.allocateUnpooledSegment(position); lengthBuffer.position(0); segment.put(0, lengthBuffer, position); return Optional.of(segment); } if (recordLength > THRESHOLD_FOR_SPILLING) { throw new UnsupportedOperationException("Unaligned checkpoint currently do not support spilled " + "records."); } else if (recordLength != -1) { int leftOverSize = leftOverLimit - leftOverStart; int unconsumedSize = Integer.BYTES + accumulatedRecordBytes + leftOverSize; DataOutputSerializer serializer = new DataOutputSerializer(unconsumedSize); serializer.writeInt(recordLength); serializer.write(buffer, 0, accumulatedRecordBytes); if (leftOverSize > 0) { serializer.write(leftOverData, leftOverStart, leftOverSize); } MemorySegment segment = MemorySegmentFactory.allocateUnpooledSegment(unconsumedSize); segment.put(0, serializer.getSharedBuffer(), 0, segment.size()); return Optional.of(segment); } return Optional.empty(); }
Source:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseAttributes courseAttributes = logic.getCourse(courseId); if (courseAttributes == null) { throw new EntityNotFoundException(new EntityDoesNotExistException("No course with id: " + courseId)); } return new JsonResult(new CourseData(courseAttributes)); }

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseAttributes courseAttributes = logic.getCourse(courseId); if (courseAttributes == null) { return new JsonResult("No course with id: " + courseId, HttpStatus.SC_NOT_FOUND); } return new JsonResult(new CourseData(courseAttributes)); }
Source:
public void testRectangularMouseZoomWithSynchronizedDecorator() { DiagramEditPart diagramPart = openDiagramEditorAndCheckDecorator(); SWTBotGefEditPart paletteRootEditPartBot = editor.getPaletteRootEditPartBot(); SWTBotGefEditPart swtBotGefEditPart = null; swtBotGefEditPart = paletteRootEditPartBot.children().iterator().next().children().get(0).children().get(1); assertEquals("The wrong tool is used.", "ToolEntryEditPart( Palette Entry (Zoom In) )", swtBotGefEditPart.part().toString()); EditPart part = swtBotGefEditPart.part(); final PaletteViewer viewer = (PaletteViewer) swtBotGefEditPart.part().getViewer(); final ToolEntry toolEntry = (ToolEntry) part.getModel(); DiagramMouseZoomTest diagramMouseZoomTest = new DiagramMouseZoomTest(); PaletteButtonActivation paletteButtonActivation = diagramMouseZoomTest.new PaletteButtonActivation(viewer, toolEntry); editor.bot().getDisplay().asyncExec(paletteButtonActivation); editor.drag(new Point(0, 0), new Point(176, 176)); checkExpected(diagramPart); }

Target:
public void testRectangularMouseZoomWithSynchronizedDecorator() { DiagramEditPart diagramPart = openDiagramEditorAndCheckDecorator(); SWTBotGefEditPart paletteRootEditPartBot = editor.getPaletteRootEditPartBot(); SWTBotGefEditPart swtBotGefEditPart = null; swtBotGefEditPart = paletteRootEditPartBot.children().iterator().next().children().get(0).children().get(1); assertEquals("The wrong tool is used.", "ToolEntryEditPart( Palette Entry (Zoom In) )", swtBotGefEditPart.part().toString()); EditPart part = swtBotGefEditPart.part(); final PaletteViewer viewer = (PaletteViewer) swtBotGefEditPart.part().getViewer(); final ToolEntry toolEntry = (ToolEntry) part.getModel(); editor.bot().getDisplay().asyncExec(() -> { viewer.setActiveTool(toolEntry); }); editor.drag(new Point(0, 0), new Point(176, 176)); checkExpected(diagramPart); }
Source:
ParallelEventsManager(final boolean syncOnTimeSteps, final boolean oneThreadPerHandler, final int numOfThreads,final int eventsQueueSize) { this.syncOnTimeSteps = syncOnTimeSteps; this.oneThreadPerHandler = oneThreadPerHandler; this.numOfThreads = numOfThreads; this.eventsHandlers = new ArrayList<EventHandler>(); this.eventsArraySize = syncOnTimeSteps ? 512 : 32768; this.eventsQueueSize = eventsQueueSize; this.eventQueue = new ArrayBlockingQueue<>(1048576 * 64); this.uncaughtExceptionHandler = new ExceptionHandler(); }

Target:
ParallelEventsManager(final boolean syncOnTimeSteps, final boolean oneThreadPerHandler, final int numOfThreads,final int eventsQueueSize) { this.syncOnTimeSteps = syncOnTimeSteps; this.oneThreadPerHandler = oneThreadPerHandler; this.numOfThreads = numOfThreads; this.eventsHandlers = new ArrayList<EventHandler>(); this.eventsArraySize = syncOnTimeSteps ? 512 : 32768; this.eventsQueueSize = eventsQueueSize; this.eventQueue = new ArrayBlockingQueue<>(eventsQueueSize); this.uncaughtExceptionHandler = new ExceptionHandler(); }
Source:
public SELF isBeforeOrEqualTo(LocalDateTime other) { Objects.instance().assertNotNull(info, actual); assertLocalDateTimeParameterIsNotNull(other); comparables.assertIsBeforeOrEqualTo(info, actual, other); return myself; }

Target:
public SELF isBeforeOrEqualTo(LocalDateTime other) { assertLocalDateTimeParameterIsNotNull(other); comparables.assertIsBeforeOrEqualTo(info, actual, other); return myself; }
Source:
TreeWalk fakeWalk(final String path) throws IOException { TreeWalk ret = new TreeWalk((ObjectReader) null); ret.reset(); ret.setRecursive(true); DirCache dc = DirCache.newInCore(); DirCacheEditor dce = dc.editor(); dce.add(new DirCacheEditor.PathEdit(path) { public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); } }); dce.finish(); ret.addTree(new DirCacheIterator(dc)); ret.next(); return ret; }

Target:
TreeWalk fakeWalk(final String path) throws IOException { DirCache dc = DirCache.newInCore(); DirCacheEditor dce = dc.editor(); dce.add(new DirCacheEditor.PathEdit(path) { public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); } }); dce.finish(); TreeWalk ret = new TreeWalk((ObjectReader) null); ret.reset(); ret.setRecursive(true); ret.addTree(new DirCacheIterator(dc)); ret.next(); return ret; }
Source:
private void shareSnippet(CharSequence input) { final PageViewFragmentInternal curPageFragment = activity.getCurPageFragment(); if (curPageFragment == null) { return; } final String selectedText = sanitizeText(input.toString()); final PageTitle title = curPageFragment.getTitle(); final String introText = activity.getString(R.string.snippet_share_intro, title.getDisplayText(), title.getCanonicalUri() + "?wprov=sfia1"); (new ImageLicenseFetchTask(WikipediaApp.getInstance().getAPIForSite(title.getSite()), title.getSite(), new PageTitle("File:" + curPageFragment.getPage().getPageProperties().getLeadImageName(), title.getSite())) { @Override public void onFinish(Map<PageTitle, ImageLicense> result) { ImageLicense leadImageLicense = (ImageLicense) result.values().toArray()[0]; final SnippetImage snippetImage = new SnippetImage(activity, curPageFragment.getLeadImageBitmap(), curPageFragment.getLeadImageFocusY(), title.getDisplayText(), curPageFragment.getPage().isMainPage() ? "" : title.getDescription(), selectedText, leadImageLicense); final Bitmap snippetBitmap = snippetImage.drawBitmap(); if (shareDialog != null) { shareDialog.dismiss(); } shareDialog = new PreviewDialog(activity, snippetBitmap, title.getDisplayText(), introText, selectedText, funnel); shareDialog.show(); } @Override public void onCatch(Throwable caught) { Log.d(TAG, "Error fetching image license info for " + title.getDisplayText() + ": " + caught.getMessage(), caught); } }).execute(); }

Target:
private void shareSnippet(CharSequence input) { final PageViewFragmentInternal curPageFragment = activity.getCurPageFragment(); if (curPageFragment == null) { return; } final String selectedText = sanitizeText(input.toString()); final PageTitle title = curPageFragment.getTitle(); final String introText = activity.getString(R.string.snippet_share_intro, title.getDisplayText(), title.getCanonicalUri() + "?wprov=sfia1"); (new ImageLicenseFetchTask(WikipediaApp.getInstance().getAPIForSite(title.getSite()), title.getSite(), new PageTitle("File:" + curPageFragment.getPage().getPageProperties().getLeadImageName(), title.getSite())) { @Override public void onFinish(@NonNull Map<PageTitle, ImageLicense> result) { ImageLicense leadImageLicense = (ImageLicense) result.values().toArray()[0]; final SnippetImage snippetImage = new SnippetImage(activity, curPageFragment.getLeadImageBitmap(), curPageFragment.getLeadImageFocusY(), title.getDisplayText(), curPageFragment.getPage().isMainPage() ? "" : title.getDescription(), selectedText, leadImageLicense); final Bitmap snippetBitmap = snippetImage.drawBitmap(); if (shareDialog != null) { shareDialog.dismiss(); } shareDialog = new PreviewDialog(activity, snippetBitmap, title.getDisplayText(), introText, selectedText, funnel); shareDialog.show(); } @Override public void onCatch(Throwable caught) { Log.d(TAG, "Error fetching image license info for " + title.getDisplayText() + ": " + caught.getMessage(), caught); } }).execute(); }
Source:
public void attemptResolution() { Set<Guid> chainFromStorage; if (getVmDao().get(getParameters().getVmId()).isDown()) { StoragePool pool = getStoragePoolDao().get(getParameters().getStoragePoolId()); if (pool.getSpmVdsId() == null || pool.getStatus() != StoragePoolStatus.Up) { log.info("VM down, waiting on SPM election to resolve Live Merge"); setSucceeded(true); return; } else { log.error("VM is not running, proceeding with Live Merge recovery"); chainFromStorage = getVolumeChainFromRecovery(); } } else { chainFromStorage = getVolumeChain(); } if (chainFromStorage == null) { setCommandStatus(CommandStatus.FAILED); return; } Collection<Guid> imagesToRemove = CollectionUtils.subtract(getImageChainFromDb(), chainFromStorage); if (imagesToRemove.size() != 1) { log.error("Failed to live merge, still in volume chain: {}", imagesToRemove); setCommandStatus(CommandStatus.FAILED); return; } log.info("Successfully removed volume(s): {}", imagesToRemove); VmBlockJobType jobType = imagesToRemove.contains(getParameters().getBaseImage().getImageId()) ? VmBlockJobType.COMMIT : VmBlockJobType.PULL; log.info("Volume merge type '{}'", jobType.name()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(jobType, Collections.singleton(imagesToRemove.stream().findFirst().get())); getReturnValue().setActionReturnValue(returnValue); setSucceeded(true); persistCommand(getParameters().getParentCommand(), true); setCommandStatus(CommandStatus.SUCCEEDED); }

Target:
public void attemptResolution() { Set<Guid> chainFromStorage; if (getVmDao().get(getParameters().getVmId()).isDown()) { StoragePool pool = getStoragePoolDao().get(getParameters().getStoragePoolId()); if (pool.getSpmVdsId() == null || pool.getStatus() != StoragePoolStatus.Up) { log.info("VM down, waiting on SPM election to resolve Live Merge"); setSucceeded(true); return; } else { log.error("VM is not running, proceeding with Live Merge recovery"); chainFromStorage = getVolumeChainFromRecovery(); } } else { chainFromStorage = getVolumeChain(); } if (chainFromStorage == null) { setCommandStatus(CommandStatus.FAILED); return; } Set<Guid> imagesToRemove = getImagesToRemove(getImageChainFromDb(), chainFromStorage); if (imagesToRemove.size() != 1) { log.error("Failed to live merge, still in volume chain: {}", imagesToRemove); setCommandStatus(CommandStatus.FAILED); return; } log.info("Successfully removed volume(s): {}", imagesToRemove); VmBlockJobType jobType = imagesToRemove.contains(getParameters().getBaseImage().getImageId()) ? VmBlockJobType.COMMIT : VmBlockJobType.PULL; log.info("Volume merge type '{}'", jobType.name()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(jobType, imagesToRemove); getReturnValue().setActionReturnValue(returnValue); setSucceeded(true); persistCommand(getParameters().getParentCommand(), true); setCommandStatus(CommandStatus.SUCCEEDED); }
Source:
public Binary copy() { if (isUnmodifiable) { return this; } else { return Binary.fromReusedByteArray(getBytes()); } }

Target:
public Binary copy() { if (isBackingBytesReused) { return Binary.fromConstantByteArray(getBytes()); } else { return this; } }
Source:
void fetchNext() { current = null; while (current == null) { if (snapshotKey == null) { fetchSnapshot(); } if (uncommittedKey == null) { fetchUncommitted(); } if (snapshotKey == null && uncommittedKey == null) { break; } int cmp = snapshotKey == null ? 1 : uncommittedKey == null ? -1 : keyType.compare(snapshotKey, uncommittedKey); if (cmp < 0) { registerCurrent(snapshotKey, snapshotValue); snapshotKey = null; } else { if (uncommittedValue != null) { registerCurrent(uncommittedKey, uncommittedValue); } if (cmp == 0) { snapshotKey = null; } uncommittedKey = null; } } }

Target:
void fetchNext() { current = null; do { if (snapshotKey == null) { fetchSnapshot(); } if (uncommittedKey == null) { fetchUncommitted(); } if (snapshotKey == null && uncommittedKey == null) { break; } int cmp = snapshotKey == null ? 1 : uncommittedKey == null ? -1 : keyType.compare(snapshotKey, uncommittedKey); if (cmp < 0) { registerCurrent(snapshotKey, snapshotValue); snapshotKey = null; break; } if (uncommittedValue != null) { registerCurrent(uncommittedKey, uncommittedValue); } if (cmp == 0) { snapshotKey = null; } uncommittedKey = null; } while (current == null); }
Source:
private void clearAll() { for (Iterator<Map.Entry<Key, Reference<Repository>>> i = cacheMap .entrySet().iterator(); i.hasNext();) { final Map.Entry<Key, Reference<Repository>> e = i.next(); unregisterAndCloseRepository(e.getKey(), null); } }

Target:
private void clearAll() { for (Iterator<Map.Entry<Key, Reference<Repository>>> i = cacheMap .entrySet().iterator(); i.hasNext();) { unregisterAndCloseRepository(i.next().getKey(), null); } }
Source:
public void ok() { new PushButton("OK").click(); }

Target:
public void ok() { new PushButton("OK").click(); new WaitWhile(new ShellIsAvailable(this)); }
Source:
private void toggleWorkingBranchLock(Button button) { try { BranchId branch = getTeamArt().getWorkingBranch(); if (branch.isInvalid()) { AWorkbench.popup("Working branch doesn't exist"); return; } boolean isLocked = false, manuallyLocked = false; Collection<AccessControlData> datas = AccessControlManager.getAccessControlList(branch); if (datas.size() > 1) { manuallyLocked = true; } else if (datas.isEmpty()) { isLocked = false; } else { AccessControlData data = datas.iterator().next(); if (data.getSubject().equals( CoreArtifactTokens.Everyone) && data.getBranchPermission() == PermissionEnum.READ) { isLocked = true; } else { manuallyLocked = true; } } if (manuallyLocked) { AWorkbench.popup( "Manual access control applied to branch. Can't override.\n\nUse Access Control option of Branch Manager"); return; } String message = String.format("Working branch is currently [%s]\n\n%s the Branch?", isLocked ? "Locked" : "NOT Locked", isLocked ? "UnLock" : "Lock"); if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Toggle Branch Lock", message)) { if (isLocked) { AccessControlManager.removeAccessControlDataIf(true, datas.iterator().next()); } else { AccessControlManager.setPermission(SystemGroup.Everyone.getArtifact(), branch, PermissionEnum.READ); } AWorkbench.popup(String.format("Branch set to [%s]", !isLocked ? "Locked" : "NOT Locked")); } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } }

Target:
private void toggleWorkingBranchLock(Button button) { try { BranchId branch = getTeamArt().getWorkingBranch(); if (branch.isInvalid()) { AWorkbench.popup("Working branch doesn't exist"); return; } boolean isLocked = false, manuallyLocked = false; Collection<AccessControlData> datas = AccessControlManager.getAccessControlList(branch); if (datas.size() > 1) { manuallyLocked = true; } else if (datas.isEmpty()) { isLocked = false; } else { AccessControlData data = datas.iterator().next(); if (data.getSubject().equals(CoreArtifactTokens.Everyone) && data.getBranchPermission().equals( PermissionEnum.READ)) { isLocked = true; } else { manuallyLocked = true; } } if (manuallyLocked) { AWorkbench.popup( "Manual access control applied to branch. Can't override.\n\nUse Access Control option of Branch Manager"); return; } String message = String.format("Working branch is currently [%s]\n\n%s the Branch?", isLocked ? "Locked" : "NOT Locked", isLocked ? "UnLock" : "Lock"); if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Toggle Branch Lock", message)) { if (isLocked) { AccessControlManager.removeAccessControlDataIf(true, datas.iterator().next()); } else { AccessControlManager.setPermission(SystemGroup.Everyone.getArtifact(), branch, PermissionEnum.READ); } AWorkbench.popup(String.format("Branch set to [%s]", !isLocked ? "Locked" : "NOT Locked")); } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } }
Source:
public void should_throw_exception_on_null_argument() { assertThatExceptionOfType(NullPointerException.class).isThrownBy(() -> { int[] content = null; invoke_api_with_null_value(assertThat(new short[] {}), content); }).withMessage("The array of values to look for should not be null"); }

Target:
public void should_throw_exception_on_null_argument() { int[] nullContent = null; NullPointerException npe = catchThrowableOfType(() -> invoke_api_with_null_value(assertThat(new short[] {}), nullContent), NullPointerException.class); assertThat(npe).hasMessage("The array of values to look for should not be null"); }
Source:
public String getAbilityList(String type) { StringBuilder abilityString = new StringBuilder(); for (Enumeration<IOption> i = getOptions(type); i.hasMoreElements(); ) { IOption ability = i.nextElement(); if (ability.booleanValue()) { abilityString.append(Utilities.getOptionDisplayName(ability)).append("<br>"); } } if (abilityString.toString().equals("")) { return null; } return "<html>" + abilityString + "</html>"; }

Target:
public String getAbilityList(String type) { StringBuilder abilityString = new StringBuilder(); for (Enumeration<IOption> i = getOptions(type); i.hasMoreElements(); ) { IOption ability = i.nextElement(); if (ability.booleanValue()) { abilityString.append(Utilities.getOptionDisplayName(ability)).append("<br>"); } } if (abilityString.length() == 0) { return null; } return "<html>" + abilityString + "</html>"; }
Source:
private void storeStyleCustomizations(final Customizable customizable) { Map<String, Object> customFeatures = new HashMap<String, Object>(); for (String featureName : customizable.getCustomFeatures()) { EStructuralFeature structuralFeature = customizable.eClass().getEStructuralFeature(featureName); if (structuralFeature != null) { Object value = customizable.eGet(structuralFeature); if (value instanceof Collection<?>) { value = new ArrayList<Object>((Collection<?>) value); } customFeatures.put(featureName, value); } } Identifier customizableIdentifier = Identifier.createCustomizableIdentifier(customizable); if (customizableIdentifier != null && !customFeatures.isEmpty()) { customizableToCustomizedFeatures.put(customizableIdentifier, customFeatures); } Iterator<EObject> iterator = customizable.eAllContents(); while (iterator.hasNext()) { EObject currentObject = iterator.next(); if (currentObject instanceof Customizable) { storeStyleCustomizations((Customizable) currentObject); } } }

Target:
private void storeStyleCustomizations(final Customizable customizable) { Map<String, Object> customFeatures = new HashMap<String, Object>(); for (String featureName : customizable.getCustomFeatures()) { EStructuralFeature structuralFeature = customizable.eClass().getEStructuralFeature(featureName); if (structuralFeature != null) { Object value = customizable.eGet(structuralFeature); if (value instanceof Collection<?>) { value = Lists.newArrayList((Collection<?>) value); } customFeatures.put(featureName, value); } } Identifier customizableIdentifier = Identifier.createCustomizableIdentifier(customizable); if (customizableIdentifier != null && !customFeatures.isEmpty()) { customizableToCustomizedFeatures.put(customizableIdentifier, customFeatures); } Iterator<EObject> iterator = customizable.eAllContents(); while (iterator.hasNext()) { EObject currentObject = iterator.next(); if (currentObject instanceof Customizable) { storeStyleCustomizations((Customizable) currentObject); } } }
Source:
public boolean isValid(ILaunchConfiguration config) { String provider; try { provider = config.getAttribute( ProviderProfileConstants.PROVIDER_CONFIG_ATT, ""); } catch (CoreException e) { setErrorMessage(e.getMessage()); return false; } if (provider.equals("")) { setErrorMessage(Messages.ProviderOptionsTab_0); return false; } Boolean isInitialized = initialized.get(getProviderId()); Boolean valid = false; if (isInitialized) { if (tabs == null) { return false; } else { for (AbstractLaunchConfigurationTab tab : tabs) { valid = tab.isValid(config); } } } return valid; }

Target:
public boolean isValid(ILaunchConfiguration config) { String provider; try { provider = config.getAttribute( ProviderProfileConstants.PROVIDER_CONFIG_ATT, ""); } catch (CoreException e) { setErrorMessage(e.getMessage()); return false; } if (provider.equals("")) { setErrorMessage(Messages.ProviderOptionsTab_0); return false; } Boolean isInitialized = initialized.get(getProviderId()); if (isInitialized) { if (tabs == null) { return false; } for (AbstractLaunchConfigurationTab tab : tabs) { if (!tab.isValid(config)) { return false; } } } return true; }
Source:
public void shutdown() { this.scheduler.shutdown(); this.scheduler.shutdownNow(); }

Target:
public void shutdown() { this.scheduler.shutdown(); try { if (!this.scheduler.awaitTermination(60, TimeUnit.SECONDS)) { this.scheduler.shutdownNow(); } } catch (final InterruptedException ex) { this.scheduler.shutdownNow(); Thread.currentThread().interrupt(); } }
Source:
private BlobId(short version, BlobIdType type, byte datacenterId, short accountId, short containerId, PartitionId partitionId, boolean isEncrypted, BlobDataType blobDataType, String uuid) { if (partitionId == null) { throw new IllegalArgumentException("partitionId cannot be null"); } switch (version) { case BLOB_ID_V1: this.type = BlobIdType.NATIVE; this.datacenterId = UNKNOWN_DATACENTER_ID; this.accountId = UNKNOWN_ACCOUNT_ID; this.containerId = UNKNOWN_CONTAINER_ID; this.isEncrypted = false; break; case BLOB_ID_V2: this.type = BlobIdType.NATIVE; this.datacenterId = datacenterId; this.accountId = accountId; this.containerId = containerId; this.isEncrypted = false; break; case BLOB_ID_V3: this.type = type; this.datacenterId = datacenterId; this.accountId = accountId; this.containerId = containerId; this.isEncrypted = false; break; case BLOB_ID_V4: this.type = type; this.datacenterId = datacenterId; this.accountId = accountId; this.containerId = containerId; this.isEncrypted = isEncrypted; break; case BLOB_ID_V5: this.type = type; this.datacenterId = datacenterId; this.accountId = accountId; this.containerId = containerId; this.isEncrypted = isEncrypted; this.blobDataType = blobDataType; break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } this.version = version; this.partitionId = partitionId; this.uuid = uuid; }

Target:
private BlobId(short version, BlobIdType type, byte datacenterId, short accountId, short containerId, PartitionId partitionId, boolean isEncrypted, BlobDataType blobDataType, String uuid) { if (partitionId == null) { throw new IllegalArgumentException("partitionId cannot be null"); } switch (version) { case BLOB_ID_V1: this.type = BlobIdType.NATIVE; this.datacenterId = UNKNOWN_DATACENTER_ID; this.accountId = UNKNOWN_ACCOUNT_ID; this.containerId = UNKNOWN_CONTAINER_ID; this.isEncrypted = false; this.blobDataType = null; break; case BLOB_ID_V2: this.type = BlobIdType.NATIVE; this.datacenterId = datacenterId; this.accountId = accountId; this.containerId = containerId; this.isEncrypted = false; this.blobDataType = null; break; case BLOB_ID_V3: this.type = type; this.datacenterId = datacenterId; this.accountId = accountId; this.containerId = containerId; this.isEncrypted = false; this.blobDataType = null; break; case BLOB_ID_V4: this.type = type; this.datacenterId = datacenterId; this.accountId = accountId; this.containerId = containerId; this.isEncrypted = isEncrypted; this.blobDataType = null; break; case BLOB_ID_V5: this.type = type; this.datacenterId = datacenterId; this.accountId = accountId; this.containerId = containerId; this.isEncrypted = isEncrypted; if (blobDataType == null) { throw new IllegalArgumentException("blobDataType can't be null for id version " + BLOB_ID_V5); } this.blobDataType = blobDataType; break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } this.version = version; this.partitionId = partitionId; this.uuid = uuid; }
Source:
public void onError(Throwable e) { logger.warn("Fetching data failed", e); try { if (count.get() == 0) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); response.setHeader("Content-Type", "application/json"); ApiError apiError = new ApiError(Throwables.getRootCause(e).getMessage()); mapper.writeValue(response.getOutputStream(), apiError); } else { generator.close(); } } catch (IOException ie) { logger.warn("There was an error closing the JSON generator", ie); } finally { request.getAsyncContext().complete(); } }

Target:
public void onError(Throwable e) { logger.warn("Fetching data failed", e); try { if (count.get() == 0) { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); response.setHeader("Content-Type", "application/json"); ApiError apiError = new ApiError(Throwables.getRootCause(e).getMessage()); mapper.writeValue(response.getOutputStream(), apiError); } else { generator.close(); } } catch (IOException ie) { logger.warn("There was an error closing the JSON generator", ie); } finally { asyncContext.complete(); } }
Source:
public JSONArray truncate(JSONArray array) throws JSONException { for (int i = 0; i < array.length(); i++) { Object value = array.get(i); if (value.getClass().equals(String.class)) { array.put(i, truncate((String) value)); } else if (value.getClass().equals(JSONObject.class)) { array.put(i, truncate((JSONObject) value)); } else if (value.getClass().equals(JSONArray.class)) { array.put(i, truncate((JSONArray) value)); } } return array; }

Target:
public JSONArray truncate(JSONArray array) throws JSONException { if (array == null) { return null; } for (int i = 0; i < array.length(); i++) { Object value = array.get(i); if (value.getClass().equals(String.class)) { array.put(i, truncate((String) value)); } else if (value.getClass().equals(JSONObject.class)) { array.put(i, truncate((JSONObject) value)); } else if (value.getClass().equals(JSONArray.class)) { array.put(i, truncate((JSONArray) value)); } } return array; }
Source:
protected boolean canDoAction() { boolean retValue = isVmExist() && isVmUpOrDown(); if (retValue && disk == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } retValue = retValue && isDiskCanBeAddedToVm(getParameters().getDiskInfo()) && isDiskPassPCIAndIDELimit(getParameters().getDiskInfo()); if (retValue && (getVmDeviceDao().exists(new VmDeviceId(disk.getId(), getVmId())) && !disk.isShareable()) || (disk.isShareable() && !isVersionSupportedForShareable())) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_ALREADY_ATTACHED); } if (retValue && Boolean.TRUE.equals(getParameters().getDiskInfo().getPlugged()) && getVm().getstatus() != VMStatus.Down) { retValue = isOSSupportingHotPlug() && isHotPlugSupported() && isInterfaceSupportedForPlugUnPlug(getParameters().getDiskInfo()); } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = isVmExist() && isVmUpOrDown(); if (retValue && disk == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } retValue = retValue && isDiskCanBeAddedToVm(getParameters().getDiskInfo()) && isDiskPassPCIAndIDELimit(getParameters().getDiskInfo()); if (retValue && (getVmDeviceDao().exists(new VmDeviceId(disk.getId(), getVmId())) && !disk.isShareable()) || (disk.isShareable() && !isVersionSupportedForShareable())) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DISK_ALREADY_ATTACHED); } if (retValue && disk.getDiskStorageType() == DiskStorageType.IMAGE && getStoragePoolIsoMapDao().get(new StoragePoolIsoMapId( ((DiskImage) disk).getstorage_ids().get(0), getVm().getstorage_pool_id())) == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH); } if (retValue && Boolean.TRUE.equals(getParameters().getDiskInfo().getPlugged()) && getVm().getstatus() != VMStatus.Down) { retValue = isOSSupportingHotPlug() && isHotPlugSupported() && isInterfaceSupportedForPlugUnPlug(getParameters().getDiskInfo()); } return retValue; }
Source:
private long detectObjects(String imageHex, String cascadeFilePath) { long objectCount; try { byte[] imageByteArr = (byte[]) new Hex().decode(imageHex); Mat image = Highgui.imdecode(new MatOfByte(imageByteArr), Highgui.IMREAD_UNCHANGED); CascadeClassifier cClassifier = new CascadeClassifier(); cClassifier.load(cascadeFilePath); Imgproc.cvtColor(image, image, Imgproc.COLOR_RGB2GRAY); Imgproc.equalizeHist(image, image); MatOfRect imageRect = new MatOfRect(); cClassifier.detectMultiScale(image, imageRect); objectCount = ((Integer) imageRect.toList().size()).longValue(); } catch (DecoderException e) { log.error("Unable to decode the hex string of the image.", e); throw new RuntimeException("Unable to decode the hex string of the image.", e); } return objectCount; }

Target:
private long detectObjects(String imageHex, String cascadeFilePath) { long objectCount; try { byte[] imageByteArr = (byte[]) new Hex().decode(imageHex); Mat image = Highgui.imdecode(new MatOfByte(imageByteArr), Highgui.IMREAD_UNCHANGED); CascadeClassifier cClassifier = new CascadeClassifier(); cClassifier.load(cascadeFilePath); Imgproc.cvtColor(image, image, Imgproc.COLOR_RGB2GRAY); Imgproc.equalizeHist(image, image); MatOfRect imageRect = new MatOfRect(); cClassifier.detectMultiScale(image, imageRect); objectCount = ((Integer) imageRect.toList().size()).longValue(); } catch (DecoderException e) { log.error("Unable to decode the hex string of the image. Make sure the image is not " + "corrupted.", e); throw new RuntimeException("Unable to decode the hex string of the image. Make sure " + "the image is not corrupted.", e); } return objectCount; }
Source:
public void setUp() throws Exception { URL resource = getClass().getResource("/projects/CSharpFileAdvancedOperations"); testProjectServiceClient.importProject( workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, DOT_NET); ide.open(workspace); projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.openItemByPath(PATH_TO_DOTNET_FILE); consoles.waitExpectedTextIntoConsole(FINISH_LANGUAGE_SERVER_INITIALIZATION_MESSAGE); projectExplorer.waitItem(PROJECT_NAME + "/obj"); projectExplorer.waitItem(PROJECT_NAME + "/bin"); }

Target:
public void setUp() throws Exception { URL resource = getClass().getResource("/projects/CSharpFileAdvancedOperations"); testProjectServiceClient.importProject( workspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, DOT_NET); ide.open(workspace); projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.openItemByPath(PATH_TO_DOT_NET_FILE); consoles.waitExpectedTextIntoConsole(FINISH_LANGUAGE_SERVER_INITIALIZATION_MESSAGE); projectExplorer.waitItem(PROJECT_NAME + "/obj"); projectExplorer.waitItem(PROJECT_NAME + "/bin"); }
Source:
@NonNull public String server() { if (server.startsWith(" server = "https:" + server; } return server; }

Target:
@NonNull public String server() { return server; }
Source:
public Workflow initializeWorkflow(String repositoryId, Workflow workflow) { try { GHRepository repository = github.getRepository(repositoryId); workflow.setOrganization(repository.getOwner().getLogin()); workflow.setRepository(repository.getName()); workflow.setSourceControl(SourceControl.GITHUB); workflow.setGitUrl(repository.getSshUrl()); workflow.setLastUpdated(new Date()); } catch (GHFileNotFoundException e) { LOG.info(gitUsername + ": GitHub reports file not found: " + e.getCause().getLocalizedMessage()); throw new CustomWebApplicationException("GitHub reports file not found: " + e.getCause().getLocalizedMessage(), HttpStatus.SC_BAD_REQUEST); } catch (IOException e) { LOG.info(gitUsername + ": Cannot getNewWorkflow {}"); throw new CustomWebApplicationException("Could not reach GitHub", HttpStatus.SC_SERVICE_UNAVAILABLE); } return workflow; }

Target:
public Workflow initializeWorkflow(String repositoryId, Workflow workflow) { try { GHRepository repository = github.getRepository(repositoryId); workflow.setOrganization(repository.getOwner().getLogin()); workflow.setRepository(repository.getName()); workflow.setSourceControl(SourceControl.GITHUB); workflow.setGitUrl(repository.getSshUrl()); workflow.setLastUpdated(new Date()); } catch (GHFileNotFoundException e) { LOG.info(gitUsername + ": GitHub reports file not found: " + e.getCause().getLocalizedMessage(), e); throw new CustomWebApplicationException("GitHub reports file not found: " + e.getCause().getLocalizedMessage(), HttpStatus.SC_BAD_REQUEST); } catch (IOException e) { LOG.info(gitUsername + ": Cannot getNewWorkflow {}", e); throw new CustomWebApplicationException("Could not reach GitHub", HttpStatus.SC_SERVICE_UNAVAILABLE); } return workflow; }