auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public GetReplyResponse getReply(GetReplyRequest input) { LOG.finer("Entering getReply"); GetReplyResponse output = new GetReplyResponse(); try { output.status = StatusType.StatusTypeSuccess; } catch (Exception e) { output.status = StatusType.StatusTypeFailure; output.error = convertToErrorAndLog(LOG, e); } LOG.finer("Exiting getReply"); return output; }

Target:
public GetReplyResponse getReply(GetReplyRequest input) { LOG.finer("Entering getReply"); GetReplyResponse output = new GetReplyResponse(); try { if (input == null) throw new InputValidationException(ApiError.InvalidValueNull.getCode(), ApiError.InvalidValueNull.getMessage("GetReplyRequest: input")); if (input.id == null) throw new InputValidationException(ApiError.InvalidValueNull.getCode(), ApiError.InvalidValueNull.getMessage("Long: input.id")); input.accessCode = ValidationHelper.validateAccessCode(input.accessCode, "input"); input.session = ValidationHelper.validateAndExtendSession(input.session, "input.session"); output.reply = ReplyServiceProvider.provide().getReply(input.id); output.status = StatusType.StatusTypeSuccess; } catch (Exception e) { output.status = StatusType.StatusTypeFailure; output.error = convertToErrorAndLog(LOG, e); } LOG.finer("Exiting getReply"); return output; }
Source:
public BlockSnapshot snapshotFor(Location<World> location) { final SpongeBlockSnapshotBuilder builder = new SpongeBlockSnapshotBuilder() .blockState(this) .position(location.getBlockPosition()) .worldId(location.getExtent().getUniqueId()); if (this.block.hasTileEntity() && location.getBlockType().equals(this.block)) { final TileEntity tileEntity = location.getTileEntity().get(); tileEntity.getContainers().forEach(builder::add); final NBTTagCompound compound = new NBTTagCompound(); ((net.minecraft.tileentity.TileEntity) tileEntity).writeToNBT(compound); builder.unsafeNbt(compound); } return builder.build(); }

Target:
public BlockSnapshot snapshotFor(Location<World> location) { final SpongeBlockSnapshotBuilder builder = new SpongeBlockSnapshotBuilder() .blockState(this) .position(location.getBlockPosition()) .worldId(location.getExtent().getUniqueId()); if (this.block.hasTileEntity() && location.getBlockType().equals(this.block)) { final TileEntity tileEntity = location.getTileEntity().get(); for (DataManipulator<?, ?> manipulator : tileEntity.getContainers()) { builder.add(manipulator); } final NBTTagCompound compound = new NBTTagCompound(); ((net.minecraft.tileentity.TileEntity) tileEntity).writeToNBT(compound); builder.unsafeNbt(compound); } return builder.build(); }
Source:
public static Webrequest getInstance(){ return webrequest_instance; }

Target:
public static Webrequest getInstance(){ return instance; }
Source:
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { ObjectMap variantOptions = variantJobsArgs.getVariantOptions(); ObjectMap pipelineOptions = variantJobsArgs.getPipelineOptions(); VariantStorageManager variantStorageManager = StorageManagerFactory.getVariantStorageManager(); QueryOptions statsOptions = new QueryOptions(variantOptions); VariantStatisticsManager variantStatisticsManager = new VariantStatisticsManager(); VariantDBAdaptor dbAdaptor = variantStorageManager.getDBAdaptor(variantOptions.getString("dbName"), variantOptions); URI outdirUri = URLHelper.createUri(pipelineOptions.getString("output.dir.statistics")); VariantSource variantSource = variantOptions.get(VariantStorageManager.VARIANT_SOURCE, VariantSource.class); URI statsOutputUri = outdirUri.resolve(VariantStorageManager.buildFilename(variantSource)); variantStatisticsManager.loadStats(dbAdaptor, statsOutputUri, statsOptions); return RepeatStatus.FINISHED; }

Target:
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { ObjectMap variantOptions = variantJobsArgs.getVariantOptions(); ObjectMap pipelineOptions = variantJobsArgs.getPipelineOptions(); VariantStorageManager variantStorageManager = StorageManagerFactory.getVariantStorageManager(); VariantSource variantSource = variantOptions.get(VariantStorageManager.VARIANT_SOURCE, VariantSource.class); VariantDBAdaptor dbAdaptor = variantStorageManager.getDBAdaptor( variantOptions.getString(VariantStorageManager.DB_NAME), variantOptions); URI outdirUri = URLHelper.createUri(pipelineOptions.getString("output.dir.statistics")); URI statsOutputUri = outdirUri.resolve(VariantStorageManager.buildFilename(variantSource)); VariantStatisticsManager variantStatisticsManager = new VariantStatisticsManager(); QueryOptions statsOptions = new QueryOptions(variantOptions); variantStatisticsManager.loadStats(dbAdaptor, statsOutputUri, statsOptions); return RepeatStatus.FINISHED; }
Source:
public static boolean deleteFile(File file) { boolean shouldFailIfOpen = DefaultMuleConfiguration.shouldFailIfDeleteOpenFile(); if (shouldFailIfOpen) { if (isFileOpen(file)) { Message message = MessageFactory.createStaticMessage("Attempting to delete an open file: " + file); throw new MuleRuntimeException(message); } } else if (shouldLogWarningIfDeleteOpenFile()) { if (isFileOpen(file)) { logger.warn("Attempting to delete an open file: " + file); } } return file.delete(); }

Target:
public static boolean deleteFile(File file) { boolean shouldFailIfOpen = shouldFailIfDeleteOpenFile(); if (shouldFailIfOpen) { if (isFileOpen(file)) { throw new MuleRuntimeException(createStaticMessage("Attempting to delete an open file: " + file)); } } else if (shouldLogWarningIfDeleteOpenFile()) { if (isFileOpen(file)) { logger.warn("Attempting to delete an open file: " + file); } } return file.delete(); }
Source:
public void ignoresParameterAfterSemiColon() throws IOException { final String data = "Build and Run"; final String ignored = ";ignored-stuff"; final String length = Integer.toHexString(data.length()); final InputStream stream = new RqChunk( new RqFake( Arrays.asList( "GET /h?a=3", "Host: c.example.com", CHUNKED_HEADER ), Joiner.on(CRLF).join( length + ignored, data, END_OF_CHUNK ) ) ).body(); final byte[] buf = new byte[data.length()]; MatcherAssert.assertThat( stream.read(buf), Matchers.equalTo(data.length()) ); MatcherAssert.assertThat(buf, Matchers.equalTo(data.getBytes())); MatcherAssert.assertThat(stream.available(), Matchers.equalTo(0)); }

