auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void showPreviousView(boolean showSwipeAnimation) { if (currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } FormIndex startIndex = mFormController.getFormIndex(); FormIndex lastValidIndex = startIndex; if (mFormController.getEvent() != FormEntryController.EVENT_BEGINNING_OF_FORM) { int event = mFormController.stepToPreviousEvent(); while (event != FormEntryController.EVENT_BEGINNING_OF_FORM && event != FormEntryController.EVENT_QUESTION && !(event == FormEntryController.EVENT_GROUP && mFormController.indexIsInFieldList() && mFormController .getQuestionPrompts().length != 0)) { event = mFormController.stepToPreviousEvent(); lastValidIndex = mFormController.getFormIndex(); } if(event == FormEntryController.EVENT_BEGINNING_OF_FORM) { mFormController.jumpToIndex(lastValidIndex); if(lastValidIndex.equals(startIndex)) { FormEntryActivity.this.triggerUserQuitInput(); return; } if(lastValidIndex.isBeginningOfFormIndex()) { this.showNextView(true); return; } } QuestionsView next = createView(); if (showSwipeAnimation) { showView(next, AnimationType.LEFT); } else { showView(next, AnimationType.FADE, false); } } else { FormEntryActivity.this.triggerUserQuitInput(); } }

Target:
private void showPreviousView(boolean showSwipeAnimation) { if (currentPromptIsQuestion()) { saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); } resetLastChangedWidget(); FormIndex startIndex = mFormController.getFormIndex(); FormIndex lastValidIndex = startIndex; if (mFormController.getEvent() != FormEntryController.EVENT_BEGINNING_OF_FORM) { int event = mFormController.stepToPreviousEvent(); while (event != FormEntryController.EVENT_BEGINNING_OF_FORM && event != FormEntryController.EVENT_QUESTION && !(event == FormEntryController.EVENT_GROUP && mFormController.indexIsInFieldList() && mFormController .getQuestionPrompts().length != 0)) { event = mFormController.stepToPreviousEvent(); lastValidIndex = mFormController.getFormIndex(); } if(event == FormEntryController.EVENT_BEGINNING_OF_FORM) { mFormController.jumpToIndex(lastValidIndex); if(lastValidIndex.equals(startIndex)) { FormEntryActivity.this.triggerUserQuitInput(); return; } if(lastValidIndex.isBeginningOfFormIndex()) { this.showNextView(true); return; } } QuestionsView next = createView(); if (showSwipeAnimation) { showView(next, AnimationType.LEFT); } else { showView(next, AnimationType.FADE, false); } } else { FormEntryActivity.this.triggerUserQuitInput(); } }
Source:
private void createContext() { if ( vc == null ) { jContext = new MapContext(Collections.emptyMap()); } else { jContext = (g==null) ? new VariantJEXLContext(vc) : new GenotypeJEXLContext(vc, g); } }

Target:
private void createContext() { if (vc == null) { jContext = new MapContext(Collections.emptyMap()); } else if (g == null) { jContext = new VariantJEXLContext(vc); } else { jContext = new GenotypeJEXLContext(vc, g); } }
Source:
private void add(Range range) { if (!ranges.isEmpty()) { int lastIndex = ranges.size() - 1; Range last = ranges.get(lastIndex); assert last.compareTo(range) <= 0; Range u = Range.union(last, range); if (u != null) { ranges.set(lastIndex, u); } else { ranges.add(range); } } else { ranges.add(range); } }

Target:
private void add(Range range) { Range rangeToAdd = range; for (int i = ranges.size() - 1; i >= 0; --i) { Range last = ranges.get(i); assert !last.isAfter(range); Range u = Range.union(last, rangeToAdd); if (u == null) { break; } rangeToAdd = u; ranges.remove(i); } ranges.add(rangeToAdd); }
Source:
public Binary getBinary(Blob blob) throws IOException { if (!(blob instanceof FileBlob)) { return super.getBinary(blob); } File file = blob.getFile(); String digest; try (InputStream in = new FileInputStream(file)) { digest = DigestUtils.md5Hex(in); } GridFSFile dbFile = gridFSBucket.find(Filters.eq("filename", digest)).first(); if (dbFile == null) { try (InputStream in = new FileInputStream(file)) { gridFSBucket.uploadFromStream(digest, in); } } return new GridFSBinary(digest, blobProviderId); }

Target:
public Binary getBinary(Blob blob) throws IOException { if (!(blob instanceof FileBlob)) { return super.getBinary(blob); } File file = blob.getFile(); String digest; try (InputStream in = new FileInputStream(file)) { digest = DigestUtils.md5Hex(in); } GridFSFile dbFile = gridFSBucket.find(Filters.eq(METADATA_PROPERTY_FILENAME, digest)).first(); if (dbFile == null) { try (InputStream in = new FileInputStream(file)) { gridFSBucket.uploadFromStream(digest, in); } } return new GridFSBinary(digest, blobProviderId); }
Source:
public void testSerde() throws Exception { RabbitMQFirehoseFactory factory = new RabbitMQFirehoseFactory( new JacksonifiedConnectionFactory(), new RabbitMQFirehoseConfig(), new StringInputRowParser( new JSONParseSpec( new TimestampSpec("timestamp", "auto"), new DimensionsSpec( Arrays.<String>asList("dim"), Lists.<String>newArrayList(), Lists.<SpatialDimensionSchema>newArrayList() ) ), null, null, null, null ) ); byte[] bytes = mapper.writeValueAsBytes(factory); RabbitMQFirehoseFactory factory2 = mapper.readValue(bytes, RabbitMQFirehoseFactory.class); byte[] bytes2 = mapper.writeValueAsBytes(factory2); Assert.assertArrayEquals(bytes, bytes2); }

