auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setLocation(String location, Job job) throws IOException { if (DEBUG) LOG.debug("LoadFunc.setLocation(" + location + ", " + job + ")"); storeInUDFContext(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess)); setInput(location, job); storeInUDFContext(PARQUET_PIG_SCHEMA, pigSchemaToString(schema)); getConfiguration(job).set(PARQUET_PIG_SCHEMA, pigSchemaToString(schema)); storeInUDFContext(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList)); getConfiguration(job).set(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList)); getConfiguration(job).set(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess)); }

Target:
public void setLocation(String location, Job job) throws IOException { if (DEBUG) LOG.debug("LoadFunc.setLocation(" + location + ", " + job + ")"); setInput(location, job); }
Source:
public <V> Map<K, V> getNextTrainingDataSplit() { int expectedMiniBatchIndex = nextSplitIndex / numDataSplitsPerMiniBatch; if (expectedMiniBatchIndex > numMiniBatchesPerEpoch) { expectedMiniBatchIndex = numMiniBatchesPerEpoch; } if (expectedMiniBatchIndex == currentMiniBatch) { final Map<K, V> nextTrainingDataSplit = new HashMap<>(); for (final K key : trainingDataSplits.get(nextSplitIndex++)) { final Pair<K, V> keyValuePair = memoryStore.get(key); if (keyValuePair == null) { continue; } nextTrainingDataSplit.put(keyValuePair.getFirst(), keyValuePair.getSecond()); } return nextTrainingDataSplit; } return Collections.emptyMap(); }

Target:
public <V> Map<K, V> getNextTrainingDataSplit() { if (!trainingDataSplitsIterator.hasNext()) { return Collections.emptyMap(); } final List<K> keyList = trainingDataSplitsIterator.next(); final Map<K, V> nextTrainingDataSplit = new HashMap<>(); for (final K key : keyList) { final Pair<K, V> keyValuePair = memoryStore.get(key); if (keyValuePair == null) { continue; } nextTrainingDataSplit.put(keyValuePair.getFirst(), keyValuePair.getSecond()); } return nextTrainingDataSplit; }
Source:
public AuthenticationResult getAuthTokenInBackground(final AuthenticationRequest request, final BrokerEvent brokerEvent) throws AuthenticationException { verifyNotOnMainThread(); setAndLogBrokerInstallationStatuses(brokerEvent); final Bundle requestBundle = getBrokerOptions(request); final Bundle bundleResult; if (isBrokerAccountServiceSupported()) { bundleResult = BrokerAccountServiceHandler.getInstance().getAuthToken(mContext, requestBundle, brokerEvent); } else { bundleResult = getAuthTokenFromAccountManager(request, requestBundle); } if (bundleResult == null) { Logger.v(TAG, "No bundle result returned from broker for silent request."); return null; } return getResultFromBrokerResponse(bundleResult, request); }

Target:
public AuthenticationResult getAuthTokenInBackground(final AuthenticationRequest request, final BrokerEvent brokerEvent) throws AuthenticationException { verifyNotOnMainThread(); setBrokerInstallationStatuses(brokerEvent); final Bundle requestBundle = getBrokerOptions(request); final Bundle bundleResult; if (isBrokerAccountServiceSupported()) { bundleResult = BrokerAccountServiceHandler.getInstance().getAuthToken(mContext, requestBundle, brokerEvent); } else { bundleResult = getAuthTokenFromAccountManager(request, requestBundle); } if (bundleResult == null) { Logger.v(TAG, "No bundle result returned from broker for silent request."); return null; } return getResultFromBrokerResponse(bundleResult, request); }
Source:
public StatementExecution(PreparedStatement statement, boolean clearParameters) { this.statement = statement; if (clearParameters) { try { statement.clearParameters(); } catch (SQLException e) { e.printStackTrace(); } } }

Target:
public StatementExecution(PreparedStatement statement, boolean clearParameters) { this.statement = statement; if (clearParameters) { try { statement.clearParameters(); } catch (SQLException e) { throw new RuntimeException("Exception while clearing parameters on PreparedStatement", e); } } }
Source:
public Object execute(final Object[] parameters) { final ReactiveCosmosParameterAccessor accessor = new ReactiveCosmosParameterParameterAccessor(getQueryMethod(), parameters); final ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); List<SqlParameter> sqlParameters = getQueryMethod().getParameters().stream() .map(p -> new SqlParameter("@" + p.getName().get(), toCosmosDbValue(parameters[p.getIndex()]))) .collect(Collectors.toList()); SqlQuerySpec querySpec = new SqlQuerySpec(query, sqlParameters); Flux<?> flux = this.operations.runQuery(querySpec, processor.getReturnedType().getDomainType(), processor.getReturnedType().getReturnedType()); return flux; }

