auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void doStart() { leaderElection = new LeaderElection(zkClient, "/tx.service/leader", new ElectionHandler() { @Override public void leader() { txManager = txManagerProvider.get(); txManager.addListener(new ServiceListenerAdapter() { @Override public void failed(State from, Throwable failure) { LOG.error("Transaction manager aborted, stopping transaction service"); TransactionService.this.abort(failure); } }, MoreExecutors.sameThreadExecutor()); server = ThriftRPCServer.builder(TTransactionServer.class) .setHost(address) .setPort(port) .setWorkerThreads(threads) .setMaxReadBufferBytes(maxReadBufferBytes) .setIOThreads(ioThreads) .build(new TransactionServiceThriftHandler(txManager)); try { server.startAndWait(); doRegister(); LOG.info("Transaction Thrift Service started successfully on " + getAddress()); } catch (Throwable t) { LOG.info("Transaction Thrift Service didn't start on " + server.getBindAddress()); leaderElection.stop(); notifyFailed(t); } } @Override public void follower() { if (server != null && server.isRunning()) { server.stopAndWait(); } undoRegiser(); } }); leaderElection.start(); notifyStarted(); }

Target:
protected void doStart() { leaderElection = new LeaderElection(zkClient, "/tx.service/leader", new ElectionHandler() { @Override public void leader() { txManager = txManagerProvider.get(); txManager.addListener(new ServiceListenerAdapter() { @Override public void failed(State from, Throwable failure) { LOG.error("Transaction manager aborted, stopping transaction service"); TransactionService.this.abort(failure); } }, MoreExecutors.sameThreadExecutor()); server = ThriftRPCServer.builder(TTransactionServer.class) .setHost(address) .setPort(port) .setWorkerThreads(threads) .setMaxReadBufferBytes(maxReadBufferBytes) .setIOThreads(ioThreads) .build(new TransactionServiceThriftHandler(txManager)); try { server.startAndWait(); doRegister(); LOG.info("Transaction Thrift Service started successfully on " + getAddress()); } catch (Throwable t) { LOG.info("Transaction Thrift Service didn't start on " + server.getBindAddress()); leaderElection.stop(); notifyFailed(t); } } @Override public void follower() { if (server != null && server.isRunning()) { server.stopAndWait(); } undoRegister(); } }); leaderElection.start(); notifyStarted(); }
Source:
public ByteBuffer transform(ClassLoader classLoader, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) throws IllegalArgumentException { final int position = classBytes.position(); final int limit = classBytes.limit(); final byte[] bytes; final Class<?> aClass = null; if (classBytes.hasArray() && classBytes.arrayOffset() == 0 && position == 0 && limit == classBytes.capacity()) { bytes = classBytes.array(); } else { bytes = new byte[limit - position]; classBytes.get(bytes); classBytes.position(position); } boolean transformed = false; byte[] transformedBuffer = bytes; for (javax.persistence.spi.ClassTransformer transformer : persistenceUnitMetadata.getTransformers()) { byte[] result = new byte[0]; try { result = transformer.transform(classLoader, className, aClass, protectionDomain, transformedBuffer); } catch (IllegalClassFormatException e) { throw JpaLogger.ROOT_LOGGER.invalidClassFormat(e, className); } if (result != null) { transformedBuffer = result; transformed = true; } } return transformed ? ByteBuffer.wrap(transformedBuffer) : null; }

Target:
public ByteBuffer transform(ClassLoader classLoader, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) throws IllegalArgumentException { byte[] transformedBuffer = getBytes(classBytes); boolean transformed = false; for (javax.persistence.spi.ClassTransformer transformer : persistenceUnitMetadata.getTransformers()) { if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.tracef("rewrite entity class '%s' using transformer '%s' for '%s'", className, transformer.getClass().getName(), persistenceUnitMetadata.getScopedPersistenceUnitName()); byte[] result; try { result = transformer.transform(classLoader, className, null, protectionDomain, transformedBuffer); } catch (IllegalClassFormatException e) { throw JpaLogger.ROOT_LOGGER.invalidClassFormat(e, className); } if (result != null) { transformedBuffer = result; transformed = true; if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.tracef("entity class '%s' was rewritten", className); } } return transformed ? ByteBuffer.wrap(transformedBuffer) : null; }
Source:
public BWEntity(net.minecraft.entity.Entity entity) { this.entity = entity; components.add(new MCEntityTransform(entity)); components.add(new Damageable() { @Override public void damage(double amount, DamageType type) { if (type == DamageType.generic) { entity.attackEntityFrom(DamageSource.generic, (float) amount); } } }); if (entity instanceof EntityLivingBase) { if (entity instanceof EntityPlayer) { MCPlayer player = components.add(new MCPlayer(this)); player.faceDisplacement = () -> Vector3D.PLUS_J.scalarMultiply(entity.getEyeHeight()); } else { Living living = components.add(new Living()); living.faceDisplacement = () -> Vector3D.PLUS_J.scalarMultiply(entity.getEyeHeight()); } } if (entity != null) { WrapperEvent.BWEntityCreate event = new WrapperEvent.BWEntityCreate(this, entity); Game.events().publish(event); } }

Target:
public BWEntity(net.minecraft.entity.Entity entity) { this.entity = entity; components.add(new MCEntityTransform(entity)); components.add(new Damageable() { @Override public void damage(double amount, DamageType type) { if (type == DamageType.generic) { entity.attackEntityFrom(DamageSource.generic, (float) amount); } } }); if (entity instanceof EntityLivingBase) { if (entity instanceof EntityPlayer) { MCPlayer player = components.add(new MCPlayer(this)); player.faceDisplacement = () -> Vector3D.PLUS_J.scalarMultiply(entity.getEyeHeight()); } else { Living living = components.add(new Living()); living.faceDisplacement = () -> Vector3D.PLUS_J.scalarMultiply(entity.getEyeHeight()); } } WrapperEvent.BWEntityCreate event = new WrapperEvent.BWEntityCreate(this, entity); Game.events().publish(event); }
Source:
private Subscription enqueue(Action0 action, long execTime) { if (innerSubscription.isUnsubscribed()) { return Subscriptions.unsubscribed(); } final TimedAction timedAction = new TimedAction(action, execTime, COUNTER_UPDATER.incrementAndGet(TrampolineScheduler.this)); synchronized (queue) { queue.add(timedAction); } if (wip.getAndIncrement() == 0) { do { synchronized (queue) { if (!queue.isEmpty()) { TimedAction polled = queue.poll(); polled.action.call(); } } } while (wip.decrementAndGet() > 0); return Subscriptions.unsubscribed(); } else { return Subscriptions.create(new Action0() { @Override public void call() { synchronized (queue) { queue.remove(timedAction); } } }); } }