Target:
public void testSerde() throws Exception { RabbitMQFirehoseConfig config = new RabbitMQFirehoseConfig( "test", "test2", "test3", true, true, true, 5, 10, 20 ); JacksonifiedConnectionFactory connectionFactory = new JacksonifiedConnectionFactory( "foo", 9978, "user", "pw", "host", null, 5, 10, 11, 12, ImmutableMap.<String, Object>of("hi", "bye") ); RabbitMQFirehoseFactory factory = new RabbitMQFirehoseFactory( connectionFactory, config, new StringInputRowParser( new JSONParseSpec( new TimestampSpec("timestamp", "auto"), new DimensionsSpec( Arrays.asList("dim"), Lists.<String>newArrayList(), Lists.<SpatialDimensionSchema>newArrayList() ) ), null, null, null, null ) ); byte[] bytes = mapper.writeValueAsBytes(factory); RabbitMQFirehoseFactory factory2 = mapper.readValue(bytes, RabbitMQFirehoseFactory.class); byte[] bytes2 = mapper.writeValueAsBytes(factory2); Assert.assertArrayEquals(bytes, bytes2); Assert.assertEquals(factory.getConfig(), factory2.getConfig()); Assert.assertEquals(factory.getConnectionFactory(), factory2.getConnectionFactory()); }
Source:
protected void onEvent(GHEvent event, String payload) { JSONObject parsedPayload = JSONObject.fromObject(payload); JSONObject repository = parsedPayload.optJSONObject("repository"); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getString("url")); } else { JSONObject organization = parsedPayload.optJSONObject("organization"); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getString("url")); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } }

Target:
protected void onEvent(GHEvent event, String payload) { JSONObject parsedPayload = fromObject(payload); JSONObject repository = parsedPayload.optJSONObject("repository"); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getString("url")); } else { JSONObject organization = parsedPayload.optJSONObject("organization"); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getString("url")); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } }
Source:
public void stepSetRemoteTimeout(RequestMonitor rm) { if (fGDBBackend.getSessionType() == SessionType.REMOTE && fGDBBackend.getIsAttachSession()) { String remoteTimeout = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT, LaunchUtils.getRemoteTimeoutDefault()); if (remoteTimeout != null && !remoteTimeout.isEmpty()) { fCommandControl.queueCommand( fCommandFactory.createMIGDBSetRemoteTimeout(fCommandControl.getContext(), remoteTimeout), new ImmediateDataRequestMonitor<MIInfo>(rm)); return; } } rm.done(); }

Target:
public void stepSetRemoteTimeout(RequestMonitor rm) { if (fGDBBackend.getSessionType() == SessionType.REMOTE) { boolean remoteTimeoutEnabled = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_ENABLED, LaunchUtils.getRemoteTimeoutEnabledDefault()); String remoteTimeoutValue = CDebugUtils.getAttribute(fAttributes, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_TIMEOUT_VALUE, LaunchUtils.getRemoteTimeoutValueDefault()); if (remoteTimeoutEnabled && remoteTimeoutValue != null && !remoteTimeoutValue.isEmpty()) { fCommandControl.queueCommand( fCommandFactory.createMIGDBSetRemoteTimeout(fCommandControl.getContext(), remoteTimeoutValue), new ImmediateDataRequestMonitor<MIInfo>(rm) { @Override protected void handleError() { IStatus status = getStatus(); MultiStatus ms = new MultiStatus(GdbPlugin.PLUGIN_ID, -1, new IStatus[] { status }, LaunchMessages.getString("FinalLaunchSequence.2"), null); rm.done(ms); } }); return; } } rm.done(); }
Source:
public void testGeneIdsorGeneNames() { List<FeatureCoordinates> featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_EXISTING), Arrays.asList(GENE_NAME_EXISITNG)); assertEquals(GENE_ID_EXISTING, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG, featureCoordinates.get(0).getName()); featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_EXISTING), null); assertEquals(GENE_ID_EXISTING, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG, featureCoordinates.get(0).getName()); featureCoordinates = findByIdsOrNamesHelper(null, Arrays.asList(GENE_NAME_EXISITNG)); assertEquals(GENE_ID_EXISTING, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG, featureCoordinates.get(0).getName()); }

Target:
public void testGeneIdsorGeneNames() { List<FeatureCoordinates> featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_EXISTING1), Arrays.asList(GENE_NAME_EXISITNG1)); assertEquals(GENE_ID_EXISTING1, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG1, featureCoordinates.get(0).getName()); featureCoordinates = findByIdsOrNamesHelper(Arrays.asList(GENE_ID_EXISTING1), null); assertEquals(GENE_ID_EXISTING1, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG1, featureCoordinates.get(0).getName()); featureCoordinates = findByIdsOrNamesHelper(null, Arrays.asList(GENE_NAME_EXISITNG1)); assertEquals(GENE_ID_EXISTING1, featureCoordinates.get(0).getId()); assertEquals(GENE_NAME_EXISITNG1, featureCoordinates.get(0).getName()); }
Source:
public void presentAnnotationIsAvailable() throws Exception { Field field = ClassWithDummyField.class.getField("annotatedField"); FrameworkField frameworkField = new FrameworkField(field); Annotation annotation = frameworkField.getAnnotation(Rule.class); assertThat(annotation, isA((Class)Rule.class)); }

Target:
public void presentAnnotationIsAvailable() throws Exception { Field field = ClassWithDummyField.class.getField("annotatedField"); FrameworkField frameworkField = new FrameworkField(field); Annotation annotation = frameworkField.getAnnotation(Rule.class); assertTrue(Rule.class.isAssignableFrom(annotation.getClass())); }
Source:
private void show(Object data) { if (oneline) { if (data instanceof ChangeAttribute) { ChangeAttribute change = (ChangeAttribute) data; out.print(String.format("%s %s (%s)\n", Change.Key.parse(change.id) .abbreviate(), change.subject, change.owner.username)); } return; } switch (outputFormat) { default: case TEXT: if (data instanceof ChangeAttribute) { out.print("change "); out.print(((ChangeAttribute) data).id); out.print("\n"); showText(data, 1); } else { showText(data, 0); } out.print('\n'); break; case JSON: out.print(gson.toJson(data)); out.print('\n'); break; } }