Target:
public Object execute(final Object[] parameters) { final ReactiveCosmosParameterAccessor accessor = new ReactiveCosmosParameterParameterAccessor(getQueryMethod(), parameters); final ResultProcessor processor = getQueryMethod().getResultProcessor().withDynamicProjection(accessor); List<SqlParameter> sqlParameters = getQueryMethod().getParameters().stream() .map(p -> new SqlParameter("@" + p.getName().orElse(""), toCosmosDbValue(parameters[p.getIndex()]))) .collect(Collectors.toList()); SqlQuerySpec querySpec = new SqlQuerySpec(query, sqlParameters); Flux<?> flux = this.operations.runQuery(querySpec, processor.getReturnedType().getDomainType(), processor.getReturnedType().getReturnedType()); return flux; }
Source:
public FlowMetaData deserialiseFlow(String metaData) { FlowMetaDataImpl result; try { ObjectMapper mapper = new ObjectMapper(); SimpleModule m = new SimpleModule(); m.addAbstractTypeMapping(FlowMetaData.class, FlowMetaDataImpl.class); m.addAbstractTypeMapping(FlowElementMetaData.class, FlowElementMetaDataImpl.class); m.addAbstractTypeMapping(Transition.class, TransitionImpl.class); mapper.registerModule(m); result = mapper.readValue(metaData, FlowMetaDataImpl.class); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating flow meta data object!", e); } return result; }

Target:
public FlowMetaData deserialiseFlow(String metaData) { FlowMetaDataImpl result; try { result = this.mapper.readValue(metaData, FlowMetaDataImpl.class); } catch (Exception e) { throw new RuntimeException("Exception has occurred creating flow meta data object!", e); } return result; }
Source:
protected Object getFieldValue(ITmfEvent event, String field) { Object value = null; if (ITmfEvent.EVENT_FIELD_CONTENT.equals(field)) { value = event.getContent().toString(); } else if (ITmfEvent.EVENT_FIELD_TYPE.equals(field)) { value = event.getType().getName(); } else if (ITmfEvent.EVENT_FIELD_TIMESTAMP.equals(field)) { value = event.getTimestamp().toString(); } else if (ITmfEvent.EVENT_FIELD_SOURCE.equals(field)) { value = event.getSource(); } else if (ITmfEvent.EVENT_FIELD_REFERENCE.equals(field)) { value = event.getReference(); } else { ITmfEventField eventField; if (!(field.startsWith(SLASH_STRING))) { eventField = event.getContent().getField(field); } else { List<String> list = getPathList(field); eventField = event.getContent().getSubField(list.toArray(new String[list.size()])); } if (eventField != null) { value = eventField.getValue(); } } return value; }

Target:
protected Object getFieldValue(ITmfEvent event, String field) { Object value = null; if (ITmfEvent.EVENT_FIELD_CONTENT.equals(field)) { value = event.getContent().toString(); } else if (ITmfEvent.EVENT_FIELD_TYPE.equals(field)) { value = event.getType().getName(); } else if (ITmfEvent.EVENT_FIELD_TIMESTAMP.equals(field)) { value = event.getTimestamp().toString(); } else if (ITmfEvent.EVENT_FIELD_SOURCE.equals(field)) { value = event.getSource(); } else if (ITmfEvent.EVENT_FIELD_REFERENCE.equals(field)) { value = event.getReference(); } else { ITmfEventField eventField; if (!(field.startsWith(SLASH_STRING))) { eventField = event.getContent().getField(field); } else { List<String> list = getPathList(field); ITmfEventField topField = event.getContent(); eventField = getSubField(topField, list); } if (eventField != null) { value = eventField.getValue(); } } return value; }
Source:
public EDDifferentialPrivacy(double epsilon, double delta, DataGeneralizationScheme generalization) { super(delta); this.epsilon = epsilon; this.generalization = generalization; this.beta = calculateBeta(epsilon); this.k = calculateK(getDelta(), epsilon, this.beta); }

Target:
public EDDifferentialPrivacy(double epsilon, double delta, DataGeneralizationScheme generalization) { this(epsilon, delta, generalization, false); }
Source:
public static boolean transferFilesUnderNewStructure (String sourceFolder, String destFolder, String additionalFolder, boolean move, boolean recursive) { boolean result = true; try { File f = new File(sourceFolder); File file[] = f.listFiles(); for (int i = 0; i < file.length; i++) { File sourceFile = file[i]; File destFile = new File(destFolder + File.separator + file[i].getName()); if (!sourceFile.isHidden()) { if (sourceFile.isFile()) { if (additionalFolder != null && additionalFolder.length() > 0) { destFile = createFolder (destFile.getParentFile(), additionalFolder); destFile = new File(destFile, file[i].getName()); } result = copyFile (sourceFile.getPath(), destFile.getPath() ); } else { if (sourceFile.isDirectory() && recursive && !sourceFile.getName().equals(".") && !sourceFile.getName().equals("..") ) { result = transferFilesUnderNewStructure (sourceFile.getPath(), destFile.getPath(), additionalFolder, move, recursive); } } if (!result) break; if (move) sourceFile.delete(); } } return result; } catch (Exception e) { return false; } }

Target:
public static boolean transferFilesUnderNewStructure (String sourceFolder, String destFolder, String additionalFolder, boolean move, boolean recursive) { boolean result = true; try { File f = new File(sourceFolder); File file[] = f.listFiles(); for (int i = 0; i < file.length; i++) { File sourceFile = file[i]; File destFile = new File(destFolder + File.separator + file[i].getName()); if (!sourceFile.isHidden()) { if (sourceFile.isFile()) { if (additionalFolder != null && additionalFolder.length() > 0) { destFile = createFolder (destFile.getParentFile(), additionalFolder); destFile = new File(destFile, file[i].getName()); } result = copyFile (sourceFile.getPath(), destFile.getPath() ); } else { if (sourceFile.isDirectory() && recursive && !sourceFile.getName().equals(".") && !sourceFile.getName().equals("..") ) { result = transferFilesUnderNewStructure (sourceFile.getPath(), destFile.getPath(), additionalFolder, move, recursive); } } if (!result) { Log.e("Alfresco", "File copy failed for " + sourceFile.getName() ); break; } if (move) sourceFile.delete(); } } return result; } catch (Exception e) { Log.e("Alfresco", "Error during file transfer: " + e.getMessage() ); e.printStackTrace(); return false; } }
Source:
public CallStatus call() throws Exception { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); QueryRunner queryRunner = mapServiceContext.getMapQueryRunner(getName()); MapContainer mapContainer = mapServiceContext.getMapContainer(name); switch (mapContainer.getMapConfig().getInMemoryFormat()) { case NATIVE: BitSet localPartitions = localPartitions(); if (localPartitions.cardinality() == 0) { result = queryRunner.populateEmptyResult(query, Collections.<Integer>emptyList()); return DONE_RESPONSE; } return new OffloadedImpl(queryRunner, localPartitions); default: result = queryRunner.runIndexOrPartitionScanQueryOnOwnedPartitions(query); return DONE_RESPONSE; } }

Target:
public CallStatus call() throws Exception { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); QueryRunner queryRunner = mapServiceContext.getMapQueryRunner(getName()); MapContainer mapContainer = mapServiceContext.getMapContainer(name); switch (mapContainer.getMapConfig().getInMemoryFormat()) { case BINARY: case OBJECT: result = queryRunner.runIndexOrPartitionScanQueryOnOwnedPartitions(query); return DONE_RESPONSE; case NATIVE: BitSet localPartitions = localPartitions(); if (localPartitions.cardinality() == 0) { result = queryRunner.populateEmptyResult(query, Collections.<Integer>emptyList()); return DONE_RESPONSE; } else { return new OffloadedImpl(queryRunner, localPartitions); } default: throw new IllegalArgumentException("Unsupported in memory format"); } }
Source:
public Integer invoke() { Integer result = 0; try (InputStream in = cache.getViaStream(key)) { int read = 0; while ((read = in.read(buffer)) != -1) result = result + read; return value = result; } catch (IOException e) { throw new RuntimeException(e); } catch (NullPointerException e) { return null; } }

