auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Set<Object> merge(Set<?>... items) { if (ArrayUtils.isEmpty(items)) { return new HashSet<Object>(); } Set<Object> result = new HashSet<Object>(); for (Set<?> item : items) { if (item != null) { result.addAll(item); } } return result; }

Target:
public Set<Object> merge(Set<?>... items) { if (ArrayUtils.isEmpty(items)) { return Collections.emptySet(); } Set<Object> result = new HashSet<Object>(); for (Set<?> item : items) { if (item != null) { result.addAll(item); } } return result; }
Source:
protected void assignResourceRequests() { while (hasReadyPendingRequest()) { SamzaResourceRequest request = peekReadyPendingRequest().get(); String processorId = request.getProcessorId(); String preferredHost = hostAffinityEnabled ? request.getPreferredHost() : ResourceRequestState.ANY_HOST; Instant requestCreationTime = request.getRequestTimestamp(); LOG.info("Handling assignment request for Processor ID: on host: {}.", processorId, preferredHost); if (hasAllocatedResource(preferredHost)) { LOG.info("Found an available container for Processor ID: on the host: {}", processorId, preferredHost); if (hostAffinityEnabled) { state.matchedResourceRequests.incrementAndGet(); } if (this.standbyContainerManager.isPresent()) { standbyContainerManager.get().checkStandbyConstraintsAndRunStreamProcessor(request, preferredHost, peekAllocatedResource(preferredHost), this, resourceRequestState); } else { runStreamProcessor(request, preferredHost); } } else { LOG.info("Did not find any allocated containers for running Processor ID: on the host: {}.", processorId, preferredHost); boolean expired = isRequestExpired(request); if (expired) { updateExpiryMetrics(request); if (hostAffinityEnabled) { handleExpiredRequestWithHostAffinityEnabled(processorId, preferredHost, request); } } else { LOG.info("Request for Processor ID: on preferred host has not expired yet." + "Request creation time: {}. Current Time: {}. Request timeout: ms", processorId, preferredHost, requestCreationTime, System.currentTimeMillis(), requestTimeout); break; } } } }

Target:
void assignResourceRequests() { while (hasReadyPendingRequest()) { SamzaResourceRequest request = peekReadyPendingRequest().get(); String processorId = request.getProcessorId(); String preferredHost = hostAffinityEnabled ? request.getPreferredHost() : ResourceRequestState.ANY_HOST; Instant requestCreationTime = request.getRequestTimestamp(); LOG.info("Handling assignment request for Processor ID: on host: {}.", processorId, preferredHost); if (hasAllocatedResource(preferredHost)) { LOG.info("Found an available container for Processor ID: on the host: {}", processorId, preferredHost); if (hostAffinityEnabled) { state.matchedResourceRequests.incrementAndGet(); } if (this.standbyContainerManager.isPresent()) { checkStandByContrainsAndRunStreamProcessor(request, preferredHost); } else { runStreamProcessor(request, preferredHost); } } else { LOG.info("Did not find any allocated containers for running Processor ID: on the host: {}.", processorId, preferredHost); boolean expired = isRequestExpired(request); if (expired) { updateExpiryMetrics(request); if (hostAffinityEnabled) { handleExpiredRequestWithHostAffinityEnabled(processorId, preferredHost, request); } } else { LOG.info("Request for Processor ID: on preferred host has not expired yet." + "Request creation time: {}. Current Time: {}. Request timeout: ms", processorId, preferredHost, requestCreationTime, System.currentTimeMillis(), requestExpiryTimeout); break; } } } }
Source:
public void before() { Locale.setDefault(ENGLISH); if (System.getProperty("java.specification.version").equals("9")) { expected_formatted_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss version=\"2.0\">\n <channel>\n" + " <title>Java Tutorials and Examples 1</title>\n" + " <language>en-us</language>\n" + " </channel>\n</rss>\n"; } else { expected_formatted_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\">\n <channel>\n" + " <title>Java Tutorials and Examples 1</title>\n" + " <language>en-us</language>\n" + " </channel>\n</rss>\n"; } }

Target:
public void before() { Locale.setDefault(ENGLISH); if (System.getProperty("java.specification.version").equals("9")) { expected_formatted_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss version=\"2.0\">\n" + " <channel>\n" + " <title>Java Tutorials and Examples 1</title>\n" + " <language>en-us</language>\n" + " </channel>\n" + "</rss>\n"; } else { expected_formatted_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<rss version=\"2.0\">\n" + " <channel>\n" + " <title>Java Tutorials and Examples 1</title>\n" + " <language>en-us</language>\n" + " </channel>\n" + "</rss>\n"; } }
Source:
public void setVisibility(Visibility visibility) { this.visibility = visibility; }

Target:
protected void setVisibility(Visibility visibility) { this.visibility = visibility; }
Source:
public SSymbol(final String value) { string = value; numberOfSignatureArguments = determineNumberOfSignatureArguments(); symbolId = (short) idGenerator.getAndIncrement(); if (VmSettings.ACTOR_TRACING) { ActorExecutionTrace.logSymbol(symbolId, string); } }

Target:
public SSymbol(final String value) { string = value; numberOfSignatureArguments = determineNumberOfSignatureArguments(); if (VmSettings.ACTOR_TRACING) { symbolId = (short) idGenerator.getAndIncrement(); ActorExecutionTrace.logSymbol(this); } else { symbolId = 0; } }
Source:
public void process() { if (RecordAndReplayUtils.getRecordAndReplayStatus() == RecordAndReplayStatus.REPLAYING && !this.loadedRecordedEvents) { fillRecordedEvents(); this.loadedRecordedEvents = true; logger.info("Loaded Recorded Events!"); startTime = System.currentTimeMillis(); } if (RecordAndReplayUtils.getRecordAndReplayStatus() == RecordAndReplayStatus.REPLAYING) { processRecordedEvents(10); if (this.recordedEvents.isEmpty()) { if (RecordAndReplayUtils.getFileCount() <= RecordAndReplayUtils.getFileAmount()) { String recordingPath = PathManager.getInstance().getRecordingPath(RecordAndReplayUtils.getGameTitle()).toString(); RecordAndReplaySerializer.deserializeRecordedEvents(recordingPath); fillRecordedEvents(); } else { RecordAndReplayUtils.reset(); RecordedEventStore.popEvents(); RecordAndReplayUtils.setRecordAndReplayStatus(RecordAndReplayStatus.REPLAY_FINISHED); } } } for (PendingEvent event = pendingEvents.poll(); event != null; event = pendingEvents.poll()) { if (event.getComponent() != null) { originalSend(event.getEntity(), event.getEvent(), event.getComponent()); } else { originalSend(event.getEntity(), event.getEvent()); } } }