Target:
private Subscription enqueue(Action0 action, long execTime) { if (innerSubscription.isUnsubscribed()) { return Subscriptions.unsubscribed(); } final TimedAction timedAction = new TimedAction(action, execTime, COUNTER_UPDATER.incrementAndGet(this)); queue.add(timedAction); if (wip.getAndIncrement() == 0) { do { final TimedAction polled = queue.poll(); if (polled != null) { polled.action.call(); } } while (wip.decrementAndGet() > 0); return Subscriptions.unsubscribed(); } else { return Subscriptions.create(new Action0() { @Override public void call() { queue.remove(timedAction); } }); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Version version = (Version) o; return major == version.major && minor == version.minor && patch == version.patch; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Version version = (Version) o; return Objects.equals(major, version.major) && Objects.equals(minor, version.minor) && Objects.equals(patch, version.patch); }
Source:
private static <T> T parseResponse(final Class<T> resultType, final HttpURLConnection connection) throws IOException, JsonParseException, JsonMappingException { final int responseCode = connection.getResponseCode(); if (responseCode < 200 || responseCode > 299) { final InputStream stream = connection.getErrorStream(); final String response = CharStreams.toString(new InputStreamReader(stream, URL_ENCODING)); stream.close(); logger.error("Received unexpected response from Google Cloud Storage. Response status code: {}. Response body: {}", responseCode, response); throw new IOException("Received unexpected response from Google Cloud Storage."); } else { final InputStream stream = connection.getInputStream(); final T response = MAPPER.readValue(stream, resultType); stream.close(); return response; } }

Target:
private static <T> T parseResponse(final Class<T> resultType, final HttpURLConnection connection) throws IOException, JsonParseException, JsonMappingException { throwIOExceptionOnErrorResponse(connection); final InputStream stream = connection.getInputStream(); final T response = MAPPER.readValue(stream, resultType); stream.close(); return response; }
Source:
public Value evaluate(DataSourceFactory dsf, Value... args) throws FunctionException { if (crs == null) { String epsgCode = null; if (args[1].getType() == Type.INT) { int code = args[1].getAsInt(); if (code == -1) { throw new FunctionException("-1 is an invalid SRID"); } else { epsgCode = "EPSG:" + code; } } else { epsgCode = args[1].getAsString(); } try { crs = DataSourceFactory.getCRSFactory().getCRS(epsgCode); } catch (CRSException ex) { throw new FunctionException("Cannot find an authority for " + epsgCode, ex); } } return ValueFactory.createValue(args[0].getAsGeometry(), crs); }

Target:
public Value evaluate(DataSourceFactory dsf, Value... args) throws FunctionException { String epsgCode = null; if (args[1].getType() == Type.INT) { int code = args[1].getAsInt(); if (code == -1) { throw new FunctionException("-1 is an invalid SRID"); } else { epsgCode = "EPSG:" + code; } } else { epsgCode = args[1].getAsString(); } try { CoordinateReferenceSystem crs = DataSourceFactory.getCRSFactory().getCRS(epsgCode); return ValueFactory.createValue(args[0].getAsGeometry(), crs); } catch (CRSException ex) { throw new FunctionException("Cannot find an authority for " + epsgCode, ex); } }
Source:
void notifyRead(Command cmd, long blockSize) { for (Listener listener : listeners) { listener.onRead(this, cmd, blockSize); } }

Target:
void notifyRead(Command cmd, long blockSize) { for (Listener listener : listeners) { try { listener.onRead(this, cmd, blockSize); } catch (Throwable x) { logger.log(Level.WARNING, null, x); } } }
Source:
private ManagedExecutorServiceResourceDefinition() { super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(EESubsystemModel.MANAGED_EXECUTOR_SERVICE), EeExtension.getResourceDescriptionResolver(EESubsystemModel.MANAGED_EXECUTOR_SERVICE)) .setAddHandler(ManagedExecutorServiceAdd.INSTANCE) .setRemoveHandler(ManagedExecutorServiceRemove.INSTANCE) .addCapabilities(CAPABILITY)); }

