auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Patient cursorToPatient(Cursor cursor) { Patient patient = new Patient(); Person person = new Person(); patient.setId(cursor.getLong(cursor.getColumnIndex(PatientTable.Column.ID))); patient.setDisplay(cursor.getString(cursor.getColumnIndex(PatientTable.Column.DISPLAY))); patient.setUuid(cursor.getString(cursor.getColumnIndex(PatientTable.Column.UUID))); patient.setEncounters(cursor.getString(cursor.getColumnIndex(PatientTable.Column.ENCOUNTERS))); PatientIdentifier patientIdentifier = new PatientIdentifier(); patientIdentifier.setIdentifier(cursor.getString(cursor.getColumnIndex(PatientTable.Column.IDENTIFIER))); patient.getIdentifiers().add(patientIdentifier); PersonName personName = new PersonName(); personName.setGivenName(cursor.getString(cursor.getColumnIndex(PatientTable.Column.GIVEN_NAME))); personName.setMiddleName(cursor.getString(cursor.getColumnIndex(PatientTable.Column.MIDDLE_NAME))); personName.setFamilyName(cursor.getString(cursor.getColumnIndex(PatientTable.Column.FAMILY_NAME))); person.getNames().add(personName); person.setGender(cursor.getString(cursor.getColumnIndex(PatientTable.Column.GENDER))); person.setBirthdate(cursor.getString(cursor.getColumnIndex(PatientTable.Column.BIRTH_DATE))); if (null != cursor.getBlob(cursor.getColumnIndex(PatientTable.Column.PHOTO))) { person.setPhoto(byteArrayToBitmap(cursor.getBlob(cursor.getColumnIndex(PatientTable.Column.PHOTO)))); } person.getAddresses().add(cursorToAddress(cursor)); patient.setPerson(person); return patient; }

Target:
private Patient cursorToPatient(Cursor cursor) { Patient patient = new Patient(); Person person = new Person(); patient.setId(cursor.getLong(cursor.getColumnIndex(PatientTable.Column.ID))); patient.setDisplay(cursor.getString(cursor.getColumnIndex(PatientTable.Column.DISPLAY))); patient.setUuid(cursor.getString(cursor.getColumnIndex(PatientTable.Column.UUID))); patient.setEncounters(cursor.getString(cursor.getColumnIndex(PatientTable.Column.ENCOUNTERS))); PatientIdentifier patientIdentifier = new PatientIdentifier(); patientIdentifier.setIdentifier(cursor.getString(cursor.getColumnIndex(PatientTable.Column.IDENTIFIER))); patient.getIdentifiers().add(patientIdentifier); PersonName personName = new PersonName(); personName.setGivenName(cursor.getString(cursor.getColumnIndex(PatientTable.Column.GIVEN_NAME))); personName.setMiddleName(cursor.getString(cursor.getColumnIndex(PatientTable.Column.MIDDLE_NAME))); personName.setFamilyName(cursor.getString(cursor.getColumnIndex(PatientTable.Column.FAMILY_NAME))); person.getNames().add(personName); person.setGender(cursor.getString(cursor.getColumnIndex(PatientTable.Column.GENDER))); person.setBirthdate(cursor.getString(cursor.getColumnIndex(PatientTable.Column.BIRTH_DATE))); byte[] photoByteArray = cursor.getBlob(cursor.getColumnIndex(PatientTable.Column.PHOTO)); if (photoByteArray != null) person.setPhoto(byteArrayToBitmap(photoByteArray)); person.getAddresses().add(cursorToAddress(cursor)); patient.setPerson(person); return patient; }
Source:
public static List<BatchItem> from(final String events) { final List<BatchItem> batch = new ArrayList<>(); StringBuilder sb = new StringBuilder(); int brackets = 0; boolean insideQuote = false; boolean escaped = false; if ((!events.startsWith("[")) || (!events.endsWith("]"))) { throw new JSONException("Array must be surrounded with square brackets"); } for (int i = 1; i < events.length() - 1; i++) { if (!escaped && events.charAt(i) == '"') { if (insideQuote) insideQuote = false; else insideQuote = true; } if (escaped) { sb.append(events.charAt(i)); escaped = false; } else if (!escaped && events.charAt(i) == '\\') { sb.append(events.charAt(i)); escaped = true; } else if (insideQuote) { sb.append(events.charAt(i)); } else { if (events.charAt(i) == '{') { brackets++; } if (events.charAt(i) == '}') { brackets--; } if (!((brackets == 0) && (events.charAt(i) == ','))) { sb.append(events.charAt(i)); } if (brackets == 0 && (events.charAt(i) != ' ') && (events.charAt(i) != '\t' && (events.charAt(i) != '\n') && (events.charAt(i) != '\r'))) { if (sb.length() > 0) { batch.add(new BatchItem(sb.toString())); } sb = new StringBuilder(); } } } if (sb.length() != 0) { batch.add(new BatchItem(sb.toString())); } return batch; }

Target:
public static List<BatchItem> from(final String events) { final List<BatchItem> batch = new ArrayList<>(); StringBuilder sb = new StringBuilder(); int brackets = 0; boolean insideQuote = false; boolean escaped = false; int start = 0; final int length = events.length(); int end = length - 1; while (isEmptyCharacter(events.charAt(start)) && start < end) { start++; } while (isEmptyCharacter(events.charAt(end)) && end > start) { end--; } if (!(events.charAt(start) == '[')) { throw new JSONException(String.format("Unexpected character %s in position %d, expected '['", events.charAt(start), start)); } start++; if (!(events.charAt(end) == ']')) { throw new JSONException(String.format("Unexpected character %s in position %d, expected ']'", events.charAt(end), end)); } for (int i = start; i < end; i++) { if (!escaped && events.charAt(i) == '"') { if (insideQuote) { insideQuote = false; } else { insideQuote = true; } } if (escaped) { sb.append(events.charAt(i)); escaped = false; } else if (!escaped && events.charAt(i) == '\\') { sb.append(events.charAt(i)); escaped = true; } else if (insideQuote) { sb.append(events.charAt(i)); } else { if (events.charAt(i) == '{') { brackets++; } if (events.charAt(i) == '}') { brackets--; } if (!((brackets == 0) && ((events.charAt(i) == ',') || isEmptyCharacter(events.charAt(i))))) { sb.append(events.charAt(i)); } if (brackets == 0 && !isEmptyCharacter(events.charAt(i))) { if (sb.length() > 0) { batch.add(new BatchItem(sb.toString())); } sb = new StringBuilder(); } } } if (sb.length() != 0) { batch.add(new BatchItem(sb.toString())); } return batch; }
Source:
public void postSplit(ObserverContext<RegionCoprocessorEnvironment> ctx, HRegion l, HRegion r) throws IOException { HRegion region = ctx.getEnvironment().getRegion(); if (familyMap != null) { familyMap.clear(); } Scan scan = createScan(); RegionScanner scanner = null; int count = 0; try { scanner = region.getScanner(scan); count = scanRegion(scanner, count); } catch (IOException e) { LOG.error(e); throw e; } finally { if (scanner != null) { try { writeStatsToStatsTable(null, region, scanner); } catch (IOException e) { LOG.error(e); throw e; } } } }

