auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void addPossibleSinkForValue(String value, HttpMessage sink) { synchronized (possibleSinksForValues) { List<HttpMessage> sinkList; sinkList = possibleSinksForValues.get(value); if (sinkList == null) { sinkList = new ArrayList<HttpMessage>(); possibleSinksForValues.put(value, sinkList); } for (HttpMessage s : sinkList) { if (s.equals(sink)) { return; } } sinkList.add(sink); } }

Target:
public void addPossibleSinkForValue(String value, HttpMessage sink) { synchronized (possibleSinksForValues) { Set<Integer> sinksForValue = possibleSinksForValues.get(value); if (sinksForValue == null) { sinksForValue = new HashSet<>(); possibleSinksForValues.put(value, sinksForValue); } boolean newMessage = sinksForValue.add(sink.hashCode()); if (newMessage) { int msgId = messagesStorage.storeMessage(sink); messagesHashToStorageIds.put(sink.hashCode(), msgId); } } }
Source:
public final RpcOptions build() { return new RpcOptions(timeout, TimeUnit.MILLISECONDS, responseFilter, responseMode, skipReplicationQueue, fifoOrder, totalOrder); }

Target:
public final RpcOptions build() { return new RpcOptions(timeout, unit, responseFilter, responseMode, skipReplicationQueue, fifoOrder, totalOrder); }
Source:
protected void testIntersections(Comparison comparison) { assertFalse(Iterables.any(comparison.getDifferences(), new Predicate<Diff>() { @SuppressWarnings("restriction") public boolean apply(Diff input) { return Iterators.size(Iterators .filter(input.getRefines().iterator(), not(instanceOf(MultiplicityReferenceChange.class)))) > 1; } })); }

Target:
protected void testIntersections(Comparison comparison) { assertFalse(Iterables.any(comparison.getDifferences(), new Predicate<Diff>() { public boolean apply(Diff input) { return input.getRefines().size() > 1; } })); }
Source:
public static String getLocalHost() throws UnknownHostException { try { String ip = InetAddress.getLocalHost().getHostAddress(); if (ip.equals("127.0.0.1")) { return getAddress(); } else return ip; } catch (Throwable e) { String ip = getAddress(); if (ip != null && !ip.isEmpty()) { return ip; } throw new UnknownHostException("InetAddress java.net.InetAddress.getLocalHost() throws UnknownHostException," + e.getMessage()); } }

Target:
public static String getLocalHost() throws UnknownHostException { String ip = InetAddress.getLocalHost().getHostAddress(); if (InetAddress.getLocalHost().isLoopbackAddress()) { return getValidAddress(); } else { return ip; } }
Source:
private static void handleUndoLog(List<UndoAction> undoLog, boolean undo) { if (undoLog == null) { return; } ListIterator<UndoAction> iterator = (undo) ? undoLog.listIterator(undoLog.size()) : undoLog.listIterator(); for (; (undo ? iterator.hasPrevious() : iterator.hasNext());) { if (undo) { iterator.previous().undo(); } else { iterator.next().release(); } } if (undo) { undoLog.clear(); } }

Target:
private static void handleUndoLog(List<UndoAction> undoLog, boolean undo) { if (undoLog == null) { return; } if (undo) { undoLog = Lists.reverse(undoLog); } for (UndoAction action : undoLog) { if (undo) { action.undo(); } else { action.release(); } } if (undo) { undoLog.clear(); } }
Source:
private GlowBlock createMockBlock(Location location, Material type, byte data) { GlowBlock mockBlock = PowerMockito.mock(GlowBlock.class); when(mockBlock.getLocation()).thenReturn(location); when(mockBlock.getType()).thenReturn(type); when(mockBlock.getTypeId()).thenReturn(type.getId()); when(mockBlock.getData()).thenReturn(data); BlockEntity entity = null; BlockType blockType = ItemTable.instance().getBlock(type); if (blockType != null) { entity = blockType.createBlockEntity(mockBlock); } when(mockBlock.getBlockEntity()).thenReturn(entity); return mockBlock; }

Target:
private GlowBlock createMockBlock(Location location, Material type, byte data) { GlowBlock mockBlock = Mockito.mock(GlowBlock.class); when(mockBlock.getLocation()).thenReturn(location); when(mockBlock.getType()).thenReturn(type); when(mockBlock.getTypeId()).thenReturn(type.getId()); when(mockBlock.getData()).thenReturn(data); BlockEntity entity = null; BlockType blockType = ItemTable.instance().getBlock(type); if (blockType != null) { GlowChunk mockChunk = Mockito.mock(GlowChunk.class); when(mockChunk.getBlock(anyInt(), anyInt(), anyInt())).thenReturn(mockBlock); entity = blockType.createBlockEntity(mockChunk, 0, 0, 0); } when(mockBlock.getBlockEntity()).thenReturn(entity); return mockBlock; }
Source:
public void testHoles() throws IOException { CatalogJanitor janitor = TEST_UTIL.getHBaseCluster().getMaster().getCatalogJanitor(); CatalogJanitor.Report report = janitor.getLastReport(); assertTrue(report.isEmpty()); verifyCornerHoles(janitor, T1); verifyCornerHoles(janitor, T2); verifyMiddleHole(janitor); janitor.scan(); assertEquals(5, janitor.getLastReport().getHoles().size()); }

Target:
public void testHoles() throws IOException { CatalogJanitor janitor = TEST_UTIL.getHBaseCluster().getMaster().getCatalogJanitor(); CatalogJanitor.Report report = janitor.getLastReport(); assertTrue(report.isEmpty()); verifyCornerHoles(janitor, T1); verifyCornerHoles(janitor, T2); verifyMiddleHole(janitor); fixHoles(janitor); }
Source:
protected abstract void updateNewlyCreatedEObjectWithEObjectDragged(T slot, S property) throws ExecutionException; @Override protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { return null; }

Target:
protected abstract void updateNewlyCreatedEObjectWithEObjectDragged(T slot, S property) throws ExecutionException; @Override protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { throw new ExecutionException("not implemented"); }
Source:
private static boolean isTableRow(TagNode node) { return "TR".equalsIgnoreCase(node.getNodeName()); }

