auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private int getGeneratedJSONObjectsCount(int amountOfConfigs) { List<Config> simpleConfigs = new ArrayList<>(); for(int i = 0; i < amountOfConfigs; i++) { Config simpleConfig = new Config(); simpleConfig.setName("simpleConfiguration" + Integer.toString(i)); simpleConfigs.add(simpleConfig); } when(configService.getConfigs()).thenReturn(simpleConfigs); openMRSTaskDataProviderBuilder.setOpenMRSConfigService(configService); VelocityEngineFactoryBean vefb = new VelocityEngineFactoryBean(); Map<String, Object> velocityPropertiesMap = new HashMap<String, Object>(); velocityPropertiesMap.put("resource.loader", "class"); velocityPropertiesMap.put("class.resource.loader.class", "org.motechproject.openmrs19.tasks.VelocityResourceLoader"); vefb.setVelocityPropertiesMap(velocityPropertiesMap); VelocityEngine velocityEngine = null; try { velocityEngine = vefb.createVelocityEngine(); } catch (IOException e) { e.printStackTrace(); } assertNotNull(velocityEngine); openMRSTaskDataProviderBuilder.setVelocityEngine(velocityEngine); String generatedJSON = openMRSTaskDataProviderBuilder.generateDataProvider(); JSONObject jsonResult = new JSONObject(generatedJSON); JSONArray objects = jsonResult.getJSONArray("objects"); return objects.length(); }

Target:
private int getGeneratedJSONObjectsCount(int amountOfConfigs) throws IOException { List<Config> simpleConfigs = new ArrayList<>(); for(int i = 0; i < amountOfConfigs; i++) { Config simpleConfig = new Config(); simpleConfig.setName("simpleConfiguration" + Integer.toString(i)); simpleConfigs.add(simpleConfig); } when(configService.getConfigs()).thenReturn(simpleConfigs); openMRSTaskDataProviderBuilder.setOpenMRSConfigService(configService); VelocityEngineFactoryBean vefb = new VelocityEngineFactoryBean(); Map<String, Object> velocityPropertiesMap = new HashMap<String, Object>(); velocityPropertiesMap.put("resource.loader", "class"); velocityPropertiesMap.put("class.resource.loader.class", "org.motechproject.openmrs19.tasks.VelocityResourceLoader"); vefb.setVelocityPropertiesMap(velocityPropertiesMap); VelocityEngine velocityEngine = vefb.createVelocityEngine(); assertNotNull(velocityEngine); openMRSTaskDataProviderBuilder.setVelocityEngine(velocityEngine); String generatedJSON = openMRSTaskDataProviderBuilder.generateDataProvider(); JSONObject jsonResult = new JSONObject(generatedJSON); JSONArray objects = jsonResult.getJSONArray("objects"); return objects.length(); }
Source:
public static void output(SpatialPartitioningState state, BlockBuilder out) { if (state.getCount() == 0) { throw new PrestoException(INVALID_SPATIAL_PARTITIONING, "No rows supplied to spatial partition."); } List<Rectangle> samples = state.getSamples(); int partitionCount = state.getPartitionCount(); int maxItemsPerNode = (samples.size() + partitionCount - 1) / partitionCount; Rectangle envelope = state.getExtent(); Rectangle paddedExtent = new Rectangle(envelope.getXMin(), envelope.getYMin(), Math.nextUp(envelope.getXMax()), Math.nextUp(envelope.getYMax())); VARCHAR.writeString(out, KdbTreeUtils.toJson(buildKdbTree(maxItemsPerNode, paddedExtent, samples))); }

Target:
public static void output(SpatialPartitioningState state, BlockBuilder out) { if (state.getCount() == 0) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "No rows supplied to spatial partition."); } List<Rectangle> samples = state.getSamples(); int partitionCount = state.getPartitionCount(); int maxItemsPerNode = (samples.size() + partitionCount - 1) / partitionCount; Rectangle envelope = state.getExtent(); Rectangle paddedExtent = new Rectangle(envelope.getXMin(), envelope.getYMin(), Math.nextUp(envelope.getXMax()), Math.nextUp(envelope.getYMax())); VARCHAR.writeString(out, KdbTreeUtils.toJson(buildKdbTree(maxItemsPerNode, paddedExtent, samples))); }
Source:
public void returnedRealmResultsOfModelIsNotNull() { RealmResults<AllTypesRealmModel> alltypes = looperThread.realm.where(AllTypesRealmModel.class).findAll(); alltypes.addChangeListener(new RealmChangeListener<RealmResults<AllTypesRealmModel>>() { @Override public void onChange(RealmResults<AllTypesRealmModel> result) { assertEquals("data 1", result.first().columnString); looperThread.testComplete(); } }); looperThread.realm.beginTransaction(); AllTypesRealmModel model = looperThread.realm.createObject(AllTypesRealmModel.class); model.columnString = "data 1"; looperThread.realm.commitTransaction(); }

Target:
public void returnedRealmResultsOfModelIsNotNull() { Realm realm = looperThread.realm; RealmResults<AllTypesRealmModel> alltypes = realm.where(AllTypesRealmModel.class).findAll(); alltypes.addChangeListener(new RealmChangeListener<RealmResults<AllTypesRealmModel>>() { @Override public void onChange(RealmResults<AllTypesRealmModel> result) { assertEquals("data 1", result.first().columnString); looperThread.testComplete(); } }); realm.beginTransaction(); AllTypesRealmModel model = realm.createObject(AllTypesRealmModel.class); model.columnString = "data 1"; realm.commitTransaction(); }
Source:
private void setSelectionFromEditor(IWorkbenchPart part, ISelection selection) { if (part instanceof IEditorPart) { IJavaElement element= null; if (selection instanceof IStructuredSelection) { Object obj= getSingleElementFromSelection(selection); if (obj instanceof IJavaElement) element= (IJavaElement)obj; } IEditorInput ei; if (part instanceof AbstractMultiEditor) ei= ((AbstractMultiEditor)part).getActiveEditor().getEditorInput(); else ei= ((IEditorPart)part).getEditorInput(); if (selection instanceof ITextSelection) { int offset= ((ITextSelection)selection).getOffset(); element= getElementAt(ei, offset); } if (element != null) { adjustInputAndSetSelection(element); return; } if (ei instanceof IFileEditorInput) { IFile file= ((IFileEditorInput)ei).getFile(); IJavaElement je= file.getAdapter(IJavaElement.class); IContainer container= null; if (je == null) { container= ((IFileEditorInput)ei).getFile().getParent(); if (container != null) je= container.getAdapter(IJavaElement.class); } if (je == null && container == null) { setSelection(null, false); return; } adjustInputAndSetSelection(je); } else if (ei instanceof IClassFileEditorInput) { ITypeRoot cf= ((IClassFileEditorInput)ei).getClassFile(); adjustInputAndSetSelection(cf); } } }