Target:
private ManagedExecutorServiceResourceDefinition() { super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(EESubsystemModel.MANAGED_EXECUTOR_SERVICE), EeExtension.getResourceDescriptionResolver(EESubsystemModel.MANAGED_EXECUTOR_SERVICE)) .setAddHandler(ManagedExecutorServiceAdd.INSTANCE) .setRemoveHandler(new ServiceRemoveStepHandler(ManagedExecutorServiceAdd.INSTANCE)) .addCapabilities(CAPABILITY)); }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Query post = RemoteAccess.evaluate(request); if (post.isDoS_blackout()) { response.sendError(503, "your request frequency is too high"); return; } String url = post.get("url", ""); URL feedUrl = null; try { feedUrl = new URL(url); } catch (Exception e) { e.printStackTrace(); } SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = null; try { feed = input.build(new XmlReader(feedUrl)); } catch (Exception e) { e.printStackTrace(); } @SuppressWarnings("unused") int totalEntries = 0; int i = 0; JSONArray jsonArray = new JSONArray(); for (SyndEntry entry : (List<SyndEntry>) feed.getEntries()) { JSONObject jsonObject = new JSONObject(); jsonObject.put("RSS Feed", url); jsonObject.put("Title", entry.getTitle().toString()); jsonObject.put("Link", entry.getLink().toString()); jsonObject.put("URI", entry.getUri().toString()); jsonObject.put("Hash-Code", Integer.toString(entry.hashCode())); jsonObject.put("Published-Date", entry.getPublishedDate().toString()); jsonObject.put("Updated-Date", (entry.getUpdatedDate() == null) ? ("null") : (entry.getUpdatedDate().toString())); jsonObject.put("Description", entry.getDescription().toString()); jsonArray.put(i, jsonObject); i++; } totalEntries = i; JSONObject rssFeed = new JSONObject(); rssFeed.put("Hackernews RSS Feed", jsonArray); response.setCharacterEncoding("UTF-8"); PrintWriter sos = response.getWriter(); sos.print(rssFeed.toString(2)); sos.println(); }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Query post = RemoteAccess.evaluate(request); if (post.isDoS_blackout()) { response.sendError(503, "your request frequency is too high"); return; } String url = post.get("url", ""); URL feedUrl = null; try { feedUrl = new URL(url); } catch (Exception e) { e.printStackTrace(); } SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = null; try { feed = input.build(new XmlReader(feedUrl)); } catch (Exception e) { e.printStackTrace(); } @SuppressWarnings("unused") int totalEntries = 0; int i = 0; JSONArray jsonArray = new JSONArray(); for (SyndEntry entry : (List<SyndEntry>) feed.getEntries()) { JSONObject jsonObject = new JSONObject(); jsonObject.put("RSS Feed", url); jsonObject.put("Title", entry.getTitle().toString()); jsonObject.put("Link", entry.getLink().toString()); jsonObject.put("URI", entry.getUri().toString()); jsonObject.put("Hash-Code", Integer.toString(entry.hashCode())); jsonObject.put("Published-Date", entry.getPublishedDate().toString()); jsonObject.put("Updated-Date", (entry.getUpdatedDate() == null) ? ("null") : (entry.getUpdatedDate().toString())); jsonObject.put("Description", entry.getDescription().toString()); jsonArray.put(i, jsonObject); i++; } totalEntries = i; JSONObject rssFeed = new JSONObject(); rssFeed.put("RSS Feed", jsonArray); response.setCharacterEncoding("UTF-8"); PrintWriter sos = response.getWriter(); sos.print(rssFeed.toString(2)); sos.println(); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_general); bindPreferenceSummaryToValue(findPreference("competition_season")); bindPreferenceSummaryToValue(findPreference("data_source")); bindPreferenceSummaryToValue(findPreference("show_field_monitor")); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.pref_general); }
Source:
public void consumeLine( String line ) { if ( line.startsWith( START_PARSING_INDICATOR ) ) { this.startParsing = true; return; } if ( this.startParsing ) { String[] tokens = StringUtils.split( line, "=", 2 ); if ( tokens.length == 2 ) { envs.put( tokens[0], tokens[1] ); } else { if ( line.trim().endsWith("=") ) { String trimmed = line.trim(); envs.put( trimmed.substring( 0, ( trimmed.length() - 1 ) ), null ); } else { unparsed.add( line ); } } } else { System.out.println( line ); } }

Target:
public void consumeLine( String line ) { if ( line.startsWith( START_PARSING_INDICATOR ) ) { this.startParsing = true; return; } if ( this.startParsing ) { String[] tokens = StringUtils.split( line, "=", 2 ); if ( tokens.length == 2 ) { envs.put( tokens[0], tokens[1] ); } else { String trimmedLine = line.trim(); if ( trimmedLine.endsWith("=") ) { envs.put( trimmedLine.substring( 0, ( trimmedLine.length() - 1 ) ), null ); } else { unparsed.add( line ); } } } else { System.out.println( line ); } }
Source:
private static InetSocketAddress tryLocalHostOrLoopback(int port) { try { logger.log(Level.FINE, "Could not find an appropriate address by searching falling back to local host"); return new InetSocketAddress(InetAddress.getLocalHost(), port); } catch (UnknownHostException ex) { logger.log(Level.FINE, "Could not find local host, falling back to loop back address"); return new InetSocketAddress(InetAddress.getLoopbackAddress(), port); } }

Target:
private static InetSocketAddress tryLocalHostOrLoopback(int port) { try { logger.log(Level.FINE, "Could not find an appropriate address, falling back to local host"); return new InetSocketAddress(InetAddress.getLocalHost(), port); } catch (UnknownHostException ex) { logger.log(Level.FINE, "Could not find local host, falling back to loop back address"); return new InetSocketAddress(InetAddress.getLoopbackAddress(), port); } }
Source:
protected final void startZoomThread(long startTime, long endTime) { long clampedStartTime = Math.max(startTime, fStartTime); long clampedEndTime = Math.min(endTime, fEndTime); fDirty.incrementAndGet(); boolean restart = false; if (fZoomThread != null) { fZoomThread.cancel(); if (fZoomThread.fZoomStartTime == clampedStartTime && fZoomThread.fZoomEndTime == clampedEndTime) { restart = true; } } long resolution = Math.max(1, (clampedEndTime - clampedStartTime) / fDisplayWidth); fZoomThread = createZoomThread(clampedStartTime, clampedEndTime, resolution, restart); if (fZoomThread != null) { fZoomThread.start(); } else { fDirty.decrementAndGet(); } }

Target:
protected final void startZoomThread(long startTime, long endTime) { long clampedStartTime = Math.min(Math.max(startTime, fStartTime), fEndTime); long clampedEndTime = Math.max(Math.min(endTime, fEndTime), fStartTime); fDirty.incrementAndGet(); boolean restart = false; if (fZoomThread != null) { fZoomThread.cancel(); if (fZoomThread.fZoomStartTime == clampedStartTime && fZoomThread.fZoomEndTime == clampedEndTime) { restart = true; } } long resolution = Math.max(1, (clampedEndTime - clampedStartTime) / fDisplayWidth); fZoomThread = createZoomThread(clampedStartTime, clampedEndTime, resolution, restart); if (fZoomThread != null) { fZoomThread.start(); } else { fDirty.decrementAndGet(); } }
Source:
public void removeInstancesFromTargetPool(List<String> instancesIdsList, String targetPoolName) { log.info("Removing instances from target pool: " + targetPoolName); if (instancesIdsList.isEmpty()) { log.warn("Cannot remove instances to target pool. Because instancesNamesList is empty."); return; } List<InstanceReference> instanceReferenceList = new ArrayList<InstanceReference>(); for (String instanceId : instancesIdsList) { String instanceUrl = createInstanceSelfLink(instanceId); instanceReferenceList.add(new InstanceReference(). setInstance(instanceUrl)); } TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequest = new TargetPoolsRemoveInstanceRequest(); if (instanceReferenceList.isEmpty()) { log.warn("Could not remove instances from target pool " + targetPoolName + " because instance reference list is null"); return; } targetPoolsRemoveInstanceRequest.setInstances(instanceReferenceList); try { Operation operation = compute.targetPools().removeInstance(PROJECT_ID, REGION_NAME, targetPoolName, targetPoolsRemoveInstanceRequest).execute(); waitForRegionOperationCompletion(operation.getName()); log.info("Instances are removed from target pool: " + targetPoolName); } catch (Exception e) { log.error("Could not remove instances from target pool " + targetPoolName, e); } }