Target:
public Integer invoke() { Integer result = 0; try (InputStream in = cache.getViaStream(key)) { if (in == null) return null; int read = 0; while ((read = in.read(buffer)) != -1) result = result + read; return value = result; } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public Reader readHtml(final SitePageContext sitePageContext, String pageType, String key, final Set<HtmlElementTransformation> transformations, final Collection<HtmlElementSubstitution> substitutions) throws IOException { Map<String, Object> pageConfig = sitePageContext.getSite().getTheme().getConfigMap(pageType); RemoteCacheKey cacheKey = RemoteCacheKey.create(pageType, key); Number cacheTtl = (Number) pageConfig.get("cacheTtl"); Optional<Integer> version = Optional.absent(); String transformedHtml = requestCachedReader(cacheKey, key, version, new CacheDeserializer<Reader, String>() { @Override public String read(Reader htmlReader) throws IOException { String htmlString = IOUtils.toString(htmlReader); Document document = Jsoup.parseBodyFragment(htmlString); for (HtmlElementTransformation transformation : transformations) { transformation.apply(sitePageContext, siteSet, document); } for (HtmlElementSubstitution substitution : substitutions) { substitution.substitute(document); } return document.getElementsByTag("body").html(); } }); return new StringReader(transformedHtml); }

Target:
public Reader readHtml(final SitePageContext sitePageContext, String pageType, String key, final Set<HtmlElementTransformation> transformations, final Collection<HtmlElementSubstitution> substitutions) throws IOException { RemoteCacheKey cacheKey = RemoteCacheKey.create(RemoteCacheSpace.EDITORIAL_CONTENT, pageType, key); Optional<Integer> version = Optional.absent(); String transformedHtml = requestCachedReader(cacheKey, key, version, (Reader htmlReader) -> { String htmlString = IOUtils.toString(htmlReader); Document document = Jsoup.parseBodyFragment(htmlString); for (HtmlElementTransformation transformation : transformations) { transformation.apply(sitePageContext, siteSet, document); } for (HtmlElementSubstitution substitution : substitutions) { substitution.substitute(document); } return document.getElementsByTag("body").html(); }); return new StringReader(transformedHtml); }
Source:
public Integer getWidthPercent () { if (widthPercent == null || widthPercent == 0){ switch (this.width) { case 12: this.widthPercent = 100; break; case 9: this.widthPercent = 75; break; case 8: this.widthPercent = 66; break; case 6: this.widthPercent = 50; break; case 4: this.widthPercent = 33; break; case 3: this.widthPercent = 25; } } return widthPercent; }

Target:
public Integer getWidthPercent () { if (widthPercent == null || widthPercent == 0){ this.widthPercent = this.mapWithWidthPercent.get(this.width); } return widthPercent; }
Source:
protected String[] customCommandLineValidation() { if (URI == null) { URI = "file:" + REFERENCE.getAbsolutePath(); } if (OUTPUT == null) { final String name = REFERENCE.getName(); final String fastaExt = ReferenceSequenceFileFactory.FASTA_EXTENSIONS.stream() .filter(name::endsWith).findFirst().orElseGet(() -> ""); OUTPUT = new File(REFERENCE.getParentFile(), REFERENCE.getName().replace(fastaExt, IOUtil.DICT_FILE_EXTENSION)); } return null; }

Target:
protected String[] customCommandLineValidation() { if (URI == null) { URI = "file:" + REFERENCE.getAbsolutePath(); } if (OUTPUT == null) { OUTPUT = getDefaultDictionaryForReferenceSequence(REFERENCE); logger.info("Output dictionary will be written in ", OUTPUT); } return null; }
Source:
private void visit( Properties properties ) { if ( properties != null ) { for ( Map.Entry<Object, Object> entry : properties.entrySet() ) { Object v = entry.getValue(); if ( v instanceof String ) { String value = (String) v; String inter = interpolate( value ); if ( value != inter && Objects.nonNull( inter ) ) { entry.setValue( inter ); } } } } }

Target:
private void visit( Properties properties ) { if ( properties != null ) { for ( Map.Entry<Object, Object> entry : properties.entrySet() ) { Object v = entry.getValue(); if ( v instanceof String ) { String value = (String) v; String inter = interpolate( value ); if ( value != inter && inter != null ) { entry.setValue( inter ); } } } } }
Source:
public void onNext(Frame frame) { log.append(new String(frame.getPayload())); }

Target:
public void onNext(Frame frame) { log.info(frame.toString()); }
Source:
public void clear() throws CacheAccessException { boolean interrupted = false; while(!cachingTierRef.compareAndSet(realCachingTier, noopCachingTier)) { synchronized (noopCachingTier) { if(cachingTierRef.get() == noopCachingTier) { try { noopCachingTier.wait(); } catch (InterruptedException e) { interrupted = true; } } } } try { authoritativeTier.clear(); } finally { try { realCachingTier.invalidate(); } finally { if(interrupted) { Thread.currentThread().interrupt(); } if(!cachingTierRef.compareAndSet(noopCachingTier, realCachingTier)) { throw new AssertionError("Something bad happened"); } synchronized (noopCachingTier) { noopCachingTier.notify(); } } } }

Target:
public void clear() throws CacheAccessException { boolean interrupted = false; while(!cachingTierRef.compareAndSet(realCachingTier, noopCachingTier)) { synchronized (noopCachingTier) { if(cachingTierRef.get() == noopCachingTier) { try { noopCachingTier.wait(); } catch (InterruptedException e) { interrupted = true; } } } } if(interrupted) { Thread.currentThread().interrupt(); } try { authoritativeTier.clear(); } finally { try { realCachingTier.invalidate(); } finally { if(!cachingTierRef.compareAndSet(noopCachingTier, realCachingTier)) { throw new AssertionError("Something bad happened"); } synchronized (noopCachingTier) { noopCachingTier.notify(); } } } }
Source:
private @Nullable ScriptingMarkerSource findMarkerSourceFromAdapters(ITmfTrace trace) { for (IMarkerEventSource source : TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class)) { if (source.getClass() == ScriptingMarkerSource.class) { ScriptingMarkerSource markerSource = (ScriptingMarkerSource) source; if (markerSource.getTrace().equals(trace)) { markerSource.initializeAdapterMarkersLists(); fScriptingMarkerSourceMap.put(trace, markerSource); return markerSource; } } } return null; }