Target:
private void setSelectionFromEditor(IWorkbenchPart part, ISelection selection) { if (part instanceof IEditorPart) { IJavaElement element= null; if (selection instanceof IStructuredSelection) { Object obj= getSingleElementFromSelection(selection); if (obj instanceof IJavaElement) element= (IJavaElement)obj; } IEditorInput ei; if (part instanceof AbstractMultiEditor) ei= ((AbstractMultiEditor)part).getActiveEditor().getEditorInput(); else ei= ((IEditorPart)part).getEditorInput(); if (selection instanceof ITextSelection) { int offset= ((ITextSelection)selection).getOffset(); element= getElementAt(ei, offset); } if (element != null) { adjustInputAndSetSelection(element); return; } if (ei instanceof IFileEditorInput) { IFile file= ((IFileEditorInput)ei).getFile(); IJavaElement je= file.getAdapter(IJavaElement.class); IContainer container= null; if (je == null) { container= ((IFileEditorInput)ei).getFile().getParent(); if (container != null) je= container.getAdapter(IJavaElement.class); } if (je == null && container == null) { setSelection(null, false); return; } adjustInputAndSetSelection(je); } else if (ei instanceof IClassFileEditorInput) { IClassFile cf= ((IClassFileEditorInput)ei).getClassFile(); adjustInputAndSetSelection(cf); } } }
Source:
public void testIterableSliceExpectedMulti() throws IOException { PayloadSlicer slicer = new BasePayloadSlicer(); Payload payload = new InputStreamPayload(new ByteArrayInputStream("aaaaaaaaaabbbbbbbbbbccccc".getBytes(Charsets.US_ASCII))); Iterator<Payload> iter = slicer.slice(payload, 10).iterator(); assertTrue(iter.hasNext(), "Not enough results"); assertEquals(new String(ByteStreams.toByteArray(iter.next())), "aaaaaaaaaa"); assertTrue(iter.hasNext(), "Not enough results"); assertEquals(new String(ByteStreams.toByteArray(iter.next())), "bbbbbbbbbb"); assertTrue(iter.hasNext(), "Not enough results"); assertEquals(new String(ByteStreams.toByteArray(iter.next())), "ccccc"); assertFalse(iter.hasNext()); }

Target:
public void testIterableSliceExpectedMulti() throws IOException { PayloadSlicer slicer = new BasePayloadSlicer(); Payload payload = new InputStreamPayload(new ByteArrayInputStream("aaaaaaaaaabbbbbbbbbbccccc".getBytes(Charsets.US_ASCII))); Iterator<Payload> iter = slicer.slice(payload, 10).iterator(); assertTrue(iter.hasNext(), "Not enough results"); assertEquals(Strings2.toStringAndClose(iter.next().getInput()), "aaaaaaaaaa"); assertTrue(iter.hasNext(), "Not enough results"); assertEquals(Strings2.toStringAndClose(iter.next().getInput()), "bbbbbbbbbb"); assertTrue(iter.hasNext(), "Not enough results"); assertEquals(Strings2.toStringAndClose(iter.next().getInput()), "ccccc"); assertFalse(iter.hasNext()); }
Source:
public static void writeToFile(InputStream source, String destination) throws IOException { File f = new File(destination); Timber.d("Creating new file... = %s", destination); final int retries = 5; int retryCnt = 0; boolean created = false; while (!created && retryCnt++ < retries) { try { created = f.createNewFile(); } catch (IOException e) { e.printStackTrace(); if (retryCnt == retries) { throw new IOException(f.getName() + ": " + e.getLocalizedMessage(), e); } else { Timber.e("IOException while creating file, retrying..."); try { Thread.sleep(200); } catch (InterruptedException e1) { e1.printStackTrace(); } } } } long startTimeMillis = System.currentTimeMillis(); OutputStream output = new BufferedOutputStream(new FileOutputStream(destination)); byte[] buf = new byte[CHUNK_SIZE]; long sizeBytes = 0; int len; if (source == null) { Timber.e("writeToFile :: source is null!"); } while ((len = source.read(buf)) >= 0) { output.write(buf, 0, len); sizeBytes += len; } long endTimeMillis = System.currentTimeMillis(); Timber.d("Finished writeToFile!"); long durationSeconds = (endTimeMillis - startTimeMillis) / 1000; long sizeKb = sizeBytes / 1024; long speedKbSec = 0; if (endTimeMillis != startTimeMillis) { speedKbSec = sizeKb * 1000 / (endTimeMillis - startTimeMillis); } Timber.d("Utils.writeToFile: Size: %d Kb, Duration: %d s, Speed: %d Kb/s", sizeKb, durationSeconds, speedKbSec); output.close(); }