Target:
public void postSplit(ObserverContext<RegionCoprocessorEnvironment> ctx, HRegion l, HRegion r) throws IOException { HRegion region = ctx.getEnvironment().getRegion(); TableName table = region.getRegionInfo().getTable(); if (!table.getNameAsString().equals(PhoenixDatabaseMetaData.SYSTEM_STATS_NAME)) { if (familyMap != null) { familyMap.clear(); } List<Mutation> mutations = Lists.newArrayListWithExpectedSize(3); long currentTime = TimeKeeper.SYSTEM.getCurrentTime(); Configuration conf = ctx.getEnvironment().getConfiguration(); if(LOG.isDebugEnabled()) { LOG.debug("Collecting stats for the daughter region "+l.getRegionInfo()); } collectStatsForSplitRegions(conf, l, region, true, mutations, currentTime); clear(); if(LOG.isDebugEnabled()) { LOG.debug("Collecting stats for the daughter region "+r.getRegionInfo()); } collectStatsForSplitRegions(conf, r, region, false, mutations, currentTime); if (LOG.isDebugEnabled()) { LOG.debug("Committing stats for the daughter regions as part of split " + r.getRegionInfo()); } commitStats(mutations); } }
Source:
public static void leaveBreadcrumb(@NonNull final byte[] nameBytes, @NonNull final BreadcrumbType type) { String name = new String(nameBytes, Charset.defaultCharset()); getClient().leaveBreadcrumb(name, type, new HashMap<String, String>()); }

Target:
public static void leaveBreadcrumb(@NonNull final byte[] nameBytes, @NonNull final BreadcrumbType type) { if (nameBytes == null) { return; } String name = new String(nameBytes, UTF8Charset); getClient().leaveBreadcrumb(name, type, Collections.<String, String>emptyMap()); }
Source:
private String getHashCode(String text) { try { MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); byte[] hash = messageDigest.digest(text.getBytes(StandardCharsets.UTF_8)); StringBuffer hexString = new StringBuffer(); for (byte element : hash) { String hex = Integer.toHexString(0xff & element); if (hex.length() == 1) { hexString.append('0'); } hexString.append(hex); } return hexString.toString(); } catch (NoSuchAlgorithmException e) { return String.valueOf(text.hashCode()); } }

Target:
private String getHashCode(String text) { return Integer.toUnsignedString(text.hashCode()); }
Source:
private List<IContainer> walkDirectory(SubMonitor loopMonitor) throws CoreException { List<IContainer> membersContainer = new ArrayList<>(); IResource[] members = root.members(IContainer.INCLUDE_HIDDEN); loopMonitor.setWorkRemaining(members.length); for (IResource member : members) { int type = member.getType(); if (type != IResource.FILE && !((Resource) member).isFiltered()) { membersContainer.add((IContainer) member); } loopMonitor.split(1); } return membersContainer; }

Target:
private List<Path> walkDirectory(SubMonitor loopMonitor) throws IOException { List<Path> childrenPath = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(root, IS_DIRECTORY)) { for (Path item : stream) { loopMonitor.setWorkRemaining(100).split(1); childrenPath.add(item); } } return childrenPath; }
Source:
public void getOrderGroupsByPatient_shouldGetOrderGroupsFromMultiplePatients() { OrderGroup orderGroupA = new OrderGroup(); OrderGroup orderGroupB = new OrderGroup(); OrderGroup orderGroupC = new OrderGroup(); Patient existingPatient1 = Context.getPatientService().getPatient(7); Patient existingPatient2 = Context.getPatientService().getPatient(8); orderGroupA.setPatient(existingPatient1); orderGroupB.setPatient(existingPatient1); orderGroupC.setPatient(existingPatient2); assertEquals(0, dao.getOrderGroupsByPatient(existingPatient1).size()); assertEquals(0, dao.getOrderGroupsByPatient(existingPatient2).size()); dao.saveOrderGroup(orderGroupA); dao.saveOrderGroup(orderGroupB); dao.saveOrderGroup(orderGroupC); assertEquals(2, dao.getOrderGroupsByPatient(existingPatient1).size()); assertEquals(1, dao.getOrderGroupsByPatient(existingPatient2).size()); }

Target:
public void getOrderGroupsByPatient_shouldGetOrderGroupsFromMultiplePatients() { Patient existingPatient1 = Context.getPatientService().getPatient(7); Patient existingPatient2 = Context.getPatientService().getPatient(8); List<OrderGroup> ordergroups1 = Context.getOrderService().getOrderGroupsByPatient(existingPatient1); List<OrderGroup> ordergroups2 = Context.getOrderService().getOrderGroupsByPatient(existingPatient2); assertEquals(2, ordergroups1.size()); assertEquals(1, ordergroups2.size()); }
Source:
public synchronized Map<String, Object> getLearnerHandlerInfo() { Map<String, Object> info = new LinkedHashMap<>(); info.put("remote_socket_address", getRemoteAddress()); info.put("sid", getSid()); info.put("established", getEstablished()); info.put("queued_packets", queuedPackets.size()); info.put("queued_packets_size", queuedPacketsSize.get()); info.put("packets_received", packetsReceived.longValue()); info.put("packets_sent", packetsSent.longValue()); info.put("requests", requestsReceived.longValue()); info.put("last_zxid", getLastZxid()); return info; }