Target:
private static boolean isTableRow(TagNode node) { return node.equalsElementName("TR"); }
Source:
public void shutdown() { if (_server != null) { try { _server.stop(); LOG.info("Helix rest server stopped!"); } catch (Exception ex) { LOG.error("Failed to stop Helix rest server, " + ex); } } _jmxReporterList.forEach(JmxReporter::stop); cleanupResourceConfigs(); }

Target:
public synchronized void shutdown() { if (_server != null) { try { _server.stop(); LOG.info("Helix rest server stopped!"); } catch (Exception ex) { LOG.error("Failed to stop Helix rest server, " + ex); } } _jmxReporterList.forEach(JmxReporter::stop); _jmxReporterList.clear(); cleanupResourceConfigs(); }
Source:
public double getLogProb(double value) { checkHasParams(); if (value < 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(lambda) - lambda * value; } }

Target:
public double getLogProb(double value) { checkHasParams(); if (value < 0) { return Double.NEGATIVE_INFINITY; } else { return logLambda - lambda * value; } }
Source:
public boolean acquireWriteLock(String ownerId) { try (Handle handle = rdbi.open()) { final MultiReadSingleWriteLockDAO dao = handle.attach(MultiReadSingleWriteLockDAO.class); while (true) { final int acquiredLock = dao.acquireWriteLock(writeLockKey, ownerId, writeTimeoutMillis); if (acquiredLock > 0) { break; } Thread.sleep(250); } while (true) { final Long readerCount = handle.jedis().zcount(readLockKey, Long.toString(Instant.now().getMillis()), "+inf"); if (readerCount < 1) { return true; } Thread.sleep(250); } } catch (InterruptedException e) { throw new RuntimeException(e); } }