Target:
public static void writeToFile(InputStream source, String destination) throws IOException { final int retries = 5; int retryCnt = 0; boolean success = false; while (!success && retryCnt++ < retries) { try { writeToFileImpl(source, destination); success = true; } catch (IOException e) { if (retryCnt == retries) { throw e; } else { Timber.e("IOException while writing to file, retrying..."); try { Thread.sleep(200); } catch (InterruptedException e1) { e1.printStackTrace(); } } } } }
Source:
private String getContentWDL(File tempMainDescriptor, Type type) { Bridge bridge = new Bridge(); Map<String, Seq> callToTask = (LinkedHashMap)bridge.getCallsAndDocker(tempMainDescriptor); Map<String, Pair<String, String>> taskContent = new HashMap<>(); ArrayList<Pair<String, String>> nodePairs = new ArrayList<>(); String result = null; for (Map.Entry<String, Seq> entry : callToTask.entrySet()) { String taskID = entry.getKey(); Seq taskDocker = entry.getValue(); if(type.equals(Type.TOOLS)){ if (taskDocker != null){ String dockerName = taskDocker.head().toString(); taskContent.put(taskID, new MutablePair<>(dockerName, getURLFromEntry(dockerName))); } else{ taskContent.put(taskID, new MutablePair<>("Not Specified", "Not Specified")); } }else{ if (taskDocker != null){ String dockerName = taskDocker.head().toString(); nodePairs.add(new MutablePair<>(taskID, getURLFromEntry(dockerName))); } else{ nodePairs.add(new MutablePair<>(taskID, "")); } } } if(type.equals(Type.TOOLS)){ result = getJSONTableToolContentWDL(taskContent); }else if(type.equals(Type.DAG)){ result = setupJSONDAG(nodePairs); } return result; }

Target:
private String getContentWDL(File tempMainDescriptor, Type type) { Bridge bridge = new Bridge(); Map<String, Seq> callToTask = (LinkedHashMap)bridge.getCallsAndDocker(tempMainDescriptor); Map<String, Pair<String, String>> taskContent = new HashMap<>(); ArrayList<Pair<String, String>> nodePairs = new ArrayList<>(); String result = null; for (Map.Entry<String, Seq> entry : callToTask.entrySet()) { String taskID = entry.getKey(); Seq taskDocker = entry.getValue(); if(type == Type.TOOLS){ if (taskDocker != null){ String dockerName = taskDocker.head().toString(); taskContent.put(taskID, new MutablePair<>(dockerName, getURLFromEntry(dockerName))); } else{ taskContent.put(taskID, new MutablePair<>("Not Specified", "Not Specified")); } }else{ if (taskDocker != null){ String dockerName = taskDocker.head().toString(); nodePairs.add(new MutablePair<>(taskID, getURLFromEntry(dockerName))); } else{ nodePairs.add(new MutablePair<>(taskID, "")); } } } if(type == Type.TOOLS){ result = getJSONTableToolContentWDL(taskContent); }else if(type == Type.DAG){ result = setupJSONDAG(nodePairs); } return result; }
Source:
private VmTemplate createVmTemplate() { VmTemplate template = new VmTemplate(); template.setname("test-template"); template.setorigin(OriginType.OVIRT); template.setId(new Guid()); template.setdescription("test-description"); template.setDbGeneration(2L); return template; }

Target:
private static VmTemplate createVmTemplate() { VmTemplate template = new VmTemplate(); template.setname("test-template"); template.setorigin(OriginType.OVIRT); template.setId(new Guid()); template.setdescription("test-description"); template.setDbGeneration(2L); return template; }
Source:
private void compareCaseDbState(String inputTransactions, String caseDbState) throws IOException { MockDataUtils.parseIntoSandbox(this.getClass().getResourceAsStream(inputTransactions), sandbox); byte[] parsedDb = dumpInstance("jr://instance/casedb"); Document parsed = XmlComparator.getDocumentFromStream(new ByteArrayInputStream(parsedDb)); Document loaded = XmlComparator.getDocumentFromStream(this.getClass().getResourceAsStream(caseDbState)); try { XmlComparator.compareXmlDOMs(parsed, loaded); } catch (Exception e) { System.out.print(new String(parsedDb)); assertEquals("CaseDB output did not match expected structure(" + e.getMessage() + ")", new String(dumpStream(caseDbState)), new String(parsedDb)); } }

Target:
private void compareCaseDbState(String inputTransactions, String caseDbState) throws IOException { MockDataUtils.parseIntoSandbox(this.getClass().getResourceAsStream(inputTransactions), sandbox); byte[] parsedDb = dumpInstance("jr://instance/casedb"); Document parsed = XmlComparator.getDocumentFromStream(new ByteArrayInputStream(parsedDb)); Document loaded = XmlComparator.getDocumentFromStream(this.getClass().getResourceAsStream(caseDbState)); try { XmlComparator.isDOMEqual(parsed, loaded); } catch(Exception e) { System.out.print(new String(parsedDb)); assertEquals("CaseDB output did not match expected structure(" + e.getMessage()+ ")",new String(dumpStream(caseDbState)), new String(parsedDb)); } }
Source:
public void testCompanionAdLink() throws Exception { Log.v(TAG, "Beginning testCompanionAdLink"); super.playVideo(); assertTrue("Ad Break did not begin within given time.", adText.waitForExists(5000)); UiObject companionAdUrl = new UiObject(new UiSelector().textContains("starbucks.com")); if (companionCheck()) { companionAd.clickAndWaitForNewWindow(); } else { fail("Companion ad not found."); } assertTrue("Companion ad did not link to correct url.", companionAdUrl.waitForExists(15000)); Log.v(TAG, "Finished testCompanionAdLink"); }

Target:
public void testCompanionAdLink() throws Exception { Log.v(TAG, "Beginning testCompanionAdLink"); super.playVideo(); assertTrue("Ad Break did not begin within given time.", adTextView.waitForExists(msecToPreroll)); UiObject companionAdUrl = new UiObject(new UiSelector().textContains("starbucks.com")); if (companionCheck()) { companionAd.clickAndWaitForNewWindow(); } else { fail("Companion ad not found."); } assertTrue("Companion ad did not link to correct url.", companionAdUrl.waitForExists(15000)); Log.v(TAG, "Finished testCompanionAdLink"); }
Source:
private boolean areEqualIgnoringWhitespace(CharSequence actual, CharSequence expected) { if (actual == null) { return expected == null; } return stripSpace(actual).equals(stripSpace(expected)); }