Target:
private void show(Object data) { switch (outputFormat) { default: case TEXT: if (data instanceof ChangeAttribute) { out.print("change "); out.print(((ChangeAttribute) data).id); out.print("\n"); showText(data, 1); } else { showText(data, 0); } out.print('\n'); break; case JSON: out.print(gson.toJson(data)); out.print('\n'); break; case SHORT: if (data instanceof ChangeAttribute) { if (includeApprovals || includeComments || includeCommitMessage || includeCurrentPatchSet || includeDependencies || includeFiles || includePatchSets) { ErrorMessage m = new ErrorMessage(); m.message = "--format=SHORT (or --online) argument is mutually exclusive with all other options"; showText(m, 0); return; } ChangeAttribute change = (ChangeAttribute) data; out.print(String.format("%s %s (%s)\n", Change.Key.parse(change.id) .abbreviate(), change.subject, change.owner.username)); } } }
Source:
void validate() { if (keyField.isEmpty()) { throw new IllegalArgumentException("The 'Key Field' property must be set."); } else if (fieldName.isEmpty()) { throw new IllegalArgumentException("The 'Input Field Name' property must be set."); } else if (fieldValue.isEmpty()) { throw new IllegalArgumentException("The 'Input Field Value' property must be set."); } else if (outputFields.isEmpty()) { throw new IllegalArgumentException("The 'OutputFields' property must be set."); } }

Target:
void validate() { if (keyField.isEmpty()) { throw new IllegalArgumentException("The 'keyField' property must be set."); } else if (nameField.isEmpty()) { throw new IllegalArgumentException("The 'nameField' property must be set."); } else if (valueField.isEmpty()) { throw new IllegalArgumentException("The 'valueField' property must be set."); } else if (outputFields.isEmpty()) { throw new IllegalArgumentException("The 'outputFields' property must be set."); } }
Source:
public ArrayList<FieldReport> getFieldReports() { return mfieldReports; }

Target:
public ArrayList<FieldReport> getFieldReports() { if (mFieldReports == null){ return new ArrayList<FieldReport>(); } return mFieldReports; }
Source:
public void testMkdirRootNonExistentContainer() throws Exception { final Configuration rawConf = getRawConfiguration(); FsShell fsShell = new FsShell(rawConf); final String account = rawConf.get(FS_AZURE_ABFS_ACCOUNT_NAME, null); String nonExistentContainer = "nonexistent-" + UUID.randomUUID(); final AbfsConfiguration conf = getConfiguration(); conf.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, false); int result = fsShell.run(new String[] { "-mkdir", ABFS_SCHEME + "://" + nonExistentContainer + "@" + account + "/testDirOnRoot" }); assertEquals(1, result); }

Target:
public void testMkdirRootNonExistentContainer() throws Exception { final Configuration rawConf = getRawConfiguration(); final String account = rawConf.get(FS_AZURE_ABFS_ACCOUNT_NAME, null); rawConf.setBoolean(AZURE_CREATE_REMOTE_FILESYSTEM_DURING_INITIALIZATION, false); String nonExistentContainer = "nonexistent-" + UUID.randomUUID(); FsShell fsShell = new FsShell(rawConf); int result = fsShell.run(new String[] {"-mkdir", ABFS_SCHEME + "://" + nonExistentContainer + "@" + account + "/"}); assertEquals(1, result); }
Source:
private static boolean headersEquivalent(String a, String b) { if (a.length() != b.length()) return false; List<String> remaining = new LinkedList<String>(Arrays.asList(a.split("\\t"))); for (String item : b.split("\\t")) { if (!remaining.remove(item)) return false; } return remaining.isEmpty(); }

Target:
private static final boolean headersEquivalent(String a, String b) { if (a.length() != b.length()) return false; List<String> remaining = new LinkedList<String>(Arrays.asList(a.split("\\t"))); for (final String item : b.split("\\t")) { if (!remaining.remove(item)) return false; } return remaining.isEmpty(); }
Source:
public List<Variant> createSiteModifyingVariants() { List<Variant> listVariant = new ArrayList<Variant>(); if (getExtension() != null) { List<ScriptWrapper> scripts = getExtension().getScripts(ExtensionActiveScan.SCRIPT_TYPE_VARIANT); for (ScriptWrapper script : scripts) { if (script.isEnabled()) { try { listVariant.add(new VariantCustom(script, getExtension())); } catch (Exception e) { getExtension().handleScriptException(script, e); } } } } for (Class<? extends Variant> variant : customVariants) { try { listVariant.add(variant.getDeclaredConstructor().newInstance()); } catch (Exception e) { LOG.error(e.getMessage(), e); } } return listVariant; }

Target:
public List<Variant> createSiteModifyingVariants() { List<Variant> listVariant = new ArrayList<Variant>(); addScriptVariants(listVariant); addCustomVariants(listVariant); return listVariant; }
Source:
public boolean sweepTable(String tableName) { TableReference tableRef = TableReference.createFromFullyQualifiedName(tableName); Preconditions.checkArgument(TableReference.isFullyQualifiedName(tableName), String.format("Table name %s is not fully qualified", tableName)); Preconditions.checkState(specificTableSweeper.getKvs().getAllTableNames().contains(tableRef), String.format("Table requested to sweep %s does not exist", tableName)); return specificTableSweeper.runOnceForTable(new TableToSweep(tableRef, null), false, Optional.empty()); }

Target:
public void sweepTable(String tableName) { TableReference tableRef = getTableRef(tableName); checkTableExists(tableName, tableRef); runSweepWithoutSavingResults(tableRef); }
Source:
public static boolean isKeyframe(ByteArrayBuffer baf) { if (baf.getLength() < 2) return false; byte b = baf.getBuffer()[baf.getOffset() + 1]; return (b & KF_MASK) != 0; }

Target:
public static boolean isKeyframe(ByteArrayBuffer baf) { if (baf == null || baf.getLength() < 2) { return false; } byte b = baf.getBuffer()[baf.getOffset() + 1]; return (b & KF_MASK) != 0; }
Source:
public void dropSchemaAndDatabase(SessionFactory sessionFactory) { final InfinispanRemoteDatastoreProvider datastoreProvider = getProvider( sessionFactory ); final Set<String> mappedCacheNames = datastoreProvider.getCacheTemplatesByName().keySet(); mappedCacheNames.forEach( cacheName -> datastoreProvider.getCache( cacheName ).clear() ); }