Target:
public synchronized Map<String, Object> getLearnerHandlerInfo() { Map<String, Object> info = new LinkedHashMap<>(9); info.put("remote_socket_address", getRemoteAddress()); info.put("sid", getSid()); info.put("established", getEstablished()); info.put("queued_packets", queuedPackets.size()); info.put("queued_packets_size", queuedPacketsSize.get()); info.put("packets_received", packetsReceived.longValue()); info.put("packets_sent", packetsSent.longValue()); info.put("requests", requestsReceived.longValue()); info.put("last_zxid", getLastZxid()); return info; }
Source:
public void testList() throws IOException, StripeException { final Customer customer = Customer.retrieve(CUSTOMER_ID); Map<String, Object> params = new HashMap<String, Object>(); params.put("object", "bank_account"); BankAccount stubbedBankAccount = APIResource.GSON.fromJson( getResourceAsString("/api_fixtures/bank_account.json"), BankAccount.class); ExternalAccountCollection stubbedCollection = new ExternalAccountCollection(); List<ExternalAccount> stubbedData = new LinkedList<ExternalAccount>(); stubbedData.add(stubbedBankAccount); stubbedCollection.setData(stubbedData); stubRequest( APIResource.RequestMethod.GET, String.format("/v1/customers/%s/sources", customer.getId()), params, ExternalAccountCollection.class, stubbedCollection.toJson() ); final ExternalAccountCollection externalAccounts = customer.getSources().list(params); assertNotNull(externalAccounts); assertEquals(1, externalAccounts.getData().size()); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/customers/%s/sources", customer.getId()) ); BankAccount bankAccount = (BankAccount) externalAccounts.getData().get(0); assertNotNull(bankAccount); }

Target:
public void testList() throws IOException, StripeException { final Customer customer = Customer.retrieve(CUSTOMER_ID); Map<String, Object> params = new HashMap<String, Object>(); params.put("object", "bank_account"); params.put("limit", 1); final BankAccount stubbedBankAccount = APIResource.GSON.fromJson( getResourceAsString("/api_fixtures/bank_account.json"), BankAccount.class); final ExternalAccountCollection stubbedCollection = new ExternalAccountCollection(); final List<ExternalAccount> stubbedData = new LinkedList<ExternalAccount>(); stubbedData.add(stubbedBankAccount); stubbedCollection.setData(stubbedData); stubRequest( APIResource.RequestMethod.GET, String.format("/v1/customers/%s/sources", customer.getId()), params, ExternalAccountCollection.class, stubbedCollection.toJson() ); final ExternalAccountCollection externalAccounts = customer.getSources().list(params); assertNotNull(externalAccounts); assertEquals(1, externalAccounts.getData().size()); verifyRequest( APIResource.RequestMethod.GET, String.format("/v1/customers/%s/sources", customer.getId()) ); final BankAccount bankAccount = (BankAccount) externalAccounts.getData().get(0); assertNotNull(bankAccount); }
Source:
public LoginContext loginAs(String username) throws LoginException { boolean isAdministrator = SecurityConstants.ADMINISTRATOR.equalsIgnoreCase(username); Principal principal = new UserPrincipal(username, null, false, isAdministrator); ClientLoginModule.getThreadLocalLogin().push(principal, null, null); return new LoginContext("nuxeo-client-login") { @Override public void logout() throws LoginException { ClientLoginModule.getThreadLocalLogin().pop(); } }; }

Target:
public LoginContext loginAs(String username) throws LoginException { boolean isAdministrator = SecurityConstants.ADMINISTRATOR.equals(username); Principal principal = new UserPrincipal(username, null, false, isAdministrator); ClientLoginModule.getThreadLocalLogin().push(principal, null, null); return new LoginContext("nuxeo-client-login") { @Override public void logout() throws LoginException { ClientLoginModule.getThreadLocalLogin().pop(); } }; }
Source:
private boolean listWindows(Socket client) { boolean result = true; BufferedSink out = null; try { mWindowsLock.readLock().lock(); out = Okio.buffer(Okio.sink(client.getOutputStream())); for (Entry<View, String> entry : mWindows.entrySet()) { out.writeUtf8(Integer.toHexString(System.identityHashCode(entry.getKey()))); out.writeUtf8CodePoint(' '); out.writeUtf8(entry.getValue()); out.writeUtf8CodePoint('\n'); } out.writeUtf8("DONE.\n"); out.flush(); } catch (Exception e) { result = false; } finally { mWindowsLock.readLock().unlock(); if (out != null) { try { out.close(); } catch (IOException e) { result = false; } } } return result; }

Target:
private boolean listWindows(Socket client) { boolean result = true; BufferedSink out = null; try { mWindowsLock.readLock().lock(); out = Okio.buffer(Okio.sink(client)); for (Entry<View, String> entry : mWindows.entrySet()) { out.writeHexadecimalUnsignedLong(System.identityHashCode(entry.getKey())); out.writeUtf8CodePoint(' '); out.writeUtf8(entry.getValue()); out.writeUtf8CodePoint('\n'); } out.writeUtf8("DONE.\n"); out.flush(); } catch (Exception e) { result = false; } finally { mWindowsLock.readLock().unlock(); if (out != null) { try { out.close(); } catch (IOException e) { result = false; } } } return result; }
Source:
public DepositState getState(String depositUUID) { DepositState result = null; try (Jedis jedis = getJedisPool().getResource()) { String state = jedis.hget(DEPOSIT_STATUS_PREFIX + depositUUID, DepositField.state.name()); result = DepositState.valueOf(state); } catch (IllegalArgumentException | NullPointerException e) { log.debug("Failed to retrieve state for deposit {}", depositUUID, e); } return result; }

Target:
public DepositState getState(String depositUUID) { try (Jedis jedis = getJedisPool().getResource()) { String state = jedis.hget(DEPOSIT_STATUS_PREFIX + depositUUID, DepositField.state.name()); if (state == null) { log.debug("No state was found for deposit {}", depositUUID); return null; } return DepositState.valueOf(state); } }
Source:
public CatalogInitialization getCatalogInitialization() { if (catalogInitialization!=null) return catalogInitialization; synchronized (this) { if (catalogInitialization!=null) return catalogInitialization; CatalogInitialization ci = new CatalogInitialization(); setCatalogInitialization(ci); return ci; } }

Target:
public CatalogInitialization getCatalogInitialization() { synchronized (catalogInitMutex) { if (catalogInitialization!=null) return catalogInitialization; CatalogInitialization ci = new CatalogInitialization(); setCatalogInitialization(ci); return ci; } }
Source:
public void flush(String source) { LOG.info("Trying to flush pending sends messages: {}", pendingFutures.size(), pendingFutures.keySet()); while (!pendingFutures.isEmpty()) { try { Thread.sleep(FLUSH_SLEEP_TIME_MILLIS); } catch (InterruptedException e) { String msg = "Flush failed with error"; LOG.error(msg, e); throw new SamzaException(msg, e); } } if (sendExceptionOnCallback != null) { String msg = "Sending one of the message failed during flush"; Throwable throwable = sendExceptionOnCallback; sendExceptionOnCallback = null; LOG.error(msg, throwable); throw new SamzaException(msg, throwable); } LOG.info("Flush succeeded."); }

Target:
public synchronized void flush(String source) { LOG.debug("Trying to flush pending sends messages.", pendingFutures.size()); checkCallbackThrowable("Received exception on message send"); CompletableFuture<Void> future = CompletableFuture .allOf(pendingFutures.toArray(new CompletableFuture[pendingFutures.size()])); try { future.get(DEFAULT_FLUSH_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { String msg = "Flush failed with error"; throw new SamzaException(msg, e); } checkCallbackThrowable("Sending one or more of the messages failed during flush"); }
Source:
public void setUp() { ws = new WsActionTester(new ShowAction(db.getDbClient(), parser, duplicationsJsonWriter, userSessionRule, TestComponentFinder.from(db))); db.getDbClient().metricDao().insert(db.getSession(), dataMetric); db.commit(); }

Target:
public void setUp() { db.getDbClient().metricDao().insert(db.getSession(), dataMetric); db.commit(); }
Source:
public VdcReturnValueBase RunAction(VdcActionType actionType, VdcActionParametersBase parameters) { VdcReturnValueBase returnValue = isModeAllowToRunAction(actionType); if (returnValue != null) { return returnValue; } return runActionImpl(actionType, parameters, false, null); }

Target:
public VdcReturnValueBase RunAction(VdcActionType actionType, VdcActionParametersBase parameters) { VdcReturnValueBase returnValue = notAllowToRunAction(actionType); if (returnValue != null) { return returnValue; } return runActionImpl(actionType, parameters, false, null); }
Source:
private void saveIndex() { File storeFolder = folders.getBase(); if (storeFolder.exists()) { File index = new File(storeFolder, INDEX_FILE_NAME); Files.remove(index); try { OutputStream stream = new FileOutputStream(index); ObjectOutputStream oos = new ObjectOutputStream(stream); try { List<DiskData> list = new ArrayList<>(diskDatas.size()); for (DiskData diskData : diskDatas.values()) { if (diskData.sessionIdentifier != null) { list.add(diskData); } } oos.writeObject(list); } finally { stream.close(); oos.close(); } } catch (Exception e) { log.error("Couldn't write DiskPageStore index to file " + index + ".", e); } } }

Target:
private void saveIndex() { File storeFolder = folders.getBase(); if (storeFolder.exists()) { File index = new File(storeFolder, INDEX_FILE_NAME); Files.remove(index); try (OutputStream stream = new FileOutputStream(index)) { ObjectOutputStream oos = new ObjectOutputStream(stream); List<DiskData> list = new ArrayList<>(diskDatas.size()); for (DiskData diskData : diskDatas.values()) { if (diskData.sessionIdentifier != null) { list.add(diskData); } } oos.writeObject(list); } catch (Exception e) { log.error("Couldn't write DiskPageStore index to file " + index + ".", e); } } }
Source:
private static Block buildSequenceBlock(long start, int count, RowsToKeepResult rowsToKeep) { BlockBuilder builder = BIGINT.createFixedSizeBlockBuilder(count); for (int i = 0; i < count; i++) { BIGINT.writeLong(builder, start + i); } if (rowsToKeep.isKeepAll()) { return builder.build(); } else { return builder.build().getPositions(rowsToKeep.elements(), 0, count); } }

Target:
private static Block buildSequenceBlock(long start, int count, RowsToKeepResult rowsToKeep) { BlockBuilder builder = BIGINT.createFixedSizeBlockBuilder(count); for (int i = 0; i < count; i++) { if (rowsToKeep.keepAll() || rowsToKeep.getRowsToKeep().contains(i)) { BIGINT.writeLong(builder, start + i); } } return builder.build(); }
Source:
protected void setup(IProgressMonitor monitor) throws SarosCancellationException { if (fileTransferManager == null) throw new LocalCancellationException( "not connected to a XMPP server", CancelOption.DO_NOT_NOTIFY_PEER); transferListener = new TransferListener(TRANSFER_ID + getID()); fileTransferManager.addFileTransferListener(transferListener); }

Target:
protected void setup(IProgressMonitor monitor) throws SarosCancellationException { if (fileTransferManager == null) throw new LocalCancellationException( "not connected to a XMPP server", CancelOption.DO_NOT_NOTIFY_PEER); transferListener = new TransferListener(TRANSFER_ID_PREFIX + getID()); fileTransferManager.addFileTransferListener(transferListener); }
Source:
protected RollCycle decodeRollCycle(String retentionDuration) { if (retentionDuration == null || retentionDuration.isEmpty()) { return DAILY; } String rollingPeriod = retentionDuration.substring(retentionDuration.length() - 1); switch (rollingPeriod) { case SECOND_ROLLING_PERIOD: return RollCycles.TEST_SECONDLY; case MINUTE_ROLLING_PERIOD: return MINUTELY; case HOUR_ROLLING_PERIOD: return HOURLY; case DAY_ROLLING_PERIOD: return DAILY; default: throw new IllegalArgumentException("Unknown rolling period: " + rollingPeriod); } }

Target:
protected RollCycle decodeRollCycle(String retentionDuration) { if (retentionDuration == null || retentionDuration.isEmpty()) { return DAILY; } String rollingPeriod = retentionDuration.substring(retentionDuration.length() - 1); switch (rollingPeriod) { case SECOND_ROLLING_PERIOD: return TEST_SECONDLY; case MINUTE_ROLLING_PERIOD: return MINUTELY; case HOUR_ROLLING_PERIOD: return HOURLY; case DAY_ROLLING_PERIOD: return DAILY; default: throw new IllegalArgumentException("Unknown rolling period: " + rollingPeriod); } }
Source:
public void testExceptionWhenSubclassSetsInvalidDefaultValue() { try { app.createAndManageChild(EntitySpec.create(EntityProvidingDefaultValueForConfigKeyInRange.class)); fail("Expected exception when managing entity setting invalid default value"); } catch (Exception e) { Throwable t = Exceptions.getFirstThrowableOfType(e, ConstraintViolationException.class); assertNotNull(t); } }

Target:
public void testExceptionWhenSubclassSetsInvalidDefaultValue() { try { app.createAndManageChild(EntitySpec.create(EntityProvidingDefaultValueForConfigKeyInRange.class)); fail("Expected exception when managing entity setting invalid default value"); } catch (Exception e) { Throwable t = Exceptions.getFirstThrowableOfType(e, ConstraintViolationException.class); assertNotNull(t, "Original exception was: " + Exceptions.collapseText(e)); } }
Source:
public static void loadSkins() { final int price = 9999; ironMan = new IronManSkin(price, "Iron Man", "iron_man"); captain = new CaptainSkin(price, "Captain", "captain"); andy = new AndySkin(price, "Andy", "andy"); noob = new NoobSkin(0, "Noob", "noob"); boy = new BoySkin(price, "B-man", "b"); plank = new PlankSkin(price, "Plank", "plank"); }

Target:
public static void loadSkins() { ironMan = new IronManSkin(); captain = new CaptainSkin(); andy = new AndySkin(); noob = new NoobSkin(); boy = new BoySkin(); plank = new PlankSkin(); }
Source:
protected Set<Integer> getInternalSelections() { Set<Integer> indexes = super.getSelection(); Set<Integer> internalIndexes = indexes.stream() .mapToInt(index -> fInternalEntryList.indexOf((getResultTable().getEntries().get(index)))) .boxed() .collect(Collectors.toSet()); return internalIndexes; }

Target:
protected Set<Integer> getInternalSelections() { Set<Integer> indexes = super.getSelection(); Set<Integer> internalIndexes = indexes.stream() .mapToInt(index -> getResultTable().getEntries().indexOf((getResultTable().getEntries().get(index)))) .boxed() .collect(Collectors.toSet()); return internalIndexes; }
Source:
public void testPackaging_ValidationSkipped() throws Exception { Verifier verifier = getVerifier("/target-platform/packagingKO", false); Map<String, String> args = new HashMap<String, String>(); args.put("tycho.target-platform-plugin.validation.skip", Boolean.TRUE.toString()); verifier.executeGoal("validate"); }

Target:
public void testPackaging_ValidationSkipped() throws Exception { Verifier verifier = getVerifier("/target-platform/packagingKO", false); verifier.setSystemProperty("tycho.target-platform-plugin.validation.skip", Boolean.TRUE.toString()); verifier.executeGoal("validate"); }
Source:
public List<SharedWorkflows> sharedWorkflows(@ApiParam(hidden = true) @Auth User user) { final List<String> paths = this.permissionsInterface.workflowsSharedWithUser(user).values() .stream() .flatMap(List::stream) .collect(Collectors.toList()); List<Workflow> workflowList = workflowDAO.findByPaths(paths, false); return this.permissionsInterface.workflowsSharedWithUser(user).entrySet().stream().map(e -> { final List<Workflow> workflows = workflowList.stream() .filter(workflow -> e.getValue().contains(workflow.getWorkflowPath())) .collect(Collectors.toList()); return new SharedWorkflows(e.getKey(), workflows); }).collect(Collectors.toList()); }

Target:
public List<SharedWorkflows> sharedWorkflows(@ApiParam(hidden = true) @Auth User user) { final Map<Role, List<String>> workflowsSharedWithUser = this.permissionsInterface.workflowsSharedWithUser(user); final List<String> paths = workflowsSharedWithUser.values() .stream() .flatMap(List::stream) .collect(Collectors.toList()); List<Workflow> workflowList = workflowDAO.findByPaths(paths, false); return workflowsSharedWithUser.entrySet().stream().map(e -> { final List<Workflow> workflows = workflowList.stream() .filter(workflow -> e.getValue().contains(workflow.getWorkflowPath()) && !workflow.getUsers().contains(user)) .collect(Collectors.toList()); return new SharedWorkflows(e.getKey(), workflows); }).filter(sharedWorkflow -> sharedWorkflow.getWorkflows().size() > 0).collect(Collectors.toList()); }
Source:
public Iterator<Pair<K, V>> iterator() { return new Iterator<Pair<K, V>>() { @SuppressWarnings("unchecked") private final HashTable<K, V>[] stack = new HashTable[Fork.this.length]; private Maybe<Iterator<Pair<K, V>>> currentIterator = Maybe.empty(); int i = 0; { this.stack[this.i++] = Fork.this; } private void updateState() { if (currentIterator.isJust() && currentIterator.fromJust().hasNext()) { return; } else { currentIterator = Maybe.empty(); } while (this.i > 0 && currentIterator.isNothing()) { HashTable<K, V> curr = this.stack[--this.i]; if (curr instanceof Fork) { Fork<K, V> fork = (Fork<K, V>) curr; for (HashTable<K, V> child : fork.children) { this.stack[this.i++] = child; } } else if (curr instanceof Leaf) { currentIterator = Maybe.of(((Leaf<K, V>) curr).dataList.iterator()); if (currentIterator.fromJust().hasNext()) { return; } else { currentIterator = Maybe.empty(); } } } } @Override public boolean hasNext() { updateState(); return currentIterator.isJust() && currentIterator.fromJust().hasNext(); } @Override public Pair<K, V> next() { updateState(); if (currentIterator.isJust() && currentIterator.fromJust().hasNext()) { return currentIterator.fromJust().next(); } throw new NoSuchElementException(); } }; }

Target:
public Iterator<Pair<K, V>> iterator() { return new Iterator<Pair<K, V>>() { @SuppressWarnings("unchecked") private final HashTable<K, V>[] stack = new HashTable[Fork.this.length]; private Iterator<Pair<K, V>> currentIterator = null; int i = 0; { this.stack[this.i++] = Fork.this; } private void updateState() { if (currentIterator != null && currentIterator.hasNext()) { return; } else { currentIterator = null; } while (this.i > 0) { this.i--; HashTable<K, V> curr = this.stack[this.i]; if (curr instanceof Fork) { Fork<K, V> fork = (Fork<K, V>) curr; for (HashTable<K, V> child : fork.children) { if (child != null) { this.stack[this.i] = child; this.i++; } } } else if (curr instanceof Leaf) { currentIterator = ((Leaf<K, V>) curr).dataList.iterator(); if (currentIterator.hasNext()) { return; } else { currentIterator = null; } } } } @Override public boolean hasNext() { updateState(); return currentIterator != null; } @Override public Pair<K, V> next() { updateState(); if (currentIterator == null) { throw new NoSuchElementException(); } return currentIterator.next(); } }; }
Source:
public static <T> T notNull(T value, String message) { if (value == null) { throw new NullPointerException(String.valueOf(message)); } return value; }

Target:
public static <T> T notNull(T value, String message) { if (value == null) { throw new NullPointerException(message); } return value; }
Source:
public void testListSecurityGroupsForNode() { HttpRequest serverReq = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_1>")) .headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse serverResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/server_with_security_groups_extension.json")).build(); HttpRequest list = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_list.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(serverReq, serverResponse); requestResponseMap.put(list, listResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); Set<SecurityGroup> groups = extension.listSecurityGroupsForNode(zone + "/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); assertEquals(1, groups.size()); }

Target:
public void testListSecurityGroupsForNode() { HttpRequest serverReq = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_1>")) .headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse serverResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/server_with_security_groups_extension.json")).build(); HttpRequest list = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_list.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(serverReq, serverResponse); requestResponseMap.put(list, listResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); Set<SecurityGroup> groups = extension.listSecurityGroupsForNode(zone + "/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb"); assertEquals(groups.size(), 1); }
Source:
private ModelAndView setupForm(SequencerPartitionContainer container, ModelMap model) throws IOException { model.put("formObj", container); model.put("container", container); model.put("containerPartitions", container.getPartitions().stream().map(Dtos::asDto).collect(Collectors.toList())); model.put("containerRuns", runService.listByContainerId(container.getId()).stream().map(Dtos::asDto).collect(Collectors.toList())); return new ModelAndView("/pages/editSequencerPartitionContainer.jsp", model); }

Target:
private ModelAndView setupForm(SequencerPartitionContainer container, ModelMap model) throws IOException { model.put("container", container); model.put("containerPartitions", container.getPartitions().stream().map(Dtos::asDto).collect(Collectors.toList())); model.put("containerRuns", runService.listByContainerId(container.getId()).stream().map(Dtos::asDto).collect(Collectors.toList())); return new ModelAndView("/pages/editSequencerPartitionContainer.jsp", model); }
Source:
private void writeSystemInfo() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } final String product = Config.getValue(ConfigValues.OriginType); final String manufacturer = OriginType.valueOf(product) == OriginType.OVIRT ? "oVirt" : "Red Hat"; final boolean needsBaseBoard = OriginType.valueOf(product) == OriginType.RHEV; final String productName = OriginType.valueOf(product) == OriginType.OVIRT ? "oVirt" : "RHV"; writer.writeStartElement("sysinfo"); writer.writeAttributeString("type", "smbios"); writer.writeStartElement("system"); writeEntryElement("manufacturer", manufacturer); writeEntryElement("product", productName); writeEntryElement("version", vm.getClusterCompatibilityVersion().toString()); writeEntryElement("family", "Red Hat Enterprise Linux"); writeEntryElement("sku", Config.getValue(ConfigValues.SkuToAVLevel, vm.getCompatibilityVersion().toString())); writeEntryElement("serial", "HOST-SERIAL:"); writeEntryElement("uuid", vm.getId().toString()); writer.writeEndElement(); if (needsBaseBoard) { writer.writeStartElement("baseBoard"); writeEntryElement("manufacturer", "Red Hat"); writeEntryElement("product", "RHEL-AV"); writer.writeEndElement(); } writer.writeEndElement(); }