Target:
private boolean areEqualIgnoringWhitespace(CharSequence actual, CharSequence expected) { if (actual == null) { return expected == null; } checkCharSequenceIsNotNull(expected); return removeAllWhitespaces(actual).equals(removeAllWhitespaces(expected)); }
Source:
public RevCommit call() throws NoHeadException, NoMessageException, UnmergedPathException, JGitInternalException { processOptions(); Ref head; ObjectId parentID; try { head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( "Commit on repo without HEAD currently not supported"); parentID = repo.resolve(Constants.HEAD + "^{commit}"); DirCache index = DirCache.lock(repo); try { ObjectWriter repoWriter = new ObjectWriter(repo); ObjectId indexTreeId = index.writeTree(repoWriter); Commit commit = new Commit(repo); commit.setCommitter(committer); commit.setAuthor(author); commit.setMessage(message); if (parentID != null) commit.setParentIds(new ObjectId[] { parentID }); commit.setTreeId(indexTreeId); ObjectId commitId = repoWriter.writeCommit(commit); RevCommit revCommit = new RevWalk(repo).parseCommit(commitId); RefUpdate ru = repo.updateRef(Constants.HEAD); ru.setNewObjectId(commitId); ru.setRefLogMessage("commit : " + revCommit.getShortMessage(), false); ru.setExpectedOldObjectId(parentID); switch (ru.update()) { case NEW: case FAST_FORWARD: return revCommit; default: throw new IllegalStateException("Updating the ref " + Constants.HEAD + " to " + commitId.toString() + " failed"); } } finally { index.unlock(); } } catch (UnmergedPathException e) { throw e; } catch (IOException e) { throw new JGitInternalException( "Exception caught during execution of commit command", e); } }

Target:
public RevCommit call() throws NoHeadException, NoMessageException, UnmergedPathException, ConcurrentRefUpdateException, JGitInternalException { checkState(); processOptions(); Ref head; ObjectId parentID; try { head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( "Commit on repo without HEAD currently not supported"); parentID = repo.resolve(Constants.HEAD + "^{commit}"); DirCache index = DirCache.lock(repo); try { ObjectWriter repoWriter = new ObjectWriter(repo); ObjectId indexTreeId = index.writeTree(repoWriter); Commit commit = new Commit(repo); commit.setCommitter(committer); commit.setAuthor(author); commit.setMessage(message); if (parentID != null) commit.setParentIds(new ObjectId[] { parentID }); commit.setTreeId(indexTreeId); ObjectId commitId = repoWriter.writeCommit(commit); RevCommit revCommit = new RevWalk(repo).parseCommit(commitId); RefUpdate ru = repo.updateRef(Constants.HEAD); ru.setNewObjectId(commitId); ru.setRefLogMessage("commit : " + revCommit.getShortMessage(), false); ru.setExpectedOldObjectId(parentID); switch (ru.update()) { case NEW: case FAST_FORWARD: setState(false); return revCommit; case LOCK_FAILURE: throw new ConcurrentRefUpdateException( "Could lock HEAD during commit"); default: throw new JGitInternalException("Updating the ref " + Constants.HEAD + " to " + commitId.toString() + " failed"); } } finally { index.unlock(); } } catch (UnmergedPathException e) { throw e; } catch (IOException e) { throw new JGitInternalException( "Exception caught during execution of commit command", e); } }
Source:
public PListViewer() { outlineView = new org.openide.explorer.view.OutlineView(); initComponents(); outline = outlineView.getOutline(); ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel("Key"); Bundle.PListNode_KeyCol(); outlineView.setPropertyColumns( "Type", Bundle.PListNode_TypeCol(), "Value", Bundle.PListNode_ValueCol()); customize(); }

Target:
public PListViewer() { outlineView = new org.openide.explorer.view.OutlineView(); initComponents(); outline = outlineView.getOutline(); ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel("Key"); outlineView.setPropertyColumns( "Type", Bundle.PListNode_TypeCol(), "Value", Bundle.PListNode_ValueCol()); customize(); }
Source:
public void createColumns(List<TmfEventTableColumn> columns) { int i = 0; for (TmfEventTableColumn column : columns) { TableColumn tableCol = new TableColumn(fTable, SWT.LEFT, i); tableCol.setText(column.getHeaderName()); String tooltip = column.getHeaderTooltip(); if (tooltip != null) { tableCol.setToolTipText(tooltip); } if (column instanceof TmfTimestampColumn) { tableCol.setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TIMESTAMP); } else if (column instanceof TmfTypeColumn) { tableCol.setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_TYPE); } else if (column instanceof TmfContentsColumn) { tableCol.setData(Key.FIELD_ID, ITmfEvent.EVENT_FIELD_CONTENT); } tableCol.addControlListener(fResizeListener); tableCol.setWidth(100); i++; } }

Target:
public void createColumns(List<TmfEventTableColumn> columns) { for (TmfEventTableColumn column : columns) { TableColumn tableCol = new TableColumn(fTable, SWT.LEFT); tableCol.setText(column.getHeaderName()); String tooltip = column.getHeaderTooltip(); if (tooltip != null) { tableCol.setToolTipText(tooltip); } tableCol.setData(Key.FIELD_ID, column.getFilterFieldId()); tableCol.addControlListener(fResizeListener); tableCol.pack(); } }
Source:
private String formatByteBuf(ChannelHandlerContext ctx, String eventName, ByteBuf msg) { String chStr = ctx.channel().toString(); int length = msg.readableBytes(); if (length == 0) { StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 4); buf.append(chStr).append(' ').append(eventName).append(": 0B"); return buf.toString(); } else { int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4; StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + 10 + 1 + 2 + rows * 80); buf.append(chStr).append(' ').append(eventName).append(": ").append(length).append('B'); if (byteBufFormat == ByteBufFormat.HEX_DUMP) { buf.append(NEWLINE); appendPrettyHexDump(buf, msg); } return buf.toString(); } }

Target:
private String formatByteBuf(ChannelHandlerContext ctx, String eventName, ByteBuf msg) { String chStr = ctx.channel().toString(); int length = msg.readableBytes(); if (length == 0) { StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 4); buf.append(chStr).append(' ').append(eventName).append(": 0B"); return buf.toString(); } else { int outputLength = chStr.length() + 1 + eventName.length() + 2 + 10 + 1; if (byteBufFormat == ByteBufFormat.HEX_DUMP) { int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4; int hexDumpLength = 2 + rows * 80; outputLength += hexDumpLength; } StringBuilder buf = new StringBuilder(outputLength); buf.append(chStr).append(' ').append(eventName).append(": ").append(length).append('B'); if (byteBufFormat == ByteBufFormat.HEX_DUMP) { buf.append(NEWLINE); appendPrettyHexDump(buf, msg); } return buf.toString(); } }
Source:
void setActiveSegment(String name) { if (!segmentsByName.containsKey(name)) { throw new IllegalArgumentException("There is no log segment with name: " + name); } activeSegment = segmentsByName.get(name); }