Target:
public void process() { processRecordedEvents(); PendingEvent event = pendingEvents.poll(); while (event != null) { if (event.getComponent() != null) { originalSend(event.getEntity(), event.getEvent(), event.getComponent()); } else { originalSend(event.getEntity(), event.getEvent()); } event = pendingEvents.poll(); } }
Source:
public Text getService() { if (OM_SERVICE_ADD.get() == null) { OM_SERVICE_ADD.compareAndSet(null, SecurityUtil.buildTokenService(OmUtils.getOmAddressForClients(conf))); } return OM_SERVICE_ADD.get(); }

Target:
public Text getService() { return omServiceAdd; }
Source:
protected List<Context> getContexts() { Context ctx = getContext(); return ctx == null ? null : new ArrayList<Context>(Arrays.asList(ctx)); }

Target:
protected List<Context> getContexts() { Context ctx = getContext(); return ctx == null ? Collections.emptyList() : Arrays.asList(ctx); }
Source:
public void testAnalysisExecution() { assertNull(fModule.getStateSystem()); IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(NonNullUtils.checkNotNull(fTrace), TidAnalysisModule.class, TidAnalysisModule.ID); assertNotNull(module); module.schedule(); module.waitForCompletion(); assertTrue(TmfTestHelper.executeAnalysis(fModule)); assertNotNull(fModule.getStateSystem()); }

Target:
public void testAnalysisExecution() { assertNull(fModule.getStateSystem()); ITmfTrace trace = fTrace; assertNotNull(trace); IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, TidAnalysisModule.class, TidAnalysisModule.ID); assertNotNull(module); module.schedule(); module.waitForCompletion(); assertTrue(TmfTestHelper.executeAnalysis(fModule)); assertNotNull(fModule.getStateSystem()); }
Source:
private static void addBootOrder(VmDevice vmDevice, Map<String, Object> struct) { String s = Integer.valueOf(vmDevice.getBootOrder()).toString(); if (!org.apache.commons.lang.StringUtils.isEmpty(s) && !s.equals("0")) { struct.put(VdsProperties.BootOrder, s); } }

Target:
private static void addBootOrder(VmDevice vmDevice, Map<String, Object> struct) { String s = String.valueOf(vmDevice.getBootOrder()); if (!org.apache.commons.lang.StringUtils.isEmpty(s) && !s.equals("0")) { struct.put(VdsProperties.BootOrder, s); } }
Source:
protected IsWidget createIcon() { Span iconSpan = new Span(); iconSpan.addStyleName(Styles.FONT_AWESOME_BASE); if (SnapshotStatus.IN_PREVIEW.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.EYE.getCssName()); } else if (SnapshotStatus.LOCKED.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.LOCK.getCssName()); } else if (getEntity().containsMemory()) { Span holder = new Span(); holder.setStyleName(Styles.ICON_STACK); holder.getElement().getStyle().setLeft(-0.2, Style.Unit.EM); holder.getElement().getStyle().setTop(-0.2, Style.Unit.EM); Italic cameraItalic = new Italic(); cameraItalic.addStyleName(Styles.FONT_AWESOME_BASE); cameraItalic.addStyleName(IconType.CAMERA.getCssName()); cameraItalic.getElement().getStyle().setFontSize(1, Style.Unit.EM); Italic memoryItalic = new Italic(); memoryItalic.addStyleName(Styles.FONT_AWESOME_BASE); memoryItalic.addStyleName(Styles.ICON_STACK_TOP); memoryItalic.addStyleName(PatternflyConstants.PFICON_MEMORY); memoryItalic.getElement().getStyle().setTop(-4, Style.Unit.PX); memoryItalic.getElement().getStyle().setLeft(18, Style.Unit.PX); memoryItalic.getElement().getStyle().setColor("#0088ce"); memoryItalic.getElement().getStyle().setFontSize(11, Style.Unit.PX); memoryItalic.getElement().getStyle().setWhiteSpace(Style.WhiteSpace.NOWRAP); holder.add(cameraItalic); holder.add(memoryItalic); Tooltip memoryInfoToolTip = new Tooltip(memoryItalic); memoryInfoToolTip.setTitle(constants.thisSnapshotContainsMemory()); memoryInfoToolTip.setPlacement(Placement.RIGHT); holder.add(memoryInfoToolTip); iconSpan.add(holder); } else { iconSpan.addStyleName(IconType.CAMERA.getCssName()); } iconSpan.addStyleName(PatternflyConstants.PF_LIST_VIEW_ICON_SM); iconPanel.add(iconSpan); return iconPanel; }

Target:
protected IsWidget createIcon() { Span iconSpan = new Span(); iconSpan.addStyleName(Styles.FONT_AWESOME_BASE); if (SnapshotStatus.IN_PREVIEW.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.EYE.getCssName()); } else if (SnapshotStatus.LOCKED.equals(getEntity().getStatus())) { iconSpan.addStyleName(IconType.LOCK.getCssName()); } else if (getEntity().containsMemory()) { iconSpan.add(createSnapshotWithMemoryIcon()); } else { iconSpan.addStyleName(IconType.CAMERA.getCssName()); } iconSpan.addStyleName(PatternflyConstants.PF_LIST_VIEW_ICON_SM); iconPanel.add(iconSpan); return iconPanel; }
Source:
public void appendConstraints(AllocationAttempt attempt, AllocationLog log, List<Constraint> constraints) { Instance instance = attempt.getInstance(); if (instance == null) { return; } @SuppressWarnings("unchecked") Map<String, String> labels = DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_LABELS) .as(Map.class); if (labels == null) { return; } for (Map.Entry<String, String> labelEntry : labels.entrySet()) { String labelKey = labelEntry.getKey(); if (labelKey.startsWith("io.rancher.scheduler.disksize.")) { String labelValue = labelEntry.getValue(); String key = labelKey.substring("io.rancher.scheduler.disksize.".length()); constraints.add(new DiskSizeConstraint(key, labelValue, objectManager)); } } }