Target:
public void removeInstancesFromTargetPool(List<String> instancesIdsList, String targetPoolName) { log.info("Removing instances from target pool: " + targetPoolName); if (instancesIdsList.isEmpty()) { log.warn("Cannot remove instances to target pool. Because instancesNamesList is empty."); return; } List<InstanceReference> instanceReferenceList = new ArrayList<InstanceReference>(); for (String instanceId : instancesIdsList) { String instanceUrl = createInstanceSelfLink(instanceId); instanceReferenceList.add(new InstanceReference(). setInstance(instanceUrl)); if (log.isDebugEnabled()) { log.debug("Instance " + instanceId + " was added to instance reference list"); } } TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequest = new TargetPoolsRemoveInstanceRequest(); if (instanceReferenceList.isEmpty()) { log.warn("Could not remove instances from target pool " + targetPoolName + " because instance reference " + "list is null"); return; } targetPoolsRemoveInstanceRequest.setInstances(instanceReferenceList); try { Operation operation = compute.targetPools().removeInstance(PROJECT_ID, REGION_NAME, targetPoolName, targetPoolsRemoveInstanceRequest).execute(); waitForRegionOperationCompletion(operation.getName()); log.info("Instances are removed from target pool: " + targetPoolName); } catch (Exception e) { log.error("Could not remove instances from target pool " + targetPoolName, e); } }
Source:
public Response deactivate(Action action) { HotPlugUnplugVmNicParameters params = new HotPlugUnplugVmNicParameters(Guid.createGuidFromString(id), PlugAction.UNPLUG); params.setVmId(((BackendNicsResource) collection).parentId); return performAction(VdcActionType.HotPlugUnplugVmNic, params); }

Target:
public Response deactivate(Action action) { HotPlugUnplugVmNicParameters params = new HotPlugUnplugVmNicParameters(guid, PlugAction.UNPLUG); params.setVmId(((BackendNicsResource) collection).parentId); return performAction(VdcActionType.HotPlugUnplugVmNic, params); }
Source:
public void apply(OnlineCommandContext ctx) throws Exception { Operations ops = new Operations(ctx.client); Address loggerAddress = Address.subsystem("logging").and("logger", category); if (replaceExisting) { try { ops.removeIfExists(loggerAddress); } catch (OperationException e) { throw new CommandFailedException("Failed to remove existing logger " + category, e); } } if (handlers != null && handlers.size() > 0) { Values handlersValues = Values.empty(); for (String handler : handlers) { handlersValues.andOptional("handler", handler); } } Values values = Values.empty() .and("category", category) .andOptional("level", level == null ? null : level.value()) .andOptional("filter-spec", filter) .andOptional("use-parent-handlers", useParentHandler) .andListOptional(String.class, "handlers", handlers); Batch batch = new Batch(); batch.add(loggerAddress, values); ops.batch(batch); }

Target:
public void apply(OnlineCommandContext ctx) throws Exception { Operations ops = new Operations(ctx.client); Address loggerAddress = Address.subsystem("logging").and("logger", category); if (replaceExisting) { try { ops.removeIfExists(loggerAddress); } catch (OperationException e) { throw new CommandFailedException("Failed to remove existing logger " + category, e); } } Values values = Values.empty() .and("category", category) .andOptional("level", level == null ? null : level.value()) .andOptional("filter-spec", filter) .andOptional("use-parent-handlers", useParentHandler) .andListOptional(String.class, "handlers", handlers); ops.add(loggerAddress, values); }
Source:
protected void removeVmRelatedEntitiesFromDb() { RemoveVmUsers(); RemoveVmNetwork(); new SnapshotsManager().removeSnapshots(getVmId()); removeVmImages(); RemoveVmStatic(); }

Target:
protected void removeVmRelatedEntitiesFromDb() { removeVmImages(); super.removeVmRelatedEntitiesFromDb(); }
Source:
public void testExpiryTime() { Session sessionCookie1 = getNewSession(); sessionCookie1.init(context); sessionCookie1.put("a", "2"); sessionCookie1.setExpiryTime(10 * 1000L); assertThat(sessionCookie1.get("a"), CoreMatchers.equalTo("2")); sessionCookie1.save(context, result); Session sessionCookie2 = roundTrip(sessionCookie1); assertThat(sessionCookie2.get("a"), CoreMatchers.equalTo("2")); when(clock.currentTimeMillis()).thenReturn(System.currentTimeMillis() + 11 * 1000L); Session sessionCookie3 = roundTrip(sessionCookie2); assertNull(sessionCookie3.get("a")); }

Target:
public void testExpiryTime() { Session sessionCookie1 = createNewSession(); sessionCookie1.init(context); sessionCookie1.put("a", "2"); sessionCookie1.setExpiryTime(10 * 1000L); assertThat(sessionCookie1.get("a"), CoreMatchers.equalTo("2")); sessionCookie1.save(context, result); Session sessionCookie2 = roundTrip(sessionCookie1); assertThat(sessionCookie2.get("a"), CoreMatchers.equalTo("2")); when(clock.currentTimeMillis()).thenReturn(System.currentTimeMillis() + 11 * 1000L); Session sessionCookie3 = roundTrip(sessionCookie2); assertNull(sessionCookie3.get("a")); }
Source:
public static void unescapePartitionSpec(SqlNodeList partSpec) { if (partSpec != null) { for (int i = 0; i < partSpec.size(); i++) { SqlNode node = partSpec.get(i); if (node instanceof SqlProperty) { SqlProperty property = (SqlProperty) node; Comparable comparable = SqlLiteral.value(property.getValue()); if (comparable instanceof NlsString) { String val = StringEscapeUtils.unescapeJava(((NlsString) comparable).getValue()); property = new SqlProperty( property.getKey(), SqlLiteral.createCharString(val, property.getValue().getParserPosition()), property.getParserPosition()); partSpec.set(i, property); } } } } }