Target:
public void dropSchemaAndDatabase(SessionFactory sessionFactory) { final InfinispanRemoteDatastoreProvider datastoreProvider = getProvider( sessionFactory ); final Set<String> mappedCacheNames = datastoreProvider.getMappedCacheNames(); mappedCacheNames.forEach( cacheName -> datastoreProvider.getCache( cacheName ).clear() ); }
Source:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = new HashMap<String, String>(); jobProperties.put(VdcObjectType.VDS.name().toLowerCase(), (getVdsName() == null) ? "" : getVdsName()); jobProperties.put(VdcObjectType.Storage.name().toLowerCase(), getStorageDomainName()); } return jobProperties; }

Target:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = new HashMap<String, String>(); jobProperties.put(VdcObjectType.VDS.name().toLowerCase(), (getVdsName() == null) ? "" : getVdsName()); } return jobProperties; }
Source:
public static <T extends DBObject> T clone(T source) { if (source == null) { return null; } if (source instanceof BasicDBObject) { @SuppressWarnings("unchecked") T clone = (T) ((BasicDBObject) source).copy(); return clone; } if (source instanceof BasicDBList) { @SuppressWarnings("unchecked") T clone = (T) ((BasicDBList) source).copy(); return clone; } if (source instanceof LazyDBList) { BasicDBList clone = new BasicDBList(); Iterator it = ((LazyDBList) source).iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof DBObject) { clone.add(Util.clone((DBObject) o)); } else { clone.add(o); } } return (T) clone; } if (source instanceof LazyBSONObject) { @SuppressWarnings("unchecked") BasicDBObject clone = new BasicDBObject(); for (Map.Entry<String, Object> entry : ((LazyBSONObject) source).entrySet()) { if (entry.getValue() instanceof DBObject) { clone.put(entry.getKey(), Util.clone((DBObject) entry.getValue())); } else { clone.put(entry.getKey(), entry.getValue()); } } return (T) clone; } throw new IllegalArgumentException("Don't know how to clone: " + source); }

Target:
public static <T extends DBObject> T clone(T source) { if (source == null) { return null; } if (source instanceof BasicDBObject) { @SuppressWarnings("unchecked") T clone = (T) ((BasicDBObject) source).copy(); return clone; } if (source instanceof BasicDBList) { @SuppressWarnings("unchecked") T clone = (T) ((BasicDBList) source).copy(); return clone; } if (source instanceof LazyDBList) { BasicDBList clone = new BasicDBList(); Iterator it = ((LazyDBList) source).iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof DBObject) { clone.add(Util.clone((DBObject) o)); } else { clone.add(o); } } return (T) clone; } if (source instanceof LazyBSONObject) { @SuppressWarnings("unchecked") BasicDBObject clone = new BasicDBObject(); for (Map.Entry<String, Object> entry : ((LazyBSONObject) source).entrySet()) { if (entry.getValue() instanceof DBObject) { clone.put(entry.getKey(), Util.clone((DBObject) entry.getValue())); } else { clone.put(entry.getKey(), entry.getValue()); } } return (T) clone; } throw new IllegalArgumentException("Don't know how to embedded: " + source); }
Source:
public static void main(String[] args) { try { ScrubInputs scrubInputs = new ScrubInputs(); if(args.length == 0){ logger.info("{}{}{}", "Command line options can be displayed with the --help arguemnt.", SystemProperties.lineSeparator, "Entering interactive mode."); scrubInputs.interactive = true; scrubInputs.runInteractive(); } else { List<String> errors = scrubInputs.parseIinputs(args); if (errors.size() > 0) { for(String err: errors){ logger.info(err); } scrubInputs.usage(); logger.info("Exiting..."); System.exit(0); } } ResourceCache.terminal.dispose(); new ScrubService().exec(scrubInputs); } catch (Exception e) { logger.info("Fatal error occurred: {}. {}", e.getMessage(), Constants.CHECK_LOG); } finally { ResourceCache.closeAll(); } }

Target:
public static void main(String[] args) { try { ScrubInputs scrubInputs = new ScrubInputs(); if(args.length == 0){ logger.info(Constants.interactiveMsg); scrubInputs.interactive = true; scrubInputs.runInteractive(); } else { List<String> errors = scrubInputs.parseIinputs(args); if (errors.size() > 0) { for(String err: errors){ logger.info(err); } scrubInputs.usage(); logger.info("Exiting..."); System.exit(0); } } ResourceCache.terminal.dispose(); new ScrubService().exec(scrubInputs); } catch (Exception e) { logger.info("Fatal error occurred: {}. {}", e.getMessage(), Constants.CHECK_LOG); } finally { ResourceCache.closeAll(); } }
Source:
public synchronized Throwable getCause() { if (cause == null) { CompositeExceptionCausalChain _cause = new CompositeExceptionCausalChain(); Set<Throwable> seenCauses = new HashSet<Throwable>(); Throwable chain = _cause; for (Throwable e : exceptions) { if (seenCauses.contains(e)) { continue; } seenCauses.add(e); List<Throwable> listOfCauses = getListOfCauses(e); for(Throwable child : listOfCauses) { if (seenCauses.contains(child)) { e = new RuntimeException("Duplicate found in causal chain so cropping to prevent loop ..."); continue; } seenCauses.add(child); } try { chain.initCause(e); } catch (Throwable t) { chain = e; } chain = chain.getCause(); } cause = _cause; } return cause; }