Target:
public void ignoresParameterAfterSemiColon() throws IOException { final String data = "Build and Run"; final String ignored = ";ignored-stuff"; final String length = Integer.toHexString(data.length()); final InputStream stream = new RqChunk( new RqFake( Arrays.asList( "GET /h?a=3", "Host: c.example.com", CHUNKED_HEADER ), Joiner.on(CRLF).join( length + ignored, data, END_OF_CHUNK, "" ) ) ).body(); final byte[] buf = new byte[data.length()]; MatcherAssert.assertThat( stream.read(buf), Matchers.equalTo(data.length()) ); MatcherAssert.assertThat(buf, Matchers.equalTo(data.getBytes())); MatcherAssert.assertThat(stream.available(), Matchers.equalTo(0)); }
Source:
private void closeResponse(CloseableHttpResponse response) { try { if (response != null) { EntityUtils.consume(response.getEntity()); response.close(); } } catch (IOException e) { LOGGER.error("Error trying to close response: " + e.getMessage()); } }

Target:
private void closeResponse(CloseableHttpResponse response) { try { if (response != null) { EntityUtils.consume(response.getEntity()); response.close(); } } catch (IOException e) { LOGGER.error("Error trying to close response", e); } }
Source:
private void initializeDistanceUnitSelector() { if (Settings.useImperialUnits()) { getDistanceUnitSelector().setSelection(2); distanceUnit = DistanceParser.UNIT.getById(2); } else { getDistanceUnitSelector().setSelection(0); distanceUnit = DistanceParser.UNIT.getById(0); } getDistanceUnitSelector().setOnItemSelectedListener(new ChangeDistanceUnit(this)); }

Target:
private void initializeDistanceUnitSelector() { distanceUnit = Settings.useImperialUnits() ? DistanceParser.DistanceUnit.FT : DistanceParser.DistanceUnit.M; getDistanceUnitSelector().setSelection(distanceUnit.getValue()); getDistanceUnitSelector().setOnItemSelectedListener(new ChangeDistanceUnit(this)); }
Source:
private VirtualMachine getVMwareTemplate(String imageName, Folder rootFolder) { VirtualMachine image = null; try { VirtualMachine node = getVM(imageName, rootFolder); if (VSpherePredicate.isTemplatePredicate.apply(node)) image = node; } catch (NullPointerException e) { logger.error("cannot find an image called " + imageName, e); throw e; } return checkNotNull(image, "image"); }

Target:
private VirtualMachine getVMwareTemplate(String imageName, Folder rootFolder) { VirtualMachine image = null; try { VirtualMachine node = getVM(imageName, rootFolder); if (VSpherePredicate.isTemplatePredicate.apply(node)) image = node; } catch (Exception e) { logger.error("cannot find an image called " + imageName, e); propagate(e); } return checkNotNull(image, "image with name " + imageName + " not found."); }
Source:
protected <T> T buildManager(Class<T> manager, HttpPipeline httpPipeline, AzureProfile profile) { try { Constructor<T> constructor = manager.getDeclaredConstructor(httpPipeline.getClass(), profile.getClass()); AccessController.doPrivileged((PrivilegedAction<Object>) () -> { constructor.setAccessible(true); return null; }); return constructor.newInstance(httpPipeline, profile); } catch (NoSuchMethodException ex) { throw logger.logExceptionAsError(new RuntimeException(ex)); } catch (IllegalAccessException ex) { throw logger.logExceptionAsError(new RuntimeException(ex)); } catch (InstantiationException ex) { throw logger.logExceptionAsError(new RuntimeException(ex)); } catch (InvocationTargetException ex) { throw logger.logExceptionAsError(new RuntimeException(ex)); } }

Target:
protected <T> T buildManager(Class<T> manager, HttpPipeline httpPipeline, AzureProfile profile) { try { Constructor<T> constructor = manager.getDeclaredConstructor(httpPipeline.getClass(), profile.getClass()); AccessController.doPrivileged((PrivilegedAction<Object>) () -> { constructor.setAccessible(true); return null; }); return constructor.newInstance(httpPipeline, profile); } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException ex) { throw logger.logExceptionAsError(new RuntimeException(ex)); } }
Source:
public void encodeToByteBuffer(ByteBuffer byteBuffer) { byteBuffer .putLong(ikeInitiatorSpi) .putLong(ikeResponderSpi) .put((byte) nextPayloadType) .put(IKE_HEADER_VERSION_INFO) .put((byte) exchangeType); byte flag = 0; if (isResponse) { flag |= IKE_HEADER_FLAG_IS_RESP; } if (fromIkeInitiator) { flag |= IKE_HEADER_FLAG_FROM_INITIATOR; } byteBuffer.put(flag).putInt(messageId).putInt(messageLength); }

Target:
public void encodeToByteBuffer(ByteBuffer byteBuffer) { byteBuffer .putLong(ikeInitiatorSpi) .putLong(ikeResponderSpi) .put((byte) nextPayloadType) .put(IKE_HEADER_VERSION_INFO) .put((byte) exchangeType); byte flag = 0; if (isResponseMsg) { flag |= IKE_HEADER_FLAG_IS_RESP_MSG; } if (fromIkeInitiator) { flag |= IKE_HEADER_FLAG_FROM_IKE_INITIATOR; } byteBuffer.put(flag).putInt(messageId).putInt(messageLength); }
Source:
public void sendMessage(ChatType type, Text message) { checkNotNull(type, "type"); checkNotNull(message, "message"); if (this.conversation != null && this.conversation.getChatHandler(this).isPresent() && !this.conversation.getChatHandler(this).get().process(message)) { return; } ITextComponent component = SpongeTexts.toComponent(message); if (type == ChatTypes.ACTION_BAR) { component = SpongeTexts.fixActionBarFormatting(component); } this.connection.sendPacket(new SPacketChat(component, ((SpongeChatType) type).getByteId())); }