Target:
public boolean acquireWriteLock(String ownerId) { try (Handle handle = rdbi.open()) { final MultiReadSingleWriteLockDAO dao = handle.attach(MultiReadSingleWriteLockDAO.class); while (true) { final int acquiredLock = dao.acquireWriteLock(writeLockKey, ownerId, writeTimeoutMillis); if (acquiredLock > 0) { break; } Thread.sleep(250); } while (true) { final Long readerCount = handle.jedis().zcount(readLockKey, Long.toString(Instant.now().toEpochMilli()), "+inf"); if (readerCount < 1) { return true; } Thread.sleep(250); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return false; }
Source:
public WeekProfile(final String weekProfileName, final DayProfile monday, final DayProfile tuesday, final DayProfile wednesday, final DayProfile thursday, final DayProfile friday, final DayProfile saturday, final DayProfile sunday) { super(); this.weekProfileName = weekProfileName; this.monday = monday; this.tuesday = tuesday; this.wednesday = wednesday; this.thursday = thursday; this.friday = friday; this.saturday = saturday; this.sunday = sunday; }

Target:
public WeekProfile(final String weekProfileName, final DayProfile monday, final DayProfile tuesday, final DayProfile wednesday, final DayProfile thursday, final DayProfile friday, final DayProfile saturday, final DayProfile sunday) { this.weekProfileName = weekProfileName; this.monday = monday; this.tuesday = tuesday; this.wednesday = wednesday; this.thursday = thursday; this.friday = friday; this.saturday = saturday; this.sunday = sunday; }
Source:
public String getMessage() { return relativeError.getMessage(); }

Target:
public String getMessage() { return message; }
Source:
public void scheduleContainerRestart(String containerId) { StreamingContainerAgent cs = this.getContainerAgent(containerId); if (cs == null || cs.isShutdownRequested()) { return; } LOG.info("Initiating recovery for {}@{}", containerId, cs.container.host); cs.container.setState(PTContainer.State.KILLED); cs.container.bufferServerAddress = null; cs.container.setResourceRequestPriority(-1); cs.container.setAllocatedMemoryMB(0); cs.container.setAllocatedVCores(0); UpdateCheckpointsContext ctx = new UpdateCheckpointsContext(clock, false, getCheckpointGroups()); for (PTOperator oper : cs.container.getOperators()) { updateRecoveryCheckpoints(oper, ctx, false); } includeLocalUpstreamOperators(ctx); LOG.info("Affected operators {}", ctx.visited); deploy(Collections.<PTContainer>emptySet(), ctx.visited, Sets.newHashSet(cs.container), ctx.visited); }

Target:
public void scheduleContainerRestart(String containerId) { StreamingContainerAgent cs = this.getContainerAgent(containerId); if (cs == null || cs.isShutdownRequested()) { return; } LOG.info("Initiating recovery for {}@{}", containerId, cs.container.host); cs.container.setState(PTContainer.State.KILLED); cs.container.bufferServerAddress = null; cs.container.setResourceRequestPriority(-1); cs.container.setAllocatedMemoryMB(0); cs.container.setAllocatedVCores(0); UpdateCheckpointsContext ctx = new UpdateCheckpointsContext(clock, false, getCheckpointGroups()); for (PTOperator oper : cs.container.getOperators()) { updateRecoveryCheckpoints(oper, ctx, false); } includeLocalUpstreamOperators(ctx); groupingManager.addOrModifyGroupingRequest(containerId, ctx.visited); groupingManager.removeProcessedGroupingRequests(); LOG.info("Affected operators {}", ctx.visited); deploy(Collections.<PTContainer>emptySet(), ctx.visited, Sets.newHashSet(cs.container), ctx.visited); }
Source:
public void testCircularBlockingQueueTakeBlock() throws InterruptedException, ExecutionException { final CircularBlockingQueue<Integer> testQueue = new CircularBlockingQueue<>(2); ExecutorService executor = Executors.newSingleThreadExecutor(); Future<Integer> testTake = executor.submit(() -> { return testQueue.take(); }); while (!testQueue.isConsumerThreadBlocked()) { Thread.sleep(50L); } testQueue.offer(10); Integer result = testTake.get(); Assert.assertEquals(10, result.intValue()); }

Target:
public void testCircularBlockingQueueTakeBlock() throws InterruptedException, ExecutionException { final CircularBlockingQueue<Integer> testQueue = new CircularBlockingQueue<>(2); ExecutorService executor = Executors.newSingleThreadExecutor(); try { Future<Integer> testTake = executor.submit(() -> { return testQueue.take(); }); while (!testQueue.isConsumerThreadBlocked()) { Thread.sleep(50L); } testQueue.offer(10); Integer result = testTake.get(); Assert.assertEquals(10, result.intValue()); } finally { executor.shutdown(); } }
Source:
public void testHttpAccessLogGeneration() { BufferedReader bf = null; boolean found = false; String line; try { axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("HttpAccessLogsTestProxy"), getBackEndServiceUrl(ESBTestConstant.SIMPLE_STOCK_QUOTE_SERVICE), "WSO2"); File[] files = new File(httpLogDir).listFiles(); Assert.assertTrue(files.length > 0, "nhttp access logs were not written to the configured directory " + httpLogDir); String fileName = null; for (int i = 0; i < files.length; i++) { fileName = files[i].getName(); } Thread.sleep(30000); bf = new BufferedReader(new FileReader(httpLogDir + File.separator + fileName)); while ((line = bf.readLine()) != null) { int indexfound = line.indexOf("HttpAccessLogsTestProxy"); if (indexfound > -1) { found = true; break; } } assertTrue(found, "Access logs not generated for the proxy service."); } catch (IOException e) { log.warn("Error occurred while reading access log file content", e); } catch (InterruptedException e) { log.warn("Error occurred while thread sleep", e); } catch (XPathExpressionException e) { log.warn("Error occurred while sending simple quote request.", e); } finally { if (bf != null) { try { bf.close(); } catch (IOException e) { log.warn("Error occurred while closing buffered reader", e); } } } }

Target:
public void testHttpAccessLogGeneration() throws Exception { BufferedReader bf = null; boolean found = false; String line; try { axis2Client.sendSimpleStockQuoteRequest(getProxyServiceURLHttp("HttpAccessLogsTestProxy"), getBackEndServiceUrl(ESBTestConstant.SIMPLE_STOCK_QUOTE_SERVICE), "WSO2"); File[] files = new File(httpLogDir).listFiles(); Assert.assertTrue(files.length > 0, "nhttp access logs were not written to the configured directory " + httpLogDir); String fileName = null; for (int i = 0; i < files.length; i++) { fileName = files[i].getName(); } Thread.sleep(30000); bf = new BufferedReader(new FileReader(httpLogDir + File.separator + fileName)); while ((line = bf.readLine()) != null) { int indexfound = line.indexOf("HttpAccessLogsTestProxy"); if (indexfound > -1) { found = true; break; } } assertTrue(found, "Access logs not generated for the proxy service."); } finally { if (bf != null) { bf.close(); } } }
Source:
private static void createDummyTrace(String metadata) { File f; try { f = new File(tempTraceDir); if (f.exists()) { deltree(f); } f.mkdirs(); f = new File(tempTraceDir + "/metadata"); FileWriter fw = new FileWriter(f); fw.write(metadata); fw.close(); f.createNewFile(); byte magicLE[] = { (byte) 0xC1, (byte) 0x1F, (byte) 0xFC, (byte) 0xC1 }; byte uuid[] = { (byte) 0xb0, 0x4d, 0x39, 0x1b, (byte) 0xe7, 0x36, 0x44, (byte) 0xc1, (byte) 0x8d, (byte) 0x89, 0x4b, (byte) 0xb4, 0x38, (byte) 0x85, 0x7f, (byte) 0x8d }; int packetSize = 4096; final int size = packetSize + 48; Event ev = new Event(2, 2); ByteBuffer data = ByteBuffer.allocate(size); data.order(ByteOrder.LITTLE_ENDIAN); data.putLong(0); data.putLong(1000000); data.putLong(32672); data.putLong(packetSize*8); data.putInt(0); data.putInt(0); int nbEvents = packetSize/ev.getSize(); for (int i = 0; i < nbEvents; i++) { ev.setEventTimestamp(i+1); ev.writeEvent(data); } f = new File(tempTraceDir + "/dummyChan"); fw = new FileWriter(f); FileOutputStream fos = new FileOutputStream(f); fos.write(magicLE); fos.write(uuid); fos.write(data.array()); fos.close(); fw.close(); f.createNewFile(); } catch (IOException e) { e.printStackTrace(); } finally { f = null; } }

Target:
private static void createDummyTrace(String metadata) { File f; try { f = new File(tempTraceDir); if (f.exists()) { deltree(f); } f.mkdirs(); f = new File(tempTraceDir + "/metadata"); FileWriter fw = new FileWriter(f); fw.write(metadata); fw.close(); f.createNewFile(); byte magicLE[] = { (byte) 0xC1, (byte) 0x1F, (byte) 0xFC, (byte) 0xC1 }; byte uuid[] = { (byte) 0xb0, 0x4d, 0x39, 0x1b, (byte) 0xe7, 0x36, 0x44, (byte) 0xc1, (byte) 0x8d, (byte) 0x89, 0x4b, (byte) 0xb4, 0x38, (byte) 0x85, 0x7f, (byte) 0x8d }; Event ev = new Event(2, 2); int dataSize = 4096; final int headerSize = 24 + 44; final int packetSize = dataSize + headerSize + 512; final int nbEvents = (dataSize / ev.getSize()) - 1; final int contentSize = (nbEvents * ev.getSize() + headerSize) * 8; ByteBuffer data = ByteBuffer.allocate(packetSize); data.order(ByteOrder.LITTLE_ENDIAN); data.put(magicLE); data.put(uuid); data.putInt(0); data.putLong(0xa500); data.putLong(nbEvents * 0x10000 + 0xa5a6); data.putLong(contentSize); data.putLong(packetSize * 8); data.putLong(0); data.putInt(0); for (int i = 0; i < nbEvents; i++) { ev.setEventTimestamp(i * 0x10000 + 0xa5a5); ev.setEventContent(i); ev.writeEvent(data); } f = new File(tempTraceDir + "/dummyChan"); fw = new FileWriter(f); FileOutputStream fos = new FileOutputStream(f); fos.write(data.array()); fos.close(); fw.close(); f.createNewFile(); } catch (IOException e) { e.printStackTrace(); } finally { f = null; } }
Source:
private <R extends PersistableBusinessObject> void writeResultsDetailsToReportByResultCode(List<RassBusinessObjectUpdateResult<R>> results, Class businessObjectClass, RassObjectUpdateResultCode resultCode) { List<RassBusinessObjectUpdateResult<R>> filteresdResults = results.stream().filter(result -> resultCode.equals(result.getResultCode())) .collect(Collectors.toList()); writeHeaderForResultsDetailsByResultCode(businessObjectClass, resultCode); for (RassBusinessObjectUpdateResult<R> result : filteresdResults) { writeResultDetailToReport(result); } }

Target:
private <R extends PersistableBusinessObject> void writeResultsDetailsToReportByResultCode(List<RassBusinessObjectUpdateResult<R>> results, Class businessObjectClass, RassObjectUpdateResultCode resultCode) { List<RassBusinessObjectUpdateResult<R>> filteredResults = results.stream().filter(result -> resultCode.equals(result.getResultCode())) .collect(Collectors.toList()); writeHeaderForResultsDetailsByResultCode(businessObjectClass, resultCode); for (RassBusinessObjectUpdateResult<R> result : filteredResults) { writeResultDetailToReport(result); } }
Source:
private DocumentMetadata.Builder handleAdditionalIds(OafEntity oafEntity, DocumentMetadata.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(oafEntity.getPid())) { Map<CharSequence, CharSequence> additionalIds = new HashMap<CharSequence, CharSequence>(); for (StructuredProperty currentPid : oafEntity.getPid()) { if (StringUtils.isNotBlank(currentPid.getQualifier().getClassid()) && StringUtils.isNotBlank(currentPid.getValue()) && fieldApprover.approve(currentPid.getDataInfo())) { additionalIds.put(currentPid.getQualifier().getClassid(), currentPid.getValue()); } } if (MapUtils.isNotEmpty(additionalIds)) { metaBuilder.setExternalIdentifiers(additionalIds); } } return metaBuilder; }