Target:
private void writeSystemInfo() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } final String product = Config.getValue(ConfigValues.OriginType); final String manufacturer = OriginType.valueOf(product) == OriginType.OVIRT ? "oVirt" : "Red Hat"; final String productName = OriginType.valueOf(product) == OriginType.OVIRT ? "oVirt" : "RHV"; writer.writeStartElement("sysinfo"); writer.writeAttributeString("type", "smbios"); writer.writeStartElement("system"); writeEntryElement("manufacturer", manufacturer); writeEntryElement("product", productName); writeEntryElement("version", vm.getClusterCompatibilityVersion().toString()); writeEntryElement("family", "Red Hat Enterprise Linux"); if (Config.valueExists(ConfigValues.SkuToAVLevel, vm.getCompatibilityVersion().toString())) { writeEntryElement("sku", Config.getValue(ConfigValues.SkuToAVLevel, vm.getCompatibilityVersion().toString())); } writeEntryElement("serial", "HOST-SERIAL:"); writeEntryElement("uuid", vm.getId().toString()); writer.writeEndElement(); if (Config.getValue(ConfigValues.IncludeBaseboardSysinfo)) { writer.writeStartElement("baseBoard"); writeEntryElement("manufacturer", "Red Hat"); writeEntryElement("product", "RHEL-AV"); writer.writeEndElement(); } writer.writeEndElement(); }
Source:
@Override public void onMatch(RelOptRuleCall call) { final Join join = call.rel(0); final RexBuilder rexBuilder = join.getCluster().getRexBuilder(); RexSimplify rexSimplify = new RexSimplify(rexBuilder, RelOptPredicateList.EMPTY, EXECUTOR); RexNode condition = rexSimplify.eliminateCommonExprInCondition(join.getCondition()); final List<RexNode> expList = Lists.newArrayList(condition); final int fieldCount = join.getLeft().getRowType().getFieldCount(); final RelMetadataQuery mq = call.getMetadataQuery(); final RelOptPredicateList leftPredicates = mq.getPulledUpPredicates(join.getLeft()); final RelOptPredicateList rightPredicates = mq.getPulledUpPredicates(join.getRight()); final RelOptPredicateList predicates = leftPredicates.union(rexBuilder, rightPredicates.shift(rexBuilder, fieldCount)); if (!reduceExpressions(join, expList, predicates, true, config.matchNullability())) { return; } call.transformTo( join.copy( join.getTraitSet(), expList.get(0), join.getLeft(), join.getRight(), join.getJoinType(), join.isSemiJoinDone())); call.getPlanner().prune(join); }