Target:
public void sendMessage(ChatType type, Text message) { checkNotNull(type, "type"); checkNotNull(message, "message"); if (type != ChatTypes.ACTION_BAR && this.conversation != null && this.conversation.getChatHandler(this).isPresent() && !this.conversation.getChatHandler(this).get().process(message)) { return; } ITextComponent component = SpongeTexts.toComponent(message); if (type == ChatTypes.ACTION_BAR) { component = SpongeTexts.fixActionBarFormatting(component); } this.connection.sendPacket(new SPacketChat(component, ((SpongeChatType) type).getByteId())); }
Source:
public static void main(String[] args) { Thread.setDefaultUncaughtExceptionHandler(new StoRMDefaultUncaughtExceptionHandler()); StoRM storm = new StoRM(); try { storm.init(); } catch (BootstrapException e) { log.error(e.getMessage(), e); return; } Runtime.getRuntime().addShutdownHook(new ShutdownHook(storm)); if (storm.startServices()) { log.info("StoRM: Backend services successfully started."); } else { log.error("StoRM: error starting storm services."); storm.stopServices(); Runtime.getRuntime().exit(1); } }

Target:
public static void main(String[] args) { Thread.setDefaultUncaughtExceptionHandler(new StoRMDefaultUncaughtExceptionHandler()); StoRM storm = new StoRM(); try { storm.init(); } catch (BootstrapException e) { log.error(e.getMessage(), e); exit(1); } Runtime.getRuntime().addShutdownHook(new ShutdownHook(storm)); try { storm.startServices(); log.info("StoRM: Backend services successfully started."); } catch (Exception e) { log.error("StoRM: error starting storm services: {}", e.getMessage()); storm.stopServices(); exit(1); } }
Source:
public void execute() { List<QuotaUsageVO> quotaUsage = _responseBuilder.getQuotaUsage(this); QuotaStatementResponse response = _responseBuilder.createQuotaStatementResponse(quotaUsage); response.setStartDate(startDate); response.setEndDate(endDate); response.setResponseName(getCommandName()); setResponseObject(response); }

Target:
public void execute() { List<QuotaUsageVO> quotaUsage = _responseBuilder.getQuotaUsage(this); QuotaStatementResponse response = _responseBuilder.createQuotaStatementResponse(quotaUsage); response.setStartDate(startDate == null ? null : new Date(startDate.getTime())); response.setEndDate(endDate == null ? null : new Date(endDate.getTime())); response.setResponseName(getCommandName()); setResponseObject(response); }
Source:
public PasswordKeyMapper(String credentialName, String algorithm, int hash) throws InvalidKeyException { Assert.checkNotNullParam("algorithm", algorithm); Assert.checkMinimumParameter("hash", 1, hash); this.algorithm = algorithm; this.passwordType = toPasswordType(algorithm); this.hash = hash; this.credentialName = credentialName; }

Target:
public PasswordKeyMapper(String credentialName, String algorithm, int hash) throws InvalidKeyException { Assert.checkNotNullParam("credentialName", credentialName); Assert.checkNotNullParam("algorithm", algorithm); Assert.checkMinimumParameter("hash", 1, hash); this.algorithm = algorithm; this.passwordType = toPasswordType(algorithm); this.hash = hash; this.credentialName = credentialName; }
Source:
protected boolean canRunOn(@NotNull ErlangFile file) { return !file.getName().endsWith(ErlangFileType.HEADER.getDefaultExtension()) && !file.isExportedAll(); }

Target:
protected boolean canRunOn(@NotNull ErlangFile file) { return file.getFileType() == ErlangFileType.MODULE && !file.isExportedAll(); }
Source:
void createHandle (int index) { state |= HANDLE | MENU; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); long adjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 0); if (adjustment == 0) error (SWT.ERROR_NO_HANDLES); handle = OS.gtk_spin_button_new (adjustment, climbRate, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0); if (OS.GTK_VERSION <= OS.VERSION(3, 20, 0)) { OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); } OS.gtk_spin_button_set_wrap (handle, (style & SWT.WRAP) != 0); if (OS.GTK3) { imContext = OS.imContextLast(); } if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)) { setFontDescription(defaultFont().handle); } }

Target:
void createHandle (int index) { state |= HANDLE | MENU; fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_has_window (fixedHandle, true); long adjustment = OS.gtk_adjustment_new (0, 0, 100, 1, 10, 0); if (adjustment == 0) error (SWT.ERROR_NO_HANDLES); handle = OS.gtk_spin_button_new (adjustment, climbRate, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0); if (OS.GTK_VERSION <= OS.VERSION(3, 20, 0)) { OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); } OS.gtk_spin_button_set_wrap (handle, (style & SWT.WRAP) != 0); if (OS.GTK3) { imContext = OS.imContextLast(); } if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { setFontDescription(defaultFont().handle); } }
Source:
private static ActiveThreadsFilter getActiveThreadsFilter(ViewerFilter[] filters) { return (ActiveThreadsFilter) Arrays.stream(filters).filter(filter -> filter instanceof ActiveThreadsFilter).findFirst().orElse(null); }

Target:
private static ActiveThreadsFilter getActiveThreadsFilter(ViewerFilter[] filters) { return Arrays.stream(filters) .filter(filter -> filter instanceof ActiveThreadsFilter) .map(filter -> (ActiveThreadsFilter) filter) .findFirst().orElse(null); }
Source:
protected boolean activate(IVampirePlayer playerIn) { VampirePlayer player = VampirePlayer.get(playerIn.getRepresentingPlayer()); player.getSpecialAttributes().half_invulnerable = true; return true; }

Target:
protected boolean activate(IVampirePlayer playerIn) { ((VampirePlayer) playerIn).getSpecialAttributes().half_invulnerable = true; playerIn.getRepresentingPlayer().addPotionEffect( new PotionEffect(MobEffects.SLOWNESS, getDuration(playerIn.getLevel()) - 1, 1, false, false)); return true; }
Source:
public static String decryptPassword(String password) { String result = password; String keyFile = Config.<String> GetValue(ConfigValues.keystoreUrl, Config.DefaultConfigurationVersion); String passwd = Config.<String> GetValue(ConfigValues.keystorePass, Config.DefaultConfigurationVersion); String alias = Config.<String> GetValue(ConfigValues.CertAlias, Config.DefaultConfigurationVersion); try { result = EncryptionUtils.decrypt((String) result, keyFile, passwd, alias); } catch (Exception e) { result = password; } return result; }