Target:
void setActiveSegment(String name) throws IOException { if (!segmentsByName.containsKey(name)) { throw new IllegalArgumentException("There is no log segment with name: " + name); } ConcurrentNavigableMap<String, LogSegment> extraSegments = segmentsByName.tailMap(name, false); Iterator<Map.Entry<String, LogSegment>> iterator = extraSegments.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, LogSegment> entry = iterator.next(); logger.info("Freeing extra segment with name ", entry.getValue().getName()); free(entry.getValue()); iterator.remove(); } logger.info("Setting active segment to [{}]", name); activeSegment = segmentsByName.get(name); }
Source:
public void invoke(String value) throws Exception { assert value.equals(RECORD); }

Target:
public void invoke(String value) throws Exception { assertEquals(RECORD, value); }
Source:
private static Certificate readX509Certificate(Path certificateFilePath) { try { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); Certificate certificate; try (InputStream stream = Files.newInputStream(certificateFilePath)) { certificate = certFactory.generateCertificate(stream); } return certificate; } catch (GeneralSecurityException | IOException e) { throw Throwables.propagate(e); } }

Target:
private static Certificate readX509Certificate(Path certificateFilePath) { try { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); Certificate certificate; try (InputStream stream = Files.newInputStream(certificateFilePath)) { certificate = certFactory.generateCertificate(stream); } return certificate; } catch (GeneralSecurityException | IOException e) { throw new RuntimeException(String.format("Could not read file at \"%s\" as an X.509 certificate", certificateFilePath.toAbsolutePath()), e); } }
Source:
public GlusterHooksListReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); if (mStatus.mCode != 0) { return; } Object[] hooksArr = (Object[]) innerMap.get(HOOKS_LIST); if (hooksArr != null) { for (int i = 0; i < hooksArr.length; i++) { this.hooks.add(getHook((Map<String, Object>) hooksArr[i])); } } }

Target:
public GlusterHooksListReturnForXmlRpc(Map<String, Object> innerMap) { super(innerMap); if (mStatus.mCode != 0) { return; } Object[] hooksArr = (Object[]) innerMap.get(HOOKS_LIST); if (hooksArr != null) { for (Object hookMap : hooksArr) { this.hooks.add(getHook((Map<String, Object>)hookMap)); } } }
Source:
public static String getStyledText(Iterable<StyleRangeEntry> entries, String text) { if (text == null) { return null; } char[] chars = text.toCharArray(); boolean[] mask = new boolean[chars.length]; Arrays.fill(mask, true); boolean _isEmpty = true; for (StyleRangeEntry entry : entries) { _isEmpty = false; int start = entry.getStart(); Arrays.fill(mask, 0, start, false); } StringBuilder styledResult = new StringBuilder(); if (!_isEmpty) { for (int i = 0; i < chars.length; i++) { if (mask[i]) { styledResult.append(chars[i]); } } } return styledResult.toString(); }

Target:
public static String getStyledText(Iterable<StyleRangeEntry> entries, String text) { if (text == null) { return null; } char[] chars = text.toCharArray(); boolean[] mask = new boolean[chars.length]; Arrays.fill(mask, false); boolean isEmpty = true; for (StyleRangeEntry entry : entries) { isEmpty = false; int start = entry.getStart(); Arrays.fill(mask, start, start + entry.getLength(), true); } StringBuilder styledResult = new StringBuilder(); if (!isEmpty) { for (int i = 0; i < chars.length; i++) { if (mask[i]) { styledResult.append(chars[i]); } } } return styledResult.toString(); }
Source:
public static void trace(String option, String message, Throwable throwable) { String systemPrintableMessage = message; while (systemPrintableMessage.length() > 100) { String partial = systemPrintableMessage.substring(0, 100); systemPrintableMessage = systemPrintableMessage.substring(100); System.out.print(partial + "\\"); } System.out.println(systemPrintableMessage); if(fgDebugTrace != null) { fgDebugTrace.trace(option, message, throwable); } }

Target:
public static void trace(String option, String message, Throwable throwable) { String systemPrintableMessage = message; while (systemPrintableMessage.length() > 100) { String partial = systemPrintableMessage.substring(0, 100); systemPrintableMessage = systemPrintableMessage.substring(100); System.out.println(partial + "\\"); } System.out.print(systemPrintableMessage); if(fgDebugTrace != null) { fgDebugTrace.trace(option, message, throwable); } }
Source:
private void verifyAllManagedMemoryIsReleasedAfter(CompletableFuture<Void> after) { FutureUtils.runAfterwardsAsync( after, () -> { if (!memoryManager.verifyEmpty()) { LOG.warn("Not all slot memory is freed, potential memory leak at {}", this); } }, asyncExecutor); }

Target:
private void verifyAllManagedMemoryIsReleasedAfter(CompletableFuture<Void> after) { after.thenRunAsync( () -> { if (!memoryManager.verifyEmpty()) { LOG.warn("Not all slot memory is freed, potential memory leak at {}", this); } }, asyncExecutor); }
Source:
private static boolean performImportWithoutUI(VirtualFile importSource, Project destinationProject) throws IOException { for (ModuleImporter importer : ModuleImporter.getAllImporters(destinationProject)) { if (importer.canImport(importSource)) { HashMap<String, VirtualFile> modules = Maps.newHashMap(); for (ModuleToImport module : importer.findModules(importSource)) { modules.put(module.name, module.location); } importer.importProjects(modules); return true; } } return false; }

Target:
private static boolean performImportWithoutUI(VirtualFile importSource, Project destinationProject) throws IOException { for (ModuleImporter importer : ModuleImporter.getAllImporters(destinationProject)) { if (importer.canImport(importSource)) { Map<String, VirtualFile> modules = Maps.newHashMap(); for (ModuleToImport module : importer.findModules(importSource)) { modules.put(module.name, module.location); } importer.importProjects(modules); return true; } } return false; }
Source:
public static IValue getConditionDeclValue(ExecSimpleDeclaration conditionDeclExec, ActivationRecord record, ConstexprEvaluationContext context) { ICPPBinding declaredBinding = ((ExecDeclarator)conditionDeclExec.getDeclaratorExecutions()[0]).getDeclaredBinding(); conditionDeclExec.executeForFunctionCall(record, context.recordStep()); return record.getVariable(declaredBinding).computeForFunctionCall(record, context).getValue(null); }