Target:
public void appendConstraints(AllocationAttempt attempt, AllocationLog log, List<Constraint> constraints) { Instance instance = attempt.getInstance(); if (instance == null) { return; } @SuppressWarnings("unchecked") Map<String, String> labels = DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_LABELS) .as(Map.class); if (labels == null) { return; } for (Map.Entry<String, String> labelEntry : labels.entrySet()) { String labelKey = labelEntry.getKey(); String labelPrefix = SystemLabels.LABEL_SCHEDULER_DISKSIZE_PREFIX; if (labelKey.startsWith(labelPrefix) && labelKey.length() > labelPrefix.length()) { String key = labelKey.substring(SystemLabels.LABEL_SCHEDULER_DISKSIZE_PREFIX.length()); String labelValue = labelEntry.getValue(); constraints.add(new DiskSizeConstraint(key, labelValue, objectManager)); } } }
Source:
public Image getImage(Object element) { if (element instanceof IReviewItem) { IReviewItem item = (IReviewItem) element; Image image = ReviewsUiPlugin.getDefault().getImageManager().getFileImage(item.getName()); if (element instanceof IFileItem) { ImageDescriptor baseImage = ImageDescriptor.createFromImage(image); IFileItem fItem = (IFileItem) element; if (fItem.getBase() != null && fItem.getTarget() != null) { IFileRevision base = fItem.getBase(); IFileRevision target = fItem.getTarget(); if (base.getPath() == null && target.getPath() != null) { ImageDescriptor overlay = ReviewsImages.OVERLAY_ADDED; Image icon = CommonImages.getImageWithOverlay(baseImage, overlay, true, true); return icon; } else if (base.getPath() != null && target.getPath() == null) { ImageDescriptor overlay = ReviewsImages.OVERLAY_REMOVED; Image icon = CommonImages.getImageWithOverlay(baseImage, overlay, true, true); return icon; } } } return image; } return null; }

Target:
public Image getImage(Object element) { if (element instanceof IReviewItem) { return super.getImage(element); } return null; }
Source:
protected void executeQueryCommand() { Provider<?> provider = getDbFacade().getProviderDao().get(getParameters().getId()); if (provider == null) { return; } NetworkProviderProxy client = getProviderProxyFactory().create(provider); List<Network> externalNetworks = client.getAll(); Map<Network, Set<Guid>> externalNetworkToDcId = new HashMap<Network, Set<Guid>>(); for (Network network : externalNetworks) { List<Guid> dcIds = getDbFacade().getStoragePoolDao().getDcIdByExternalNetworkId(network.getProvidedBy().getExternalId()); Set<Guid> dataCenterIds = new HashSet<Guid>(); for (Guid dcId : dcIds) { dataCenterIds.add(dcId); } externalNetworkToDcId.put(network, dataCenterIds); } getQueryReturnValue().setReturnValue(externalNetworkToDcId); }

Target:
protected void executeQueryCommand() { Provider<?> provider = getDbFacade().getProviderDao().get(getParameters().getId()); if (provider == null) { return; } NetworkProviderProxy client = getProviderProxyFactory().create(provider); List<Network> externalNetworks = client.getAll(); Map<Network, Set<Guid>> externalNetworkToDcId = new HashMap<Network, Set<Guid>>(); for (Network network : externalNetworks) { List<Guid> dcIds = getDbFacade().getNetworkDao().getDcIdByExternalNetworkId(network.getProvidedBy().getExternalId()); externalNetworkToDcId.put(network, new HashSet<Guid>(dcIds)); } getQueryReturnValue().setReturnValue(externalNetworkToDcId); }
Source:
private static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual, Deque<Integer> indexes, Object messageOrSupplier) { if (expected == actual) { return; } assertIterablesNotNull(expected, actual, indexes, messageOrSupplier); Iterator<?> expectedIterator = expected.iterator(); Iterator<?> actualIterator = actual.iterator(); int processed = 0; while (expectedIterator.hasNext() && actualIterator.hasNext()) { processed++; Object expectedElement = expectedIterator.next(); Object actualElement = actualIterator.next(); if (expectedElement == actualElement) { continue; } if (expectedElement != null && expectedElement.equals(actualElement)) { continue; } indexes.addLast(processed - 1); assertIterableElementsEqual(expectedElement, actualElement, indexes, messageOrSupplier); indexes.removeLast(); } assertIteratorsAreEmpty(expectedIterator, actualIterator, processed, indexes, messageOrSupplier); }