Target:
public static String decryptPassword(String password) { String result = password; String keyFile = Config.<String> GetValue(ConfigValues.keystoreUrl, Config.DefaultConfigurationVersion); String passwd = Config.<String> GetValue(ConfigValues.keystorePass, Config.DefaultConfigurationVersion); String alias = Config.<String> GetValue(ConfigValues.CertAlias, Config.DefaultConfigurationVersion); try { result = EncryptionUtils.decrypt((String) result, keyFile, passwd, alias); } catch (Exception e) { log.debugFormat("Failed to decrypt password, error message: {0}", e.getMessage()); result = password; } return result; }
Source:
private boolean isAllowedInSessionLevelAnySection(String sessionName, String privilegeName) { for (String sectionName : this.sessionLevel.keySet()) { if (this.sessionLevel.get(sectionName).get(sessionName).containsKey(privilegeName) && this.sessionLevel.get(sectionName).get(sessionName).get(privilegeName).booleanValue()) { return true; } } for (String sectionName : this.sectionLevel.keySet()) { if (isAllowedInSectionLevel(sectionName, privilegeName)) { return true; } } return false; }

Target:
private boolean isAllowedInSessionLevelAnySection(String sessionName, String privilegeName) { HashSet<String> sections = new HashSet<String>(this.sessionLevel.keySet()); sections.addAll(this.sectionLevel.keySet()); for (String sectionName : sections) { if (isAllowedInSessionLevel(sectionName, sessionName, privilegeName)) { return true; } } return false; }
Source:
public void created(ClientCacheEntryCreatedEvent e) { for (CreatedListener listener : created) { try { listener.created(e.getKey(), e.getVersion()); } catch (Throwable t) { log.error("Listener " + listener + " has thrown an exception", t); } } }

Target:
public void created(ClientCacheEntryCreatedEvent e) { for (CreatedListener listener : created) { try { listener.created(e.getKey(), e.getVersion()); } catch (Exception ex) { log.error("Listener " + listener + " has thrown an exception", ex); } } }
Source:
protected Object getSessionUser(String sessionID) { return SessionDataContainer.getInstance().GetData(sessionID, USER_SESSION_KEY); }

Target:
protected Object getSessionUser(String sessionID) { return SessionDataContainer.getInstance().getUser(sessionID); }
Source:
public void validateFor(InvocationOnMock invocation) { Throwable throwable = this.throwable; if (throwable == null) { throw cannotStubWithNullThrowable(); } if (throwable instanceof RuntimeException || throwable instanceof Error) { return; } if (!new MethodInfo(invocation).isValidException(throwable)) { throw checkedExceptionInvalid(throwable); } }

Target:
public void validateFor(InvocationOnMock invocation) { if (throwable == null) { throw cannotStubWithNullThrowable(); } if (throwable instanceof RuntimeException || throwable instanceof Error) { return; } if (!new InvocationInfo(invocation).isValidException(throwable)) { throw checkedExceptionInvalid(throwable); } }
Source:
public static void skipContent(@Nonnull JayceInternalReaderImpl in) throws IOException { NodeLevel nodeLevel = in.getNodeLevel(); in.readInt(); in.readId(); if (nodeLevel != NodeLevel.TYPES) { in.skipId(); in.skipIds(); in.skipId(); in.skipId(); in.skipId(); in.skipIds(); in.readNodes(NField.class); in.readNodes(NMethod.class); in.skipNodes(NAnnotation.class); in.skipNodes(NMarker.class); } }

Target:
public static void skipContent(@Nonnull JayceInternalReaderImpl in) throws IOException { NodeLevel nodeLevel = in.getNodeLevel(); in.skipInt(); in.skipId(); if (nodeLevel != NodeLevel.TYPES) { in.skipId(); in.skipIds(); in.skipId(); in.skipId(); in.skipId(); in.skipIds(); in.skipNodes(NField.class); in.skipNodes(NMethod.class); in.skipNodes(NAnnotation.class); in.skipNodes(NMarker.class); } }
Source:
public boolean isItemValid(int slot, @Nonnull ItemStack stack) { if (checkSlot(slot)) { return compose.isItemValid(slot, stack); } return false; }

Target:
public boolean isItemValid(int slot, @Nonnull ItemStack stack) { if (checkSlot(slot)) { return compose.isItemValid(slot + minSlot, stack); } return false; }
Source:
public ImageLicense processPage(int pageId, PageTitle pageTitle, JSONObject result) { try { if (result.getJSONArray("imageinfo") != null) { JSONObject imageInfo = (JSONObject) result.getJSONArray("imageinfo").get(0); ImageLicense license = parseImageLicenseMetadata(imageInfo.getJSONObject("extmetadata")); return license; } return null; } catch (JSONException e) { Log.w(TAG, e); return null; } }

Target:
public ImageLicense processPage(int pageId, PageTitle pageTitle, JSONObject result) { ImageLicense license = new ImageLicense("", "", ""); try { JSONObject imageInfo = (JSONObject) result.getJSONArray("imageinfo").get(0); parseImageLicenseMetadata(license, imageInfo.getJSONObject("extmetadata")); } catch (JSONException e) { Log.w(TAG, e); } return license; }
Source:
private static TmfTimeRange getTimeRangeForX(int x, SWTBotTimeGraphEntry entry){ Long low = entry.getTimeForPoint(x); assertNotNull(low); Long high = entry.getTimeForPoint(x + 1); assertNotNull(high); return new TmfTimeRange(TmfTimestamp.fromNanos(low), TmfTimestamp.fromNanos(high)); }

Target:
private static long getTimeRangeForX(int x, SWTBotTimeGraphEntry entry){ Long timeForPoint = entry.getTimeForPoint(x); assertNotNull(timeForPoint); return timeForPoint; }
Source:
private void addExecutionPermissionToScripts() throws IOException { String schedulerHome = ClasspathUtils.findSchedulerHome(); if (!StandardSystemProperty.OS_NAME.value().toLowerCase().contains("windows")) { File scriptsDirectory = new File(schedulerHome, "dist/scripts/processbuilder/linux"); if (scriptsDirectory != null) { for (File script : scriptsDirectory.listFiles()) { script.setExecutable(true, false); } } else { throw new IOException("The directory that contains scripts required for the runAsMe mode does not exist"); } } }

Target:
private void addExecutionPermissionToScripts() throws IOException { if (!StandardSystemProperty.OS_NAME.value().toLowerCase().contains("windows")) { String schedulerHome = ClasspathUtils.findSchedulerHome(); File scriptsDirectory = new File(schedulerHome, "dist/scripts/processbuilder/linux"); if (scriptsDirectory != null) { for (File script : scriptsDirectory.listFiles()) { script.setExecutable(true, false); } } else { throw new IOException("The directory that contains scripts required for the runAsMe mode does not exist"); } } }
Source:
public void stop() throws InterruptedException { if (supervisorTaskChecker != null) { supervisorTaskChecker.shutdownNow(); supervisorTaskChecker.awaitTermination(10, TimeUnit.SECONDS); supervisorTaskChecker = null; } supervisorTaskCheckTimes.clear(); }