Target:
public synchronized Throwable getCause() { if (cause == null) { CompositeExceptionCausalChain _cause = new CompositeExceptionCausalChain(); Set<Throwable> seenCauses = new HashSet<Throwable>(); Throwable chain = _cause; for (Throwable e : exceptions) { if (seenCauses.contains(e)) { continue; } seenCauses.add(e); List<Throwable> listOfCauses = getListOfCauses(e); for(Throwable child : listOfCauses) { if (seenCauses.contains(child)) { e = new RuntimeException("Duplicate found in causal chain so cropping to prevent loop ..."); continue; } seenCauses.add(child); } try { chain.initCause(e); chain = chain.getCause(); } catch (Throwable t) { chain = e; } } cause = _cause; } return cause; }
Source:
private void populateFilters() { this.testingCheck = new SidebarCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new SidebarCheckBox(tr("Patch Required")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new SidebarCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new SidebarCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new SidebarGroup("Filters", testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }

Target:
private void populateFilters() { this.testingCheck = new SidebarCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new SidebarCheckBox(tr("Patch required")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new SidebarCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new SidebarCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new SidebarGroup("Filters", testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }
Source:
public void start() throws SchedulerException { try { this.scheduler.start(); logger.info("Quartz Scheduler started."); } catch (SchedulerConfigException e) { if(e.getCause() instanceof org.quartz.JobPersistenceException) { if(e.getCause().getCause() instanceof java.io.InvalidClassException) { if(enableSerializationHack()) { try { this.scheduler.start(); logger.info("Quartz Scheduler started (with serialization hack)."); return; } catch (SchedulerConfigException e2) { logger.error("Error initializing hacked scheduler", e2); } } } } logger.error("Error initializing scheduler", e); scheduler = null; } }

Target:
public void start() throws SchedulerException { try { this.scheduler.start(); logger.info("Quartz Scheduler started."); } catch (SchedulerConfigException e) { if (isSerializationBug(e) && enableSerializationHack()) { try { this.scheduler.start(); logger.info("Quartz Scheduler started (with serialization hack)."); return; } catch (SchedulerConfigException e2) { logger.error("Error initializing hacked scheduler", e2); } } logger.error("Error initializing scheduler", e); scheduler = null; } }
Source:
public void add(ComplexEventChunk<StreamEvent> addingEventChunk) throws ConnectionUnavailableException { if (isCacheEnabled) { ComplexEventChunk<StreamEvent> addingEventChunkWithTimestamp = new ComplexEventChunk<>(); while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); Object[] outputData = event.getOutputData(); Object[] outputDataWithTimeStamp = appendValue(outputData, new Timestamp(System.currentTimeMillis()).getTime()); StreamEvent eventWithTimeStamp = new StreamEvent(0, 0, outputDataWithTimeStamp.length); eventWithTimeStamp.setOutputData(outputDataWithTimeStamp); addingEventChunkWithTimestamp.add(eventWithTimeStamp); } cachedTable.add(addingEventChunk); if (cachedTable.size() > maxCacheSize) { isCacheEnabled = false; log.warn(siddhiAppContext.getName() + ": " + cacheTableDefinition.getId() + " size is now " + cachedTable.size() + " which is bigger than cache table size defined as " + maxCacheSize + ". So cache is now disabled"); } } List<Object[]> records = new ArrayList<>(); addingEventChunk.reset(); long timestamp = 0L; while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); records.add(event.getOutputData()); timestamp = event.getTimestamp(); } if (recordTableHandler != null) { recordTableHandler.add(timestamp, records); } else { add(records); } }

Target:
public void add(ComplexEventChunk<StreamEvent> addingEventChunk) throws ConnectionUnavailableException { if (isCacheEnabled) { ComplexEventChunk<StreamEvent> addingEventChunkWithTimestamp = new ComplexEventChunk<>(); while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); Object[] outputData = event.getOutputData(); Object[] outputDataWithTimeStamp = new Object[outputData.length + 1]; System.arraycopy(outputData, 0 , outputDataWithTimeStamp, 0, outputData.length); outputDataWithTimeStamp[outputDataWithTimeStamp.length - 1] = siddhiAppContext.getTimestampGenerator().currentTime(); StreamEvent eventWithTimeStamp = new StreamEvent(0, 0, outputDataWithTimeStamp.length); eventWithTimeStamp.setOutputData(outputDataWithTimeStamp); addingEventChunkWithTimestamp.add(eventWithTimeStamp); } } List<Object[]> records = new ArrayList<>(); addingEventChunk.reset(); long timestamp = 0L; while (addingEventChunk.hasNext()) { StreamEvent event = addingEventChunk.next(); records.add(event.getOutputData()); timestamp = event.getTimestamp(); } if (isCacheEnabled) { readWriteLock.writeLock().lock(); try { cachedTable.add(addingEventChunk); if (recordTableHandler != null) { recordTableHandler.add(timestamp, records); } else { add(records); } } finally { readWriteLock.writeLock().unlock(); } if (cachedTable.size() > maxCacheSize) { isCacheEnabled = false; log.warn(siddhiAppContext.getName() + ": " + cacheTableDefinition.getId() + " size is now " + cachedTable.size() + " which is bigger than cache table size defined as " + maxCacheSize + ". So cache is now disabled"); } } else { if (recordTableHandler != null) { recordTableHandler.add(timestamp, records); } else { add(records); } } }
Source:
public void changePassword_nullThrows() { SyncUser user = createTestUser(); try { user.changePassword(null); fail(); } catch (IllegalArgumentException ignored) { } }

Target:
public void changePassword_nullThrows() { SyncUser user = createTestUser(); thrown.expect(IllegalArgumentException.class); user.changePassword(null); }
Source:
public boolean shouldRender(Minecraft minecraft) { EntityPlayer player = Minecraft.getMinecraft().player; ItemStack sigilStack = player.getHeldItem(EnumHand.MAIN_HAND); boolean flag = false; if (simple) { if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION) flag = true; if(!flag) flag = isFlagSigilHolding(sigilStack, true); if (!flag) { sigilStack = player.getHeldItem(EnumHand.OFF_HAND); if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION) flag = true; } if(!flag) { flag = isFlagSigilHolding(sigilStack, true); } } else { if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER) flag = true; if(!flag) flag = isFlagSigilHolding(sigilStack, false); if (!flag) { sigilStack = player.getHeldItem(EnumHand.OFF_HAND); if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER) flag = true; } if(!flag) flag = isFlagSigilHolding(sigilStack, false); } return super.shouldRender(minecraft) && flag; }