Target:
public static void unescapePartitionSpec(SqlNodeList partSpec) { if (partSpec != null) { partSpec.accept(UNESCAPE_SHUTTLE); } }
Source:
public String getExpressionWithAbsoluteStartAndEndTimeStamps(NotificationContext context) { String expression = context.getAlert().getExpression().replaceAll("[\\s\\t\\r\\n\\f]*",""); String regexMatcher = "(?i)(\\(\\-[0-9]+(d|m|h|s)|:\\-[0-9]+(d|m|h|s)|,\\-[0-9]+(d|m|h|s)|#\\-[0-9]+(d|h|m|s))"; Matcher m = Pattern.compile(regexMatcher).matcher(expression); Long relativeTo = context.getTriggerFiredTime(); while (m.find()) { String timeStr = m.group(); Long absoluteTime = MetricReader.getTime(context.getTriggerFiredTime(), timeStr.substring(1)); expression = expression.replace(timeStr, (""+timeStr.charAt(0)) + absoluteTime); } return expression; }

Target:
public String getExpressionWithAbsoluteStartAndEndTimeStamps(NotificationContext context) { String expression = context.getAlert().getExpression().replaceAll("[\\s\\t\\r\\n\\f]*",""); String regexMatcher = "(?i)(\\(\\-[0-9]+(d|m|h|s)|:\\-[0-9]+(d|m|h|s)|,\\-[0-9]+(d|m|h|s)|#\\-[0-9]+(d|h|m|s))"; Matcher m = Pattern.compile(regexMatcher).matcher(expression); Long relativeTo = context.getAlertEnqueueTimestamp(); while (m.find()) { String timeStr = m.group(); Long absoluteTime = MetricReader.getTime(relativeTo, timeStr.substring(1)); expression = expression.replace(timeStr, (""+timeStr.charAt(0)) + absoluteTime); } return expression; }
Source:
public Map<String, Map<String, String>> getSystemProperties() { return Collections.EMPTY_MAP; }

Target:
public Map<String, Map<String, String>> getSystemProperties() { log.warn("System properties a not available for SNMP"); return Collections.EMPTY_MAP; }
Source:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof AzureTemplateOptions) { AzureTemplateOptions eTo = AzureTemplateOptions.class.cast(to); eTo.virtualNetworkName(virtualNetworkName); eTo.subnetId(subnetId); eTo.blob(blob); eTo.availabilitySet(availabilitySet); eTo.availabilitySet(availabilitySetName); if (!dataDisks.isEmpty()) { eTo.dataDisks(dataDisks); } } }

Target:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof AzureTemplateOptions) { AzureTemplateOptions eTo = AzureTemplateOptions.class.cast(to); eTo.virtualNetworkName(virtualNetworkName); eTo.subnetId(subnetId); eTo.blob(blob); eTo.availabilitySet(availabilitySet); eTo.availabilitySet(availabilitySetName); eTo.dataDisks(dataDisks); } }
Source:
protected void executeCommand() { ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(getParameters().getStoragePoolId(), _newMasterStorageDomainId, getVds().getId(), EventType.RECOVERY), new Callable<EventResult>() { @Override public EventResult call() { try { if (StorageHelperDirector.getInstance().getItem(getStorageDomain().getstorage_type()) .connectStorageToDomainByVdsId(getNewMaster(false), getVds().getId())) { StoragePoolIsoMap domainPoolMap = new StoragePoolIsoMap(getParameters() .getNewMasterDomainId(), getParameters().getStoragePoolId(), StorageDomainStatus.Active); DbFacade.getInstance() .getStoragePoolIsoMapDao() .save(domainPoolMap); getParameters().setVdsId(getVds().getId()); getParameters().setStorageDomainId(getStorageDomainId().getValue()); try { executeReconstruct(); } finally { if (!reconstructOpSucceeded) { getStoragePoolIsoMapDAO().remove(domainPoolMap.getId()); } } } else { getReturnValue().setFault(new VdcFault(new VdcBLLException(VdcBllErrors.StorageServerConnectionError, "Failed to connect storage"), VdcBllErrors.StorageServerConnectionError)); } } catch (VdcBLLException e) { getReturnValue().setFault(new VdcFault(e)); } return new EventResult(getSucceeded(), EventType.RECONSTRUCT); } }); }

Target:
protected void executeCommand() { ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(getParameters().getStoragePoolId(), _newMasterStorageDomainId, getVds().getId(), EventType.RECOVERY), new Callable<EventResult>() { @Override public EventResult call() { try { if (StorageHelperDirector.getInstance().getItem(getStorageDomain().getstorage_type()) .connectStorageToDomainByVdsId(getNewMaster(false), getVds().getId())) { StoragePoolIsoMap domainPoolMap = new StoragePoolIsoMap(getParameters() .getNewMasterDomainId(), getParameters().getStoragePoolId(), StorageDomainStatus.Active); DbFacade.getInstance() .getStoragePoolIsoMapDao() .save(domainPoolMap); getParameters().setVdsId(getVds().getId()); getParameters().setStorageDomainId(getStorageDomainId().getValue()); getStoragePoolDAO().updateStatus(getStoragePool().getId(), StoragePoolStatus.Problematic); try { executeReconstruct(); } finally { if (!reconstructOpSucceeded) { getStoragePoolIsoMapDAO().remove(domainPoolMap.getId()); } } } else { getReturnValue().setFault(new VdcFault(new VdcBLLException(VdcBllErrors.StorageServerConnectionError, "Failed to connect storage"), VdcBllErrors.StorageServerConnectionError)); } } catch (VdcBLLException e) { getReturnValue().setFault(new VdcFault(e)); } return new EventResult(getSucceeded(), EventType.RECONSTRUCT); } }); }
Source:
protected void createToolItems(ToolBarManager toolBarManager) { IContributionItem[] items = toolBarManager.getItems(); for (IContributionItem iContributionItem : items) { if (iContributionItem instanceof ActionContributionItem) { IAction action = ((ActionContributionItem)iContributionItem).getAction(); String id = action.getActionDefinitionId(); if ("org.eclipse.compare.copyAllLeftToRight".equals(id)) { toolBarManager.remove(iContributionItem); } else if ("org.eclipse.compare.copyAllRightToLeft".equals(id)) { toolBarManager.remove(iContributionItem); } } } }