Target:
private static void assertIterableEquals(Iterable<?> expected, Iterable<?> actual, Deque<Integer> indexes, Object messageOrSupplier) { if (expected == actual) { return; } assertIterablesNotNull(expected, actual, indexes, messageOrSupplier); Iterator<?> expectedIterator = expected.iterator(); Iterator<?> actualIterator = actual.iterator(); int processed = 0; while (expectedIterator.hasNext() && actualIterator.hasNext()) { processed++; Object expectedElement = expectedIterator.next(); Object actualElement = actualIterator.next(); if (Objects.equals(expectedElement, actualElement)) { continue; } indexes.addLast(processed - 1); assertIterableElementsEqual(expectedElement, actualElement, indexes, messageOrSupplier); indexes.removeLast(); } assertIteratorsAreEmpty(expectedIterator, actualIterator, processed, indexes, messageOrSupplier); }
Source:
public WriteContext init(Configuration configuration) { this.configuration = configuration; if (this.protocolFactory == null) { try { this.protocolFactory = getTProtocolFactoryClass(configuration).newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } if (thriftClass != null) { TBaseWriteSupport.setThriftClass(configuration, thriftClass); } else { thriftClass = TBaseWriteSupport.getThriftClass(configuration); } ThriftSchemaConverter thriftSchemaConverter = new ThriftSchemaConverter(this.configuration); this.thriftStruct = thriftSchemaConverter.toStructType(thriftClass); this.schema = thriftSchemaConverter.convert(thriftStruct); if (buffered) { readToWrite = new BufferedProtocolReadToWrite(thriftStruct, errorHandler); } else { readToWrite = new ProtocolReadToWrite(); } return thriftWriteSupport.init(configuration); }

Target:
public WriteContext init(Configuration configuration) { this.configuration = configuration; if (this.protocolFactory == null) { try { this.protocolFactory = getTProtocolFactoryClass(configuration).newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException(e); } } if (thriftClass != null) { TBaseWriteSupport.setThriftClass(configuration, thriftClass); } else { thriftClass = TBaseWriteSupport.getThriftClass(configuration); } ThriftSchemaConverter thriftSchemaConverter = new ThriftSchemaConverter(this.configuration); thriftStruct = thriftSchemaConverter.toStructType(thriftClass); schema = thriftSchemaConverter.convert(thriftStruct); if (buffered) { readToWrite = new BufferedProtocolReadToWrite(thriftStruct, errorHandler); } else { readToWrite = new ProtocolReadToWrite(); } return thriftWriteSupport.init(configuration); }
Source:
protected static Serializable getDocumentPropertyValue(Object o) throws JSONException { if (o instanceof String) { Calendar calendar = null; try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZ"); Date date = df.parse((String) o); calendar = Calendar.getInstance(); calendar.setTime(date); } catch (ParseException e) { } if (calendar != null) { return calendar; } else { return (Serializable) o; } } else if (o instanceof JSONArray) { JSONArray jsonArray = (JSONArray) o; ArrayList<Serializable> list = new ArrayList<Serializable>(); for (Object aJsonArray : jsonArray) { Serializable pValue = getDocumentPropertyValue(aJsonArray); if (pValue != null && !(pValue instanceof JSONNull)) { list.add(pValue); } } return list; } else if (o instanceof JSONObject) { JSONObject jsonObject = (JSONObject) o; HashMap<String, Serializable> map = new HashMap<String, Serializable>(); Iterator<String> keys = jsonObject.keys(); while (keys.hasNext()) { String key = keys.next(); map.put(key, getDocumentPropertyValue(jsonObject.get(key))); } return map; } else { return (Serializable) o; } }

Target:
protected static Serializable getDocumentPropertyValue(Object o) throws JSONException { if (o == null || o instanceof JSONNull) { return null; } else if (o instanceof String) { Calendar calendar = null; try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZZ"); Date date = df.parse((String) o); calendar = Calendar.getInstance(); calendar.setTime(date); } catch (ParseException e) { } if (calendar != null) { return calendar; } else { return (Serializable) o; } } else if (o instanceof JSONArray) { JSONArray jsonArray = (JSONArray) o; ArrayList<Serializable> list = new ArrayList<Serializable>(); for (Object aJsonArray : jsonArray) { Serializable pValue = getDocumentPropertyValue(aJsonArray); if (pValue != null) { list.add(pValue); } } return list; } else if (o instanceof JSONObject) { JSONObject jsonObject = (JSONObject) o; HashMap<String, Serializable> map = new HashMap<String, Serializable>(); Iterator<String> keys = jsonObject.keys(); while (keys.hasNext()) { String key = keys.next(); map.put(key, getDocumentPropertyValue(jsonObject.get(key))); } return map; } else { return (Serializable) o; } }
Source:
public void load(String propertyFileLocation) throws IOException { ConnectionFactoryConfigurer.load(this, propertyFileLocation); }

Target:
public ConnectionFactory load(String propertyFileLocation) throws IOException { ConnectionFactoryConfigurator.load(this, propertyFileLocation); return this; }
Source:
public void createWithoutOverwrite() throws Exception { Path path = new Path("/file"); alluxio.client.file.FileSystem alluxioFs = mock(alluxio.client.file.FileSystem.class); when(alluxioFs.exists(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)))) .thenReturn(true); when(alluxioFs.createFile(eq(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path))), any())) .thenThrow(new FileAlreadyExistsException(path.toString())); FileSystem alluxioHadoopFs = new FileSystem(alluxioFs); try { alluxioHadoopFs.create(path, false, 100, (short) 1, 1000); fail("create() of existing file is expected to fail"); } catch (IOException e) { assertEquals("Not allowed to create() (overwrite=false) for existing Alluxio path: " + path, e.getMessage()); } alluxioHadoopFs.close(); }

Target:
public void createWithoutOverwrite() throws Exception { Path path = new Path("/file"); alluxio.client.file.FileSystem alluxioFs = mock(alluxio.client.file.FileSystem.class); when(alluxioFs.exists(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path)))) .thenReturn(true); when(alluxioFs.createFile(eq(new AlluxioURI(HadoopUtils.getPathWithoutScheme(path))), any())) .thenThrow(new FileAlreadyExistsException(path.toString())); try (FileSystem alluxioHadoopFs = new FileSystem(alluxioFs)) { alluxioHadoopFs.create(path, false, 100, (short) 1, 1000); fail("create() of existing file is expected to fail"); } catch (IOException e) { assertEquals("Not allowed to create() (overwrite=false) for existing Alluxio path: " + path, e.getMessage()); } }
Source:
public void onSubscribe(Subscription s) { env.debug(String.format("%s::onSubscribe(%s)", this, s)); if (!subscription.isCompleted()) { subscription.complete(s); onSubscribeCalled.set(true); } else { env.flop("Subscriber::onSubscribe called on an already-subscribed Subscriber"); } }

Target:
public void onSubscribe(Subscription s) { env.debug(String.format("%s::onSubscribe(%s)", this, s)); if (!subscription.isCompleted()) { subscription.complete(s); } else { env.flop("Subscriber::onSubscribe called on an already-subscribed Subscriber"); } }
Source:
public Boolean deserializeZxidDigest(InputArchive ia) throws IOException { if (!DigestCalculator.digestEnabled()) { return false; } try { ZxidDigest zxidDigest = new ZxidDigest(); zxidDigest.deserialize(ia); if (zxidDigest.zxid > 0) { digestFromLoadedSnapshot = zxidDigest; } return true; } catch (EOFException e) { LOG.warn("Got EOF exception while reading the digest, " + "likely due to the reading an older snapshot."); return false; } }

Target:
public boolean deserializeZxidDigest(InputArchive ia) throws IOException { if (!DigestCalculator.digestEnabled()) { return false; } try { ZxidDigest zxidDigest = new ZxidDigest(); zxidDigest.deserialize(ia); if (zxidDigest.zxid > 0) { digestFromLoadedSnapshot = zxidDigest; } return true; } catch (EOFException e) { LOG.warn("Got EOF exception while reading the digest, " + "likely due to the reading an older snapshot."); return false; } }
Source:
public void testOptionsFileExclude() throws Exception { final JavadocRunner javadocRunner = buildTestRunner(); final JavadocOptions options = new JavadocOptions(); final List<String> excludes = new LinkedList<String>(); excludes.add("*.internal"); excludes.add("*.internal.*"); excludes.add("*.xom"); options.setExcludes(excludes); javadocRunner.setOptions(options); final Set<File> manifests = new HashSet<File>(); File file = getTestBundleRoot(); Assert.assertNotNull(file); manifests.add(file); javadocRunner.setManifestFiles(manifests); String optionsFile = javadocRunner.createOptionsFileContent(); AssertOnBuffer aob = new AssertOnBuffer(optionsFile); aob.assertNextLine("com.example.bundle.core"); aob.assertNextLine("com.example.bundle.core.conf"); aob.assertNextLine("com.acme.other.core"); aob.assertNoMoreLines(); }