Target:
public void stop() throws InterruptedException { if (supervisorTaskChecker != null) { supervisorTaskChecker.shutdownNow(); supervisorTaskChecker.awaitTermination(10, TimeUnit.SECONDS); } supervisorTaskCheckTimes.clear(); }
Source:
public void tick(WorkloadExecutionStatus status, WorkloadAdjuster adjuster) { log.debug("Going to perform tick with status {}", status); if (isPeriodic()) { long currentTime = System.currentTimeMillis(); if (startTime == 0) { startTime = currentTime - period; } long difference = currentTime - startTime; if(difference >= period) { startTime = startTime + period; sendSamples(samplesCount, status, adjuster); } } else { int samplesLeft = samplesCount - samplesSubmitted; sendSamples(samplesLeft, status, adjuster); } }

Target:
public void tick(WorkloadExecutionStatus status, WorkloadAdjuster adjuster) { log.debug("Going to perform tick with status {}", status); if (isPeriodic()) { long currentTime = System.currentTimeMillis(); if (startTime == 0) { startTime = currentTime - period; } long difference = currentTime - startTime; if(difference >= period) { if (status.getTotalSamples() < samplesSubmitted) { log.warn("Can not create such load with invocations with ms period", samplesCount, period); } startTime = startTime + period; sendSamples(samplesCount, status, adjuster); } } else { int samplesLeft = samplesCount - samplesSubmitted; sendSamples(samplesLeft, status, adjuster); } }
Source:
private DB selectDatabase(Mongo mongo) { DB db = mongo.getDB(dbName); db.setWriteConcern(WriteConcern.JOURNALED); if (username != null) { if(authDbName != null) { DB authDb = mongo.getDB(authDbName) authDb.authenticate(username, password.toCharArray()); } else { db.authenticate(username, password.toCharArray()); } } return db; }

Target:
private DB selectDatabase(Mongo mongo) { DB db = mongo.getDB(dbName); db.setWriteConcern(WriteConcern.JOURNALED); if (username != null) { if(authDbName != null) { DB authDb = mongo.getDB(authDbName); authDb.authenticate(username, password.toCharArray()); } else { db.authenticate(username, password.toCharArray()); } } return db; }
Source:
private List<DispoItem> massDisposition(BranchId branch, String setId, List<String> itemIds, String resolutionType, String resolution) { List<DispoItem> toEdit = new ArrayList<>(); List<DispoItem> allItemsInSet = getDispoItems(branch, setId); for (DispoItem item : allItemsInSet) { if (itemIds.contains(item.getGuid())) { DispoItemData newItem = new DispoItemData(); newItem.setGuid(item.getGuid()); newItem.setName(item.getName()); List<DispoAnnotationData> newAnnotations = new ArrayList<>(); newAnnotations = item.getAnnotationsList(); for (DispoAnnotationData annotation : item.getAnnotationsList()) { if (annotation.getResolution().equals("")) { annotation.setResolutionType(resolutionType); annotation.setResolution(resolution); annotation.setLastResolution(resolution); annotation.setIsResolutionValid(true); annotation.setIsConnected(true); annotation.setIsDefault(false); dispoConnector.connectAnnotation(annotation, item.getDiscrepanciesList()); newAnnotations.set(annotation.getIndex(), annotation); } } newItem.setAnnotationsList(newAnnotations); newItem.setDiscrepanciesList(item.getDiscrepanciesList()); newItem.setStatus(dispoConnector.getItemStatus(newItem)); toEdit.add(newItem); } } return toEdit; }

Target:
private List<DispoItem> massDisposition(BranchId branch, String setId, List<String> itemIds, String resolutionType, String resolution) { List<DispoItem> toEdit = new ArrayList<>(); List<DispoItem> allItemsInSet = getDispoItems(branch, setId); for (DispoItem item : allItemsInSet) { if (itemIds.contains(item.getGuid())) { DispoItemData newItem = new DispoItemData(); newItem.setGuid(item.getGuid()); newItem.setName(item.getName()); List<DispoAnnotationData> newAnnotations = new ArrayList<>(); newAnnotations = item.getAnnotationsList(); for (DispoAnnotationData annotation : item.getAnnotationsList()) { if (annotation.getResolution().equals("")) { annotation.setResolutionType(resolutionType); annotation.setResolution(resolution); annotation.setLastResolution("N/A"); annotation.setIsResolutionValid(true); annotation.setIsConnected(true); annotation.setIsDefault(false); dispoConnector.connectAnnotation(annotation, item.getDiscrepanciesList()); newAnnotations.set(annotation.getIndex(), annotation); } } newItem.setAnnotationsList(newAnnotations); newItem.setDiscrepanciesList(item.getDiscrepanciesList()); newItem.setStatus(dispoConnector.getItemStatus(newItem)); toEdit.add(newItem); } } return toEdit; }
Source:
public void updateModel(final @Nullable ISegmentStore<ISegment> dataInput) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!getTableViewer().getTable().isDisposed()) { ISegmentStore<ISegment> data = dataInput; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace == null) { fAnalysisModule = null; } else { fAnalysisModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, LatencyAnalysis.class, LatencyAnalysis.ID); } if (data == null){ setInput(null); getTableViewer().setItemCount(0); return; } setInput(data); getTableViewer().setItemCount((int) data.getNbElements()); } } }); }