Target:
public static IValue getConditionDeclValue(ExecSimpleDeclaration conditionDeclExec, ActivationRecord record, ConstexprEvaluationContext context) { ICPPBinding declaredBinding = ((ExecDeclarator)conditionDeclExec.getDeclaratorExecutions()[0]).getDeclaredBinding(); conditionDeclExec.executeForFunctionCall(record, context.recordStep()); return record.getVariable(declaredBinding).computeForFunctionCall(record, context).getValue(context.getPoint()); }
Source:
public void add( String groupName, List<String> hostFQDNs, List<String> components) { hostGroups.put(groupName, ImmutableList.copyOf(components)); hostGroupsToHosts.put(groupName, ImmutableList.copyOf(hostFQDNs)); hasHosts = true; }

Target:
public void add( String groupName, List<String> hostFQDNs, List<String> components) { Preconditions.checkNotNull(hostFQDNs, "No hosts in list"); Preconditions.checkNotNull(components, "No components to install"); hostGroups.put(groupName, ImmutableList.copyOf(components)); hostGroupsToHosts.put(groupName, ImmutableList.copyOf(hostFQDNs)); hasHosts = true; }
Source:
public AuditLogType getAuditLogTypeValue() { if (EXECUTE.equals(getActionState()) && getSucceeded()){ return outOfSyncHostsExist() ? CLUSTER_SYNC_ALL_NETWORKS_STARTED : CLUSTER_SYNC_NOTHING_TO_DO; } else if (EXECUTE.equals(getActionState()) && !getSucceeded()) { return CLUSTER_SYNC_ALL_NETWORKS_START_ERROR; } else if (END_SUCCESS.equals(getActionState())) { return CLUSTER_SYNC_ALL_NETWORKS_FINISHED; } return CLUSTER_SYNC_ALL_NETWORKS_FAILED; }

Target:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (!getSucceeded()){ return CLUSTER_SYNC_ALL_NETWORKS_START_ERROR; } else if (!outOfSyncHostsExist()){ return CLUSTER_SYNC_NOTHING_TO_DO; } else { return CLUSTER_SYNC_ALL_NETWORKS_STARTED; } case END_SUCCESS: return CLUSTER_SYNC_ALL_NETWORKS_FINISHED; } return CLUSTER_SYNC_ALL_NETWORKS_FAILED; }
Source:
public void stop(boolean abort) { if (!setRunning(false)) { return; } LOG.info("Stopping the Region Procedure Store, isAbort={}", abort); if (localStore != null) { localStore.close(abort); } }

Target:
public void stop(boolean abort) { if (!setRunning(false)) { return; } LOG.info("Stopping the Region Procedure Store, isAbort={}", abort); }
Source:
public synchronized byte[] serialize(Message<?> message) throws SerializationException { Kryo kryo = kryoInstance(); Output output = new Output(2048, -1); kryo.writeObjectOrNull(output, message, GenericMessage.class); return output.getBuffer(); }

Target:
public byte[] serialize(Message<?> message) throws SerializationException { Kryo kryo = kryoInstance(); Output output = new Output(2048, -1); kryo.writeObjectOrNull(output, message, GenericMessage.class); return output.getBuffer(); }
Source:
public void prepare() { try { PluggableSCMMaterial material = (PluggableSCMMaterial) revision.getMaterial(); Modification latestModification = revision.getLatestModification(); SCMRevision scmRevision = new SCMRevision(latestModification.getRevision(), latestModification.getModifiedTime(), null, null, latestModification.getAdditionalDataMap(), null); File destinationFolder = material.workingDirectory(workingDirectory); Result result = scmExtension.checkout(material.getScmConfig().getPluginConfiguration().getId(), buildSCMPropertyConfigurations(material.getScmConfig()), destinationFolder.getAbsolutePath(), scmRevision); if (!result.isSuccessful()) { } } catch (Exception e) { } }

Target:
public void prepare() { try { PluggableSCMMaterial material = (PluggableSCMMaterial) revision.getMaterial(); Modification latestModification = revision.getLatestModification(); SCMRevision scmRevision = new SCMRevision(latestModification.getRevision(), latestModification.getModifiedTime(), null, null, latestModification.getAdditionalDataMap(), null); File destinationFolder = material.workingDirectory(workingDirectory); Result result = scmExtension.checkout(material.getScmConfig().getPluginConfiguration().getId(), buildSCMPropertyConfigurations(material.getScmConfig()), destinationFolder.getAbsolutePath(), scmRevision); handleCheckoutResult(material, result); } catch (Exception e) { consumer.errOutput(String.format("Material %s checkout failed: %s", revision.getMaterial().getDisplayName(), e.getMessage())); } }
Source:
public String getFailureMessage() { String result = null; if (checkHeight && checkWidth) { result = new ComparisonFailure("The expected bounds is not reached.", expectedBounds.toString(), getCurrentAbsoluteBounds().toString()).getMessage(); } else if (checkWidth) { result = new ComparisonFailure("The expected width is not reached.", Integer.toString(expectedBounds.width), Integer.toString(getCurrentAbsoluteBounds().width)).getMessage(); } else if (checkHeight) { result = new ComparisonFailure("The expected width is not reached.", Integer.toString(expectedBounds.height), Integer.toString(getCurrentAbsoluteBounds().height)).getMessage(); } else { result = "The expected location is not reached, expected:<" + expectedBounds.getLocation() + "> but was:<" + getCurrentAbsoluteBounds().getLocation() + ">"; } return result; }