Target:
private void handleAdditionalIds(OafEntity oafEntity, DocumentMetadata.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(oafEntity.getPid())) { Map<CharSequence, CharSequence> additionalIds = oafEntity.getPid().stream() .filter(x -> StringUtils.isNotBlank(x.getQualifier().getClassid())) .filter(x -> StringUtils.isNotBlank(x.getValue())) .filter(x -> fieldApprover.approve(x.getDataInfo())) .map(x -> new AbstractMap.SimpleEntry<>(x.getQualifier().getClassid(), x.getValue())) .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue, (val1, val2) -> val1)); if (MapUtils.isNotEmpty(additionalIds)) { metaBuilder.setExternalIdentifiers(additionalIds); } } }
Source:
public OAuth2AuthorizedClientProviderBuilder authorizationCode() { this.builders.computeIfAbsent(AuthorizationCodeGrantBuilder.class, k -> new AuthorizationCodeGrantBuilder()); return OAuth2AuthorizedClientProviderBuilder.this; }

Target:
public OAuth2AuthorizedClientProviderBuilder authorizationCode() { this.builders.computeIfAbsent(AuthorizationCodeOAuth2AuthorizedClientProvider.class, k -> new AuthorizationCodeGrantBuilder()); return OAuth2AuthorizedClientProviderBuilder.this; }
Source:
public @Nullable IEventDeclaration getEventDeclaration(int eventId) { if (eventId == EventDeclaration.UNSET_EVENT_ID) { return fEvents.get(0); } if (eventId < 0) { throw new IllegalArgumentException("Event ID cannot be negative."); } if (eventId >= fEvents.size()) { return null; } return fEvents.get(eventId); }

Target:
public @Nullable IEventDeclaration getEventDeclaration(int eventId) { int eventIndex = (eventId == EventDeclaration.UNSET_EVENT_ID) ? 0 : eventId; if (eventIndex < 0) { throw new IllegalArgumentException("Event ID cannot be negative."); } if (eventIndex >= fEvents.size()) { return null; } return fEvents.get(eventIndex); }
Source:
protected List<Name> getLogNames(LogManager manager, String names) { if (ALL_LOGS.equalsIgnoreCase(names)) { return manager.listAll().stream().filter(name -> !INPUT_STREAM.equals(name)) .collect(Collectors.toList()); } List<Name> ret = Arrays.asList(names.split(",")).stream().map(Name::ofUrn).collect(Collectors.toList()); if (ret.isEmpty()) { throw new IllegalArgumentException("No log name provided or found."); } for (Name name : ret) { if (!manager.exists(name)) { throw new IllegalArgumentException("Unknown log name: " + name); } } return ret; }

Target:
protected List<Name> getLogNames(LogManager manager, String names) { if (ALL_LOGS.equalsIgnoreCase(names)) { return manager.listAllNames().stream().filter(name -> !INPUT_STREAM.equals(name.getName())) .collect(Collectors.toList()); } List<Name> ret = Arrays.stream(names.split(",")).map(Name::ofUrn).collect(Collectors.toList()); if (ret.isEmpty()) { throw new IllegalArgumentException("No log name provided or found."); } for (Name name : ret) { if (!manager.exists(name)) { throw new IllegalArgumentException("Unknown log name: " + name); } } return ret; }
Source:
public CommunicationsManager getCommsManager() { return commsManager; }

Target:
CommunicationsManager getCommsManager() { return commsManager; }
Source:
public void selectFromListByIndex(String locator, String... indexes) { if (indexes.length == 0) { throw new SeleniumLibraryNonFatalException("No index given."); } List<String> tmp = new ArrayList<>(Arrays.asList(indexes)); String items = String.format("index(es) '%s'", Python.join(", ", tmp)); logging.info(String.format("Selecting %s from list '%s'.", items, locator)); Select select = getSelectList(locator); for (String index : indexes) { select.selectByIndex(Integer.parseInt(index)); } }

Target:
public void selectFromListByIndex(String locator, String... indexes) { if (indexes.length == 0) { throw new SeleniumLibraryNonFatalException("No index given."); } List<String> tmp = new ArrayList<>(); Collections.addAll(tmp, indexes); String items = String.format("index(es) '%s'", Python.join(", ", tmp)); logging.info(String.format("Selecting %s from list '%s'.", items, locator)); Select select = getSelectList(locator); for (String index : indexes) { select.selectByIndex(Integer.parseInt(index)); } }
Source:
private Database getDatabase() { if (database == null) { List<Database> databaseList = documentClient .queryDatabases( "SELECT * FROM root r WHERE r.id='" + databaseId + "'", null).getQueryIterable().toList(); if (databaseList.size() > 0) { database = databaseList.get(0); } else { try { Database databaseDefinition = new Database(); databaseDefinition.setId(databaseId); database = documentClient.createDatabase( databaseDefinition, null).getResource(); } catch (DocumentClientException e) { e.printStackTrace(); } } } return database; }