Target:
public void updateModel(final @Nullable ISegmentStore<ISegment> dataInput) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!getTableViewer().getTable().isDisposed()) { ISegmentStore<ISegment> data = dataInput; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace == null) { fAnalysisModule = null; } else { fAnalysisModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, LatencyAnalysis.class, LatencyAnalysis.ID); } if (data == null){ setInput(null); getTableViewer().setItemCount(0); return; } setInput(data); if (data.getNbElements() <= Integer.MAX_VALUE) { getTableViewer().setItemCount((int) data.getNbElements()); } else { getTableViewer().setItemCount(Integer.MAX_VALUE); } } } }); }
Source:
public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { Objects.requireNonNull(receivedMessage, "'receivedMessage' cannot be null."); this.amqpAnnotatedMessage = new AmqpAnnotatedMessage(receivedMessage.getAmqpAnnotatedMessage()); this.context = Context.NONE; final AmqpDataBody amqpDataBody = ((AmqpDataBody) receivedMessage.getAmqpAnnotatedMessage().getBody()); final List<BinaryData> binaryDataList = amqpDataBody.getData().stream().collect(Collectors.toList()); if (binaryDataList.size() > 0) { binaryData = binaryDataList.get(0).getData(); } else { binaryData = EMPTY_BYTE_ARRAY; } amqpAnnotatedMessage.getHeader().setDeliveryCount(null); removeValues(amqpAnnotatedMessage.getMessageAnnotations(), LOCKED_UNTIL_KEY_ANNOTATION_NAME, SEQUENCE_NUMBER_ANNOTATION_NAME, DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME, ENQUEUED_SEQUENCE_NUMBER_ANNOTATION_NAME, ENQUEUED_TIME_UTC_ANNOTATION_NAME); removeValues(amqpAnnotatedMessage.getApplicationProperties(), DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME, DEAD_LETTER_REASON_ANNOTATION_NAME); }

Target:
public ServiceBusMessage(ServiceBusReceivedMessage receivedMessage) { Objects.requireNonNull(receivedMessage, "'receivedMessage' cannot be null."); this.amqpAnnotatedMessage = new AmqpAnnotatedMessage(receivedMessage.getAmqpAnnotatedMessage()); this.context = Context.NONE; this.binaryData = receivedMessage.getBody(); amqpAnnotatedMessage.getHeader().setDeliveryCount(null); removeValues(amqpAnnotatedMessage.getMessageAnnotations(), LOCKED_UNTIL_KEY_ANNOTATION_NAME, SEQUENCE_NUMBER_ANNOTATION_NAME, DEAD_LETTER_SOURCE_KEY_ANNOTATION_NAME, ENQUEUED_SEQUENCE_NUMBER_ANNOTATION_NAME, ENQUEUED_TIME_UTC_ANNOTATION_NAME); removeValues(amqpAnnotatedMessage.getApplicationProperties(), DEAD_LETTER_DESCRIPTION_ANNOTATION_NAME, DEAD_LETTER_REASON_ANNOTATION_NAME); }
Source:
public AsyncRequest(int method, String url, String entity) { super(method, url + "/@async", entity); }

Target:
public AsyncRequest(int method, String url, String entity) { super(method, url + ASYNC_ADAPTER, entity); }
Source:
public void loadPlugins(Class source) { URL[] urls; if (checkFileExists() == false) { log.info("No plugin configuration file found, skipping loading plugins"); return; } try (InputStream inputStream = openFromFile()) { PluginProperties props = parsePluginConfigs(inputStream); List<PluginProperties.PluginConfiguration> pluginConfigurations = getEnabledJars(props); logPlugins(pluginConfigurations); urls = getJarPathsFromPluginConfigurations(pluginConfigurations); } catch (IOException e) { throw new MissingPluginConfigurationException( "Unable to load plugin config file: " + this.filename, e); } addJarsToClassPath(source, urls); }

Target:
public void loadPlugins(Class source) { URL[] urls; if (checkFileExists() == false) { log.info("Not loading plugins: No plugin configuration file found: {}", this.filename); return; } try (InputStream inputStream = openFromFile()) { PluginProperties props = parsePluginConfigs(inputStream); List<PluginProperties.PluginConfiguration> pluginConfigurations = getEnabledJars(props); logPlugins(pluginConfigurations); urls = getJarPathsFromPluginConfigurations(pluginConfigurations); } catch (IOException e) { throw new MissingPluginConfigurationException( String.format( "Not loading plugins: No plugin configuration file found: %s", this.filename), e); } addJarsToClassPath(source, urls); }
Source:
public void createsMeasuredResponseWithCustomHeader() throws IOException { final String customHeader = "X-Custom-Takes-Millis"; MatcherAssert.assertThat( new RsPrint( new TkMeasured( new TkText("custom header response"), customHeader ).act() ).print(), Matchers.containsString(customHeader) ); }

Target:
public void createsMeasuredResponseWithCustomHeader() throws IOException { final String header = "X-Custom-Takes-Millis"; MatcherAssert.assertThat( new RsPrint( new TkMeasured( new TkText("custom header response"), header ).act() ).print(), Matchers.containsString(header) ); }
Source:
protected void updateDetailsAvailability() { super.updateDetailsAvailability(); NetworkView network = (NetworkView) getSelectedItem(); networkExternalSubnetListModel.setIsAvailable(network.isExternal()); }

Target:
protected void updateDetailsAvailability() { super.updateDetailsAvailability(); NetworkView network = (NetworkView) getSelectedItem(); networkExternalSubnetListModel.setIsAvailable(network != null && network.isExternal()); }
Source:
private Cluster findBestProbe(List<Cluster> clusters) { int highestProbeBitrateBps = 0; Cluster bestIt = new Cluster(); for (Cluster cluster : clusters) { if (cluster.sendMeanMs == 0 || cluster.recvMeanMs == 0) continue; if (cluster.numAboveMinDelta > cluster.count / 2 && (cluster.recvMeanMs - cluster.sendMeanMs <= 2.0f && cluster.sendMeanMs - cluster.recvMeanMs <= 5.0f)) { int probeBitrateBps = Math.min(cluster.getSendBitrateBps(), cluster .getRecvBitrateBps()); if (probeBitrateBps > highestProbeBitrateBps) { highestProbeBitrateBps = probeBitrateBps; bestIt = cluster; } } else { double sendBitrateBps = cluster.meanSize * 8 * 1000 / cluster.sendMeanMs; double recvBitrateBps = cluster.meanSize * 8 * 1000 / cluster.recvMeanMs; logger.warn("Probe failed, sent at " + sendBitrateBps + " bps, received at " + recvBitrateBps + " bps. Mean send delta: " + cluster.sendMeanMs + " ms, mean recv delta: " + cluster.recvMeanMs + " ms, num probes: " + cluster.count); break; } } return bestIt; }