Target:
@Override public void onMatch(RelOptRuleCall call) { final Join join = call.rel(0); final RexBuilder rexBuilder = join.getCluster().getRexBuilder(); final RexSimplify rexSimplify = new RexSimplify(rexBuilder, RelOptPredicateList.EMPTY, EXECUTOR); final RexNode condition = rexSimplify.eliminateCommonExprInCondition(join.getCondition()); final List<RexNode> expList = Lists.newArrayList(condition); final int fieldCount = join.getLeft().getRowType().getFieldCount(); final RelMetadataQuery mq = call.getMetadataQuery(); final RelOptPredicateList leftPredicates = mq.getPulledUpPredicates(join.getLeft()); final RelOptPredicateList rightPredicates = mq.getPulledUpPredicates(join.getRight()); final RelOptPredicateList predicates = leftPredicates.union(rexBuilder, rightPredicates.shift(rexBuilder, fieldCount)); if (!reduceExpressions(join, expList, predicates, true, config.matchNullability())) { return; } call.transformTo( join.copy( join.getTraitSet(), expList.get(0), join.getLeft(), join.getRight(), join.getJoinType(), join.isSemiJoinDone())); call.getPlanner().prune(join); }
Source:
public void setUp() throws Exception { File rootDir = Files.createTempDir(); rootDir.deleteOnExit(); fileSystemJarCache = new FileSystemJarCache(rootDir, true); expectedChecksum = ChecksumTest.createdExpectedChecksum( Hashing.sha256().hashBytes(CONTENTS.getBytes(Charset.forName("UTF-8")))); }