Target:
public boolean shouldRender(Minecraft minecraft) { EntityPlayer player = Minecraft.getMinecraft().player; ItemStack sigilStack = player.getHeldItem(EnumHand.MAIN_HAND); boolean flag = false; if (simple) { if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION) flag = true; else flag = isFlagSigilHolding(sigilStack, true); if (!flag) { sigilStack = player.getHeldItem(EnumHand.OFF_HAND); if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION) flag = true; else flag = isFlagSigilHolding(sigilStack, true); } } else { if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER) flag = true; else flag = isFlagSigilHolding(sigilStack, false); if (!flag) { sigilStack = player.getHeldItem(EnumHand.OFF_HAND); if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER) flag = true; else flag = isFlagSigilHolding(sigilStack, false); } } return super.shouldRender(minecraft) && flag; }
Source:
public void testUpsertAndDeleteWithGlobalIndex() throws Exception { Assume.assumeTrue(HbaseCompatCapabilities.hasPreWALAppend()); SchemaBuilder builder = new SchemaBuilder(getUrl()); boolean createGlobalIndex = true; long ddlTimestamp = upsertAndDeleteHelper(builder, createGlobalIndex); assertAnnotation(2, builder.getPhysicalTableName(false), null, builder.getTableOptions().getSchemaName(), builder.getDataOptions().getTableName(), PTableType.TABLE, ddlTimestamp); assertAnnotation(0, builder.getPhysicalTableIndexName(false), null, builder.getTableOptions().getSchemaName(), SchemaUtil.getTableNameFromFullName(builder.getEntityTableIndexName()), PTableType.INDEX, ddlTimestamp); }

Target:
public void testUpsertAndDeleteWithGlobalIndex() throws Exception { Assume.assumeTrue(HbaseCompatCapabilities.hasPreWALAppend()); SchemaBuilder builder = new SchemaBuilder(getUrl()); boolean createGlobalIndex = true; long ddlTimestamp = upsertAndDeleteHelper(builder, createGlobalIndex); assertAnnotation(2, builder.getPhysicalTableName(false), null, builder.getTableOptions().getSchemaName(), builder.getDataOptions().getTableName(), PTableType.TABLE, ddlTimestamp); assertAnnotation(0, builder.getPhysicalTableIndexName(false), null, null, null, null, ddlTimestamp); }
Source:
public void openAndCloseEvent() { Single.just("1") .delay(1, TimeUnit.MILLISECONDS, testScheduler) .compose(new UntilCorrespondingEventSingleTransformer<String, String>(lifecycle, CORRESPONDING_EVENTS)) .subscribe(testSubscriber); lifecycle.onNext("create"); lifecycle.onNext("destroy"); testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); testSubscriber.assertNoValues(); testSubscriber.assertError(CancellationException.class); }

Target:
public void openAndCloseEvent() { Single.just("1") .delay(1, TimeUnit.MILLISECONDS, testScheduler) .compose(new UntilCorrespondingEventSingleTransformer<String, String>(lifecycle, CORRESPONDING_EVENTS)) .subscribe(testSubscriber); lifecycle.onNext("create"); testSubscriber.assertNoErrors(); lifecycle.onNext("destroy"); testScheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS); testSubscriber.assertNoValues(); testSubscriber.assertError(CancellationException.class); }
Source:
public int hashCode() { return Objects.hash(message, sqlState, errorCode, errorName, errorType, errorLocation, failureInfo); }

Target:
public int hashCode() { return Objects.hash(errorCode, message, sqlState, errorName, errorType, errorLocation, failureInfo); }
Source:
public Map<Consumer, List<Entitlement>> getDistinctConsumers( List<Entitlement> entsToRevoke) { Map<Consumer, List<Entitlement>> result = new HashMap<Consumer, List<Entitlement>>(); for (Entitlement ent : entsToRevoke) { if (!result.containsKey(ent.getConsumer())) { result.put(ent.getConsumer(), new ArrayList<Entitlement>()); } result.get(ent.getConsumer()).add(ent); } return result; }

Target:
public Map<Consumer, List<Entitlement>> getDistinctConsumers( List<Entitlement> entsToRevoke) { Map<Consumer, List<Entitlement>> result = new HashMap<Consumer, List<Entitlement>>(); for (Entitlement ent : entsToRevoke) { List<Entitlement> ents = result.get(ent.getConsumer()); if (ents == null) { ents = new ArrayList<Entitlement>(); result.put(ent.getConsumer(), ents); } ents.add(ent); } return result; }
Source:
public QName(final String namespaceURI, final String localPart, final String prefix) { if (namespaceURI == null) { setNamespaceURI(XMLConstants.NULL_NS_URI); } else { setNamespaceURI(namespaceURI); } if (localPart == null) { throw new IllegalArgumentException( "local part cannot be \"null\" when creating a QName"); } setLocalPart(localPart); if (prefix == null) { throw new IllegalArgumentException( "prefix cannot be \"null\" when creating a QName"); } setPrefix(prefix); setKey(toString()); final String usedPrefix = !StringUtils.isEmpty(getPrefix()) ? getPrefix() + ":" : ""; final String string = "{" + getNamespaceURI() + "}" + usedPrefix + getLocalPart(); setString(string); }

Target:
public QName(final String namespaceURI, final String localPart, final String prefix) { if (Objects.isNull(namespaceURI)) { setNamespaceURI(XMLConstants.NULL_NS_URI); } else { setNamespaceURI(namespaceURI); } if (Objects.isNull(localPart)) { throw new IllegalArgumentException("local part cannot be \"null\" when creating a QName"); } setLocalPart(localPart); if (Objects.isNull(prefix)) { throw new IllegalArgumentException("prefix cannot be \"null\" when creating a QName"); } setPrefix(prefix); setKey(toString()); final String usedPrefix = !StringUtils.isEmpty(getPrefix()) ? getPrefix() + ":" : ""; final String string = "{" + getNamespaceURI() + "}" + usedPrefix + getLocalPart(); setString(string); }
Source:
public static IPluggableSerializer getSerializer(Map<String, Object> config) { IPluggableSerializer serializer; try { String serializerClassName = (String) config.get(Config.TOPOLOGY_SERIALIZER_CLASSNAME); if (serializerClassName == null) { LOG.log(Level.WARNING, "Serializer class name not provided"); LOG.log(Level.WARNING, "Fall back to Java serializer. " + "This could cause serious performance degradation"); LOG.log(Level.WARNING, "You can specify to use Kryo as serializer. " + "See <LINK_0> for details"); serializer = new JavaSerializer(); } else { serializer = (IPluggableSerializer) Class.forName(serializerClassName).newInstance(); } serializer.initialize(config); return serializer; } catch (ClassNotFoundException ex) { throw new RuntimeException("Serializer class must be in class path " + ex); } catch (InstantiationException ex) { throw new RuntimeException( "Serializer class must be concrete and have a nullary constructor " + ex); } catch (IllegalAccessException ex) { throw new RuntimeException("Serializer class constructor must be public " + ex); } }