Target:
private Database getDatabase() { if (database == null) { List<Database> databaseList = documentClient .queryDatabases( "SELECT * FROM root r WHERE r.id='" + databaseId + "'", null) .getQueryIterable() .toList(); if (databaseList.size() > 0) { database = databaseList.get(0); } else { try { Database databaseDefinition = new Database(); databaseDefinition.setId(databaseId); database = documentClient.createDatabase(databaseDefinition, null) .getResource(); } catch (DocumentClientException e) { e.printStackTrace(System.err); } } } return database; }
Source:
void setupIndentationLevel() { level.style.marginLeft = margin(20 * presenter.getLevel()); }

Target:
void setupIndentationLevel() { final int indentationLevel = presenter.getLevel(); final int pixelsPerLevel = 20; final int marginPixels = pixelsPerLevel * indentationLevel; this.level.style.marginLeft = margin(marginPixels); }
Source:
private static EnsembleProvider createEnsembleProvider( final String type, final String serversAndPort, final String path) { final EnsembleProvider result; if (TYPE_EXHIBITOR.equalsIgnoreCase(type)) { final String[] hostsPort = serversAndPort.split(":"); if (hostsPort.length != 2) { throw new RuntimeException("Failed to parse zookeeper connection configuration, port not found in " + serversAndPort); } final Exhibitors exhibitors = new Exhibitors( Arrays.asList(hostsPort[0].split(",")), Integer.parseInt(hostsPort[1]), () -> { throw new RuntimeException("No backup list exists"); }); final ExhibitorRestClient exhibitorRestClient = new DefaultExhibitorRestClient(); result = new ExhibitorEnsembleProvider( exhibitors, exhibitorRestClient, "/exhibitor/v1/cluster/list", EXHIBITOR_POLLING_MS, new ExponentialBackoffRetry(EXHIBITOR_RETRY_TIME, EXHIBITOR_RETRY_MAX), path); } else if (TYPE_ZOOKEEPER.equalsIgnoreCase(type)) { result = new FixedEnsembleProvider(serversAndPort + path); } else { throw new RuntimeException("Connection type for zookeeper ensemble provider is not supported: " + type); } return result; }

Target:
private static EnsembleProvider createEnsembleProvider( final String type, final String serversAndPort, final String path) { final EnsembleProvider result; if (TYPE_EXHIBITOR.equalsIgnoreCase(type)) { final String[] hostsPort = serversAndPort.split(":"); if (hostsPort.length != 2) { throw new RuntimeException("Failed to parse zookeeper connection configuration, port not found in " + serversAndPort); } final Exhibitors exhibitors = new Exhibitors( Arrays.asList(hostsPort[0].split(",")), Integer.parseInt(hostsPort[1]), () -> { throw new RuntimeException("No backup list exists"); }); final ExhibitorRestClient exhibitorRestClient = new DefaultExhibitorRestClient(); result = new ExhibitorEnsembleProvider( exhibitors, exhibitorRestClient, "/exhibitor/v1/cluster/list", EXHIBITOR_POLLING_MS, new ExponentialBackoffRetry(EXHIBITOR_RETRY_TIME, EXHIBITOR_RETRY_MAX), path); } else if (TYPE_ZOOKEEPER.equalsIgnoreCase(type)) { final List<String> hosts = Arrays.asList(serversAndPort.split(",")); Collections.shuffle(hosts); result = new FixedEnsembleProvider(String.join(",", hosts) + path); } else { throw new RuntimeException("Connection type for zookeeper ensemble provider is not supported: " + type); } return result; }
Source:
private Hosts mapCollection(List<VDS> entities) { ApplicationMode appMode = getCurrent().get(ApplicationMode.class); Hosts collection = new Hosts(); for (VDS entity : entities) { if (appMode == ApplicationMode.GlusterOnly) { collection.getHosts().add(addLinks(populate(map(entity), entity), "storage")); } else { collection.getHosts().add(addLinks(populate(map(entity), entity))); } } return collection; }

Target:
private Hosts mapCollection(List<VDS> entities) { Hosts collection = new Hosts(); for (VDS entity : entities) { collection.getHosts().add(addLinks(populate(map(entity), entity))); } return collection; }
Source:
void shouldNotContainNoIssuesSinceLabelWhenTotalIsNotZero() { AnalysisResult analysisResult = createAnalysisResult(Maps.fixedSize.of(), 0, 0, Lists.immutable.empty(), 0, 0); when(analysisResult.getTotalSize()).thenReturn(1); String createdHtml = createTestData(analysisResult).create(); assertThat(createdHtml).doesNotContain("No warnings for"); }

Target:
void shouldNotContainNoIssuesSinceLabelWhenTotalIsNotZero() { AnalysisResult analysisResult = createAnalysisResult(Maps.fixedSize.of(), 0, 0, Lists.immutable.empty(), 0, 0); when(analysisResult.getTotalSize()).thenReturn(1); String createdHtml = createTestData(analysisResult).create(); assertThat(createdHtml).doesNotContain("No warnings for"); assertThat(createdHtml).contains("<a href=\"testResult\">One warning</a>"); }
Source:
private boolean validateCategoricalVariableHasAPossibleValue(final MeasurementVariable var) { if (var.getDataTypeId() !=null && var.getDataTypeId() == TermId.CATEGORICAL_VARIABLE.getId()) { return var.getPossibleValues() != null; } return true; }

Target:
private boolean validateCategoricalVariableHasAPossibleValue(final MeasurementVariable var) { if (var.getDataTypeId() !=null && var.getDataTypeId() == TermId.CATEGORICAL_VARIABLE.getId()) { return !CollectionUtils.isEmpty(var.getPossibleValues()); } return true; }
Source:
private AssertionError getThrownErrorPostMapper(Function<StringBuilder, StringBuilder> errorMessageMapper) { try { FxAssert.verifyThat(false, alwaysFail(), errorMessageMapper); throw new AssertionError("Error: verifyThat did not throw an error when it should have."); } catch (AssertionError error) { return error; } }