Target:
private Cluster findBestProbe(List<Cluster> clusters) { int highestProbeBitrateBps = 0; Cluster bestIt = new Cluster(); for (Cluster cluster : clusters) { if (cluster.sendMeanMs == 0 || cluster.recvMeanMs == 0) continue; if (cluster.numAboveMinDelta > cluster.count / 2 && (-2.0f <= cluster.sendMeanMs - cluster.recvMeanMs && cluster.sendMeanMs - cluster.recvMeanMs <= 5.0f)) { int probeBitrateBps = Math.min(cluster.getSendBitrateBps(), cluster .getRecvBitrateBps()); if (probeBitrateBps > highestProbeBitrateBps) { highestProbeBitrateBps = probeBitrateBps; bestIt = cluster; } } else { double sendBitrateBps = cluster.meanSize * 8 * 1000 / cluster.sendMeanMs; double recvBitrateBps = cluster.meanSize * 8 * 1000 / cluster.recvMeanMs; logger.warn("Probe failed, sent at " + sendBitrateBps + " bps, received at " + recvBitrateBps + " bps. Mean send delta: " + cluster.sendMeanMs + " ms, mean recv delta: " + cluster.recvMeanMs + " ms, num probes: " + cluster.count); break; } } return bestIt; }
Source:
public double getPWMDutyCycle(IOLine ioLine) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); if (!ioLine.hasPWMCapability()) throw new IllegalArgumentException("Provided IO line does not have PWM capability."); String atCommand = ioLine.getPWMATCommand(); ATCommandResponse response = sendATCommand(new ATCommand(atCommand)); if (response == null || response.getResponseStatus() != ATCommandStatus.OK) throw new XBeeException(XBeeException.INVALID_OPERATION); int readValue = ByteUtils.byteArrayToInt(response.getResponse()); return readValue * 100.0/1023.0; }

Target:
public double getPWMDutyCycle(IOLine ioLine) throws InvalidOperatingModeException, XBeeException { if (!connectionInterface.isOpen()) throw new XBeeException(XBeeException.CONNECTION_NOT_OPEN); if (ioLine == null) throw new NullPointerException("IO line cannot be null."); if (!ioLine.hasPWMCapability()) throw new IllegalArgumentException("Provided IO line does not have PWM capability."); String atCommand = ioLine.getPWMDutyCycleATCommand(); ATCommandResponse response = sendATCommand(new ATCommand(atCommand)); if (response == null || response.getResponseStatus() != ATCommandStatus.OK || response == null || response.getResponse().length == 0) throw new XBeeException(XBeeException.INVALID_OPERATION); int readValue = ByteUtils.byteArrayToInt(response.getResponse()); return Math.round((readValue * 100.0/1023.0) * 100.0) / 100.0; }
Source:
public void test() throws Exception { for (Entry<String, SignatureAlgorithmIdentifier> entry : SignatureAlgorithmIdentifier.getAllSignatureAlgorithmIdentifiers().entrySet()) { SignatureAlgorithmIdentifier signatureAlgorithmIdentifier = entry.getValue(); assertEquals(signatureAlgorithmIdentifier.getName(), entry.getKey()); AlgorithmIdentifier algorithmIdentifier; try { algorithmIdentifier = new DefaultSignatureAlgorithmIdentifierFinder().find(entry.getKey()); } catch (IllegalArgumentException e) { continue; } assertEquals( signatureAlgorithmIdentifier.getOid(), algorithmIdentifier.getAlgorithm().getId()); assertEquals( base16().encode(signatureAlgorithmIdentifier.getEncoded()), base16().encode(algorithmIdentifier.getAlgorithm().getEncoded("DER"))); assertEquals(algorithmIdentifier, algorithmIdentifier); assertEquals(algorithmIdentifier.hashCode(), algorithmIdentifier.hashCode()); } }

Target:
public void test() throws Exception { int verifiedCount = 0; for (Entry<String, SignatureAlgorithmIdentifier> entry : SignatureAlgorithmIdentifier.getAllSignatureAlgorithmIdentifiers().entrySet()) { SignatureAlgorithmIdentifier signatureAlgorithmIdentifier = entry.getValue(); assertEquals(signatureAlgorithmIdentifier.getName(), entry.getKey()); AlgorithmIdentifier algorithmIdentifier; try { algorithmIdentifier = new DefaultSignatureAlgorithmIdentifierFinder().find(entry.getKey()); } catch (IllegalArgumentException e) { continue; } assertEquals( signatureAlgorithmIdentifier.getOid(), algorithmIdentifier.getAlgorithm().getId()); assertEquals( base16().encode(signatureAlgorithmIdentifier.getEncoded()), base16().encode(algorithmIdentifier.getAlgorithm().getEncoded("DER"))); assertEquals(algorithmIdentifier, algorithmIdentifier); assertEquals(algorithmIdentifier.hashCode(), algorithmIdentifier.hashCode()); verifiedCount++; } assertThat(verifiedCount).as("Algorithm identifiers verified").isGreaterThanOrEqualTo(10); }
Source:
public Query setIsolationLevel(IsolationLevel level) { if (this instanceof ImmutableScan) { super.setAttribute(ISOLATION_LEVEL, level.toBytes()); } else { setAttribute(ISOLATION_LEVEL, level.toBytes()); } return this; }

Target:
public Query setIsolationLevel(IsolationLevel level) { setAttribute(ISOLATION_LEVEL, level.toBytes()); return this; }
Source:
public void fileModeTestFileWithMissingInWorkingTree() throws Exception { Git git = new Git(db); writeTrashFile("a", "Hello world a"); writeTrashFile("b", "Hello world b"); git.add().addFilepattern(".").call(); git.commit().setMessage("add files a & b").call(); Ref branch_1 = git.branchCreate().setName("branch_1").call(); git.rm().addFilepattern("a").call(); File symlinkA = new File(db.getWorkTree(), "a"); writeTrashFile("a", "b"); git.add().addFilepattern("a").call(); git.commit().setMessage("add file a").call(); FileEntry entry = new FileTreeIterator.FileEntry(new File( db.getWorkTree(), "a"), db.getFS()); assertEquals(FileMode.REGULAR_FILE, entry.getMode()); FileUtils.delete(symlinkA); git.checkout().setName(branch_1.getName()).call(); entry = new FileTreeIterator.FileEntry(new File(db.getWorkTree(), "a"), db.getFS()); assertEquals(FileMode.REGULAR_FILE, entry.getMode()); }