Target:
public static IPluggableSerializer getSerializer(Map<String, Object> config) { IPluggableSerializer serializer; try { String serializerClassName = (String) config.get(Config.TOPOLOGY_SERIALIZER_CLASSNAME); if (serializerClassName == null) { LOG.log(Level.WARNING, "Serializer class name not provided. " + "Fall back to Java serializer. " + "This could cause serious performance degradation. " + "You can specify to use Kryo as serializer. " + "See <LINK_0> for details"); serializer = new JavaSerializer(); } else { serializer = (IPluggableSerializer) Class.forName(serializerClassName).newInstance(); } serializer.initialize(config); return serializer; } catch (ClassNotFoundException ex) { throw new RuntimeException("Serializer class must be in class path " + ex); } catch (InstantiationException ex) { throw new RuntimeException( "Serializer class must be concrete and have a nullary constructor " + ex); } catch (IllegalAccessException ex) { throw new RuntimeException("Serializer class constructor must be public " + ex); } }
Source:
public static void unzip(String zipFilename, String[] filenames, String outdir) throws IOException { ZipFile zipFile = new ZipFile(zipFilename); Enumeration entries = zipFile.entries(); L1: while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); for (int i = 0; i < filenames.length; i++) { if (entry.getName().equals(filenames[i])) { Utilities.assertNotZipSlipVulnarable(outdir + "\\" + filenames[i], outdir); byte[] buffer = new byte[1024]; int len; InputStream zipin = zipFile.getInputStream(entry); BufferedOutputStream fileout = new BufferedOutputStream( new FileOutputStream(outdir + "\\" + filenames[i])); while ((len = zipin.read(buffer)) >= 0) fileout.write(buffer, 0, len); zipin.close(); fileout.flush(); fileout.close(); continue L1; } } } }

Target:
public static void unzip(String zipFilename, String[] filenames, String outdir) throws IOException { ZipFile zipFile = new ZipFile(zipFilename); Enumeration entries = zipFile.entries(); L1: while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); for (int i = 0; i < filenames.length; i++) { if (entry.getName().equals(filenames[i])) { Utilities.assertNotZipSlipVulnarable( new File(outdir, filenames[i]), Paths.get(outdir)); byte[] buffer = new byte[1024]; int len; InputStream zipin = zipFile.getInputStream(entry); BufferedOutputStream fileout = new BufferedOutputStream( new FileOutputStream(new File(outdir, filenames[i]))); while ((len = zipin.read(buffer)) >= 0) fileout.write(buffer, 0, len); zipin.close(); fileout.flush(); fileout.close(); continue L1; } } } }
Source:
protected VDS getVds(Guid id) { return DbFacade.getInstance().getVdsDao().get(id); }

Target:
protected VDS getVds(Guid id) { return getVdsDAO().get(id); }
Source:
public void lock(BindContext context) { log.debug("Requesting locks"); context.lockPools(); log.debug("Successfully achieved locks"); }

Target:
private void lock(BindContext context) { log.debug("Requesting locks"); context.lockPools(); log.debug("Successfully achieved locks"); }
Source:
public void roundtripBase58_invalidCompressed() { String base58 = "5Kg5shEQWrf1TojaHTdc2kLuz5Mfh4uvp3cYu8uJHaHgfTGUbTD"; byte[] bytes = Base58.decodeChecked(base58); bytes = Arrays.concatenate(bytes, new byte[]{0}); base58 = Base58.encode(bytes); DumpedPrivateKey.fromBase58(null, base58); }

Target:
public void roundtripBase58_invalidCompressed() { String base58 = "5Kg5shEQWrf1TojaHTdc2kLuz5Mfh4uvp3cYu8uJHaHgfTGUbTD"; byte[] bytes = Base58.decodeChecked(base58); bytes = Arrays.copyOf(bytes, bytes.length+1); bytes[bytes.length-1] = 0; base58 = Base58.encode(bytes); DumpedPrivateKey.fromBase58(null, base58); }
Source:
public boolean isUsableByPlayer(EntityPlayer player) { return true; }

Target:
public boolean isUsableByPlayer(EntityPlayer player) { return adapter.isUsableByPlayer(player); }
Source:
private boolean isHostLocal(EndpointDetails details, HostLocation myLocation) { return details.isSetDatacenter() && details.isSetRack() && details.isSetHost() && myLocation.equals(HostLocation.of(details.getDatacenter(), details.getRack())); }

Target:
private static boolean isHostLocal(EndpointDetails details, HostLocation myLocation) { return details.isSetDatacenter() && details.isSetRack() && details.isSetHost() && myLocation.equals(HostLocation.of(details.getDatacenter(), details.getRack())); }
Source:
public void startTimer() { SwingUtilities.invokeLater( new Runnable() { public void run() { remaining = new JLabel(timeLimit+" sec"); timer = new Timer(1000, listener); phaseDisplay.getClientgui().getMenuBar().add(display); timer.start(); display.setLayout(new FlowLayout()); display.add(remaining); display.add(progressBar); display.setVisible(true); } }); }