Target:
private @Nullable ScriptingMarkerSource findMarkerSourceFromAdapters(ITmfTrace trace) { for (IMarkerEventSource source : TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class)) { if (source instanceof ScriptingMarkerSource) { ScriptingMarkerSource markerSource = (ScriptingMarkerSource) source; if (Objects.equals(markerSource.getTrace(), trace)) { markerSource.initializeAdapterMarkersLists(); fScriptingMarkerSourceMap.put(trace, markerSource); return markerSource; } } } return null; }
Source:
public void testAddInvalidDataToIndex() throws Exception { startGrid(); grid().cluster().state(ClusterState.ACTIVE); sql("CREATE TABLE TEST (ID INT PRIMARY KEY, VAL_INT INT, VAL_DATE DATE) " + "WITH \"CACHE_NAME=test,VALUE_TYPE=ValueType0\""); sql("CREATE INDEX TEST_0_VAL_DATE_IDX ON TEST(VAL_DATE)"); sql("CREATE INDEX TEST_1_VAL_INT_IDX ON TEST(VAL_INT)"); BinaryObjectBuilder bob = grid().binary().builder("ValueType0"); bob.setField("VAL_INT", 10); bob.setField("VAL_DATE", new java.util.Date()); GridTestUtils.assertThrowsAnyCause(log, () -> { grid().cache("test").put(0, bob.build()); return null; }, CachePartialUpdateCheckedException.class, "Failed to update keys"); sql("DROP INDEX TEST_0_VAL_DATE_IDX"); List<List<?>> res = sql("SELECT VAL_INT FROM TEST WHERE VAL_INT > 0").getAll(); assertEquals(1, res.size()); }

Target:
public void testAddInvalidDataToIndex() throws Exception { startGrid(); grid().cluster().state(ClusterState.ACTIVE); sql("CREATE TABLE TEST (ID INT PRIMARY KEY, VAL_INT INT, VAL_DATE DATE) " + "WITH \"CACHE_NAME=test,VALUE_TYPE=ValueType0\""); sql("CREATE INDEX TEST_0_VAL_DATE_IDX ON TEST(VAL_DATE)"); sql("CREATE INDEX TEST_1_VAL_INT_IDX ON TEST(VAL_INT)"); BinaryObjectBuilder bob = grid().binary().builder("ValueType0"); bob.setField("VAL_INT", 10); bob.setField("VAL_DATE", new java.util.Date()); GridTestUtils.assertThrowsAnyCause(log, () -> { grid().cache("test").put(0, bob.build()); return null; }, CachePartialUpdateCheckedException.class, "Failed to update keys"); sql("DROP INDEX TEST_0_VAL_DATE_IDX"); grid().cache("test").put(1, bob.build()); List<List<?>> res = sql("SELECT VAL_INT FROM TEST WHERE VAL_INT > 0").getAll(); assertEquals(2, res.size()); }
Source:
public void close(Duration timeout) { if (timeout.toMillis() < 0) throw new IllegalArgumentException("The timeout cannot be negative."); acquire(); try { if (!closed) { close(timeout.toMillis(), false); closed = true; } } finally { release(); } }

Target:
public void close(Duration timeout) { if (timeout.toMillis() < 0) throw new IllegalArgumentException("The timeout cannot be negative."); acquire(); try { if (!closed) { close(timeout.toMillis(), false); } } finally { closed = true; release(); } }
Source:
public static void lockGroupMembership(Group group, List<Member> members) throws InternalErrorException, InterruptedException { if(group == null) throw new InternalErrorException("Group can't be null when creating lock for group and list of members."); if(members == null || members.isEmpty()) throw new InternalErrorException("Members can't be null or empty when creating lock for group and list of members."); Collections.sort(members); List<Lock> returnedLocks = new ArrayList<>(); try { groupsLocks.putIfAbsent(group, new ReentrantReadWriteLock(true)); Lock readGroupLock = groupsLocks.get(group).readLock(); readGroupLock.lock(); returnedLocks.add(readGroupLock); for (Member member : members) { Map<Member, Lock> newLockForMember = new HashMap<>(); newLockForMember.put(member, new ReentrantLock(true)); groupsMembersLocks.putIfAbsent(group, newLockForMember); Lock memberLock = groupsMembersLocks.get(group).get(member); memberLock.lock(); returnedLocks.add(memberLock); } TransactionSynchronizationManager.bindResource(uniqueKey, returnedLocks); } catch (Exception ex) { unlockAll(returnedLocks); throw ex; } }

Target:
public static void lockGroupMembership(Group group, List<Member> members) throws InternalErrorException, InterruptedException { if(group == null) throw new InternalErrorException("Group can't be null when creating lock for group and list of members."); if(members == null) throw new InternalErrorException("Members can't be null or empty when creating lock for group and list of members."); Collections.sort(members); List<Lock> returnedLocks = new ArrayList<>(); try { ReadWriteLock groupReadWriteLock = groupsLocks.get(group); if(groupReadWriteLock == null) { groupsLocks.putIfAbsent(group, new ReentrantReadWriteLock(true)); groupReadWriteLock = groupsLocks.get(group); } groupReadWriteLock.readLock().lock(); returnedLocks.add(groupReadWriteLock.readLock()); for (Member member : members) { ConcurrentHashMap<Member, Lock> membersLocks = groupsMembersLocks.get(group); if(membersLocks == null) { groupsMembersLocks.putIfAbsent(group, new ConcurrentHashMap<Member, Lock>()); membersLocks = groupsMembersLocks.get(group); } Lock memberLock = membersLocks.get(member); if(memberLock == null) { membersLocks.putIfAbsent(member, new ReentrantLock(true)); memberLock = membersLocks.get(member); } memberLock.lock(); returnedLocks.add(memberLock); } if(TransactionSynchronizationManager.getResource(uniqueKey) == null) { TransactionSynchronizationManager.bindResource(uniqueKey, returnedLocks); } else { ((List<Lock>) TransactionSynchronizationManager.getResource(uniqueKey)).addAll(returnedLocks); } } catch (Exception ex) { unlockAll(returnedLocks); throw ex; } }
Source:
public Pair<Node, JsonObj> optimizePushdown(JobConf jobConf, Deserializer deserializer, ExprNodeDesc exprNodeDesc) { if (exprNodeDesc == null) { return new Pair<Node, JsonObj>(null, null); } Settings settings = HadoopSettingsManager.loadFrom(jobConf); boolean isES50 = SettingsUtils.isEs50(settings); log.info("[PushDown][isES50] : " + isES50); SargableParser sargableParser = EsSargableParser.getInstance(); if (sargableParser == null) { return new Pair<Node, JsonObj>(null, null); } FieldAlias fieldAlias = HiveUtils.alias(settings); HiveTreeBuilder hiveTreeBuilder = new HiveTreeBuilder(fieldAlias, sargableParser); EsTreeParser parser = new EsTreeParser(sargableParser, isES50); String preFilterQuery = settings.getQuery(); if (StringUtils.isNotEmpty(preFilterQuery)) { QueryBuilder rawQuery = QueryUtils.parseQuery(settings); if (rawQuery != null && !(rawQuery instanceof MatchAllQueryBuilder)) { log.info("[PushDown][Pre Filter " + ES_QUERY + "] : " + preFilterQuery); JsonObj preFilterJson = new EsQueryParser(rawQuery, isES50).parse(); parser.setPreFilterJson(preFilterJson); } } OpNode root = hiveTreeBuilder.build(exprNodeDesc); if (root != null) { JsonObj esQuery = parser.parse(root); if (esQuery != null) { log.info("[PushDown][Final Filter " + ES_QUERY + "] : " + esQuery.toQuery()); } return new Pair<Node, JsonObj>(root, esQuery); } return new Pair<Node, JsonObj>(null, null); }