Target:
public String getFailureMessage() { String result = null; if (checkHeight && checkWidth) { result = new ComparisonFailure("The expected bounds is not reached.", expectedBounds.toString(), getCurrentAbsoluteBounds().toString()).getMessage(); } else if (checkWidth) { result = new ComparisonFailure("The expected width is not reached.", Integer.toString(expectedBounds.width), Integer.toString(getCurrentAbsoluteBounds().width)).getMessage(); } else if (checkHeight) { result = new ComparisonFailure("The expected height is not reached.", Integer.toString(expectedBounds.height), Integer.toString(getCurrentAbsoluteBounds().height)).getMessage(); } else { result = new ComparisonFailure("The expected location is not reached.", expectedBounds.getLocation().toString(), getCurrentAbsoluteBounds().getLocation().toString()).getMessage(); } return result; }
Source:
public List<Map<String, String>> resultsFolderJson(@PathVariable("tenant") final String tenant, @RequestParam(value = "not_before", required = false) final String timestamp) { final TenantContext context = _tenantContextFactory.getContext(tenant); final Date searchedTimestamp; if (timestamp == null || Long.valueOf(timestamp) < 0) { searchedTimestamp = null; } else { searchedTimestamp = new Date(Long.valueOf(timestamp)); } final RepositoryFolder resultsFolder = context.getResultFolder(); final List<Map<String, String>> result = new ArrayList<>(); { final List<RepositoryFile> files = resultsFolder.getFiles(null, FileFilters.ANALYSIS_RESULT_SER.getExtension()); for (final RepositoryFile file : files) { final Map<String, String> map = new HashMap<>(); final String name = file.getName(); if (searchedTimestamp != null) { final String timestampString = name.substring(name.lastIndexOf("-") + 1, name.indexOf(".")); final Date jobDate = new Date(Long.valueOf(timestampString)); if (jobDate.after(searchedTimestamp)) { map.put("filename", name); map.put("repository_path", file.getQualifiedPath()); } } else { map.put("filename", name); map.put("repository_path", file.getQualifiedPath()); } if (map.size() > 0) { result.add(map); } } } return result; }

Target:
public List<Map<String, String>> resultsFolderJson(@PathVariable("tenant") final String tenant, @RequestParam(value = "not_before", required = false) final String timestamp) { final TenantContext context = _tenantContextFactory.getContext(tenant); final RepositoryFolder resultsFolder = context.getResultFolder(); final List<Map<String, String>> result = new ArrayList<>(); { final List<RepositoryFile> files = resultsFolder.getFiles(null, FileFilters.ANALYSIS_RESULT_SER.getExtension()); for (final RepositoryFile file : files) { final Map<String, String> map = new HashMap<>(); final String name = file.getName(); if (isEligibleJob(timestamp, name)) { map.put("filename", name); map.put("repository_path", file.getQualifiedPath()); result.add(map); } } } return result; }
Source:
public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final SubscriptionBase subscriptionBase, final Errors errors, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.HIGH_LEVEL_API)) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } try { return createSubscription(subscriptionBase, request); } catch (final DuplicatedSubscriptionException e) { try { return new ResponseEntity<>(getExistingSubscription(subscriptionBase), HttpStatus.OK); } catch (final NakadiException ex) { LOG.error("Error occurred during fetching existing subscription", ex); return Responses.create(Response.Status.INTERNAL_SERVER_ERROR, ex.getProblemMessage(), request); } } catch (final InternalNakadiException e) { LOG.error("Error occurred during subscription creation", e); return Responses.create(e.asProblem(), request); } }

Target:
public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final SubscriptionBase subscriptionBase, final Errors errors, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } if (errors.hasErrors()) { return create(new ValidationProblem(errors), request); } try { return createSubscription(subscriptionBase, request); } catch (final DuplicatedSubscriptionException e) { try { return new ResponseEntity<>(getExistingSubscription(subscriptionBase), HttpStatus.OK); } catch (final NakadiException ex) { LOG.error("Error occurred during fetching existing subscription", ex); return create(INTERNAL_SERVER_ERROR, ex.getProblemMessage(), request); } } catch (final InternalNakadiException e) { LOG.error("Error occurred during subscription creation", e); return create(e.asProblem(), request); } }
Source:
private void sendAllDeferred() { if (!deferredMessages.isEmpty()) logger.info("transmitting deferred messages now ..."); List<Message> localMessages = new ArrayList<>(); final List<Message> highPriority = new ArrayList<>(); for (final Message message : new ArrayList<>(deferredMessages)) { if (message.hasPart(MessageParts.PriorityProcessing)) { if (remotes.containsKey(message.getSubject())) { highPriority.add(message); } else { localMessages.add(message); } deferredMessages.remove(message); } } final List<Message> lowPriority = new ArrayList<>(); do { for (final Message message : new ArrayList<>(deferredMessages)) { if (remotes.containsKey(message.getSubject())) { lowPriority.add(message); localMessages.remove(message); } else { localMessages.add(message); } deferredMessages.remove(message); } } while (!deferredMessages.isEmpty()); try { transportHandler.transmit(highPriority); transportHandler.transmit(lowPriority); for (final Message message : localMessages) { String subject = message.getSubject(); if(!localSubscriptions.containsKey(subject)) { try { throw new NoSubscribersToDeliverTo(subject); } catch (NoSubscribersToDeliverTo ex) { if (message.getErrorCallback() != null) { message.getErrorCallback().error(message, ex); } } } } } finally { deferredMessages.clear(); } }