Target:
public void startTimer() { SwingUtilities.invokeLater( new Runnable() { public void run() { timer = new Timer(1000, listener); phaseDisplay.getClientgui().getMenuBar().add(display); timer.start(); display.setVisible(true); } }); }
Source:
public List<Partition> get_partitions_by_names(final String dbName, final String tblName, final List<String> partNames, boolean getColStats) throws TException { String[] dbNameParts = parseDbName(dbName, conf); String parsedCatName = dbNameParts[CAT_NAME]; String parsedDbName = dbNameParts[DB_NAME]; List<Partition> ret = null; Exception ex = null; startTableFunction("get_partitions_by_names", parsedCatName, parsedDbName, tblName); try { authorizeTableForPartitionMetadata(parsedCatName, parsedDbName, tblName); fireReadTablePreEvent(parsedCatName, parsedDbName, tblName); ret = getMS().getPartitionsByNames(parsedCatName, parsedDbName, tblName, partNames); ret = FilterUtils.filterPartitionsIfEnabled(isServerFilterEnabled, filterHook, ret); if (getColStats) { Table table = getTable(parsedCatName, parsedDbName, tblName); for (Partition part: ret) { String partName = Warehouse.makePartName(table.getPartitionKeys(), part.getValues()); List<ColumnStatistics> partColStatsList = getMS().getPartitionColumnStatistics(parsedCatName, parsedDbName, tblName, Collections.singletonList(partName), StatsSetupConst.getColumnsHavingStats(part.getParameters())); if (partColStatsList != null && !partColStatsList.isEmpty()) { ColumnStatistics partColStats = partColStatsList.get(0); if (partColStats != null) { part.setColStats(partColStats); } } } } } catch (Exception e) { ex = e; rethrowException(e); } finally { endFunction("get_partitions_by_names", ret != null, ex, tblName); } return ret; }

Target:
public List<Partition> get_partitions_by_names(final String dbName, final String tblName, final List<String> partNames, boolean getColStats) throws TException { String[] dbNameParts = parseDbName(dbName, conf); String parsedCatName = dbNameParts[CAT_NAME]; String parsedDbName = dbNameParts[DB_NAME]; List<Partition> ret = null; Exception ex = null; boolean success = false; startTableFunction("get_partitions_by_names", parsedCatName, parsedDbName, tblName); try { getMS().openTransaction(); authorizeTableForPartitionMetadata(parsedCatName, parsedDbName, tblName); fireReadTablePreEvent(parsedCatName, parsedDbName, tblName); ret = getMS().getPartitionsByNames(parsedCatName, parsedDbName, tblName, partNames); ret = FilterUtils.filterPartitionsIfEnabled(isServerFilterEnabled, filterHook, ret); if (getColStats) { Table table = getTable(parsedCatName, parsedDbName, tblName); for (Partition part: ret) { String partName = Warehouse.makePartName(table.getPartitionKeys(), part.getValues()); List<ColumnStatistics> partColStatsList = getMS().getPartitionColumnStatistics(parsedCatName, parsedDbName, tblName, Collections.singletonList(partName), StatsSetupConst.getColumnsHavingStats(part.getParameters())); if (partColStatsList != null && !partColStatsList.isEmpty()) { ColumnStatistics partColStats = partColStatsList.get(0); if (partColStats != null) { part.setColStats(partColStats); } } } } success = getMS().commitTransaction(); } catch (Exception e) { ex = e; rethrowException(e); } finally { if (!success) { getMS().rollbackTransaction(); } endFunction("get_partitions_by_names", ret != null, ex, tblName); } return ret; }
Source:
private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext context) { String pkgName = getDeserializerPackageName(targetType); final String simpleName = getDeserializerSimpleName(targetType); final PrintWriter pw; final ClassSourceFileComposerFactory cf; pw = context.tryCreate(logger, pkgName, simpleName); if (pw == null) return null; cf = new ClassSourceFileComposerFactory(pkgName, simpleName); cf.addImport(JavaScriptObject.class.getCanonicalName()); cf.addImport(ResultDeserializer.class.getCanonicalName()); cf.setSuperclass(ArrayResultDeserializer.class.getCanonicalName()); cf.addImplementedInterface(ResultDeserializer.class.getCanonicalName() + "<" + targetType.getQualifiedSourceName() + ">"); return cf.createSourceWriter(context, pw); }

Target:
private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext context) { String pkgName = getDeserializerPackageName(targetType); final String simpleName = getDeserializerSimpleName(targetType); final PrintWriter pw; final ClassSourceFileComposerFactory cf; pw = context.tryCreate(logger, pkgName, simpleName); if (pw == null) { return null; } cf = new ClassSourceFileComposerFactory(pkgName, simpleName); cf.addImport(JavaScriptObject.class.getCanonicalName()); cf.addImport(ResultDeserializer.class.getCanonicalName()); cf.setSuperclass(ArrayResultDeserializer.class.getCanonicalName()); cf.addImplementedInterface(ResultDeserializer.class.getCanonicalName() + "<" + targetType.getQualifiedSourceName() + ">"); return cf.createSourceWriter(context, pw); }
Source:
private void removeNmMdAndUqTags(final SAMRecord rec) { rec.setAttribute(SAMTag.NM.name(), null); rec.setAttribute(SAMTag.MD.name(), null); rec.setAttribute(SAMTag.UQ.name(), null); }

Target:
private static void removeNmMdAndUqTags(final SAMRecord rec) { rec.setAttribute(SAMTag.NM.name(), null); rec.setAttribute(SAMTag.MD.name(), null); rec.setAttribute(SAMTag.UQ.name(), null); }
Source:
public void open() throws CatalogException { if (client == null) { client = HiveMetastoreClientFactory.create(hiveConf, hiveVersion); if (client == null) { throw new CatalogException("Can not open hive catalog because create hive metastore client failed."); } LOG.info("Connected to Hive metastore"); } if (!databaseExists(getDefaultDatabase())) { throw new CatalogException(String.format("Configured default database %s doesn't exist in catalog %s.", getDefaultDatabase(), getName())); } }

Target:
public void open() throws CatalogException { if (client == null) { client = HiveMetastoreClientFactory.create(hiveConf, hiveVersion); LOG.info("Connected to Hive metastore"); } if (!databaseExists(getDefaultDatabase())) { throw new CatalogException(String.format("Configured default database %s doesn't exist in catalog %s.", getDefaultDatabase(), getName())); } }