Target:
private AssertionError getThrownErrorPostMapper(Function<StringBuilder, StringBuilder> errorMessageMapper) { try { verifyThat(false, alwaysFail(), errorMessageMapper.compose(sb -> new StringBuilder())); throw new AssertionError("Error: verifyThat did not throw an error when it should have."); } catch (AssertionError error) { return error; } }
Source:
public void testFileLock() throws IOException { File file = File.createTempFile("temp", "1"); FileLock lock = new FileLock(file); lock.lock(); Assert.assertFalse(lock.tryLock()); lock.unlock(); Assert.assertTrue(lock.tryLock()); lock.unlock(); lock.destroy(); }

Target:
public void testFileLock() throws IOException { File file = File.createTempFile("temp", "1"); file.deleteOnExit(); FileLock lock = new FileLock(file); lock.lock(); Assert.assertFalse(lock.tryLock()); lock.unlock(); Assert.assertTrue(lock.tryLock()); lock.unlock(); lock.destroy(); }
Source:
public void freeMemory(AllocationPoint point) { if (point.getAllocationStatus() == AllocationStatus.DEVICE) { this.getMemoryHandler().getMemoryProvider().free(point); point.setAllocationStatus(AllocationStatus.HOST); this.getMemoryHandler().getMemoryProvider().free(point); } else { this.getMemoryHandler().getMemoryProvider().free(point); } allocationsMap.remove(point.getObjectId()); }

Target:
public void freeMemory(AllocationPoint point) { if (point.getAllocationStatus() == AllocationStatus.DEVICE) { this.getMemoryHandler().getMemoryProvider().free(point); point.setAllocationStatus(AllocationStatus.HOST); this.getMemoryHandler().getMemoryProvider().free(point); this.getMemoryHandler().forget(point, AllocationStatus.DEVICE); } else { this.getMemoryHandler().getMemoryProvider().free(point); this.getMemoryHandler().forget(point, AllocationStatus.HOST); } allocationsMap.remove(point.getObjectId()); }
Source:
public String getName() { return "Sounds.json"; }

Target:
public String getName() { return "Sounds"; }
Source:
public NewYorkTimesDocument next() { if (docRead) return null; NewYorkTimesDocument doc; try { docRead = true; doc = parser.parseFile(path.toFile()); } catch (IOException e) { return null; } return doc; }

Target:
public NewYorkTimesDocument next() { if (docRead) throw new NoSuchElementException(); NewYorkTimesDocument doc; try { docRead = true; doc = parser.parseFile(path.toFile()); } catch (IOException e) { return null; } return doc; }
Source:
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) { InetSocketAddress address = (InetSocketAddress) bootstrap.getOption("remoteAddress"); int delay = reconnectDelayManager.getReconnectDelayMs(address); timer.newTimeout(new TimerTask() { public void run(Timeout timeout) throws Exception { if (! client.isShutdown()) { bootstrap.connect(); } } }, delay, TimeUnit.MILLISECONDS); client.onDisconnect(); }