Target:
public void testOptionsFileExclude() throws Exception { final JavadocRunner javadocRunner = buildTestRunner(); final JavadocOptions options = new JavadocOptions(); final List<String> excludes = new LinkedList<String>(); excludes.add("*.internal"); excludes.add("*.internal.*"); excludes.add("*.xom"); options.setExcludes(excludes); javadocRunner.setOptions(options); final Set<File> manifests = new HashSet<File>(); File file = getTestBundleRoot(); manifests.add(file); javadocRunner.setManifestFiles(manifests); String optionsFile = javadocRunner.createOptionsFileContent(); AssertOnBuffer aob = new AssertOnBuffer(optionsFile); aob.assertNextLine("com.example.bundle.core"); aob.assertNextLine("com.example.bundle.core.conf"); aob.assertNextLine("com.acme.other.core"); aob.assertNoMoreLines(); }
Source:
public static List<Store> readStores() throws Exception { ClassPathResource resource = new ClassPathResource("starbucks.csv"); Scanner scanner = new Scanner(resource.getInputStream()); String line = scanner.nextLine(); scanner.close(); FlatFileItemReader<Store> itemReader = new FlatFileItemReader<Store>(); itemReader.setResource(resource); DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); tokenizer.setNames(line.split(",")); tokenizer.setStrict(false); DefaultLineMapper<Store> lineMapper = new DefaultLineMapper<Store>(); lineMapper.setLineTokenizer(tokenizer); lineMapper.setFieldSetMapper(StoreFieldSetMapper.INSTANCE); itemReader.setLineMapper(lineMapper); itemReader.setRecordSeparatorPolicy(new DefaultRecordSeparatorPolicy()); itemReader.setLinesToSkip(1); itemReader.open(new ExecutionContext()); List<Store> stores = new ArrayList<Store>(); Store store = null; do { store = itemReader.read(); if (store != null) { stores.add(store); } } while (store != null); return stores; }

Target:
public static List<Store> readStores() throws Exception { ClassPathResource resource = new ClassPathResource("starbucks.csv"); Scanner scanner = new Scanner(resource.getInputStream()); String line = scanner.nextLine(); scanner.close(); FlatFileItemReader<Store> itemReader = new FlatFileItemReader<Store>(); itemReader.setResource(resource); DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); tokenizer.setNames(line.split(",")); tokenizer.setStrict(false); DefaultLineMapper<Store> lineMapper = new DefaultLineMapper<Store>(); lineMapper.setLineTokenizer(tokenizer); lineMapper.setFieldSetMapper(StoreFieldSetMapper.INSTANCE); itemReader.setLineMapper(lineMapper); itemReader.setRecordSeparatorPolicy(new DefaultRecordSeparatorPolicy()); itemReader.setLinesToSkip(1); itemReader.open(new ExecutionContext()); List<Store> stores = new ArrayList<>(); Store store = null; do { store = itemReader.read(); if (store != null) { stores.add(store); } } while (store != null); return stores; }
Source:
public void testGcGraceSecondsUpgradeIsApplied() throws TException { CassandraKeyValueService kvs = createKvs(getConfigWithGcGraceSeconds(FOUR_DAYS_IN_SECONDS)); verify(logger, times(1)) .debug(startsWith("No tables are being upgraded on startup. No updated table-related settings found.")); kvs.createTable(testTable, AtlasDbConstants.GENERIC_TABLE_METADATA); assertThatGcGraceSecondsIs(kvs, FOUR_DAYS_IN_SECONDS); kvs.close(); CassandraKeyValueService kvs2 = createKvs(getConfigWithGcGraceSeconds(ONE_HOUR_IN_SECONDS)); assertThatGcGraceSecondsIs(kvs2, ONE_HOUR_IN_SECONDS); kvs.close(); verify(logger, times(1)) .debug(startsWith("New table-related settings were applied on startup!!")); CassandraKeyValueService kvs3 = createKvs(getConfigWithGcGraceSeconds(ONE_HOUR_IN_SECONDS)); assertThatGcGraceSecondsIs(kvs3, ONE_HOUR_IN_SECONDS); verify(logger, times(2)) .debug(startsWith("No tables are being upgraded on startup. No updated table-related settings found.")); kvs3.close(); }

Target:
public void testGcGraceSecondsUpgradeIsApplied() throws TException { Logger testLogger = mock(Logger.class); CassandraKeyValueService kvs = createKvs(getConfigWithGcGraceSeconds(FOUR_DAYS_IN_SECONDS), testLogger); verify(testLogger, times(1)) .info(startsWith("No tables are being upgraded on startup. No updated table-related settings found.")); kvs.createTable(testTable, AtlasDbConstants.GENERIC_TABLE_METADATA); assertThatGcGraceSecondsIs(kvs, FOUR_DAYS_IN_SECONDS); kvs.close(); CassandraKeyValueService kvs2 = createKvs(getConfigWithGcGraceSeconds(ONE_HOUR_IN_SECONDS), testLogger); assertThatGcGraceSecondsIs(kvs2, ONE_HOUR_IN_SECONDS); kvs2.close(); verify(testLogger, times(1)) .info(startsWith("New table-related settings were applied on startup!!")); CassandraKeyValueService kvs3 = createKvs(getConfigWithGcGraceSeconds(ONE_HOUR_IN_SECONDS), testLogger); assertThatGcGraceSecondsIs(kvs3, ONE_HOUR_IN_SECONDS); verify(testLogger, times(2)) .info(startsWith("No tables are being upgraded on startup. No updated table-related settings found.")); kvs3.close(); }
Source:
protected boolean canDoAction() { Disk disk = getDiskDao().get(getParameters().getImageGroupID()); DiskValidator diskValidator = new DiskValidator(disk); return validate(diskValidator.validateDiskIsNotLun()) && validate(diskValidator.validateDiskIsNotCinder()); }