Target:
protected void createToolItems(ToolBarManager toolBarManager) { super.createToolItems(toolBarManager); IContributionItem[] items = toolBarManager.getItems(); for (IContributionItem iContributionItem : items) { if (iContributionItem instanceof ActionContributionItem) { IAction action = ((ActionContributionItem)iContributionItem).getAction(); String id = action.getActionDefinitionId(); if ("org.eclipse.compare.copyAllLeftToRight".equals(id)) { toolBarManager.remove(iContributionItem); } else if ("org.eclipse.compare.copyAllRightToLeft".equals(id)) { toolBarManager.remove(iContributionItem); } } } }
Source:
private void setupMultiExecutorMode() { String filters = azkProps.getString(AZKABAN_EXECUTOR_SELECTOR_FILTERS, ""); if (filters != null) { filterList = Arrays.asList(StringUtils.split(filters, ",")); } Map<String, String> compListStrings = azkProps.getMapByPrefix(AZKABAN_EXECUTOR_SELECTOR_COMPARATOR_PREFIX); if (compListStrings != null) { comparatorWeightsMap = new TreeMap<String, Integer>(); for (Map.Entry<String, String> entry : compListStrings.entrySet()) { comparatorWeightsMap.put(entry.getKey(), Integer.valueOf(entry.getValue())); } } queueProcessor = new QueueProcessorThread(azkProps.getBoolean( AZKABAN_QUEUEPROCESSING_ENABLED, true), azkProps.getLong( AZKABAN_ACTIVE_EXECUTOR_REFRESHINTERVAL_IN_MS, 1000), azkProps.getInt( AZKABAN_ACTIVE_EXECUTOR_REFRESHINTERVAL_IN_FLOW, 1000)); queueProcessor.start(); }

Target:
private void setupMultiExecutorMode() { String filters = azkProps.getString(AZKABAN_EXECUTOR_SELECTOR_FILTERS, ""); if (filters != null) { filterList = Arrays.asList(StringUtils.split(filters, ",")); } Map<String, String> compListStrings = azkProps.getMapByPrefix(AZKABAN_EXECUTOR_SELECTOR_COMPARATOR_PREFIX); if (compListStrings != null) { comparatorWeightsMap = new TreeMap<String, Integer>(); for (Map.Entry<String, String> entry : compListStrings.entrySet()) { comparatorWeightsMap.put(entry.getKey(), Integer.valueOf(entry.getValue())); } } executorInforRefresherService = Executors.newFixedThreadPool(azkProps.getInt( AZKABAN_EXECUTORINFO_REFRESH_MAX_THREADS, 5)); queueProcessor = new QueueProcessorThread(azkProps.getBoolean( AZKABAN_QUEUEPROCESSING_ENABLED, true), azkProps.getLong( AZKABAN_ACTIVE_EXECUTOR_REFRESHINTERVAL_IN_MS, 1000), azkProps.getInt( AZKABAN_ACTIVE_EXECUTOR_REFRESHINTERVAL_IN_NUM_FLOW, 1000)); queueProcessor.start(); }
Source:
private void printBundleDiags(Collection<Bundle> toPrint) { StringBuilder sb = new StringBuilder(); toPrint.forEach(bundle -> appendBundleDiag(bundle, sb)); LOGGER.info("Printing unsatisfied bundle requirements: {}", sb); }

Target:
private void printBundleDiags(Collection<Bundle> toPrint) { StringBuilder sb = new StringBuilder(); toPrint.forEach(bundle -> appendBundleDiag(bundle, sb)); LOGGER.error("Printing unsatisfied bundle requirements: {}", sb); }
Source:
public static JoinDistributionType getJoinDistributionType(Session session) { if (!session.getSystemProperty(DISTRIBUTED_JOIN, Boolean.class)) { return JoinDistributionType.BROADCAST; } return session.getSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.class); }

Target:
public static JoinDistributionType getJoinDistributionType(Session session) { Boolean distributedJoin = session.getSystemProperty(DISTRIBUTED_JOIN, Boolean.class); if (distributedJoin != null) { if (!distributedJoin) { return BROADCAST; } return REPARTITIONED; } return session.getSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.class); }
Source:
public void testQueuedJobRunsAfterShutdown() throws InterruptedException { BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(); ExecutorService service = Executors.newSingleThreadExecutor(); try { PartitionedUnorderedExecutor executor = new PartitionedUnorderedExecutor(queue, service, 1); final Semaphore jobSemaphore = new Semaphore(0); final Semaphore testSemaphore = new Semaphore(0); executor.submit((Callable<Void>) () -> { testSemaphore.release(); jobSemaphore.acquireUninterruptibly(); return null; }); executor.submit((Callable<Void>) () -> { jobSemaphore.acquireUninterruptibly(); return null; }); testSemaphore.acquireUninterruptibly(); executor.shutdown(); assertThat(executor.awaitTermination(100, MILLISECONDS), is(false)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(false)); jobSemaphore.release(); assertThat(executor.awaitTermination(100, MILLISECONDS), is(false)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(false)); jobSemaphore.release(); assertThat(executor.awaitTermination(2, MINUTES), is(true)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(true)); assertThat(jobSemaphore.availablePermits(), is(0)); } finally { service.shutdown(); } }

Target:
public void testQueuedJobRunsAfterShutdown() throws InterruptedException { BlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(); ExecutorService service = Executors.newSingleThreadExecutor(); try { PartitionedUnorderedExecutor executor = new PartitionedUnorderedExecutor(queue, service, 1); final Semaphore jobSemaphore = new Semaphore(0); final Semaphore testSemaphore = new Semaphore(0); executor.submit(() -> { testSemaphore.release(); jobSemaphore.acquireUninterruptibly(); }); executor.submit(() -> jobSemaphore.acquireUninterruptibly()); testSemaphore.acquireUninterruptibly(); executor.shutdown(); assertThat(executor.awaitTermination(100, MILLISECONDS), is(false)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(false)); jobSemaphore.release(); assertThat(executor.awaitTermination(100, MILLISECONDS), is(false)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(false)); jobSemaphore.release(); assertThat(executor.awaitTermination(2, MINUTES), is(true)); assertThat(executor.isShutdown(), is(true)); assertThat(executor.isTerminated(), is(true)); assertThat(jobSemaphore.availablePermits(), is(0)); } finally { service.shutdown(); } }
Source:
static protected Integer getOffset(final long time, final TreeMap<Long,Integer> offsetMap) { final Long higher = offsetMap.higherKey(time); final Long lower = offsetMap.lowerKey(time); if (lower == null && higher == null) { throw new AlgorithmException(String.format("unable to map offset from t=%s in map of size %d",new DateTime(time).toString(),offsetMap.size())); } if (lower == null) { return offsetMap.get(higher); } else { return offsetMap.get(lower); } }