Target:
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) { InetSocketAddress address = (InetSocketAddress) bootstrap.getOption("remoteAddress"); int delay = reconnectDelayManager.getReconnectDelayMs(address); timer.newTimeout(new TimerTask() { public void run(Timeout timeout) throws Exception { if (! client.shutdownRequested()) { bootstrap.connect(); } } }, delay, TimeUnit.MILLISECONDS); client.onDisconnect(); }
Source:
public void testAddSecondWorkmanager() { try { cli.sendLine("batch"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm1:add(name=dwm1)"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm1/short-running-threads=dwm1:add(max-threads=11,queue-length=22)"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm2:add(name=dwm2)"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm2/short-running-threads=dwm2:add(max-threads=11,queue-length=22)"); cli.sendLine("run-batch"); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public void testAddSecondWorkmanager() throws Exception { try (CLIWrapper cli = new CLIWrapper(true)) { try { cli.sendLine("batch"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm1:add(name=dwm1)"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm1/short-running-threads=dwm1:add(max-threads=11,queue-length=22)"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm2:add(name=dwm2)"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm2/short-running-threads=dwm2:add(max-threads=11,queue-length=22)"); cli.sendLine("run-batch"); } finally { cli.sendLine("/subsystem=jca/distributed-workmanager=dwm2:remove"); cli.sendLine("/subsystem=jca/distributed-workmanager=dwm1:remove"); } } }
Source:
protected IndexWriter createIndexWriter(boolean create) throws CorruptIndexException, LockObtainFailedException, IOException { IndexWriterConfig writerConfig = new IndexWriterConfig(TaskAnalyzer.instance()); writerConfig.setInfoStream(InfoStream.NO_OUTPUT); return new IndexWriter(directory, writerConfig); }

Target:
protected IndexWriter createIndexWriter(boolean create) throws CorruptIndexException, LockObtainFailedException, IOException { IndexWriterConfig writerConfig = new IndexWriterConfig(TaskAnalyzer.instance()); writerConfig.setInfoStream(InfoStream.NO_OUTPUT); writerConfig.setOpenMode(create ? OpenMode.CREATE : OpenMode.APPEND); return new IndexWriter(directory, writerConfig); }
Source:
public void testRSA(TestHarness th, byte[] n, byte[] e, byte[] d, byte[] message) { RSAPublicKey pubKey = new RSAPublicKey(n, e); RSAPrivateKey privKey = new RSAPrivateKey(n, d); try { Cipher rsa = Cipher.getInstance("RSA"); rsa.init(Cipher.ENCRYPT_MODE, privKey); byte[] encMessage = new byte[privKey.getModulusLen()]; rsa.doFinal(message, 0, message.length, encMessage, 0); Cipher rsa2 = Cipher.getInstance("RSA"); rsa2.init(Cipher.DECRYPT_MODE, pubKey); byte[] decMessage = new byte[pubKey.getModulusLen()]; rsa2.doFinal(encMessage, 0, encMessage.length, decMessage, 0); boolean ok = true; for (int i = 0; i < message.length; i++) { if (message[i] != decMessage[i]) { ok = false; } } th.todo(ok); } catch (Exception ex) { th.fail("Unexpected exception: " + ex); ex.printStackTrace(); } }

Target:
public void testRSA(TestHarness th, byte[] n, byte[] e, byte[] d, byte[] message) throws NoSuchAlgorithmException, InvalidKeyException, ShortBufferException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { RSAPublicKey pubKey = new RSAPublicKey(n, e); RSAPrivateKey privKey = new RSAPrivateKey(n, d); Cipher rsa = Cipher.getInstance("RSA"); rsa.init(Cipher.ENCRYPT_MODE, privKey); byte[] encMessage = new byte[privKey.getModulusLen()]; rsa.doFinal(message, 0, message.length, encMessage, 0); Cipher rsa2 = Cipher.getInstance("RSA"); rsa2.init(Cipher.DECRYPT_MODE, pubKey); byte[] decMessage = new byte[pubKey.getModulusLen()]; rsa2.doFinal(encMessage, 0, encMessage.length, decMessage, 0); for (int i = 0; i < message.length; i++) { th.check(decMessage[i], message[i]); } }
Source:
private static DynamicTableSource createSource(DescriptorProperties properties) { return FactoryUtil.createTableSource( null, ObjectIdentifier.of("", "", ""), new CatalogTableImpl(TEST_SCHEMA, properties.asMap(), ""), new Configuration(), Thread.currentThread().getContextClassLoader(), false); }

Target:
private static DynamicTableSource createSource(DescriptorProperties properties) { return FactoryUtil.createTableSource( null, ObjectIdentifier.of("mycatalog", "mydb", "mytable"), new CatalogTableImpl(TEST_SCHEMA, properties.asMap(), ""), new Configuration(), Thread.currentThread().getContextClassLoader(), false); }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.DICTIONARY_LITERAL, ctx -> { DictionaryLiteral dictionaryLiteral = (DictionaryLiteral) ctx.syntaxNode(); Set<Integer> issueIndexes = new HashSet<>(); for (int i = 0; i < dictionaryLiteral.elements().size(); i++) { if (!dictionaryLiteral.elements().get(i).is(Tree.Kind.KEY_VALUE_PAIR) || issueIndexes.contains(i)) { continue; } Expression key = ((KeyValuePair) dictionaryLiteral.elements().get(i)).key(); List<Tree> duplicateKeys = findIdenticalKeys(i, dictionaryLiteral.elements(), issueIndexes); if (!duplicateKeys.isEmpty()) { PreciseIssue issue = ctx.addIssue(key, "Change or remove duplicates of this key."); duplicateKeys.forEach(d -> issue.secondary(d, "Duplicate key")); } } }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.DICTIONARY_LITERAL, ctx -> { DictionaryLiteral dictionaryLiteral = (DictionaryLiteral) ctx.syntaxNode(); Set<Integer> issueIndexes = new HashSet<>(); if (dictionaryLiteral.elements().size() > 100) { return; } for (int i = 0; i < dictionaryLiteral.elements().size(); i++) { if (!dictionaryLiteral.elements().get(i).is(Tree.Kind.KEY_VALUE_PAIR) || issueIndexes.contains(i)) { continue; } Expression key = ((KeyValuePair) dictionaryLiteral.elements().get(i)).key(); List<Tree> duplicateKeys = findIdenticalKeys(i, dictionaryLiteral.elements(), issueIndexes); if (!duplicateKeys.isEmpty()) { PreciseIssue issue = ctx.addIssue(key, "Change or remove duplicates of this key."); duplicateKeys.forEach(d -> issue.secondary(d, "Duplicate key")); } } }); }
Source:
private void sendRequest(String addUrl, String query) throws IOException { String charset = "UTF-8"; URLConnection connection = new URL(addUrl).openConnection(); connection.setDoOutput(true); connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("Content-Type", "application/xml;charset=" + charset); OutputStream output = null; try { output = connection.getOutputStream(); output.write(query.getBytes(charset)); } finally { if (output != null) { try { output.close(); } catch (IOException logOrIgnore) { log.error("Error while closing the connection"); } } } InputStream response = connection.getInputStream(); String out = "[Fault] No Response."; if (response != null) { StringBuilder sb = new StringBuilder(); byte[] bytes = new byte[1024]; int len; while ((len = response.read(bytes)) != -1) { sb.append(new String(bytes, 0, len)); } out = sb.toString(); } }

Target:
private void sendRequest(String addUrl, String query) throws IOException { String charset = "UTF-8"; URLConnection connection = new URL(addUrl).openConnection(); connection.setDoOutput(true); connection.setRequestProperty("Accept-Charset", charset); connection.setRequestProperty("Content-Type", "application/xml;charset=" + charset); OutputStream output = null; try { output = connection.getOutputStream(); output.write(query.getBytes(charset)); } finally { if (output != null) { output.close(); } } InputStream response = connection.getInputStream(); String out = "[Fault] No Response."; if (response != null) { StringBuilder sb = new StringBuilder(); byte[] bytes = new byte[1024]; int len; while ((len = response.read(bytes)) != -1) { sb.append(new String(bytes, 0, len)); } out = sb.toString(); } }
Source:
private DiffToolConfig(Config rc) { toolName = rc.getString(ConfigConstants.CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_TOOL); guiToolName = rc.getString(ConfigConstants.CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_GUITOOL); prompt = rc.getBoolean(ConfigConstants.CONFIG_DIFFTOOL_SECTION, ConfigConstants.CONFIG_KEY_PROMPT, true); String trustStr = rc.getString(ConfigConstants.CONFIG_DIFFTOOL_SECTION, null, ConfigConstants.CONFIG_KEY_TRUST_EXIT_CODE); if (trustStr != null) { trustExitCode = BooleanOption .defined(Boolean.parseBoolean(trustStr)); } else { trustExitCode = BooleanOption.notDefined(false); } tools = new HashMap<>(); Set<String> subsections = rc .getSubsections(ConfigConstants.CONFIG_DIFFTOOL_SECTION); for (String name : subsections) { String cmd = rc.getString(ConfigConstants.CONFIG_DIFFTOOL_SECTION, name, ConfigConstants.CONFIG_KEY_CMD); String path = rc.getString(ConfigConstants.CONFIG_DIFFTOOL_SECTION, name, ConfigConstants.CONFIG_KEY_PATH); boolean trustExitCodeTool = trustExitCode.toBoolean(); if (!trustExitCode.isDefined()) { trustExitCodeTool = rc.getBoolean( ConfigConstants.CONFIG_DIFFTOOL_SECTION, name, ConfigConstants.CONFIG_KEY_TRUST_EXIT_CODE, false); } if ((cmd != null) || (path != null)) { tools.put(name, new UserDefinedDiffTool(name, path, cmd, trustExitCodeTool)); } } }