Target:
public void setUp() throws Exception { fileSystemJarCache = new FileSystemJarCache(tmp.getRoot(), true); expectedChecksum = ChecksumTest.createdExpectedChecksum( Hashing.sha256().hashBytes(CONTENTS.getBytes(Charset.forName("UTF-8")))); }
Source:
public Query apply(Function input, LuceneQueryBuilder.Context context) { RefAndLiteral refAndLiteral = RefAndLiteral.of(input); if (refAndLiteral == null) { return null; } String colName = refAndLiteral.reference().column().fqn(); MappedFieldType fieldType = context.getFieldTypeOrNull(colName); if (fieldType == null) { return Queries.newMatchNoDocsQuery("column does not exist in this index"); } String cidr = (String) refAndLiteral.literal().value(); Tuple<InetAddress, InetAddress> cidrRange = CIDROperator.extractRange(cidr); return fieldType.rangeQuery(cidrRange.v1(), cidrRange.v2(), true, false, null, null, context.queryShardContext); }

Target:
public Query apply(Function input, LuceneQueryBuilder.Context context) { RefAndLiteral refAndLiteral = RefAndLiteral.of(input); if (refAndLiteral == null) { return null; } String colName = refAndLiteral.reference().column().fqn(); MappedFieldType fieldType = context.getFieldTypeOrNull(colName); if (fieldType == null) { return Queries.newMatchNoDocsQuery("column does not exist in this index"); } String cidrStr = (String) refAndLiteral.literal().value(); Tuple<InetAddress, Integer> cidr = InetAddresses.parseCidr(cidrStr); return InetAddressPoint.newPrefixQuery(fieldType.name(), cidr.v1(), cidr.v2()); }
Source:
public void clearID() { idSupplier = null; nodeMap.clear(); nodeMap = null; }