Target:
public void fileModeTestFileWithMissingInWorkingTree() throws Exception { Git git = new Git(db); File fileA = writeTrashFile("a", "Hello world a"); writeTrashFile("b", "Hello world b"); git.add().addFilepattern(".").call(); git.commit().setMessage("add files a & b").call(); Ref branch_1 = git.branchCreate().setName("branch_1").call(); git.rm().addFilepattern("a").call(); writeTrashFile("a", "b"); git.add().addFilepattern("a").call(); git.commit().setMessage("add file a").call(); FileEntry entry = new FileTreeIterator.FileEntry(new File( db.getWorkTree(), "a"), db.getFS()); assertEquals(FileMode.REGULAR_FILE, entry.getMode()); FileUtils.delete(fileA); git.checkout().setName(branch_1.getName()).call(); entry = new FileTreeIterator.FileEntry(new File(db.getWorkTree(), "a"), db.getFS()); assertEquals(FileMode.REGULAR_FILE, entry.getMode()); }
Source:
private void checkShutdown() { if (completedOrFailedEvalCount.incrementAndGet() == initWorkerCount + initServerCount && !serverContexts.isEmpty()) { for (final ActiveContext serverContext : serverContexts) { serverContext.close(); } serverContexts.clear(); } }

Target:
private void checkShutdown() { if (completedOrFailedEvalCount.incrementAndGet() == initWorkerCount + initServerCount) { for (final ActiveContext serverContext : serverContexts) { serverContext.close(); } for (final ActiveContext workerContext : workerContextsToClose) { workerContext.close(); } } }
Source:
public <T> T find(Class<T> serviceClass) { final String[] eligibleLocalServices = applicationContext.getBeanNamesForAnnotation(Service.class); List<T> localServiceInstances = new LinkedList<>(); for (String eligibleService : eligibleLocalServices) { final Object bean = applicationContext.getBean(eligibleService); if (serviceClass.isInstance(bean) && !Proxy.isProxyClass(bean.getClass())) { localServiceInstances.add((T) bean); } } if (localServiceInstances.isEmpty()) { LOGGER.info("No local service found for {}", serviceClass); return null; } else if (localServiceInstances.size() == 1) { LOGGER.info("One local service found for {}", serviceClass); return localServiceInstances.get(0); } else { LOGGER.warn("{} local services found for {}", localServiceInstances.size(), serviceClass); return localServiceInstances.get(0); } }

Target:
public <T> T find(Class<T> serviceClass) { final String[] eligibleLocalServices = applicationContext.getBeanNamesForAnnotation(Service.class); List<T> localServiceInstances = new LinkedList<>(); for (String eligibleService : eligibleLocalServices) { final Object bean = applicationContext.getBean(eligibleService); if (serviceClass.isInstance(bean) && !Proxy.isProxyClass(bean.getClass())) { localServiceInstances.add((T) bean); } } if (localServiceInstances.isEmpty()) { LOGGER.info("No local service found for {}", serviceClass); return null; } else if (localServiceInstances.size() == 1) { LOGGER.info("One local service found for {}", serviceClass); return localServiceInstances.get(0); } else { LOGGER.warn("{} local services found for {}", localServiceInstances.size(), serviceClass); return null; } }
Source:
public StandardJoinFilterFunction(InternalJoinFilterFunction filterFunction, LongArrayList addresses, List<Page> pages) { this.filterFunction = requireNonNull(filterFunction, "filterFunction can not be null"); this.addresses = requireNonNull(addresses, "addresses is null"); this.pages = requireNonNull(pages, "pages is null"); }

Target:
public StandardJoinFilterFunction(InternalJoinFilterFunction filterFunction, LongArrayList addresses, List<Page> pages) { this.filterFunction = requireNonNull(filterFunction, "filterFunction can not be null"); this.addresses = requireNonNull(addresses, "addresses is null"); this.pages = ImmutableList.copyOf(requireNonNull(pages, "pages is null")); }
Source:
public ValueMatcher makeValueMatcher(String dimension, final Predicate predicate) { final DimensionSelector selector = cursor.makeDimensionSelector( new DefaultDimensionSpec(dimension, dimension) ); return new ValueMatcher() { final boolean matchNull = predicate.apply(null); @Override public boolean matches() { IndexedInts row = selector.getRow(); if (row.size() == 0) { return matchNull; } for (int rowVal : row) { if (predicate.apply(selector.lookupName(rowVal))) { return true; } } return false; } }; }

Target:
public ValueMatcher makeValueMatcher(String dimension, final Predicate predicate) { final DimensionSelector selector = cursor.makeDimensionSelector( new DefaultDimensionSpec(dimension, dimension) ); return new ValueMatcher() { final boolean matchNull = predicate.apply(null); @Override public boolean matches() { IndexedInts row = selector.getRow(); if (row.size() == 0) { return matchNull; } for (int i = 0; i < row.size(); i++) { if (predicate.apply(selector.lookupName(row.get(i)))) { return true; } } return false; } }; }
Source:
public boolean addNode(PlatformServer sender, String[] parents, String name, Serializable value) { if ("management".equals(name) && value instanceof ManagementMessage) { fire((ManagementMessage) value); } return false; }

Target:
public boolean addNode(PlatformServer sender, String[] parents, String name, Serializable value) { LOGGER.trace("[{}] addNode({}, {})", consumerId, name, String.valueOf(value)); if (RELIABLE_CHANNEL_KEY.equals(name)) { if (value instanceof ManagementMessage) { fire((ManagementMessage) value); } else if (value != null) { Utils.warnOrAssert(LOGGER, "[0] addNode(from={}) IGNORED: wrong value type: {}", value.getClass().getSimpleName()); } } return false; }
Source:
public ReferencedEnvelope getBounds() throws IOException { return this.getFeatures().getBounds(); }

Target:
public ReferencedEnvelope getBounds() throws IOException { ReferencedEnvelope orignalBounds = super.getBounds(); return JTS.toEnvelope(clip.intersection(JTS.toGeometry(orignalBounds))); }
Source:
private MapperWrapper chainMapperWrappers(List<XStreamMarshallerExtension> extensions, MapperWrapper last) { if (extensions.isEmpty()) { return last; } else { XStreamMarshallerExtension head = extensions.get(0); List<XStreamMarshallerExtension> tail = extensions.subList(1, extensions.size()); return head.chainMapperWrapper(chainMapperWrappers(tail, last)); } }

Target:
private MapperWrapper chainMapperWrappers(List<XStreamMarshallerExtension> extensions, MapperWrapper last) { if (extensions.isEmpty()) { return last; } else { XStreamMarshallerExtension head = extensions.remove(0); return head.chainMapperWrapper(chainMapperWrappers(extensions, last)); } }