Target:
private void sendAllDeferred() { if (!deferredMessages.isEmpty()) logger.info("transmitting deferred messages now ..."); final List<Message> highPriority = new ArrayList<>(); for (final Message message : new ArrayList<>(deferredMessages)) { if (message.hasPart(MessageParts.PriorityProcessing)) { if (remotes.containsKey(message.getSubject())) { highPriority.add(message); deferredMessages.remove(message); } } } final List<Message> lowPriority = new ArrayList<>(); for (final Message message : new ArrayList<>(deferredMessages)) { if (remotes.containsKey(message.getSubject())) { lowPriority.add(message); deferredMessages.remove(message); } } try { transportHandler.transmit(highPriority); transportHandler.transmit(lowPriority); for (final Message message : deferredMessages) { String subject = message.getSubject(); if (!(localSubscriptions.containsKey(subject) || subscriptions.containsKey(subject) || shadowSubscriptions.containsKey(subject))) { try { throw new NoSubscribersToDeliverTo(subject); } catch (NoSubscribersToDeliverTo ex) { if (message.getErrorCallback() != null) { message.getErrorCallback().error(message, ex); } } } } } finally { deferredMessages.clear(); } }
Source:
public Map<String, String> getDiskAddressMap(VmDevice vmDevice, DiskInterface diskInterface) { String address = vmDevice.getAddress(); if (diskInterface != DiskInterface.VirtIO_SCSI && diskInterface != DiskInterface.SPAPR_VSCSI) { if (StringUtils.isNotBlank(address)) { return XmlRpcStringUtils.string2Map(address); } } else { try { lockVmDiskHotPlugWithWait(); VM vm = DbFacade.getInstance().getVmDao().get(getParameters().getVmId()); Map<DiskInterface, Integer> controllerIndexMap = ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new GetControllerIndices()).returnValue(); int virtioScsiIndex = controllerIndexMap.get(DiskInterface.VirtIO_SCSI); int sPaprVscsiIndex = controllerIndexMap.get(DiskInterface.SPAPR_VSCSI); if (diskInterface == DiskInterface.VirtIO_SCSI) { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForVirtioScsiDisks(getVm()); return getAddressMapForScsiDisk(address, vmDeviceUnitMap, vmDevice, virtioScsiIndex, false); } else if (diskInterface == DiskInterface.SPAPR_VSCSI) { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForSpaprScsiDisks(getVm()); return getAddressMapForScsiDisk(address, vmDeviceUnitMap, vmDevice, sPaprVscsiIndex, true); } } finally { LockManagerFactory.getLockManager().releaseLock(vmDiskHotPlugEngineLock); } } return null; }

Target:
public Map<String, String> getDiskAddressMap(VmDevice vmDevice, DiskInterface diskInterface) { String address = vmDevice.getAddress(); if (diskInterface != DiskInterface.VirtIO_SCSI && diskInterface != DiskInterface.SPAPR_VSCSI) { if (StringUtils.isNotBlank(address)) { return XmlRpcStringUtils.string2Map(address); } } else { EngineLock vmDiskHotPlugEngineLock = null; try { vmDiskHotPlugEngineLock = lockVmDiskHotPlugWithWait(); VM vm = vmDAO.get(getParameters().getVmId()); Map<DiskInterface, Integer> controllerIndexMap = ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new GetControllerIndices()).returnValue(); int virtioScsiIndex = controllerIndexMap.get(DiskInterface.VirtIO_SCSI); int sPaprVscsiIndex = controllerIndexMap.get(DiskInterface.SPAPR_VSCSI); if (diskInterface == DiskInterface.VirtIO_SCSI) { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForVirtioScsiDisks(getVm()); return getAddressMapForScsiDisk(address, vmDeviceUnitMap, vmDevice, virtioScsiIndex, false); } else if (diskInterface == DiskInterface.SPAPR_VSCSI) { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForSpaprScsiDisks(getVm()); return getAddressMapForScsiDisk(address, vmDeviceUnitMap, vmDevice, sPaprVscsiIndex, true); } } finally { LockManagerFactory.getLockManager().releaseLock(vmDiskHotPlugEngineLock); } } return null; }
Source:
private AtomicReference<Status> processRequest(DataSegmentChangeRequest changeRequest) { synchronized (requestStatusesLock) { if (requestStatuses.getIfPresent(changeRequest) == null) { if (changeRequest instanceof SegmentChangeRequestLoad) { requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING)); exec.submit( () -> SegmentLoadDropHandler.this.addSegment( ((SegmentChangeRequestLoad) changeRequest).getSegment(), DataSegmentChangeCallback.NOOP ) ); } else if (changeRequest instanceof SegmentChangeRequestDrop) { requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING)); SegmentLoadDropHandler.this.removeSegment( ((SegmentChangeRequestDrop) changeRequest).getSegment(), DataSegmentChangeCallback.NOOP, true ); } else { throw new IAE("Not a segment load/drop request[%s].", changeRequest.getClass().getName()); } } return requestStatuses.getIfPresent(changeRequest); } }

Target:
private AtomicReference<Status> processRequest(DataSegmentChangeRequest changeRequest) { synchronized (requestStatusesLock) { if (requestStatuses.getIfPresent(changeRequest) == null) { changeRequest.go( new DataSegmentChangeHandler() { @Override public void addSegment(DataSegment segment, DataSegmentChangeCallback callback) { requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING)); exec.submit( () -> SegmentLoadDropHandler.this.addSegment( ((SegmentChangeRequestLoad) changeRequest).getSegment(), () -> resolveWaitingFutures() ) ); } @Override public void removeSegment(DataSegment segment, DataSegmentChangeCallback callback) { requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING)); SegmentLoadDropHandler.this.removeSegment( ((SegmentChangeRequestDrop) changeRequest).getSegment(), () -> resolveWaitingFutures(), true ); } }, () -> resolveWaitingFutures() ); } return requestStatuses.getIfPresent(changeRequest); } }
Source:
public StreamSpec streamFromConfig(String streamId) { StreamConfig streamConfig = new StreamConfig(config); String system = streamConfig.getSystem(streamId); String physicalName = streamConfig.getPhysicalName(streamId, streamId); Map<String, String> properties = streamConfig.getStreamProperties(streamId); return new StreamSpec(streamId, physicalName, system, properties); }

Target:
public StreamSpec streamFromConfig(String streamId) { StreamConfig streamConfig = new StreamConfig(config); String physicalName = streamConfig.getPhysicalName(streamId, streamId); return streamFromConfig(streamId, physicalName); }
Source:
private Integer getPrecedenceLevel(RouterErrorCode routerErrorCode) { if (precedenceLevels.containsKey(routerErrorCode)) { return precedenceLevels.get(routerErrorCode); } else { return Integer.MIN_VALUE; } }

Target:
private Integer getPrecedenceLevel(RouterErrorCode routerErrorCode) { switch (routerErrorCode) { case BlobExpired: return 1; case AmbryUnavailable: return 2; case UnexpectedInternalError: return 3; case OperationTimedOut: return 4; case BlobDoesNotExist: return 5; default: return Integer.MIN_VALUE; } }