Target:
public void clearID() { idSupplier = null; if (nodeMap != null) { nodeMap.clear(); nodeMap = null; } }
Source:
private Object deserializeItem(Object item) { try { Class klass = YoutubeEventClassifier.detectClass((String) item); System.out.println(klass.getName()); if (klass.equals(Video.class)) { item = mapper.readValue((String) item, Video.class); } else if(klass.equals(Channel.class)) { item = mapper.readValue((String) item, Channel.class); } } catch (Exception e) { LOGGER.error("Exception while trying to deserializeItem: {}", e); } return item; }

Target:
private Object deserializeItem(Object item) { try { Class klass = YoutubeEventClassifier.detectClass((String) item); if (klass.equals(Video.class)) { item = mapper.readValue((String) item, Video.class); } else if(klass.equals(Channel.class)) { item = mapper.readValue((String) item, Channel.class); } } catch (Exception e) { LOGGER.error("Exception while trying to deserializeItem: {}", e); } return item; }
Source:
@Override public String url(HttpRequest request) { StringBuffer url = new StringBuffer("http://"); String host = request.headers().get("HOST"); if (host != null) url.append(host); url.append(request.uri()); return url.toString(); }

Target:
@Override public String url(HttpRequest request) { String host = requestHeader(request, "Host"); if (host == null) return null; return "http://" + host + request.uri(); }
Source:
public AdobePDFSchemaImpl(AdobePDFSchema schema, Metadata metadata) { this.schema = schema; this.metadata = metadata; }