Target:
protected boolean canDoAction() { Disk disk = getDiskDao().get(getParameters().getImageGroupID()); if (disk != null) { DiskValidator diskValidator = new DiskValidator(disk); return validate(diskValidator.validateUnsupportedDiskStorageType( DiskStorageType.LUN, DiskStorageType.CINDER)); } return false; }
Source:
private static BlockingQueue createTaskQueue( int queueSize ) { if ( queueSize == UNBOUNDED_QUEUE ) { return new LinkedBlockingQueue(); } else if ( queueSize == SYNCHRONOUS_QUEUE ) { return new SynchronousQueue(); } else if ( queueSize > 0 ) { return new ArrayBlockingQueue( queueSize ); } throw new IllegalArgumentException( String.format( "Unsupported queue size %d for thread pool creation.", queueSize ) ); }

Target:
private static BlockingQueue<Runnable> createTaskQueue( int queueSize ) { if ( queueSize == UNBOUNDED_QUEUE ) { return new LinkedBlockingQueue<>(); } else if ( queueSize == SYNCHRONOUS_QUEUE ) { return new SynchronousQueue<>(); } else if ( queueSize > 0 ) { return new ArrayBlockingQueue<>( queueSize ); } throw new IllegalArgumentException( String.format( "Unsupported queue size %d for thread pool creation.", queueSize ) ); }
Source:
private Map<TypeElement, ViewInjector> findAndParseTargets(RoundEnvironment env) { Map<TypeElement, ViewInjector> targetClassMap = new LinkedHashMap<TypeElement, ViewInjector>(); Set<String> erasedTargetNames = new HashSet<String>(); for (Element element : env.getElementsAnnotatedWith(InjectView.class)) { try { parseInjectView(element, targetClassMap, erasedTargetNames); } catch (Exception e) { StringWriter stackTrace = new StringWriter(); e.printStackTrace(new PrintWriter(stackTrace)); error(element, "Unable to generate view injector for @InjectView.\n\n%s", stackTrace.toString()); } } for (Class<? extends Annotation> listener : LISTENERS) { findAndParseListener(env, listener, targetClassMap, erasedTargetNames); } for (Map.Entry<TypeElement, ViewInjector> entry : targetClassMap.entrySet()) { String parentClassFqcn = findParentFqcn(entry.getKey(), erasedTargetNames); if (parentClassFqcn != null) { entry.getValue().setParentInjector(parentClassFqcn + SUFFIX); } } return targetClassMap; }

Target:
private Map<TypeElement, ViewInjector> findAndParseTargets(RoundEnvironment env) { Map<TypeElement, ViewInjector> targetClassMap = new LinkedHashMap<TypeElement, ViewInjector>(); Set<String> erasedTargetNames = new LinkedHashSet<String>(); for (Element element : env.getElementsAnnotatedWith(InjectView.class)) { try { parseInjectView(element, targetClassMap, erasedTargetNames); } catch (Exception e) { StringWriter stackTrace = new StringWriter(); e.printStackTrace(new PrintWriter(stackTrace)); error(element, "Unable to generate view injector for @InjectView.\n\n%s", stackTrace.toString()); } } for (Class<? extends Annotation> listener : LISTENERS) { findAndParseListener(env, listener, targetClassMap, erasedTargetNames); } for (Map.Entry<TypeElement, ViewInjector> entry : targetClassMap.entrySet()) { String parentClassFqcn = findParentFqcn(entry.getKey(), erasedTargetNames); if (parentClassFqcn != null) { entry.getValue().setParentInjector(parentClassFqcn + SUFFIX); } } return targetClassMap; }
Source:
private BundleHandoverResponse deployPatch(BundleHandoverRequest request) { File patchFile; try { patchFile = File.createTempFile("rhq-jboss-as-7-", ".patch"); } catch (IOException e) { return BundleHandoverResponse .failure(BundleHandoverResponse.FailureType.EXECUTION, "Failed to create a temp file to copy patch to."); } try { StreamUtil.copy(request.getContent(), new FileOutputStream(patchFile)); } catch (FileNotFoundException e) { return BundleHandoverResponse.failure(EXECUTION, "Failed to copy patch to local storage."); } Map<String, String> parameters = request.getParams(); if (parameters != null) { for (Map.Entry<String, String> e : parameters.entrySet()) { String name = e.getKey(); String value = e.getValue(); if (!("override".equals(name) || "override-all".equals(name) || "preserve".equals(name) || "override-modules".equals(name))) { return BundleHandoverResponse.failure(BundleHandoverResponse.FailureType.INVALID_PARAMETER, "'" + name + "' is not a supported parameter. Only 'override', 'override-all', 'preserve' and 'override-modules' are supported."); } } } String errorMessage = deployPatch(patchFile, parameters); return errorMessage == null ? BundleHandoverResponse.success() : BundleHandoverResponse.failure(EXECUTION, errorMessage); }

Target:
private BundleHandoverResponse deployPatch(BundleHandoverRequest request) { File patchFile = null; try { try { patchFile = File.createTempFile("rhq-jboss-as-7-", ".patch"); } catch (IOException e) { return BundleHandoverResponse .failure(BundleHandoverResponse.FailureType.EXECUTION, "Failed to create a temp file to copy patch to."); } try { StreamUtil.copy(request.getContent(), new FileOutputStream(patchFile)); } catch (FileNotFoundException e) { return BundleHandoverResponse.failure(EXECUTION, "Failed to copy patch to local storage."); } Map<String, String> parameters = request.getParams(); if (parameters != null) { for (Map.Entry<String, String> e : parameters.entrySet()) { String name = e.getKey(); String value = e.getValue(); if (!("override".equals(name) || "override-all".equals(name) || "preserve".equals(name) || "override-modules".equals(name))) { return BundleHandoverResponse.failure(BundleHandoverResponse.FailureType.INVALID_PARAMETER, "'" + name + "' is not a supported parameter. Only 'override', 'override-all', 'preserve' and 'override-modules' are supported."); } } } String errorMessage = deployPatch(patchFile, parameters); return errorMessage == null ? BundleHandoverResponse.success() : BundleHandoverResponse.failure(EXECUTION, errorMessage); } finally { if (patchFile != null) { patchFile.delete(); } } }
Source:
public NodeValue exec(List<NodeValue> args) { if ( args.isEmpty() ) throw new ExprBuildException("fn:apply: no function to call (minimum number of args is one)"); NodeValue functionId = args.get(0); List<NodeValue> argExprs = args.subList(1,args.size()) ; ExprList exprs = new ExprList(); argExprs.forEach((a)->exprs.add(a)); Node fnNode = functionId.asNode(); if ( fnNode.isBlank() ) throw new ExprBuildException("fn:apply: function id is a blank node (must be a URI)"); if ( fnNode.isLiteral() ) throw new ExprBuildException("fn:apply: function id is a literal (must be a URI)"); if ( fnNode.isVariable() ) throw new ExprBuildException("fn:apply: function id is an unbound variable (must be a URI)"); if ( fnNode.isURI() ) { String functionIRI = fnNode.getURI(); Function function = cache1.getOrFill(functionIRI, ()->buildFunction(functionIRI)); if ( function instanceof FunctionBase ) { return ((FunctionBase)function).exec(argExprs); } function.build(functionIRI, exprs); return function.exec(null, exprs, functionIRI, null); } throw new ExprEvalException("fn:apply: Weird function argument (arg 1): "+functionId); }