Target:
private Pair<Node, JsonObj> optimizePushdown(JobConf jobConf, Deserializer deserializer, ExprNodeDesc exprNodeDesc) { if (exprNodeDesc == null) { return new Pair<Node, JsonObj>(null, null); } Settings settings = HadoopSettingsManager.loadFrom(jobConf); boolean isES50 = SettingsUtils.isEs50(settings); SargableParser sargableParser = new EsSargableParser(); FieldAlias fieldAlias = HiveUtils.alias(settings); HiveTreeBuilder hiveTreeBuilder = new HiveTreeBuilder(fieldAlias, sargableParser); EsTreeParser parser = new EsTreeParser(sargableParser, isES50); OpNode root = hiveTreeBuilder.build(exprNodeDesc); if (root != null) { JsonObj filters = parser.parse(root); if (filters != null) { log.info("[PushDown][Final Filter " + InternalConfigurationOptions.INTERNAL_ES_QUERY_FILTERS + "] : " + filters.toQuery()); } return new Pair<Node, JsonObj>(root, filters); } return new Pair<Node, JsonObj>(null, null); }
Source:
private Set<Point> getStraightPath( Point origin, Point delta, int length, boolean includeImpassable ){ Set<Point> points = new HashSet<>(); Rectangle bounds = new Rectangle(size); Point current = new Point(origin); for (int i=0; i<length; i++){ current.translate(delta.x, delta.y); if ( bounds.contains(current) && (includeImpassable || isPassable(current)) && !hasTypeAt(Pillar.class, current) ){ points.add(new Point(current)); } else { break; } } return points; }

Target:
private Set<Point> getStraightPath( Point origin, Point delta, int length, boolean includeImpassable ){ Set<Point> points = new HashSet<>(); Rectangle bounds = new Rectangle(size); Point current = new Point(origin); for (int i=0; i<length; i++){ current.translate(delta.x, delta.y); if (bounds.contains(current)){ if ( (includeImpassable || isPassable(current)) && !hasTypeAt(Pillar.class, current) ){ points.add(new Point(current)); } if (!isPassable(current)){ break; } } } return points; }
Source:
private boolean shouldBeDistributed(PlanNode planNode) { return planNode instanceof AggregationNode || planNode instanceof JoinNode || (planNode instanceof TopNNode && ((TopNNode) planNode).getStep().equals(TopNNode.Step.PARTIAL)); }

Target:
private boolean shouldBeDistributed(PlanNode planNode) { if (planNode instanceof JoinNode) { return true; } if (planNode instanceof AggregationNode) { return true; } if (planNode instanceof TopNNode) { return ((TopNNode) planNode).getStep() == TopNNode.Step.PARTIAL; } return false; }
Source:
public void fillMap(EventFields event, Key key, Value value) { List<Map.Entry<Key,Value>> map = null; try { map = decodeRow(key, value); } catch (Exception e) { } try { if(map != null) { for(Map.Entry<Key,Value> kv : map) { if(visibilityEvaluator.evaluate(kv.getKey().getColumnVisibilityParsed())) { String colq = kv.getKey().getColumnQualifier().toString(); int idx = colq.indexOf(NULL_BYTE); String fieldName = colq.substring(0, idx); String fieldValue = colq.substring(idx + 1); event.put(fieldName, new FieldValue(getColumnVisibility(kv.getKey()), fieldValue.getBytes(), kv.getValue().get())); } } } } catch(Exception e) { throw new RuntimeException(e); } }

Target:
public void fillMap(EventFields event, Key key, Value value) { List<Map.Entry<Key,Value>> entryList = Collections.emptyList(); try { entryList = decodeRow(key, value); } catch (Exception e) { } try { for(Map.Entry<Key,Value> kv : entryList) { String colq = kv.getKey().getColumnQualifier().toString(); int idx = colq.indexOf(NULL_BYTE); String fieldName = colq.substring(0, idx); String fieldValue = colq.substring(idx + 1); event.put(fieldName, new EventFields.FieldValue(getColumnVisibility(kv.getKey()), fieldValue.getBytes(), kv.getValue().get())); } } catch(Exception e) { throw new RuntimeException(e); } }
Source:
public void schemaReaderTest() throws Exception { MsAccessSchemaReader schemaReader = new MsAccessSchemaReader(); schemaReader.setSource(new FileIOSupplier(getSourceTempFilePath())); schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(USER_NAME)); schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(PASSWORD)); schemaReader.setIsSchemaNameQuoted(false); IOReport report = schemaReader.execute(new LogProgressIndicator()); assertTrue(report.isSuccess()); Schema schema = schemaReader.getSchema(); Collection<? extends TypeDefinition> k = schema.getTypes(); for (TypeDefinition def : k) System.out.println(def.getDisplayName()); assertTrue(schema != null); }

Target:
public void schemaReaderTest() throws Exception { MsAccessSchemaReader schemaReader = new MsAccessSchemaReader(); schemaReader.setSource(new FileIOSupplier(getSourceTempFilePath())); schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(USER_NAME)); schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(PASSWORD)); IOReport report = schemaReader.execute(new LogProgressIndicator()); assertTrue(report.isSuccess()); TEMP_SOURCE_FILE_NAME = null; Schema schema = schemaReader.getSchema(); assertTrue(schema != null); Collection<? extends TypeDefinition> k = schema.getMappingRelevantTypes(); for (TypeDefinition def : k) System.out.println(def.getDisplayName()); checkTables(k); }
Source:
Class<?> forName(String name) throws ClassNotFoundException { if (preferredLoader != null) { return classForName(name, preferredLoader); } try { return classForName(name, contextLoader); } catch (ClassNotFoundException e) { if (JHelper.objectSameReference(callerLoader, contextLoader)) { throw e; } else { return classForName(name, callerLoader); } } }