Target:
public AdobePDFSchemaImpl(AdobePDFSchema schema, Metadata metadata) { if (schema == null) { throw new IllegalArgumentException("AdobePdf schema representation can not be null"); } if (metadata == null) { throw new IllegalArgumentException("Metadata representation can not be null"); } this.schema = schema; this.metadata = metadata; }
Source:
public AnAction[] getChildren(@Nullable AnActionEvent event) { ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup actionGroup = (DefaultActionGroup) actionManager.getAction(PantsConstants.ACTION_COMPILE_GROUP_ID); actionGroup.remove(actionManager.getAction(IdeActions.ACTION_MAKE_MODULE)); actionGroup.remove(actionManager.getAction(IdeActions.ACTION_COMPILE)); final AnAction[] emptyAction = new AnAction[0]; if (event == null) { return emptyAction; } Project project = event.getProject(); Optional<VirtualFile> eventFile = IPantsGetTargets.getFileForEvent(event); if (project == null || !eventFile.isPresent()) { return emptyAction; } VirtualFile file = eventFile.get(); Module module = ModuleUtil.findModuleForFile(file, project); if (module == null) { return emptyAction; } List<String> targetAddresses = PantsUtil.getNonGenTargetAddresses(module); if (targetAddresses.isEmpty()) { return emptyAction; } List<AnAction> actions = new LinkedList<>(); if (targetAddresses.size() > 1) { actions.add(new PantsCompileAllTargetsInModuleAction(module)); } targetAddresses.forEach(target -> actions.add(new PantsCompileTargetAction(target))); return actions.toArray(emptyAction); }

Target:
public AnAction[] getChildren(@Nullable AnActionEvent event) { ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup actionGroup = (DefaultActionGroup) actionManager.getAction(PantsConstants.ACTION_COMPILE_GROUP_ID); actionGroup.remove(actionManager.getAction(IdeActions.ACTION_MAKE_MODULE)); actionGroup.remove(actionManager.getAction(IdeActions.ACTION_COMPILE)); final AnAction[] emptyAction = new AnAction[0]; if (event == null) { return emptyAction; } Project project = event.getProject(); Optional<VirtualFile> eventFile = PantsUtil.getFileForEvent(event); if (project == null || !eventFile.isPresent()) { return emptyAction; } VirtualFile file = eventFile.get(); List<AnAction> actions = new LinkedList<>(); Module module = ModuleUtil.findModuleForFile(file, project); if (module == null) { return emptyAction; } List<String> targetAddresses = PantsUtil.getNonGenTargetAddresses(module); if (targetAddresses.isEmpty()) { return emptyAction; } actions.add(new PantsLintTargetAction(targetAddresses)); if (targetAddresses.size() > 1) { actions.add(new PantsCompileAllTargetsInModuleAction(Optional.of(module))); } targetAddresses.forEach(target -> actions.add(new PantsCompileTargetAction(target))); return actions.toArray(emptyAction); }
Source:
public void update(Object[] srcRow, Object[] destRow) { Number value = (Number) srcRow[pos]; if (value != null) { Number sum = (Number) destRow[pos]; if (sum == null) { destRow[pos] = value; } else { destRow[pos] = sum.intValue() + value.intValue(); } } }

Target:
public void update(Object[] srcRow, Object[] destRow) { Number value = (Number) srcRow[pos]; if (value != null) { Number sum = (Number) destRow[pos]; if (sum == null) { destRow[pos] = value; } else { destRow[pos] = add(value, sum); } } }
Source:
final protected void interrupted() { onInterrupted(); if (previous != null && (!previous.isScheduled())) { previous.schedule(); } }

Target:
protected final void interrupted() { onInterrupted(); if (previous != null && !previous.isScheduled()) { previous.schedule(); } }
Source:
protected void doPush(final ProgressMonitor monitor, final Map<String, RemoteRefUpdate> refUpdates) throws TransportException { final InputStream httpIn; final OutputStream httpOut; try { final URL url = new URL(baseUrl, "git-receive-pack"); final Proxy proxy = HttpSupport.proxyFor(proxySelector, url); final HttpURLConnection conn; conn = (HttpURLConnection) url.openConnection(proxy); conn.setRequestMethod("POST"); conn.setInstanceFollowRedirects(false); conn.setDoOutput(true); conn.setChunkedStreamingMode(0); conn.setRequestProperty("Content-Type", REQ_TYPE); httpOut = new BufferedOutputStream(conn.getOutputStream()); httpIn = new HttpInputStream(conn, httpOut, RSP_TYPE); } catch (IOException e) { throw new TransportException(uri, "Cannot begin HTTP push", e); } init(new BufferedInputStream(httpIn), httpOut); super.doPush(monitor, refUpdates); }

Target:
protected void doPush(final ProgressMonitor monitor, final Map<String, RemoteRefUpdate> refUpdates) throws TransportException { final InputStream httpIn; final OutputStream httpOut; try { final URL url = new URL(baseUrl, "git-receive-pack"); final Proxy proxy = HttpSupport.proxyFor(proxySelector, url); final HttpURLConnection conn; conn = (HttpURLConnection) url.openConnection(proxy); conn.setRequestMethod(HttpSupport.METHOD_POST); conn.setInstanceFollowRedirects(false); conn.setDoOutput(true); conn.setChunkedStreamingMode(0); conn.setRequestProperty(HttpSupport.HDR_CONTENT_TYPE, REQ_TYPE); httpOut = new BufferedOutputStream(conn.getOutputStream()); httpIn = new HttpInputStream(conn, httpOut, RSP_TYPE); } catch (IOException e) { throw new TransportException(uri, "Cannot begin HTTP push", e); } init(new BufferedInputStream(httpIn), httpOut); super.doPush(monitor, refUpdates); }