Target:
static protected Integer getOffset(final long time, final TreeMap<Long,Integer> offsetMap) { final Long higher = offsetMap.higherKey(time); final Long lower = offsetMap.lowerKey(time); if (lower == null && higher == null) { LOGGER.error("action=exception_due_to_empty_offset_map map_size={} t={}",offsetMap.size(),time); throw new AlgorithmException(String.format("unable to map offset from t=%s in map of size %d",new DateTime(time).toString(),offsetMap.size())); } if (lower == null) { return offsetMap.get(higher); } return offsetMap.get(lower); }
Source:
private String getFilterByDataSourceClause() { if (datasourceObjId > 0) { return " AND blackboard_artifacts.data_source_obj_id = " + datasourceObjId + " "; } return " "; }

Target:
private String getFilterByDataSourceClause() { if (filteringDSObjId > 0) { return " AND blackboard_artifacts.data_source_obj_id = " + filteringDSObjId + " "; } return " "; }
Source:
public int run() throws IOException { Preconditions.checkArgument(files != null && files.size() >= 1, "A Parquet file is required."); Preconditions.checkArgument(files.size() == 1, "Cannot process multiple Parquet files."); InputFile in = HadoopInputFile.fromPath(new Path(files.get(0)), new Configuration()); if (!showColumnIndex && !showOffsetIndex) { showColumnIndex = showOffsetIndex = true; } try (ParquetFileReader reader = ParquetFileReader.open(in)) { boolean firstBlock = true; for (Entry<Integer, BlockMetaData> entry : getBlocks(reader.getFooter())) { if (!firstBlock) { console.info(""); } firstBlock = false; console.info("row group {}:", entry.getKey()); for (ColumnChunkMetaData column : getColumns(entry.getValue())) { String path = column.getPath().toDotString(); if (showColumnIndex) { console.info("column index for column {}:", path); ColumnIndex columnIndex = reader.readColumnIndex(column); if (columnIndex == null) { console.info("NONE"); } else { console.info(columnIndex.toString()); } } if (showOffsetIndex) { console.info("offset index for column {}:", path); OffsetIndex offsetIndex = reader.readOffsetIndex(column); if (offsetIndex == null) { console.info("NONE"); } else { console.info(offsetIndex.toString()); } } } } } return 0; }

Target:
public int run() throws IOException { Preconditions.checkArgument(files != null && files.size() >= 1, "A Parquet file is required."); Preconditions.checkArgument(files.size() == 1, "Cannot process multiple Parquet files."); InputFile in = HadoopInputFile.fromPath(qualifiedPath(files.get(0)), getConf()); if (!showColumnIndex && !showOffsetIndex) { showColumnIndex = true; showOffsetIndex = true; } Set<String> rowGroupIndexSet = new HashSet<>(); if (rowGroupIndexes != null) { rowGroupIndexSet.addAll(rowGroupIndexes); } try (ParquetFileReader reader = ParquetFileReader.open(in)) { boolean firstBlock = true; int rowGroupIndex = 0; for (BlockMetaData block : reader.getFooter().getBlocks()) { if (!rowGroupIndexSet.isEmpty() && !rowGroupIndexSet.contains(Integer.toString(rowGroupIndex))) { ++rowGroupIndex; continue; } if (!firstBlock) { console.info(""); } firstBlock = false; console.info("row-group {}:", rowGroupIndex); for (ColumnChunkMetaData column : getColumns(block)) { String path = column.getPath().toDotString(); if (showColumnIndex) { console.info("column index for column {}:", path); ColumnIndex columnIndex = reader.readColumnIndex(column); if (columnIndex == null) { console.info("NONE"); } else { console.info(columnIndex.toString()); } } if (showOffsetIndex) { console.info("offset index for column {}:", path); OffsetIndex offsetIndex = reader.readOffsetIndex(column); if (offsetIndex == null) { console.info("NONE"); } else { console.info(offsetIndex.toString()); } } } ++rowGroupIndex; } } return 0; }
Source:
boolean containsValue(Object value) { for (Iterator<DelegateCache> it = delegateCaches.values().iterator(); it .hasNext();) { DelegateCache cache = it.next(); if (cache.containsValue(value)) return true; } return false; }

Target:
boolean containsValue(Object value) { for (DelegateCache cache : delegateCaches.values()) { if (cache.containsValue(value)) return true; } return false; }
Source:
public void testDeleteViewIndexSequences() throws Exception { String schemaName = generateUniqueName(); String tableName = generateUniqueName(); String viewSchemaName = generateUniqueName(); String fullTableName = SchemaUtil.getTableName(schemaName, tableName); String indexName = "IND_" + generateUniqueName(); String viewName = "VIEW_" + generateUniqueName(); String fullViewName = SchemaUtil.getTableName(viewSchemaName, viewName); createBaseTable(schemaName, tableName, false, null, null); Connection conn1 = getConnection(); Connection conn2 = getConnection(); conn1.createStatement().execute("CREATE VIEW " + fullViewName + " AS SELECT * FROM " + fullTableName); conn1.createStatement().execute("CREATE INDEX " + indexName + " ON " + fullViewName + " (v1)"); conn2.createStatement().executeQuery("SELECT * FROM " + fullTableName).next(); String sequenceName = getViewIndexSequenceName(PNameFactory.newName(fullTableName), null, isNamespaceMapped); String sequenceSchemaName = getViewIndexSequenceSchemaName(PNameFactory.newName(fullTableName), isNamespaceMapped); verifySequenceValue(null, sequenceName, sequenceSchemaName, -9223372036854775807L); verifySequenceValue(null, sequenceName, sequenceSchemaName, -9223372036854775807L); conn1.createStatement().execute("CREATE INDEX " + indexName + "_2 ON " + fullViewName + " (v1)"); verifySequenceValue(null, sequenceName, sequenceSchemaName, -9223372036854775806L); conn1.createStatement().execute("DROP VIEW " + fullViewName); conn1.createStatement().execute("DROP TABLE "+ fullTableName); verifySequenceNotExists(null, sequenceName, sequenceSchemaName); }