Target:
public NodeValue exec(List<NodeValue> args) { if ( args.isEmpty() ) throw new ExprException("fn:apply: no function to call (minimum number of args is one)"); NodeValue functionId = args.get(0); List<NodeValue> argExprs = args.subList(1,args.size()) ; ExprList exprs = new ExprList(); argExprs.forEach(exprs::add); Node fnNode = functionId.asNode(); if ( fnNode.isBlank() ) throw new ExprEvalException("fn:apply: function id is a blank node (must be a URI)"); if ( fnNode.isLiteral() ) throw new ExprEvalException("fn:apply: function id is a literal (must be a URI)"); if ( fnNode.isVariable() ) throw new ExprEvalException("fn:apply: function id is an unbound variable (must be a URI)"); if ( fnNode.isURI() ) { String functionIRI = fnNode.getURI(); Function function = cache1.getOrFill(functionIRI, ()->buildFunction(functionIRI)); if ( function == null ) throw new ExprEvalException("fn:apply: Unknown function: <"+functionId+">"); if ( function instanceof FunctionBase ) { return ((FunctionBase)function).exec(argExprs); } function.build(functionIRI, exprs); return function.exec(null, exprs, functionIRI, null); } throw new ExprEvalException("fn:apply: Weird function argument (arg 1): "+functionId); }
Source:
private void unsubscribe() { loginSubscriptions.unsubscribe(); loginSubscriptions = new CompositeSubscription(); Log.v(TAG, "Unsubscribed from login events."); }

Target:
private void unsubscribe() { loginSubscriptions.unsubscribe(); loginSubscriptions = new CompositeSubscription(); }
Source:
LedgerEntryRequest(List<BookieSocketAddress> ensemble, long lId, long eId) { this.entryImpl = LedgerEntryImpl.create(lId, eId); this.ensemble = ensemble; this.eId = eId; long entryIdToConsiderForWriteSet = eId; if (clientCtx.getConf().enableStickyReads && lh.getLedgerMetadata().getWriteQuorumSize() == lh.getLedgerMetadata().getEnsembleSize()) { entryIdToConsiderForWriteSet = 0; } if (clientCtx.getConf().enableReorderReadSequence) { writeSet = clientCtx.getPlacementPolicy() .reorderReadSequence( ensemble, lh.getBookiesHealthInfo(), lh.distributionSchedule.getWriteSet(entryIdToConsiderForWriteSet)); } else { writeSet = lh.distributionSchedule.getWriteSet(entryIdToConsiderForWriteSet); } }

Target:
LedgerEntryRequest(List<BookieSocketAddress> ensemble, long lId, long eId) { this.entryImpl = LedgerEntryImpl.create(lId, eId); this.ensemble = ensemble; this.eId = eId; if (clientCtx.getConf().enableReorderReadSequence) { writeSet = clientCtx.getPlacementPolicy() .reorderReadSequence( ensemble, lh.getBookiesHealthInfo(), lh.getWriteSetForReadOperation(eId)); } else { writeSet = lh.getWriteSetForReadOperation(eId); } }
Source:
public Collection<MgfMsSpectrum> execute() throws MSDKException { logger.info("Started MGF import from file", target); double mzValues[] = null; float intensityValues[] = null; int numOfDataPoints; try (final BufferedReader reader = new BufferedReader(new FileReader(target))) { String line; while ((line = reader.readLine()) != null) { switch (line) { case "BEGIN IONS": spectra.add(processSpectrum(reader)); processedSpectra++; break; } } reader.close(); } catch (IOException e) { System.out.println("Well"); } return spectra; }

Target:
public List<MgfMsSpectrum> execute() throws MSDKException { logger.info("Started MGF import from {}", target); spectra = new LinkedList<>(); String line; try (final BufferedReader reader = new BufferedReader(new FileReader(target))) { while (!cancelled) { line = reader.readLine(); if (line == null) break; switch (line) { case "BEGIN IONS": spectra.add(processSpectrum(reader)); break; } } reader.close(); } catch (IOException e) { throw new MSDKException(e); } logger.info("Finished MGF import from with spectrums", target, spectra.size()); return spectra; }
Source:
public void checkout() throws IOException { if (headCommitTree != null) preScanTwoTrees(headCommitTree.getTreeId(), dc, mergeCommitTree.getTreeId()); else prescanOneTree(dc, mergeCommitTree.getTreeId()); if (!conflicts.isEmpty()) { if (failOnConflict) { dc.unlock(); throw new IOException("dirty files exist; refusing to merge."); } else cleanUpConflicts(); } builder.finish(); File file; for (String p : updated.keySet()) { file = new File(repo.getWorkDir(), p); file.getParentFile().mkdirs(); file.createNewFile(); DirCacheEntry entry = dc.getEntry(p); entry.checkoutEntry(repo, file, config_filemode()); entry.setLastModified(file.lastModified()); entry.setLength((int) file.length()); } for (String r : removed) { file = new File(repo.getWorkDir(), r); file.delete(); removeEmptyParents(file); } if (!builder.commit()) { dc.unlock(); throw new IOException( "couldn't commit the index; refusing to merge"); } }