Target:
Class<?> forName(String name) throws ClassNotFoundException { if (preferredLoader != null) { return classForName(name, preferredLoader); } try { return classForName(name, contextLoader); } catch (ClassNotFoundException e) { if (callerLoader == contextLoader) { throw e; } else { return classForName(name, callerLoader); } } }
Source:
BasicAuthInterceptor(ZipkinElasticsearchHttpStorageProperties es) { this.es = es; }

Target:
BasicAuthInterceptor(ZipkinElasticsearchHttpStorageProperties es) { basicCredentials = Credentials.basic(es.getUsername(), es.getPassword()); }
Source:
public void stop(StopContext context) { JChannel channel = this.getValue(); channel.disconnect(); if (channel instanceof JChannel) { try { JmxConfigurator.unregisterChannel((JChannel) channel, this.server.getValue(), this.name); } catch (Exception e) { LOGGER.debug(e.getMessage(), e); } } }

Target:
public void stop(StopContext context) { JChannel channel = this.getValue(); channel.disconnect(); try { JmxConfigurator.unregisterChannel(channel, this.server.getValue(), this.name); } catch (Exception e) { LOGGER.debug(e.getMessage(), e); } }
Source:
public void should_report_warnings_per_axis() { String file = "matrix-warnings.txt"; MatrixProject job = setupJob("/warnings_plugin/" + file, MatrixProject.class, WarningsBuildSettings.class, new AnalysisConfigurator<WarningsBuildSettings>() { @Override public void configure(WarningsBuildSettings settings) { settings.addConsoleParser("GNU C Compiler 4 (gcc)"); } }); job.configure(); job.addUserAxis("user_axis", "one two three"); job.addShellStep("cat " + file + "| grep $user_axis"); job.save(); Build build = buildSuccessfulJob(job); String title = "GNU C Compiler Warnings"; assertThatActionExists(job, build, title); build.open(); assertThat(driver, hasContent(title + ": 12")); Map<String, Integer> warningsPerAxis = new HashMap<>(); warningsPerAxis.put("user_axis=one", 4); warningsPerAxis.put("user_axis=two", 6); warningsPerAxis.put("user_axis=three", 2); for (MatrixConfiguration axis : job.getConfigurations()) { Build axisBuild = axis.getLastBuild(); assertThat(axisBuild, hasAction(title)); assertThat(driver, hasContent(title + ": " + warningsPerAxis.get(axis.name))); } try { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { } driver.navigate().refresh(); assertThatConfigurationTabIsCorrectlyFilled(job); assertThatFoldersTabIsCorrectlyFilled(job); assertThatFilesTabIsCorrectlyFilled(job); }

Target:
public void should_report_warnings_per_axis() { String file = "matrix-warnings.txt"; MatrixProject job = setupJob("/warnings_plugin/" + file, MatrixProject.class, WarningsBuildSettings.class, new AnalysisConfigurator<WarningsBuildSettings>() { @Override public void configure(WarningsBuildSettings settings) { settings.addConsoleParser("GNU C Compiler 4 (gcc)"); } }); job.configure(); job.addUserAxis("user_axis", "one two three"); job.addShellStep("cat " + file + "| grep $user_axis"); job.save(); Build build = buildSuccessfulJob(job); String title = "GNU C Compiler Warnings"; assertThatActionExists(job, build, title); build.open(); assertThat(driver, hasContent(title + ": 12")); Map<String, Integer> warningsPerAxis = new HashMap<>(); warningsPerAxis.put("user_axis=one", 4); warningsPerAxis.put("user_axis=two", 6); warningsPerAxis.put("user_axis=three", 2); for (MatrixConfiguration axis : job.getConfigurations()) { Build axisBuild = axis.getLastBuild(); assertThat(axisBuild, hasAction(title)); assertThat(driver, hasContent(title + ": " + warningsPerAxis.get(axis.name))); } sleep(1000); driver.navigate().refresh(); assertThatConfigurationTabIsCorrectlyFilled(job); assertThatFoldersTabIsCorrectlyFilled(job); assertThatFilesTabIsCorrectlyFilled(job); }
Source:
private void setResponseHeaders(BlobInfo blobInfo) throws RestServiceException { BlobProperties blobProperties = blobInfo.getBlobProperties(); restResponseChannel.setStatus(ResponseStatus.Ok); restResponseChannel.setLastModified(new Date(blobProperties.getCreationTimeInMs())); restResponseChannel.setContentLength(blobProperties.getBlobSize()); restResponseChannel.setHeader(RestUtils.Headers.Blob_Size, blobProperties.getBlobSize()); restResponseChannel.setHeader(RestUtils.Headers.Service_Id, blobProperties.getServiceId()); restResponseChannel.setHeader(RestUtils.Headers.Creation_Time, new Date(blobProperties.getCreationTimeInMs())); restResponseChannel.setHeader(RestUtils.Headers.Private, blobProperties.isPrivate()); if (blobProperties.getTimeToLiveInSeconds() != Utils.Infinite_Time) { restResponseChannel.setHeader(RestUtils.Headers.TTL, Long.toString(blobProperties.getTimeToLiveInSeconds())); } if (blobProperties.getContentType() != null) { restResponseChannel.setHeader(RestUtils.Headers.Content_Type, blobProperties.getContentType()); restResponseChannel.setContentType(blobProperties.getContentType()); } if (blobProperties.getOwnerId() != null) { restResponseChannel.setHeader(RestUtils.Headers.Owner_Id, blobProperties.getOwnerId()); } byte[] userMetadataArray = blobInfo.getUserMetadata(); Map<String, List<String>> userMetadata = RestUtils.getUserMetadataFromByteArray(userMetadataArray); for (String key : userMetadata.keySet()) { restResponseChannel.setHeader(key, RestUtils.getHeaderValueFromList(userMetadata.get(key))); } }

Target:
private void setResponseHeaders(BlobInfo blobInfo) throws RestServiceException { BlobProperties blobProperties = blobInfo.getBlobProperties(); restResponseChannel.setStatus(ResponseStatus.Ok); restResponseChannel.setLastModified(new Date(blobProperties.getCreationTimeInMs())); restResponseChannel.setContentLength(blobProperties.getBlobSize()); restResponseChannel.setHeader(RestUtils.Headers.Blob_Size, blobProperties.getBlobSize()); restResponseChannel.setHeader(RestUtils.Headers.Service_Id, blobProperties.getServiceId()); restResponseChannel.setHeader(RestUtils.Headers.Creation_Time, new Date(blobProperties.getCreationTimeInMs())); restResponseChannel.setHeader(RestUtils.Headers.Private, blobProperties.isPrivate()); if (blobProperties.getTimeToLiveInSeconds() != Utils.Infinite_Time) { restResponseChannel.setHeader(RestUtils.Headers.TTL, Long.toString(blobProperties.getTimeToLiveInSeconds())); } if (blobProperties.getContentType() != null) { restResponseChannel.setHeader(RestUtils.Headers.Content_Type, blobProperties.getContentType()); restResponseChannel.setContentType(blobProperties.getContentType()); } if (blobProperties.getOwnerId() != null) { restResponseChannel.setHeader(RestUtils.Headers.Owner_Id, blobProperties.getOwnerId()); } byte[] userMetadataArray = blobInfo.getUserMetadata(); Map<String, String> userMetadata = RestUtils.buildUserMetadata(userMetadataArray); for (Map.Entry<String, String> entry : userMetadata.entrySet()) { restResponseChannel.setHeader(entry.getKey(), entry.getValue()); } }
Source:
public List<LongSplit> snapshotState(long checkpointId) { if (split == null) { return Collections.emptyList(); } throttle = split.numCompletedCheckpoints >= minCheckpoints; LOG.info("Snapshotted @ subtask (~{} attempt)", split, split.nextNumber % split.increment, numRestarts); return singletonList(split); }

Target:
public List<LongSplit> snapshotState(long checkpointId) { if (split == null) { return Collections.emptyList(); } throttle = split.numCompletedCheckpoints >= minCheckpoints; LOG.info("Snapshotted @ subtask ({} attempt)", split, split.nextNumber % split.increment, numRestarts); return singletonList(split); }
Source:
public void outjectRequestMap() { for (ValuedParameter vparameter : methodInfo.getValuedParameters()) { result.include(vparameter.getParameter().getName(), vparameter.getValue()); } }

Target:
public void outjectRequestMap() { for (ValuedParameter vparameter : methodInfo.getValuedParameters()) { result.include(vparameter.getName(), vparameter.getValue()); } }
Source:
public List<RemoteReference> lsRemote(LsRemoteRequest request) throws UnauthorizedException, GitException { String remoteUrl = request.getRemoteUrl(); LsRemoteCommand lsRemoteCommand = getGit().lsRemote(); lsRemoteCommand.setRemote(remoteUrl); Collection<Ref> refs; try { refs = lsRemoteCommand.call(); } catch (GitAPIException exception) { if (exception.getMessage().contains(ERROR_AUTHENTICATION_REQUIRED)) { throw new UnauthorizedException(String.format(ERROR_AUTHENTICATION_FAILED, remoteUrl)); } else { throw new GitException(exception.getMessage(), exception); } } List<RemoteReference> remoteRefs = new ArrayList<>(refs.size()); for (Ref ref : refs) { String commitId = ref.getObjectId().name(); String name = ref.getName(); RemoteReference remoteRef = newDto(RemoteReference.class).withCommitId(commitId).withReferenceName(name); remoteRefs.add(remoteRef); } return remoteRefs; }

Target:
public List<RemoteReference> lsRemote(LsRemoteRequest request) throws UnauthorizedException, GitException { String remoteUrl = request.getRemoteUrl(); LsRemoteCommand lsRemoteCommand = getGit().lsRemote().setRemote(remoteUrl); Collection<Ref> refs; try { refs = lsRemoteCommand.call(); } catch (GitAPIException exception) { if (exception.getMessage().contains(ERROR_AUTHENTICATION_REQUIRED)) { throw new UnauthorizedException(String.format(ERROR_AUTHENTICATION_FAILED, remoteUrl)); } else { throw new GitException(exception.getMessage(), exception); } } return refs.stream() .map(ref -> newDto(RemoteReference.class).withCommitId(ref.getObjectId().name()).withReferenceName(ref.getName())) .collect(Collectors.toList()); }
Source:
private static void appendMyPlacesLayers(final JSONArray layerList, final List<Long> publishedMyPlaces, final User user, final long viewID, final Set<String> bundleIds, final String mapSrs, final boolean useDirectURL, final boolean modifyURLs, final JSONArray plugins) { if (publishedMyPlaces.isEmpty()) { return; } final boolean myPlacesBundlePresent = isMyplacesBundlePresent(bundleIds); final String uuid = user.getUuid(); final List<MyPlaceCategory> myPlacesLayers = myPlaceService .getMyPlaceLayersById(publishedMyPlaces); for (MyPlaceCategory mpLayer : myPlacesLayers) { if (!mpLayer.isPublished() && !mpLayer.isOwnedBy(uuid)) { LOGGER.info("Found my places layer in selected that is no longer published. ViewID:", viewID, "Myplaces layerId:", mpLayer.getId()); continue; } if (myPlacesBundlePresent && mpLayer.isOwnedBy(uuid)) { continue; } JSONObject myPlaceLayer = null; if (plugins != null && plugins.toString().indexOf(PLUGIN_WFSVECTORLAYER) != -1) { myPlaceLayer = MyPlacesService.parseLayerToJSON(mpLayer, mapSrs); JSONHelper.putValue(myPlaceLayer, LayerJSONFormatter.KEY_TYPE, OskariLayer.TYPE_WFS); } if (myPlaceLayer != null) { layerList.put(myPlaceLayer); } } }

Target:
private static void appendMyPlacesLayers(final JSONArray layerList, final List<Long> publishedMyPlaces, final User user, final long viewID, final Set<String> bundleIds, final String mapSrs, final boolean useDirectURL, final boolean modifyURLs, final JSONArray plugins) { if (publishedMyPlaces.isEmpty()) { return; } final boolean myPlacesBundlePresent = isMyplacesBundlePresent(bundleIds); final String uuid = user.getUuid(); final List<MyPlaceCategory> myPlacesLayers = myPlaceService .getMyPlaceLayersById(publishedMyPlaces); for (MyPlaceCategory mpLayer : myPlacesLayers) { if (!mpLayer.isPublished() && !mpLayer.isOwnedBy(uuid)) { LOGGER.info("Found my places layer in selected that is no longer published. ViewID:", viewID, "Myplaces layerId:", mpLayer.getId()); continue; } if (myPlacesBundlePresent && mpLayer.isOwnedBy(uuid)) { continue; } JSONObject myPlaceLayer = MyPlacesService.parseLayerToJSON(mpLayer, mapSrs); JSONHelper.putValue(myPlaceLayer, LayerJSONFormatter.KEY_TYPE, OskariLayer.TYPE_WFS); layerList.put(myPlaceLayer); } }
Source:
public URI getSvnUrl() throws SubversionPluginTestException { String url = PROTOCOL_SVN + ipBound(80) + ':' + port(3690); return createUri(url); }

Target:
public URI getSvnUrl() throws SubversionPluginTestException { String url = PROTOCOL_SVN + ipBound(3690) + ':' + port(3690); return createUri(url); }
Source:
protected Optional<TypedValue> getValue(String name, StatementContext ctx2) { @SuppressWarnings("unchecked") PojoProperty<Object> property = (PojoProperty<Object>) properties.getProperties().get(name); if (property == null) { return Optional.empty(); } return Optional.of(new TypedValue(property.getQualifiedType(), property.get(obj))); }

Target:
protected Optional<TypedValue> getValue(String name, StatementContext ctx2) { @SuppressWarnings("unchecked") PojoProperty<Object> property = (PojoProperty<Object>) properties.getProperties().get(name); return Optional.ofNullable(property) .map(p -> new TypedValue(p.getQualifiedType(), p.get(obj))); }
Source:
public static boolean isInvalidBranchName(String branchName) { if (HEAD.equals(branchName)) { return true; } if ((R_HEADS + HEAD).equals(branchName)) { return true; } return branchName.startsWith("-"); }

Target:
public static boolean isInvalidBranchName(String branchName) { if (HEAD.equals(branchName)) { return true; } return branchName.startsWith("-"); }
Source:
public List<DevfileLocation> devfileFileLocations() { return devfileFilenames .stream() .map( f -> new DevfileLocation() { @Override public Optional<String> filename() { return Optional.ofNullable(f); } @Override public String location() { return rawFileLocation(f); } }) .collect(Collectors.toList()); }

Target:
public List<DevfileLocation> devfileFileLocations() { return devfileFilenames.stream().map(this::createDevfileLocation).collect(Collectors.toList()); }
Source:
public void setUp() { setting = new SettingImpl<>(new SimpleUri("engine-tests:TestSetting"), 50, new RangedNumberValidator<>(0, 100, false, false)); eventResult = -1; setting.subscribe(propertyChangeEvent -> eventResult = (int) propertyChangeEvent.getNewValue()); }

Target:
public void setUp() { setting = new SettingImpl<>(SETTING_ID, 50, new RangedNumberValidator<>(0, 100, false, false)); eventResult = -1; setting.subscribe(propertyChangeEvent -> eventResult = (int) propertyChangeEvent.getNewValue()); }
Source:
private boolean isMethodAGetter(final ASTMethod method) { final Pattern p = Pattern.compile("^(string|void)$", Pattern.CASE_INSENSITIVE); final boolean startsWithGet = method.getNode().getMethodInfo().getCanonicalName().startsWith("get"); final boolean voidOrString = p .matcher(method.getNode().getMethodInfo().getEmitSignature().getReturnType().getApexName()).matches(); return (startsWithGet && !voidOrString); }

Target:
private boolean isMethodAGetter(final ASTMethod method) { final boolean startsWithGet = method.getNode().getMethodInfo().getCanonicalName().startsWith("get"); final boolean voidOrString = IS_STRING_OR_VOID_PATTERN .matcher(method.getNode().getMethodInfo().getEmitSignature().getReturnType().getApexName()).matches(); return (startsWithGet && !voidOrString); }
Source:
public void executeTask() throws MojoExecutionException, MojoFailureException { if (serverId == null) { File currentProperties = wizard.getCurrentServerPath(); if (currentProperties != null) serverId = currentProperties.getName(); } serverId = wizard.promptForExistingServerIdIfMissing(serverId); Server server = Server.loadServer(serverId); File serverPath = server.getServerDirectory(); serverPath.mkdirs(); File userDir = new File(System.getProperty("user.dir")); if (Project.hasProject(userDir)) { Project config = Project.loadProject(userDir); if (config.isOpenmrsModule()) { String artifactId = config.getArtifactId(); String groupId = config.getGroupId(); String version = config.getVersion(); if ((artifactId != null) && (groupId != null) && version != null) { getLog().info("OpenMRS module detected, installing before run..."); Deploy deployer = new Deploy(this); deployer.deployModule(serverPath.getName(), groupId, artifactId, version); } } } try { File tempFolder = createTempReactorProject(server); cleanInstallModule(tempFolder.getPath()); deleteTempReactorProject(tempFolder); deployWatchedModules(server); } catch (MavenInvocationException e) { throw new MojoFailureException(e.getMessage()); } if (Boolean.FALSE.equals(fork)) { new RunTomcat(serverId, port, wizard).execute(); } else { runInFork(server); } }

Target:
public void executeTask() throws MojoExecutionException, MojoFailureException { if (serverId == null) { File currentProperties = wizard.getCurrentServerPath(); if (currentProperties != null) serverId = currentProperties.getName(); } serverId = wizard.promptForExistingServerIdIfMissing(serverId); Server server = Server.loadServer(serverId); File serverPath = server.getServerDirectory(); serverPath.mkdirs(); File userDir = new File(System.getProperty("user.dir")); if (Project.hasProject(userDir)) { Project config = Project.loadProject(userDir); if (config.isOpenmrsModule()) { String artifactId = config.getArtifactId(); String groupId = config.getGroupId(); String version = config.getVersion(); if ((artifactId != null) && (groupId != null) && version != null) { getLog().info("OpenMRS module detected, installing before run..."); Deploy deployer = new Deploy(this); deployer.deployModule(serverPath.getName(), groupId, artifactId, version); } } } if (server.hasWatchedProjects()) { File tempFolder = createTempReactorProject(server); cleanInstallServerProject(tempFolder.getPath()); deleteTempReactorProject(tempFolder); try { deployWatchedModules(server); } catch (MavenInvocationException e) { throw new MojoFailureException("Failed to deploy watched modules", e); } } if (Boolean.FALSE.equals(fork)) { new RunTomcat(serverId, port, wizard).execute(); } else { runInFork(server); } }