Target:
public void testDeleteViewIndexSequences() throws Exception { String schemaName = generateUniqueName(); String tableName = generateUniqueName(); String viewSchemaName = generateUniqueName(); String fullTableName = SchemaUtil.getTableName(schemaName, tableName); String indexName = "IND_" + generateUniqueName(); String viewName = "VIEW_" + generateUniqueName(); String fullViewName = SchemaUtil.getTableName(viewSchemaName, viewName); createBaseTable(schemaName, tableName, false, null, null); Connection conn1 = getConnection(); Connection conn2 = getConnection(); conn1.createStatement().execute("CREATE VIEW " + fullViewName + " AS SELECT * FROM " + fullTableName); conn1.createStatement().execute("CREATE INDEX " + indexName + " ON " + fullViewName + " (v1)"); conn2.createStatement().executeQuery("SELECT * FROM " + fullTableName).next(); String sequenceName = getViewIndexSequenceName(PNameFactory.newName(fullTableName), null, isNamespaceMapped); String sequenceSchemaName = getViewIndexSequenceSchemaName(PNameFactory.newName(fullTableName), isNamespaceMapped); verifySequenceValue(null, sequenceName, sequenceSchemaName, Long.MIN_VALUE + 1); conn1.createStatement().execute("CREATE INDEX " + indexName + "_2 ON " + fullViewName + " (v1)"); verifySequenceValue(null, sequenceName, sequenceSchemaName, Long.MIN_VALUE + 2); conn1.createStatement().execute("DROP VIEW " + fullViewName); conn1.createStatement().execute("DROP TABLE "+ fullTableName); verifySequenceNotExists(null, sequenceName, sequenceSchemaName); }
Source:
public void saveRevisionData(Session session, Object revisionData) { session.save( revisionInfoEntityName, revisionData ); if ( revisionInfoNumberReader != null ) { if ( revisionInfoNumberReader.getRevisionNumber( revisionData ).longValue() < 0 ) { throw new AuditException( "Negative revision numbers are not allowed" ); } } sessionCacheCleaner.scheduleAuditDataRemoval( session, revisionData ); }

Target:
public void saveRevisionData(Session session, Object revisionData) { session.save( revisionInfoEntityName, revisionData ); if ( revisionInfoNumberReader != null && revisionInfoNumberReader.getRevisionNumber( revisionData ).longValue() < 0 ) { throw new AuditException( "Negative revision numbers are not allowed" ); } sessionCacheCleaner.scheduleAuditDataRemoval( session, revisionData ); }
Source:
public ForgeDirection getOpenOrientation() { int connectionsNum = 0; ForgeDirection targetOrientation = ForgeDirection.UNKNOWN; for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) { if (container.pipeConnectionsBuffer[o.ordinal()]) { connectionsNum++; if (connectionsNum == 1) { targetOrientation = o; } } } if (connectionsNum > 1 || connectionsNum == 0) { return ForgeDirection.UNKNOWN; } return targetOrientation.getOpposite(); }

Target:
public ForgeDirection getOpenOrientation() { int connectionsNum = 0; ForgeDirection targetOrientation = ForgeDirection.UNKNOWN; for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) { if (container.isPipeConnected(o)) { connectionsNum++; if (connectionsNum == 1) { targetOrientation = o; } } } if (connectionsNum > 1 || connectionsNum == 0) { return ForgeDirection.UNKNOWN; } return targetOrientation.getOpposite(); }
Source:
public void writeTo(final OutputStream outStream) throws IOException { final long startTime = PerformanceUtils.getCurrentTime(); final long totalBytes = IOUtils.copy(this.getContent(), outStream, bufferSize); final long endTime = PerformanceUtils.getCurrentTime(); if (this.getContentLength() != -1 && totalBytes != this.getContentLength()) { throw new ContentLengthNotMatchException(String.format("The Content length (%d) not match the number of byte read (%d)", this.getContentLength(), totalBytes)); } PerformanceUtils.logMbps(startTime, endTime, totalBytes, path, true); }

Target:
public void writeTo(final OutputStream outStream) throws IOException { final long startTime = PerformanceUtils.getCurrentTime(); final long totalBytes = IOUtils.copy(this.getContent(), outStream, bufferSize); final long endTime = PerformanceUtils.getCurrentTime(); if (this.getContentLength() != -1 && totalBytes != this.getContentLength()) { throw new ContentLengthNotMatchException(path, this.getContentLength(), totalBytes); } PerformanceUtils.logMbps(startTime, endTime, totalBytes, path, true); }
Source:
private long getInstallationSize() { long totalSize = 0; Iterator<Pack> iter = idata.selectedPacks.iterator(); while( iter.hasNext() ) { Pack p = (Pack) iter.next(); totalSize += p.nbytes; } String addFeatureSizes = idata.getVariable("INSTALL_ADDITIONAL_SIZES"); if (addFeatureSizes != null && !addFeatureSizes.isEmpty()) { String[] afs = addFeatureSizes.split(","); for (int i = 0; i < afs.length; i++) totalSize += Long.parseLong(afs[i]); } String runtimeSizes = idata.getVariable("INSTALL_RT_SIZES"); if (runtimeSizes != null && !runtimeSizes.isEmpty()) { String[] rts = runtimeSizes.split(","); for (int i = 0; i < rts.length; i++) totalSize += Long.parseLong(rts[i]); } return totalSize; }

Target:
private long getInstallationSize() { long totalSize = 0; Iterator<Pack> iter = idata.selectedPacks.iterator(); while( iter.hasNext() ) { Pack p = (Pack) iter.next(); totalSize += p.nbytes; } totalSize += calculateAggregateSize(idata.getVariable("INSTALL_ADDITIONAL_SIZES")); totalSize += calculateAggregateSize(idata.getVariable("INSTALL_RT_SIZES")); return totalSize; }