Target:
public void checkout() throws IOException { if (headCommitTree != null) preScanTwoTrees(); else prescanOneTree(); if (!conflicts.isEmpty()) { if (failOnConflict) { dc.unlock(); throw new IOException(JGitText.get().cannotDeleteFile); } else cleanUpConflicts(); } builder.finish(); File file; for (String path : updated.keySet()) { file = new File(repo.getWorkDir(), path); file.getParentFile().mkdirs(); file.createNewFile(); DirCacheEntry entry = dc.getEntry(path); checkoutEntry(file, entry, config_filemode()); entry.setLastModified(file.lastModified()); entry.setLength((int) file.length()); } for (String path : removed) { file = new File(repo.getWorkDir(), path); file.delete(); removeEmptyParents(file); } if (!builder.commit()) { dc.unlock(); throw new IOException(JGitText.get().cannotDeleteFile); } }
Source:
public void should_fail_if_files_are_not_binary_identical() throws IOException { Throwable throwable = catchThrowable(() -> unMockedFiles.assertSameContentAs(someInfo(), createFileWithNonUTF8Character(), expected)); assertThat(throwable).isInstanceOf(AssertionError.class) .hasMessageEndingWith("does not have expected binary content at offset <0>, expecting:\n" + " <\"EOF\">\n" + "but was:\n" + " <\"0x0\">"); }

Target:
public void should_fail_if_files_are_not_binary_identical() throws IOException { try { unMockedFiles.assertSameContentAs(someInfo(), createFileWithNonUTF8Character(), expected); failBecauseExpectedAssertionErrorWasNotThrown(); } catch (AssertionError e) { assertThat(e.getMessage()).endsWith("does not have expected binary content at offset <0>, expecting:\n" + " <\"EOF\">\n" + "but was:\n" + " <\"0x0\">"); } }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { InputStream in = null; String resourceLocation = getServletConfig().getInitParameter("resource-location"); String outputFormat = getServletConfig().getInitParameter("output-format"); try { in = new FileInputStream(resourceLocation); CertificateFactory cf = CertificateFactory.getInstance("X.509"); Certificate certificate = cf.generateCertificate(in); if (outputFormat.equals("X509-PEM")) { response.setContentType("application/x-x509-ca-cert"); response.getWriter().print( String.format( ( "-----BEGIN CERTIFICATE-----\n" + "%1$s" + "-----END CERTIFICATE-----\n" ), new Base64( 76, new byte[] { (byte)'\n' } ).encodeToString( certificate.getEncoded() ) ) ); } else if (outputFormat.equals("SSH")) { response.setContentType("text/plain"); response.getWriter().print( OpenSSHUtils.getKeyString( certificate.getPublicKey(), getServletConfig().getInitParameter("output-alias") ) ); } else { throw new IllegalArgumentException("Unsupported output format " + outputFormat); } } catch(Exception e) { log.error( String.format( "Cannot send public key resource '%1$s' format '%2$s'", resourceLocation, outputFormat ), e ); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { if (in != null) { in.close(); } } }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { InputStream in = null; String resourceLocation = getServletConfig().getInitParameter("resource-location"); String outputFormat = getServletConfig().getInitParameter("output-format"); try { in = new FileInputStream(resourceLocation); CertificateFactory cf = CertificateFactory.getInstance("X.509"); Certificate certificate = cf.generateCertificate(in); if (outputFormat.equals("X509-PEM")) { response.setContentType("application/x-x509-ca-cert"); response.getWriter().print( String.format( ( "-----BEGIN CERTIFICATE-----\n" + "%1$s" + "-----END CERTIFICATE-----\n" ), new Base64( 76, new byte[] { (byte)'\n' } ).encodeToString( certificate.getEncoded() ) ) ); } else if (outputFormat.equals("SSH")) { response.setContentType("text/plain"); response.getWriter().print( String.format( "%1$s\n", OpenSSHUtils.getKeyString( certificate.getPublicKey(), getServletConfig().getInitParameter("output-alias") ) ) ); } else { throw new IllegalArgumentException("Unsupported output format " + outputFormat); } } catch(Exception e) { log.error( String.format( "Cannot send public key resource '%1$s' format '%2$s'", resourceLocation, outputFormat ), e ); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { if (in != null) { in.close(); } } }
Source:
public double getZoomCenter() { return zoomCenter; }

Target:
public float getZoomCenter() { return zoomCenter; }
Source:
protected static String generateMeta(ImportedPatent patent) { if ("non-existing".equals(patent.getPublnNr())) { throw new NoSuchElementException("unable to find element"); } StringBuilder strBuilder = new StringBuilder(); strBuilder.append(patent.getApplnAuth()); strBuilder.append('-'); strBuilder.append(patent.getApplnNr()); strBuilder.append('-'); strBuilder.append(patent.getPublnAuth()); strBuilder.append('-'); strBuilder.append(patent.getPublnNr()); strBuilder.append('-'); strBuilder.append(patent.getPublnKind()); return strBuilder.toString(); }

Target:
protected static String generateMeta(ImportedPatent patent) { if ("non-existing".contentEquals(patent.getPublnNr())) { throw new NoSuchElementException("unable to find element"); } StringBuilder strBuilder = new StringBuilder(); strBuilder.append(patent.getApplnAuth()); strBuilder.append('-'); strBuilder.append(patent.getApplnNr()); strBuilder.append('-'); strBuilder.append(patent.getPublnAuth()); strBuilder.append('-'); strBuilder.append(patent.getPublnNr()); strBuilder.append('-'); strBuilder.append(patent.getPublnKind()); return strBuilder.toString(); }
Source:
private boolean isInside(int offset, int start, int end) { return offset == start || offset == end || (offset > start && offset < end); }

Target:
private boolean isInside(int offset, int start, int end) { return offset >= start && offset <= end; }
Source:
public static PhoenixJson getInstance(String jsonData) throws SQLException { try { JsonFactory jsonFactory = new JsonFactory(); JsonParser jsonParser = jsonFactory.createJsonParser(jsonData); PhoenixJson phoenixJson = getInstanceInternal(jsonParser); phoenixJson.setJsonAsString(jsonData); return phoenixJson; } catch (IOException x) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.INVALID_JSON_DATA).setRootCause(x) .setMessage(x.getMessage()).build().buildException(); } }

Target:
public static PhoenixJson getInstance(String jsonData) throws SQLException { if (jsonData == null) { return null; } try { JsonFactory jsonFactory = new JsonFactory(); JsonParser jsonParser = jsonFactory.createJsonParser(jsonData); JsonNode jsonNode = getRootJsonNode(jsonParser); return new PhoenixJson(jsonNode, jsonData); } catch (IOException x) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.INVALID_JSON_DATA).setRootCause(x) .setMessage(x.getMessage()).build().buildException(); } }