Target:
private DiffToolConfig(Config rc) { toolName = rc.getString(ConfigConstants.CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_TOOL); guiToolName = rc.getString(ConfigConstants.CONFIG_DIFF_SECTION, null, ConfigConstants.CONFIG_KEY_GUITOOL); prompt = rc.getBoolean(ConfigConstants.CONFIG_DIFFTOOL_SECTION, ConfigConstants.CONFIG_KEY_PROMPT, true); String trustStr = rc.getString(ConfigConstants.CONFIG_DIFFTOOL_SECTION, null, ConfigConstants.CONFIG_KEY_TRUST_EXIT_CODE); if (trustStr != null) { trustExitCode = BooleanOption .defined(Boolean.parseBoolean(trustStr)); } else { trustExitCode = BooleanOption.notDefined(false); } tools = new HashMap<>(); Set<String> subsections = rc .getSubsections(ConfigConstants.CONFIG_DIFFTOOL_SECTION); for (String name : subsections) { String cmd = rc.getString(ConfigConstants.CONFIG_DIFFTOOL_SECTION, name, ConfigConstants.CONFIG_KEY_CMD); String path = rc.getString(ConfigConstants.CONFIG_DIFFTOOL_SECTION, name, ConfigConstants.CONFIG_KEY_PATH); if ((cmd != null) || (path != null)) { tools.put(name, new UserDefinedDiffTool(name, path, cmd)); } } }
Source:
public static <T> T[] concat(T[] first, T[] second) { int aLen = first.length; int bLen = second.length; @SuppressWarnings("unchecked") T[] C = (T[]) Array.newInstance( first.getClass().getComponentType(), aLen + bLen ); System.arraycopy( first, 0, C, 0, aLen ); System.arraycopy( second, 0, C, aLen, bLen ); return C; }

Target:
public static <T> T[] concat(T[] first, T[] second) { int firstLength = first.length; int secondLength = second.length; @SuppressWarnings("unchecked") T[] result = (T[]) Array.newInstance( first.getClass().getComponentType(), firstLength + secondLength ); System.arraycopy( first, 0, result, 0, firstLength ); System.arraycopy( second, 0, result, firstLength, secondLength ); return result; }
Source:
public MessageGroup removeMessageFromGroup(Object groupId, Message<?> messageToRemove) { Lock lock = this.lockRegistry.obtain(groupId); try { lock.lockInterruptibly(); try { SimpleMessageGroup group = this.groupIdToMessageGroup.get(groupId); Assert.notNull(group, "MessageGroup for groupId '" + groupId + "' " + "can not be located while attempting to remove Message from the MessageGroup"); if (group.remove(messageToRemove)) { this.groupToUpperBound.get(groupId).release(); group.setLastModified(System.currentTimeMillis()); } return group; } finally { lock.unlock(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MessagingException("Interrupted while obtaining lock", e); } }

Target:
public MessageGroup removeMessageFromGroup(Object groupId, Message<?> messageToRemove) { Lock lock = this.lockRegistry.obtain(groupId); try { lock.lockInterruptibly(); try { MessageGroup group = this.groupIdToMessageGroup.get(groupId); Assert.notNull(group, "MessageGroup for groupId '" + groupId + "' " + "can not be located while attempting to remove Message from the MessageGroup"); if (group.remove(messageToRemove)) { UpperBound upperBound = this.groupToUpperBound.get(groupId); Assert.state(upperBound != null, "'upperBound' must not be null."); upperBound.release(); group.setLastModified(System.currentTimeMillis()); } return group; } finally { lock.unlock(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new MessagingException("Interrupted while obtaining lock", e); } }
Source:
public Long getPublishedGroupId() { return publishedGroupId; }

Target:
Long getPublishedGroupId() { return publishedGroupId; }
Source:
public void writeToXml(PrintWriter pw1, int indent) { writeToXmlBegin(pw1, indent); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "equipmentNum", equipmentNum); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "typeName", MekHqXmlUtil.escape(type.getInternalName())); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "size", size); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "equipTonnage", equipTonnage); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "trooper", trooper); writeToXmlEnd(pw1, indent); }

Target:
public void writeToXml(PrintWriter pw1, int indent) { writeToXmlBegin(pw1, indent); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "equipmentNum", equipmentNum); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "typeName", type.getInternalName()); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "size", size); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "equipTonnage", equipTonnage); MekHqXmlUtil.writeSimpleXmlTag(pw1, indent + 1, "trooper", trooper); writeToXmlEnd(pw1, indent); }
Source:
private static OkHttpClient.Builder httpClient() { OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.level(HttpLoggingInterceptor.Level.BODY); httpClient.interceptors().add(interceptor); return httpClient; }

Target:
private static OkHttpClient.Builder httpClient() { if (httpClientBuilder == null) { httpClientBuilder = new OkHttpClient.Builder(); HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); if (BuildConfig.DEBUG) { interceptor.level(HttpLoggingInterceptor.Level.BASIC); } else { interceptor.level(HttpLoggingInterceptor.Level.NONE); } httpClientBuilder.interceptors().add(interceptor); } return httpClientBuilder; }
Source:
protected void onInit() { this.messageListenerContainer.setMessageListener((ChannelAwareMessageListener) (message, channel) -> { boolean error = false; Map<String, Object> headers = null; Object payload = null; try { payload = this.messageConverter.fromMessage(message); headers = this.headerMapper.toHeadersFromRequest(message.getMessageProperties()); if (this.messageListenerContainer.getAcknowledgeMode() == AcknowledgeMode.MANUAL) { headers.put(AmqpHeaders.DELIVERY_TAG, message.getMessageProperties().getDeliveryTag()); headers.put(AmqpHeaders.CHANNEL, channel); } } catch (RuntimeException e) { if (getErrorChannel() != null) { getMessagingTemplate().send(getErrorChannel(), new ErrorMessage( new ListenerExecutionFailedException("Message conversion failed", e, message))); } else { throw e; } error = true; } if (!error) { sendMessage(getMessageBuilderFactory().withPayload(payload).copyHeaders(headers).build()); } }); this.messageListenerContainer.afterPropertiesSet(); super.onInit(); }

Target:
protected void onInit() { this.messageListenerContainer.setMessageListener(new Listener()); this.messageListenerContainer.afterPropertiesSet(); super.onInit(); }